Re: [PATCH RFT/RFC] mfd: cs42l43: setup true links with software nodes
From: Charles Keepax
Date: Wed Nov 19 2025 - 04:31:49 EST
On Wed, Nov 19, 2025 at 10:10:24AM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> Currently the SPI driver sets up a software node rerefencing the GPIO
> controller exposing the chip-select GPIO but this node never gets
> attached to the actual GPIO provider. The lookup uses the weird way GPIO
> core performs the software node lookup by the swnode's name. We want to
> switch to a true firmware node lookup so the actual link must exist.
> Move the configuration to the MFD core and connect the SPI and pinctrl
> sub-devices with software node references.
>
> Fixes: 439fbc97502a ("spi: cs42l43: Add bridged cs35l56 amplifiers")
> Reported-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
> Closes: https://lore.kernel.org/all/aRyf7qDdHKABppP8@xxxxxxxxxxxxxxxxxxxxx/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> ---
> Hi Charles!
>
> Please give this a try. It's only build-tested so far. I hope I
> understood correctly that it's the SPI driver that needs the "cs" GPIO
> from the pinctrl.
Unfortunately it fails with an -EBUSY on adding the MFD children.
I will investigate a little more and report back.
> +static const struct software_node cs42l43_gpiochip_swnode = {
> + .name = "cs42l43-pinctrl",
> +};
> +
> +static const struct property_entry cs42l43_cs_props[] = {
> + PROPERTY_ENTRY_GPIO("cs-gpios", &cs42l43_gpiochip_swnode, 0, GPIO_ACTIVE_LOW),
> + { }
> +};
This drops the undefined node, that is important as it lets the
SPI core know that device is using an internal chip select rather
than a GPIO.
> +static const struct software_node cs42l43_spi_swnode = {
> + .properties = cs42l43_cs_props,
> +};
> +
> static const struct mfd_cell cs42l43_devs[] = {
> - { .name = "cs42l43-pinctrl", },
> - { .name = "cs42l43-spi", },
> + {
> + .name = "cs42l43-pinctrl",
> + .swnode = &cs42l43_gpiochip_swnode,
> + },
> + {
> + .name = "cs42l43-spi",
> + .swnode = &cs42l43_spi_swnode,
I will need to think about this a little more but I suspect this
no longer being conditional on the magic ACPI properties could
cause issues if a system was to use the SPI controller more
traditionally and actually have CS GPIOs in the firmware.
Although maybe that real node would take preference over the
swnode?
Thanks,
Charles