cvbs: add cvbs support for sm1 [1/1]

PD#SWPL-6112

Problem:
need add cvbsout support for sm1

Solution:
add cvbsout support for sm1

Verify:
sm1

Change-Id: I037fbdb41b823d9ef93a9069f3798f8d38ac5796
Signed-off-by: Nian Jing <nian.jing@amlogic.com>
This commit is contained in:
Nian Jing
2019-03-20 11:26:28 +08:00
committed by Jianxiong Pan
parent 596a196d05
commit ca660985da
13 changed files with 48 additions and 28 deletions

View File

@@ -1180,7 +1180,7 @@
};
vdac {
compatible = "amlogic, vdac-g12a";
compatible = "amlogic, vdac-sm1";
status = "okay";
};

View File

@@ -131,7 +131,7 @@
};
cvbsout {
compatible = "amlogic, cvbsout-g12a";
compatible = "amlogic, cvbsout-sm1";
dev_name = "cvbsout";
status = "okay";
clocks = <&clkc CLKID_VCLK2_ENCI
@@ -145,7 +145,7 @@
clk_path = <0>;
/* performance: reg_address, reg_value */
/* g12a */
/* sm1 */
performance = <0x1bf0 0x9
0x1b56 0x333
0x1b12 0x8080

View File

@@ -171,7 +171,7 @@
};
cvbsout {
compatible = "amlogic, cvbsout-g12a";
compatible = "amlogic, cvbsout-sm1";
dev_name = "cvbsout";
status = "okay";
clocks = <&clkc CLKID_VCLK2_ENCI
@@ -190,7 +190,7 @@
clk_path = <0>;
/* performance: reg_address, reg_value */
/* g12a */
/* sm1 */
performance = <0x1bf0 0x9
0x1b56 0x333
0x1b12 0x8080

View File

@@ -171,7 +171,7 @@
};
cvbsout {
compatible = "amlogic, cvbsout-g12a";
compatible = "amlogic, cvbsout-sm1";
dev_name = "cvbsout";
status = "okay";
clocks = <&clkc CLKID_VCLK2_ENCI
@@ -190,7 +190,7 @@
clk_path = <0>;
/* performance: reg_address, reg_value */
/* g12a */
/* sm1 */
performance = <0x1bf0 0x9
0x1b56 0x333
0x1b12 0x8080

View File

@@ -1180,7 +1180,7 @@
};
vdac {
compatible = "amlogic, vdac-g12a";
compatible = "amlogic, vdac-sm1";
status = "okay";
};

View File

@@ -132,7 +132,7 @@
};
cvbsout {
compatible = "amlogic, cvbsout-g12a";
compatible = "amlogic, cvbsout-sm1";
dev_name = "cvbsout";
status = "okay";
clocks = <&clkc CLKID_VCLK2_ENCI
@@ -146,7 +146,7 @@
clk_path = <0>;
/* performance: reg_address, reg_value */
/* g12a */
/* sm1 */
performance = <0x1bf0 0x9
0x1b56 0x333
0x1b12 0x8080

View File

@@ -169,7 +169,7 @@
};
cvbsout {
compatible = "amlogic, cvbsout-g12a";
compatible = "amlogic, cvbsout-sm1";
dev_name = "cvbsout";
status = "okay";
clocks = <&clkc CLKID_VCLK2_ENCI
@@ -188,7 +188,7 @@
clk_path = <0>;
/* performance: reg_address, reg_value */
/* g12a */
/* sm1 */
performance = <0x1bf0 0x9
0x1b56 0x333
0x1b12 0x8080

View File

@@ -169,7 +169,7 @@
};
cvbsout {
compatible = "amlogic, cvbsout-g12a";
compatible = "amlogic, cvbsout-sm1";
dev_name = "cvbsout";
status = "okay";
clocks = <&clkc CLKID_VCLK2_ENCI
@@ -188,7 +188,7 @@
clk_path = <0>;
/* performance: reg_address, reg_value */
/* g12a */
/* sm1 */
performance = <0x1bf0 0x9
0x1b56 0x333
0x1b12 0x8080

View File

@@ -903,17 +903,13 @@ static void cvbs_performance_regs_dump(void)
pr_info("vcbus [0x%x] = 0x%x\n", performance_regs_enci[i],
cvbs_out_reg_read(performance_regs_enci[i]));
}
if (cvbs_cpu_type() == CVBS_CPU_TYPE_G12A ||
cvbs_cpu_type() == CVBS_CPU_TYPE_G12B ||
cvbs_cpu_type() == CVBS_CPU_TYPE_TL1)
if (cvbs_cpu_type() >= CVBS_CPU_TYPE_G12A)
size = sizeof(performance_regs_vdac_g12a)/sizeof(unsigned int);
else
size = sizeof(performance_regs_vdac)/sizeof(unsigned int);
pr_info("------------------------\n");
for (i = 0; i < size; i++) {
if (cvbs_cpu_type() == CVBS_CPU_TYPE_G12A ||
cvbs_cpu_type() == CVBS_CPU_TYPE_G12B ||
cvbs_cpu_type() == CVBS_CPU_TYPE_TL1)
if (cvbs_cpu_type() >= CVBS_CPU_TYPE_G12A)
pr_info("hiu [0x%x] = 0x%x\n",
performance_regs_vdac_g12a[i],
cvbs_out_hiu_read(performance_regs_vdac_g12a[i]));
@@ -1210,9 +1206,7 @@ static void cvbs_debug_store(char *buf)
cvbs_performance_config_dump();
break;
case CMD_VP_SET_PLLPATH:
if (cvbs_cpu_type() != CVBS_CPU_TYPE_G12A &&
cvbs_cpu_type() != CVBS_CPU_TYPE_G12B &&
cvbs_cpu_type() != CVBS_CPU_TYPE_TL1) {
if (cvbs_cpu_type() < CVBS_CPU_TYPE_G12A) {
print_info("ERR:Only after g12a/b chip supported\n");
break;
}
@@ -1458,6 +1452,12 @@ struct meson_cvbsout_data meson_tl1_cvbsout_data = {
.name = "meson-tl1-cvbsout",
};
struct meson_cvbsout_data meson_sm1_cvbsout_data = {
.cntl0_val = 0x8f6001,
.cpu_id = CVBS_CPU_TYPE_SM1,
.name = "meson-sm1-cvbsout",
};
static const struct of_device_id meson_cvbsout_dt_match[] = {
{
.compatible = "amlogic, cvbsout-gxl",
@@ -1477,6 +1477,9 @@ static const struct of_device_id meson_cvbsout_dt_match[] = {
}, {
.compatible = "amlogic, cvbsout-tl1",
.data = &meson_tl1_cvbsout_data,
}, {
.compatible = "amlogic, cvbsout-sm1",
.data = &meson_sm1_cvbsout_data,
},
{},
};

View File

@@ -52,6 +52,7 @@ enum cvbs_cpu_type {
CVBS_CPU_TYPE_G12A = 4,
CVBS_CPU_TYPE_G12B = 5,
CVBS_CPU_TYPE_TL1 = 6,
CVBS_CPU_TYPE_SM1 = 7,
};
struct meson_cvbsout_data {

View File

@@ -183,7 +183,8 @@ void set_vmode_clk(void)
cvbs_out_hiu_setb(HHI_VIID_CLK_CNTL, 0, VCLK2_EN, 1);
udelay(5);
} else if (cvbs_cpu_type() == CVBS_CPU_TYPE_G12A ||
cvbs_cpu_type() == CVBS_CPU_TYPE_G12B) {
cvbs_cpu_type() == CVBS_CPU_TYPE_G12B ||
cvbs_cpu_type() == CVBS_CPU_TYPE_SM1) {
if (cvbs_clk_path & 0x1) {
pr_info("config g12a gp0_pll\n");
cvbs_out_hiu_write(HHI_GP0_PLL_CNTL0, 0x180204f7);
@@ -250,7 +251,8 @@ void set_vmode_clk(void)
}
if (cvbs_cpu_type() == CVBS_CPU_TYPE_G12A ||
cvbs_cpu_type() == CVBS_CPU_TYPE_G12B) {
cvbs_cpu_type() == CVBS_CPU_TYPE_G12B ||
cvbs_cpu_type() == CVBS_CPU_TYPE_SM1) {
if (cvbs_clk_path & 0x2)
cvbs_set_vid1_clk(cvbs_clk_path & 0x1);
else
@@ -274,7 +276,8 @@ void set_vmode_clk(void)
void disable_vmode_clk(void)
{
if (cvbs_cpu_type() == CVBS_CPU_TYPE_G12A ||
cvbs_cpu_type() == CVBS_CPU_TYPE_G12B) {
cvbs_cpu_type() == CVBS_CPU_TYPE_G12B ||
cvbs_cpu_type() == CVBS_CPU_TYPE_SM1) {
if (cvbs_clk_path & 0x2)
disable_vid1_clk_out();
else

View File

@@ -589,6 +589,11 @@ struct meson_vdac_data meson_tl1_vdac_data = {
.name = "meson-tl1-vdac",
};
struct meson_vdac_data meson_sm1_vdac_data = {
.cpu_id = VDAC_CPU_SM1,
.name = "meson-sm1-vdac",
};
static const struct of_device_id meson_vdac_dt_match[] = {
{
.compatible = "amlogic, vdac-gxtvbb",
@@ -620,6 +625,9 @@ static const struct of_device_id meson_vdac_dt_match[] = {
}, {
.compatible = "amlogic, vdac-tl1",
.data = &meson_tl1_vdac_data,
}, {
.compatible = "amlogic, vdac-sm1",
.data = &meson_sm1_vdac_data,
},
{},
};
@@ -701,7 +709,8 @@ static int __exit aml_vdac_remove(struct platform_device *pdev)
static int amvdac_drv_suspend(struct platform_device *pdev,
pm_message_t state)
{
if (s_vdac_data->cpu_id == VDAC_CPU_TXL)
if (s_vdac_data->cpu_id == VDAC_CPU_TXL ||
s_vdac_data->cpu_id == VDAC_CPU_TXLX)
vdac_hiu_reg_write(HHI_VDAC_CNTL0, 0);
else if (s_vdac_data->cpu_id == VDAC_CPU_TL1)
vdac_hiu_reg_setb(HHI_VDAC_CNTL1_G12A, 1, 7, 1);
@@ -725,8 +734,11 @@ static void amvdac_drv_shutdown(struct platform_device *pdev)
pr_info("%s: shutdown module\n", __func__);
cntl0 = 0x0;
if (is_meson_txl_cpu() || is_meson_txlx_cpu())
if (s_vdac_data->cpu_id == VDAC_CPU_TXL ||
s_vdac_data->cpu_id == VDAC_CPU_TXLX)
cntl1 = 0x0;
else if (s_vdac_data->cpu_id == VDAC_CPU_TL1)
cntl1 = 0x80;
else
cntl1 = 0x8;
vdac_set_ctrl0_ctrl1(cntl0, cntl1);

View File

@@ -27,6 +27,7 @@ enum vdac_cpu_type {
VDAC_CPU_TXHD = 5,
VDAC_CPU_G12AB = 6,
VDAC_CPU_TL1 = 7,
VDAC_CPU_SM1 = 8,
VDAC_CPU_MAX,
};