Re: [PATCH] hwmon: (dell-smm) Add Dell XPS 15 9560 into DMI list

2017-03-08 Thread Guenter Roeck

On 03/03/2017 02:41 PM, Pali Rohár wrote:

It was reported that dell-smm-hwmon is working fine on Dell XPS 15 9560.

Link: http://www.spinics.net/lists/platform-driver-x86/msg10751.html
Reported-by: Vasile Dumitrescu 
Signed-off-by: Pali Rohár 


With Vasile's feedback, I'll consider this patch tested and will apply it
to hwmon-next.

Thanks,
Guenter



---
 drivers/hwmon/dell-smm-hwmon.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index 34704b0..3189246 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -995,6 +995,13 @@ enum i8k_configs {
},
.driver_data = (void *)_config_data[DELL_XPS],
},
+   {
+   .ident = "Dell XPS 15 9560",
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+   DMI_MATCH(DMI_PRODUCT_NAME, "XPS 15 9560"),
+   },
+   },
{ }
 };




--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] hwmon: (dell-smm) Add Dell XPS 15 9560 into DMI list

2017-03-08 Thread Jean Delvare
On Wed, 8 Mar 2017 20:25:33 +0100, Vasile Dumitrescu wrote:
> sudo sensors
> =>

Note that you don't need to be root to run "sensors".

> (...)
> dell_smm-virtual-0
> Adapter: Virtual device
> Processor Fan: 2490 RPM
> Video Fan: 2493 RPM
> CPU:+48.0°C
> Ambient:+48.0°C
> Ambient:+44.0°C
> Other:  +40.0°C
> 
> sudo pwmconfig
> => fans definitely stop and restart as the script indicates they should
> 
> Conclusion: works for me (TM) - without force or any special options
> 
> Thanks Jean, that was easy.

You're welcome, glad I could help :-)

> Looking forward to see it in some future kernel.

-- 
Jean Delvare
SUSE L3 Support
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/2] scpi-sensors: Fix SCP sensor readings scale

2017-03-08 Thread Guenter Roeck
On Wed, Mar 08, 2017 at 09:24:38AM +0100, Carlo Caione wrote:
> On Fri, Mar 3, 2017 at 10:14 AM, Carlo Caione  wrote:
> > From: Carlo Caione 
> >
> > The implementation details for SCPI seems to suggest that the sensor
> > readings must be reported by SCP using a well defined scale
> > (millidegree Celsius for temperature, millivolts for voltage,
> > milliamperes for current, microwatts for power and microjoules for
> > energy).
> >
> > This is also important for the interaction with other subsystems: for
> > example both the thermal sub-system and the hwmon sysfs interface expect
> > the temperature expressed in millidegree Celsius.
> >
> > Unfortunately since this behaviour is dependent on the firmware
> > implementation there are cases where the sensor readings are reported
> > using a different scale. For example in the Amlogic SoCs the
> > temperature is reported in degree and not millidegree Celsius.
> >
> > In this patchset we introduce a new DT property `scpi,sensors-scale` that is
> > used by the scpi-hwmon driver to convert the sensor readings to the expected
> > scale.
> >
> > v2:
> >  - Added data validation (scale != 0)
> >  - s/unsigned int/u32/ for the array
> >  - Switched to array initialiser notation
> >  - Introduced scpi_scale_reading()
> 
> gentle ping
> 

Waiting for Rob to provide feedback on the devicetree property.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] hwmon: (dell-smm) Add Dell XPS 15 9560 into DMI list

2017-03-08 Thread Vasile Dumitrescu
Wow, that was easy :-).

so I did:
download the driver source and makefile
make
=> several new files show up including a .ko - WOHOOO
sudo rmmod dell-smm-hwmon
lsmod | grep hwmo
=> nothing
sudo insmod ./dell-smm-hwmon.ko
=> nothing
lsmod | grep hwmo
=> dell_smm_hwmon 16384  0

sudo sensors
=>
coretemp-isa-
Adapter: ISA adapter
Physical id 0:  +50.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0: +47.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1: +50.0°C  (high = +100.0°C, crit = +100.0°C)
Core 2: +46.0°C  (high = +100.0°C, crit = +100.0°C)
Core 3: +48.0°C  (high = +100.0°C, crit = +100.0°C)

acpitz-virtual-0
Adapter: Virtual device
temp1:+25.0°C  (crit = +107.0°C)

dell_smm-virtual-0
Adapter: Virtual device
Processor Fan: 2490 RPM
Video Fan: 2493 RPM
CPU:+48.0°C
Ambient:+48.0°C
Ambient:+44.0°C
Other:  +40.0°C

sudo pwmconfig
=> fans definitely stop and restart as the script indicates they should

Conclusion: works for me (TM) - without force or any special options

Thanks Jean, that was easy.

Looking forward to see it in some future kernel.

Kind regards
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/2] hwmon: (scpi) Fix the scale of SCP sensor readings

2017-03-08 Thread Punit Agrawal
Carlo Caione  writes:

> From: Carlo Caione 
>
> The implementation details for SCPI seems to suggest that the sensor
> readings must be reported by SCP using a well defined scale
> (millidegree Celsius for temperature, millivolts for voltage,
> milliamperes for current, microwatts for power and microjoules for
> energy).
>
> This is also important for the interaction with other subsystems: for
> example both the thermal sub-system and the hwmon sysfs interface expect
> the temperature expressed in millidegree Celsius.
>
> Unfortunately since this behaviour is dependent on the firmware
> implementation there are cases where the sensor readings are reported
> using a different scale. For example in the Amlogic SoCs the
> temperature is reported in degree and not millidegree Celsius.
>
> To take into account this discrepancy and fixup the values reported by
> SCP a new DT property `scpi,sensors-scale' is introduced and used in
> this patch by the scpi-hwmon driver to convert the sensor readings to
> the expected scale.
>
> Signed-off-by: Carlo Caione 
> ---
>  drivers/hwmon/scpi-hwmon.c | 34 ++
>  1 file changed, 34 insertions(+)
>
> diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
> index 094f948f99ff..b64fe7d10742 100644
> --- a/drivers/hwmon/scpi-hwmon.c
> +++ b/drivers/hwmon/scpi-hwmon.c
> @@ -23,6 +23,7 @@
>  #include 
>  
>  struct sensor_data {
> + unsigned int scale;
>   struct scpi_sensor_info info;
>   struct device_attribute dev_attr_input;
>   struct device_attribute dev_attr_label;
> @@ -44,6 +45,22 @@ struct scpi_sensors {
>   const struct attribute_group *groups[2];
>  };
>  
> +static const u32 scpi_scale[] = {
> + [TEMPERATURE]   = 1000, /* (millicelsius)   */
> + [VOLTAGE]   = 1000, /* (millivolts) */
> + [CURRENT]   = 1000, /* (milliamperes)   */
> + [POWER] = 100,  /* (microwatts) */
> + [ENERGY]= 100,  /* (microjoules)*/
> +};
> +
> +void scpi_scale_reading(u64 *value, struct sensor_data *sensor)

This function is not intended for use outside this file. Please mark as
static.

> +{
> + if (scpi_scale[sensor->info.class] != sensor->scale) {
> + *value *= scpi_scale[sensor->info.class];
> + do_div(*value, sensor->scale);
> + }
> +}
> +
>  static int scpi_read_temp(void *dev, int *temp)
>  {
>   struct scpi_thermal_zone *zone = dev;
> @@ -57,6 +74,8 @@ static int scpi_read_temp(void *dev, int *temp)
>   if (ret)
>   return ret;
>  
> + scpi_scale_reading(, sensor);
> +
>   *temp = value;
>   return 0;
>  }
> @@ -77,6 +96,8 @@ scpi_show_sensor(struct device *dev, struct 
> device_attribute *attr, char *buf)
>   if (ret)
>   return ret;
>  
> + scpi_scale_reading(, sensor);
> +
>   return sprintf(buf, "%llu\n", value);
>  }
>  
> @@ -97,6 +118,7 @@ static struct thermal_zone_of_device_ops scpi_sensor_ops = 
> {
>  static int scpi_hwmon_probe(struct platform_device *pdev)
>  {
>   u16 nr_sensors, i;
> + u32 scale[] = { 1000, 1000, 1000, 100, 100 };
>   int num_temp = 0, num_volt = 0, num_current = 0, num_power = 0;
>   int num_energy = 0;
>   struct scpi_ops *scpi_ops;
> @@ -131,6 +153,16 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
>  
>   scpi_sensors->scpi_ops = scpi_ops;
>  
> + of_property_read_u32_array(dev->of_node, "scpi,sensors-scale",
> +scale, ARRAY_SIZE(scale));
> +
> + for (i = 0; i < ARRAY_SIZE(scale); i++) {
> + if (!scale[i]) {
> + dev_err(dev, "%s: scale cannot be zero (%d)\n", 
> __func__, i);
> + return -EINVAL;
> + }
> + }
> +
>   for (i = 0, idx = 0; i < nr_sensors; i++) {
>   struct sensor_data *sensor = _sensors->data[idx];
>  
> @@ -178,6 +210,8 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
>   continue;
>   }
>  
> + sensor->scale = scale[sensor->info.class];
> +
>   sensor->dev_attr_input.attr.mode = S_IRUGO;
>   sensor->dev_attr_input.show = scpi_show_sensor;
>   sensor->dev_attr_input.attr.name = sensor->input;

So with the function marked as static,

Acked-by: Punit Agrawal 
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/2] scpi-sensors: Fix SCP sensor readings scale

2017-03-08 Thread Carlo Caione
On Fri, Mar 3, 2017 at 10:14 AM, Carlo Caione  wrote:
> From: Carlo Caione 
>
> The implementation details for SCPI seems to suggest that the sensor
> readings must be reported by SCP using a well defined scale
> (millidegree Celsius for temperature, millivolts for voltage,
> milliamperes for current, microwatts for power and microjoules for
> energy).
>
> This is also important for the interaction with other subsystems: for
> example both the thermal sub-system and the hwmon sysfs interface expect
> the temperature expressed in millidegree Celsius.
>
> Unfortunately since this behaviour is dependent on the firmware
> implementation there are cases where the sensor readings are reported
> using a different scale. For example in the Amlogic SoCs the
> temperature is reported in degree and not millidegree Celsius.
>
> In this patchset we introduce a new DT property `scpi,sensors-scale` that is
> used by the scpi-hwmon driver to convert the sensor readings to the expected
> scale.
>
> v2:
>  - Added data validation (scale != 0)
>  - s/unsigned int/u32/ for the array
>  - Switched to array initialiser notation
>  - Introduced scpi_scale_reading()

gentle ping



-- 
Carlo Caione
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html