drivers: thermal: bcl-pmic5: clean up PMIC v5 BCL driver
Clean up PMIC v5 BCL driver. It includes rename driver, remove redundant debug logs, remove WARN_ON from ISR etc. Change-Id: Ia6a3a406c6f139cfa6741e4e2f08dc9cd4e4bdaa Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
This commit is contained in:
parent
d4dd9e52e3
commit
e49406e787
7 changed files with 28 additions and 36 deletions
|
|
@ -14,7 +14,7 @@ with the multiple BCL peripherals.
|
|||
|
||||
Required Parameters:
|
||||
- compatible: must be
|
||||
'qcom,msm-bcl-pmic5' for bcl peripheral in PMIC version 5.
|
||||
'qcom,bcl-v5' for bcl peripheral in PMIC version 5.
|
||||
- reg: <a b> where 'a' is the starting register address of the PMIC
|
||||
peripheral and 'b' is the size of the peripheral address space.
|
||||
- interrupts: <a b c> Where 'a' is the SLAVE ID of the PMIC, 'b' is
|
||||
|
|
@ -27,11 +27,11 @@ Required Parameters:
|
|||
"bcl-high-ibat"
|
||||
|
||||
Example:
|
||||
bcl@4200 {
|
||||
compatible = "qcom,msm-bcl-pmic5";
|
||||
reg = <0x4200 0xFF>;
|
||||
interrupts = <0x2 0x42 0x0>,
|
||||
<0x2 0x42 0x1>;
|
||||
interrupt-names = "bcl-high-ibat",
|
||||
"bcl-low-vbat";
|
||||
};
|
||||
bcl@4200 {
|
||||
compatible = "qcom,bcl-v5";
|
||||
reg = <0x4200 0x100>;
|
||||
interrupts = <0x2 0x42 0x0>,
|
||||
<0x2 0x42 0x1>;
|
||||
interrupt-names = "bcl-high-ibat",
|
||||
"bcl-low-vbat";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -414,8 +414,8 @@
|
|||
};
|
||||
|
||||
bcl_sensor: bcl@3d00 {
|
||||
compatible = "qcom,msm-bcl-pmic5";
|
||||
reg = <0x3d00 0xff>;
|
||||
compatible = "qcom,bcl-v5";
|
||||
reg = <0x3d00 0x100>;
|
||||
interrupts = <0x2 0x3d 0x0 IRQ_TYPE_NONE>,
|
||||
<0x2 0x3d 0x1 IRQ_TYPE_NONE>;
|
||||
interrupt-names = "bcl-high-ibat",
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ CONFIG_THERMAL_TSENS=y
|
|||
CONFIG_QTI_VIRTUAL_SENSOR=y
|
||||
CONFIG_QTI_QMI_COOLING_DEVICE=y
|
||||
CONFIG_REGULATOR_COOLING_DEVICE=y
|
||||
CONFIG_MSM_BCL_PMIC5=y
|
||||
CONFIG_QTI_BCL_PMIC5=y
|
||||
CONFIG_QTI_BCL_SOC_DRIVER=y
|
||||
CONFIG_MFD_SPMI_PMIC=y
|
||||
CONFIG_REGULATOR_FIXED_VOLTAGE=y
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ CONFIG_THERMAL_TSENS=y
|
|||
CONFIG_QTI_VIRTUAL_SENSOR=y
|
||||
CONFIG_QTI_QMI_COOLING_DEVICE=y
|
||||
CONFIG_REGULATOR_COOLING_DEVICE=y
|
||||
CONFIG_MSM_BCL_PMIC5=y
|
||||
CONFIG_QTI_BCL_PMIC5=y
|
||||
CONFIG_QTI_BCL_SOC_DRIVER=y
|
||||
CONFIG_MFD_SPMI_PMIC=y
|
||||
CONFIG_REGULATOR_FIXED_VOLTAGE=y
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ config REGULATOR_COOLING_DEVICE
|
|||
|
||||
If you want this support, you should say Y here.
|
||||
|
||||
config MSM_BCL_PMIC5
|
||||
config QTI_BCL_PMIC5
|
||||
bool "BCL driver for BCL peripherals in PMIC5"
|
||||
depends on SPMI && THERMAL_OF
|
||||
help
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ obj-$(CONFIG_QTI_VIRTUAL_SENSOR) += qti_virtual_sensor.o
|
|||
obj-$(CONFIG_QTI_AOP_REG_COOLING_DEVICE) += regulator_aop_cdev.o
|
||||
obj-$(CONFIG_REGULATOR_COOLING_DEVICE) += regulator_cdev.o
|
||||
obj-$(CONFIG_QTI_QMI_COOLING_DEVICE) += thermal_mitigation_device_service_v01.o qmi_cooling.o
|
||||
obj-$(CONFIG_MSM_BCL_PMIC5) += bcl_pmic5.o
|
||||
obj-$(CONFIG_QTI_BCL_PMIC5) += bcl_pmic5.o
|
||||
obj-$(CONFIG_QTI_BCL_SOC_DRIVER) += bcl_soc.o
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ static char bcl_int_names[BCL_TYPE_MAX][25] = {
|
|||
"bcl-very-high-ibat",
|
||||
"bcl-low-vbat",
|
||||
"bcl-very-low-vbat",
|
||||
"bcl-crit-low-vbat"
|
||||
"bcl-crit-low-vbat",
|
||||
};
|
||||
|
||||
struct bcl_peripheral_data {
|
||||
|
|
@ -93,10 +93,9 @@ static int bcl_read_register(int16_t reg_offset, unsigned int *data)
|
|||
ret = regmap_read(bcl_perph->regmap,
|
||||
(bcl_perph->fg_bcl_addr + reg_offset),
|
||||
data);
|
||||
if (ret < 0) {
|
||||
pr_err("Error reading register %d. err:%d", reg_offset, ret);
|
||||
return ret;
|
||||
}
|
||||
if (ret < 0)
|
||||
pr_err("Error reading register %d. err:%d\n",
|
||||
reg_offset, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -113,7 +112,8 @@ static int bcl_write_general_register(int16_t reg_offset,
|
|||
}
|
||||
ret = regmap_write(bcl_perph->regmap, (base + reg_offset), *write_buf);
|
||||
if (ret < 0) {
|
||||
pr_err("Error reading register %d. err:%d", reg_offset, ret);
|
||||
pr_err("Error reading register %d. err:%d\n",
|
||||
reg_offset, ret);
|
||||
return ret;
|
||||
}
|
||||
pr_debug("wrote 0x%02x to 0x%04x\n", data, base + reg_offset);
|
||||
|
|
@ -192,10 +192,8 @@ static int bcl_set_ibat(void *data, int low, int high)
|
|||
goto set_trip_exit;
|
||||
}
|
||||
ret = bcl_write_register(addr, val);
|
||||
if (ret) {
|
||||
pr_err("Error accessing BCL peripheral. err:%d\n", ret);
|
||||
if (ret)
|
||||
goto set_trip_exit;
|
||||
}
|
||||
bat_data->trip_thresh = ibat_ua;
|
||||
|
||||
if (bat_data->irq_num && !bat_data->irq_enabled) {
|
||||
|
|
@ -218,10 +216,8 @@ static int bcl_read_ibat(void *data, int *adc_value)
|
|||
|
||||
*adc_value = val;
|
||||
ret = bcl_read_register(BCL_IBAT_READ, &val);
|
||||
if (ret) {
|
||||
pr_err("BCL register read error. err:%d\n", ret);
|
||||
if (ret)
|
||||
goto bcl_read_exit;
|
||||
}
|
||||
*adc_value = val;
|
||||
if (*adc_value == 0) {
|
||||
/*
|
||||
|
|
@ -258,10 +254,8 @@ static int bcl_get_vbat_trip(void *data, int type, int *trip)
|
|||
return -ENODEV;
|
||||
|
||||
ret = bcl_read_register(addr, &val);
|
||||
if (ret) {
|
||||
pr_err("BCL register read error. err:%d\n", ret);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (addr == BCL_VBAT_ADC_LOW) {
|
||||
*trip = val;
|
||||
|
|
@ -317,10 +311,8 @@ static int bcl_read_vbat(void *data, int *adc_value)
|
|||
|
||||
*adc_value = val;
|
||||
ret = bcl_read_register(BCL_VBAT_READ, &val);
|
||||
if (ret) {
|
||||
pr_err("BCL register read error. err:%d\n", ret);
|
||||
if (ret)
|
||||
goto bcl_read_exit;
|
||||
}
|
||||
*adc_value = val;
|
||||
if (*adc_value == BCL_VBAT_NO_READING) {
|
||||
*adc_value = bat_data->last_val;
|
||||
|
|
@ -341,7 +333,7 @@ static irqreturn_t bcl_handle_irq(int irq, void *data)
|
|||
|
||||
mutex_lock(&perph_data->state_trans_lock);
|
||||
if (!perph_data->irq_enabled) {
|
||||
WARN_ON(1);
|
||||
pr_err("irq:%d not in expected state\n", irq);
|
||||
disable_irq_nosync(irq);
|
||||
perph_data->irq_enabled = false;
|
||||
goto exit_intr;
|
||||
|
|
@ -396,7 +388,7 @@ static void bcl_fetch_trip(struct platform_device *pdev, const char *int_name,
|
|||
int_name, data);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev,
|
||||
"Error requesting trip irq. err:%d",
|
||||
"Error requesting trip irq. err:%d\n",
|
||||
ret);
|
||||
mutex_unlock(&data->state_trans_lock);
|
||||
return;
|
||||
|
|
@ -511,7 +503,7 @@ static int bcl_probe(struct platform_device *pdev)
|
|||
|
||||
static const struct of_device_id bcl_match[] = {
|
||||
{
|
||||
.compatible = "qcom,msm-bcl-pmic5",
|
||||
.compatible = "qcom,bcl-v5",
|
||||
},
|
||||
{},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue