I'm trying to enable two instances of AD7606 SPI driver for AD7606C. In order for ADC to start the conversion GPIO pins for CONVST (conversion start), interrupt pin (BUSY pin) and RESET pin have to be defined in the device tree for the driver to use.
Two ADCs are on the SPI bus, each ADC has it's own chip select pin and interrupt/BUSY pin but CONVST and RESET are hardwired and shared between two ADCs, on the same pins.
Device tree is given below, and platform used is STM32MP157C Odyssey.
&spi2 {
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi2_pins_mx>;
pinctrl-1 = <&spi2_sleep_pins_mx>;
status = "okay";
num-cs = <2>;
cs-gpios = <&gpiob 12 GPIO_ACTIVE_LOW>, // ADC CS1
<&gpiod 4 GPIO_ACTIVE_LOW>; // ADC CS2
adc0@0 {
compatible = "adi,ad7606b";
reg = <0>;
spi-max-frequency = <10000000>; // <60MHz if Vdrive > 2.7V, <40MHz if < 2.7V
spi-cpol;
spi-cpha;
avcc-supply = <&vref>;
interrupts = <10 IRQ_TYPE_EDGE_FALLING>; // Port and pin number where BUSY pin is connected
interrupt-parent = <&gpioe>;
adi,conversion-start-gpios = <&gpiof 10 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpioc 0 GPIO_ACTIVE_HIGH>;
adi,sw-mode;
};
adc1@1 {
compatible = "adi,ad7606b";
reg = <1>;
spi-max-frequency = <10000000>;
spi-cpol;
spi-cpha;
avcc-supply = <&vref>;
interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
interrupt-parent = <&gpiod>;
adi,conversion-start-gpios = <&gpiof 10 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpioc 0 GPIO_ACTIVE_HIGH>;
adi,sw-mode;
};
};
The second driver returns probe error -16 (Device or resource busy) because it can't use CONVST and RESET pins that previous driver already allocated.
The second ADC actually works if I assign some random unused GPIOs, read the value from the first ADC (in order to activate CONVST pin), then read the value from second ADC. This is a workaround used currently.
My question is, is it possible somehow to share GPIO pins between two instances of the same driver in Linux?