Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Riana Tauro <riana.tauro@intel.com>
To: "Poosa, Karthik" <karthik.poosa@intel.com>,
	"Nilawar, Badal" <badal.nilawar@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <anshuman.gupta@intel.com>
Subject: Re: [PATCH] drm/xe/hwmon: Add label support
Date: Tue, 6 Feb 2024 12:43:55 +0530	[thread overview]
Message-ID: <55a03371-9eb7-441a-af18-459d988bede8@intel.com> (raw)
In-Reply-To: <c6cff625-383b-4297-8863-166674d230f6@intel.com>

Hi Karthik

On 2/6/2024 11:17 AM, Poosa, Karthik wrote:
> 
> On 02-02-2024 17:22, Nilawar, Badal wrote:
>>
>>
>> On 01-02-2024 23:28, Karthik Poosa wrote:
>>> Add label for power and energy attributes.
add why label is added
>>>
>>> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
>>> ---
>>>   drivers/gpu/drm/xe/xe_hwmon.c | 24 ++++++++++++++++++++++--
>>>   1 file changed, 22 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c 
>>> b/drivers/gpu/drm/xe/xe_hwmon.c
>>> index 89c6f7f84b5a..9fd70bff3435 100644
>>> --- a/drivers/gpu/drm/xe/xe_hwmon.c
>>> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
>>> @@ -403,10 +403,10 @@ static const struct attribute_group 
>>> *hwmon_groups[] = {
>>>   };
>>>     static const struct hwmon_channel_info * const hwmon_info[] = {
>>> -    HWMON_CHANNEL_INFO(power, HWMON_P_MAX | HWMON_P_RATED_MAX | 
>>> HWMON_P_CRIT),
>>> +    HWMON_CHANNEL_INFO(power, HWMON_P_MAX | HWMON_P_RATED_MAX | 
>>> HWMON_P_CRIT | HWMON_P_LABEL),
>> Is it not possible to expose label for each individual entry?
> You mean like power1_max_label, power1_crit_label ?
> Nope we can't do that, Each entry can have only 1 label, ex: power1_label.
> 
>>>       HWMON_CHANNEL_INFO(curr, HWMON_C_CRIT),
>>>       HWMON_CHANNEL_INFO(in, HWMON_I_INPUT),
>>> -    HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT),
>>> +    HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL),
>>>       NULL
>>>   };
>>>   @@ -484,6 +484,8 @@ xe_hwmon_power_is_visible(struct xe_hwmon 
>>> *hwmon, u32 attr, int chan)
>>>       case hwmon_power_crit:
>>>           return (xe_hwmon_pcode_read_i1(hwmon->gt, &uval) ||
>>>               !(uval & POWER_SETUP_I1_WATTS)) ? 0 : 0644;
>>> +    case hwmon_power_label:
>>> +        return 0444;
>>>       default:
>>>           return 0;
>>>       }
>>> @@ -584,6 +586,8 @@ xe_hwmon_energy_is_visible(struct xe_hwmon 
>>> *hwmon, u32 attr)
>>>       switch (attr) {
>>>       case hwmon_energy_input:
>>>           return xe_hwmon_get_reg(hwmon, REG_PKG_ENERGY_STATUS) ? 
>>> 0444 : 0;
>>> +    case hwmon_energy_label:
>>> +        return 0444;
This should be visible only if any of the energy entries are visible.
Same for power.

Thanks
Riana
>>>       default:
>>>           return 0;
>>>       }
>>> @@ -691,10 +695,26 @@ xe_hwmon_write(struct device *dev, enum 
>>> hwmon_sensor_types type, u32 attr,
>>>       return ret;
>>>   }
>>>   +static int xe_hwmon_read_label(struct device *dev,
>>> +                   enum hwmon_sensor_types type,
>>> +                   u32 attr, int channel, const char **str)
>>> +{
>>> +    switch (type) {
>>> +    case hwmon_power:
>>> +    case hwmon_energy:
>>> +        *str = "card";
>> This should be package instead of card. You may use 'pkg' here.
> Okay.
>>
>> Regards,
>> Badal
>>> +        return 0;
>>> +    default:
>>> +        return -EOPNOTSUPP;
>>> +    }
>>> +}
>>> +
>>> +
>>>   static const struct hwmon_ops hwmon_ops = {
>>>       .is_visible = xe_hwmon_is_visible,
>>>       .read = xe_hwmon_read,
>>>       .write = xe_hwmon_write,
>>> +    .read_string = xe_hwmon_read_label,
>>>   };
>>>     static const struct hwmon_chip_info hwmon_chip_info = {

  reply	other threads:[~2024-02-06  7:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 17:58 [PATCH] drm/xe/hwmon: Add label support Karthik Poosa
2024-02-01 18:10 ` ✓ CI.Patch_applied: success for " Patchwork
2024-02-01 18:10 ` ✗ CI.checkpatch: warning " Patchwork
2024-02-01 18:11 ` ✓ CI.KUnit: success " Patchwork
2024-02-01 18:18 ` ✓ CI.Build: " Patchwork
2024-02-01 18:18 ` ✓ CI.Hooks: " Patchwork
2024-02-01 18:20 ` ✓ CI.checksparse: " Patchwork
2024-02-01 18:43 ` ✓ CI.BAT: " Patchwork
2024-02-02 11:52 ` [PATCH] " Nilawar, Badal
2024-02-06  5:47   ` Poosa, Karthik
2024-02-06  7:13     ` Riana Tauro [this message]
2024-02-06 15:40       ` Poosa, Karthik

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=55a03371-9eb7-441a-af18-459d988bede8@intel.com \
    --to=riana.tauro@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=karthik.poosa@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