atv_demod: Modify atv demod to adapter tuner
authornengwen.chen <nengwen.chen@amlogic.com>
Fri, 4 May 2018 12:49:01 +0000 (20:49 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Mon, 7 May 2018 09:53:03 +0000 (02:53 -0700)
PD#165368: atv_demod: Modify atv demod to adapter tuner

Change-Id: Ifa69db980dfe9519c80932d22dffbb1fb6600fc9
Signed-off-by: nengwen.chen <nengwen.chen@amlogic.com>
drivers/amlogic/atv_demod/Makefile
drivers/amlogic/atv_demod/atv_demod_ops.c
drivers/amlogic/atv_demod/atv_demod_v4l2.c
drivers/amlogic/atv_demod/atvdemod_func.c
drivers/media/dvb-core/dvb_frontend.h

index f53fe04..6741a28 100644 (file)
@@ -1,6 +1,6 @@
-obj-$(CONFIG_AMLOGIC_ATV_DEMOD) += aml_atvdemod.o
+obj-$(CONFIG_AMLOGIC_ATV_DEMOD) += atvdemod_fe.o
 
-aml_atvdemod-objs = atvdemod_func.o atvauddemod_func.o atv_demod_v4l2.o atv_demod_driver.o atv_demod_ops.o
+atvdemod_fe-objs = atvdemod_func.o atvauddemod_func.o atv_demod_v4l2.o atv_demod_driver.o atv_demod_ops.o
 
 ccflags-y += -I.
 ccflags-y += -Idrivers/media/dvb-core
index 0ab11fc..8947535 100644 (file)
@@ -285,7 +285,7 @@ static void atv_demod_set_params(struct dvb_frontend *fe,
                last_frq = atvdemod_param->param.frequency;
                last_std = atvdemod_param->param.std;
 #endif
-               if (atvdemod_param->param.std != amlatvdemod_devp->std) {
+               if (1/*atvdemod_param->param.std != amlatvdemod_devp->std*/) {
                        amlatvdemod_devp->std = atvdemod_param->param.std;
                        amlatvdemod_devp->if_freq = atvdemod_param->if_freq;
                        amlatvdemod_devp->if_inv = atvdemod_param->if_inv;
@@ -385,8 +385,8 @@ static int atv_demod_set_config(struct dvb_frontend *fe, void *priv_cfg)
        case AML_ATVDEMOD_INIT:
                if (get_atvdemod_state() != ATVDEMOD_STATE_WORK) {
                        atv_demod_enter_mode();
-                       if (fe->ops.tuner_ops.init)
-                               fe->ops.tuner_ops.init(fe);
+                       if (fe->ops.tuner_ops.set_config)
+                               fe->ops.tuner_ops.set_config(fe, NULL);
                }
                break;
 
@@ -407,23 +407,6 @@ static int atv_demod_set_config(struct dvb_frontend *fe, void *priv_cfg)
                break;
        }
 
-#if 0
-       if (*state == AML_ATVDEMOD_INIT && atvdemod_state != *state) {
-               atv_demod_enter_mode();
-               if (fe->ops.tuner_ops.init)
-                       fe->ops.tuner_ops.init(fe);
-       } else if (*state == AML_ATVDEMOD_UNINIT && atvdemod_state != *state) {
-               atv_demod_leave_mode();
-               if (fe->ops.tuner_ops.release)
-                       fe->ops.tuner_ops.release(fe);
-       } else if (*state == AML_ATVDEMOD_RESUME && atvdemod_state != *state) {
-               if (get_atvdemod_state() == ATVDEMOD_STATE_SLEEP)
-                       atv_demod_enter_mode();
-               if (fe->ops.tuner_ops.resume)
-                       fe->ops.tuner_ops.resume(fe);
-       }
-#endif
-
        mutex_unlock(&atv_demod_list_mutex);
 
        return 0;
index 22feab3..fe8db19 100644 (file)
@@ -279,7 +279,6 @@ static void v4l2_fe_try_analog_format(struct v4l2_frontend *v4l2_fe,
                audio = V4L2_STD_SECAM_L;
        } else {
                /*V4L2_COLOR_STD_PAL*/
-               *video_fmt |= V4L2_COLOR_STD_PAL;
                amlatvdemod_set_std(AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK);
                audio = aml_audiomode_autodet(fe);
                pr_info("autodet audmode 0x%x\n", audio);
@@ -481,7 +480,7 @@ static enum v4l2_search v4l2_frontend_search(struct v4l2_frontend *v4l2_fe)
         * and need tvafe identify signal type.
         */
        if (p->std == 0) {
-               p->std = V4L2_COLOR_STD_PAL | V4L2_STD_PAL_DK;
+               p->std = V4L2_COLOR_STD_NTSC | V4L2_STD_NTSC_M;
                auto_search_std = true;
                pr_dbg("[%s] user analog.std is 0, so set it to PAL | DK.\n",
                                __func__);
index 95a9a9c..629f18e 100644 (file)
@@ -1841,7 +1841,8 @@ void atv_dmd_set_std(void)
                broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M;
                if_freq = 4250000;
                gde_curve = 0;
-       } else if ((ptstd & V4L2_COLOR_STD_NTSC) && (ptstd & V4L2_STD_NTSC_M)) {
+       } else if ((ptstd & V4L2_COLOR_STD_NTSC) &&
+               ((ptstd & V4L2_STD_NTSC_M) || (ptstd & V4L2_STD_PAL_M))) {
                amlatvdemod_devp->fre_offset = 1750000;
                freq_hz_cvrt = AML_ATV_DEMOD_FREQ_60HZ_VERT;
                if_freq = 4250000;
index a2ad942..b87b82d 100644 (file)
@@ -264,6 +264,10 @@ struct dvb_tuner_ops {
         */
        int (*set_frequency)(struct dvb_frontend *fe, u32 frequency);
        int (*set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth);
+
+#ifdef CONFIG_AMLOGIC_DVB_COMPAT
+       int (*get_strength)(struct dvb_frontend *fe, s16 *strength);
+#endif
 };
 
 /**