atv_demod: fix synchronization problem when get frontend [1/1]
authornengwen.chen <nengwen.chen@amlogic.com>
Tue, 23 Jul 2019 07:21:05 +0000 (15:21 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Wed, 31 Jul 2019 06:08:43 +0000 (23:08 -0700)
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 <nengwen.chen@amlogic.com>
drivers/amlogic/atv_demod/atv_demod_ops.c
drivers/amlogic/atv_demod/atv_demod_v4l2.c

index 622b84975fe078a30c2ec408f77983e00b9a0a41..00ff39d7273a556980df17c7b574c0075a8d6fca 100644 (file)
@@ -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);
        }
 }
 
index 6a11de5e3b379aea7c5ba252ac52c1836f115d1a..44a4cd640d99e27cad33be320c95c394f07f1ea5 100644 (file)
@@ -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)