public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Javi Merino <javi.merino@arm.com>
To: Eduardo Valentin <edubezval@gmail.com>
Cc: "rui.zhang@intel.com" <rui.zhang@intel.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Punit Agrawal <Punit.Agrawal@arm.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"tixy@linaro.org" <tixy@linaro.org>
Subject: Re: [PATCH v2 7/7] thermal: export thermal_zone_parameters to sysfs
Date: Mon, 2 Mar 2015 14:17:51 +0000	[thread overview]
Message-ID: <20150302141751.GA5756@e104805> (raw)
In-Reply-To: <20150226221004.GA5564@developer.amazonguestwifi.org>

On Thu, Feb 26, 2015 at 10:10:07PM +0000, Eduardo Valentin wrote:
> On Fri, Feb 27, 2015 at 05:19:05PM +0000, Javi Merino wrote:
> > On Thu, Feb 26, 2015 at 10:04:24PM +0000, Eduardo Valentin wrote:
> > > On Thu, Feb 26, 2015 at 05:30:00PM -0400, Eduardo Valentin wrote:
> > > > On Thu, Feb 26, 2015 at 07:00:33PM +0000, Javi Merino wrote:

[snip]

> > > > > +
> > > > > +static ssize_t
> > > > > +sustainable_power_show(struct device *dev, struct device_attribute *devattr,
> > > > > +		       char *buf)
> > > > > +{
> > > > > +	struct thermal_zone_device *tz = to_thermal_zone(dev);
> > > > > +
> > > > > +	if (tz->tzp)
> > > > > +		return sprintf(buf, "%u\n", tz->tzp->sustainable_power);
> > > > > +	else
> > > > > +		return -EIO;
> > > > > +}
> > > > > +
> > > > > +static ssize_t
> > > > > +sustainable_power_store(struct device *dev, struct device_attribute *devattr,
> > > > > +			const char *buf, size_t count)
> > > > > +{
> > > > > +	struct thermal_zone_device *tz = to_thermal_zone(dev);
> > > > > +	u32 sustainable_power;
> > > > > +
> > > > > +	if (!tz->tzp)
> > > > > +		return -EIO;
> > > > > +
> > > > > +	if (kstrtou32(buf, 10, &sustainable_power))
> > > > > +		return -EINVAL;
> > > > > +
> > > > > +	tz->tzp->sustainable_power = sustainable_power;
> > > > > +
> > > > > +	return count;
> > > > > +}
> > > > > +static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, sustainable_power_show,
> > > > > +		sustainable_power_store);
> > > > > +
> > > > > +#define create_s32_tzp_attr(name)					\
> > > > > +	static ssize_t							\
> > > > > +	name##_show(struct device *dev, struct device_attribute *devattr, \
> > > > > +		char *buf)						\
> > > > > +	{								\
> > > > > +	struct thermal_zone_device *tz = to_thermal_zone(dev);		\
> > > > > +									\
> > > > > +	if (tz->tzp)							\
> > > > > +		return sprintf(buf, "%u\n", tz->tzp->name);		\
> > > > > +	else								\
> > > > > +		return -EIO;						\
> > > > > +	}								\
> > > > > +									\
> > > > > +	static ssize_t							\
> > > > > +	name##_store(struct device *dev, struct device_attribute *devattr, \
> > > > > +		const char *buf, size_t count)				\
> > > > > +	{								\
> > > > > +		struct thermal_zone_device *tz = to_thermal_zone(dev);	\
> > > > > +		s32 value;						\
> > > > > +									\
> > > > > +		if (!tz->tzp)						\
> > > > > +			return -EIO;					\
> > > > > +									\
> > > > > +		if (kstrtos32(buf, 10, &value))				\
> > > > > +			return -EINVAL;					\
> > > > > +									\
> > > > > +		tz->tzp->name = value;					\
> > > > > +									\
> > > > > +		return count;						\
> > > > > +	}								\
> > > > > +	static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, name##_show, name##_store)
> > > > > +
> > > > > +create_s32_tzp_attr(k_po);
> > > > > +create_s32_tzp_attr(k_pu);
> > > > > +create_s32_tzp_attr(k_i);
> > > > > +create_s32_tzp_attr(k_d);
> > > > > +create_s32_tzp_attr(integral_cutoff);
> > > > > +#undef create_s32_tzp_attr
> > > > > +
> > > > > +static struct device_attribute *dev_tzp_attrs[] = {
> > > > > +	&dev_attr_sustainable_power,
> > > > > +	&dev_attr_k_po,
> > > > > +	&dev_attr_k_pu,
> > > > > +	&dev_attr_k_i,
> > > > > +	&dev_attr_k_d,
> > > > > +	&dev_attr_integral_cutoff,
> > > > > +};
> > > > > +
> > > > > +static int create_power_allocator_tzp_attrs(struct device *dev)
> > > 
> > > I would rename this to thermal_create_zone_params_attrs and remove the
> > > ifdefiry.
> > 
> > Ok, I will remove them.
> > 
> > >           If you are not exposing the complete info under tzp, then make
> > > a comment about it.
> > 
> > There's nothing else worth populating.  The governor_name is not
> > interesting, you have the thermal zone policy for that.  Similar for
> > no_hwmon.  For tbps, weight and trip_mask are already exposed in the
> > instance.  The binding_limits is currently not available in sysfs, but
> > if we were to populate it, I would expose the ones that end up in the
> > instance, as we do with trips and weights.
> > 
> > Is it worth putting this in a comment in the code?
> 
> 
> Well, I was more interested in governor specific / internal data,
> accessible only in the governor file (e.g.: power_allocator.c). Do you
> think we need to expose something that is accessible only from the
> governor code or do you think the current info under tzp is enough?
> 
> 
> If the former is the case, then we need restructure with callbacks. If
> not, meaning, if all you need is in tzp, then we can keep the code in
> thermal core.

I don't want to expose anything from the governor file, I think the
current info under tzp is enough.

Cheers,
Javi

  reply	other threads:[~2015-03-02 14:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26 19:00 [PATCH v2 0/7] The power allocator thermal governor Javi Merino
2015-02-26 19:00 ` [PATCH v2 1/7] thermal: let governors have private data for each thermal zone Javi Merino
2015-02-26 19:00 ` [PATCH v2 2/7] thermal: extend the cooling device API to include power information Javi Merino
2015-02-26 19:00 ` [PATCH v2 3/7] thermal: cpu_cooling: implement the power cooling device API Javi Merino
2015-02-26 19:00 ` [PATCH v2 4/7] thermal: introduce the Power Allocator governor Javi Merino
2015-02-26 20:36   ` Eduardo Valentin
2015-02-27 16:12     ` Javi Merino
2015-02-26 19:00 ` [PATCH v2 5/7] thermal: add trace events to the power allocator governor Javi Merino
2015-02-26 19:38   ` Steven Rostedt
2015-02-26 19:46     ` Eduardo Valentin
2015-02-26 22:52       ` Steven Rostedt
2015-02-26 21:18         ` Eduardo Valentin
2015-02-27  0:09           ` Steven Rostedt
2015-02-26 19:00 ` [PATCH v2 6/7] of: thermal: Introduce sustainable power for a thermal zone Javi Merino
2015-02-26 19:00 ` [PATCH v2 7/7] thermal: export thermal_zone_parameters to sysfs Javi Merino
2015-02-26 21:30   ` Eduardo Valentin
2015-02-26 22:04     ` Eduardo Valentin
2015-02-27 17:19       ` Javi Merino
2015-02-26 22:10         ` Eduardo Valentin
2015-03-02 14:17           ` Javi Merino [this message]
2015-02-26 22:16 ` [PATCH v2 0/7] The power allocator thermal governor Eduardo Valentin
2015-03-02 16:28   ` Javi Merino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150302141751.GA5756@e104805 \
    --to=javi.merino@arm.com \
    --cc=Punit.Agrawal@arm.com \
    --cc=broonie@kernel.org \
    --cc=edubezval@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=tixy@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox