aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-18 15:53:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-18 15:53:54 -0500
commit4a7c1ff2362b7bfbc04990f42c21cefdff57f997 (patch)
tree82ac9c30ca95b6a92084f5535e6406866eb99cf3 /drivers/media/dvb
parent9278e634b4e063f415b46923a9ca4e74f42ec932 (diff)
parent36be126cb0ebe3000a65c1049f339a3e882a9a47 (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (57 commits) [media] as3645a: Fix compilation by including slab.h [media] s5p-fimc: Remove linux/version.h include from fimc-mdevice.c [media] s5p-mfc: Remove linux/version.h include from s5p_mfc.c [media] ds3000: using logical && instead of bitwise & [media] v4l2-ctrls: make control names consistent [media] DVB: dib0700, add support for Nova-TD LEDs [media] DVB: dib0700, add corrected Nova-TD frontend_attach [media] DVB: dib0700, separate stk7070pd initialization [media] DVB: dib0700, move Nova-TD Stick to a separate set [media] : add MODULE_FIRMWARE to dib0700 [media] DVB-CORE: remove superfluous DTV_CMDs [media] s5p-jpeg: adapt to recent videobuf2 changes [media] s5p-g2d: fixed a bug in controls setting function [media] s5p-mfc: Fix volatile controls setup [media] drivers/media/video/s5p-mfc/s5p_mfc.c: adjust double test [media] drivers/media/video/s5p-fimc/fimc-capture.c: adjust double test [media] s5p-fimc: Fix incorrect control ID assignment [media] dvb_frontend: Don't call get_frontend() if idle [media] DocBook/dvbproperty.xml: Remove DTV_MODULATION from ISDB-T [media] DocBook/dvbproperty.xml: Fix ISDB-T delivery system parameters ...
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c41
-rw-r--r--drivers/media/dvb/dvb-usb/anysee.c20
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700.h2
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_core.c1
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c150
-rw-r--r--drivers/media/dvb/frontends/cxd2820r_core.c10
-rw-r--r--drivers/media/dvb/frontends/ds3000.c2
-rw-r--r--drivers/media/dvb/frontends/mb86a20s.c8
-rw-r--r--drivers/media/dvb/frontends/tda18271c2dd.c1
9 files changed, 180 insertions, 55 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index b15db4fe347b..fbbe545a74cb 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -904,8 +904,11 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
904{ 904{
905 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 905 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
906 int i; 906 int i;
907 u32 delsys;
907 908
909 delsys = c->delivery_system;
908 memset(c, 0, sizeof(struct dtv_frontend_properties)); 910 memset(c, 0, sizeof(struct dtv_frontend_properties));
911 c->delivery_system = delsys;
909 912
910 c->state = DTV_CLEAR; 913 c->state = DTV_CLEAR;
911 914
@@ -1009,25 +1012,6 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
1009 _DTV_CMD(DTV_ISDBT_LAYERC_SEGMENT_COUNT, 1, 0), 1012 _DTV_CMD(DTV_ISDBT_LAYERC_SEGMENT_COUNT, 1, 0),
1010 _DTV_CMD(DTV_ISDBT_LAYERC_TIME_INTERLEAVING, 1, 0), 1013 _DTV_CMD(DTV_ISDBT_LAYERC_TIME_INTERLEAVING, 1, 0),
1011 1014
1012 _DTV_CMD(DTV_ISDBT_PARTIAL_RECEPTION, 0, 0),
1013 _DTV_CMD(DTV_ISDBT_SOUND_BROADCASTING, 0, 0),
1014 _DTV_CMD(DTV_ISDBT_SB_SUBCHANNEL_ID, 0, 0),
1015 _DTV_CMD(DTV_ISDBT_SB_SEGMENT_IDX, 0, 0),
1016 _DTV_CMD(DTV_ISDBT_SB_SEGMENT_COUNT, 0, 0),
1017 _DTV_CMD(DTV_ISDBT_LAYER_ENABLED, 0, 0),
1018 _DTV_CMD(DTV_ISDBT_LAYERA_FEC, 0, 0),
1019 _DTV_CMD(DTV_ISDBT_LAYERA_MODULATION, 0, 0),
1020 _DTV_CMD(DTV_ISDBT_LAYERA_SEGMENT_COUNT, 0, 0),
1021 _DTV_CMD(DTV_ISDBT_LAYERA_TIME_INTERLEAVING, 0, 0),
1022 _DTV_CMD(DTV_ISDBT_LAYERB_FEC, 0, 0),
1023 _DTV_CMD(DTV_ISDBT_LAYERB_MODULATION, 0, 0),
1024 _DTV_CMD(DTV_ISDBT_LAYERB_SEGMENT_COUNT, 0, 0),
1025 _DTV_CMD(DTV_ISDBT_LAYERB_TIME_INTERLEAVING, 0, 0),
1026 _DTV_CMD(DTV_ISDBT_LAYERC_FEC, 0, 0),
1027 _DTV_CMD(DTV_ISDBT_LAYERC_MODULATION, 0, 0),
1028 _DTV_CMD(DTV_ISDBT_LAYERC_SEGMENT_COUNT, 0, 0),
1029 _DTV_CMD(DTV_ISDBT_LAYERC_TIME_INTERLEAVING, 0, 0),
1030
1031 _DTV_CMD(DTV_ISDBS_TS_ID, 1, 0), 1015 _DTV_CMD(DTV_ISDBS_TS_ID, 1, 0),
1032 _DTV_CMD(DTV_DVBT2_PLP_ID, 1, 0), 1016 _DTV_CMD(DTV_DVBT2_PLP_ID, 1, 0),
1033 1017
@@ -1413,6 +1397,15 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
1413 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 1397 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
1414 enum dvbv3_emulation_type type; 1398 enum dvbv3_emulation_type type;
1415 1399
1400 /*
1401 * It was reported that some old DVBv5 applications were
1402 * filling delivery_system with SYS_UNDEFINED. If this happens,
1403 * assume that the application wants to use the first supported
1404 * delivery system.
1405 */
1406 if (c->delivery_system == SYS_UNDEFINED)
1407 c->delivery_system = fe->ops.delsys[0];
1408
1416 if (desired_system == SYS_UNDEFINED) { 1409 if (desired_system == SYS_UNDEFINED) {
1417 /* 1410 /*
1418 * A DVBv3 call doesn't know what's the desired system. 1411 * A DVBv3 call doesn't know what's the desired system.
@@ -1732,6 +1725,7 @@ static int dvb_frontend_ioctl_properties(struct file *file,
1732{ 1725{
1733 struct dvb_device *dvbdev = file->private_data; 1726 struct dvb_device *dvbdev = file->private_data;
1734 struct dvb_frontend *fe = dvbdev->priv; 1727 struct dvb_frontend *fe = dvbdev->priv;
1728 struct dvb_frontend_private *fepriv = fe->frontend_priv;
1735 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 1729 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
1736 int err = 0; 1730 int err = 0;
1737 1731
@@ -1798,9 +1792,14 @@ static int dvb_frontend_ioctl_properties(struct file *file,
1798 1792
1799 /* 1793 /*
1800 * Fills the cache out struct with the cache contents, plus 1794 * Fills the cache out struct with the cache contents, plus
1801 * the data retrieved from get_frontend. 1795 * the data retrieved from get_frontend, if the frontend
1796 * is not idle. Otherwise, returns the cached content
1802 */ 1797 */
1803 dtv_get_frontend(fe, NULL); 1798 if (fepriv->state != FESTATE_IDLE) {
1799 err = dtv_get_frontend(fe, NULL);
1800 if (err < 0)
1801 goto out;
1802 }
1804 for (i = 0; i < tvps->num; i++) { 1803 for (i = 0; i < tvps->num; i++) {
1805 err = dtv_property_process_get(fe, c, tvp + i, file); 1804 err = dtv_property_process_get(fe, c, tvp + i, file);
1806 if (err < 0) 1805 if (err < 0)
diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c
index d66192974d68..1455e2644ab5 100644
--- a/drivers/media/dvb/dvb-usb/anysee.c
+++ b/drivers/media/dvb/dvb-usb/anysee.c
@@ -877,24 +877,18 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap)
877 case ANYSEE_HW_508T2C: /* 20 */ 877 case ANYSEE_HW_508T2C: /* 20 */
878 /* E7 T2C */ 878 /* E7 T2C */
879 879
880 if (state->fe_id)
881 break;
882
880 /* enable DVB-T/T2/C demod on IOE[5] */ 883 /* enable DVB-T/T2/C demod on IOE[5] */
881 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 5), 0x20); 884 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 5), 0x20);
882 if (ret) 885 if (ret)
883 goto error; 886 goto error;
884 887
885 if (state->fe_id == 0) { 888 /* attach demod */
886 /* DVB-T/T2 */ 889 adap->fe_adap[state->fe_id].fe = dvb_attach(cxd2820r_attach,
887 adap->fe_adap[state->fe_id].fe = 890 &anysee_cxd2820r_config, &adap->dev->i2c_adap,
888 dvb_attach(cxd2820r_attach, 891 NULL);
889 &anysee_cxd2820r_config,
890 &adap->dev->i2c_adap, NULL);
891 } else {
892 /* DVB-C */
893 adap->fe_adap[state->fe_id].fe =
894 dvb_attach(cxd2820r_attach,
895 &anysee_cxd2820r_config,
896 &adap->dev->i2c_adap, adap->fe_adap[0].fe);
897 }
898 892
899 state->has_ci = true; 893 state->has_ci = true;
900 894
diff --git a/drivers/media/dvb/dvb-usb/dib0700.h b/drivers/media/dvb/dvb-usb/dib0700.h
index 9bd6d51b3b93..7de125c0b36f 100644
--- a/drivers/media/dvb/dvb-usb/dib0700.h
+++ b/drivers/media/dvb/dvb-usb/dib0700.h
@@ -48,6 +48,8 @@ struct dib0700_state {
48 u8 disable_streaming_master_mode; 48 u8 disable_streaming_master_mode;
49 u32 fw_version; 49 u32 fw_version;
50 u32 nb_packet_buffer_size; 50 u32 nb_packet_buffer_size;
51 int (*read_status)(struct dvb_frontend *, fe_status_t *);
52 int (*sleep)(struct dvb_frontend* fe);
51 u8 buf[255]; 53 u8 buf[255];
52}; 54};
53 55
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
index 206999476f02..070e82aa53f5 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_core.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
@@ -834,6 +834,7 @@ static struct usb_driver dib0700_driver = {
834 834
835module_usb_driver(dib0700_driver); 835module_usb_driver(dib0700_driver);
836 836
837MODULE_FIRMWARE("dvb-usb-dib0700-1.20.fw");
837MODULE_AUTHOR("Patrick Boettcher <pboettcher@dibcom.fr>"); 838MODULE_AUTHOR("Patrick Boettcher <pboettcher@dibcom.fr>");
838MODULE_DESCRIPTION("Driver for devices based on DiBcom DiB0700 - USB bridge"); 839MODULE_DESCRIPTION("Driver for devices based on DiBcom DiB0700 - USB bridge");
839MODULE_VERSION("1.0"); 840MODULE_VERSION("1.0");
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index 81ef4b46f790..f9e966aa26e7 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -3066,19 +3066,25 @@ static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
3066 } 3066 }
3067}; 3067};
3068 3068
3069static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap) 3069static void stk7070pd_init(struct dvb_usb_device *dev)
3070{ 3070{
3071 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); 3071 dib0700_set_gpio(dev, GPIO6, GPIO_OUT, 1);
3072 msleep(10); 3072 msleep(10);
3073 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); 3073 dib0700_set_gpio(dev, GPIO9, GPIO_OUT, 1);
3074 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); 3074 dib0700_set_gpio(dev, GPIO4, GPIO_OUT, 1);
3075 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); 3075 dib0700_set_gpio(dev, GPIO7, GPIO_OUT, 1);
3076 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); 3076 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 0);
3077 3077
3078 dib0700_ctrl_clock(adap->dev, 72, 1); 3078 dib0700_ctrl_clock(dev, 72, 1);
3079 3079
3080 msleep(10); 3080 msleep(10);
3081 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); 3081 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 1);
3082}
3083
3084static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
3085{
3086 stk7070pd_init(adap->dev);
3087
3082 msleep(10); 3088 msleep(10);
3083 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); 3089 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3084 3090
@@ -3099,6 +3105,77 @@ static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
3099 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; 3105 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3100} 3106}
3101 3107
3108static int novatd_read_status_override(struct dvb_frontend *fe,
3109 fe_status_t *stat)
3110{
3111 struct dvb_usb_adapter *adap = fe->dvb->priv;
3112 struct dvb_usb_device *dev = adap->dev;
3113 struct dib0700_state *state = dev->priv;
3114 int ret;
3115
3116 ret = state->read_status(fe, stat);
3117
3118 if (!ret)
3119 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT,
3120 !!(*stat & FE_HAS_LOCK));
3121
3122 return ret;
3123}
3124
3125static int novatd_sleep_override(struct dvb_frontend* fe)
3126{
3127 struct dvb_usb_adapter *adap = fe->dvb->priv;
3128 struct dvb_usb_device *dev = adap->dev;
3129 struct dib0700_state *state = dev->priv;
3130
3131 /* turn off LED */
3132 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, 0);
3133
3134 return state->sleep(fe);
3135}
3136
3137/**
3138 * novatd_frontend_attach - Nova-TD specific attach
3139 *
3140 * Nova-TD has GPIO0, 1 and 2 for LEDs. So do not fiddle with them except for
3141 * information purposes.
3142 */
3143static int novatd_frontend_attach(struct dvb_usb_adapter *adap)
3144{
3145 struct dvb_usb_device *dev = adap->dev;
3146 struct dib0700_state *st = dev->priv;
3147
3148 if (adap->id == 0) {
3149 stk7070pd_init(dev);
3150
3151 /* turn the power LED on, the other two off (just in case) */
3152 dib0700_set_gpio(dev, GPIO0, GPIO_OUT, 0);
3153 dib0700_set_gpio(dev, GPIO1, GPIO_OUT, 0);
3154 dib0700_set_gpio(dev, GPIO2, GPIO_OUT, 1);
3155
3156 if (dib7000p_i2c_enumeration(&dev->i2c_adap, 2, 18,
3157 stk7070pd_dib7000p_config) != 0) {
3158 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
3159 __func__);
3160 return -ENODEV;
3161 }
3162 }
3163
3164 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &dev->i2c_adap,
3165 adap->id == 0 ? 0x80 : 0x82,
3166 &stk7070pd_dib7000p_config[adap->id]);
3167
3168 if (adap->fe_adap[0].fe == NULL)
3169 return -ENODEV;
3170
3171 st->read_status = adap->fe_adap[0].fe->ops.read_status;
3172 adap->fe_adap[0].fe->ops.read_status = novatd_read_status_override;
3173 st->sleep = adap->fe_adap[0].fe->ops.sleep;
3174 adap->fe_adap[0].fe->ops.sleep = novatd_sleep_override;
3175
3176 return 0;
3177}
3178
3102/* S5H1411 */ 3179/* S5H1411 */
3103static struct s5h1411_config pinnacle_801e_config = { 3180static struct s5h1411_config pinnacle_801e_config = {
3104 .output_mode = S5H1411_PARALLEL_OUTPUT, 3181 .output_mode = S5H1411_PARALLEL_OUTPUT,
@@ -3870,6 +3947,57 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3870 .pid_filter_count = 32, 3947 .pid_filter_count = 32,
3871 .pid_filter = stk70x0p_pid_filter, 3948 .pid_filter = stk70x0p_pid_filter,
3872 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, 3949 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3950 .frontend_attach = novatd_frontend_attach,
3951 .tuner_attach = dib7070p_tuner_attach,
3952
3953 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3954 }},
3955 .size_of_priv = sizeof(struct dib0700_adapter_state),
3956 }, {
3957 .num_frontends = 1,
3958 .fe = {{
3959 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3960 .pid_filter_count = 32,
3961 .pid_filter = stk70x0p_pid_filter,
3962 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3963 .frontend_attach = novatd_frontend_attach,
3964 .tuner_attach = dib7070p_tuner_attach,
3965
3966 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3967 }},
3968 .size_of_priv = sizeof(struct dib0700_adapter_state),
3969 }
3970 },
3971
3972 .num_device_descs = 1,
3973 .devices = {
3974 { "Hauppauge Nova-TD Stick (52009)",
3975 { &dib0700_usb_id_table[35], NULL },
3976 { NULL },
3977 },
3978 },
3979
3980 .rc.core = {
3981 .rc_interval = DEFAULT_RC_INTERVAL,
3982 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3983 .module_name = "dib0700",
3984 .rc_query = dib0700_rc_query_old_firmware,
3985 .allowed_protos = RC_TYPE_RC5 |
3986 RC_TYPE_RC6 |
3987 RC_TYPE_NEC,
3988 .change_protocol = dib0700_change_protocol,
3989 },
3990 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3991
3992 .num_adapters = 2,
3993 .adapter = {
3994 {
3995 .num_frontends = 1,
3996 .fe = {{
3997 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3998 .pid_filter_count = 32,
3999 .pid_filter = stk70x0p_pid_filter,
4000 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3873 .frontend_attach = stk7070pd_frontend_attach0, 4001 .frontend_attach = stk7070pd_frontend_attach0,
3874 .tuner_attach = dib7070p_tuner_attach, 4002 .tuner_attach = dib7070p_tuner_attach,
3875 4003
@@ -3892,7 +4020,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3892 } 4020 }
3893 }, 4021 },
3894 4022
3895 .num_device_descs = 6, 4023 .num_device_descs = 5,
3896 .devices = { 4024 .devices = {
3897 { "DiBcom STK7070PD reference design", 4025 { "DiBcom STK7070PD reference design",
3898 { &dib0700_usb_id_table[17], NULL }, 4026 { &dib0700_usb_id_table[17], NULL },
@@ -3902,10 +4030,6 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3902 { &dib0700_usb_id_table[18], NULL }, 4030 { &dib0700_usb_id_table[18], NULL },
3903 { NULL }, 4031 { NULL },
3904 }, 4032 },
3905 { "Hauppauge Nova-TD Stick (52009)",
3906 { &dib0700_usb_id_table[35], NULL },
3907 { NULL },
3908 },
3909 { "Hauppauge Nova-TD-500 (84xxx)", 4033 { "Hauppauge Nova-TD-500 (84xxx)",
3910 { &dib0700_usb_id_table[36], NULL }, 4034 { &dib0700_usb_id_table[36], NULL },
3911 { NULL }, 4035 { NULL },
diff --git a/drivers/media/dvb/frontends/cxd2820r_core.c b/drivers/media/dvb/frontends/cxd2820r_core.c
index 93e1b12e7907..caae7f79c837 100644
--- a/drivers/media/dvb/frontends/cxd2820r_core.c
+++ b/drivers/media/dvb/frontends/cxd2820r_core.c
@@ -309,9 +309,14 @@ static int cxd2820r_read_status(struct dvb_frontend *fe, fe_status_t *status)
309 309
310static int cxd2820r_get_frontend(struct dvb_frontend *fe) 310static int cxd2820r_get_frontend(struct dvb_frontend *fe)
311{ 311{
312 struct cxd2820r_priv *priv = fe->demodulator_priv;
312 int ret; 313 int ret;
313 314
314 dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system); 315 dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
316
317 if (priv->delivery_system == SYS_UNDEFINED)
318 return 0;
319
315 switch (fe->dtv_property_cache.delivery_system) { 320 switch (fe->dtv_property_cache.delivery_system) {
316 case SYS_DVBT: 321 case SYS_DVBT:
317 ret = cxd2820r_get_frontend_t(fe); 322 ret = cxd2820r_get_frontend_t(fe);
@@ -476,10 +481,10 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe)
476 dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system); 481 dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
477 482
478 /* switch between DVB-T and DVB-T2 when tune fails */ 483 /* switch between DVB-T and DVB-T2 when tune fails */
479 if (priv->last_tune_failed && (priv->delivery_system != SYS_DVBC_ANNEX_A)) { 484 if (priv->last_tune_failed) {
480 if (priv->delivery_system == SYS_DVBT) 485 if (priv->delivery_system == SYS_DVBT)
481 c->delivery_system = SYS_DVBT2; 486 c->delivery_system = SYS_DVBT2;
482 else 487 else if (priv->delivery_system == SYS_DVBT2)
483 c->delivery_system = SYS_DVBT; 488 c->delivery_system = SYS_DVBT;
484 } 489 }
485 490
@@ -492,6 +497,7 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe)
492 /* frontend lock wait loop count */ 497 /* frontend lock wait loop count */
493 switch (priv->delivery_system) { 498 switch (priv->delivery_system) {
494 case SYS_DVBT: 499 case SYS_DVBT:
500 case SYS_DVBC_ANNEX_A:
495 i = 20; 501 i = 20;
496 break; 502 break;
497 case SYS_DVBT2: 503 case SYS_DVBT2:
diff --git a/drivers/media/dvb/frontends/ds3000.c b/drivers/media/dvb/frontends/ds3000.c
index 938777065de6..af65d013db11 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -1195,7 +1195,7 @@ static int ds3000_set_frontend(struct dvb_frontend *fe)
1195 1195
1196 for (i = 0; i < 30 ; i++) { 1196 for (i = 0; i < 30 ; i++) {
1197 ds3000_read_status(fe, &status); 1197 ds3000_read_status(fe, &status);
1198 if (status && FE_HAS_LOCK) 1198 if (status & FE_HAS_LOCK)
1199 break; 1199 break;
1200 1200
1201 msleep(10); 1201 msleep(10);
diff --git a/drivers/media/dvb/frontends/mb86a20s.c b/drivers/media/dvb/frontends/mb86a20s.c
index 7fa3e472cdca..fade566927c3 100644
--- a/drivers/media/dvb/frontends/mb86a20s.c
+++ b/drivers/media/dvb/frontends/mb86a20s.c
@@ -402,7 +402,7 @@ static int mb86a20s_get_modulation(struct mb86a20s_state *state,
402 [2] = 0x8e, /* Layer C */ 402 [2] = 0x8e, /* Layer C */
403 }; 403 };
404 404
405 if (layer > ARRAY_SIZE(reg)) 405 if (layer >= ARRAY_SIZE(reg))
406 return -EINVAL; 406 return -EINVAL;
407 rc = mb86a20s_writereg(state, 0x6d, reg[layer]); 407 rc = mb86a20s_writereg(state, 0x6d, reg[layer]);
408 if (rc < 0) 408 if (rc < 0)
@@ -435,7 +435,7 @@ static int mb86a20s_get_fec(struct mb86a20s_state *state,
435 [2] = 0x8f, /* Layer C */ 435 [2] = 0x8f, /* Layer C */
436 }; 436 };
437 437
438 if (layer > ARRAY_SIZE(reg)) 438 if (layer >= ARRAY_SIZE(reg))
439 return -EINVAL; 439 return -EINVAL;
440 rc = mb86a20s_writereg(state, 0x6d, reg[layer]); 440 rc = mb86a20s_writereg(state, 0x6d, reg[layer]);
441 if (rc < 0) 441 if (rc < 0)
@@ -470,7 +470,7 @@ static int mb86a20s_get_interleaving(struct mb86a20s_state *state,
470 [2] = 0x90, /* Layer C */ 470 [2] = 0x90, /* Layer C */
471 }; 471 };
472 472
473 if (layer > ARRAY_SIZE(reg)) 473 if (layer >= ARRAY_SIZE(reg))
474 return -EINVAL; 474 return -EINVAL;
475 rc = mb86a20s_writereg(state, 0x6d, reg[layer]); 475 rc = mb86a20s_writereg(state, 0x6d, reg[layer]);
476 if (rc < 0) 476 if (rc < 0)
@@ -494,7 +494,7 @@ static int mb86a20s_get_segment_count(struct mb86a20s_state *state,
494 [2] = 0x91, /* Layer C */ 494 [2] = 0x91, /* Layer C */
495 }; 495 };
496 496
497 if (layer > ARRAY_SIZE(reg)) 497 if (layer >= ARRAY_SIZE(reg))
498 return -EINVAL; 498 return -EINVAL;
499 rc = mb86a20s_writereg(state, 0x6d, reg[layer]); 499 rc = mb86a20s_writereg(state, 0x6d, reg[layer]);
500 if (rc < 0) 500 if (rc < 0)
diff --git a/drivers/media/dvb/frontends/tda18271c2dd.c b/drivers/media/dvb/frontends/tda18271c2dd.c
index 86da3d816498..ad7c72e8f517 100644
--- a/drivers/media/dvb/frontends/tda18271c2dd.c
+++ b/drivers/media/dvb/frontends/tda18271c2dd.c
@@ -29,7 +29,6 @@
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/firmware.h> 30#include <linux/firmware.h>
31#include <linux/i2c.h> 31#include <linux/i2c.h>
32#include <linux/version.h>
33#include <asm/div64.h> 32#include <asm/div64.h>
34 33
35#include "dvb_frontend.h" 34#include "dvb_frontend.h"