From: John Ernberg <john.ernberg@actia.se>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>,
"kernel@pengutronix.de" <kernel@pengutronix.de>
Subject: Re: [PATCH 8/8] pwm: Add support for pwmchip devices for faster and easier userspace access
Date: Mon, 15 Apr 2024 11:27:35 +0000 [thread overview]
Message-ID: <b2a6c620-2272-4aa2-98f5-863e7faeb5ab@actia.se> (raw)
In-Reply-To: <z6g6zbzwaejozhb7hxjnta2tawifa5diblz6ktdt6hnngazkfr@xclx4ooiuw63>
Hi Uwe,
On 4/9/24 9:49 AM, Uwe Kleine-König wrote:
> Hallo,
>
> On Mon, Apr 08, 2024 at 03:42:39PM +0000, John Ernberg wrote:
>> Seeing this patch set made me excited.
>
> \o/
>
>> Did you consider or try a pwm_line model structure, that is connected to a file
>> descriptor, more like request_line from gpio chardevs?
>
> I'd be open for an extension that simplifies detection of which (chip,
> hwpwm) pair corresponds to which usage. It could be fed from a device
> tree like:
>
> &pwm0 {
> compatible = ...;
> reg = <...>;
> #pwm-cells = <3>;
> pwm-names = "motor-control", "backlight", "", "status-led";
> }
>
> and provide a function in libpwm that allows to determine the chipid of
> the chip corresponding to &pwm0 (or an open fd to that device) and 3
> when "status-led" is searched for.
>
> This could be done completely in userspace I think (by inspecting
> sysfs), so I wonder if this could be a complete userspace
> implementation. I like keeping the kernel API simple, i.e. let it only
> work (as it is now) only using chipid and hwpwm. Hmm, maybe make pwm
> names a kernel concept exposed to sysfs to not have to hardcode the dt
> details into libpwm?!
Sounds like it could be workable that way. Thanks!
>
>> We have been using gpio chardevs for a while and really benefitted from that
>> over the sysfs interface. I wrote a simple wrapper around the PWM sysfs
>> interface mimicing the way gpio chardevs work for PWM using dirfd, to make our
>> application design more streamlined.
>
> libpwm can also fall back to sysfs when the character devices are
> missing. If you want to compare the two implementation and create a best
> of two merge from it, that would be great.
>
>> With this patch set I do not see how we can name the PWMs in the device tree
>> nor during request which is a big benefit with GPIO when we need to support
>> multiple hardwares. Nor can I see how we would inspect which pins are
>> allocated or their names when debugging.
>
> Best regards
> Uwe
>
Best regards // John Ernberg
next prev parent reply other threads:[~2024-04-15 11:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-17 10:40 [PATCH 0/8] pwm: Add support for character devices Uwe Kleine-König
2024-03-17 10:40 ` [PATCH 1/8] pwm: Ensure that pwm_chips are allocated using pwmchip_alloc() Uwe Kleine-König
2024-03-17 10:40 ` [PATCH 2/8] pwm: Give some sysfs related variables and functions better names Uwe Kleine-König
2024-03-17 10:40 ` [PATCH 3/8] pwm: Move contents of sysfs.c into core.c Uwe Kleine-König
2024-03-17 10:40 ` [PATCH 4/8] pwm: Ensure a struct pwm has the same lifetime as its pwm_chip Uwe Kleine-König
2024-03-17 10:40 ` [PATCH 5/8] pwm: Add a struct device to struct pwm_chip Uwe Kleine-König
2024-03-28 18:44 ` David Lechner
2024-03-29 10:19 ` Uwe Kleine-König
2024-03-17 10:40 ` [PATCH 6/8] pwm: Make pwmchip_[sg]et_drvdata() a wrapper around dev_set_drvdata() Uwe Kleine-König
2024-03-17 10:40 ` [PATCH 7/8] pwm: Add more locking Uwe Kleine-König
2024-03-18 7:28 ` Thorsten Scherer
[not found] ` <CGME20240404120932eucas1p1b3c1e07bf6f41f6330725148b0268b13@eucas1p1.samsung.com>
2024-04-04 12:09 ` Marek Szyprowski
2024-04-04 15:33 ` Uwe Kleine-König
2024-03-17 10:40 ` [PATCH 8/8] pwm: Add support for pwmchip devices for faster and easier userspace access Uwe Kleine-König
2024-04-08 15:42 ` John Ernberg
2024-04-09 7:49 ` Uwe Kleine-König
2024-04-15 11:27 ` John Ernberg [this message]
2024-05-07 1:11 ` Kent Gibson
2024-05-07 6:12 ` Uwe Kleine-König
2024-04-13 9:22 ` [PATCH 0/8] pwm: Add support for character devices Uwe Kleine-König
2024-04-22 18:59 ` David Lechner
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=b2a6c620-2272-4aa2-98f5-863e7faeb5ab@actia.se \
--to=john.ernberg@actia.se \
--cc=kernel@pengutronix.de \
--cc=linux-pwm@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).