How to add LVDS setting to imx8mplus

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add LVDS setting to imx8mplus

2,505 Views
t2865k5
Contributor I

Dear TI ,

HW: srg-imx8mplus (Base on : imx8mplus)

kernel version: 5.10.72

I can't measure the LVDS0_CLK_N signal , but I can  measure the VDD_LVDS 3.3V .

Please refer to the imx8mp_LVDS.log. Please help fix this issue .

 

lvds0_panel {
compatible = "auo,g101evn010";
enable-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
enable-active-high;
backlight = <&lvds_backlight>;

port {
panel_lvds_in: endpoint {
remote-endpoint = <&lvds_out>;
};
};
};

&ldb {
status = "okay";

lvds-channel@0 {
fsl,data-mapping = "spwg";
fsl,data-width = <18>;
status = "okay";

port@1 {
reg = <1>;

lvds_out: endpoint {
remote-endpoint = <&panel_lvds_in>;
};
};
};
};

LCM data sheet :

t2865k5_0-1683612800463.pngt2865k5_1-1683612821570.png

srg-imx8mplus HW : LVDS 

t2865k5_2-1683613152822.png

 

 

 

0 Kudos
Reply
3 Replies

2,491 Views
t2865k5
Contributor I

Dear NXP ,

I can measure the LVDS0_CLK_N signal . It is 74.25MHz but it not 68.93MHz.

0 Kudos
Reply

2,477 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @t2865k5 

You need add new pll=965020000 in imx_pll1443x_tbl

/drivers/clk/imx/clk-pll14xx.c

static const struct imx_pll14xx_rate_table imx_pll1443x_tbl[] = {
PLL_1443X_RATE(1039500000U, 173, 2, 1, 16384),
PLL_1443X_RATE(650000000U, 325, 3, 2, 0),
PLL_1443X_RATE(594000000U, 198, 2, 2, 0),
PLL_1443X_RATE(519750000U, 173, 2, 2, 16384),
PLL_1443X_RATE(393216000U, 262, 2, 3, 9437),
PLL_1443X_RATE(361267200U, 361, 3, 3, 17511),
};

The pmks should calculated from below formula

Qmiller_0-1683686562606.png

 

0 Kudos
Reply

2,146 Views
mengfei
Contributor III

你好我按照你们的文档修改了以下内容,可见我添加了三个pll属性,其中56Mhz的参数是你们给的,65Mhz及32Mhz的参数是我自己计算的,但是下面修改的项只有你们给的56Mhz,和我自己修改的32Mhz的成功了,我自己改的另外一个65Mhz的却失败了,我又检查了下设置两种属性的参数都是满足你们的文档要求的,不知道为什么设定为65Mhz的代码,在编译并重新写入内核后示波器测量的clk仍是74.25Mhz.请帮忙看下:

diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c
old mode 100644
new mode 100755
index a92cf7727..75f86d38c
--- a/drivers/clk/imx/clk-imx8mp.c
+++ b/drivers/clk/imx/clk-imx8mp.c
@@ -59,6 +59,9 @@ static const struct imx_pll14xx_rate_table imx8mp_videopll_tbl[] = {
PLL_1443X_RATE(650000000U, 325, 3, 2, 0),
PLL_1443X_RATE(594000000U, 198, 2, 2, 0),
PLL_1443X_RATE(519750000U, 173, 2, 2, 16384),
+ PLL_1443X_RATE(456000000U, 76, 1, 2, 0),
+ PLL_1443X_RATE(393216000U, 262, 2, 3, 9437), //-> for 56M
+ PLL_1443X_RATE(228000000U, 76, 1, 3, 0),
};

static const struct imx_pll14xx_rate_table imx8mp_drampll_tbl[] = {
diff --git a/drivers/gpu/drm/imx/imx8mp-ldb.c b/drivers/gpu/drm/imx/imx8mp-ldb.c
old mode 100644
new mode 100755
index c26f8dc83..41baeea0b
--- a/drivers/gpu/drm/imx/imx8mp-ldb.c
+++ b/drivers/gpu/drm/imx/imx8mp-ldb.c
@@ -123,8 +123,29 @@ imx8mp_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder,
dev_warn(ldb->dev,
"%s: mode exceeds 80 MHz pixel clock\n", __func__);
}
-
- serial_clk = mode->clock * (ldb->dual ? 3500UL : 7000UL);
+ /*
+ 最终产生的serial_clk的计算公式如下:
+ 如果是双通道则*3500 如果是单通道*7000
+ 本次我们使用的是单通道,因此为65000 * 7000 = 455 000 000
+ 但是要注意,关键点来了,上面计算出的结果455000000是video_pll1能够产生的FOUT信号
+ 查看clk-imx8mp.c可见:
+ PLL_1443X_RATE(1039500000U, 173, 2, 1, 16384),
+ PLL_1443X_RATE(650000000U, 325, 3, 2, 0),
+ PLL_1443X_RATE(594000000U, 198, 2, 2, 0),
+ PLL_1443X_RATE(519750000U, 173, 2, 2, 16384),
+ 其仅支持上述四种,因此我们在上述文件中添加本次使用的clk频点设置项:
+ PLL_1443X_RATE(456000000U, 76, 1, 2, 0),     //-> for 65Mhz   失败
+ PLL_1443X_RATE(393216000U, 262, 2, 3, 9437), //-> for 56M  成功
+ PLL_1443X_RATE(228000000U, 76, 1, 3, 0),     //-> for 32M   成功
+ PLL_1443X_RATE( FOUT, _m,_p, _s, _k)
+ 计算公式为:FOUT=((m + k/65536) × FIN) / (p × 2^s)
+ 之所以最终设定的值与上述计算结果不同是因为计算公式找不到恰当的组合
+ */
+ //serial_clk = mode->clock * (ldb->dual ? 3500UL : 7000UL);
+ //serial_clk = 228000000U; //写死为固定值 -> for 32.5Mhz
+ //serial_clk = 393216000U; //写死为固定值 -> for 56.17Mhz
+ serial_clk = 456000000U; //写死为固定值 -> for 65.1Mhz
+ printk("mftest serial_clk = %d\n",serial_clk);
clk_set_rate(imx8mp_ldb->clk_root, serial_clk);

if (!ldb_ch->bus_format) {
@@ -200,8 +221,11 @@ imx8mp_ldb_encoder_atomic_check(struct drm_encoder *encoder,
if (ldb->dual)
mode->clock = mode->clock > 100000 ? 148500 : 74250;
else
- mode->clock = 74250;
-
+ {
+ //mode->clock = 32571; //这里模拟产生32.5m时钟
+ //mode->clock = 56173;
+ mode->clock = 65142; //S50 8寸屏幕使用的是65Mhz时钟,但是计算公式限制不能完美实现,Pll生成一个接近的时钟吧
+ }
return 0;
}

@@ -226,8 +250,14 @@ imx8mp_ldb_encoder_mode_valid(struct drm_encoder *encoder,
if (ldb->dual && mode->clock != 74250 && mode->clock != 148500)
return MODE_NOCLOCK;

- if (!ldb->dual && mode->clock != 74250)
- return MODE_NOCLOCK;
+ /*
+ 原下列代码的作用是
+ 如果设备树中没有设置双通道则检查是不是设置为了74250
+ 防止设备树中随意的设定的clk无法产生,但本次我们自行设定新的clk
+ 一定是计算过的可用的clk,因此屏蔽原先NXP编写的代码
+ */
+ //if (!ldb->dual && mode->clock != 74250)
+ // return MODE_NOCLOCK;

return MODE_OK;
}
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
old mode 100644
new mode 100755
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
old mode 100644

0 Kudos
Reply