.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Thermal device driver for DA9062 and DA9061 |
---|
3 | 4 | * 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. |
---|
14 | 5 | */ |
---|
15 | 6 | |
---|
16 | 7 | /* When over-temperature is reached, an interrupt from the device will be |
---|
.. | .. |
---|
58 | 49 | struct da9062 *hw; |
---|
59 | 50 | struct delayed_work work; |
---|
60 | 51 | struct thermal_zone_device *zone; |
---|
61 | | - enum thermal_device_mode mode; |
---|
62 | 52 | struct mutex lock; /* protection for da9062_thermal temperature */ |
---|
63 | 53 | int temperature; |
---|
64 | 54 | int irq; |
---|
.. | .. |
---|
130 | 120 | return IRQ_HANDLED; |
---|
131 | 121 | } |
---|
132 | 122 | |
---|
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 | | - |
---|
141 | 123 | static int da9062_thermal_get_trip_type(struct thermal_zone_device *z, |
---|
142 | 124 | int trip, |
---|
143 | 125 | enum thermal_trip_type *type) |
---|
.. | .. |
---|
190 | 172 | |
---|
191 | 173 | static struct thermal_zone_device_ops da9062_thermal_ops = { |
---|
192 | 174 | .get_temp = da9062_thermal_get_temp, |
---|
193 | | - .get_mode = da9062_thermal_get_mode, |
---|
194 | 175 | .get_trip_type = da9062_thermal_get_trip_type, |
---|
195 | 176 | .get_trip_temp = da9062_thermal_get_trip_temp, |
---|
196 | 177 | }; |
---|
.. | .. |
---|
242 | 223 | |
---|
243 | 224 | thermal->config = match->data; |
---|
244 | 225 | thermal->hw = chip; |
---|
245 | | - thermal->mode = THERMAL_DEVICE_ENABLED; |
---|
246 | 226 | thermal->dev = &pdev->dev; |
---|
247 | 227 | |
---|
248 | 228 | INIT_DELAYED_WORK(&thermal->work, da9062_thermal_poll_on); |
---|
.. | .. |
---|
257 | 237 | ret = PTR_ERR(thermal->zone); |
---|
258 | 238 | goto err; |
---|
259 | 239 | } |
---|
| 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 | + } |
---|
260 | 245 | |
---|
261 | 246 | dev_dbg(&pdev->dev, |
---|
262 | 247 | "TJUNC temperature polling period set at %d ms\n", |
---|