Re: [PATCH v3 2/2] spi: Add generic SPI multiplexer

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

 



On Mon, Jan 27, 2020 at 11:04 PM Chris Packham
<chris.packham@xxxxxxxxxxxxxxxxxxx> wrote:
>
> Add a SPI device driver that sits in-band and provides a SPI controller
> which supports chip selects via a mux-control. This enables extra SPI
> devices to be connected with limited native chip selects.

...

>  obj-$(CONFIG_SPI_MEM)                  += spi-mem.o
>  obj-$(CONFIG_SPI_SPIDEV)               += spidev.o
>  obj-$(CONFIG_SPI_LOOPBACK_TEST)                += spi-loopback-test.o
> +obj-$(CONFIG_SPI_MUX)                  += spi-mux.o

Maybe after SPI_MEM ?

...

> +struct spi_mux_priv {
> +       struct spi_device       *spi;
> +       unsigned int            current_cs;
> +

> +       void                    (*child_mesg_complete)(void *context);
> +       void                    *child_mesg_context;
> +       struct spi_device       *child_mesg_dev;

mesg -> msg ?

> +       struct mux_control      *mux;
> +};

...

> +static int spi_mux_select(struct spi_device *spi)
> +{
> +       struct spi_mux_priv *priv = spi_controller_get_devdata(spi->controller);

> +       int ret = 0;

Drop this assignment...

> +       if (priv->current_cs != spi->chip_select) {

...convert this to
 if (cs == chip_select)
    return 0;

> +               dev_dbg(&priv->spi->dev,
> +                       "setting up the mux for cs %d\n",
> +                       spi->chip_select);

After above changes this perhaps fits one line (now it fits two, by
the way, not three).

> +}

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux