linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pandruvada, Srinivas" <srinivas.pandruvada@intel.com>
To: "matthewgarrett@google.com" <matthewgarrett@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "Zhang, Rui" <rui.zhang@intel.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"Aram, Nisha" <nisha.aram@intel.com>,
	"mjg59@google.com" <mjg59@google.com>
Subject: Re: [PATCH V2 1/3] thermal/int340x_thermal: Export GDDV
Date: Fri, 29 May 2020 06:00:16 +0000	[thread overview]
Message-ID: <fe5119b46d975e4699ced2d9ed12a25f8ae5d1cd.camel@intel.com> (raw)
In-Reply-To: <4c00e15c8d5e34a723896f132989edd581c6995e.camel@intel.com>

On Mon, 2020-05-18 at 23:18 +0000, Pandruvada, Srinivas wrote:
> On Mon, 2020-04-13 at 19:09 -0700, Matthew Garrett wrote:
> > From: Matthew Garrett <mjg59@google.com>
> > 
> > Implementing DPTF properly requires making use of firmware-provided
> > information associated with the INT3400 device. Calling GDDV
> > provides
> > a
> > buffer of information which userland can then interpret to
> > determine
> > appropriate DPTF policy.
> > 
> > Signed-off-by: Matthew Garrett <mjg59@google.com>
> Tested-by: Pandruvada, Srinivas <srinivas.pandruvada@linux.intel.com>

Can we take this series for 5.8?

Thanks,
Srinivas

> 
> > ---
> >  .../intel/int340x_thermal/int3400_thermal.c   | 60
> > +++++++++++++++++++
> >  1 file changed, 60 insertions(+)
> > 
> > diff --git
> > a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> > b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> > index ceef89c956bd4..00a7732724cd0 100644
> > --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> > +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> > @@ -52,6 +52,25 @@ struct int3400_thermal_priv {
> >  	u8 uuid_bitmap;
> >  	int rel_misc_dev_res;
> >  	int current_uuid_index;
> > +	char *data_vault;
> > +};
> > +
> > +static ssize_t data_vault_read(struct file *file, struct kobject
> > *kobj,
> > +	     struct bin_attribute *attr, char *buf, loff_t off, size_t
> > count)
> > +{
> > +	memcpy(buf, attr->private + off, count);
> > +	return count;
> > +}
> > +
> > +static BIN_ATTR_RO(data_vault, 0);
> > +
> > +static struct bin_attribute *data_attributes[] = {
> > +	&bin_attr_data_vault,
> > +	NULL,
> > +};
> > +
> > +static const struct attribute_group data_attribute_group = {
> > +	.bin_attrs = data_attributes,
> >  };
> >  
> >  static ssize_t available_uuids_show(struct device *dev,
> > @@ -278,6 +297,32 @@ static struct thermal_zone_params
> > int3400_thermal_params = {
> >  	.no_hwmon = true,
> >  };
> >  
> > +static void int3400_setup_gddv(struct int3400_thermal_priv *priv)
> > +{
> > +	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
> > +	union acpi_object *obj;
> > +	acpi_status status;
> > +
> > +	status = acpi_evaluate_object(priv->adev->handle, "GDDV", NULL,
> > +				      &buffer);
> > +	if (ACPI_FAILURE(status) || !buffer.length)
> > +		return;
> > +
> > +	obj = buffer.pointer;
> > +	if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count != 1
> > +	    || obj->package.elements[0].type != ACPI_TYPE_BUFFER) {
> > +		kfree(buffer.pointer);
> > +		return;
> > +	}
> > +
> > +	priv->data_vault = kmemdup(obj-
> > > package.elements[0].buffer.pointer,
> > +				   obj-
> > > package.elements[0].buffer.length,
> > +				   GFP_KERNEL);
> > +	bin_attr_data_vault.private = priv->data_vault;
> > +	bin_attr_data_vault.size = obj-
> > > package.elements[0].buffer.length;
> > +	kfree(buffer.pointer);
> > +}
> > +
> >  static int int3400_thermal_probe(struct platform_device *pdev)
> >  {
> >  	struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
> > @@ -309,6 +354,8 @@ static int int3400_thermal_probe(struct
> > platform_device *pdev)
> >  
> >  	platform_set_drvdata(pdev, priv);
> >  
> > +	int3400_setup_gddv(priv);
> > +
> >  	int3400_thermal_ops.get_mode = int3400_thermal_get_mode;
> >  	int3400_thermal_ops.set_mode = int3400_thermal_set_mode;
> >  
> > @@ -327,6 +374,13 @@ static int int3400_thermal_probe(struct
> > platform_device *pdev)
> >  	if (result)
> >  		goto free_rel_misc;
> >  
> > +	if (priv->data_vault) {
> > +		result = sysfs_create_group(&pdev->dev.kobj,
> > +					    &data_attribute_group);
> > +		if (result)
> > +			goto free_uuid;
> > +	}
> > +
> >  	result = acpi_install_notify_handler(
> >  			priv->adev->handle, ACPI_DEVICE_NOTIFY,
> > int3400_notify,
> >  			(void *)priv);
> > @@ -336,6 +390,9 @@ static int int3400_thermal_probe(struct
> > platform_device *pdev)
> >  	return 0;
> >  
> >  free_sysfs:
> > +	if (priv->data_vault)
> > +		sysfs_remove_group(&pdev->dev.kobj,
> > &data_attribute_group);
> > +free_uuid:
> >  	sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group);
> >  free_rel_misc:
> >  	if (!priv->rel_misc_dev_res)
> > @@ -360,8 +417,11 @@ static int int3400_thermal_remove(struct
> > platform_device *pdev)
> >  	if (!priv->rel_misc_dev_res)
> >  		acpi_thermal_rel_misc_device_remove(priv->adev-
> > > handle);
> >  
> > +	if (priv->data_vault)
> > +		sysfs_remove_group(&pdev->dev.kobj,
> > &data_attribute_group);
> >  	sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group);
> >  	thermal_zone_device_unregister(priv->thermal);
> > +	kfree(priv->data_vault);
> >  	kfree(priv->trts);
> >  	kfree(priv->arts);
> >  	kfree(priv);

  reply	other threads:[~2020-05-29  6:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14  2:09 [PATCH V2 1/3] thermal/int340x_thermal: Export GDDV Matthew Garrett
2020-04-14  2:09 ` [PATCH V2 2/3] thermal/int340x_thermal: Export OEM vendor variables Matthew Garrett
2020-05-18 23:18   ` Pandruvada, Srinivas
2020-04-14  2:09 ` [PATCH V2 3/3] thermal/int340x_thermal: Don't require IDSP to exist Matthew Garrett
2020-05-18 23:18   ` Pandruvada, Srinivas
2020-04-14  3:33 ` [PATCH V2 1/3] thermal/int340x_thermal: Export GDDV Pandruvada, Srinivas
2020-04-14  3:53   ` Matthew Garrett
2020-04-14  3:58     ` Pandruvada, Srinivas
2020-05-18 23:18 ` Pandruvada, Srinivas
2020-05-29  6:00   ` Pandruvada, Srinivas [this message]
2020-05-29  6:02     ` Zhang Rui

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=fe5119b46d975e4699ced2d9ed12a25f8ae5d1cd.camel@intel.com \
    --to=srinivas.pandruvada@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matthewgarrett@google.com \
    --cc=mjg59@google.com \
    --cc=nisha.aram@intel.com \
    --cc=rui.zhang@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).