aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2012-09-17 05:08:36 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-03 08:19:47 -0400
commit57bc6c517bd930ef5db527dd4efe4f7ce36b025e (patch)
tree26e775d0cc2be0d6201343f79507817ead3731e3
parent3c45d05be382340dc4ccbef5819bd1eca601eb57 (diff)
OMAPDSS: nec-nl8048 panel: handle gpios in panel driver
The nec-nl8048hl11-01 panel driver leaves gpio configurations to the platform_enable and disable calls in the platform's board file. These should happen in the panel driver itself. Create a platform data struct for the panel, this contains the gpio numbers used by the panel driver, this struct will be passed to the panel driver as platform data. The driver will request and configure these gpios rather than leaving it to platform callbacks in board files. This will help in removing the need for the panel drivers to have platform related callbacks. Signed-off-by: Archit Taneja <archit@ti.com>
-rw-r--r--drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c45
1 files changed, 34 insertions, 11 deletions
diff --git a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
index c197927b26e9..3b85e2a70323 100644
--- a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
+++ b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
@@ -20,8 +20,10 @@
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
22#include <linux/fb.h> 22#include <linux/fb.h>
23#include <linux/gpio.h>
23 24
24#include <video/omapdss.h> 25#include <video/omapdss.h>
26#include <video/omap-panel-data.h>
25 27
26#define LCD_XRES 800 28#define LCD_XRES 800
27#define LCD_YRES 480 29#define LCD_YRES 480
@@ -31,9 +33,6 @@
31 */ 33 */
32#define LCD_PIXEL_CLOCK 23800 34#define LCD_PIXEL_CLOCK 23800
33 35
34struct nec_8048_data {
35};
36
37static const struct { 36static const struct {
38 unsigned char addr; 37 unsigned char addr;
39 unsigned char dat; 38 unsigned char dat;
@@ -82,30 +81,46 @@ static struct omap_video_timings nec_8048_panel_timings = {
82 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE, 81 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
83}; 82};
84 83
84static inline struct panel_nec_nl8048_data
85*get_panel_data(const struct omap_dss_device *dssdev)
86{
87 return (struct panel_nec_nl8048_data *) dssdev->data;
88}
89
85static int nec_8048_panel_probe(struct omap_dss_device *dssdev) 90static int nec_8048_panel_probe(struct omap_dss_device *dssdev)
86{ 91{
87 struct nec_8048_data *necd; 92 struct panel_nec_nl8048_data *pd = get_panel_data(dssdev);
93 int r;
94
95 if (!pd)
96 return -EINVAL;
88 97
89 dssdev->panel.timings = nec_8048_panel_timings; 98 dssdev->panel.timings = nec_8048_panel_timings;
90 99
91 necd = kzalloc(sizeof(*necd), GFP_KERNEL); 100 if (gpio_is_valid(pd->qvga_gpio)) {
92 if (!necd) 101 r = devm_gpio_request_one(&dssdev->dev, pd->qvga_gpio,
93 return -ENOMEM; 102 GPIOF_OUT_INIT_HIGH, "lcd QVGA");
103 if (r)
104 return r;
105 }
94 106
95 dev_set_drvdata(&dssdev->dev, necd); 107 if (gpio_is_valid(pd->res_gpio)) {
108 r = devm_gpio_request_one(&dssdev->dev, pd->res_gpio,
109 GPIOF_OUT_INIT_LOW, "lcd RES");
110 if (r)
111 return r;
112 }
96 113
97 return 0; 114 return 0;
98} 115}
99 116
100static void nec_8048_panel_remove(struct omap_dss_device *dssdev) 117static void nec_8048_panel_remove(struct omap_dss_device *dssdev)
101{ 118{
102 struct nec_8048_data *necd = dev_get_drvdata(&dssdev->dev);
103
104 kfree(necd);
105} 119}
106 120
107static int nec_8048_panel_power_on(struct omap_dss_device *dssdev) 121static int nec_8048_panel_power_on(struct omap_dss_device *dssdev)
108{ 122{
123 struct panel_nec_nl8048_data *pd = get_panel_data(dssdev);
109 int r; 124 int r;
110 125
111 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) 126 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
@@ -124,6 +139,9 @@ static int nec_8048_panel_power_on(struct omap_dss_device *dssdev)
124 goto err1; 139 goto err1;
125 } 140 }
126 141
142 if (gpio_is_valid(pd->res_gpio))
143 gpio_set_value_cansleep(pd->res_gpio, 1);
144
127 return 0; 145 return 0;
128err1: 146err1:
129 omapdss_dpi_display_disable(dssdev); 147 omapdss_dpi_display_disable(dssdev);
@@ -133,9 +151,14 @@ err0:
133 151
134static void nec_8048_panel_power_off(struct omap_dss_device *dssdev) 152static void nec_8048_panel_power_off(struct omap_dss_device *dssdev)
135{ 153{
154 struct panel_nec_nl8048_data *pd = get_panel_data(dssdev);
155
136 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) 156 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
137 return; 157 return;
138 158
159 if (gpio_is_valid(pd->res_gpio))
160 gpio_set_value_cansleep(pd->res_gpio, 0);
161
139 if (dssdev->platform_disable) 162 if (dssdev->platform_disable)
140 dssdev->platform_disable(dssdev); 163 dssdev->platform_disable(dssdev);
141 164