From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: broonie@kernel.org, linus.walleij@linaro.org, brgl@bgdev.pl,
linux-gpio@vger.kernel.org, linux-spi@vger.kernel.org,
patches@opensource.cirrus.com
Subject: Re: [PATCH v3 1/3] gpio: swnode: Add ability to specify native chip selects for SPI
Date: Wed, 3 Apr 2024 23:21:28 +0300 [thread overview]
Message-ID: <Zg26SKlGtwRvoUDW@surfacebook.localdomain> (raw)
In-Reply-To: <20240329114730.360313-2-ckeepax@opensource.cirrus.com>
Fri, Mar 29, 2024 at 11:47:28AM +0000, Charles Keepax kirjoitti:
> SPI devices can specify a cs-gpios property to enumerate their
> chip selects. Under device tree, a zero entry in this property can
> be used to specify that a particular chip select is using the SPI
> controllers native chip select, for example:
>
> cs-gpios = <&gpio1 0 0>, <0>;
>
> Here the second chip select is native. However, when using swnodes
> there is currently no way to specify a native chip select. The
> proposal here is to register a swnode_gpio_undefined software node,
> that can be specified to allow the indication of a native chip
> select. For example:
>
> static const struct software_node_ref_args device_cs_refs[] = {
> {
> .node = &device_gpiochip_swnode,
> .nargs = 2,
> .args = { 0, GPIO_ACTIVE_LOW },
> },
> {
> .node = &swnode_gpio_undefined,
> .nargs = 0,
> },
> };
>
> Register the swnode as the gpiolib is initialised and
> check in swnode_get_gpio_device if the returned node matches
> swnode_gpio_undefined and return -ENOENT, which matches the behaviour
> of the device tree system when it encounters a 0 phandle.
...
> +const struct software_node swnode_gpio_undefined = {
> + .name = "gpio-internal-undefined",
This name is still too generic, perhaps "software-node-undefined-gpio"?
> +};
> +EXPORT_SYMBOL_GPL(swnode_gpio_undefined);
Maybe we can start using namespaces?
...
> + if (!strcmp(gdev_node->name, "gpio-internal-undefined"))
Probably it needs a definition to avoid typos in case somebody wants to change
the name.
#define GPIOLIB_SWNODE_UNDEFINED "..."
?
> + return ERR_PTR(-ENOENT);
...
> static int __init gpiolib_debugfs_init(void)
> {
> + int ret;
> +
> + ret = software_node_register(&swnode_gpio_undefined);
> + if (ret < 0) {
> + pr_err("gpiolib: failed to register swnode: %d\n", ret);
> + return ret;
> + }
> +
> /* /sys/kernel/debug/gpio */
> debugfs_create_file("gpio", 0444, NULL, NULL, &gpiolib_fops);
> +
> return 0;
> }
> subsys_initcall(gpiolib_debugfs_init);
I believe now it's time to get __exitcall to be implemented. Actually the above
already needs that. Besides that, what you are adding doesn't belong to debugfs
AFAICS. And why it can't be done in gpiolib-swnode.c?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-04-03 20:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 11:47 [PATCH 0/3] Add bridged amplifiers to cs42l43 Charles Keepax
2024-03-29 11:47 ` [PATCH v3 1/3] gpio: swnode: Add ability to specify native chip selects for SPI Charles Keepax
2024-04-03 20:21 ` Andy Shevchenko [this message]
2024-03-29 11:47 ` [PATCH v3 2/3] spi: Add a mechanism to use the fwnode name for the SPI device Charles Keepax
2024-04-03 20:29 ` Andy Shevchenko
2024-04-08 13:51 ` Charles Keepax
2024-04-08 16:11 ` Andy Shevchenko
2024-03-29 11:47 ` [PATCH v3 3/3] spi: cs42l43: Add bridged cs35l56 amplifiers Charles Keepax
2024-04-03 20:47 ` Andy Shevchenko
2024-04-08 15:35 ` Charles Keepax
2024-04-08 16:07 ` Andy Shevchenko
2024-04-08 19:50 ` Andy Shevchenko
2024-04-08 20:07 ` Andy Shevchenko
2024-04-09 9:24 ` Charles Keepax
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=Zg26SKlGtwRvoUDW@surfacebook.localdomain \
--to=andy.shevchenko@gmail.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=patches@opensource.cirrus.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