LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v1 1/1] ARM: pxa/lubbock: Replace custom ->cs_control() by GPIO lookup table
@ 2021-11-22 20:32 Andy Shevchenko
  2021-11-22 20:55 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2021-11-22 20:32 UTC (permalink / raw)
  To: Andy Shevchenko, linux-arm-kernel, linux-kernel
  Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King

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>
---
 arch/arm/mach-pxa/lubbock.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 742d18a1f7dc..e2411971422d 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -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));
 }
-- 
2.33.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] ARM: pxa/lubbock: Replace custom ->cs_control() by GPIO lookup table
  2021-11-22 20:32 [PATCH v1 1/1] ARM: pxa/lubbock: Replace custom ->cs_control() by GPIO lookup table Andy Shevchenko
@ 2021-11-22 20:55 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2021-11-22 20:55 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King

On Mon, Nov 22, 2021 at 10:32:47PM +0200, Andy Shevchenko wrote:
> 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.

Okay, I think it would be first patch in a series of getting rid of cs_control.
So, please give your Acks, etc here, and I will appreciate any testing in case
you are in possession of such platform.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-22 20:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22 20:32 [PATCH v1 1/1] ARM: pxa/lubbock: Replace custom ->cs_control() by GPIO lookup table Andy Shevchenko
2021-11-22 20:55 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).