Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM/fbdev: sa11x0: Switch to use GPIO descriptors

This converts the SA11x0 frame buffer driver to use
GPIO descriptors. Get the GPIO optional and register
a look-up table specifically for the Shannon machine.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200415165055.193113-1-linus.walleij@linaro.org

authored by

Linus Walleij and committed by
Bartlomiej Zolnierkiewicz
5e4096ef 7066fcd5

+21 -11
+9
arch/arm/mach-sa1100/shannon.c
··· 104 104 .enabled_at_boot = 1, 105 105 }; 106 106 107 + static struct gpiod_lookup_table shannon_display_gpio_table = { 108 + .dev_id = "sa11x0-fb", 109 + .table = { 110 + GPIO_LOOKUP("gpio", 22, "shannon-lcden", GPIO_ACTIVE_HIGH), 111 + { }, 112 + }, 113 + }; 114 + 107 115 static void __init shannon_init(void) 108 116 { 109 117 sa11x0_register_fixed_regulator(0, &shannon_cf_vcc_pdata, ··· 121 113 sa11x0_register_pcmcia(0, &shannon_pcmcia0_gpio_table); 122 114 sa11x0_register_pcmcia(1, &shannon_pcmcia1_gpio_table); 123 115 sa11x0_ppc_configure_mcp(); 116 + gpiod_add_lookup_table(&shannon_display_gpio_table); 124 117 sa11x0_register_lcd(&shannon_lcd_info); 125 118 sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1); 126 119 sa11x0_register_mcp(&shannon_mcp_data);
+9 -11
drivers/video/fbdev/sa1100fb.c
··· 173 173 #include <linux/init.h> 174 174 #include <linux/ioport.h> 175 175 #include <linux/cpufreq.h> 176 - #include <linux/gpio.h> 176 + #include <linux/gpio/consumer.h> 177 177 #include <linux/platform_device.h> 178 178 #include <linux/dma-mapping.h> 179 179 #include <linux/mutex.h> ··· 799 799 writel_relaxed(fbi->dbar2, fbi->base + DBAR2); 800 800 writel_relaxed(fbi->reg_lccr0 | LCCR0_LEN, fbi->base + LCCR0); 801 801 802 - if (machine_is_shannon()) 803 - gpio_set_value(SHANNON_GPIO_DISP_EN, 1); 802 + if (fbi->shannon_lcden) 803 + gpiod_set_value(fbi->shannon_lcden, 1); 804 804 805 805 dev_dbg(fbi->dev, "DBAR1: 0x%08x\n", readl_relaxed(fbi->base + DBAR1)); 806 806 dev_dbg(fbi->dev, "DBAR2: 0x%08x\n", readl_relaxed(fbi->base + DBAR2)); ··· 817 817 818 818 dev_dbg(fbi->dev, "Disabling LCD controller\n"); 819 819 820 - if (machine_is_shannon()) 821 - gpio_set_value(SHANNON_GPIO_DISP_EN, 0); 820 + if (fbi->shannon_lcden) 821 + gpiod_set_value(fbi->shannon_lcden, 0); 822 822 823 823 set_current_state(TASK_UNINTERRUPTIBLE); 824 824 add_wait_queue(&fbi->ctrlr_wait, &wait); ··· 1173 1173 return ret; 1174 1174 } 1175 1175 1176 - if (machine_is_shannon()) { 1177 - ret = devm_gpio_request_one(&pdev->dev, SHANNON_GPIO_DISP_EN, 1178 - GPIOF_OUT_INIT_LOW, "display enable"); 1179 - if (ret) 1180 - return ret; 1181 - } 1176 + fbi->shannon_lcden = gpiod_get_optional(&pdev->dev, "shannon-lcden", 1177 + GPIOD_OUT_LOW); 1178 + if (IS_ERR(fbi->shannon_lcden)) 1179 + return PTR_ERR(fbi->shannon_lcden); 1182 1180 1183 1181 /* Initialize video memory */ 1184 1182 ret = sa1100fb_map_video_memory(fbi);
+3
drivers/video/fbdev/sa1100fb.h
··· 10 10 * for more details. 11 11 */ 12 12 13 + struct gpio_desc; 14 + 13 15 #define LCCR0 0x0000 /* LCD Control Reg. 0 */ 14 16 #define LCSR 0x0004 /* LCD Status Reg. */ 15 17 #define DBAR1 0x0010 /* LCD DMA Base Address Reg. channel 1 */ ··· 35 33 struct device *dev; 36 34 const struct sa1100fb_rgb *rgb[NR_RGB]; 37 35 void __iomem *base; 36 + struct gpio_desc *shannon_lcden; 38 37 39 38 /* 40 39 * These are the addresses we mapped