Re: [PATCH] hwmon: (emc1403) Decode fractional temperatures.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 28, 2024 at 11:00:47AM -0700, Guenter Roeck wrote:
> On Fri, Apr 26, 2024 at 04:13:22PM +0200, Lars Petter Mostad wrote:
> > Decode all diode data low byte registers.
> > 
> All ?
> 
> > Signed-off-by: Lars Petter Mostad <lars.petter.mostad@xxxxxxxxxx>
> > ---
> >  drivers/hwmon/emc1403.c | 34 ++++++++++++++++++++++++++++++++--
> >  1 file changed, 32 insertions(+), 2 deletions(-)
> > 
> > 
> > base-commit: e723f6ca39fb54ae31f79b5af74fe8496308d4de
> > 
> > diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c
> > index d370efd6f986..2b14db802f96 100644
> > --- a/drivers/hwmon/emc1403.c
> > +++ b/drivers/hwmon/emc1403.c
> > @@ -37,13 +37,43 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *attr,
> >  {
> >  	struct sensor_device_attribute *sda = to_sensor_dev_attr(attr);
> >  	struct thermal_data *data = dev_get_drvdata(dev);
> > -	unsigned int val;
> > +	unsigned int val, val_lowbyte;
> 
> FWIW, this is wrong. The upper bit of the high byte is a sign bit
> on emc1438.
> 
> >  	int retval;
> > +	int idx_lowbyte;
> > +
> > +	switch (sda->index) {
> > +	case 0x00:
> > +		idx_lowbyte = 0x29;
> > +		break;
> > +	case 0x01:
> > +		idx_lowbyte = 0x10;
> > +		break;
> > +	case 0x23:
> > +	case 0x2a:
> > +	case 0x41:
> > +	case 0x43:
> > +	case 0x45:
> > +	case 0x47:
> > +		idx_lowbyte = sda->index + 1;
> > +		break;
> 
> What about the following ?
> 
> 2c -> 2e
> 2d -> 2f

Also all other limit registers, and for those the write part is missing.

Guenter




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux