demod: prevent the agc pin conflict when used in atv or dtv demod [1/3]
authornengwen.chen <nengwen.chen@amlogic.com>
Tue, 24 Jul 2018 06:20:03 +0000 (14:20 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Wed, 25 Jul 2018 10:26:12 +0000 (03:26 -0700)
PD#170409: prevent the agc pin conflict when used in atv or dtv demod

Change-Id: I78359502a97d79a703e990669bd1acddae6679ce
Signed-off-by: nengwen.chen <nengwen.chen@amlogic.com>
drivers/amlogic/atv_demod/atv_demod_ops.c
drivers/amlogic/media/dtv_demod/amlfrontend.c
drivers/media/dvb-core/dvb_frontend.c

index 1a2fed72a036c4d11e0399ee24609c6b84155011..4eb44e5f507a3bdfd5a2713ba2839d01f589c9e4 100644 (file)
@@ -468,10 +468,15 @@ int atv_demod_enter_mode(struct dvb_frontend *fe)
        if (atv_demod_get_state() == ATVDEMOD_STATE_WORK)
                return 0;
 #endif
-       if (amlatvdemod_devp->pin_name != NULL)
+       if (amlatvdemod_devp->pin_name != NULL) {
                amlatvdemod_devp->agc_pin =
                        devm_pinctrl_get_select(amlatvdemod_devp->dev,
                                amlatvdemod_devp->pin_name);
+               if (IS_ERR(amlatvdemod_devp->agc_pin)) {
+                       amlatvdemod_devp->agc_pin = NULL;
+                       pr_err("%s: get agc pins fail\n", __func__);
+               }
+       }
 
        adc_set_pll_cntl(1, 0x1, NULL);
        vdac_enable(1, 1);
@@ -510,7 +515,7 @@ int atv_demod_leave_mode(struct dvb_frontend *fe)
        aml_afc_timer_disable(fe);
 
        atvdemod_uninit();
-       if (amlatvdemod_devp->agc_pin != NULL) {
+       if (!IS_ERR_OR_NULL(amlatvdemod_devp->agc_pin)) {
                devm_pinctrl_put(amlatvdemod_devp->agc_pin);
                amlatvdemod_devp->agc_pin = NULL;
        }
index 106e2450f98b4a674d14c50fb9c147980b664451..f2d395d2651b6652898d6c478752d3df431a50eb 100644 (file)
@@ -3008,9 +3008,13 @@ static void dtvdemod_set_agc_pinmux(int on)
        if (on) {
                dtvdd_devp->pin = devm_pinctrl_get_select(dtvdd_devp->dev,
                                                        dtvdd_devp->pin_name);
+               if (IS_ERR(dtvdd_devp->pin)) {
+                       dtvdd_devp->pin = NULL;
+                       PR_ERR("get agc pins fail\n");
+               }
        } else {
                /*off*/
-               if (dtvdd_devp->pin != NULL) {
+               if (!IS_ERR_OR_NULL(dtvdd_devp->pin)) {
                        devm_pinctrl_put(dtvdd_devp->pin);
                        dtvdd_devp->pin = NULL;
                }
@@ -4064,7 +4068,7 @@ static struct dvb_frontend_ops aml_dtvdm_gxtvbb_ops = {
 };
 
 static struct dvb_frontend_ops aml_dtvdm_txl_ops = {
-       .delsys = { /*SYS_DVBC_ANNEX_A,*/ SYS_DTMB, SYS_ANALOG},
+       .delsys = { SYS_DVBC_ANNEX_A, SYS_DTMB, SYS_ANALOG},
        .info = {
                /*in aml_fe, it is 'amlogic dvb frontend' */
                .name = "amlogic dtv demod txl",
index aadff13ea7e88461e054b1a1fe2ac31a9a0e1b8c..09bffbcc1db18e749a3ac0237f4ce1b5868095f4 100644 (file)
@@ -1544,7 +1544,8 @@ static bool is_dvbv3_delsys(u32 delsys)
        bool status;
 
        status = (delsys == SYS_DVBT) || (delsys == SYS_DVBC_ANNEX_A) ||
-                (delsys == SYS_DVBS) || (delsys == SYS_ATSC);
+                (delsys == SYS_DVBS) || (delsys == SYS_ATSC) ||
+                (delsys == SYS_DTMB); /* added by Amlogic 20180720 */
 
        return status;
 }