linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mythri P K <mythripk@ti.com>
To: linux-omap@vger.kernel.org, tomi.valkeinen@ti.com
Cc: Mythri P K <mythripk@ti.com>
Subject: [PATCH v5 06/10] OMAP4 : DSS2 : HDMI: HDMI panel driver addition in the DSS
Date: Thu, 10 Mar 2011 16:14:14 +0530	[thread overview]
Message-ID: <1299753858-12222-7-git-send-email-mythripk@ti.com> (raw)
In-Reply-To: <1299753858-12222-6-git-send-email-mythripk@ti.com>

The panel driver(hdmi_omap4_panel.c) in omap2/dss acts as a controller
to manage the enable and disable requests and synchronize audio and video.

Signed-off-by: Mythri P K <mythripk@ti.com>
---
 drivers/video/omap2/dss/dss.h              |    2 +
 drivers/video/omap2/dss/hdmi_omap4_panel.c |  222 ++++++++++++++++++++++++++++
 2 files changed, 224 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/omap2/dss/hdmi_omap4_panel.c

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 6bf923c..05ccd00 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -483,6 +483,8 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev);
 void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev);
 int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
 					struct omap_video_timings *timings);
+int hdmi_panel_init(void);
+void hdmi_panel_exit(void);
 
 /* RFBI */
 #ifdef CONFIG_OMAP2_DSS_RFBI
diff --git a/drivers/video/omap2/dss/hdmi_omap4_panel.c b/drivers/video/omap2/dss/hdmi_omap4_panel.c
new file mode 100644
index 0000000..ffb5de9
--- /dev/null
+++ b/drivers/video/omap2/dss/hdmi_omap4_panel.c
@@ -0,0 +1,222 @@
+/*
+ * hdmi_omap4_panel.c
+ *
+ * HDMI library support functions for TI OMAP4 processors.
+ *
+ * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/
+ * Authors:	Mythri P k <mythripk@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/kernel.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/mutex.h>
+#include <linux/module.h>
+#include <plat/display.h>
+
+#include "dss.h"
+
+static struct {
+	struct mutex hdmi_lock;
+} hdmi;
+
+
+static int hdmi_panel_probe(struct omap_dss_device *dssdev)
+{
+	DSSDBG("ENTER hdmi_panel_probe\n");
+
+	dssdev->panel.config = OMAP_DSS_LCD_TFT |
+			OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
+
+	/*
+	 * Initialize the timings to 640 * 480
+	 * This is only for framebuffer update not for TV timing setting
+	 * Setting TV timing will be done only on enable
+	 */
+	dssdev->panel.timings.x_res = 640;
+	dssdev->panel.timings.y_res = 480;
+
+	DSSDBG("hdmi_panel_probe x_res= %d y_res = %d\n",
+		dssdev->panel.timings.x_res,
+		dssdev->panel.timings.y_res);
+	return 0;
+}
+
+static void hdmi_panel_remove(struct omap_dss_device *dssdev)
+{
+
+}
+
+static int hdmi_panel_enable(struct omap_dss_device *dssdev)
+{
+	int r = 0;
+	DSSDBG("ENTER hdmi_panel_enable\n");
+
+	mutex_lock(&hdmi.hdmi_lock);
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) {
+		r = -EINVAL;
+		goto err;
+	}
+
+	r = omapdss_hdmi_display_enable(dssdev);
+	if (r) {
+		DSSERR("failed to power on\n");
+		goto err;
+	}
+
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+
+err:
+	mutex_unlock(&hdmi.hdmi_lock);
+
+	return r;
+}
+
+static void hdmi_panel_disable(struct omap_dss_device *dssdev)
+{
+	mutex_lock(&hdmi.hdmi_lock);
+
+	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
+		omapdss_hdmi_display_disable(dssdev);
+
+	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+
+	mutex_unlock(&hdmi.hdmi_lock);
+}
+
+static int hdmi_panel_suspend(struct omap_dss_device *dssdev)
+{
+	int r = 0;
+
+	mutex_lock(&hdmi.hdmi_lock);
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) {
+		r = -EINVAL;
+		goto err;
+	}
+
+	dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
+
+	omapdss_hdmi_display_disable(dssdev);
+
+err:
+	mutex_unlock(&hdmi.hdmi_lock);
+
+	return r;
+}
+
+static int hdmi_panel_resume(struct omap_dss_device *dssdev)
+{
+	int r = 0;
+
+	mutex_lock(&hdmi.hdmi_lock);
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) {
+		r = -EINVAL;
+		goto err;
+	}
+
+	r = omapdss_hdmi_display_enable(dssdev);
+	if (r) {
+		DSSERR("failed to power on\n");
+		goto err;
+	}
+
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+
+err:
+	mutex_unlock(&hdmi.hdmi_lock);
+
+	return r;
+}
+
+static void hdmi_get_timings(struct omap_dss_device *dssdev,
+			struct omap_video_timings *timings)
+{
+	mutex_lock(&hdmi.hdmi_lock);
+
+	*timings = dssdev->panel.timings;
+
+	mutex_unlock(&hdmi.hdmi_lock);
+}
+
+static void hdmi_set_timings(struct omap_dss_device *dssdev,
+			struct omap_video_timings *timings)
+{
+	DSSDBG("hdmi_set_timings\n");
+
+	mutex_lock(&hdmi.hdmi_lock);
+
+	dssdev->panel.timings = *timings;
+
+	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
+		/* turn the hdmi off and on to get new timings to use */
+		omapdss_hdmi_display_disable(dssdev);
+		omapdss_hdmi_display_set_timing(dssdev);
+	}
+
+	mutex_unlock(&hdmi.hdmi_lock);
+}
+
+static int hdmi_check_timings(struct omap_dss_device *dssdev,
+			struct omap_video_timings *timings)
+{
+	int r = 0;
+
+	DSSDBG("hdmi_check_timings\n");
+
+	mutex_lock(&hdmi.hdmi_lock);
+
+	r = omapdss_hdmi_display_check_timing(dssdev, timings);
+	if (r) {
+		DSSERR("Timing cannot be applied\n");
+		goto err;
+	}
+err:
+	mutex_unlock(&hdmi.hdmi_lock);
+	return r;
+}
+
+static struct omap_dss_driver hdmi_driver = {
+	.probe		= hdmi_panel_probe,
+	.remove		= hdmi_panel_remove,
+	.enable		= hdmi_panel_enable,
+	.disable	= hdmi_panel_disable,
+	.suspend	= hdmi_panel_suspend,
+	.resume		= hdmi_panel_resume,
+	.get_timings	= hdmi_get_timings,
+	.set_timings	= hdmi_set_timings,
+	.check_timings	= hdmi_check_timings,
+	.driver			= {
+		.name   = "hdmi_panel",
+		.owner  = THIS_MODULE,
+	},
+};
+
+int hdmi_panel_init(void)
+{
+	mutex_init(&hdmi.hdmi_lock);
+
+	omap_dss_register_driver(&hdmi_driver);
+
+	return 0;
+}
+
+void hdmi_panel_exit(void)
+{
+	omap_dss_unregister_driver(&hdmi_driver);
+
+}
-- 
1.5.6.3


  reply	other threads:[~2011-03-10 10:50 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 10:44 [PATCH v5 00/10] OMAP4 : DSS2 : HDMI support on OMAP4 Mythri P K
2011-03-10 10:44 ` [PATCH v5 01/10] OMAP4 : DSS2 : Add display type HDMI to DSS2 Mythri P K
2011-03-10 10:44   ` [PATCH v5 02/10] OMAP4 : DSS2 : HDMI: Select between HDMI VENC clock source Mythri P K
2011-03-10 10:44     ` [PATCH v5 03/10] OMAP4 : DSS2 : HDMI: Dispc gamma enable set/reset function for TV Mythri P K
2011-03-10 10:44       ` [PATCH v5 04/10] OMAP4 : DSS2 : HDMI: HDMI driver header file addition Mythri P K
2011-03-10 10:44         ` [PATCH v5 05/10] OMAP4 : DSS2 : HDMI: HDMI driver addition in the DSS Mythri P K
2011-03-10 10:44           ` Mythri P K [this message]
2011-03-10 10:44             ` [PATCH v5 07/10] OMAP4 : DSS2 : HDMI: Add makefile and kconfig changes to enable HDMI in OMAP4 Mythri P K
2011-03-10 10:44               ` [PATCH v5 08/10] OMAP4 : DSS : HDMI: Call to HDMI module init to register driver Mythri P K
2011-03-10 10:44                 ` [PATCH v5 09/10] OMAP4 : HDMI : Add HDMI structure in the board file for OMAP4 SDP Mythri P K
2011-03-10 10:44                   ` [PATCH v5 10/10] OMAP4 : HDMI : Add HDMI structure in the board file for OMAP4 PANDA Mythri P K
2011-03-15  4:23                     ` Tomi Valkeinen
2011-03-15 14:47                       ` John S
2011-03-10 14:04                 ` [PATCH v5 08/10] OMAP4 : DSS : HDMI: Call to HDMI module init to register driver Tomi Valkeinen
2011-03-10 13:59               ` [PATCH v5 07/10] OMAP4 : DSS2 : HDMI: Add makefile and kconfig changes to enable HDMI in OMAP4 Tomi Valkeinen
2011-03-10 13:58           ` [PATCH v5 05/10] OMAP4 : DSS2 : HDMI: HDMI driver addition in the DSS Tomi Valkeinen
2011-03-10 13:52       ` [PATCH v5 03/10] OMAP4 : DSS2 : HDMI: Dispc gamma enable set/reset function for TV Tomi Valkeinen
2011-05-05 13:50       ` Laurent Pinchart
2011-03-10 13:49     ` [PATCH v5 02/10] OMAP4 : DSS2 : HDMI: Select between HDMI VENC clock source Tomi Valkeinen
2011-03-10 13:48   ` [PATCH v5 01/10] OMAP4 : DSS2 : Add display type HDMI to DSS2 Tomi Valkeinen
2011-03-10 16:53     ` Aaro Koskinen
2011-03-10 13:44 ` [PATCH v5 00/10] OMAP4 : DSS2 : HDMI support on OMAP4 Tomi Valkeinen
2011-03-10 14:45   ` Stephan Raue
2011-03-10 14:51     ` Tomi Valkeinen
2011-03-11  0:07       ` Stephan Raue
2011-03-11  6:16         ` K, Mythri P
2011-03-11  7:24           ` Tomi Valkeinen
2011-03-11 13:23             ` Hiremath, Vaibhav
2011-03-14  8:35               ` Hiremath, Vaibhav
2011-03-14  9:24                 ` Tomi Valkeinen
2011-03-14  9:35                   ` Hiremath, Vaibhav
2011-03-16  6:45                     ` Tomi Valkeinen
2011-03-16  6:47                       ` Hiremath, Vaibhav
2011-03-11  7:12     ` Tomi Valkeinen
2011-03-11  8:43       ` Stephan Raue
2011-03-11 13:22         ` Tomi Valkeinen
2011-03-11 16:18           ` Stephan Raue
2011-03-11 18:27             ` Tomi Valkeinen
2011-03-11 18:42               ` Stephan Raue
2011-03-12  6:51                 ` K, Mythri P
2011-03-13 14:32                   ` Stephan Raue
2011-03-13 16:20                     ` Stephan Raue
2011-03-16  6:51                       ` Tomi Valkeinen
2011-03-16 10:53                         ` K, Mythri P
2011-03-16 10:59                           ` Tomi Valkeinen
2011-03-16 23:49                           ` Stephan Raue
2011-03-17 11:11                             ` Tomi Valkeinen
2011-03-17 16:20                               ` Janorkar, Mayuresh
2011-03-17 20:16                                 ` Stephan Raue
2011-03-17 21:13                                   ` Stephan Raue
2011-03-17 21:34                                     ` Stephan Raue
2011-03-18  3:45                                     ` Tomi Valkeinen
2011-03-18  5:43                             ` Anand Gadiyar
2011-03-18  5:43                             ` Anand Gadiyar
2011-03-18  6:17                               ` Gadiyar, Anand
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-18  5:52                             ` Anand Gadiyar
2011-03-14 10:37   ` Jan, Sebastien
2011-03-15  4:06     ` Tomi Valkeinen
2011-03-15  4:38       ` K, Mythri P
2011-03-10 15:06 ` Tomi Valkeinen
2011-03-11  8:24   ` K, Mythri P
2011-03-16  8:32     ` 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=1299753858-12222-7-git-send-email-mythripk@ti.com \
    --to=mythripk@ti.com \
    --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).