Re: [PATCH 1/7] Input: cyttsp - Probe from compatibles

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

 



Hello Linus,

On Tue, Mar 30, 2021 at 10:54 AM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
>
> The driver (both SPI and I2C interface) should probe from
> the compatible strings, cypress,cy8ctma340 etc when using
> device tree, not as now, where it is probing implicitly from
> the I2C/SPI node name "cypress,cyttsp-i2c" etc.
>
> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> ---
>  drivers/input/touchscreen/cyttsp_i2c.c | 7 +++++++
>  drivers/input/touchscreen/cyttsp_spi.c | 7 +++++++
>  2 files changed, 14 insertions(+)
>
> diff --git a/drivers/input/touchscreen/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp_i2c.c
> index 061debf64a2b..0f097f34832a 100644
> --- a/drivers/input/touchscreen/cyttsp_i2c.c
> +++ b/drivers/input/touchscreen/cyttsp_i2c.c
> @@ -52,10 +52,17 @@ static const struct i2c_device_id cyttsp_i2c_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, cyttsp_i2c_id);
>
> +static const struct of_device_id cyttsp_of_i2c_match[] = {
> +       { .compatible = "cypress,cy8ctma340", },
> +       { .compatible = "cypress,cy8ctst341", },
> +       { /* sentinel */ }
> +};
> +

I think we want to export this as modalias with
MODULE_DEVICE_TABLE(of, cyttsp_of_i2c_match) so the driver could be
autoloaded if built as a module ?

>  static struct i2c_driver cyttsp_i2c_driver = {
>         .driver = {
>                 .name   = CY_I2C_NAME,
>                 .pm     = &cyttsp_pm_ops,
> +               .of_match_table = cyttsp_of_i2c_match,
>         },
>         .probe          = cyttsp_i2c_probe,
>         .id_table       = cyttsp_i2c_id,
> diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c
> index 54e410921d53..ad8b3c6c4d3e 100644
> --- a/drivers/input/touchscreen/cyttsp_spi.c
> +++ b/drivers/input/touchscreen/cyttsp_spi.c
> @@ -160,10 +160,17 @@ static int cyttsp_spi_probe(struct spi_device *spi)
>         return 0;
>  }
>
> +static const struct of_device_id cyttsp_of_spi_match[] = {
> +       { .compatible = "cypress,cy8ctma340", },
> +       { .compatible = "cypress,cy8ctst341", },
> +       { /* sentinel */ }
> +};
> +

And same here.

Other than that, the patch looks good to me.

Reviewed-by: Javier Martinez Canillas <javier@xxxxxxxxxxxx>

Best regards,
Javier



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux