linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Archit Taneja <archit@ti.com>
To: tomi.valkeinen@ti.com
Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org,
	Archit Taneja <archit@ti.com>
Subject: [PATCH 16/33] OMAPDSS: acx565akm panel: handle gpios in panel driver
Date: Wed, 13 Feb 2013 14:34:08 +0000	[thread overview]
Message-ID: <1360765345-19312-17-git-send-email-archit@ti.com> (raw)
In-Reply-To: <1360765345-19312-1-git-send-email-archit@ti.com>

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>
---
 drivers/video/omap2/displays/panel-acx565akm.c |   48 ++++++++++++++++--------
 include/video/omap-panel-data.h                |    8 ++++
 2 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-acx565akm.c b/drivers/video/omap2/displays/panel-acx565akm.c
index a8fb26b..d7f69c0 100644
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ b/drivers/video/omap2/displays/panel-acx565akm.c
@@ -29,8 +29,10 @@
 #include <linux/sched.h>
 #include <linux/backlight.h>
 #include <linux/fb.h>
+#include <linux/gpio.h>
 
 #include <video/omapdss.h>
+#include <video/omap-panel-data.h>
 
 #define MIPID_CMD_READ_DISP_ID		0x04
 #define MIPID_CMD_READ_RED		0x06
@@ -494,21 +496,38 @@ static struct omap_video_timings acx_panel_timings = {
 	.sync_pclk_edge	= OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
 };
 
+static struct panel_acx565akm_data *get_panel_data(struct omap_dss_device *dssdev)
+{
+	return (struct panel_acx565akm_data *) dssdev->data;
+}
+
 static int acx_panel_probe(struct omap_dss_device *dssdev)
 {
 	int r;
 	struct acx565akm_device *md = &acx_dev;
+	struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
 	struct backlight_device *bldev;
 	int max_brightness, brightness;
 	struct backlight_properties props;
 
 	dev_dbg(&dssdev->dev, "%s\n", __func__);
 
+	if (!panel_data)
+		return -EINVAL;
+
 	/* FIXME AC bias ? */
 	dssdev->panel.timings = acx_panel_timings;
 
-	if (dssdev->platform_enable)
-		dssdev->platform_enable(dssdev);
+	if (gpio_is_valid(panel_data->reset_gpio)) {
+		r = devm_gpio_request_one(&dssdev->dev, panel_data->reset_gpio,
+				GPIOF_OUT_INIT_LOW, "lcd reset");
+		if (r)
+			return r;
+	}
+
+	if (gpio_is_valid(panel_data->reset_gpio))
+		gpio_set_value(panel_data->reset_gpio, 1);
+
 	/*
 	 * After reset we have to wait 5 msec before the first
 	 * command can be sent.
@@ -520,8 +539,9 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
 	r = panel_detect(md);
 	if (r) {
 		dev_err(&dssdev->dev, "%s panel detect error\n", __func__);
-		if (!md->enabled && dssdev->platform_disable)
-			dssdev->platform_disable(dssdev);
+		if (!md->enabled && gpio_is_valid(panel_data->reset_gpio))
+			gpio_set_value(panel_data->reset_gpio, 0);
+
 		return r;
 	}
 
@@ -530,8 +550,8 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
 	mutex_unlock(&acx_dev.mutex);
 
 	if (!md->enabled) {
-		if (dssdev->platform_disable)
-			dssdev->platform_disable(dssdev);
+		if (gpio_is_valid(panel_data->reset_gpio))
+			gpio_set_value(panel_data->reset_gpio, 0);
 	}
 
 	/*------- Backlight control --------*/
@@ -584,6 +604,7 @@ static void acx_panel_remove(struct omap_dss_device *dssdev)
 static int acx_panel_power_on(struct omap_dss_device *dssdev)
 {
 	struct acx565akm_device *md = &acx_dev;
+	struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
 	int r;
 
 	dev_dbg(&dssdev->dev, "%s\n", __func__);
@@ -605,11 +626,8 @@ static int acx_panel_power_on(struct omap_dss_device *dssdev)
 	/*FIXME tweak me */
 	msleep(50);
 
-	if (dssdev->platform_enable) {
-		r = dssdev->platform_enable(dssdev);
-		if (r)
-			goto fail;
-	}
+	if (gpio_is_valid(panel_data->reset_gpio))
+		gpio_set_value(panel_data->reset_gpio, 1);
 
 	if (md->enabled) {
 		dev_dbg(&md->spi->dev, "panel already enabled\n");
@@ -638,8 +656,7 @@ static int acx_panel_power_on(struct omap_dss_device *dssdev)
 	mutex_unlock(&md->mutex);
 
 	return acx565akm_bl_update_status(md->bl_dev);
-fail:
-	omapdss_sdi_display_disable(dssdev);
+
 fail_unlock:
 	mutex_unlock(&md->mutex);
 	return r;
@@ -648,6 +665,7 @@ fail_unlock:
 static void acx_panel_power_off(struct omap_dss_device *dssdev)
 {
 	struct acx565akm_device *md = &acx_dev;
+	struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
 
 	dev_dbg(&dssdev->dev, "%s\n", __func__);
 
@@ -671,8 +689,8 @@ static void acx_panel_power_off(struct omap_dss_device *dssdev)
 	 */
 	msleep(50);
 
-	if (dssdev->platform_disable)
-		dssdev->platform_disable(dssdev);
+	if (gpio_is_valid(panel_data->reset_gpio))
+		gpio_set_value(panel_data->reset_gpio, 0);
 
 	/* FIXME need to tweak this delay */
 	msleep(100);
diff --git a/include/video/omap-panel-data.h b/include/video/omap-panel-data.h
index 86da8d3..6faf0c7 100644
--- a/include/video/omap-panel-data.h
+++ b/include/video/omap-panel-data.h
@@ -117,4 +117,12 @@ struct panel_sharp_ls037v7dw01_data {
 	int ud_gpio;
 };
 
+/**
+ * acx565akm panel driver configuration data
+ * @reset_gpio: reset signal
+ */
+struct panel_acx565akm_data {
+	int reset_gpio;
+};
+
 #endif /* __OMAP_PANEL_DATA_H */
-- 
1.7.9.5


  parent reply	other threads:[~2013-02-13 14:34 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-13 14:33 [PATCH 00/33] OMAPDSS: platform_enable/disable callback removal from panel drivers Archit Taneja
2013-02-13 14:33 ` [PATCH 01/33] OMAPDSS: panels: keep platform data of all panels in a single header Archit Taneja
2013-02-13 14:33 ` [PATCH 02/33] OMAPDSS: generic dpi panel: handle gpios in panel driver Archit Taneja
2013-02-13 14:33 ` [PATCH 03/33] arm: omap: board-2430: use generic dpi panel's gpio handling Archit Taneja
2013-02-13 14:33 ` [PATCH 04/33] arm: omap: board-devkit8000: " Archit Taneja
2013-02-13 14:33 ` [PATCH 05/33] arm: omap: board-cm-t35: " Archit Taneja
2013-02-13 15:16   ` Igor Grinberg
2013-02-13 15:28     ` Tomi Valkeinen
2013-02-13 15:59       ` Tomi Valkeinen
2013-02-14  6:56         ` Igor Grinberg
2013-02-14  7:09           ` Tomi Valkeinen
2013-02-14  8:37             ` Igor Grinberg
2013-02-14  9:09               ` Tomi Valkeinen
2013-02-14  9:43                 ` Igor Grinberg
2013-02-14 10:59                   ` Tomi Valkeinen
2013-02-14 12:37                     ` Igor Grinberg
2013-02-14 12:52                       ` Tomi Valkeinen
2013-02-14 13:51                         ` Igor Grinberg
2013-04-03 12:02                           ` Tomi Valkeinen
2013-04-04  7:17                             ` Igor Grinberg
2013-02-13 14:33 ` [PATCH 06/33] arm: omap: board-apollon: " Archit Taneja
2013-02-13 14:33 ` [PATCH 07/33] arm: omap: board-am3517: " Archit Taneja
2013-02-13 14:34 ` [PATCH 08/33] arm: omap: board-ldp: " Archit Taneja
2013-02-13 14:34 ` [PATCH 09/33] OMAPDSS: lb035q02: handle gpios in panel driver Archit Taneja
2013-02-13 14:34 ` [PATCH 10/33] arm: omap: board-overo: use lb035q02 dpi panel's gpio handling Archit Taneja
2013-02-13 14:34 ` [PATCH 11/33] OMAPDSS: lb035q02 panel: remove platform_enable/disable callbacks Archit Taneja
2013-02-13 14:34 ` [PATCH 12/33] OMAPDSS: generic dpi panel: remove platform_enable/disable ops from platform_data Archit Taneja
2013-02-13 14:34 ` [PATCH 13/33] arm: omap: board-omap3evm: use sharp panel's gpio handling Archit Taneja
2013-02-13 14:34 ` [PATCH 14/33] arm: omap: board-sdp3430: " Archit Taneja
2013-02-13 14:34 ` [PATCH 15/33] OMAPDSS: sharp-ls panel: remove platform_enable/disable callbacks Archit Taneja
2013-02-13 14:34 ` Archit Taneja [this message]
2013-02-13 17:29   ` [PATCH 16/33] OMAPDSS: acx565akm panel: handle gpios in panel driver Aaro Koskinen
2013-02-14  6:52     ` Archit Taneja
2013-02-14  6:58       ` Tomi Valkeinen
2013-02-14  7:20         ` Archit Taneja
2013-02-18  7:45         ` Archit Taneja
2013-02-18  8:11           ` Tomi Valkeinen
2013-02-18  8:35             ` Archit Taneja
2013-02-13 14:34 ` [PATCH 17/33] arm: omap: board-rx-51: use acx565akm panel's gpio handling Archit Taneja
2013-02-13 14:34 ` [PATCH 18/33] OMAPDSS: nec-nl8048 panel: handle gpios ins panel driver Archit Taneja
2013-02-13 14:34 ` [PATCH 19/33] arm: omap: board-zoom: use NEC panel's gpio handling Archit Taneja
2013-02-13 14:34 ` [PATCH 20/33] OMAPDSS: nec-nl8048 panel: remove platform_enable/disable callbacks Archit Taneja
2013-02-13 14:34 ` [PATCH 21/33] OMAPDSS: tpo-td043 panel: handle gpios in panel driver Archit Taneja
2013-02-13 14:34 ` [PATCH 22/33] arm: omap: board-omap3pandora: use tpo panel's gpio handling Archit Taneja
2013-02-13 14:34 ` [PATCH 23/33] OMAPDSS: tpo-td043: remove platform_enable/disable callbacks Archit Taneja
2013-02-13 14:34 ` [PATCH 24/33] OMAPDSS: picodlp panel: handle gpio data in panel driver Archit Taneja
2013-02-13 14:34 ` [PATCH 25/33] arm: omap: dss-common: use picodlp panel's gpio handling Archit Taneja
2013-02-13 14:34 ` [PATCH 26/33] OMAPDSS: picodlp panel: remove platform_enable/disable callbacks Archit Taneja
2013-02-13 14:34 ` [PATCH 27/33] OMAPDSS: n8x0 panel: handle gpio data in panel driver Archit Taneja
2013-02-13 17:35   ` Aaro Koskinen
2013-02-14  6:46     ` Archit Taneja
2013-02-14 12:45       ` Aaro Koskinen
2013-02-13 14:34 ` [PATCH 28/33] OMAPDSS: n8x0 panel: remove platform_enable/disable callbacks Archit Taneja
2013-02-13 14:34 ` [PATCH 29/33] arm: omap boards: Remove unnecessary platform_enable/disable callbacks for VENC device Archit Taneja
2013-02-13 14:34 ` [PATCH 30/33] OMAPDSS: VENC: remove platform_enable/disable calls Archit Taneja
2013-02-13 14:34 ` [PATCH 31/33] OMAPDSS: remove platform_enable/disable callbacks from omap_dss_device Archit Taneja
2013-02-13 14:34 ` [PATCH 32/33] arm: dss-common: don't use reset_gpio from omap4_panda_dvi_device Archit Taneja
2013-02-13 14:34 ` [PATCH 33/33] OMAPDSS: remove reset_gpio field from omap_dss_device Archit Taneja
2013-02-13 16:46 ` [PATCH 00/33] OMAPDSS: platform_enable/disable callback removal from panel drivers Tony Lindgren
2013-02-14  7:29   ` Archit Taneja
2013-04-03 12:28   ` Tomi Valkeinen
2013-04-03 15:46     ` Tony Lindgren
2013-04-15  9:29       ` Tomi Valkeinen
2013-04-15 21:20         ` Tony Lindgren
2013-04-16  4:20           ` Tomi Valkeinen
2013-04-18  0:34             ` Tony Lindgren
2013-04-18  3:40               ` Tomi Valkeinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360765345-19312-17-git-send-email-archit@ti.com \
    --to=archit@ti.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).