[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241019154920.64797b16@jic23-huawei>
Date: Sat, 19 Oct 2024 15:49:20 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Guillaume Stols <gstols@...libre.com>
Cc: Uwe Kleine-König <ukleinek@...nel.org>, Lars-Peter
Clausen <lars@...afoo.de>, Michael Hennerich
<Michael.Hennerich@...log.com>, Rob Herring <robh@...nel.org>, Krzysztof
Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Greg
Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
<rafael@...nel.org>, Jonathan Corbet <corbet@....net>,
linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-fbdev@...r.kernel.org, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-doc@...r.kernel.org,
aardelean@...libre.com, dlechner@...libre.com, jstephan@...libre.com,
nuno.sa@...log.com, Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v5 4/8] iio: adc: ad7606: Add PWM support for conversion
trigger
On Tue, 15 Oct 2024 13:56:17 +0000
Guillaume Stols <gstols@...libre.com> wrote:
> Until now, the conversion were triggered by setting high the GPIO
> connected to the convst pin. This commit gives the possibility to
> connect the convst pin to a PWM.
> Connecting a PWM allows to have a better control on the samplerate,
> but it must be handled with care, as it is completely decorrelated of
> the driver's busy pin handling.
> Hence it is not recommended to be used "as is" but must be exploited
> in conjunction with IIO backend, and for now only a mock functionality
> is enabled, i.e PWM never swings, but is used as a GPIO, i.e duty_cycle
> == period equals high state, duty_cycle == 0 equals low state.
>
> This mock functionality will be disabled after the IIO backend usecase
> is introduced.
>
> Signed-off-by: Guillaume Stols <gstols@...libre.com>
Trivial fix needed so this builds.
> static int ad7606_read_samples(struct ad7606_state *st)
> {
> unsigned int num = st->chip_info->num_channels - 1;
> @@ -324,7 +393,13 @@ static irqreturn_t ad7606_trigger_handler(int irq, void *p)
> error_ret:
> iio_trigger_notify_done(indio_dev->trig);
> /* The rising edge of the CONVST signal starts a new conversion. */
> - gpiod_set_value(st->gpio_convst, 1);
> + if (st->gpio_convst) {
> + gpiod_set_value(st->gpio_convst, 1);
> + } else {
> + ret = ad7606_pwm_set_high(st)
Missing ;
> + if (ret < 0)
> + dev_err(st->dev, "Could not set PWM to high.");
> + }
Powered by blists - more mailing lists