Message ID | 1459298497-29481-4-git-send-email-srikars@nvidia.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Eduardo Valentin |
Headers | show |
Looks good to me. On 03/29/2016 05:41 PM, Srikar Srimath Tirumala wrote: > * Add a state variable to track if trip point is triggered. > * Enable trip events only when the state of the tirp point changes. > * Implement the get\set callbacks for trip state. > > Change-Id: I1bd6a7b0e5e520d8ee678b83111d23cada7a580c > Signed-off-by: Srikar Srimath Tirumala <srikars@nvidia.com> > --- > drivers/thermal/of-thermal.c | 43 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 43 insertions(+) > > diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c > index 49ac23d..f6d9d3d 100644 > --- a/drivers/thermal/of-thermal.c > +++ b/drivers/thermal/of-thermal.c > @@ -379,6 +379,43 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, > return -EINVAL; > } > > +static bool of_thermal_enb_temp_notify(struct thermal_zone_device *tz, int trip) > +{ > + bool ret = true; > + struct __thermal_zone *data = tz->devdata; > + > + if (trip >= data->ntrips || trip < 0) > + ret = false; > + > + return ret; > +} > + > +static int of_thermal_get_trip_state(struct thermal_zone_device *tz, int trip, > + enum thermal_trip_state *state) > +{ > + struct __thermal_zone *data = tz->devdata; > + > + if (trip >= data->ntrips || trip < 0) > + return -EDOM; > + > + *state = data->trips[trip].state; > + > + return 0; > +} > + > +static int of_thermal_set_trip_state(struct thermal_zone_device *tz, int trip, > + enum thermal_trip_state state) > +{ > + struct __thermal_zone *data = tz->devdata; > + > + if (trip >= data->ntrips || trip < 0) > + return -EDOM; > + > + data->trips[trip].state = state; > + > + return 0; > +} > + > static struct thermal_zone_device_ops of_thermal_ops = { > .get_mode = of_thermal_get_mode, > .set_mode = of_thermal_set_mode, > @@ -392,6 +429,10 @@ static struct thermal_zone_device_ops of_thermal_ops = { > > .bind = of_thermal_bind, > .unbind = of_thermal_unbind, > + > + .get_trip_state = of_thermal_get_trip_state, > + .set_trip_state = of_thermal_set_trip_state, > + .enb_temp_notify = of_thermal_enb_temp_notify, > }; > > /*** sensor API ***/ > @@ -782,6 +823,8 @@ static int thermal_of_populate_trip(struct device_node *np, > return ret; > } > > + trip->state = THERMAL_TRIP_NOT_TRIPPED; > + > /* Required for cooling map matching */ > trip->np = np; > of_node_get(np); -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Mar 29, 2016 at 05:41:36PM -0700, Srikar Srimath Tirumala wrote: > * Add a state variable to track if trip point is triggered. > * Enable trip events only when the state of the tirp point changes. > * Implement the get\set callbacks for trip state. > > Change-Id: I1bd6a7b0e5e520d8ee678b83111d23cada7a580c > Signed-off-by: Srikar Srimath Tirumala <srikars@nvidia.com> > --- > drivers/thermal/of-thermal.c | 43 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 43 insertions(+) > > diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c > index 49ac23d..f6d9d3d 100644 > --- a/drivers/thermal/of-thermal.c > +++ b/drivers/thermal/of-thermal.c > @@ -379,6 +379,43 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, > return -EINVAL; > } > > +static bool of_thermal_enb_temp_notify(struct thermal_zone_device *tz, int trip) > +{ > + bool ret = true; > + struct __thermal_zone *data = tz->devdata; > + > + if (trip >= data->ntrips || trip < 0) > + ret = false; > + > + return ret; > +} > + > +static int of_thermal_get_trip_state(struct thermal_zone_device *tz, int trip, > + enum thermal_trip_state *state) > +{ > + struct __thermal_zone *data = tz->devdata; > + > + if (trip >= data->ntrips || trip < 0) > + return -EDOM; > + > + *state = data->trips[trip].state; For the sake of the current implementation, I believe tracking state is probably more of a thermal core duty. Not sure this has anything to do with OF thermal. Could you please clarify why you think this has to be here? > + > + return 0; > +} > + > +static int of_thermal_set_trip_state(struct thermal_zone_device *tz, int trip, > + enum thermal_trip_state state) > +{ > + struct __thermal_zone *data = tz->devdata; > + > + if (trip >= data->ntrips || trip < 0) > + return -EDOM; > + > + data->trips[trip].state = state; > + > + return 0; > +} > + > static struct thermal_zone_device_ops of_thermal_ops = { > .get_mode = of_thermal_get_mode, > .set_mode = of_thermal_set_mode, > @@ -392,6 +429,10 @@ static struct thermal_zone_device_ops of_thermal_ops = { > > .bind = of_thermal_bind, > .unbind = of_thermal_unbind, > + > + .get_trip_state = of_thermal_get_trip_state, > + .set_trip_state = of_thermal_set_trip_state, > + .enb_temp_notify = of_thermal_enb_temp_notify, > }; > > /*** sensor API ***/ > @@ -782,6 +823,8 @@ static int thermal_of_populate_trip(struct device_node *np, > return ret; > } > > + trip->state = THERMAL_TRIP_NOT_TRIPPED; > + > /* Required for cooling map matching */ > trip->np = np; > of_node_get(np); > -- > 2.1.4 > -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 49ac23d..f6d9d3d 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -379,6 +379,43 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, return -EINVAL; } +static bool of_thermal_enb_temp_notify(struct thermal_zone_device *tz, int trip) +{ + bool ret = true; + struct __thermal_zone *data = tz->devdata; + + if (trip >= data->ntrips || trip < 0) + ret = false; + + return ret; +} + +static int of_thermal_get_trip_state(struct thermal_zone_device *tz, int trip, + enum thermal_trip_state *state) +{ + struct __thermal_zone *data = tz->devdata; + + if (trip >= data->ntrips || trip < 0) + return -EDOM; + + *state = data->trips[trip].state; + + return 0; +} + +static int of_thermal_set_trip_state(struct thermal_zone_device *tz, int trip, + enum thermal_trip_state state) +{ + struct __thermal_zone *data = tz->devdata; + + if (trip >= data->ntrips || trip < 0) + return -EDOM; + + data->trips[trip].state = state; + + return 0; +} + static struct thermal_zone_device_ops of_thermal_ops = { .get_mode = of_thermal_get_mode, .set_mode = of_thermal_set_mode, @@ -392,6 +429,10 @@ static struct thermal_zone_device_ops of_thermal_ops = { .bind = of_thermal_bind, .unbind = of_thermal_unbind, + + .get_trip_state = of_thermal_get_trip_state, + .set_trip_state = of_thermal_set_trip_state, + .enb_temp_notify = of_thermal_enb_temp_notify, }; /*** sensor API ***/ @@ -782,6 +823,8 @@ static int thermal_of_populate_trip(struct device_node *np, return ret; } + trip->state = THERMAL_TRIP_NOT_TRIPPED; + /* Required for cooling map matching */ trip->np = np; of_node_get(np);
* Add a state variable to track if trip point is triggered. * Enable trip events only when the state of the tirp point changes. * Implement the get\set callbacks for trip state. Change-Id: I1bd6a7b0e5e520d8ee678b83111d23cada7a580c Signed-off-by: Srikar Srimath Tirumala <srikars@nvidia.com> --- drivers/thermal/of-thermal.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)