From: David Lechner <dlechner@baylibre.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Guillaume Stols" <gstols@baylibre.com>
Cc: "Mark Brown" <broonie@kernel.org>,
"Jonathan Cameron" <jic23@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Nuno Sá" <nuno.sa@analog.com>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"David Jander" <david@protonic.nl>,
"Martin Sperl" <kernel@martin.sperl.org>,
linux-spi@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
linux-pwm@vger.kernel.org
Subject: Re: [PATCH RFC v4 01/15] pwm: core: export pwm_get_state_hw()
Date: Tue, 29 Oct 2024 10:30:43 -0500 [thread overview]
Message-ID: <82edfbb9-5e65-4292-b15b-d5cde7b53e42@baylibre.com> (raw)
In-Reply-To: <mavlxxjza7ud7ylgoewz6fz3chtuwljvcjjf6o3kcv555iolwa@wdnrsiow5u5w>
On 10/29/24 3:05 AM, Uwe Kleine-König wrote:
> Hello David,
>
> On Wed, Oct 23, 2024 at 03:59:08PM -0500, David Lechner wrote:
>> Export the pwm_get_state_hw() function. This is useful in cases where
>> we want to know what the hardware is actually doing, rather than what
>> what we requested it should do.
>>
>> Signed-off-by: David Lechner <dlechner@baylibre.com>
>> ---
>>
>> v4 changes: new patch in v4
>>
>> And FYI for Uwe and Jonathan, there are a couple of other series
>> introducing PWM conversion triggers that could make use of this
>> so that the sampling_frequency attribute can return the actual rate
>> rather than the requested rate.
>>
>> Already applied:
>> https://lore.kernel.org/linux-iio/20241015-ad7606_add_iio_backend_support-v5-4-654faf1ae08c@baylibre.com/
>>
>> Under review:
>> https://lore.kernel.org/linux-iio/aea7f92b-3d12-4ced-b1c8-90bcf1d992d3@baylibre.com/T/#m1377d5acd7e996acd1f59038bdd09f0742d3ac35
>> ---
>> drivers/pwm/core.c | 55 +++++++++++++++++++++++++++++++++++++----------------
>> include/linux/pwm.h | 1 +
>> 2 files changed, 40 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
>> index 634be56e204b..a214d0165d09 100644
>> --- a/drivers/pwm/core.c
>> +++ b/drivers/pwm/core.c
>> @@ -718,7 +718,7 @@ int pwm_apply_atomic(struct pwm_device *pwm, const struct pwm_state *state)
>> }
>> EXPORT_SYMBOL_GPL(pwm_apply_atomic);
>>
>> -static int pwm_get_state_hw(struct pwm_device *pwm, struct pwm_state *state)
>> +static int __pwm_get_state_hw(struct pwm_device *pwm, struct pwm_state *state)
>> {
>> struct pwm_chip *chip = pwm->chip;
>> const struct pwm_ops *ops = chip->ops;
>> @@ -730,29 +730,50 @@ static int pwm_get_state_hw(struct pwm_device *pwm, struct pwm_state *state)
>>
>> BUG_ON(WFHWSIZE < ops->sizeof_wfhw);
>>
>> - scoped_guard(pwmchip, chip) {
>> -
>> - ret = __pwm_read_waveform(chip, pwm, &wfhw);
>> - if (ret)
>> - return ret;
>> + ret = __pwm_read_waveform(chip, pwm, &wfhw);
>> + if (ret)
>> + return ret;
>>
>> - ret = __pwm_round_waveform_fromhw(chip, pwm, &wfhw, &wf);
>> - if (ret)
>> - return ret;
>> - }
>> + ret = __pwm_round_waveform_fromhw(chip, pwm, &wfhw, &wf);
>> + if (ret)
>> + return ret;
>>
>> pwm_wf2state(&wf, state);
>>
>> } else if (ops->get_state) {
>> - scoped_guard(pwmchip, chip)
>> - ret = ops->get_state(chip, pwm, state);
>> -
>> + ret = ops->get_state(chip, pwm, state);
>> trace_pwm_get(pwm, state, ret);
>> }
>>
>> return ret;
>> }
>
> I don't understand why you introduce __pwm_get_state_hw() (a variant of
> pwm_get_state_hw() that expects the caller to hold the chip lock) when the
> single caller (apart from plain pwm_get_state_hw()) could just continue
> to use pwm_get_state_hw().
Hmm... it seems like I thought there was a good reason for it at the
time, but looking at it again, I agree with your assessment.
>
> In principle I'm open to such a patch and wonder if there is already a
> merge plan for this series. If you send a simpler patch soon with the
> same objective, I'll make sure it goes into v6.13-rc1 in the assumption
> that it's to late for the whole series to go in then. Or do you still
> target 6.13-rc1 for the spi bits? Then it would probably better to let
> this patch go in with the rest via the spi tree.
The SPI offload stuff is not likely to be merged soon. But there is
ad7606 + AXI ADC support from Guillaume that was just merged that
could make use of this. So I can send this as a stand-alone patch
so that it can be made available for that too.
next prev parent reply other threads:[~2024-10-29 15:30 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 20:59 [PATCH RFC v4 00/15] spi: axi-spi-engine: add offload support David Lechner
2024-10-23 20:59 ` [PATCH RFC v4 01/15] pwm: core: export pwm_get_state_hw() David Lechner
2024-10-29 8:05 ` Uwe Kleine-König
2024-10-29 15:30 ` David Lechner [this message]
2024-10-23 20:59 ` [PATCH RFC v4 02/15] spi: add basic support for SPI offloading David Lechner
2024-10-24 13:27 ` Nuno Sá
2024-10-24 14:49 ` David Lechner
2024-10-25 12:59 ` Nuno Sá
2024-10-25 16:39 ` Nuno Sá
2024-10-26 15:05 ` Jonathan Cameron
2024-11-11 17:14 ` David Lechner
2024-11-11 19:02 ` David Lechner
2024-10-30 15:55 ` Mark Brown
2024-10-23 20:59 ` [PATCH RFC v4 03/15] spi: offload: add support for hardware triggers David Lechner
2024-10-24 14:04 ` Nuno Sá
2024-10-24 15:02 ` David Lechner
2024-10-25 6:29 ` Nuno Sá
2024-10-26 15:14 ` Jonathan Cameron
2024-10-28 13:53 ` Nuno Sá
2024-10-23 20:59 ` [PATCH RFC v4 04/15] spi: dt-bindings: add trigger-source.yaml David Lechner
2024-10-23 20:59 ` [PATCH RFC v4 05/15] spi: dt-bindings: add PWM SPI offload trigger David Lechner
2024-10-26 15:18 ` Jonathan Cameron
2024-10-27 0:20 ` David Lechner
2024-10-27 20:24 ` Conor Dooley
2024-10-31 18:16 ` Conor Dooley
2024-11-11 17:31 ` David Lechner
2024-10-23 20:59 ` [PATCH RFC v4 06/15] spi: offload-trigger: add PWM trigger driver David Lechner
2024-10-25 12:07 ` Nuno Sá
2024-10-25 16:28 ` David Lechner
2024-10-28 13:47 ` Nuno Sá
2024-10-23 20:59 ` [PATCH RFC v4 07/15] spi: add offload TX/RX streaming APIs David Lechner
2024-10-25 12:24 ` Nuno Sá
2024-10-23 20:59 ` [PATCH RFC v4 08/15] spi: dt-bindings: axi-spi-engine: add SPI offload properties David Lechner
2024-10-25 12:26 ` Nuno Sá
2024-10-23 20:59 ` [PATCH RFC v4 09/15] spi: axi-spi-engine: implement offload support David Lechner
2024-10-25 13:09 ` Nuno Sá
2024-10-25 16:35 ` David Lechner
2024-10-23 20:59 ` [PATCH RFC v4 10/15] iio: buffer-dmaengine: document iio_dmaengine_buffer_setup_ext David Lechner
2024-10-26 15:29 ` Jonathan Cameron
2024-10-23 20:59 ` [PATCH RFC v4 11/15] iio: buffer-dmaengine: add devm_iio_dmaengine_buffer_setup_ext2() David Lechner
2024-10-25 13:24 ` Nuno Sá
2024-10-25 16:42 ` David Lechner
2024-10-23 20:59 ` [PATCH RFC v4 12/15] iio: adc: ad7944: don't use storagebits for sizing David Lechner
2024-10-23 20:59 ` [PATCH RFC v4 13/15] iio: adc: ad7944: add support for SPI offload David Lechner
2024-10-26 15:51 ` Jonathan Cameron
2024-10-23 20:59 ` [PATCH RFC v4 14/15] dt-bindings: iio: adc: adi,ad4695: add SPI offload properties David Lechner
2024-10-23 20:59 ` [PATCH RFC v4 15/15] iio: adc: ad4695: Add support for SPI offload David Lechner
2024-10-26 16:00 ` Jonathan Cameron
2024-10-27 0:01 ` David Lechner
2024-10-27 9:12 ` Jonathan Cameron
2024-10-27 19:52 ` David Lechner
2024-10-28 16:39 ` Jonathan Cameron
2024-10-27 0:05 ` David Lechner
2024-10-27 9:15 ` Jonathan Cameron
2024-10-24 14:12 ` [PATCH RFC v4 00/15] spi: axi-spi-engine: add offload support Nuno Sá
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=82edfbb9-5e65-4292-b15b-d5cde7b53e42@baylibre.com \
--to=dlechner@baylibre.com \
--cc=Michael.Hennerich@analog.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=david@protonic.nl \
--cc=devicetree@vger.kernel.org \
--cc=gstols@baylibre.com \
--cc=jic23@kernel.org \
--cc=kernel@martin.sperl.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox