Re: [PATCHv2 23/27] OMAPDSS: connector-dvi: Add DT support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux