Patch "iio: adc: ad4130: only set GPIO_CTRL if pin is unused" has been added to the 6.7-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    iio: adc: ad4130: only set GPIO_CTRL if pin is unused

to the 6.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iio-adc-ad4130-only-set-gpio_ctrl-if-pin-is-unused.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6514e2dd79779b62fda02f5b2e42d4f1e921d16b
Author: Cosmin Tanislav <demonsingur@xxxxxxxxx>
Date:   Wed Feb 7 15:20:06 2024 +0200

    iio: adc: ad4130: only set GPIO_CTRL if pin is unused
    
    [ Upstream commit 78367c32bebfe833cd30c855755d863a4ff3fdee ]
    
    Currently, GPIO_CTRL bits are set even if the pins are used for
    measurements.
    
    GPIO_CTRL bits should only be set if the pin is not used for
    other functionality.
    
    Fix this by only setting the GPIO_CTRL bits if the pin has no
    other function.
    
    Fixes: 62094060cf3a ("iio: adc: ad4130: add AD4130 driver")
    Signed-off-by: Cosmin Tanislav <demonsingur@xxxxxxxxx>
    Reviewed-by: Nuno Sa <nuno.sa@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240207132007.253768-2-demonsingur@xxxxxxxxx
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iio/adc/ad4130.c b/drivers/iio/adc/ad4130.c
index 9daeac16499b..62490424b6ae 100644
--- a/drivers/iio/adc/ad4130.c
+++ b/drivers/iio/adc/ad4130.c
@@ -1891,10 +1891,14 @@ static int ad4130_setup(struct iio_dev *indio_dev)
 		return ret;
 
 	/*
-	 * Configure all GPIOs for output. If configured, the interrupt function
-	 * of P2 takes priority over the GPIO out function.
+	 * Configure unused GPIOs for output. If configured, the interrupt
+	 * function of P2 takes priority over the GPIO out function.
 	 */
-	val =  AD4130_IO_CONTROL_GPIO_CTRL_MASK;
+	val = 0;
+	for (i = 0; i < AD4130_MAX_GPIOS; i++)
+		if (st->pins_fn[i + AD4130_AIN2_P1] == AD4130_PIN_FN_NONE)
+			val |= FIELD_PREP(AD4130_IO_CONTROL_GPIO_CTRL_MASK, BIT(i));
+
 	val |= FIELD_PREP(AD4130_IO_CONTROL_INT_PIN_SEL_MASK, st->int_pin_sel);
 
 	ret = regmap_write(st->regmap, AD4130_IO_CONTROL_REG, val);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux