Re: [PATCH 3/3] spi: add ACPI support for SPI controller chip select lines(cs-gpios)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 4, 2018 at 5:33 PM Mark Brown <broonie@xxxxxxxxxx> wrote:
> On Mon, Dec 03, 2018 at 11:15:51AM +0800, Jay Fang wrote:
>
> > -static int of_spi_register_master(struct spi_controller *ctlr)
> > -{
> > +     if (IS_ENABLED(CONFIG_OF) && np) {
> > +             for (i = 0; i < nb; i++)
> > +                     cs[i] = of_get_named_gpio(np, "cs-gpios", i);
> > +     } else if (IS_ENABLED(CONFIG_ACPI) && ACPI_HANDLE(&ctlr->dev)) {
> > +             for (i = 0; i < nb; i++) {
> > +                     desc = devm_gpiod_get_index(&ctlr->dev, "cs",
> > +                                                 i, GPIOD_ASIS);
> > +                     if (IS_ERR(desc))
> > +                             continue;
> > +                     cs[i] = desc_to_gpio(desc);
> > +             }
> > +     }
> >       return 0;
>
> Given that both properties are called "cs" won't devm_gpiod_get_index()
> do the right thing for DT systems as well as ACPI allowing us to move
> entirely to descriptors and remove the need for separate code paths here?

Indeed moving the cs-gpios over to just using descriptors is on my
TODO list and I have a rough patch cooking:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/commit/?h=gpio-descriptors-spi&id=963bff1e8feb020cac05325db84a37f81efdb0ea

I think maybe I should expediate this patch[set] so there is a clean
path forward for ACPI without having to do this:

> +                     cs[i] = desc_to_gpio(desc);

Which is essentially the waltz of two steps forward, one step back,
*shudder*

I'll try to get my patch into shape ASAP.

Yours,
Linus Walleij



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux