From cdd5f6af3bd5f1f437deb9403c866f3e2db0eaa9 Mon Sep 17 00:00:00 2001 From: "nengwen.chen" Date: Fri, 4 May 2018 20:49:01 +0800 Subject: [PATCH] atv_demod: Modify atv demod to adapter tuner PD#165368: atv_demod: Modify atv demod to adapter tuner Change-Id: Ifa69db980dfe9519c80932d22dffbb1fb6600fc9 Signed-off-by: nengwen.chen --- drivers/amlogic/atv_demod/Makefile | 4 ++-- drivers/amlogic/atv_demod/atv_demod_ops.c | 23 +++-------------------- drivers/amlogic/atv_demod/atv_demod_v4l2.c | 3 +-- drivers/amlogic/atv_demod/atvdemod_func.c | 3 ++- drivers/media/dvb-core/dvb_frontend.h | 4 ++++ 5 files changed, 12 insertions(+), 25 deletions(-) diff --git a/drivers/amlogic/atv_demod/Makefile b/drivers/amlogic/atv_demod/Makefile index f53fe04..6741a28 100644 --- a/drivers/amlogic/atv_demod/Makefile +++ b/drivers/amlogic/atv_demod/Makefile @@ -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 diff --git a/drivers/amlogic/atv_demod/atv_demod_ops.c b/drivers/amlogic/atv_demod/atv_demod_ops.c index 0ab11fc..8947535 100644 --- a/drivers/amlogic/atv_demod/atv_demod_ops.c +++ b/drivers/amlogic/atv_demod/atv_demod_ops.c @@ -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; diff --git a/drivers/amlogic/atv_demod/atv_demod_v4l2.c b/drivers/amlogic/atv_demod/atv_demod_v4l2.c index 22feab3..fe8db19 100644 --- a/drivers/amlogic/atv_demod/atv_demod_v4l2.c +++ b/drivers/amlogic/atv_demod/atv_demod_v4l2.c @@ -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__); diff --git a/drivers/amlogic/atv_demod/atvdemod_func.c b/drivers/amlogic/atv_demod/atvdemod_func.c index 95a9a9c..629f18e 100644 --- a/drivers/amlogic/atv_demod/atvdemod_func.c +++ b/drivers/amlogic/atv_demod/atvdemod_func.c @@ -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; diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h index a2ad9421f..b87b82d 100644 --- a/drivers/media/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb-core/dvb_frontend.h @@ -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 }; /** -- 2.7.4