Re: [PATCH 1/2] iio: adc: xilinx-xadc: Don't clobber preset voltage/temperature thresholds

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

 



On Thu, 2023-09-14 at 15:24 -0600, Robert Hancock wrote:
> In the probe function, the driver was reading out the thresholds
> already
> set in the core, which can be configured by the user in the Vivado
> tools
> when the FPGA image is built. However, it later clobbered those
> values
> with zero or maximum values. In particular, the overtemperature
> shutdown
> threshold register was overwritten with the max value, which
> effectively
> prevents the FPGA from shutting down when the desired threshold was
> eached, potentially risking hardware damage in that case.
> 
> Remove this code to leave the preconfigured default threshold values
> intact.

Apparently this change is necessary but not sufficient, as the driver
is also disabling all the alarm bits which are needed for the
overtemperature shutdown to actually function. Will follow up with a
new version shortly.

> 
> Fixes: bdc8cda1d010 ("iio:adc: Add Xilinx XADC driver")
> Signed-off-by: Robert Hancock <robert.hancock@xxxxxxxxxx>
> ---
>  drivers/iio/adc/xilinx-xadc-core.c | 16 ----------------
>  1 file changed, 16 deletions(-)
> 
> diff --git a/drivers/iio/adc/xilinx-xadc-core.c
> b/drivers/iio/adc/xilinx-xadc-core.c
> index dba73300f894..88d523ac7881 100644
> --- a/drivers/iio/adc/xilinx-xadc-core.c
> +++ b/drivers/iio/adc/xilinx-xadc-core.c
> @@ -1429,22 +1429,6 @@ static int xadc_probe(struct platform_device
> *pdev)
>         if (ret)
>                 return ret;
>  
> -       /* Set thresholds to min/max */
> -       for (i = 0; i < 16; i++) {
> -               /*
> -                * Set max voltage threshold and both temperature
> thresholds to
> -                * 0xffff, min voltage threshold to 0.
> -                */
> -               if (i % 8 < 4 || i == 7)
> -                       xadc->threshold[i] = 0xffff;
> -               else
> -                       xadc->threshold[i] = 0;
> -               ret = xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
> -                       xadc->threshold[i]);
> -               if (ret)
> -                       return ret;
> -       }
> -
>         /* Go to non-buffered mode */
>         xadc_postdisable(indio_dev);
>  





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux