kernel:thermal bat thermistor change
authorxuwei9 <xuwei9@lenovo.com>
Fri, 15 Feb 2019 13:25:10 +0000 (21:25 +0800)
committerlingsen1 <lingsen1@lenovo.com>
Sun, 7 Feb 2021 09:36:57 +0000 (17:36 +0800)
use thermal temperature
as battery temp

Change-Id: I264cd804814cf46fbc4de4b257f64b12d625e0c4
Signed-off-by: xuwei9 <xuwei9@mt.com>
Reviewed-on: https://gerrit.mot.com/1310122
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key

drivers/hwmon/ntc_thermistor.c

index 3f4ccdb682c4a5ddbf712b4906a86b7be8aabd06..f4b7a71110ecd9155b618a18caad2fdb1018e1f3 100755 (executable)
@@ -261,6 +261,19 @@ struct ntc_data {
 struct ntc_data *data_ntc = NULL;
 
 #if defined(CONFIG_OF) && IS_ENABLED(CONFIG_IIO)
+static bool battery_therm_data(struct ntc_data *data, struct device *dev)
+{
+       struct device_node *np = dev->of_node;
+
+       if (!np)
+               return false;
+
+       if (memcmp(np->name, "battery_thermistor", 18) == 0) {
+               data_ntc = data;
+       }
+
+       return true;
+}
 static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata)
 {
        struct iio_channel *channel = pdata->chan;
@@ -641,7 +654,7 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
        pdev_id = of_id ? of_id->data : platform_get_device_id(pdev);
 
        data->pdata = pdata;
-       data_ntc = data;
+       battery_therm_data(data, dev);
 
        switch (pdev_id->driver_data) {
        case TYPE_NCPXXWB473: