Lines Matching full:thermal

3  * Thermal device driver for DA9062 and DA9061
11 * implementation of the thermal driver will include a .notify() function
27 #include <linux/thermal.h>
61 struct da9062_thermal *thermal = container_of(work, in da9062_thermal_poll_on() local
69 ret = regmap_write(thermal->hw->regmap, in da9062_thermal_poll_on()
73 dev_err(thermal->dev, in da9062_thermal_poll_on()
82 ret = regmap_read(thermal->hw->regmap, in da9062_thermal_poll_on()
86 dev_err(thermal->dev, in da9062_thermal_poll_on()
92 mutex_lock(&thermal->lock); in da9062_thermal_poll_on()
93 thermal->temperature = DA9062_MILLI_CELSIUS(125); in da9062_thermal_poll_on()
94 mutex_unlock(&thermal->lock); in da9062_thermal_poll_on()
95 thermal_zone_device_update(thermal->zone, in da9062_thermal_poll_on()
98 delay = msecs_to_jiffies(thermal->zone->passive_delay); in da9062_thermal_poll_on()
99 queue_delayed_work(system_freezable_wq, &thermal->work, delay); in da9062_thermal_poll_on()
103 mutex_lock(&thermal->lock); in da9062_thermal_poll_on()
104 thermal->temperature = DA9062_MILLI_CELSIUS(0); in da9062_thermal_poll_on()
105 mutex_unlock(&thermal->lock); in da9062_thermal_poll_on()
106 thermal_zone_device_update(thermal->zone, in da9062_thermal_poll_on()
110 enable_irq(thermal->irq); in da9062_thermal_poll_on()
115 struct da9062_thermal *thermal = data; in da9062_thermal_irq_handler() local
117 disable_irq_nosync(thermal->irq); in da9062_thermal_irq_handler()
118 queue_delayed_work(system_freezable_wq, &thermal->work, 0); in da9062_thermal_irq_handler()
127 struct da9062_thermal *thermal = z->devdata; in da9062_thermal_get_trip_type() local
134 dev_err(thermal->dev, in da9062_thermal_get_trip_type()
146 struct da9062_thermal *thermal = z->devdata; in da9062_thermal_get_trip_temp() local
153 dev_err(thermal->dev, in da9062_thermal_get_trip_temp()
164 struct da9062_thermal *thermal = z->devdata; in da9062_thermal_get_temp() local
166 mutex_lock(&thermal->lock); in da9062_thermal_get_temp()
167 *temp = thermal->temperature; in da9062_thermal_get_temp()
168 mutex_unlock(&thermal->lock); in da9062_thermal_get_temp()
180 .name = "da9062-thermal",
184 { .compatible = "dlg,da9062-thermal", .data = &da9062_config },
193 struct da9062_thermal *thermal; in da9062_thermal_probe() local
217 thermal = devm_kzalloc(&pdev->dev, sizeof(struct da9062_thermal), in da9062_thermal_probe()
219 if (!thermal) { in da9062_thermal_probe()
224 thermal->config = match->data; in da9062_thermal_probe()
225 thermal->hw = chip; in da9062_thermal_probe()
226 thermal->dev = &pdev->dev; in da9062_thermal_probe()
228 INIT_DELAYED_WORK(&thermal->work, da9062_thermal_poll_on); in da9062_thermal_probe()
229 mutex_init(&thermal->lock); in da9062_thermal_probe()
231 thermal->zone = thermal_zone_device_register(thermal->config->name, in da9062_thermal_probe()
232 1, 0, thermal, in da9062_thermal_probe()
235 if (IS_ERR(thermal->zone)) { in da9062_thermal_probe()
236 dev_err(&pdev->dev, "Cannot register thermal zone device\n"); in da9062_thermal_probe()
237 ret = PTR_ERR(thermal->zone); in da9062_thermal_probe()
240 ret = thermal_zone_device_enable(thermal->zone); in da9062_thermal_probe()
242 dev_err(&pdev->dev, "Cannot enable thermal zone device\n"); in da9062_thermal_probe()
248 thermal->zone->passive_delay); in da9062_thermal_probe()
250 ret = platform_get_irq_byname(pdev, "THERMAL"); in da9062_thermal_probe()
255 thermal->irq = ret; in da9062_thermal_probe()
257 ret = request_threaded_irq(thermal->irq, NULL, in da9062_thermal_probe()
260 "THERMAL", thermal); in da9062_thermal_probe()
263 "Failed to request thermal device IRQ.\n"); in da9062_thermal_probe()
267 platform_set_drvdata(pdev, thermal); in da9062_thermal_probe()
271 thermal_zone_device_unregister(thermal->zone); in da9062_thermal_probe()
278 struct da9062_thermal *thermal = platform_get_drvdata(pdev); in da9062_thermal_remove() local
280 free_irq(thermal->irq, thermal); in da9062_thermal_remove()
281 cancel_delayed_work_sync(&thermal->work); in da9062_thermal_remove()
282 thermal_zone_device_unregister(thermal->zone); in da9062_thermal_remove()
290 .name = "da9062-thermal",
298 MODULE_DESCRIPTION("Thermal TJUNC device driver for Dialog DA9062 and DA9061");
300 MODULE_ALIAS("platform:da9062-thermal");