forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/thermal/da9062-thermal.c
....@@ -1,16 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Thermal device driver for DA9062 and DA9061
34 * Copyright (C) 2017 Dialog Semiconductor
4
- *
5
- * This program is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU General Public License
7
- * as published by the Free Software Foundation; either version 2
8
- * of the License, or (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
145 */
156
167 /* When over-temperature is reached, an interrupt from the device will be
....@@ -58,7 +49,6 @@
5849 struct da9062 *hw;
5950 struct delayed_work work;
6051 struct thermal_zone_device *zone;
61
- enum thermal_device_mode mode;
6252 struct mutex lock; /* protection for da9062_thermal temperature */
6353 int temperature;
6454 int irq;
....@@ -130,14 +120,6 @@
130120 return IRQ_HANDLED;
131121 }
132122
133
-static int da9062_thermal_get_mode(struct thermal_zone_device *z,
134
- enum thermal_device_mode *mode)
135
-{
136
- struct da9062_thermal *thermal = z->devdata;
137
- *mode = thermal->mode;
138
- return 0;
139
-}
140
-
141123 static int da9062_thermal_get_trip_type(struct thermal_zone_device *z,
142124 int trip,
143125 enum thermal_trip_type *type)
....@@ -190,7 +172,6 @@
190172
191173 static struct thermal_zone_device_ops da9062_thermal_ops = {
192174 .get_temp = da9062_thermal_get_temp,
193
- .get_mode = da9062_thermal_get_mode,
194175 .get_trip_type = da9062_thermal_get_trip_type,
195176 .get_trip_temp = da9062_thermal_get_trip_temp,
196177 };
....@@ -242,7 +223,6 @@
242223
243224 thermal->config = match->data;
244225 thermal->hw = chip;
245
- thermal->mode = THERMAL_DEVICE_ENABLED;
246226 thermal->dev = &pdev->dev;
247227
248228 INIT_DELAYED_WORK(&thermal->work, da9062_thermal_poll_on);
....@@ -257,6 +237,11 @@
257237 ret = PTR_ERR(thermal->zone);
258238 goto err;
259239 }
240
+ ret = thermal_zone_device_enable(thermal->zone);
241
+ if (ret) {
242
+ dev_err(&pdev->dev, "Cannot enable thermal zone device\n");
243
+ goto err_zone;
244
+ }
260245
261246 dev_dbg(&pdev->dev,
262247 "TJUNC temperature polling period set at %d ms\n",