Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 38b2482

Browse files
linuswarndb
authored andcommitted
ARM: spitz: Use software nodes for the ADS7846 touchscreen
Convert the Spitz to use software nodes to describe GPIOs for the ADS7846 touchscreen. As part of the conversion switch from the custom wait_for_sync() callback to defining hsync GPIO that can be used by the ads7846 driver to detect hsync. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20240628180852.1738922-11-dmitry.torokhov@gmail.com Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 29c4e69 commit 38b2482

File tree

1 file changed

+15
-25
lines changed

1 file changed

+15
-25
lines changed

arch/arm/mach-pxa/spitz.c

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -534,31 +534,23 @@ static inline void spitz_leds_init(void) {}
534534
* SSP Devices
535535
******************************************************************************/
536536
#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
537-
static void spitz_ads7846_wait_for_hsync(void)
538-
{
539-
while (gpio_get_value(SPITZ_GPIO_HSYNC))
540-
cpu_relax();
541-
542-
while (!gpio_get_value(SPITZ_GPIO_HSYNC))
543-
cpu_relax();
544-
}
545537

546-
static struct ads7846_platform_data spitz_ads7846_info = {
547-
.model = 7846,
548-
.vref_delay_usecs = 100,
549-
.x_plate_ohms = 419,
550-
.y_plate_ohms = 486,
551-
.pressure_max = 1024,
552-
.wait_for_sync = spitz_ads7846_wait_for_hsync,
538+
static const struct property_entry spitz_ads7846_props[] = {
539+
PROPERTY_ENTRY_STRING("compatible", "ti,ads7846"),
540+
PROPERTY_ENTRY_U32("touchscreen-max-pressure", 1024),
541+
PROPERTY_ENTRY_U16("ti,x-plate-ohms", 419),
542+
PROPERTY_ENTRY_U16("ti,y-plate-ohms", 486),
543+
PROPERTY_ENTRY_U16("ti,vref-delay-usecs", 100),
544+
PROPERTY_ENTRY_GPIO("pendown-gpios", &pxa2xx_gpiochip_node,
545+
SPITZ_GPIO_TP_INT, GPIO_ACTIVE_LOW),
546+
PROPERTY_ENTRY_GPIO("ti,hsync-gpios", &pxa2xx_gpiochip_node,
547+
SPITZ_GPIO_HSYNC, GPIO_ACTIVE_LOW),
548+
{ }
553549
};
554550

555-
static struct gpiod_lookup_table spitz_ads7846_gpio_table = {
556-
.dev_id = "spi2.0",
557-
.table = {
558-
GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_TP_INT,
559-
"pendown", GPIO_ACTIVE_LOW),
560-
{ }
561-
},
551+
static const struct software_node spitz_ads7846_swnode = {
552+
.name = "ads7846",
553+
.properties = spitz_ads7846_props,
562554
};
563555

564556
static const struct property_entry spitz_lcdcon_props[] = {
@@ -595,7 +587,7 @@ static struct spi_board_info spitz_spi_devices[] = {
595587
.max_speed_hz = 1200000,
596588
.bus_num = 2,
597589
.chip_select = 0,
598-
.platform_data = &spitz_ads7846_info,
590+
.swnode = &spitz_ads7846_swnode,
599591
.irq = PXA_GPIO_TO_IRQ(SPITZ_GPIO_TP_INT),
600592
}, {
601593
.modalias = "corgi-lcd",
@@ -638,8 +630,6 @@ static void __init spitz_spi_init(void)
638630
struct platform_device *pd;
639631
int err;
640632

641-
gpiod_add_lookup_table(&spitz_ads7846_gpio_table);
642-
643633
pd = platform_device_register_full(&spitz_spi_device_info);
644634
err = PTR_ERR_OR_ZERO(pd);
645635
if (err)

0 commit comments

Comments
 (0)