All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Laurent Pinchart
	<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>,
	Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCHv2 23/27] OMAPDSS: connector-dvi: Add DT support
Date: Wed, 18 Dec 2013 14:02:28 +0000	[thread overview]
Message-ID: <52B1AAF4.3020509@ti.com> (raw)
In-Reply-To: <52B17BBF.8090003-l0cyMroinI0@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2089 bytes --]

On 2013-12-18 12:41, Tomi Valkeinen wrote:

> 3. Have correct DT data, but at init time, in omap arch code, go through
> the DT data and change the compat strings for the display nodes to
> include "omapdss,". This way the drivers would only work for omap
> platforms. Like a combination of 1. and 2. I'm not sure if the DT-code
> allows this at the moment, though.

This wasn't actually too hard. It says "hack" all over it, but the code
was quite compact. I call the omapdss_early_init_of() as the first thing
in omap_generic_init(), before the devices are created:

+static const char* const dss_compat_conv_list[] = {
+       "hdmi-connector",
+       "dvi-connector",
+       "ti,tpd12s015",
+       "panel-dsi-cm",
+};
+
+static void omapdss_omapify_node(struct device_node *node, const char
*compat)
+{
+       char *new_compat;
+       struct property *prop;
+
+       new_compat = kasprintf(GFP_KERNEL, "omapdss,%s", compat);
+
+       prop = kzalloc(sizeof(*prop), GFP_KERNEL);
+       prop->name = "compatible";
+       prop->value = new_compat;
+       prop->length = strlen(new_compat) + 1;
+
+       of_update_property(node, prop);
+}
+
+void __init omapdss_early_init_of(void)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(dss_compat_conv_list); ++i) {
+               const char *compat = dss_compat_conv_list[i];
+               struct device_node *node = NULL;
+
+               while ((node = of_find_compatible_node(node, NULL,
compat))) {
+                       if (!of_device_is_available(node))
+                               continue;
+
+                       omapdss_omapify_node(node, compat);
+               }
+       }
+}

The list has just part of the devices, and I've so far only tested on
OMAP 4430sdp board, but it seemed to work fine.

So with this, I can have "hdmi-connector" in the .dts file, and
"omapdss,hdmi-connector" as a compat string in the omap specific driver.

Does it make your eyes bleed, or is it maybe something that could be
fine for the time being?

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Tomi Valkeinen <tomi.valkeinen-l0cyMroinI0@public.gmane.org>
To: Laurent Pinchart
	<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>,
	Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCHv2 23/27] OMAPDSS: connector-dvi: Add DT support
Date: Wed, 18 Dec 2013 16:02:28 +0200	[thread overview]
Message-ID: <52B1AAF4.3020509@ti.com> (raw)
In-Reply-To: <52B17BBF.8090003-l0cyMroinI0@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2089 bytes --]

On 2013-12-18 12:41, Tomi Valkeinen wrote:

> 3. Have correct DT data, but at init time, in omap arch code, go through
> the DT data and change the compat strings for the display nodes to
> include "omapdss,". This way the drivers would only work for omap
> platforms. Like a combination of 1. and 2. I'm not sure if the DT-code
> allows this at the moment, though.

This wasn't actually too hard. It says "hack" all over it, but the code
was quite compact. I call the omapdss_early_init_of() as the first thing
in omap_generic_init(), before the devices are created:

+static const char* const dss_compat_conv_list[] = {
+       "hdmi-connector",
+       "dvi-connector",
+       "ti,tpd12s015",
+       "panel-dsi-cm",
+};
+
+static void omapdss_omapify_node(struct device_node *node, const char
*compat)
+{
+       char *new_compat;
+       struct property *prop;
+
+       new_compat = kasprintf(GFP_KERNEL, "omapdss,%s", compat);
+
+       prop = kzalloc(sizeof(*prop), GFP_KERNEL);
+       prop->name = "compatible";
+       prop->value = new_compat;
+       prop->length = strlen(new_compat) + 1;
+
+       of_update_property(node, prop);
+}
+
+void __init omapdss_early_init_of(void)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(dss_compat_conv_list); ++i) {
+               const char *compat = dss_compat_conv_list[i];
+               struct device_node *node = NULL;
+
+               while ((node = of_find_compatible_node(node, NULL,
compat))) {
+                       if (!of_device_is_available(node))
+                               continue;
+
+                       omapdss_omapify_node(node, compat);
+               }
+       }
+}

The list has just part of the devices, and I've so far only tested on
OMAP 4430sdp board, but it seemed to work fine.

So with this, I can have "hdmi-connector" in the .dts file, and
"omapdss,hdmi-connector" as a compat string in the omap specific driver.

Does it make your eyes bleed, or is it maybe something that could be
fine for the time being?

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

  parent reply	other threads:[~2013-12-18 14:02 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 14:56 [PATCHv2 00/27] OMAPDSS: DT support v2 Tomi Valkeinen
2013-12-16 14:56 ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 01/27] ARM: OMAP: remove DSS DT hack Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 18:41   ` Tony Lindgren
2013-12-16 18:41     ` Tony Lindgren
2013-12-17  6:45     ` Tomi Valkeinen
2013-12-17  6:45       ` Tomi Valkeinen
2013-12-17 15:30       ` Tony Lindgren
2013-12-17 15:30         ` Tony Lindgren
2013-12-18  7:12         ` Tomi Valkeinen
2013-12-18  7:12           ` Tomi Valkeinen
2013-12-18 10:21           ` Tomi Valkeinen
2013-12-18 10:21             ` Tomi Valkeinen
2013-12-18 17:33             ` Tony Lindgren
2013-12-18 17:33               ` Tony Lindgren
2013-12-18 17:32           ` Tony Lindgren
2013-12-18 17:32             ` Tony Lindgren
2013-12-16 14:56 ` [PATCHv2 02/27] OMAPDSS: remove DT hacks for regulators Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 18:42   ` Tony Lindgren
2013-12-16 18:42     ` Tony Lindgren
2013-12-17  6:42     ` Tomi Valkeinen
2013-12-17  6:42       ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 03/27] ARM: OMAP2+: add omapdss_init_of() Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 18:46   ` Tony Lindgren
2013-12-16 18:46     ` Tony Lindgren
2013-12-17  6:20     ` Tomi Valkeinen
2013-12-17  6:20       ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 04/27] OMAPDSS: add 'label' support for DT Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 05/27] OMAPDSS: get dssdev->alias from DT alias Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 06/27] OMAPFB: clean up default display search Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
     [not found] ` <1387205794-32246-1-git-send-email-tomi.valkeinen-l0cyMroinI0@public.gmane.org>
2013-12-16 14:56   ` [PATCHv2 07/27] OMAPFB: search for default display with DT alias Tomi Valkeinen
2013-12-16 14:56     ` Tomi Valkeinen
2013-12-16 14:56   ` [PATCHv2 17/27] ARM: omap3-tobi.dts: add lcd (TEST) Tomi Valkeinen
2013-12-16 14:56     ` Tomi Valkeinen
2013-12-17 17:17     ` Florian Vaussard
2013-12-17 17:17       ` Florian Vaussard
2013-12-16 14:56 ` [PATCHv2 08/27] OMAPDSS: add of helpers Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-17  7:00   ` Archit Taneja
2013-12-17  7:12     ` Archit Taneja
2013-12-17  7:01     ` Tomi Valkeinen
2013-12-17  7:01       ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 09/27] OMAPDSS: Add DT support to DSS, DISPC, DPI and SDI Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 10/27] OMAPDSS: Add DT support to HDMI Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 11/27] OMAPDSS: Add DT support to VENC Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 12/27] OMAPDSS: Add DT support to DSI Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 13/27] ARM: omap3.dtsi: add omapdss information Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 14/27] ARM: omap4.dtsi: " Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 15/27] ARM: omap4-panda.dts: add display information Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 16/27] ARM: omap4-sdp.dts: " Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 18/27] ARM: omap3-beagle.dts: " Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 19/27] ARM: omap3-beagle-xm.dts: " Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 20/27] ARM: omap3-igep0020.dts: " Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 21/27] OMAPDSS: panel-dsi-cm: Add DT support Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 22/27] OMAPDSS: encoder-tfp410: " Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 23/27] OMAPDSS: connector-dvi: " Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-17  7:05   ` Sascha Hauer
2013-12-17  7:05     ` Sascha Hauer
2013-12-17  7:15     ` Tomi Valkeinen
2013-12-17  7:15       ` Tomi Valkeinen
2013-12-17 15:15       ` Laurent Pinchart
2013-12-17 15:15         ` Laurent Pinchart
2013-12-18 10:41         ` Tomi Valkeinen
2013-12-18 10:41           ` Tomi Valkeinen
     [not found]           ` <52B17BBF.8090003-l0cyMroinI0@public.gmane.org>
2013-12-18 14:02             ` Tomi Valkeinen [this message]
2013-12-18 14:02               ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 24/27] OMAPDSS: encoder-tpd12s015: " Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 25/27] OMAPDSS: hdmi-connector: " Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 26/27] OMAPDSS: panel-dpi: " Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
2013-12-16 14:56 ` [PATCHv2 27/27] OMAPDSS: connector-analog-tv: " Tomi Valkeinen
2013-12-16 14:56   ` Tomi Valkeinen
     [not found]   ` <1387205794-32246-28-git-send-email-tomi.valkeinen-l0cyMroinI0@public.gmane.org>
2014-08-26 16:58     ` Laurent Pinchart
2014-08-26 16:58       ` Laurent Pinchart
2014-08-27  9:37       ` Tomi Valkeinen
2014-08-27  9:37         ` 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=52B1AAF4.3020509@ti.com \
    --to=tomi.valkeinen@ti.com \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
    --cc=linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.