lkml.org 
[lkml]   [2016]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC,2/2] hwmon: adt7411: add min, max and alarm attributes
On Fri, Oct 14, 2016 at 11:43:35AM +0200, Michael Walle wrote:
> This patch adds support for the min, max and alarm attributes of the
> voltage and temperature channels. Additionally, the temp2_fault attribute
> is supported which indicates a fault of the external temperature diode.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> drivers/hwmon/adt7411.c | 306 ++++++++++++++++++++++++++++++++++++++++++------
> 1 file changed, 271 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c
> index 2f44cdc..c6351b8 100644
> --- a/drivers/hwmon/adt7411.c
> +++ b/drivers/hwmon/adt7411.c
[ ... ]
> static int adt7411_read_in_vdd(struct device *dev, u32 attr, long *val)
> {
> struct adt7411_data *data = dev_get_drvdata(dev);
> @@ -179,32 +242,40 @@ static int adt7411_read_in_vdd(struct device *dev, u32 attr, long *val)
> return ret;
> *val = ret * 7000 / 1024;
> return 0;
> + case hwmon_in_min:
> + ret = i2c_smbus_read_byte_data(client, ADT7411_REG_VDD_LOW);
> + if (ret < 0)
> + return ret;
> + *val = ret * 7000 / 256;
> + return 0;
> + case hwmon_in_max:
> + ret = i2c_smbus_read_byte_data(client, ADT7411_REG_VDD_HIGH);
> + if (ret < 0)
> + return ret;
> + *val = ret * 7000 / 256;

return 0;

> + case hwmon_in_alarm:
> + return adt7411_read_in_alarm(dev, 0, val);
> default:
> return -EOPNOTSUPP;
> }
> }

\
 
 \ /
  Last update: 2016-11-19 21:55    [W:0.099 / U:1.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site