[v2,1/1] hwmon: (nct7904) Fix the incorrect value of vsen_mask in nct7904_data struct.

2019-09-15 Thread Amy.Shih
From: "amy.shih" 

Voltage sensors overlap with external temperature sensors. Detect
the multi-function of voltage, thermal diode and thermistor from
register VT_ADC_MD_REG to set value of vsen_mask in nct7904_data
struct.

Signed-off-by: amy.shih 
---
Changes in v2:
- Moved the if statement to outside.
 drivers/hwmon/nct7904.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c
index 95b447cfa24c..e2b3ec74491a 100644
--- a/drivers/hwmon/nct7904.c
+++ b/drivers/hwmon/nct7904.c
@@ -921,6 +921,8 @@ static int nct7904_probe(struct i2c_client *client,
data->tcpu_mask &= ~bit;
else if (val == 0x1 || val == 0x2)
data->temp_mode |= bit;
+   if (val != 0)
+   data->vsen_mask &= ~(0x06 << (i * 2));
}
 
/* PECI */
-- 
2.17.1



Re: [v1,1/1] hwmon: (nct7904) Fix the incorrect value of vsen_mask in nct7904_data struct.

2019-09-15 Thread Guenter Roeck

On 9/15/19 7:18 PM, amy.s...@advantech.com.tw wrote:

From: "amy.shih" 

Voltage sensors overlap with external temperature sensors. Detect
the multi-function of voltage, thermal diode and thermistor from
register VT_ADC_MD_REG to set value of vsen_mask in nct7904_data
struct.

Signed-off-by: amy.shih 
---
  drivers/hwmon/nct7904.c | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c
index 95b447cfa24c..ad61c3d92411 100644
--- a/drivers/hwmon/nct7904.c
+++ b/drivers/hwmon/nct7904.c
@@ -919,8 +919,11 @@ static int nct7904_probe(struct i2c_client *client,
bit = (1 << i);
if (val == 0)
data->tcpu_mask &= ~bit;
-   else if (val == 0x1 || val == 0x2)
+   else if (val == 0x1 || val == 0x2) {
data->temp_mode |= bit;
+   data->vsen_mask &= ~(0x06 << (i * 2));
+   } else
+   data->vsen_mask &= ~(0x06 << (i * 2));


The second instruction is the same for both branches of the if()
statement and can thus be moved outside.

Either case, if {} is needed for one branch of an if statement,
it needs to be used for the other branch(es) as well.

Guenter


[v1,1/1] hwmon: (nct7904) Fix the incorrect value of vsen_mask in nct7904_data struct.

2019-09-15 Thread Amy.Shih
From: "amy.shih" 

Voltage sensors overlap with external temperature sensors. Detect
the multi-function of voltage, thermal diode and thermistor from
register VT_ADC_MD_REG to set value of vsen_mask in nct7904_data
struct.

Signed-off-by: amy.shih 
---
 drivers/hwmon/nct7904.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c
index 95b447cfa24c..ad61c3d92411 100644
--- a/drivers/hwmon/nct7904.c
+++ b/drivers/hwmon/nct7904.c
@@ -919,8 +919,11 @@ static int nct7904_probe(struct i2c_client *client,
bit = (1 << i);
if (val == 0)
data->tcpu_mask &= ~bit;
-   else if (val == 0x1 || val == 0x2)
+   else if (val == 0x1 || val == 0x2) {
data->temp_mode |= bit;
+   data->vsen_mask &= ~(0x06 << (i * 2));
+   } else
+   data->vsen_mask &= ~(0x06 << (i * 2));
}
 
/* PECI */
-- 
2.17.1



[GIT PULL] hwmon updates for v5.4

2019-09-15 Thread Guenter Roeck
Hi Linus,

Please pull hwmon updates for Linux v5.4 from signed tag:

git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git 
hwmon-for-v5.4

Thanks,
Guenter
--

The following changes since commit a55aa89aab90fae7c815b0551b07be37db359d76:

  Linux 5.3-rc6 (2019-08-25 12:01:23 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git 
tags/hwmon-for-v5.4

for you to fetch changes up to 4e19e72f45d360975c59df8272f98bff59f6b748:

  hwmon: submitting-patches: Add note on comment style (2019-09-13 05:43:06 
-0700)


hwmon updates for v5.4

New drivers and chip support
- Add Inspur Power System power supply driver
- Add Synaptics AS370 PVT sensor driver
- Add support for SHTC3 to shtc1 driver
- Add support for NCT6116 to nct6775 driver
- Add support for AMD family 17h, model 70h CPUs to k10temp driver
- Add support for PCT2075 to lm75 driver

Removed drivers
- Remove ads1015 driver (now supported in iio)

Other changes
- Convert drivers to use devm_i2c_new_dummy_device
- Substantial structural improvements in lm75 driver
  Add support for writing sample interval for supported chips
- Add support for PSU version 2 to ibm-cffps driver
- Add support for power attribute to iio_hwmon bridge
- Add support for additional fan, voltage and temperature attributes
  to nct7904 driver
- Convert adt7475 driver to use hwmon_device_register_with_groups()
- Convert k8temp driver to use hwmon_device_register_with_info()
- Various other improvements and minor fixes


Bartosz Golaszewski (1):
  hwmon: pmbus: ucd9000: remove unneeded include

Björn Gerhart (1):
  hwmon: (nct6775) Integrate new model nct6116

Christophe JAILLET (1):
  hwmon: (pmbus/max31785) Remove a useless #define

Dan Robertson (2):
  hwmon: (shtc1) fix shtc1 and shtw1 id mask
  hwmon: (shtc1) add support for the SHTC3 sensor

Daniel Mack (2):
  device-tree: bindinds: add NXP PCT2075 as compatible device to LM75
  hwmon: (lm75) add support for PCT2075

Eddie James (2):
  dt-bindings: hwmon: Document ibm,cffps2 compatible string
  pmbus: (ibm-cffps) Add support for version 2 of the PSU

Grant McEwan (1):
  hwmon: (adt7475) Convert to use hwmon_device_register_with_groups()

Guenter Roeck (8):
  hwmon: (lm75) Fix write operations for negative temperatures
  hwmon: Remove ads1015 driver
  hwmon: (lm75) Support configuring the sample time for various chips
  hwmon: (lm75) Move updating the sample interval to its own function
  hwmon: (lm75) Add support for writing conversion time for TMP112
  hwmon: (lm75) Add support for writing sampling period on PCT2075
  hwmon: submitting-patches: Point to with_info API
  hwmon: submitting-patches: Add note on comment style

Iker Perez del Palomar Sustatxa (5):
  hwmon: (lm75) Create structure to save all the configuration parameters.
  hwmon: (lm75) Create function from code to write into registers
  hwmon: (lm75) Add new fields into lm75_params_
  hwmon: (lm75) Modularize lm75_write and make hwmon_chip writable
  hwmon: (lm75) Aproximate sample times to data-sheet values

Jean Delvare (1):
  hwmon: w83795: Fan control option isn't that dangerous

Jisheng Zhang (2):
  hwmon: Add Synaptics AS370 PVT sensor driver
  hwmon: (as370-hwmon) Add DT bindings for Synaptics AS370 PVT

John Wang (2):
  hwmon: pmbus: Add Inspur Power System power supply driver
  dt-bindings: Add ipsps1 as a trivial device

Marcel Bocu (2):
  x86/amd_nb: Add PCI device IDs for family 17h, model 70h
  hwmon: (k10temp) Add support for AMD family 17h, model 70h CPUs

Mauro Carvalho Chehab (1):
  docs: hwmon: pxe1610: convert to ReST format and add to the index

Max Staudt (1):
  hwmon/ltc2990: Generalise DT to fwnode support

Michal Simek (1):
  hwmon: (iio_hwmon) Enable power exporting from IIO

Robert Karszniewicz (1):
  hwmon: (k8temp) update to use new hwmon registration API

Stefan Wahren (1):
  hwmon: (raspberrypi) update MODULE_AUTHOR() email address

Stephen Boyd (1):
  hwmon: (npcm750-pwm-fan) Remove dev_err() usage after platform_get_irq()

Wang Shenran (1):
  hwmon: (acpi_power_meter) Change log level for 'unsafe software power cap'

Wenwen Wang (1):
  hwmon (coretemp) Fix a memory leak bug

Wolfram Sang (6):
  hwmon: (asb100) convert to i2c_new_dummy_device
  hwmon: (smm665) convert to i2c_new_dummy_device
  hwmon: (w83781d) convert to i2c_new_dummy_device
  hwmon: (w83791d) convert to use devm_i2c_new_dummy_device
  hwmon: (w83792d) convert to use devm_i2c_new_dummy_device
  hwmon: (w83793d) convert to use devm_i2c_new_dummy_device

amy.shih (3):
  hwmon: (nct7904) Add extra sysfs support for fan, voltage and temperature.
  hwmon: (nct7904) Fix incorrect