From 8d4026515cae7ca28c9989f7daca5fe2dc7b3d48 Mon Sep 17 00:00:00 2001 From: "nengwen.chen" Date: Tue, 23 Jul 2019 15:21:05 +0800 Subject: [PATCH] atv_demod: fix synchronization problem when get frontend [1/1] PD#TV-8131 Problem: fix synchronization problem when get frontend. Solution: 1.fix synchronization problem when get frontend. Verify: Verified by x301 Change-Id: Ic0580a83448fe75529615ffa08cb526e205ef9a8 Signed-off-by: nengwen.chen --- drivers/amlogic/atv_demod/atv_demod_ops.c | 2 ++ drivers/amlogic/atv_demod/atv_demod_v4l2.c | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/amlogic/atv_demod/atv_demod_ops.c b/drivers/amlogic/atv_demod/atv_demod_ops.c index 622b84975fe0..00ff39d7273a 100644 --- a/drivers/amlogic/atv_demod/atv_demod_ops.c +++ b/drivers/amlogic/atv_demod/atv_demod_ops.c @@ -260,6 +260,8 @@ static void atv_demod_set_params(struct dvb_frontend *fe, /* for searching mute audio */ priv->standby = false; + + pr_dbg("%s: frequency %d.\n", __func__, p->param.frequency); } } diff --git a/drivers/amlogic/atv_demod/atv_demod_v4l2.c b/drivers/amlogic/atv_demod/atv_demod_v4l2.c index 6a11de5e3b37..44a4cd640d99 100644 --- a/drivers/amlogic/atv_demod/atv_demod_v4l2.c +++ b/drivers/amlogic/atv_demod/atv_demod_v4l2.c @@ -341,8 +341,11 @@ static int v4l2_frontend_start(struct v4l2_frontend *v4l2_fe) static int v4l2_frontend_check_mode(struct v4l2_frontend *v4l2_fe) { - if (v4l2_fe->mode != V4L2_TUNER_ANALOG_TV) + if (v4l2_fe->mode != V4L2_TUNER_ANALOG_TV) { + pr_dbg("%s: not in analog TV mode [%d].\n", + __func__, v4l2_fe->mode); return -EINVAL; + } return 0; } @@ -357,8 +360,6 @@ static int v4l2_set_frontend(struct v4l2_frontend *v4l2_fe, struct dvb_frontend *fe = &v4l2_fe->fe; struct v4l2_property tvp = { 0 }; - pr_dbg("%s.\n", __func__); - if (v4l2_frontend_check_mode(v4l2_fe) < 0) return -EINVAL; @@ -394,6 +395,8 @@ static int v4l2_set_frontend(struct v4l2_frontend *v4l2_fe, v4l2_fe->params.afc_range = params->afc_range; v4l2_fe->params.reserved = params->reserved; + pr_dbg("%s: params->flag 0x%x.\n", __func__, params->flag); + /* Request the search algorithm to search */ if (params->flag & ANALOG_FLAG_ENABLE_AFC) { fepriv->state = V4L2FE_STATE_RETUNE; @@ -427,7 +430,8 @@ static int v4l2_set_frontend(struct v4l2_frontend *v4l2_fe, static int v4l2_get_frontend(struct v4l2_frontend *v4l2_fe, struct v4l2_analog_parameters *p) { - pr_dbg("%s.\n", __func__); + if (v4l2_frontend_check_mode(v4l2_fe) < 0) + return -EINVAL; /*memcpy(p, &v4l2_fe->params, sizeof(struct v4l2_analog_parameters));*/ p->frequency = v4l2_fe->params.frequency; @@ -438,6 +442,8 @@ static int v4l2_get_frontend(struct v4l2_frontend *v4l2_fe, p->afc_range = v4l2_fe->params.afc_range; p->reserved = v4l2_fe->params.reserved; + pr_dbg("%s: frequency %d.\n", __func__, p->frequency); + return 0; } @@ -820,7 +826,7 @@ static long v4l2_frontend_ioctl(struct file *filp, void *fh, bool valid_prio, if (fepriv->exit != V4L2_FE_NO_EXIT) return -ENODEV; - if (cmd == V4L2_READ_STATUS || cmd == V4L2_GET_FRONTEND) + if (cmd == V4L2_READ_STATUS/* || cmd == V4L2_GET_FRONTEND */) need_lock = 0; if (need_lock)