Re: [PATCHv4] hwmon: Add tc654 driver

2016-10-12 Thread Chris Packham
On 10/13/2016 02:03 AM, Guenter Roeck wrote:
> On Tue, Oct 11, 2016 at 10:26:31AM +1300, Chris Packham wrote:
>> > Add support for the tc654 and tc655 fan controllers from Microchip.
>> >
>> > http://ww1.microchip.com/downloads/en/DeviceDoc/20001734C.pdf
>> >
>> > Signed-off-by: Chris Packham 
>> > Acked-by: Rob Herring 
> Applied to -next (after fixing continuation line alignments).
>

Sorry about those. I'll try to do better next time.



Re: [PATCHv4] hwmon: Add tc654 driver

2016-10-12 Thread Guenter Roeck
On Tue, Oct 11, 2016 at 10:26:31AM +1300, Chris Packham wrote:
> Add support for the tc654 and tc655 fan controllers from Microchip.
> 
> http://ww1.microchip.com/downloads/en/DeviceDoc/20001734C.pdf
> 
> Signed-off-by: Chris Packham 
> Acked-by: Rob Herring 

Applied to -next (after fixing continuation line alignments).

Guenter

> ---
> Changes in v4:
> - tab-align values in #defines
> - ensure locking in set_pwm covers updating cached values
> - populate the cached value for the config register in tc654_probe()
> 
> Changes in v3:
> - typofix in documentation
> - add missing value to tc654_pwm_map, re-generate based on datasheet.
> - remove unnecessary hwmon_dev member from struct tc654_data
> - bug fixes in set_fan_min() and show_pwm_mode()
> - miscellaneous style fixes
>  
> Changes in v2:
> - Add Documentation/hwmon/tc654
> - Incorporate most of the review comments from Guenter. Additional error
>   handling is added. Unused/unnecessary code is removed. I decided not
>   to go down the regmap path yet. I may circle back to it when I look at
>   using regmap in the adm9240 driver.
> 
>  .../devicetree/bindings/i2c/trivial-devices.txt|   2 +
>  Documentation/hwmon/tc654  |  31 ++
>  drivers/hwmon/Kconfig  |  11 +
>  drivers/hwmon/Makefile |   1 +
>  drivers/hwmon/tc654.c  | 514 
> +
>  5 files changed, 559 insertions(+)
>  create mode 100644 Documentation/hwmon/tc654
>  create mode 100644 drivers/hwmon/tc654.c
> 
> diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt 
> b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
> index 1416c6a0d2cd..833fb9f133d3 100644
> --- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
> +++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
> @@ -122,6 +122,8 @@ microchip,mcp4662-502 Microchip 8-bit Dual I2C 
> Digital Potentiometer with NV Mem
>  microchip,mcp4662-103Microchip 8-bit Dual I2C Digital Potentiometer 
> with NV Memory (10k)
>  microchip,mcp4662-503Microchip 8-bit Dual I2C Digital Potentiometer 
> with NV Memory (50k)
>  microchip,mcp4662-104Microchip 8-bit Dual I2C Digital Potentiometer 
> with NV Memory (100k)
> +microchip,tc654  PWM Fan Speed Controller With Fan Fault 
> Detection
> +microchip,tc655  PWM Fan Speed Controller With Fan Fault 
> Detection
>  national,lm63Temperature sensor with integrated fan control
>  national,lm75I2C TEMP SENSOR
>  national,lm80Serial Interface ACPI-Compatible Microprocessor 
> System Hardware Monitor
> diff --git a/Documentation/hwmon/tc654 b/Documentation/hwmon/tc654
> new file mode 100644
> index ..91a2843f5f98
> --- /dev/null
> +++ b/Documentation/hwmon/tc654
> @@ -0,0 +1,31 @@
> +Kernel driver tc654
> +===
> +
> +Supported chips:
> +  * Microship TC654 and TC655
> +Prefix: 'tc654'
> +Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/20001734C.pdf
> +
> +Authors:
> +Chris Packham 
> +Masahiko Iwamoto 
> +
> +Description
> +---
> +This driver implements support for the Microchip TC654 and TC655.
> +
> +The TC654 uses the 2-wire interface compatible with the SMBUS 2.0
> +specification. The TC654 has two (2) inputs for measuring fan RPM and
> +one (1) PWM output which can be used for fan control.
> +
> +Configuration Notes
> +---
> +Ordinarily the pwm1_mode ABI is used for controlling the pwm output
> +mode.  However, for this chip the output is always pwm, and the
> +pwm1_mode determines if the pwm output is controlled via the pwm1 value
> +or via the Vin analog input.
> +
> +
> +Setting pwm1_mode to 1 will cause the pwm output to be driven based on
> +the pwm1 value. Setting pwm1_mode to 0 will cause the pwm output to be
> +driven based on the Vin input.
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 45cef3d2c75c..8681bc65cde5 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -907,6 +907,17 @@ config SENSORS_MCP3021
> This driver can also be built as a module.  If so, the module
> will be called mcp3021.
>  
> +config SENSORS_TC654
> + tristate "Microchip TC654/TC655 and compatibles"
> + depends on I2C
> + help
> +   If you say yes here you get support for TC654 and TC655.
> +   The TC654 and TC655 are PWM mode fan speed controllers with
> +   FanSense technology for use with brushless DC fans.
> +
> +   This driver can also be built as a module.  If so, the module
> +   will be called tc654.
> +
>  config SENSORS_MENF21BMC_HWMON
>   tristate "MEN 14F021P00 BMC Hardware Monitoring"
>   depends on MFD_MENF21BMC
> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> index aecf4ba17460..c651f0f1d047 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon

Re: [PATCHv4] hwmon: Add tc654 driver

2016-10-10 Thread Rob Herring
On Tue, Oct 11, 2016 at 10:26:31AM +1300, Chris Packham wrote:
> Add support for the tc654 and tc655 fan controllers from Microchip.
> 
> http://ww1.microchip.com/downloads/en/DeviceDoc/20001734C.pdf
> 
> Signed-off-by: Chris Packham 
> ---
> Changes in v4:
> - tab-align values in #defines
> - ensure locking in set_pwm covers updating cached values
> - populate the cached value for the config register in tc654_probe()
> 
> Changes in v3:
> - typofix in documentation
> - add missing value to tc654_pwm_map, re-generate based on datasheet.
> - remove unnecessary hwmon_dev member from struct tc654_data
> - bug fixes in set_fan_min() and show_pwm_mode()
> - miscellaneous style fixes
>  
> Changes in v2:
> - Add Documentation/hwmon/tc654
> - Incorporate most of the review comments from Guenter. Additional error
>   handling is added. Unused/unnecessary code is removed. I decided not
>   to go down the regmap path yet. I may circle back to it when I look at
>   using regmap in the adm9240 driver.
> 
>  .../devicetree/bindings/i2c/trivial-devices.txt|   2 +

Expect a merge conflict with the IIO tree.

Acked-by: Rob Herring 

>  Documentation/hwmon/tc654  |  31 ++
>  drivers/hwmon/Kconfig  |  11 +
>  drivers/hwmon/Makefile |   1 +
>  drivers/hwmon/tc654.c  | 514 
> +
>  5 files changed, 559 insertions(+)
>  create mode 100644 Documentation/hwmon/tc654
>  create mode 100644 drivers/hwmon/tc654.c