Commit 5e4096ef authored by Linus Walleij's avatar Linus Walleij Committed by Bartlomiej Zolnierkiewicz

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: default avatarLinus Walleij <linus.walleij@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200415165055.193113-1-linus.walleij@linaro.org
parent 7066fcd5
...@@ -104,6 +104,14 @@ static struct fixed_voltage_config shannon_cf_vcc_pdata __initdata = { ...@@ -104,6 +104,14 @@ static struct fixed_voltage_config shannon_cf_vcc_pdata __initdata = {
.enabled_at_boot = 1, .enabled_at_boot = 1,
}; };
static struct gpiod_lookup_table shannon_display_gpio_table = {
.dev_id = "sa11x0-fb",
.table = {
GPIO_LOOKUP("gpio", 22, "shannon-lcden", GPIO_ACTIVE_HIGH),
{ },
},
};
static void __init shannon_init(void) static void __init shannon_init(void)
{ {
sa11x0_register_fixed_regulator(0, &shannon_cf_vcc_pdata, sa11x0_register_fixed_regulator(0, &shannon_cf_vcc_pdata,
...@@ -113,6 +121,7 @@ static void __init shannon_init(void) ...@@ -113,6 +121,7 @@ static void __init shannon_init(void)
sa11x0_register_pcmcia(0, &shannon_pcmcia0_gpio_table); sa11x0_register_pcmcia(0, &shannon_pcmcia0_gpio_table);
sa11x0_register_pcmcia(1, &shannon_pcmcia1_gpio_table); sa11x0_register_pcmcia(1, &shannon_pcmcia1_gpio_table);
sa11x0_ppc_configure_mcp(); sa11x0_ppc_configure_mcp();
gpiod_add_lookup_table(&shannon_display_gpio_table);
sa11x0_register_lcd(&shannon_lcd_info); sa11x0_register_lcd(&shannon_lcd_info);
sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1); sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1);
sa11x0_register_mcp(&shannon_mcp_data); sa11x0_register_mcp(&shannon_mcp_data);
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#include <linux/gpio.h> #include <linux/gpio/consumer.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/mutex.h> #include <linux/mutex.h>
...@@ -799,8 +799,8 @@ static void sa1100fb_enable_controller(struct sa1100fb_info *fbi) ...@@ -799,8 +799,8 @@ static void sa1100fb_enable_controller(struct sa1100fb_info *fbi)
writel_relaxed(fbi->dbar2, fbi->base + DBAR2); writel_relaxed(fbi->dbar2, fbi->base + DBAR2);
writel_relaxed(fbi->reg_lccr0 | LCCR0_LEN, fbi->base + LCCR0); writel_relaxed(fbi->reg_lccr0 | LCCR0_LEN, fbi->base + LCCR0);
if (machine_is_shannon()) if (fbi->shannon_lcden)
gpio_set_value(SHANNON_GPIO_DISP_EN, 1); gpiod_set_value(fbi->shannon_lcden, 1);
dev_dbg(fbi->dev, "DBAR1: 0x%08x\n", readl_relaxed(fbi->base + DBAR1)); dev_dbg(fbi->dev, "DBAR1: 0x%08x\n", readl_relaxed(fbi->base + DBAR1));
dev_dbg(fbi->dev, "DBAR2: 0x%08x\n", readl_relaxed(fbi->base + DBAR2)); dev_dbg(fbi->dev, "DBAR2: 0x%08x\n", readl_relaxed(fbi->base + DBAR2));
...@@ -817,8 +817,8 @@ static void sa1100fb_disable_controller(struct sa1100fb_info *fbi) ...@@ -817,8 +817,8 @@ static void sa1100fb_disable_controller(struct sa1100fb_info *fbi)
dev_dbg(fbi->dev, "Disabling LCD controller\n"); dev_dbg(fbi->dev, "Disabling LCD controller\n");
if (machine_is_shannon()) if (fbi->shannon_lcden)
gpio_set_value(SHANNON_GPIO_DISP_EN, 0); gpiod_set_value(fbi->shannon_lcden, 0);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&fbi->ctrlr_wait, &wait); add_wait_queue(&fbi->ctrlr_wait, &wait);
...@@ -1173,12 +1173,10 @@ static int sa1100fb_probe(struct platform_device *pdev) ...@@ -1173,12 +1173,10 @@ static int sa1100fb_probe(struct platform_device *pdev)
return ret; return ret;
} }
if (machine_is_shannon()) { fbi->shannon_lcden = gpiod_get_optional(&pdev->dev, "shannon-lcden",
ret = devm_gpio_request_one(&pdev->dev, SHANNON_GPIO_DISP_EN, GPIOD_OUT_LOW);
GPIOF_OUT_INIT_LOW, "display enable"); if (IS_ERR(fbi->shannon_lcden))
if (ret) return PTR_ERR(fbi->shannon_lcden);
return ret;
}
/* Initialize video memory */ /* Initialize video memory */
ret = sa1100fb_map_video_memory(fbi); ret = sa1100fb_map_video_memory(fbi);
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
* for more details. * for more details.
*/ */
struct gpio_desc;
#define LCCR0 0x0000 /* LCD Control Reg. 0 */ #define LCCR0 0x0000 /* LCD Control Reg. 0 */
#define LCSR 0x0004 /* LCD Status Reg. */ #define LCSR 0x0004 /* LCD Status Reg. */
#define DBAR1 0x0010 /* LCD DMA Base Address Reg. channel 1 */ #define DBAR1 0x0010 /* LCD DMA Base Address Reg. channel 1 */
...@@ -33,6 +35,7 @@ struct sa1100fb_info { ...@@ -33,6 +35,7 @@ struct sa1100fb_info {
struct device *dev; struct device *dev;
const struct sa1100fb_rgb *rgb[NR_RGB]; const struct sa1100fb_rgb *rgb[NR_RGB];
void __iomem *base; void __iomem *base;
struct gpio_desc *shannon_lcden;
/* /*
* These are the addresses we mapped * These are the addresses we mapped
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment