usb: dwc3: rockchip: fix possible circular deadlock
[firefly-linux-kernel-4.4.55.git] / drivers / hwmon / hwmon-rockchip.h
1 /*
2  * Copyright (C) ST-Ericsson 2010 - 2013
3  * License terms: GNU General Public License v2
4  * Author: Martin Persson <martin.persson@stericsson.com>
5  *         Hongbo Zhang <hongbo.zhang@linaro.com>
6  */
7
8 #ifndef _ROCKCHIP_H
9 #define _ROCKCHIP_H
10
11 #define NUM_SENSORS 5
12
13 struct rockchip_temp;
14
15 /*
16  * struct rockchip_temp_ops - rockchip chip specific ops
17  * @read_sensor: reads gpadc output
18  * @irq_handler: irq handler
19  * @show_name: hwmon device name
20  * @show_label: hwmon attribute label
21  * @is_visible: is attribute visible
22  */
23 struct rockchip_temp_ops {
24         int (*read_sensor)(int);
25         int (*irq_handler)(int, struct rockchip_temp *);
26         ssize_t (*show_name)(struct device *,
27                         struct device_attribute *, char *);
28         ssize_t (*show_label) (struct device *,
29                         struct device_attribute *, char *);
30         int (*is_visible)(struct attribute *, int);
31 };
32
33 /*
34  * struct rockchip_temp - representation of temp mon device
35  * @pdev: platform device
36  * @hwmon_dev: hwmon device
37  * @ops: rockchip chip specific ops
38  * @gpadc_addr: gpadc channel address
39  * @min: sensor temperature min value
40  * @max: sensor temperature max value
41  * @max_hyst: sensor temperature hysteresis value for max limit
42  * @min_alarm: sensor temperature min alarm
43  * @max_alarm: sensor temperature max alarm
44  * @work: delayed work scheduled to monitor temperature periodically
45  * @work_active: True if work is active
46  * @lock: mutex
47  * @monitored_sensors: number of monitored sensors
48  * @plat_data: private usage, usually points to platform specific data
49  */
50 struct rockchip_temp {
51         struct platform_device *pdev;
52         struct device *hwmon_dev;
53         struct rockchip_temp_ops ops;
54         u8 tsadc_addr[NUM_SENSORS];
55         unsigned long min[NUM_SENSORS];
56         unsigned long max[NUM_SENSORS];
57         unsigned long max_hyst[NUM_SENSORS];
58         bool min_alarm[NUM_SENSORS];
59         bool max_alarm[NUM_SENSORS];
60         struct delayed_work work;
61         bool work_active;
62         struct mutex lock;
63         int monitored_sensors;
64         void *plat_data;
65         void __iomem            *regs;
66         struct clk              *clk;
67         struct clk              *pclk;
68         struct resource         *ioarea;
69         struct tsadc_host               *tsadc;
70         struct work_struct      auto_ht_irq_work;
71         struct workqueue_struct  *workqueue;
72         struct workqueue_struct  *tsadc_workqueue;
73 };
74
75 int rockchip_hwmon_init(struct rockchip_temp *data);
76
77 #endif /* _ROCKCHIP_H */