Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 371331
b: refs/heads/master
c: 3103098
h: refs/heads/master
i:
  371329: a66efbe
  371327: 6d7635e
v: v3
  • Loading branch information
Tomi Valkeinen committed Apr 3, 2013
1 parent 7bb5c0e commit e4cf9cc
Show file tree
Hide file tree
Showing 2 changed files with 61 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: 7e930086e739c9eb5bd9ccd2017f26aa87153dd8
refs/heads/master: 31030985450977d978a1781111a4ddadb86c4ae8
71 changes: 60 additions & 11 deletions trunk/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
#include <linux/fb.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/gpio.h>

#include <video/omapdss.h>

struct sharp_data {
};
#include <video/omap-panel-data.h>

static struct omap_video_timings sharp_ls_timings = {
.x_res = 480,
Expand All @@ -50,31 +49,67 @@ static struct omap_video_timings sharp_ls_timings = {
.sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
};

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

static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
{
struct sharp_data *sd;
struct panel_sharp_ls037v7dw01_data *pd = get_panel_data(dssdev);
int r;

if (!pd)
return -EINVAL;

dssdev->panel.timings = sharp_ls_timings;

sd = kzalloc(sizeof(*sd), GFP_KERNEL);
if (!sd)
return -ENOMEM;
if (gpio_is_valid(pd->mo_gpio)) {
r = devm_gpio_request_one(&dssdev->dev, pd->mo_gpio,
GPIOF_OUT_INIT_LOW, "lcd MO");
if (r)
return r;
}

if (gpio_is_valid(pd->lr_gpio)) {
r = devm_gpio_request_one(&dssdev->dev, pd->lr_gpio,
GPIOF_OUT_INIT_HIGH, "lcd LR");
if (r)
return r;
}

dev_set_drvdata(&dssdev->dev, sd);
if (gpio_is_valid(pd->ud_gpio)) {
r = devm_gpio_request_one(&dssdev->dev, pd->ud_gpio,
GPIOF_OUT_INIT_HIGH, "lcd UD");
if (r)
return r;
}

if (gpio_is_valid(pd->resb_gpio)) {
r = devm_gpio_request_one(&dssdev->dev, pd->resb_gpio,
GPIOF_OUT_INIT_LOW, "lcd RESB");
if (r)
return r;
}

if (gpio_is_valid(pd->ini_gpio)) {
r = devm_gpio_request_one(&dssdev->dev, pd->ini_gpio,
GPIOF_OUT_INIT_LOW, "lcd INI");
if (r)
return r;
}

return 0;
}

static void __exit sharp_ls_panel_remove(struct omap_dss_device *dssdev)
{
struct sharp_data *sd = dev_get_drvdata(&dssdev->dev);

kfree(sd);
}

static int sharp_ls_power_on(struct omap_dss_device *dssdev)
{
struct panel_sharp_ls037v7dw01_data *pd = get_panel_data(dssdev);
int r = 0;

if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
Expand All @@ -96,6 +131,12 @@ static int sharp_ls_power_on(struct omap_dss_device *dssdev)
goto err1;
}

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

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

return 0;
err1:
omapdss_dpi_display_disable(dssdev);
Expand All @@ -105,9 +146,17 @@ static int sharp_ls_power_on(struct omap_dss_device *dssdev)

static void sharp_ls_power_off(struct omap_dss_device *dssdev)
{
struct panel_sharp_ls037v7dw01_data *pd = get_panel_data(dssdev);

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

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

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

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

Expand Down

0 comments on commit e4cf9cc

Please sign in to comment.