aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2012-11-20 01:05:23 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-03 08:19:47 -0400
commit3c45d05be382340dc4ccbef5819bd1eca601eb57 (patch)
treeb36cae3c3ecd723b8436bfd20b3e5107b0752eea
parent3db716bca710b5f0f1749c058532728d21b85bfc (diff)
OMAPDSS: acx565akm panel: handle gpios in panel driver
The acx565akm 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 reset gpio number used by the panel driver, this struct will be passed to the panel driver as platform data. The driver will request and configure the reset gpio 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-acx565akm.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/drivers/video/omap2/displays/panel-acx565akm.c b/drivers/video/omap2/displays/panel-acx565akm.c
index a8fb26b0ee85..d7f69c09ecf1 100644
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ b/drivers/video/omap2/displays/panel-acx565akm.c
@@ -29,8 +29,10 @@
29#include <linux/sched.h> 29#include <linux/sched.h>
30#include <linux/backlight.h> 30#include <linux/backlight.h>
31#include <linux/fb.h> 31#include <linux/fb.h>
32#include <linux/gpio.h>
32 33
33#include <video/omapdss.h> 34#include <video/omapdss.h>
35#include <video/omap-panel-data.h>
34 36
35#define MIPID_CMD_READ_DISP_ID 0x04 37#define MIPID_CMD_READ_DISP_ID 0x04
36#define MIPID_CMD_READ_RED 0x06 38#define MIPID_CMD_READ_RED 0x06
@@ -494,21 +496,38 @@ static struct omap_video_timings acx_panel_timings = {
494 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES, 496 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
495}; 497};
496 498
499static struct panel_acx565akm_data *get_panel_data(struct omap_dss_device *dssdev)
500{
501 return (struct panel_acx565akm_data *) dssdev->data;
502}
503
497static int acx_panel_probe(struct omap_dss_device *dssdev) 504static int acx_panel_probe(struct omap_dss_device *dssdev)
498{ 505{
499 int r; 506 int r;
500 struct acx565akm_device *md = &acx_dev; 507 struct acx565akm_device *md = &acx_dev;
508 struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
501 struct backlight_device *bldev; 509 struct backlight_device *bldev;
502 int max_brightness, brightness; 510 int max_brightness, brightness;
503 struct backlight_properties props; 511 struct backlight_properties props;
504 512
505 dev_dbg(&dssdev->dev, "%s\n", __func__); 513 dev_dbg(&dssdev->dev, "%s\n", __func__);
506 514
515 if (!panel_data)
516 return -EINVAL;
517
507 /* FIXME AC bias ? */ 518 /* FIXME AC bias ? */
508 dssdev->panel.timings = acx_panel_timings; 519 dssdev->panel.timings = acx_panel_timings;
509 520
510 if (dssdev->platform_enable) 521 if (gpio_is_valid(panel_data->reset_gpio)) {
511 dssdev->platform_enable(dssdev); 522 r = devm_gpio_request_one(&dssdev->dev, panel_data->reset_gpio,
523 GPIOF_OUT_INIT_LOW, "lcd reset");
524 if (r)
525 return r;
526 }
527
528 if (gpio_is_valid(panel_data->reset_gpio))
529 gpio_set_value(panel_data->reset_gpio, 1);
530
512 /* 531 /*
513 * After reset we have to wait 5 msec before the first 532 * After reset we have to wait 5 msec before the first
514 * command can be sent. 533 * command can be sent.
@@ -520,8 +539,9 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
520 r = panel_detect(md); 539 r = panel_detect(md);
521 if (r) { 540 if (r) {
522 dev_err(&dssdev->dev, "%s panel detect error\n", __func__); 541 dev_err(&dssdev->dev, "%s panel detect error\n", __func__);
523 if (!md->enabled && dssdev->platform_disable) 542 if (!md->enabled && gpio_is_valid(panel_data->reset_gpio))
524 dssdev->platform_disable(dssdev); 543 gpio_set_value(panel_data->reset_gpio, 0);
544
525 return r; 545 return r;
526 } 546 }
527 547
@@ -530,8 +550,8 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
530 mutex_unlock(&acx_dev.mutex); 550 mutex_unlock(&acx_dev.mutex);
531 551
532 if (!md->enabled) { 552 if (!md->enabled) {
533 if (dssdev->platform_disable) 553 if (gpio_is_valid(panel_data->reset_gpio))
534 dssdev->platform_disable(dssdev); 554 gpio_set_value(panel_data->reset_gpio, 0);
535 } 555 }
536 556
537 /*------- Backlight control --------*/ 557 /*------- Backlight control --------*/
@@ -584,6 +604,7 @@ static void acx_panel_remove(struct omap_dss_device *dssdev)
584static int acx_panel_power_on(struct omap_dss_device *dssdev) 604static int acx_panel_power_on(struct omap_dss_device *dssdev)
585{ 605{
586 struct acx565akm_device *md = &acx_dev; 606 struct acx565akm_device *md = &acx_dev;
607 struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
587 int r; 608 int r;
588 609
589 dev_dbg(&dssdev->dev, "%s\n", __func__); 610 dev_dbg(&dssdev->dev, "%s\n", __func__);
@@ -605,11 +626,8 @@ static int acx_panel_power_on(struct omap_dss_device *dssdev)
605 /*FIXME tweak me */ 626 /*FIXME tweak me */
606 msleep(50); 627 msleep(50);
607 628
608 if (dssdev->platform_enable) { 629 if (gpio_is_valid(panel_data->reset_gpio))
609 r = dssdev->platform_enable(dssdev); 630 gpio_set_value(panel_data->reset_gpio, 1);
610 if (r)
611 goto fail;
612 }
613 631
614 if (md->enabled) { 632 if (md->enabled) {
615 dev_dbg(&md->spi->dev, "panel already enabled\n"); 633 dev_dbg(&md->spi->dev, "panel already enabled\n");
@@ -638,8 +656,7 @@ static int acx_panel_power_on(struct omap_dss_device *dssdev)
638 mutex_unlock(&md->mutex); 656 mutex_unlock(&md->mutex);
639 657
640 return acx565akm_bl_update_status(md->bl_dev); 658 return acx565akm_bl_update_status(md->bl_dev);
641fail: 659
642 omapdss_sdi_display_disable(dssdev);
643fail_unlock: 660fail_unlock:
644 mutex_unlock(&md->mutex); 661 mutex_unlock(&md->mutex);
645 return r; 662 return r;
@@ -648,6 +665,7 @@ fail_unlock:
648static void acx_panel_power_off(struct omap_dss_device *dssdev) 665static void acx_panel_power_off(struct omap_dss_device *dssdev)
649{ 666{
650 struct acx565akm_device *md = &acx_dev; 667 struct acx565akm_device *md = &acx_dev;
668 struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
651 669
652 dev_dbg(&dssdev->dev, "%s\n", __func__); 670 dev_dbg(&dssdev->dev, "%s\n", __func__);
653 671
@@ -671,8 +689,8 @@ static void acx_panel_power_off(struct omap_dss_device *dssdev)
671 */ 689 */
672 msleep(50); 690 msleep(50);
673 691
674 if (dssdev->platform_disable) 692 if (gpio_is_valid(panel_data->reset_gpio))
675 dssdev->platform_disable(dssdev); 693 gpio_set_value(panel_data->reset_gpio, 0);
676 694
677 /* FIXME need to tweak this delay */ 695 /* FIXME need to tweak this delay */
678 msleep(100); 696 msleep(100);