drm/radeon: add a quirk for Toshiba Satellite L20-183
[linux/fpc-iii.git] / drivers / thermal / st / st_thermal.h
blobfecafbe10fa773db80674d7d96e11b704e00a70d
1 /*
2 * ST Thermal Sensor Driver for STi series of SoCs
3 * Author: Ajit Pal Singh <ajitpal.singh@st.com>
5 * Copyright (C) 2003-2014 STMicroelectronics (R&D) Limited
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
13 #ifndef __STI_THERMAL_SYSCFG_H
14 #define __STI_THERMAL_SYSCFG_H
16 #include <linux/interrupt.h>
17 #include <linux/platform_device.h>
18 #include <linux/regmap.h>
19 #include <linux/thermal.h>
21 enum st_thermal_regfield_ids {
22 INT_THRESH_HI = 0, /* Top two regfield IDs are mutually exclusive */
23 TEMP_PWR = 0,
24 DCORRECT,
25 OVERFLOW,
26 DATA,
27 INT_ENABLE,
29 MAX_REGFIELDS
32 /* Thermal sensor power states */
33 enum st_thermal_power_state {
34 POWER_OFF = 0,
35 POWER_ON
38 struct st_thermal_sensor;
40 /**
41 * Description of private thermal sensor ops.
43 * @power_ctrl: Function for powering on/off a sensor. Clock to the
44 * sensor is also controlled from this function.
45 * @alloc_regfields: Allocate regmap register fields, specific to a sensor.
46 * @do_memmap_regmap: Memory map the thermal register space and init regmap
47 * instance or find regmap instance.
48 * @register_irq: Register an interrupt handler for a sensor.
50 struct st_thermal_sensor_ops {
51 int (*power_ctrl)(struct st_thermal_sensor *, enum st_thermal_power_state);
52 int (*alloc_regfields)(struct st_thermal_sensor *);
53 int (*regmap_init)(struct st_thermal_sensor *);
54 int (*register_enable_irq)(struct st_thermal_sensor *);
55 int (*enable_irq)(struct st_thermal_sensor *);
58 /**
59 * Description of thermal driver compatible data.
61 * @reg_fields: Pointer to the regfields array for a sensor.
62 * @sys_compat: Pointer to the syscon node compatible string.
63 * @ops: Pointer to private thermal ops for a sensor.
64 * @calibration_val: Default calibration value to be written to the DCORRECT
65 * register field for a sensor.
66 * @temp_adjust_val: Value to be added/subtracted from the data read from
67 * the sensor. If value needs to be added please provide a
68 * positive value and if it is to be subtracted please
69 * provide a negative value.
70 * @crit_temp: The temperature beyond which the SoC should be shutdown
71 * to prevent damage.
73 struct st_thermal_compat_data {
74 char *sys_compat;
75 const struct reg_field *reg_fields;
76 const struct st_thermal_sensor_ops *ops;
77 unsigned int calibration_val;
78 int temp_adjust_val;
79 int crit_temp;
82 struct st_thermal_sensor {
83 struct device *dev;
84 struct thermal_zone_device *thermal_dev;
85 const struct st_thermal_sensor_ops *ops;
86 const struct st_thermal_compat_data *cdata;
87 struct clk *clk;
88 struct regmap *regmap;
89 struct regmap_field *pwr;
90 struct regmap_field *dcorrect;
91 struct regmap_field *overflow;
92 struct regmap_field *temp_data;
93 struct regmap_field *int_thresh_hi;
94 struct regmap_field *int_enable;
95 int irq;
96 void __iomem *mmio_base;
99 extern int st_thermal_register(struct platform_device *pdev,
100 const struct of_device_id *st_thermal_of_match);
101 extern int st_thermal_unregister(struct platform_device *pdev);
102 extern const struct dev_pm_ops st_thermal_pm_ops;
104 #endif /* __STI_RESET_SYSCFG_H */