Re: Questions related to some drivers

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

 



Hi,

On 11/06, Ardelean, Alexandru wrote:
For AD778x you could also add support for the GAIN & FILTER pins via GPIOs,
to control these settings. And then in the ad7780_postprocess_sample()
function check if the GPIO settings (stored on a gpio_desc on ad7780_state)
match the expected GAIN & FILTER bit settings ; if not return -EIO.

We're having some trouble with the GPIOs, and would like some insight on
how to proceed. Any help would be very much appreciated!

We're wondering if we should do something like this in ad7780.c's probe:

st->powerdown_gpio = devm_gpiod_get_optional(&spi->dev,
					     "powerdown",
					     GPIOD_OUT_LOW);

for both gain and filter. Taking a look at driver drivers/iio/adc/hx711.c
(another adc driver out of staging), we have:

hx711_data->gpiod_pd_sck = devm_gpiod_get(dev, "sck", GPIOD_OUT_LOW);

So we're assuming "sck" and "powerdown" are the pins we're looking for. Are we
correct to assume that these strings are compared with a table that map the
actual GPIO pins? So we'd have something like:

st->gain_gpio = devm_gpiod_get_optional(&spi->dev,
					"gain",
					GPIO_DOUT_LOW);

Where "gain" is the pin 4 or 5 on the AD778x
(https://www.analog.com/media/en/technical-documentation/data-sheets/ad7780.pdf)
chip.

Where can we find this table that maps these pin names to the actual pin
numbers? We found this link
https://www.kernel.org/doc/html/v4.17/driver-api/gpio/board.html that shows how
to declare table attributes, but we couldn't find this lookup table there.

Are we missing something? Out of curiosity, why do we have to pass a string
(e.g. powerdown, gain, sck, dout) instead of the pin number? We found somewhere
that they are names to functions. Are these functions implemented on the chip?

Thanks,
Renato



[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