All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilia Mirkin <imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
To: Oscar Salvador
	<osalvador.vilardaga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH v2 4/5] nouveau_hwmon: Add support for auto_point attributes
Date: Wed, 19 Apr 2017 14:25:19 -0400	[thread overview]
Message-ID: <CAKb7Uvim8A6jZ_bNu7PsAw+GbtuZyh=RqphNF8e+kKNUhDJrVA@mail.gmail.com> (raw)
In-Reply-To: <1492415272-20378-5-git-send-email-osalvador.vilardaga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Mon, Apr 17, 2017 at 3:47 AM, Oscar Salvador
<osalvador.vilardaga@gmail.com> wrote:
> This patch creates a special group attributes for attrs like "*auto_point*".
> We check if we have support for them, and if we do, we gather them all in
> an attribute_group's structure which is the parameter regarding special groups
> of hwmon_device_register_with_info.
> ---
>  drivers/gpu/drm/nouveau/nouveau_hwmon.c | 29 ++++++++++++++++++++++++++++-
>  1 file changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> index 538bf67..655ae11 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> @@ -359,6 +359,23 @@ nouveau_hwmon_get_power1_crit(struct nouveau_drm *drm)
>         return iccsense->power_w_crit;
>  }
>
> +static struct attribute *pwm_fan_sensor_attrs[] = {

static const struct. Below as well.

> +       &sensor_dev_attr_pwm1_min.dev_attr.attr,
> +       &sensor_dev_attr_pwm1_max.dev_attr.attr,
> +       NULL
> +};
> +ATTRIBUTE_GROUPS(pwm_fan_sensor);
> +
> +static struct attribute *temp1_auto_point_sensor_attrs[] = {
> +       &sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr,
> +       &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
> +       &sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr.attr,
> +       NULL
> +};
> +ATTRIBUTE_GROUPS(temp1_auto_point_sensor);
> +
> +#define N_ATTR_GROUPS   3
> +
>  static const u32 nouveau_config_chip[] = {
>         HWMON_C_UPDATE_INTERVAL,
>         0
> @@ -789,17 +806,27 @@ nouveau_hwmon_init(struct drm_device *dev)
>  #if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
>         struct nouveau_drm *drm = nouveau_drm(dev);
>         struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
> +       const struct attribute_group *special_groups[N_ATTR_GROUPS];
>         struct nouveau_hwmon *hwmon;
>         struct device *hwmon_dev;
>         int ret = 0;
> +       int i = 0;
>
>         hwmon = drm->hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL);
>         if (!hwmon)
>                 return -ENOMEM;
>         hwmon->dev = dev;
>
> +       if (therm && therm->attr_get && therm->attr_set) {
> +               if (nvkm_therm_temp_get(therm) >= 0)
> +                       special_groups[i++] = &temp1_auto_point_sensor_group;
> +               if (therm->fan_get && therm->fan_get(therm) >= 0)
> +                       special_groups[i++] = &pwm_fan_sensor_group;
> +       }
> +
> +       special_groups[i] = 0;
>         hwmon_dev = hwmon_device_register_with_info(dev->dev, "nouveau", dev,
> -                                               &nouveau_chip_info, NULL);
> +                                       &nouveau_chip_info, special_groups);
>         if (IS_ERR(hwmon_dev)) {
>                 ret = PTR_ERR(hwmon_dev);
>                 NV_ERROR(drm, "Unable to register hwmon device: %d\n", ret);
> --
> 2.1.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2017-04-19 18:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-17  7:47 [PATCH v2 0/5] replace hwmon_device_register for hwmon_device_register_with_info Oscar Salvador
     [not found] ` <1492415272-20378-1-git-send-email-osalvador.vilardaga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-17  7:47   ` [PATCH v2 1/5] nouveau_hwmon: Add config for all sensors and their settings Oscar Salvador
     [not found]     ` <1492415272-20378-2-git-send-email-osalvador.vilardaga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-19 18:11       ` Ilia Mirkin
2017-04-19 18:18         ` [Nouveau] " Oscar Salvador
2017-04-17  7:47   ` [PATCH v2 2/5] nouveau_hwmon: Add nouveau_hwmon_ops structure with .is_visible/.read_string Oscar Salvador
     [not found]     ` <1492415272-20378-3-git-send-email-osalvador.vilardaga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-18  7:56       ` Karol Herbst
2017-04-20  6:47         ` [Nouveau] " Oscar Salvador
2017-04-20  7:32           ` Oscar Salvador
2017-04-19 18:19       ` Ilia Mirkin
2017-04-17  7:47   ` [PATCH v2 3/5] nouveau_hwmon: Remove old code, add .write/.read operations Oscar Salvador
2017-04-17  7:47   ` [PATCH v2 4/5] nouveau_hwmon: Add support for auto_point attributes Oscar Salvador
     [not found]     ` <1492415272-20378-5-git-send-email-osalvador.vilardaga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-19 18:25       ` Ilia Mirkin [this message]
2017-04-17  7:47   ` [PATCH v2 5/5] nouveau_hwmon: Change permissions to numeric Oscar Salvador

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='CAKb7Uvim8A6jZ_bNu7PsAw+GbtuZyh=RqphNF8e+kKNUhDJrVA@mail.gmail.com' \
    --to=imirkin-frubxkncsvf2fbvcvol8/a@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=osalvador.vilardaga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.