vdac: add shutdown function
authorNian Jing <nian.jing@amlogic.com>
Fri, 7 Sep 2018 09:27:41 +0000 (17:27 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 17 Sep 2018 09:25:08 +0000 (02:25 -0700)
PD#173443: add shutdown function
disable cvbsout driver config

Change-Id: I2c9a5e908b0c66e79bb200bebf0bf4fc312e77ef
Signed-off-by: Nian Jing <nian.jing@amlogic.com>
arch/arm/boot/dts/amlogic/txlx_t962e_r321.dts
arch/arm/boot/dts/amlogic/txlx_t962x_r311_1g.dts
arch/arm/boot/dts/amlogic/txlx_t962x_r311_2g.dts
arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts
arch/arm64/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts
arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts
arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts
arch/arm64/boot/dts/amlogic/txlx_t962x_r311_720p.dts
drivers/amlogic/media/vout/cvbs/cvbs_out.c
drivers/amlogic/media/vout/vdac/vdac_dev.c

index e23d2ee..a1a4550 100644 (file)
        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
index 96402bc..34549c0 100644 (file)
        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
index 14f4484..7fc629f 100644 (file)
        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
index cd4346d..aeb3c54 100644 (file)
        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
index 1114caf..03096db 100644 (file)
        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
index e6fb97d..99f95b9 100644 (file)
        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
index 334fe79..6628ae2 100644 (file)
        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
index 17461a9..8697f1b 100644 (file)
        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
index 4c735f7..435dab5 100644 (file)
@@ -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);
index b65ad14..ea13a56 100644 (file)
@@ -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)