From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org,
devicetree@vger.kernel.org
Cc: Archit Taneja <archit@ti.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Nishanth Menon <nm@ti.com>, Felipe Balbi <balbi@ti.com>,
Santosh Shilimkar <santosh.shilimkar@ti.com>,
Tony Lindgren <tony@atomide.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [RFC 09/22] OMAPDSS: Add DT support to DSI
Date: Fri, 9 Aug 2013 11:38:54 +0300 [thread overview]
Message-ID: <1376037547-10859-10-git-send-email-tomi.valkeinen@ti.com> (raw)
In-Reply-To: <1376037547-10859-1-git-send-email-tomi.valkeinen@ti.com>
Add the code to make the DSI driver work with device tree on OMAP3 and
OMAP4.
A minor hack is needed at the moment in the DSI driver: the DSS driver
needs to know the ID number of a DSI device, as clocks are routed in
different ways to the DSI devices. At the moment we don't have any
proper way to manage this, so this patchs adds a simple lookup table
that is used to deduce the ID from the DSI device's base address.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dsi.c | 53 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 52 insertions(+), 1 deletion(-)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 0c8bd1f..bccf5fc 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -38,6 +38,7 @@
#include <linux/slab.h>
#include <linux/debugfs.h>
#include <linux/pm_runtime.h>
+#include <linux/of.h>
#include <video/omapdss.h>
#include <video/mipi_display.h>
@@ -371,6 +372,13 @@ struct dsi_packet_sent_handler_data {
struct completion *completion;
};
+struct dsi_module_id_data {
+ u32 address;
+ int id;
+};
+
+static const struct of_device_id dsi_of_match[];
+
#ifdef DEBUG
static bool dsi_perf;
module_param(dsi_perf, bool, 0644);
@@ -5537,7 +5545,6 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
if (!dsi)
return -ENOMEM;
- dsi->module_id = dsidev->id;
dsi->pdev = dsidev;
dev_set_drvdata(&dsidev->dev, dsi);
@@ -5587,6 +5594,31 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
return r;
}
+ if (dsidev->dev.of_node) {
+ const struct of_device_id *match;
+ const struct dsi_module_id_data *d;
+
+ match = of_match_node(dsi_of_match, dsidev->dev.of_node);
+ if (!match) {
+ DSSERR("unsupported DSI module\n");
+ return -ENODEV;
+ }
+
+ d = match->data;
+
+ while (d->address != 0 && d->address != dsi_mem->start)
+ d++;
+
+ if (d->address == 0) {
+ DSSERR("unsupported DSI module\n");
+ return -ENODEV;
+ }
+
+ dsi->module_id = d->id;
+ } else {
+ dsi->module_id = dsidev->id;
+ }
+
/* DSI VCs initialization */
for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
dsi->vc[i].source = DSI_VC_SOURCE_L4;
@@ -5641,6 +5673,7 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
else if (dsi->module_id == 1)
dss_debugfs_create_file("dsi2_irqs", dsi2_dump_irqs);
#endif
+
return 0;
err_probe:
@@ -5694,6 +5727,23 @@ static const struct dev_pm_ops dsi_pm_ops = {
.runtime_resume = dsi_runtime_resume,
};
+static const struct dsi_module_id_data dsi_of_data_omap3[] = {
+ { .address = 0x4804fc00, .id = 0, },
+ { },
+};
+
+static const struct dsi_module_id_data dsi_of_data_omap4[] = {
+ { .address = 0x58004000, .id = 0, },
+ { .address = 0x58005000, .id = 1, },
+ { },
+};
+
+static const struct of_device_id dsi_of_match[] = {
+ { .compatible = "ti,omap3-dsi", .data = dsi_of_data_omap3, },
+ { .compatible = "ti,omap4-dsi", .data = dsi_of_data_omap4, },
+ {},
+};
+
static struct platform_driver omap_dsihw_driver = {
.probe = omap_dsihw_probe,
.remove = __exit_p(omap_dsihw_remove),
@@ -5701,6 +5751,7 @@ static struct platform_driver omap_dsihw_driver = {
.name = "omapdss_dsi",
.owner = THIS_MODULE,
.pm = &dsi_pm_ops,
+ .of_match_table = dsi_of_match,
},
};
--
1.8.1.2
next prev parent reply other threads:[~2013-08-09 8:39 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-09 8:38 [RFC 00/22] OMAPDSS: DT support Tomi Valkeinen
2013-08-09 8:38 ` [RFC 01/22] ARM: OMAP: remove DSS DT hack Tomi Valkeinen
2013-08-09 8:38 ` [RFC 02/22] OMAPDSS: remove DT hacks for regulators Tomi Valkeinen
2013-08-09 8:38 ` [RFC 03/22] ARM: OMAP2+: add omapdss_init_of() Tomi Valkeinen
2013-08-09 8:38 ` [RFC 04/22] OMAPDSS: if dssdev->name==NULL, use alias Tomi Valkeinen
2013-08-09 8:38 ` [RFC 05/22] OMAPDSS: get dssdev->alias from DT alias Tomi Valkeinen
2013-08-09 8:38 ` [RFC 06/22] OMAPFB: clean up default display search Tomi Valkeinen
2013-08-09 8:38 ` [RFC 07/22] OMAPFB: search for default display with DT alias Tomi Valkeinen
2013-08-09 8:38 ` [RFC 08/22] OMAPDSS: Add DT support to DSS, DISPC, DPI, HDMI, VENC Tomi Valkeinen
2013-08-09 8:38 ` Tomi Valkeinen [this message]
2013-08-09 8:38 ` [RFC 10/22] ARM: omap3.dtsi: add omapdss information Tomi Valkeinen
2013-08-09 8:38 ` [RFC 11/22] ARM: omap4.dtsi: " Tomi Valkeinen
2013-08-09 8:38 ` [RFC 12/22] ARM: omap4-panda.dts: add display information Tomi Valkeinen
2013-08-09 8:38 ` [RFC 13/22] ARM: omap4-sdp.dts: " Tomi Valkeinen
2013-08-09 8:38 ` [RFC 14/22] ARM: omap3-tobi.dts: add lcd (TEST) Tomi Valkeinen
2013-08-09 8:39 ` [RFC 15/22] ARM: omap3-beagle.dts: add display information Tomi Valkeinen
2013-08-09 8:39 ` [RFC 16/22] OMAPDSS: panel-dsi-cm: Add DT support Tomi Valkeinen
2013-08-09 8:39 ` [RFC 17/22] OMAPDSS: encoder-tfp410: " Tomi Valkeinen
2013-08-09 8:39 ` [RFC 18/22] OMAPDSS: connector-dvi: " Tomi Valkeinen
2013-08-09 8:39 ` [RFC 19/22] OMAPDSS: encoder-tpd12s015: " Tomi Valkeinen
2013-08-09 8:39 ` [RFC 20/22] OMAPDSS: hdmi-connector: " Tomi Valkeinen
2013-08-09 8:39 ` [RFC 21/22] OMAPDSS: panel-dpi: " Tomi Valkeinen
2013-08-09 8:39 ` [RFC 22/22] OMAPDSS: connector-analog-tv: " Tomi Valkeinen
2013-08-13 7:54 ` [RFC 00/22] OMAPDSS: " Tony Lindgren
2013-08-30 9:47 ` Tomi Valkeinen
2013-09-02 6:15 ` Tony Lindgren
2013-09-02 6:42 ` Tomi Valkeinen
2013-09-04 17:20 ` Tony Lindgren
2013-08-21 21:07 ` Laurent Pinchart
2013-09-02 8:00 ` Tomi Valkeinen
2013-09-03 10:56 ` Laurent Pinchart
2013-09-04 7:29 ` Stefan Roese
2013-09-04 7:41 ` 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=1376037547-10859-10-git-send-email-tomi.valkeinen@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=archit@ti.com \
--cc=balbi@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=santosh.shilimkar@ti.com \
--cc=tony@atomide.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).