Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 371334
b: refs/heads/master
c: 57bc6c5
h: refs/heads/master
v: v3
  • Loading branch information
Archit Taneja authored and Tomi Valkeinen committed Apr 3, 2013
1 parent 9b64d13 commit 05bf473
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3c45d05be382340dc4ccbef5819bd1eca601eb57
refs/heads/master: 57bc6c517bd930ef5db527dd4efe4f7ce36b025e
45 changes: 34 additions & 11 deletions trunk/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
#include <linux/delay.h>
#include <linux/spi/spi.h>
#include <linux/fb.h>
#include <linux/gpio.h>

#include <video/omapdss.h>
#include <video/omap-panel-data.h>

#define LCD_XRES 800
#define LCD_YRES 480
Expand All @@ -31,9 +33,6 @@
*/
#define LCD_PIXEL_CLOCK 23800

struct nec_8048_data {
};

static const struct {
unsigned char addr;
unsigned char dat;
Expand Down Expand Up @@ -82,30 +81,46 @@ static struct omap_video_timings nec_8048_panel_timings = {
.sync_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
};

static inline struct panel_nec_nl8048_data
*get_panel_data(const struct omap_dss_device *dssdev)
{
return (struct panel_nec_nl8048_data *) dssdev->data;
}

static int nec_8048_panel_probe(struct omap_dss_device *dssdev)
{
struct nec_8048_data *necd;
struct panel_nec_nl8048_data *pd = get_panel_data(dssdev);
int r;

if (!pd)
return -EINVAL;

dssdev->panel.timings = nec_8048_panel_timings;

necd = kzalloc(sizeof(*necd), GFP_KERNEL);
if (!necd)
return -ENOMEM;
if (gpio_is_valid(pd->qvga_gpio)) {
r = devm_gpio_request_one(&dssdev->dev, pd->qvga_gpio,
GPIOF_OUT_INIT_HIGH, "lcd QVGA");
if (r)
return r;
}

dev_set_drvdata(&dssdev->dev, necd);
if (gpio_is_valid(pd->res_gpio)) {
r = devm_gpio_request_one(&dssdev->dev, pd->res_gpio,
GPIOF_OUT_INIT_LOW, "lcd RES");
if (r)
return r;
}

return 0;
}

static void nec_8048_panel_remove(struct omap_dss_device *dssdev)
{
struct nec_8048_data *necd = dev_get_drvdata(&dssdev->dev);

kfree(necd);
}

static int nec_8048_panel_power_on(struct omap_dss_device *dssdev)
{
struct panel_nec_nl8048_data *pd = get_panel_data(dssdev);
int r;

if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
Expand All @@ -124,6 +139,9 @@ static int nec_8048_panel_power_on(struct omap_dss_device *dssdev)
goto err1;
}

if (gpio_is_valid(pd->res_gpio))
gpio_set_value_cansleep(pd->res_gpio, 1);

return 0;
err1:
omapdss_dpi_display_disable(dssdev);
Expand All @@ -133,9 +151,14 @@ static int nec_8048_panel_power_on(struct omap_dss_device *dssdev)

static void nec_8048_panel_power_off(struct omap_dss_device *dssdev)
{
struct panel_nec_nl8048_data *pd = get_panel_data(dssdev);

if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
return;

if (gpio_is_valid(pd->res_gpio))
gpio_set_value_cansleep(pd->res_gpio, 0);

if (dssdev->platform_disable)
dssdev->platform_disable(dssdev);

Expand Down

0 comments on commit 05bf473

Please sign in to comment.