2019-06-03 08:44:50 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
omapfb: copy omapdss & displays for omapfb
This patch makes a copy of the omapdss driver and the omap panel &
encoder drivers for omapfb. The purpose is to separate omapdrm and
omapfb drivers from each other.
Note that this patch only does a direct copy of the files without any
other modifications. The files are not yet used.
The original files are in:
drivers/video/fbdev/omap2/dss/
drivers/video/fbdev/omap2/displays-new/
Here's a more detailed explanation about this and the following patches,
from the introduction mail of the patch series:
A short background on the current status. We have the following
entities:
* omapdss, located in drivers/video/fbdev/omap2/dss/. This is a driver for the
display subsystem IPs used on OMAP (and related) SoCs. It offers only a
kernel internal API, and does not implement anything for fbdev or drm.
* omapdss panels and encoders, located in
drivers/video/fbdev/omap2/displays-new/. These are panel and external encoder
drivers, which use APIs offered by omapdss driver. These also don't implement
anything for fbdev or drm.
* omapdrm, located in drivers/gpu/drm/omapdrm/. This is a drm driver, which
uses omapdss and the panel/encoder drivers to operate the hardware.
* omapfb, located in drivers/video/fbdev/omap2/omapfb/. This is an fbdev
driver, which uses omapdss and the panel/encoder drivers to operate the
hardware.
* omap_vout, located in drivers/media/platform/omap/. This is a v4l2 driver,
which uses omapdss and omapfb to implement a v4l2 API for the video overlays.
So, on the top level, we have either omapdrm, or omapfb+omap_vout. Both of
those use the same low level drivers. Without going to the historical details
why the architecture is like that, I think it's finally time to change that.
The situation with omapfb+omap_vout is that it still works, but no new features
have been added for a long time, and I want to keep it working as it's still
being used. At some point in the future I'd like to remove omapfb and
omap_vout altogether.
Omapdrm, on the other hand, is being actively developed. Sharing the low level
parts with omapfb makes that development more difficult than it should be. It
also "hides" half of the development, as everything happening in the low level
parts resides under fbdev directory, not in the drm directory.
I've been wanting to clean this up for a long time, but I haven't figured out a
very good way to do it. I still haven't, but here's the best way I have come up
with.
This series makes a full copy of the low level parts, omapdss and panel/encoder
drivers. Both omapfb+omap_vout and omapdrm will have their own versions. The
copy omapfb+omap_vout get is a new copy, and the copy that omapdrm gets is just
the current files moved. This way git will associate the omapdrm version with
the old files.
The omapfb+omap_vout versions won't be touched unless there are some big issues
there.
The omapdrm versions can be refactored and cleaned up, as the omapfb support
code is no longer needed. We can perhaps also merge omapdss and omapdrm into
the same kernel module.
This series only does the copy, and the absolutely necessary parts. No further
cleanups are done yet.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
2015-12-09 19:28:28 +03:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Texas Instruments
|
|
|
|
* Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* As omapdss panel drivers are omapdss specific, but we want to define the
|
|
|
|
* DT-data in generic manner, we convert the compatible strings of the panel and
|
|
|
|
* encoder nodes from "panel-foo" to "omapdss,panel-foo". This way we can have
|
|
|
|
* both correct DT data and omapdss specific drivers.
|
|
|
|
*
|
|
|
|
* When we get generic panel drivers to the kernel, this file will be removed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/of.h>
|
|
|
|
#include <linux/of_graph.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
|
|
|
|
static struct list_head dss_conv_list __initdata;
|
|
|
|
|
|
|
|
static const char prefix[] __initconst = "omapdss,";
|
|
|
|
|
|
|
|
struct dss_conv_node {
|
|
|
|
struct list_head list;
|
|
|
|
struct device_node *node;
|
|
|
|
bool root;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init omapdss_count_strings(const struct property *prop)
|
|
|
|
{
|
|
|
|
const char *p = prop->value;
|
|
|
|
int l = 0, total = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; total < prop->length; total += l, p += l, i++)
|
|
|
|
l = strlen(p) + 1;
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init omapdss_update_prop(struct device_node *node, char *compat,
|
|
|
|
int len)
|
|
|
|
{
|
|
|
|
struct property *prop;
|
|
|
|
|
|
|
|
prop = kzalloc(sizeof(*prop), GFP_KERNEL);
|
|
|
|
if (!prop)
|
|
|
|
return;
|
|
|
|
|
|
|
|
prop->name = "compatible";
|
|
|
|
prop->value = compat;
|
|
|
|
prop->length = len;
|
|
|
|
|
|
|
|
of_update_property(node, prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init omapdss_prefix_strcpy(char *dst, int dst_len,
|
|
|
|
const char *src, int src_len)
|
|
|
|
{
|
|
|
|
size_t total = 0;
|
|
|
|
|
|
|
|
while (total < src_len) {
|
|
|
|
size_t l = strlen(src) + 1;
|
|
|
|
|
|
|
|
strcpy(dst, prefix);
|
|
|
|
dst += strlen(prefix);
|
|
|
|
|
|
|
|
strcpy(dst, src);
|
|
|
|
dst += l;
|
|
|
|
|
|
|
|
src += l;
|
|
|
|
total += l;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* prepend compatible property strings with "omapdss," */
|
|
|
|
static void __init omapdss_omapify_node(struct device_node *node)
|
|
|
|
{
|
|
|
|
struct property *prop;
|
|
|
|
char *new_compat;
|
|
|
|
int num_strs;
|
|
|
|
int new_len;
|
|
|
|
|
|
|
|
prop = of_find_property(node, "compatible", NULL);
|
|
|
|
|
|
|
|
if (!prop || !prop->value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (strnlen(prop->value, prop->length) >= prop->length)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* is it already prefixed? */
|
|
|
|
if (strncmp(prefix, prop->value, strlen(prefix)) == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
num_strs = omapdss_count_strings(prop);
|
|
|
|
|
|
|
|
new_len = prop->length + strlen(prefix) * num_strs;
|
|
|
|
new_compat = kmalloc(new_len, GFP_KERNEL);
|
2019-04-01 18:46:57 +03:00
|
|
|
if (!new_compat)
|
|
|
|
return;
|
omapfb: copy omapdss & displays for omapfb
This patch makes a copy of the omapdss driver and the omap panel &
encoder drivers for omapfb. The purpose is to separate omapdrm and
omapfb drivers from each other.
Note that this patch only does a direct copy of the files without any
other modifications. The files are not yet used.
The original files are in:
drivers/video/fbdev/omap2/dss/
drivers/video/fbdev/omap2/displays-new/
Here's a more detailed explanation about this and the following patches,
from the introduction mail of the patch series:
A short background on the current status. We have the following
entities:
* omapdss, located in drivers/video/fbdev/omap2/dss/. This is a driver for the
display subsystem IPs used on OMAP (and related) SoCs. It offers only a
kernel internal API, and does not implement anything for fbdev or drm.
* omapdss panels and encoders, located in
drivers/video/fbdev/omap2/displays-new/. These are panel and external encoder
drivers, which use APIs offered by omapdss driver. These also don't implement
anything for fbdev or drm.
* omapdrm, located in drivers/gpu/drm/omapdrm/. This is a drm driver, which
uses omapdss and the panel/encoder drivers to operate the hardware.
* omapfb, located in drivers/video/fbdev/omap2/omapfb/. This is an fbdev
driver, which uses omapdss and the panel/encoder drivers to operate the
hardware.
* omap_vout, located in drivers/media/platform/omap/. This is a v4l2 driver,
which uses omapdss and omapfb to implement a v4l2 API for the video overlays.
So, on the top level, we have either omapdrm, or omapfb+omap_vout. Both of
those use the same low level drivers. Without going to the historical details
why the architecture is like that, I think it's finally time to change that.
The situation with omapfb+omap_vout is that it still works, but no new features
have been added for a long time, and I want to keep it working as it's still
being used. At some point in the future I'd like to remove omapfb and
omap_vout altogether.
Omapdrm, on the other hand, is being actively developed. Sharing the low level
parts with omapfb makes that development more difficult than it should be. It
also "hides" half of the development, as everything happening in the low level
parts resides under fbdev directory, not in the drm directory.
I've been wanting to clean this up for a long time, but I haven't figured out a
very good way to do it. I still haven't, but here's the best way I have come up
with.
This series makes a full copy of the low level parts, omapdss and panel/encoder
drivers. Both omapfb+omap_vout and omapdrm will have their own versions. The
copy omapfb+omap_vout get is a new copy, and the copy that omapdrm gets is just
the current files moved. This way git will associate the omapdrm version with
the old files.
The omapfb+omap_vout versions won't be touched unless there are some big issues
there.
The omapdrm versions can be refactored and cleaned up, as the omapfb support
code is no longer needed. We can perhaps also merge omapdss and omapdrm into
the same kernel module.
This series only does the copy, and the absolutely necessary parts. No further
cleanups are done yet.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
2015-12-09 19:28:28 +03:00
|
|
|
|
|
|
|
omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length);
|
|
|
|
|
|
|
|
omapdss_update_prop(node, new_compat, new_len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init omapdss_add_to_list(struct device_node *node, bool root)
|
|
|
|
{
|
|
|
|
struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node),
|
|
|
|
GFP_KERNEL);
|
|
|
|
if (n) {
|
|
|
|
n->node = node;
|
|
|
|
n->root = root;
|
|
|
|
list_add(&n->list, &dss_conv_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool __init omapdss_list_contains(const struct device_node *node)
|
|
|
|
{
|
|
|
|
struct dss_conv_node *n;
|
|
|
|
|
|
|
|
list_for_each_entry(n, &dss_conv_list, list) {
|
|
|
|
if (n->node == node)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init omapdss_walk_device(struct device_node *node, bool root)
|
|
|
|
{
|
|
|
|
struct device_node *n;
|
|
|
|
|
|
|
|
omapdss_add_to_list(node, root);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* of_graph_get_remote_port_parent() prints an error if there is no
|
|
|
|
* port/ports node. To avoid that, check first that there's the node.
|
|
|
|
*/
|
|
|
|
n = of_get_child_by_name(node, "ports");
|
|
|
|
if (!n)
|
|
|
|
n = of_get_child_by_name(node, "port");
|
|
|
|
if (!n)
|
|
|
|
return;
|
|
|
|
|
|
|
|
of_node_put(n);
|
|
|
|
|
|
|
|
n = NULL;
|
|
|
|
while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
|
|
|
|
struct device_node *pn;
|
|
|
|
|
|
|
|
pn = of_graph_get_remote_port_parent(n);
|
|
|
|
|
|
|
|
if (!pn)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!of_device_is_available(pn) || omapdss_list_contains(pn)) {
|
|
|
|
of_node_put(pn);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
omapdss_walk_device(pn, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct of_device_id omapdss_of_match[] __initconst = {
|
|
|
|
{ .compatible = "ti,omap2-dss", },
|
|
|
|
{ .compatible = "ti,omap3-dss", },
|
|
|
|
{ .compatible = "ti,omap4-dss", },
|
|
|
|
{ .compatible = "ti,omap5-dss", },
|
|
|
|
{ .compatible = "ti,dra7-dss", },
|
|
|
|
{},
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init omapdss_boot_init(void)
|
|
|
|
{
|
|
|
|
struct device_node *dss, *child;
|
|
|
|
|
|
|
|
INIT_LIST_HEAD(&dss_conv_list);
|
|
|
|
|
|
|
|
dss = of_find_matching_node(NULL, omapdss_of_match);
|
|
|
|
|
2019-04-01 18:46:56 +03:00
|
|
|
if (dss == NULL || !of_device_is_available(dss)) {
|
|
|
|
of_node_put(dss);
|
omapfb: copy omapdss & displays for omapfb
This patch makes a copy of the omapdss driver and the omap panel &
encoder drivers for omapfb. The purpose is to separate omapdrm and
omapfb drivers from each other.
Note that this patch only does a direct copy of the files without any
other modifications. The files are not yet used.
The original files are in:
drivers/video/fbdev/omap2/dss/
drivers/video/fbdev/omap2/displays-new/
Here's a more detailed explanation about this and the following patches,
from the introduction mail of the patch series:
A short background on the current status. We have the following
entities:
* omapdss, located in drivers/video/fbdev/omap2/dss/. This is a driver for the
display subsystem IPs used on OMAP (and related) SoCs. It offers only a
kernel internal API, and does not implement anything for fbdev or drm.
* omapdss panels and encoders, located in
drivers/video/fbdev/omap2/displays-new/. These are panel and external encoder
drivers, which use APIs offered by omapdss driver. These also don't implement
anything for fbdev or drm.
* omapdrm, located in drivers/gpu/drm/omapdrm/. This is a drm driver, which
uses omapdss and the panel/encoder drivers to operate the hardware.
* omapfb, located in drivers/video/fbdev/omap2/omapfb/. This is an fbdev
driver, which uses omapdss and the panel/encoder drivers to operate the
hardware.
* omap_vout, located in drivers/media/platform/omap/. This is a v4l2 driver,
which uses omapdss and omapfb to implement a v4l2 API for the video overlays.
So, on the top level, we have either omapdrm, or omapfb+omap_vout. Both of
those use the same low level drivers. Without going to the historical details
why the architecture is like that, I think it's finally time to change that.
The situation with omapfb+omap_vout is that it still works, but no new features
have been added for a long time, and I want to keep it working as it's still
being used. At some point in the future I'd like to remove omapfb and
omap_vout altogether.
Omapdrm, on the other hand, is being actively developed. Sharing the low level
parts with omapfb makes that development more difficult than it should be. It
also "hides" half of the development, as everything happening in the low level
parts resides under fbdev directory, not in the drm directory.
I've been wanting to clean this up for a long time, but I haven't figured out a
very good way to do it. I still haven't, but here's the best way I have come up
with.
This series makes a full copy of the low level parts, omapdss and panel/encoder
drivers. Both omapfb+omap_vout and omapdrm will have their own versions. The
copy omapfb+omap_vout get is a new copy, and the copy that omapdrm gets is just
the current files moved. This way git will associate the omapdrm version with
the old files.
The omapfb+omap_vout versions won't be touched unless there are some big issues
there.
The omapdrm versions can be refactored and cleaned up, as the omapfb support
code is no longer needed. We can perhaps also merge omapdss and omapdrm into
the same kernel module.
This series only does the copy, and the absolutely necessary parts. No further
cleanups are done yet.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
2015-12-09 19:28:28 +03:00
|
|
|
return 0;
|
2019-04-01 18:46:56 +03:00
|
|
|
}
|
omapfb: copy omapdss & displays for omapfb
This patch makes a copy of the omapdss driver and the omap panel &
encoder drivers for omapfb. The purpose is to separate omapdrm and
omapfb drivers from each other.
Note that this patch only does a direct copy of the files without any
other modifications. The files are not yet used.
The original files are in:
drivers/video/fbdev/omap2/dss/
drivers/video/fbdev/omap2/displays-new/
Here's a more detailed explanation about this and the following patches,
from the introduction mail of the patch series:
A short background on the current status. We have the following
entities:
* omapdss, located in drivers/video/fbdev/omap2/dss/. This is a driver for the
display subsystem IPs used on OMAP (and related) SoCs. It offers only a
kernel internal API, and does not implement anything for fbdev or drm.
* omapdss panels and encoders, located in
drivers/video/fbdev/omap2/displays-new/. These are panel and external encoder
drivers, which use APIs offered by omapdss driver. These also don't implement
anything for fbdev or drm.
* omapdrm, located in drivers/gpu/drm/omapdrm/. This is a drm driver, which
uses omapdss and the panel/encoder drivers to operate the hardware.
* omapfb, located in drivers/video/fbdev/omap2/omapfb/. This is an fbdev
driver, which uses omapdss and the panel/encoder drivers to operate the
hardware.
* omap_vout, located in drivers/media/platform/omap/. This is a v4l2 driver,
which uses omapdss and omapfb to implement a v4l2 API for the video overlays.
So, on the top level, we have either omapdrm, or omapfb+omap_vout. Both of
those use the same low level drivers. Without going to the historical details
why the architecture is like that, I think it's finally time to change that.
The situation with omapfb+omap_vout is that it still works, but no new features
have been added for a long time, and I want to keep it working as it's still
being used. At some point in the future I'd like to remove omapfb and
omap_vout altogether.
Omapdrm, on the other hand, is being actively developed. Sharing the low level
parts with omapfb makes that development more difficult than it should be. It
also "hides" half of the development, as everything happening in the low level
parts resides under fbdev directory, not in the drm directory.
I've been wanting to clean this up for a long time, but I haven't figured out a
very good way to do it. I still haven't, but here's the best way I have come up
with.
This series makes a full copy of the low level parts, omapdss and panel/encoder
drivers. Both omapfb+omap_vout and omapdrm will have their own versions. The
copy omapfb+omap_vout get is a new copy, and the copy that omapdrm gets is just
the current files moved. This way git will associate the omapdrm version with
the old files.
The omapfb+omap_vout versions won't be touched unless there are some big issues
there.
The omapdrm versions can be refactored and cleaned up, as the omapfb support
code is no longer needed. We can perhaps also merge omapdss and omapdrm into
the same kernel module.
This series only does the copy, and the absolutely necessary parts. No further
cleanups are done yet.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
2015-12-09 19:28:28 +03:00
|
|
|
|
|
|
|
omapdss_walk_device(dss, true);
|
|
|
|
|
|
|
|
for_each_available_child_of_node(dss, child) {
|
|
|
|
if (!of_find_property(child, "compatible", NULL))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
omapdss_walk_device(child, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
while (!list_empty(&dss_conv_list)) {
|
|
|
|
struct dss_conv_node *n;
|
|
|
|
|
|
|
|
n = list_first_entry(&dss_conv_list, struct dss_conv_node,
|
|
|
|
list);
|
|
|
|
|
|
|
|
if (!n->root)
|
|
|
|
omapdss_omapify_node(n->node);
|
|
|
|
|
|
|
|
list_del(&n->list);
|
|
|
|
of_node_put(n->node);
|
|
|
|
kfree(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
subsys_initcall(omapdss_boot_init);
|