]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ARM: pxa/lubbock: Replace custom ->cs_control() by GPIO lookup table
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 23 Nov 2021 19:27:21 +0000 (21:27 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 29 Nov 2021 12:19:58 +0000 (12:19 +0000)
SPI PXA2xx driver supports GPIO chipselect by querying for known
GPIO connection ID. Replace custom ->cs_control() by GPIO table,
so the driver will use generic approach on this platform.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211123192723.44537-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
arch/arm/mach-pxa/lubbock.c

index 742d18a1f7dc8c0424efcd79133f800397a43d61..e2411971422d7be2f13a903610106a75cd881613 100644 (file)
@@ -211,16 +211,17 @@ static struct ads7846_platform_data ads_info = {
        // .y_plate_ohms                = 500,  /* GUESS! */
 };
 
-static void ads7846_cs(u32 command)
-{
-       static const unsigned   TS_nCS = 1 << 11;
-       lubbock_set_misc_wr(TS_nCS, (command == PXA2XX_CS_ASSERT) ? 0 : TS_nCS);
-}
+static struct gpiod_lookup_table ads7846_cs_gpios = {
+       .dev_id         = "ads7846",
+       .table          = {
+               GPIO_LOOKUP("lubbock", 11, "cs", GPIO_ACTIVE_LOW),
+               {}
+       },
+};
 
 static struct pxa2xx_spi_chip ads_hw = {
        .tx_threshold           = 1,
        .rx_threshold           = 2,
-       .cs_control             = ads7846_cs,
 };
 
 static struct spi_board_info spi_board_info[] __initdata = { {
@@ -512,6 +513,8 @@ static void __init lubbock_init(void)
        lubbock_flash_data[flashboot].name = "boot-rom";
        (void) platform_add_devices(devices, ARRAY_SIZE(devices));
 
+       gpiod_add_lookup_table(&ads7846_cs_gpios);
+
        pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
        spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
 }