aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq806x/patches-4.19/0063-2-tsens-support-configurable-interrupts.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ipq806x/patches-4.19/0063-2-tsens-support-configurable-interrupts.patch')
-rw-r--r--target/linux/ipq806x/patches-4.19/0063-2-tsens-support-configurable-interrupts.patch71
1 files changed, 26 insertions, 45 deletions
diff --git a/target/linux/ipq806x/patches-4.19/0063-2-tsens-support-configurable-interrupts.patch b/target/linux/ipq806x/patches-4.19/0063-2-tsens-support-configurable-interrupts.patch
index 944d1e575b..62e26cbee4 100644
--- a/target/linux/ipq806x/patches-4.19/0063-2-tsens-support-configurable-interrupts.patch
+++ b/target/linux/ipq806x/patches-4.19/0063-2-tsens-support-configurable-interrupts.patch
@@ -21,27 +21,9 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
include/linux/thermal.h | 14 +++++
6 files changed, 162 insertions(+), 17 deletions(-)
---- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
-+++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
-@@ -12,11 +12,15 @@ Required properties:
- - Refer to Documentation/devicetree/bindings/nvmem/nvmem.txt to know how to specify
- nvmem cells
-
-+Optional properties:
-+- interrupts: Interrupt which gets triggered when threshold is hit
-+
- Example:
- tsens: thermal-sensor@900000 {
- compatible = "qcom,msm8916-tsens";
- reg = <0x4a8000 0x2000>;
- nvmem-cells = <&tsens_caldata>, <&tsens_calsel>;
- nvmem-cell-names = "caldata", "calsel";
-+ interrupts = <0 178 0>;
- #thermal-sensor-cells = <1>;
- };
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
-@@ -95,7 +95,7 @@ static int of_thermal_get_temp(struct th
+@@ -77,7 +77,7 @@ static int of_thermal_get_temp(struct th
{
struct __thermal_zone *data = tz->devdata;
@@ -50,7 +32,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EINVAL;
return data->ops->get_temp(data->sensor_data, temp);
-@@ -106,7 +106,8 @@ static int of_thermal_set_trips(struct t
+@@ -88,7 +88,8 @@ static int of_thermal_set_trips(struct t
{
struct __thermal_zone *data = tz->devdata;
@@ -60,7 +42,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EINVAL;
return data->ops->set_trips(data->sensor_data, low, high);
-@@ -192,6 +193,9 @@ static int of_thermal_set_emul_temp(stru
+@@ -174,6 +175,9 @@ static int of_thermal_set_emul_temp(stru
{
struct __thermal_zone *data = tz->devdata;
@@ -70,7 +52,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return data->ops->set_emul_temp(data->sensor_data, temp);
}
-@@ -200,7 +204,7 @@ static int of_thermal_get_trend(struct t
+@@ -182,7 +186,7 @@ static int of_thermal_get_trend(struct t
{
struct __thermal_zone *data = tz->devdata;
@@ -79,7 +61,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EINVAL;
return data->ops->get_trend(data->sensor_data, trip, trend);
-@@ -289,7 +293,9 @@ static int of_thermal_set_mode(struct th
+@@ -271,7 +275,9 @@ static int of_thermal_set_mode(struct th
mutex_unlock(&tz->lock);
data->mode = mode;
@@ -90,7 +72,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return 0;
}
-@@ -299,7 +305,8 @@ static int of_thermal_get_trip_type(stru
+@@ -281,7 +287,8 @@ static int of_thermal_get_trip_type(stru
{
struct __thermal_zone *data = tz->devdata;
@@ -100,7 +82,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EDOM;
*type = data->trips[trip].type;
-@@ -307,12 +314,39 @@ static int of_thermal_get_trip_type(stru
+@@ -289,12 +296,39 @@ static int of_thermal_get_trip_type(stru
return 0;
}
@@ -141,7 +123,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EDOM;
*temp = data->trips[trip].temperature;
-@@ -325,7 +359,8 @@ static int of_thermal_set_trip_temp(stru
+@@ -307,7 +341,8 @@ static int of_thermal_set_trip_temp(stru
{
struct __thermal_zone *data = tz->devdata;
@@ -151,7 +133,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EDOM;
if (data->ops->set_trip_temp) {
-@@ -347,7 +382,8 @@ static int of_thermal_get_trip_hyst(stru
+@@ -329,7 +364,8 @@ static int of_thermal_get_trip_hyst(stru
{
struct __thermal_zone *data = tz->devdata;
@@ -161,7 +143,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EDOM;
*hyst = data->trips[trip].hysteresis;
-@@ -360,7 +396,8 @@ static int of_thermal_set_trip_hyst(stru
+@@ -342,7 +378,8 @@ static int of_thermal_set_trip_hyst(stru
{
struct __thermal_zone *data = tz->devdata;
@@ -171,7 +153,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EDOM;
/* thermal framework should take care of data->mask & (1 << trip) */
-@@ -435,6 +472,9 @@ thermal_zone_of_add_sensor(struct device
+@@ -417,6 +454,9 @@ thermal_zone_of_add_sensor(struct device
if (ops->set_emul_temp)
tzd->ops->set_emul_temp = of_thermal_set_emul_temp;
@@ -181,7 +163,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
mutex_unlock(&tzd->lock);
return tzd;
-@@ -729,7 +769,10 @@ static const char * const trip_types[] =
+@@ -711,7 +751,10 @@ static const char * const trip_types[] =
[THERMAL_TRIP_ACTIVE] = "active",
[THERMAL_TRIP_PASSIVE] = "passive",
[THERMAL_TRIP_HOT] = "hot",
@@ -261,7 +243,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
static SIMPLE_DEV_PM_OPS(tsens_pm_ops, tsens_suspend, tsens_resume);
static const struct of_device_id tsens_table[] = {
-@@ -83,6 +109,8 @@ MODULE_DEVICE_TABLE(of, tsens_table);
+@@ -86,6 +112,8 @@ MODULE_DEVICE_TABLE(of, tsens_table);
static const struct thermal_zone_of_device_ops tsens_of_ops = {
.get_temp = tsens_get_temp,
.get_trend = tsens_get_trend,
@@ -270,18 +252,18 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
};
static int tsens_register(struct tsens_device *tmdev)
-@@ -131,7 +159,7 @@ static int tsens_probe(struct platform_d
+@@ -134,7 +162,7 @@ static int tsens_probe(struct platform_d
if (id)
data = id->data;
else
- data = &data_8960;
+ return -EINVAL;
- if (data->num_sensors <= 0) {
- dev_err(dev, "invalid number of sensors\n");
-@@ -146,6 +174,9 @@ static int tsens_probe(struct platform_d
+ num_sensors = data->num_sensors;
+
+@@ -155,6 +183,9 @@ static int tsens_probe(struct platform_d
tmdev->dev = dev;
- tmdev->num_sensors = data->num_sensors;
+ tmdev->num_sensors = num_sensors;
tmdev->ops = data->ops;
+
+ tmdev->tsens_irq = platform_get_irq(pdev, 0);
@@ -324,15 +306,14 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
};
/**
-@@ -76,11 +85,13 @@ struct tsens_context {
+@@ -76,10 +85,12 @@ struct tsens_context {
struct tsens_device {
struct device *dev;
u32 num_sensors;
+ u32 tsens_irq;
struct regmap *map;
- struct regmap_field *status_field;
+ u32 tm_offset;
struct tsens_context ctx;
- bool trdy;
const struct tsens_ops *ops;
+ struct work_struct tsens_work;
struct tsens_sensor sensor[0];
@@ -340,7 +321,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
-@@ -115,12 +115,48 @@ trip_point_type_show(struct device *dev,
+@@ -113,12 +113,48 @@ trip_point_type_show(struct device *dev,
return sprintf(buf, "passive\n");
case THERMAL_TRIP_ACTIVE:
return sprintf(buf, "active\n");
@@ -389,7 +370,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
trip_point_temp_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
-@@ -562,6 +598,12 @@ static int create_trip_attrs(struct ther
+@@ -559,6 +595,12 @@ static int create_trip_attrs(struct ther
tz->trip_type_attrs[indx].attr.show = trip_point_type_show;
attrs[indx] = &tz->trip_type_attrs[indx].attr.attr;
@@ -404,7 +385,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
"trip_point_%d_temp", indx);
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
-@@ -78,11 +78,19 @@ enum thermal_device_mode {
+@@ -63,11 +63,19 @@ enum thermal_device_mode {
THERMAL_DEVICE_ENABLED,
};
@@ -424,7 +405,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
};
enum thermal_trend {
-@@ -120,6 +128,8 @@ struct thermal_zone_device_ops {
+@@ -105,6 +113,8 @@ struct thermal_zone_device_ops {
enum thermal_trip_type *);
int (*get_trip_temp) (struct thermal_zone_device *, int, int *);
int (*set_trip_temp) (struct thermal_zone_device *, int, int);
@@ -433,7 +414,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
int (*get_trip_hyst) (struct thermal_zone_device *, int, int *);
int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
int (*get_crit_temp) (struct thermal_zone_device *, int *);
-@@ -363,6 +373,8 @@ struct thermal_genl_event {
+@@ -349,6 +359,8 @@ struct thermal_genl_event {
* temperature.
* @set_trip_temp: a pointer to a function that sets the trip temperature on
* hardware.
@@ -442,7 +423,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
*/
struct thermal_zone_of_device_ops {
int (*get_temp)(void *, int *);
-@@ -370,6 +382,8 @@ struct thermal_zone_of_device_ops {
+@@ -356,6 +368,8 @@ struct thermal_zone_of_device_ops {
int (*set_trips)(void *, int, int);
int (*set_emul_temp)(void *, int);
int (*set_trip_temp)(void *, int, int);