From c4e78ab6128fbbf68e0183a25c7bdfdd5b08251e Mon Sep 17 00:00:00 2001 From: Nian Jing Date: Fri, 7 Sep 2018 17:27:41 +0800 Subject: [PATCH] vdac: add shutdown function PD#173443: add shutdown function disable cvbsout driver config Change-Id: I2c9a5e908b0c66e79bb200bebf0bf4fc312e77ef Signed-off-by: Nian Jing --- arch/arm/boot/dts/amlogic/txlx_t962e_r321.dts | 2 +- arch/arm/boot/dts/amlogic/txlx_t962x_r311_1g.dts | 2 +- arch/arm/boot/dts/amlogic/txlx_t962x_r311_2g.dts | 2 +- arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts | 2 +- .../boot/dts/amlogic/txlx_t962e_r321_buildroot.dts | 2 +- arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts | 2 +- arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts | 2 +- arch/arm64/boot/dts/amlogic/txlx_t962x_r311_720p.dts | 2 +- drivers/amlogic/media/vout/cvbs/cvbs_out.c | 12 ++---------- drivers/amlogic/media/vout/vdac/vdac_dev.c | 19 +++++++++++++++++-- 10 files changed, 27 insertions(+), 20 deletions(-) diff --git a/arch/arm/boot/dts/amlogic/txlx_t962e_r321.dts b/arch/arm/boot/dts/amlogic/txlx_t962e_r321.dts index e23d2ee..a1a4550 100644 --- a/arch/arm/boot/dts/amlogic/txlx_t962e_r321.dts +++ b/arch/arm/boot/dts/amlogic/txlx_t962e_r321.dts @@ -895,7 +895,7 @@ cvbsout { compatible = "amlogic, cvbsout-txlx"; dev_name = "cvbsout"; - status = "okay"; + status = "disabled"; clocks = <&clkc CLKID_VCLK2_ENCI &clkc CLKID_VCLK2_VENCI0 &clkc CLKID_VCLK2_VENCI1 diff --git a/arch/arm/boot/dts/amlogic/txlx_t962x_r311_1g.dts b/arch/arm/boot/dts/amlogic/txlx_t962x_r311_1g.dts index 96402bc..34549c0 100644 --- a/arch/arm/boot/dts/amlogic/txlx_t962x_r311_1g.dts +++ b/arch/arm/boot/dts/amlogic/txlx_t962x_r311_1g.dts @@ -925,7 +925,7 @@ cvbsout { compatible = "amlogic, cvbsout-txlx"; dev_name = "cvbsout"; - status = "okay"; + status = "disabled"; clocks = <&clkc CLKID_VCLK2_ENCI &clkc CLKID_VCLK2_VENCI0 &clkc CLKID_VCLK2_VENCI1 diff --git a/arch/arm/boot/dts/amlogic/txlx_t962x_r311_2g.dts b/arch/arm/boot/dts/amlogic/txlx_t962x_r311_2g.dts index 14f4484..7fc629f 100644 --- a/arch/arm/boot/dts/amlogic/txlx_t962x_r311_2g.dts +++ b/arch/arm/boot/dts/amlogic/txlx_t962x_r311_2g.dts @@ -931,7 +931,7 @@ cvbsout { compatible = "amlogic, cvbsout-txlx"; dev_name = "cvbsout"; - status = "okay"; + status = "disabled"; clocks = <&clkc CLKID_VCLK2_ENCI &clkc CLKID_VCLK2_VENCI0 &clkc CLKID_VCLK2_VENCI1 diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts b/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts index cd4346d..aeb3c54 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts @@ -905,7 +905,7 @@ cvbsout { compatible = "amlogic, cvbsout-txlx"; dev_name = "cvbsout"; - status = "okay"; + status = "disabled"; clocks = <&clkc CLKID_VCLK2_ENCI &clkc CLKID_VCLK2_VENCI0 &clkc CLKID_VCLK2_VENCI1 diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts b/arch/arm64/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts index 1114caf..03096db 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts @@ -942,7 +942,7 @@ cvbsout { compatible = "amlogic, cvbsout-txlx"; dev_name = "cvbsout"; - status = "okay"; + status = "disabled"; clocks = <&clkc CLKID_VCLK2_ENCI &clkc CLKID_VCLK2_VENCI0 &clkc CLKID_VCLK2_VENCI1 diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts index e6fb97d..99f95b9 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts @@ -926,7 +926,7 @@ cvbsout { compatible = "amlogic, cvbsout-txlx"; dev_name = "cvbsout"; - status = "okay"; + status = "disabled"; clocks = <&clkc CLKID_VCLK2_ENCI &clkc CLKID_VCLK2_VENCI0 &clkc CLKID_VCLK2_VENCI1 diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts index 334fe79..6628ae2 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts @@ -932,7 +932,7 @@ cvbsout { compatible = "amlogic, cvbsout-txlx"; dev_name = "cvbsout"; - status = "okay"; + status = "disabled"; clocks = <&clkc CLKID_VCLK2_ENCI &clkc CLKID_VCLK2_VENCI0 &clkc CLKID_VCLK2_VENCI1 diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_720p.dts b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_720p.dts index 17461a9..8697f1b 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_720p.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_720p.dts @@ -925,7 +925,7 @@ cvbsout { compatible = "amlogic, cvbsout-txlx"; dev_name = "cvbsout"; - status = "okay"; + status = "disabled"; clocks = <&clkc CLKID_VCLK2_ENCI &clkc CLKID_VCLK2_VENCI0 &clkc CLKID_VCLK2_VENCI1 diff --git a/drivers/amlogic/media/vout/cvbs/cvbs_out.c b/drivers/amlogic/media/vout/cvbs/cvbs_out.c index 4c735f7..435dab5 100644 --- a/drivers/amlogic/media/vout/cvbs/cvbs_out.c +++ b/drivers/amlogic/media/vout/cvbs/cvbs_out.c @@ -304,15 +304,6 @@ static void cvbs_out_disable_clk(void) disable_vmode_clk(); } -static void cvbs_out_disable_venc(void) -{ - info->dwork_flag = 0; - cvbs_cntl_output(0); - cvbs_out_reg_write(ENCI_VIDEO_EN, 0); - - return; -} - static void cvbs_out_vpu_power_ctrl(int status) { if (info->vinfo == NULL) @@ -1497,7 +1488,8 @@ static int cvbsout_remove(struct platform_device *pdev) static void cvbsout_shutdown(struct platform_device *pdev) { - cvbs_out_disable_venc(); + info->dwork_flag = 0; + cvbs_out_reg_write(ENCI_VIDEO_EN, 0); cvbs_out_disable_clk(); cvbs_out_vpu_power_ctrl(0); diff --git a/drivers/amlogic/media/vout/vdac/vdac_dev.c b/drivers/amlogic/media/vout/vdac/vdac_dev.c index b65ad14..ea13a56 100644 --- a/drivers/amlogic/media/vout/vdac/vdac_dev.c +++ b/drivers/amlogic/media/vout/vdac/vdac_dev.c @@ -326,6 +326,8 @@ void vdac_out_cntl1_bit3(bool on, unsigned int module_sel) if (is_meson_txl_cpu() || is_meson_txlx_cpu()) vdac_hiu_reg_setb(HHI_VDAC_CNTL1, enable, 3, 1); + else if (is_meson_g12a_cpu() || is_meson_g12b_cpu()) + vdac_hiu_reg_setb(HHI_VDAC_CNTL1_G12A, ~enable, 3, 1); else vdac_hiu_reg_setb(HHI_VDAC_CNTL1, ~enable, 3, 1); } @@ -382,7 +384,7 @@ void vdac_enable(bool on, unsigned int module_sel) if (!is_meson_g12a_cpu() && !is_meson_g12b_cpu()) vdac_hiu_reg_setb(HHI_VDAC_CNTL0, 0, 10, 1); /* enable dac output */ - vdac_out_cntl1_bit3(0, 0x4); + vdac_out_cntl1_bit3(0, VDAC_MODULE_ATV_DEMOD); } break; case VDAC_MODULE_DTV_DEMOD: /* dtv demod */ @@ -582,7 +584,6 @@ static int __exit aml_vdac_remove(struct platform_device *pdev) static int amvdac_drv_suspend(struct platform_device *pdev, pm_message_t state) { - pr_info("%s: suspend module\n", __func__); return 0; } @@ -594,6 +595,19 @@ static int amvdac_drv_resume(struct platform_device *pdev) } #endif +static void amvdac_drv_shutdown(struct platform_device *pdev) +{ + unsigned int cntl0, cntl1; + + pr_info("%s: shutdown module\n", __func__); + cntl0 = 0x0; + if (is_meson_txl_cpu() || is_meson_txlx_cpu()) + cntl1 = 0x0; + else + cntl1 = 0x8; + vdac_set_ctrl0_ctrl1(cntl0, cntl1); +} + static const struct of_device_id aml_vdac_dt_match[] = { { @@ -614,6 +628,7 @@ static struct platform_driver aml_vdac_driver = { .suspend = amvdac_drv_suspend, .resume = amvdac_drv_resume, #endif + .shutdown = amvdac_drv_shutdown, }; static int __init aml_vdac_init(void) -- 2.7.4