~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to drivers/media/dvb/dvb-usb/dw2102.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
992
992
        struct dvb_tuner_ops *tuner_ops = NULL;
993
993
 
994
994
        if (demod_probe & 4) {
995
 
                d->fe = dvb_attach(stv0900_attach, &dw2104a_stv0900_config,
 
995
                d->fe_adap[0].fe = dvb_attach(stv0900_attach, &dw2104a_stv0900_config,
996
996
                                &d->dev->i2c_adap, 0);
997
 
                if (d->fe != NULL) {
998
 
                        if (dvb_attach(stb6100_attach, d->fe,
 
997
                if (d->fe_adap[0].fe != NULL) {
 
998
                        if (dvb_attach(stb6100_attach, d->fe_adap[0].fe,
999
999
                                        &dw2104a_stb6100_config,
1000
1000
                                        &d->dev->i2c_adap)) {
1001
 
                                tuner_ops = &d->fe->ops.tuner_ops;
 
1001
                                tuner_ops = &d->fe_adap[0].fe->ops.tuner_ops;
1002
1002
                                tuner_ops->set_frequency = stb6100_set_freq;
1003
1003
                                tuner_ops->get_frequency = stb6100_get_freq;
1004
1004
                                tuner_ops->set_bandwidth = stb6100_set_bandw;
1005
1005
                                tuner_ops->get_bandwidth = stb6100_get_bandw;
1006
 
                                d->fe->ops.set_voltage = dw210x_set_voltage;
 
1006
                                d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
1007
1007
                                info("Attached STV0900+STB6100!\n");
1008
1008
                                return 0;
1009
1009
                        }
1011
1011
        }
1012
1012
 
1013
1013
        if (demod_probe & 2) {
1014
 
                d->fe = dvb_attach(stv0900_attach, &dw2104_stv0900_config,
 
1014
                d->fe_adap[0].fe = dvb_attach(stv0900_attach, &dw2104_stv0900_config,
1015
1015
                                &d->dev->i2c_adap, 0);
1016
 
                if (d->fe != NULL) {
1017
 
                        if (dvb_attach(stv6110_attach, d->fe,
 
1016
                if (d->fe_adap[0].fe != NULL) {
 
1017
                        if (dvb_attach(stv6110_attach, d->fe_adap[0].fe,
1018
1018
                                        &dw2104_stv6110_config,
1019
1019
                                        &d->dev->i2c_adap)) {
1020
 
                                d->fe->ops.set_voltage = dw210x_set_voltage;
 
1020
                                d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
1021
1021
                                info("Attached STV0900+STV6110A!\n");
1022
1022
                                return 0;
1023
1023
                        }
1025
1025
        }
1026
1026
 
1027
1027
        if (demod_probe & 1) {
1028
 
                d->fe = dvb_attach(cx24116_attach, &dw2104_config,
 
1028
                d->fe_adap[0].fe = dvb_attach(cx24116_attach, &dw2104_config,
1029
1029
                                &d->dev->i2c_adap);
1030
 
                if (d->fe != NULL) {
1031
 
                        d->fe->ops.set_voltage = dw210x_set_voltage;
 
1030
                if (d->fe_adap[0].fe != NULL) {
 
1031
                        d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
1032
1032
                        info("Attached cx24116!\n");
1033
1033
                        return 0;
1034
1034
                }
1035
1035
        }
1036
1036
 
1037
 
        d->fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config,
 
1037
        d->fe_adap[0].fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config,
1038
1038
                        &d->dev->i2c_adap);
1039
 
        if (d->fe != NULL) {
1040
 
                d->fe->ops.set_voltage = dw210x_set_voltage;
 
1039
        if (d->fe_adap[0].fe != NULL) {
 
1040
                d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
1041
1041
                info("Attached DS3000!\n");
1042
1042
                return 0;
1043
1043
        }
1053
1053
{
1054
1054
        if (dw2102_properties.i2c_algo == &dw2102_serit_i2c_algo) {
1055
1055
                /*dw2102_properties.adapter->tuner_attach = NULL;*/
1056
 
                d->fe = dvb_attach(si21xx_attach, &serit_sp1511lhb_config,
 
1056
                d->fe_adap[0].fe = dvb_attach(si21xx_attach, &serit_sp1511lhb_config,
1057
1057
                                        &d->dev->i2c_adap);
1058
 
                if (d->fe != NULL) {
1059
 
                        d->fe->ops.set_voltage = dw210x_set_voltage;
 
1058
                if (d->fe_adap[0].fe != NULL) {
 
1059
                        d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
1060
1060
                        info("Attached si21xx!\n");
1061
1061
                        return 0;
1062
1062
                }
1063
1063
        }
1064
1064
 
1065
1065
        if (dw2102_properties.i2c_algo == &dw2102_earda_i2c_algo) {
1066
 
                d->fe = dvb_attach(stv0288_attach, &earda_config,
 
1066
                d->fe_adap[0].fe = dvb_attach(stv0288_attach, &earda_config,
1067
1067
                                        &d->dev->i2c_adap);
1068
 
                if (d->fe != NULL) {
1069
 
                        if (dvb_attach(stb6000_attach, d->fe, 0x61,
 
1068
                if (d->fe_adap[0].fe != NULL) {
 
1069
                        if (dvb_attach(stb6000_attach, d->fe_adap[0].fe, 0x61,
1070
1070
                                        &d->dev->i2c_adap)) {
1071
 
                                d->fe->ops.set_voltage = dw210x_set_voltage;
 
1071
                                d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
1072
1072
                                info("Attached stv0288!\n");
1073
1073
                                return 0;
1074
1074
                        }
1077
1077
 
1078
1078
        if (dw2102_properties.i2c_algo == &dw2102_i2c_algo) {
1079
1079
                /*dw2102_properties.adapter->tuner_attach = dw2102_tuner_attach;*/
1080
 
                d->fe = dvb_attach(stv0299_attach, &sharp_z0194a_config,
 
1080
                d->fe_adap[0].fe = dvb_attach(stv0299_attach, &sharp_z0194a_config,
1081
1081
                                        &d->dev->i2c_adap);
1082
 
                if (d->fe != NULL) {
1083
 
                        d->fe->ops.set_voltage = dw210x_set_voltage;
 
1082
                if (d->fe_adap[0].fe != NULL) {
 
1083
                        d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
1084
1084
                        info("Attached stv0299!\n");
1085
1085
                        return 0;
1086
1086
                }
1090
1090
 
1091
1091
static int dw3101_frontend_attach(struct dvb_usb_adapter *d)
1092
1092
{
1093
 
        d->fe = dvb_attach(tda10023_attach, &dw3101_tda10023_config,
 
1093
        d->fe_adap[0].fe = dvb_attach(tda10023_attach, &dw3101_tda10023_config,
1094
1094
                                &d->dev->i2c_adap, 0x48);
1095
 
        if (d->fe != NULL) {
 
1095
        if (d->fe_adap[0].fe != NULL) {
1096
1096
                info("Attached tda10023!\n");
1097
1097
                return 0;
1098
1098
        }
1101
1101
 
1102
1102
static int zl100313_frontend_attach(struct dvb_usb_adapter *d)
1103
1103
{
1104
 
        d->fe = dvb_attach(mt312_attach, &zl313_config,
 
1104
        d->fe_adap[0].fe = dvb_attach(mt312_attach, &zl313_config,
1105
1105
                        &d->dev->i2c_adap);
1106
 
        if (d->fe != NULL) {
1107
 
                if (dvb_attach(zl10039_attach, d->fe, 0x60,
 
1106
        if (d->fe_adap[0].fe != NULL) {
 
1107
                if (dvb_attach(zl10039_attach, d->fe_adap[0].fe, 0x60,
1108
1108
                                &d->dev->i2c_adap)) {
1109
 
                        d->fe->ops.set_voltage = dw210x_set_voltage;
 
1109
                        d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
1110
1110
                        info("Attached zl100313+zl10039!\n");
1111
1111
                        return 0;
1112
1112
                }
1119
1119
{
1120
1120
        u8 obuf[] = {7, 1};
1121
1121
 
1122
 
        d->fe = dvb_attach(stv0288_attach, &earda_config,
 
1122
        d->fe_adap[0].fe = dvb_attach(stv0288_attach, &earda_config,
1123
1123
                        &d->dev->i2c_adap);
1124
1124
 
1125
 
        if (d->fe == NULL)
1126
 
                return -EIO;
1127
 
 
1128
 
        if (NULL == dvb_attach(stb6000_attach, d->fe, 0x61, &d->dev->i2c_adap))
1129
 
                return -EIO;
1130
 
 
1131
 
        d->fe->ops.set_voltage = dw210x_set_voltage;
 
1125
        if (d->fe_adap[0].fe == NULL)
 
1126
                return -EIO;
 
1127
 
 
1128
        if (NULL == dvb_attach(stb6000_attach, d->fe_adap[0].fe, 0x61, &d->dev->i2c_adap))
 
1129
                return -EIO;
 
1130
 
 
1131
        d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
1132
1132
 
1133
1133
        dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG);
1134
1134
 
1143
1143
        struct s6x0_state *st = (struct s6x0_state *)d->dev->priv;
1144
1144
        u8 obuf[] = {7, 1};
1145
1145
 
1146
 
        d->fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config,
 
1146
        d->fe_adap[0].fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config,
1147
1147
                        &d->dev->i2c_adap);
1148
1148
 
1149
 
        if (d->fe == NULL)
 
1149
        if (d->fe_adap[0].fe == NULL)
1150
1150
                return -EIO;
1151
1151
 
1152
 
        st->old_set_voltage = d->fe->ops.set_voltage;
1153
 
        d->fe->ops.set_voltage = s660_set_voltage;
 
1152
        st->old_set_voltage = d->fe_adap[0].fe->ops.set_voltage;
 
1153
        d->fe_adap[0].fe->ops.set_voltage = s660_set_voltage;
1154
1154
 
1155
1155
        dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG);
1156
1156
 
1163
1163
{
1164
1164
        u8 obuf[] = {7, 1};
1165
1165
 
1166
 
        d->fe = dvb_attach(stv0900_attach, &prof_7500_stv0900_config,
 
1166
        d->fe_adap[0].fe = dvb_attach(stv0900_attach, &prof_7500_stv0900_config,
1167
1167
                                        &d->dev->i2c_adap, 0);
1168
 
        if (d->fe == NULL)
 
1168
        if (d->fe_adap[0].fe == NULL)
1169
1169
                return -EIO;
1170
1170
 
1171
 
        d->fe->ops.set_voltage = dw210x_set_voltage;
 
1171
        d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
1172
1172
 
1173
1173
        dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG);
1174
1174
 
1204
1204
        if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
1205
1205
                err("command 0x51 transfer failed.");
1206
1206
 
1207
 
        d->fe = dvb_attach(ds3000_attach, &su3000_ds3000_config,
 
1207
        d->fe_adap[0].fe = dvb_attach(ds3000_attach, &su3000_ds3000_config,
1208
1208
                                        &d->dev->i2c_adap);
1209
 
        if (d->fe == NULL)
 
1209
        if (d->fe_adap[0].fe == NULL)
1210
1210
                return -EIO;
1211
1211
 
1212
1212
        info("Attached DS3000!\n");
1216
1216
 
1217
1217
static int dw2102_tuner_attach(struct dvb_usb_adapter *adap)
1218
1218
{
1219
 
        dvb_attach(dvb_pll_attach, adap->fe, 0x60,
 
1219
        dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
1220
1220
                &adap->dev->i2c_adap, DVB_PLL_OPERA1);
1221
1221
        return 0;
1222
1222
}
1223
1223
 
1224
1224
static int dw3101_tuner_attach(struct dvb_usb_adapter *adap)
1225
1225
{
1226
 
        dvb_attach(dvb_pll_attach, adap->fe, 0x60,
 
1226
        dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
1227
1227
                &adap->dev->i2c_adap, DVB_PLL_TUA6034);
1228
1228
 
1229
1229
        return 0;
1535
1535
                                        DW210X_READ_MSG);
1536
1536
                        if ((reset16[0] == 0xa1) || (reset16[0] == 0x80)) {
1537
1537
                                dw2102_properties.i2c_algo = &dw2102_i2c_algo;
1538
 
                                dw2102_properties.adapter->tuner_attach = &dw2102_tuner_attach;
 
1538
                                dw2102_properties.adapter->fe[0].tuner_attach = &dw2102_tuner_attach;
1539
1539
                                break;
1540
1540
                        } else {
1541
1541
                                /* check STV0288 frontend  */
1591
1591
        .read_mac_address = dw210x_read_mac_address,
1592
1592
        .adapter = {
1593
1593
                {
 
1594
                .num_frontends = 1,
 
1595
                .fe = {{
1594
1596
                        .frontend_attach = dw2102_frontend_attach,
1595
1597
                        .stream = {
1596
1598
                                .type = USB_BULK,
1602
1604
                                        }
1603
1605
                                }
1604
1606
                        },
 
1607
                }},
1605
1608
                }
1606
1609
        },
1607
1610
        .num_device_descs = 3,
1642
1645
        .read_mac_address = dw210x_read_mac_address,
1643
1646
        .adapter = {
1644
1647
                {
 
1648
                .num_frontends = 1,
 
1649
                .fe = {{
1645
1650
                        .frontend_attach = dw2104_frontend_attach,
1646
1651
                        .stream = {
1647
1652
                                .type = USB_BULK,
1653
1658
                                        }
1654
1659
                                }
1655
1660
                        },
 
1661
                }},
1656
1662
                }
1657
1663
        },
1658
1664
        .num_device_descs = 2,
1689
1695
        .read_mac_address = dw210x_read_mac_address,
1690
1696
        .adapter = {
1691
1697
                {
 
1698
                .num_frontends = 1,
 
1699
                .fe = {{
1692
1700
                        .frontend_attach = dw3101_frontend_attach,
1693
1701
                        .tuner_attach = dw3101_tuner_attach,
1694
1702
                        .stream = {
1701
1709
                                        }
1702
1710
                                }
1703
1711
                        },
 
1712
                }},
1704
1713
                }
1705
1714
        },
1706
1715
        .num_device_descs = 1,
1733
1742
        .read_mac_address = s6x0_read_mac_address,
1734
1743
        .adapter = {
1735
1744
                {
 
1745
                .num_frontends = 1,
 
1746
                .fe = {{
1736
1747
                        .frontend_attach = zl100313_frontend_attach,
1737
1748
                        .stream = {
1738
1749
                                .type = USB_BULK,
1744
1755
                                        }
1745
1756
                                }
1746
1757
                        },
 
1758
                }},
1747
1759
                }
1748
1760
        },
1749
1761
        .num_device_descs = 1,
1810
1822
 
1811
1823
        .adapter = {
1812
1824
                {
 
1825
                .num_frontends = 1,
 
1826
                .fe = {{
1813
1827
                        .streaming_ctrl   = su3000_streaming_ctrl,
1814
1828
                        .frontend_attach  = su3000_frontend_attach,
1815
1829
                        .stream = {
1822
1836
                                        }
1823
1837
                                }
1824
1838
                        }
 
1839
                }},
1825
1840
                }
1826
1841
        },
1827
1842
        .num_device_descs = 3,
1855
1870
        p1100->devices[0] = d1100;
1856
1871
        p1100->rc.legacy.rc_map_table = rc_map_tbs_table;
1857
1872
        p1100->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table);
1858
 
        p1100->adapter->frontend_attach = stv0288_frontend_attach;
 
1873
        p1100->adapter->fe[0].frontend_attach = stv0288_frontend_attach;
1859
1874
 
1860
1875
        s660 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
1861
1876
        if (!s660) {
1869
1884
        s660->devices[0] = d660;
1870
1885
        s660->devices[1] = d480_1;
1871
1886
        s660->devices[2] = d480_2;
1872
 
        s660->adapter->frontend_attach = ds3000_frontend_attach;
 
1887
        s660->adapter->fe[0].frontend_attach = ds3000_frontend_attach;
1873
1888
 
1874
1889
        p7500 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
1875
1890
        if (!p7500) {
1883
1898
        p7500->devices[0] = d7500;
1884
1899
        p7500->rc.legacy.rc_map_table = rc_map_tbs_table;
1885
1900
        p7500->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table);
1886
 
        p7500->adapter->frontend_attach = prof_7500_frontend_attach;
 
1901
        p7500->adapter->fe[0].frontend_attach = prof_7500_frontend_attach;
1887
1902
 
1888
1903
        if (0 == dvb_usb_device_init(intf, &dw2102_properties,
1889
1904
                        THIS_MODULE, NULL, adapter_nr) ||