aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2014-12-23 12:09:13 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-03 13:26:37 -0500
commitde701f0ff14456204ad0077856c12f35070e5405 (patch)
treec179a694644872138a404d5630b71464e8e16dbb /drivers/media
parentd0f232e823af54a2554e371b5c96189facb1434b (diff)
[media] rtl28xxu: merge chip type specific all callbacks
Merge all chip type specific prefixed (rtl2831u_ and rtl2832u_) callback to top level callback prefixed as rtl28xxu_. rtl2831u_foo() => rtl28xxu_foo() rtl2832u_foo() => rtl28xxu_foo() Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/usb/dvb-usb-v2/rtl28xxu.c140
1 files changed, 94 insertions, 46 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 5bc77745b737..821dcbaba4ff 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -523,6 +523,16 @@ err:
523 return ret; 523 return ret;
524} 524}
525 525
526static int rtl28xxu_read_config(struct dvb_usb_device *d)
527{
528 struct rtl28xxu_dev *dev = d_to_priv(d);
529
530 if (dev->chip_id == CHIP_ID_RTL2831U)
531 return rtl2831u_read_config(d);
532 else
533 return rtl2832u_read_config(d);
534}
535
526static int rtl28xxu_identify_state(struct dvb_usb_device *d, const char **name) 536static int rtl28xxu_identify_state(struct dvb_usb_device *d, const char **name)
527{ 537{
528 struct rtl28xxu_dev *dev = d_to_priv(d); 538 struct rtl28xxu_dev *dev = d_to_priv(d);
@@ -906,7 +916,17 @@ err:
906 return ret; 916 return ret;
907} 917}
908 918
909static int rtl2832u_frontend_detach(struct dvb_usb_adapter *adap) 919static int rtl28xxu_frontend_attach(struct dvb_usb_adapter *adap)
920{
921 struct rtl28xxu_dev *dev = adap_to_priv(adap);
922
923 if (dev->chip_id == CHIP_ID_RTL2831U)
924 return rtl2831u_frontend_attach(adap);
925 else
926 return rtl2832u_frontend_attach(adap);
927}
928
929static int rtl28xxu_frontend_detach(struct dvb_usb_adapter *adap)
910{ 930{
911 struct dvb_usb_device *d = adap_to_d(adap); 931 struct dvb_usb_device *d = adap_to_d(adap);
912 struct rtl28xxu_dev *dev = d_to_priv(d); 932 struct rtl28xxu_dev *dev = d_to_priv(d);
@@ -1172,7 +1192,17 @@ err:
1172 return ret; 1192 return ret;
1173} 1193}
1174 1194
1175static int rtl2832u_tuner_detach(struct dvb_usb_adapter *adap) 1195static int rtl28xxu_tuner_attach(struct dvb_usb_adapter *adap)
1196{
1197 struct rtl28xxu_dev *dev = adap_to_priv(adap);
1198
1199 if (dev->chip_id == CHIP_ID_RTL2831U)
1200 return rtl2831u_tuner_attach(adap);
1201 else
1202 return rtl2832u_tuner_attach(adap);
1203}
1204
1205static int rtl28xxu_tuner_detach(struct dvb_usb_adapter *adap)
1176{ 1206{
1177 struct dvb_usb_device *d = adap_to_d(adap); 1207 struct dvb_usb_device *d = adap_to_d(adap);
1178 struct rtl28xxu_dev *dev = d_to_priv(d); 1208 struct rtl28xxu_dev *dev = d_to_priv(d);
@@ -1350,7 +1380,17 @@ err:
1350 return ret; 1380 return ret;
1351} 1381}
1352 1382
1353static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff) 1383static int rtl28xxu_power_ctrl(struct dvb_usb_device *d, int onoff)
1384{
1385 struct rtl28xxu_dev *dev = d_to_priv(d);
1386
1387 if (dev->chip_id == CHIP_ID_RTL2831U)
1388 return rtl2831u_power_ctrl(d, onoff);
1389 else
1390 return rtl2832u_power_ctrl(d, onoff);
1391}
1392
1393static int rtl28xxu_frontend_ctrl(struct dvb_frontend *fe, int onoff)
1354{ 1394{
1355 struct dvb_usb_device *d = fe_to_d(fe); 1395 struct dvb_usb_device *d = fe_to_d(fe);
1356 struct rtl28xxu_dev *dev = fe_to_priv(fe); 1396 struct rtl28xxu_dev *dev = fe_to_priv(fe);
@@ -1360,6 +1400,9 @@ static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff)
1360 1400
1361 dev_dbg(&d->intf->dev, "fe=%d onoff=%d\n", fe->id, onoff); 1401 dev_dbg(&d->intf->dev, "fe=%d onoff=%d\n", fe->id, onoff);
1362 1402
1403 if (dev->chip_id == CHIP_ID_RTL2831U)
1404 return 0;
1405
1363 /* control internal demod ADC */ 1406 /* control internal demod ADC */
1364 if (fe->id == 0 && onoff) 1407 if (fe->id == 0 && onoff)
1365 val = 0x48; /* enable ADC */ 1408 val = 0x48; /* enable ADC */
@@ -1572,45 +1615,50 @@ static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
1572 1615
1573 return 0; 1616 return 0;
1574} 1617}
1575#else
1576#define rtl2831u_get_rc_config NULL
1577#define rtl2832u_get_rc_config NULL
1578#endif
1579 1618
1580static int rtl2831u_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) 1619static int rtl28xxu_get_rc_config(struct dvb_usb_device *d,
1620 struct dvb_usb_rc *rc)
1581{ 1621{
1582 struct dvb_usb_device *d = adap_to_d(adap);
1583 struct rtl28xxu_dev *dev = d_to_priv(d); 1622 struct rtl28xxu_dev *dev = d_to_priv(d);
1584 struct rtl2830_platform_data *pdata = &dev->rtl2830_platform_data;
1585 1623
1586 return pdata->pid_filter_ctrl(adap->fe[0], onoff); 1624 if (dev->chip_id == CHIP_ID_RTL2831U)
1625 return rtl2831u_get_rc_config(d, rc);
1626 else
1627 return rtl2832u_get_rc_config(d, rc);
1587} 1628}
1629#else
1630#define rtl28xxu_get_rc_config NULL
1631#endif
1588 1632
1589static int rtl2832u_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) 1633static int rtl28xxu_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
1590{ 1634{
1591 struct dvb_usb_device *d = adap_to_d(adap); 1635 struct rtl28xxu_dev *dev = adap_to_priv(adap);
1592 struct rtl28xxu_dev *dev = d_to_priv(d);
1593 struct rtl2832_platform_data *pdata = &dev->rtl2832_platform_data;
1594 1636
1595 return pdata->pid_filter_ctrl(adap->fe[0], onoff); 1637 if (dev->chip_id == CHIP_ID_RTL2831U) {
1596} 1638 struct rtl2830_platform_data *pdata = &dev->rtl2830_platform_data;
1597 1639
1598static int rtl2831u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) 1640 return pdata->pid_filter_ctrl(adap->fe[0], onoff);
1599{ 1641 } else {
1600 struct dvb_usb_device *d = adap_to_d(adap); 1642 struct rtl2832_platform_data *pdata = &dev->rtl2832_platform_data;
1601 struct rtl28xxu_dev *dev = d_to_priv(d);
1602 struct rtl2830_platform_data *pdata = &dev->rtl2830_platform_data;
1603 1643
1604 return pdata->pid_filter(adap->fe[0], index, pid, onoff); 1644 return pdata->pid_filter_ctrl(adap->fe[0], onoff);
1645 }
1605} 1646}
1606 1647
1607static int rtl2832u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) 1648static int rtl28xxu_pid_filter(struct dvb_usb_adapter *adap, int index,
1649 u16 pid, int onoff)
1608{ 1650{
1609 struct dvb_usb_device *d = adap_to_d(adap); 1651 struct rtl28xxu_dev *dev = adap_to_priv(adap);
1610 struct rtl28xxu_dev *dev = d_to_priv(d); 1652
1611 struct rtl2832_platform_data *pdata = &dev->rtl2832_platform_data; 1653 if (dev->chip_id == CHIP_ID_RTL2831U) {
1654 struct rtl2830_platform_data *pdata = &dev->rtl2830_platform_data;
1612 1655
1613 return pdata->pid_filter(adap->fe[0], index, pid, onoff); 1656 return pdata->pid_filter(adap->fe[0], index, pid, onoff);
1657 } else {
1658 struct rtl2832_platform_data *pdata = &dev->rtl2832_platform_data;
1659
1660 return pdata->pid_filter(adap->fe[0], index, pid, onoff);
1661 }
1614} 1662}
1615 1663
1616static const struct dvb_usb_device_properties rtl2831u_props = { 1664static const struct dvb_usb_device_properties rtl2831u_props = {
@@ -1620,14 +1668,14 @@ static const struct dvb_usb_device_properties rtl2831u_props = {
1620 .size_of_priv = sizeof(struct rtl28xxu_dev), 1668 .size_of_priv = sizeof(struct rtl28xxu_dev),
1621 1669
1622 .identify_state = rtl28xxu_identify_state, 1670 .identify_state = rtl28xxu_identify_state,
1623 .power_ctrl = rtl2831u_power_ctrl, 1671 .power_ctrl = rtl28xxu_power_ctrl,
1624 .i2c_algo = &rtl28xxu_i2c_algo, 1672 .i2c_algo = &rtl28xxu_i2c_algo,
1625 .read_config = rtl2831u_read_config, 1673 .read_config = rtl28xxu_read_config,
1626 .frontend_attach = rtl2831u_frontend_attach, 1674 .frontend_attach = rtl28xxu_frontend_attach,
1627 .frontend_detach = rtl2832u_frontend_detach, 1675 .frontend_detach = rtl28xxu_frontend_detach,
1628 .tuner_attach = rtl2831u_tuner_attach, 1676 .tuner_attach = rtl28xxu_tuner_attach,
1629 .init = rtl28xxu_init, 1677 .init = rtl28xxu_init,
1630 .get_rc_config = rtl2831u_get_rc_config, 1678 .get_rc_config = rtl28xxu_get_rc_config,
1631 1679
1632 .num_adapters = 1, 1680 .num_adapters = 1,
1633 .adapter = { 1681 .adapter = {
@@ -1636,8 +1684,8 @@ static const struct dvb_usb_device_properties rtl2831u_props = {
1636 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 1684 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1637 1685
1638 .pid_filter_count = 32, 1686 .pid_filter_count = 32,
1639 .pid_filter_ctrl = rtl2831u_pid_filter_ctrl, 1687 .pid_filter_ctrl = rtl28xxu_pid_filter_ctrl,
1640 .pid_filter = rtl2831u_pid_filter, 1688 .pid_filter = rtl28xxu_pid_filter,
1641 1689
1642 .stream = DVB_USB_STREAM_BULK(0x81, 6, 8 * 512), 1690 .stream = DVB_USB_STREAM_BULK(0x81, 6, 8 * 512),
1643 }, 1691 },
@@ -1651,16 +1699,16 @@ static const struct dvb_usb_device_properties rtl2832u_props = {
1651 .size_of_priv = sizeof(struct rtl28xxu_dev), 1699 .size_of_priv = sizeof(struct rtl28xxu_dev),
1652 1700
1653 .identify_state = rtl28xxu_identify_state, 1701 .identify_state = rtl28xxu_identify_state,
1654 .power_ctrl = rtl2832u_power_ctrl, 1702 .power_ctrl = rtl28xxu_power_ctrl,
1655 .frontend_ctrl = rtl2832u_frontend_ctrl, 1703 .frontend_ctrl = rtl28xxu_frontend_ctrl,
1656 .i2c_algo = &rtl28xxu_i2c_algo, 1704 .i2c_algo = &rtl28xxu_i2c_algo,
1657 .read_config = rtl2832u_read_config, 1705 .read_config = rtl28xxu_read_config,
1658 .frontend_attach = rtl2832u_frontend_attach, 1706 .frontend_attach = rtl28xxu_frontend_attach,
1659 .frontend_detach = rtl2832u_frontend_detach, 1707 .frontend_detach = rtl28xxu_frontend_detach,
1660 .tuner_attach = rtl2832u_tuner_attach, 1708 .tuner_attach = rtl28xxu_tuner_attach,
1661 .tuner_detach = rtl2832u_tuner_detach, 1709 .tuner_detach = rtl28xxu_tuner_detach,
1662 .init = rtl28xxu_init, 1710 .init = rtl28xxu_init,
1663 .get_rc_config = rtl2832u_get_rc_config, 1711 .get_rc_config = rtl28xxu_get_rc_config,
1664 1712
1665 .num_adapters = 1, 1713 .num_adapters = 1,
1666 .adapter = { 1714 .adapter = {
@@ -1669,8 +1717,8 @@ static const struct dvb_usb_device_properties rtl2832u_props = {
1669 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 1717 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1670 1718
1671 .pid_filter_count = 32, 1719 .pid_filter_count = 32,
1672 .pid_filter_ctrl = rtl2832u_pid_filter_ctrl, 1720 .pid_filter_ctrl = rtl28xxu_pid_filter_ctrl,
1673 .pid_filter = rtl2832u_pid_filter, 1721 .pid_filter = rtl28xxu_pid_filter,
1674 1722
1675 .stream = DVB_USB_STREAM_BULK(0x81, 6, 8 * 512), 1723 .stream = DVB_USB_STREAM_BULK(0x81, 6, 8 * 512),
1676 }, 1724 },