Dear all,
i have a imx6q board similar to sabreauto.
Generally i use a display type1 on LVDS0 and a display type2 on LVDS1.
But sometime i need to swap them.
In previous kernel version as 3.10.17, this was possible simply changing the kernel mxcfb resolutions in kernel cmdline params.
In kernel 3.14, a new devictree node has been added, and display timing and resolution need to be specified there.
But, when i switch the 2 displays i have now to change the device tree.
Is there any way to avoid this kernel / dts re-build ?
Thanks,
angelo
Solved! Go to Solution.
Hi,
welcome
Patch body:
add support for lvds timings set from command line
Signed-off-by: Angelo Dureghello <angelo.dureghello@nomovok.com>
--------------------------- drivers/video/mxc/ldb.c ---------------------------
index d3e8494..ae49cf4 100644
@@ -391,7 +391,6 @@ static int ldb_setup(struct mxc_dispdrv_handle *mddh,
struct ldb_chan chan;
struct device *dev = ldb->dev;
struct clk *ldb_di_parent, *ldb_di_sel, *ldb_di_sel_parent;
- struct clk *other_ldb_di_sel = NULL;
struct bus_mux bus_mux;
int ret = 0, id = 0, chno, other_chno;
unsigned long serial_clk;
@@ -680,6 +679,35 @@ static bool is_valid_crtc(struct ldb_data *ldb, enum crtc crtc,
return false;
}
+extern char *saved_command_line;
+
+#define ERR_NO_LVDS_TIMING -1
+
+/*
+ * Nomovok OY
+ * we want the ability to select display timing from command line.
+ *
+ * use params:
+ * lvds0_timing=index
+ * lvds1_timing=index
+ *
+ * where index 0 is the first timing entry
+ *
+ */
+static int get_ldb_timing(int ch)
+{
+ char *x, *s = saved_command_line;
+ static char buff[16];
+
+ sprintf(buff, "lvds%d_timing=", ch);
+
+ if ((x = strstr(s, buff)) != NULL) {
+ return (x[13]-48);
+ }
+
+ return ERR_NO_LVDS_TIMING;
+}
+
static int ldb_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -753,7 +781,7 @@ static int ldb_probe(struct platform_device *pdev)
struct ldb_chan *chan;
enum crtc crtc;
bool is_primary;
- int ret;
+ int ret, timing_idx;
ret = of_property_read_u32(child, "reg", &i);
if (ret || i < 0 || i > 1 || i >= ldb->bus_mux_num) {
@@ -828,7 +856,10 @@ static int ldb_probe(struct platform_device *pdev)
return -EINVAL;
}
- ret = of_get_videomode(child, &chan->vm, OF_USE_NATIVE_MODE);
+ timing_idx = get_ldb_timing(chan->chno);
+ ret = of_get_videomode(child, &chan->vm,
+ (timing_idx != ERR_NO_LVDS_TIMING) ?
+ timing_idx : OF_USE_NATIVE_MODE);
if (ret)
return -EINVAL;
From what i realize from the sources, no.
I added a small patch to parse commandline for a parameter inside drivers/video/mxc/ldb.c.
I get an index to pass to of_get_videomode call.
Best regards
angelo
Hi Angelo,
Would you be nice enough to share the patch you created? It would be very appreciated and helpful for future references.
Best Regards,
Alejandro
Hi,
welcome
Patch body:
add support for lvds timings set from command line
Signed-off-by: Angelo Dureghello <angelo.dureghello@nomovok.com>
--------------------------- drivers/video/mxc/ldb.c ---------------------------
index d3e8494..ae49cf4 100644
@@ -391,7 +391,6 @@ static int ldb_setup(struct mxc_dispdrv_handle *mddh,
struct ldb_chan chan;
struct device *dev = ldb->dev;
struct clk *ldb_di_parent, *ldb_di_sel, *ldb_di_sel_parent;
- struct clk *other_ldb_di_sel = NULL;
struct bus_mux bus_mux;
int ret = 0, id = 0, chno, other_chno;
unsigned long serial_clk;
@@ -680,6 +679,35 @@ static bool is_valid_crtc(struct ldb_data *ldb, enum crtc crtc,
return false;
}
+extern char *saved_command_line;
+
+#define ERR_NO_LVDS_TIMING -1
+
+/*
+ * Nomovok OY
+ * we want the ability to select display timing from command line.
+ *
+ * use params:
+ * lvds0_timing=index
+ * lvds1_timing=index
+ *
+ * where index 0 is the first timing entry
+ *
+ */
+static int get_ldb_timing(int ch)
+{
+ char *x, *s = saved_command_line;
+ static char buff[16];
+
+ sprintf(buff, "lvds%d_timing=", ch);
+
+ if ((x = strstr(s, buff)) != NULL) {
+ return (x[13]-48);
+ }
+
+ return ERR_NO_LVDS_TIMING;
+}
+
static int ldb_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -753,7 +781,7 @@ static int ldb_probe(struct platform_device *pdev)
struct ldb_chan *chan;
enum crtc crtc;
bool is_primary;
- int ret;
+ int ret, timing_idx;
ret = of_property_read_u32(child, "reg", &i);
if (ret || i < 0 || i > 1 || i >= ldb->bus_mux_num) {
@@ -828,7 +856,10 @@ static int ldb_probe(struct platform_device *pdev)
return -EINVAL;
}
- ret = of_get_videomode(child, &chan->vm, OF_USE_NATIVE_MODE);
+ timing_idx = get_ldb_timing(chan->chno);
+ ret = of_get_videomode(child, &chan->vm,
+ (timing_idx != ERR_NO_LVDS_TIMING) ?
+ timing_idx : OF_USE_NATIVE_MODE);
if (ret)
return -EINVAL;
Thanks a lot Angelo!!