Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a759bf9e authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi Committed by Gerrit - the friendly Code Review server
Browse files

drivers: thermal: Add support to modify passive/polling delay to of_thermal



Whenever userspace modifies thermal zone passive delay or polling
delay from sysfs, of_thermal can reset this value to devicetree
defaults while re-enabling thermal zone. Add support to update
passive delay and polling delay to the of_thermal framework so that
userspace can modify and retain the delay across multiple disable
and enable actions.

Change-Id: I68c2bcd2eebeeffa48b3f8ecfb2882c77ff9d6ee
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent e72e3f64
Loading
Loading
Loading
Loading
+22 −0
Original line number Original line Diff line number Diff line
@@ -521,6 +521,26 @@ static bool of_thermal_is_wakeable(struct thermal_zone_device *tz)
	return data->is_wakeable;
	return data->is_wakeable;
}
}


static int of_thermal_set_polling_delay(struct thermal_zone_device *tz,
				    int delay)
{
	struct __thermal_zone *data = tz->devdata;

	data->polling_delay = delay;

	return 0;
}

static int of_thermal_set_passive_delay(struct thermal_zone_device *tz,
				    int delay)
{
	struct __thermal_zone *data = tz->devdata;

	data->passive_delay = delay;

	return 0;
}

static int of_thermal_aggregate_trip_types(struct thermal_zone_device *tz,
static int of_thermal_aggregate_trip_types(struct thermal_zone_device *tz,
		unsigned int trip_type_mask, int *low, int *high)
		unsigned int trip_type_mask, int *low, int *high)
{
{
@@ -648,6 +668,8 @@ static struct thermal_zone_device_ops of_thermal_ops = {
	.unbind = of_thermal_unbind,
	.unbind = of_thermal_unbind,


	.is_wakeable = of_thermal_is_wakeable,
	.is_wakeable = of_thermal_is_wakeable,
	.set_polling_delay = of_thermal_set_polling_delay,
	.set_passive_delay = of_thermal_set_passive_delay,
};
};


static struct thermal_zone_of_device_ops of_virt_ops = {
static struct thermal_zone_of_device_ops of_virt_ops = {
+4 −0
Original line number Original line Diff line number Diff line
@@ -393,6 +393,8 @@ polling_delay_store(struct device *dev, struct device_attribute *attr,


	mutex_lock(&tz->lock);
	mutex_lock(&tz->lock);
	tz->polling_delay = delay;
	tz->polling_delay = delay;
	if (tz->ops->set_polling_delay)
		tz->ops->set_polling_delay(tz, delay);
	mutex_unlock(&tz->lock);
	mutex_unlock(&tz->lock);
	thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
	thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);


@@ -420,6 +422,8 @@ passive_delay_store(struct device *dev, struct device_attribute *attr,


	mutex_lock(&tz->lock);
	mutex_lock(&tz->lock);
	tz->passive_delay = delay;
	tz->passive_delay = delay;
	if (tz->ops->set_passive_delay)
		tz->ops->set_passive_delay(tz, delay);
	mutex_unlock(&tz->lock);
	mutex_unlock(&tz->lock);
	thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
	thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);


+2 −0
Original line number Original line Diff line number Diff line
@@ -144,6 +144,8 @@ struct thermal_zone_device_ops {
	int (*notify) (struct thermal_zone_device *, int,
	int (*notify) (struct thermal_zone_device *, int,
		       enum thermal_trip_type);
		       enum thermal_trip_type);
	bool (*is_wakeable)(struct thermal_zone_device *);
	bool (*is_wakeable)(struct thermal_zone_device *);
	int (*set_polling_delay)(struct thermal_zone_device *, int);
	int (*set_passive_delay)(struct thermal_zone_device *, int);
};
};


struct thermal_cooling_device_ops {
struct thermal_cooling_device_ops {