aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/ttpci')
-rw-r--r--drivers/media/dvb/ttpci/av7110.c102
-rw-r--r--drivers/media/dvb/ttpci/av7110.h3
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c50
-rw-r--r--drivers/media/dvb/ttpci/budget-ci.c51
-rw-r--r--drivers/media/dvb/ttpci/budget-patch.c27
-rw-r--r--drivers/media/dvb/ttpci/budget.c68
6 files changed, 175 insertions, 126 deletions
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 3d20719fce1a..6ecbcf614878 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -991,7 +991,7 @@ static int av7110_start_feed(struct dvb_demux_feed *feed)
991 991
992 if (feed->type == DMX_TYPE_TS) { 992 if (feed->type == DMX_TYPE_TS) {
993 if ((feed->ts_type & TS_DECODER) && 993 if ((feed->ts_type & TS_DECODER) &&
994 (feed->pes_type < DMX_TS_PES_OTHER)) { 994 (feed->pes_type <= DMX_TS_PES_PCR)) {
995 switch (demux->dmx.frontend->source) { 995 switch (demux->dmx.frontend->source) {
996 case DMX_MEMORY_FE: 996 case DMX_MEMORY_FE:
997 if (feed->ts_type & TS_DECODER) 997 if (feed->ts_type & TS_DECODER)
@@ -1568,20 +1568,27 @@ static int get_firmware(struct av7110* av7110)
1568 return ret; 1568 return ret;
1569} 1569}
1570 1570
1571static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) 1571static int alps_bsrv2_tuner_set_params(struct dvb_frontend *fe)
1572{ 1572{
1573 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1573 struct av7110* av7110 = fe->dvb->priv; 1574 struct av7110* av7110 = fe->dvb->priv;
1574 u8 pwr = 0; 1575 u8 pwr = 0;
1575 u8 buf[4]; 1576 u8 buf[4];
1576 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; 1577 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) };
1577 u32 div = (params->frequency + 479500) / 125; 1578 u32 div = (p->frequency + 479500) / 125;
1578 1579
1579 if (params->frequency > 2000000) pwr = 3; 1580 if (p->frequency > 2000000)
1580 else if (params->frequency > 1800000) pwr = 2; 1581 pwr = 3;
1581 else if (params->frequency > 1600000) pwr = 1; 1582 else if (p->frequency > 1800000)
1582 else if (params->frequency > 1200000) pwr = 0; 1583 pwr = 2;
1583 else if (params->frequency >= 1100000) pwr = 1; 1584 else if (p->frequency > 1600000)
1584 else pwr = 2; 1585 pwr = 1;
1586 else if (p->frequency > 1200000)
1587 pwr = 0;
1588 else if (p->frequency >= 1100000)
1589 pwr = 1;
1590 else
1591 pwr = 2;
1585 1592
1586 buf[0] = (div >> 8) & 0x7f; 1593 buf[0] = (div >> 8) & 0x7f;
1587 buf[1] = div & 0xff; 1594 buf[1] = div & 0xff;
@@ -1604,19 +1611,20 @@ static struct ves1x93_config alps_bsrv2_config = {
1604 .invert_pwm = 0, 1611 .invert_pwm = 0,
1605}; 1612};
1606 1613
1607static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) 1614static int alps_tdbe2_tuner_set_params(struct dvb_frontend *fe)
1608{ 1615{
1616 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1609 struct av7110* av7110 = fe->dvb->priv; 1617 struct av7110* av7110 = fe->dvb->priv;
1610 u32 div; 1618 u32 div;
1611 u8 data[4]; 1619 u8 data[4];
1612 struct i2c_msg msg = { .addr = 0x62, .flags = 0, .buf = data, .len = sizeof(data) }; 1620 struct i2c_msg msg = { .addr = 0x62, .flags = 0, .buf = data, .len = sizeof(data) };
1613 1621
1614 div = (params->frequency + 35937500 + 31250) / 62500; 1622 div = (p->frequency + 35937500 + 31250) / 62500;
1615 1623
1616 data[0] = (div >> 8) & 0x7f; 1624 data[0] = (div >> 8) & 0x7f;
1617 data[1] = div & 0xff; 1625 data[1] = div & 0xff;
1618 data[2] = 0x85 | ((div >> 10) & 0x60); 1626 data[2] = 0x85 | ((div >> 10) & 0x60);
1619 data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); 1627 data[3] = (p->frequency < 174000000 ? 0x88 : p->frequency < 470000000 ? 0x84 : 0x81);
1620 1628
1621 if (fe->ops.i2c_gate_ctrl) 1629 if (fe->ops.i2c_gate_ctrl)
1622 fe->ops.i2c_gate_ctrl(fe, 1); 1630 fe->ops.i2c_gate_ctrl(fe, 1);
@@ -1635,14 +1643,15 @@ static struct ves1820_config alps_tdbe2_config = {
1635 1643
1636 1644
1637 1645
1638static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) 1646static int grundig_29504_451_tuner_set_params(struct dvb_frontend *fe)
1639{ 1647{
1648 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1640 struct av7110* av7110 = fe->dvb->priv; 1649 struct av7110* av7110 = fe->dvb->priv;
1641 u32 div; 1650 u32 div;
1642 u8 data[4]; 1651 u8 data[4];
1643 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; 1652 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
1644 1653
1645 div = params->frequency / 125; 1654 div = p->frequency / 125;
1646 data[0] = (div >> 8) & 0x7f; 1655 data[0] = (div >> 8) & 0x7f;
1647 data[1] = div & 0xff; 1656 data[1] = div & 0xff;
1648 data[2] = 0x8e; 1657 data[2] = 0x8e;
@@ -1661,11 +1670,12 @@ static struct tda8083_config grundig_29504_451_config = {
1661 1670
1662 1671
1663 1672
1664static int philips_cd1516_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) 1673static int philips_cd1516_tuner_set_params(struct dvb_frontend *fe)
1665{ 1674{
1675 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1666 struct av7110* av7110 = fe->dvb->priv; 1676 struct av7110* av7110 = fe->dvb->priv;
1667 u32 div; 1677 u32 div;
1668 u32 f = params->frequency; 1678 u32 f = p->frequency;
1669 u8 data[4]; 1679 u8 data[4];
1670 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; 1680 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
1671 1681
@@ -1692,16 +1702,17 @@ static struct ves1820_config philips_cd1516_config = {
1692 1702
1693 1703
1694 1704
1695static int alps_tdlb7_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) 1705static int alps_tdlb7_tuner_set_params(struct dvb_frontend *fe)
1696{ 1706{
1707 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1697 struct av7110* av7110 = fe->dvb->priv; 1708 struct av7110* av7110 = fe->dvb->priv;
1698 u32 div, pwr; 1709 u32 div, pwr;
1699 u8 data[4]; 1710 u8 data[4];
1700 struct i2c_msg msg = { .addr = 0x60, .flags = 0, .buf = data, .len = sizeof(data) }; 1711 struct i2c_msg msg = { .addr = 0x60, .flags = 0, .buf = data, .len = sizeof(data) };
1701 1712
1702 div = (params->frequency + 36200000) / 166666; 1713 div = (p->frequency + 36200000) / 166666;
1703 1714
1704 if (params->frequency <= 782000000) 1715 if (p->frequency <= 782000000)
1705 pwr = 1; 1716 pwr = 1;
1706 else 1717 else
1707 pwr = 2; 1718 pwr = 2;
@@ -1829,8 +1840,9 @@ static u8 nexusca_stv0297_inittab[] = {
1829 0xff, 0xff, 1840 0xff, 0xff,
1830}; 1841};
1831 1842
1832static int nexusca_stv0297_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) 1843static int nexusca_stv0297_tuner_set_params(struct dvb_frontend *fe)
1833{ 1844{
1845 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1834 struct av7110* av7110 = fe->dvb->priv; 1846 struct av7110* av7110 = fe->dvb->priv;
1835 u32 div; 1847 u32 div;
1836 u8 data[4]; 1848 u8 data[4];
@@ -1838,19 +1850,19 @@ static int nexusca_stv0297_tuner_set_params(struct dvb_frontend* fe, struct dvb_
1838 struct i2c_msg readmsg = { .addr = 0x63, .flags = I2C_M_RD, .buf = data, .len = 1 }; 1850 struct i2c_msg readmsg = { .addr = 0x63, .flags = I2C_M_RD, .buf = data, .len = 1 };
1839 int i; 1851 int i;
1840 1852
1841 div = (params->frequency + 36150000 + 31250) / 62500; 1853 div = (p->frequency + 36150000 + 31250) / 62500;
1842 1854
1843 data[0] = (div >> 8) & 0x7f; 1855 data[0] = (div >> 8) & 0x7f;
1844 data[1] = div & 0xff; 1856 data[1] = div & 0xff;
1845 data[2] = 0xce; 1857 data[2] = 0xce;
1846 1858
1847 if (params->frequency < 45000000) 1859 if (p->frequency < 45000000)
1848 return -EINVAL; 1860 return -EINVAL;
1849 else if (params->frequency < 137000000) 1861 else if (p->frequency < 137000000)
1850 data[3] = 0x01; 1862 data[3] = 0x01;
1851 else if (params->frequency < 403000000) 1863 else if (p->frequency < 403000000)
1852 data[3] = 0x02; 1864 data[3] = 0x02;
1853 else if (params->frequency < 860000000) 1865 else if (p->frequency < 860000000)
1854 data[3] = 0x04; 1866 data[3] = 0x04;
1855 else 1867 else
1856 return -EINVAL; 1868 return -EINVAL;
@@ -1884,27 +1896,36 @@ static struct stv0297_config nexusca_stv0297_config = {
1884 1896
1885 1897
1886 1898
1887static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) 1899static int grundig_29504_401_tuner_set_params(struct dvb_frontend *fe)
1888{ 1900{
1901 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1889 struct av7110* av7110 = fe->dvb->priv; 1902 struct av7110* av7110 = fe->dvb->priv;
1890 u32 div; 1903 u32 div;
1891 u8 cfg, cpump, band_select; 1904 u8 cfg, cpump, band_select;
1892 u8 data[4]; 1905 u8 data[4];
1893 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; 1906 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
1894 1907
1895 div = (36125000 + params->frequency) / 166666; 1908 div = (36125000 + p->frequency) / 166666;
1896 1909
1897 cfg = 0x88; 1910 cfg = 0x88;
1898 1911
1899 if (params->frequency < 175000000) cpump = 2; 1912 if (p->frequency < 175000000)
1900 else if (params->frequency < 390000000) cpump = 1; 1913 cpump = 2;
1901 else if (params->frequency < 470000000) cpump = 2; 1914 else if (p->frequency < 390000000)
1902 else if (params->frequency < 750000000) cpump = 1; 1915 cpump = 1;
1903 else cpump = 3; 1916 else if (p->frequency < 470000000)
1917 cpump = 2;
1918 else if (p->frequency < 750000000)
1919 cpump = 1;
1920 else
1921 cpump = 3;
1904 1922
1905 if (params->frequency < 175000000) band_select = 0x0e; 1923 if (p->frequency < 175000000)
1906 else if (params->frequency < 470000000) band_select = 0x05; 1924 band_select = 0x0e;
1907 else band_select = 0x03; 1925 else if (p->frequency < 470000000)
1926 band_select = 0x05;
1927 else
1928 band_select = 0x03;
1908 1929
1909 data[0] = (div >> 8) & 0x7f; 1930 data[0] = (div >> 8) & 0x7f;
1910 data[1] = div & 0xff; 1931 data[1] = div & 0xff;
@@ -1964,15 +1985,14 @@ static int av7110_fe_lock_fix(struct av7110* av7110, fe_status_t status)
1964 return ret; 1985 return ret;
1965} 1986}
1966 1987
1967static int av7110_fe_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 1988static int av7110_fe_set_frontend(struct dvb_frontend *fe)
1968{ 1989{
1969 struct av7110* av7110 = fe->dvb->priv; 1990 struct av7110* av7110 = fe->dvb->priv;
1970 1991
1971 int ret = av7110_fe_lock_fix(av7110, 0); 1992 int ret = av7110_fe_lock_fix(av7110, 0);
1972 if (!ret) { 1993 if (!ret)
1973 av7110->saved_fe_params = *params; 1994 ret = av7110->fe_set_frontend(fe);
1974 ret = av7110->fe_set_frontend(fe, params); 1995
1975 }
1976 return ret; 1996 return ret;
1977} 1997}
1978 1998
@@ -2081,7 +2101,7 @@ static void dvb_s_recover(struct av7110* av7110)
2081 msleep(20); 2101 msleep(20);
2082 av7110_fe_set_tone(av7110->fe, av7110->saved_tone); 2102 av7110_fe_set_tone(av7110->fe, av7110->saved_tone);
2083 2103
2084 av7110_fe_set_frontend(av7110->fe, &av7110->saved_fe_params); 2104 av7110_fe_set_frontend(av7110->fe);
2085} 2105}
2086 2106
2087static u8 read_pwm(struct av7110* av7110) 2107static u8 read_pwm(struct av7110* av7110)
diff --git a/drivers/media/dvb/ttpci/av7110.h b/drivers/media/dvb/ttpci/av7110.h
index d85b8512ac30..88b3b2d6cc0e 100644
--- a/drivers/media/dvb/ttpci/av7110.h
+++ b/drivers/media/dvb/ttpci/av7110.h
@@ -272,7 +272,6 @@ struct av7110 {
272 272
273 /* crash recovery */ 273 /* crash recovery */
274 void (*recover)(struct av7110* av7110); 274 void (*recover)(struct av7110* av7110);
275 struct dvb_frontend_parameters saved_fe_params;
276 fe_sec_voltage_t saved_voltage; 275 fe_sec_voltage_t saved_voltage;
277 fe_sec_tone_mode_t saved_tone; 276 fe_sec_tone_mode_t saved_tone;
278 struct dvb_diseqc_master_cmd saved_master_cmd; 277 struct dvb_diseqc_master_cmd saved_master_cmd;
@@ -286,7 +285,7 @@ struct av7110 {
286 int (*fe_set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone); 285 int (*fe_set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);
287 int (*fe_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage); 286 int (*fe_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
288 int (*fe_dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd); 287 int (*fe_dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
289 int (*fe_set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); 288 int (*fe_set_frontend)(struct dvb_frontend *fe);
290}; 289};
291 290
292 291
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 78d32f7e49fc..8b32e282bf5d 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -502,33 +502,33 @@ static int philips_su1278_ty_ci_set_symbol_rate(struct dvb_frontend *fe, u32 sra
502 return 0; 502 return 0;
503} 503}
504 504
505static int philips_su1278_ty_ci_tuner_set_params(struct dvb_frontend *fe, 505static int philips_su1278_ty_ci_tuner_set_params(struct dvb_frontend *fe)
506 struct dvb_frontend_parameters *params)
507{ 506{
507 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
508 u32 div; 508 u32 div;
509 u8 buf[4]; 509 u8 buf[4];
510 struct budget *budget = (struct budget *) fe->dvb->priv; 510 struct budget *budget = (struct budget *) fe->dvb->priv;
511 struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; 511 struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) };
512 512
513 if ((params->frequency < 950000) || (params->frequency > 2150000)) 513 if ((c->frequency < 950000) || (c->frequency > 2150000))
514 return -EINVAL; 514 return -EINVAL;
515 515
516 div = (params->frequency + (125 - 1)) / 125; // round correctly 516 div = (c->frequency + (125 - 1)) / 125; /* round correctly */
517 buf[0] = (div >> 8) & 0x7f; 517 buf[0] = (div >> 8) & 0x7f;
518 buf[1] = div & 0xff; 518 buf[1] = div & 0xff;
519 buf[2] = 0x80 | ((div & 0x18000) >> 10) | 4; 519 buf[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
520 buf[3] = 0x20; 520 buf[3] = 0x20;
521 521
522 if (params->u.qpsk.symbol_rate < 4000000) 522 if (c->symbol_rate < 4000000)
523 buf[3] |= 1; 523 buf[3] |= 1;
524 524
525 if (params->frequency < 1250000) 525 if (c->frequency < 1250000)
526 buf[3] |= 0; 526 buf[3] |= 0;
527 else if (params->frequency < 1550000) 527 else if (c->frequency < 1550000)
528 buf[3] |= 0x40; 528 buf[3] |= 0x40;
529 else if (params->frequency < 2050000) 529 else if (c->frequency < 2050000)
530 buf[3] |= 0x80; 530 buf[3] |= 0x80;
531 else if (params->frequency < 2150000) 531 else if (c->frequency < 2150000)
532 buf[3] |= 0xC0; 532 buf[3] |= 0xC0;
533 533
534 if (fe->ops.i2c_gate_ctrl) 534 if (fe->ops.i2c_gate_ctrl)
@@ -617,8 +617,9 @@ static struct stv0299_config cinergy_1200s_1894_0010_config = {
617 .set_symbol_rate = philips_su1278_ty_ci_set_symbol_rate, 617 .set_symbol_rate = philips_su1278_ty_ci_set_symbol_rate,
618}; 618};
619 619
620static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 620static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe)
621{ 621{
622 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
622 struct budget *budget = (struct budget *) fe->dvb->priv; 623 struct budget *budget = (struct budget *) fe->dvb->priv;
623 u8 buf[6]; 624 u8 buf[6];
624 struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; 625 struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) };
@@ -627,13 +628,13 @@ static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_f
627#define CU1216_IF 36125000 628#define CU1216_IF 36125000
628#define TUNER_MUL 62500 629#define TUNER_MUL 62500
629 630
630 u32 div = (params->frequency + CU1216_IF + TUNER_MUL / 2) / TUNER_MUL; 631 u32 div = (c->frequency + CU1216_IF + TUNER_MUL / 2) / TUNER_MUL;
631 632
632 buf[0] = (div >> 8) & 0x7f; 633 buf[0] = (div >> 8) & 0x7f;
633 buf[1] = div & 0xff; 634 buf[1] = div & 0xff;
634 buf[2] = 0xce; 635 buf[2] = 0xce;
635 buf[3] = (params->frequency < 150000000 ? 0x01 : 636 buf[3] = (c->frequency < 150000000 ? 0x01 :
636 params->frequency < 445000000 ? 0x02 : 0x04); 637 c->frequency < 445000000 ? 0x02 : 0x04);
637 buf[4] = 0xde; 638 buf[4] = 0xde;
638 buf[5] = 0x20; 639 buf[5] = 0x20;
639 640
@@ -697,8 +698,9 @@ static int philips_tu1216_tuner_init(struct dvb_frontend *fe)
697 return 0; 698 return 0;
698} 699}
699 700
700static int philips_tu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 701static int philips_tu1216_tuner_set_params(struct dvb_frontend *fe)
701{ 702{
703 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
702 struct budget *budget = (struct budget *) fe->dvb->priv; 704 struct budget *budget = (struct budget *) fe->dvb->priv;
703 u8 tuner_buf[4]; 705 u8 tuner_buf[4];
704 struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,.len = 706 struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,.len =
@@ -707,7 +709,7 @@ static int philips_tu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_f
707 u8 band, cp, filter; 709 u8 band, cp, filter;
708 710
709 // determine charge pump 711 // determine charge pump
710 tuner_frequency = params->frequency + 36166000; 712 tuner_frequency = c->frequency + 36166000;
711 if (tuner_frequency < 87000000) 713 if (tuner_frequency < 87000000)
712 return -EINVAL; 714 return -EINVAL;
713 else if (tuner_frequency < 130000000) 715 else if (tuner_frequency < 130000000)
@@ -732,28 +734,28 @@ static int philips_tu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_f
732 return -EINVAL; 734 return -EINVAL;
733 735
734 // determine band 736 // determine band
735 if (params->frequency < 49000000) 737 if (c->frequency < 49000000)
736 return -EINVAL; 738 return -EINVAL;
737 else if (params->frequency < 161000000) 739 else if (c->frequency < 161000000)
738 band = 1; 740 band = 1;
739 else if (params->frequency < 444000000) 741 else if (c->frequency < 444000000)
740 band = 2; 742 band = 2;
741 else if (params->frequency < 861000000) 743 else if (c->frequency < 861000000)
742 band = 4; 744 band = 4;
743 else 745 else
744 return -EINVAL; 746 return -EINVAL;
745 747
746 // setup PLL filter 748 // setup PLL filter
747 switch (params->u.ofdm.bandwidth) { 749 switch (c->bandwidth_hz) {
748 case BANDWIDTH_6_MHZ: 750 case 6000000:
749 filter = 0; 751 filter = 0;
750 break; 752 break;
751 753
752 case BANDWIDTH_7_MHZ: 754 case 7000000:
753 filter = 0; 755 filter = 0;
754 break; 756 break;
755 757
756 case BANDWIDTH_8_MHZ: 758 case 8000000:
757 filter = 1; 759 filter = 1;
758 break; 760 break;
759 761
@@ -763,7 +765,7 @@ static int philips_tu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_f
763 765
764 // calculate divisor 766 // calculate divisor
765 // ((36166000+((1000000/6)/2)) + Finput)/(1000000/6) 767 // ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
766 tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000; 768 tuner_frequency = (((c->frequency / 1000) * 6) + 217496) / 1000;
767 769
768 // setup tuner buffer 770 // setup tuner buffer
769 tuner_buf[0] = (tuner_frequency >> 8) & 0x7f; 771 tuner_buf[0] = (tuner_frequency >> 8) & 0x7f;
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c
index ca02e9722172..98e524178765 100644
--- a/drivers/media/dvb/ttpci/budget-ci.c
+++ b/drivers/media/dvb/ttpci/budget-ci.c
@@ -193,7 +193,6 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
193 dev->input_phys = budget_ci->ir.phys; 193 dev->input_phys = budget_ci->ir.phys;
194 dev->input_id.bustype = BUS_PCI; 194 dev->input_id.bustype = BUS_PCI;
195 dev->input_id.version = 1; 195 dev->input_id.version = 1;
196 dev->scanmask = 0xff;
197 if (saa->pci->subsystem_vendor) { 196 if (saa->pci->subsystem_vendor) {
198 dev->input_id.vendor = saa->pci->subsystem_vendor; 197 dev->input_id.vendor = saa->pci->subsystem_vendor;
199 dev->input_id.product = saa->pci->subsystem_device; 198 dev->input_id.product = saa->pci->subsystem_device;
@@ -234,6 +233,8 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
234 dev->map_name = RC_MAP_BUDGET_CI_OLD; 233 dev->map_name = RC_MAP_BUDGET_CI_OLD;
235 break; 234 break;
236 } 235 }
236 if (!budget_ci->ir.full_rc5)
237 dev->scanmask = 0xff;
237 238
238 error = rc_register_device(dev); 239 error = rc_register_device(dev);
239 if (error) { 240 if (error) {
@@ -659,33 +660,33 @@ static int philips_su1278_tt_set_symbol_rate(struct dvb_frontend *fe, u32 srate,
659 return 0; 660 return 0;
660} 661}
661 662
662static int philips_su1278_tt_tuner_set_params(struct dvb_frontend *fe, 663static int philips_su1278_tt_tuner_set_params(struct dvb_frontend *fe)
663 struct dvb_frontend_parameters *params)
664{ 664{
665 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
665 struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; 666 struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv;
666 u32 div; 667 u32 div;
667 u8 buf[4]; 668 u8 buf[4];
668 struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; 669 struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) };
669 670
670 if ((params->frequency < 950000) || (params->frequency > 2150000)) 671 if ((p->frequency < 950000) || (p->frequency > 2150000))
671 return -EINVAL; 672 return -EINVAL;
672 673
673 div = (params->frequency + (500 - 1)) / 500; // round correctly 674 div = (p->frequency + (500 - 1)) / 500; /* round correctly */
674 buf[0] = (div >> 8) & 0x7f; 675 buf[0] = (div >> 8) & 0x7f;
675 buf[1] = div & 0xff; 676 buf[1] = div & 0xff;
676 buf[2] = 0x80 | ((div & 0x18000) >> 10) | 2; 677 buf[2] = 0x80 | ((div & 0x18000) >> 10) | 2;
677 buf[3] = 0x20; 678 buf[3] = 0x20;
678 679
679 if (params->u.qpsk.symbol_rate < 4000000) 680 if (p->symbol_rate < 4000000)
680 buf[3] |= 1; 681 buf[3] |= 1;
681 682
682 if (params->frequency < 1250000) 683 if (p->frequency < 1250000)
683 buf[3] |= 0; 684 buf[3] |= 0;
684 else if (params->frequency < 1550000) 685 else if (p->frequency < 1550000)
685 buf[3] |= 0x40; 686 buf[3] |= 0x40;
686 else if (params->frequency < 2050000) 687 else if (p->frequency < 2050000)
687 buf[3] |= 0x80; 688 buf[3] |= 0x80;
688 else if (params->frequency < 2150000) 689 else if (p->frequency < 2150000)
689 buf[3] |= 0xC0; 690 buf[3] |= 0xC0;
690 691
691 if (fe->ops.i2c_gate_ctrl) 692 if (fe->ops.i2c_gate_ctrl)
@@ -740,8 +741,9 @@ static int philips_tdm1316l_tuner_init(struct dvb_frontend *fe)
740 return 0; 741 return 0;
741} 742}
742 743
743static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 744static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe)
744{ 745{
746 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
745 struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; 747 struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv;
746 u8 tuner_buf[4]; 748 u8 tuner_buf[4];
747 struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address,.flags = 0,.buf = tuner_buf,.len = sizeof(tuner_buf) }; 749 struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address,.flags = 0,.buf = tuner_buf,.len = sizeof(tuner_buf) };
@@ -749,7 +751,7 @@ static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb
749 u8 band, cp, filter; 751 u8 band, cp, filter;
750 752
751 // determine charge pump 753 // determine charge pump
752 tuner_frequency = params->frequency + 36130000; 754 tuner_frequency = p->frequency + 36130000;
753 if (tuner_frequency < 87000000) 755 if (tuner_frequency < 87000000)
754 return -EINVAL; 756 return -EINVAL;
755 else if (tuner_frequency < 130000000) 757 else if (tuner_frequency < 130000000)
@@ -774,30 +776,30 @@ static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb
774 return -EINVAL; 776 return -EINVAL;
775 777
776 // determine band 778 // determine band
777 if (params->frequency < 49000000) 779 if (p->frequency < 49000000)
778 return -EINVAL; 780 return -EINVAL;
779 else if (params->frequency < 159000000) 781 else if (p->frequency < 159000000)
780 band = 1; 782 band = 1;
781 else if (params->frequency < 444000000) 783 else if (p->frequency < 444000000)
782 band = 2; 784 band = 2;
783 else if (params->frequency < 861000000) 785 else if (p->frequency < 861000000)
784 band = 4; 786 band = 4;
785 else 787 else
786 return -EINVAL; 788 return -EINVAL;
787 789
788 // setup PLL filter and TDA9889 790 // setup PLL filter and TDA9889
789 switch (params->u.ofdm.bandwidth) { 791 switch (p->bandwidth_hz) {
790 case BANDWIDTH_6_MHZ: 792 case 6000000:
791 tda1004x_writereg(fe, 0x0C, 0x14); 793 tda1004x_writereg(fe, 0x0C, 0x14);
792 filter = 0; 794 filter = 0;
793 break; 795 break;
794 796
795 case BANDWIDTH_7_MHZ: 797 case 7000000:
796 tda1004x_writereg(fe, 0x0C, 0x80); 798 tda1004x_writereg(fe, 0x0C, 0x80);
797 filter = 0; 799 filter = 0;
798 break; 800 break;
799 801
800 case BANDWIDTH_8_MHZ: 802 case 8000000:
801 tda1004x_writereg(fe, 0x0C, 0x14); 803 tda1004x_writereg(fe, 0x0C, 0x14);
802 filter = 1; 804 filter = 1;
803 break; 805 break;
@@ -808,7 +810,7 @@ static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb
808 810
809 // calculate divisor 811 // calculate divisor
810 // ((36130000+((1000000/6)/2)) + Finput)/(1000000/6) 812 // ((36130000+((1000000/6)/2)) + Finput)/(1000000/6)
811 tuner_frequency = (((params->frequency / 1000) * 6) + 217280) / 1000; 813 tuner_frequency = (((p->frequency / 1000) * 6) + 217280) / 1000;
812 814
813 // setup tuner buffer 815 // setup tuner buffer
814 tuner_buf[0] = tuner_frequency >> 8; 816 tuner_buf[0] = tuner_frequency >> 8;
@@ -855,8 +857,9 @@ static struct tda1004x_config philips_tdm1316l_config_invert = {
855 .request_firmware = philips_tdm1316l_request_firmware, 857 .request_firmware = philips_tdm1316l_request_firmware,
856}; 858};
857 859
858static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 860static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe)
859{ 861{
862 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
860 struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; 863 struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv;
861 u8 tuner_buf[5]; 864 u8 tuner_buf[5];
862 struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address, 865 struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address,
@@ -867,7 +870,7 @@ static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struc
867 u8 band, cp, filter; 870 u8 band, cp, filter;
868 871
869 // determine charge pump 872 // determine charge pump
870 tuner_frequency = params->frequency + 36125000; 873 tuner_frequency = p->frequency + 36125000;
871 if (tuner_frequency < 87000000) 874 if (tuner_frequency < 87000000)
872 return -EINVAL; 875 return -EINVAL;
873 else if (tuner_frequency < 130000000) { 876 else if (tuner_frequency < 130000000) {
@@ -904,7 +907,7 @@ static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struc
904 filter = 1; 907 filter = 1;
905 908
906 // calculate divisor 909 // calculate divisor
907 tuner_frequency = (params->frequency + 36125000 + (62500/2)) / 62500; 910 tuner_frequency = (p->frequency + 36125000 + (62500/2)) / 62500;
908 911
909 // setup tuner buffer 912 // setup tuner buffer
910 tuner_buf[0] = tuner_frequency >> 8; 913 tuner_buf[0] = tuner_frequency >> 8;
diff --git a/drivers/media/dvb/ttpci/budget-patch.c b/drivers/media/dvb/ttpci/budget-patch.c
index 3395d1a90516..2cb35c23d2ac 100644
--- a/drivers/media/dvb/ttpci/budget-patch.c
+++ b/drivers/media/dvb/ttpci/budget-patch.c
@@ -261,19 +261,25 @@ static int budget_patch_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_c
261 return 0; 261 return 0;
262} 262}
263 263
264static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 264static int alps_bsrv2_tuner_set_params(struct dvb_frontend *fe)
265{ 265{
266 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
266 struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv; 267 struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv;
267 u8 pwr = 0; 268 u8 pwr = 0;
268 u8 buf[4]; 269 u8 buf[4];
269 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; 270 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) };
270 u32 div = (params->frequency + 479500) / 125; 271 u32 div = (p->frequency + 479500) / 125;
271 272
272 if (params->frequency > 2000000) pwr = 3; 273 if (p->frequency > 2000000)
273 else if (params->frequency > 1800000) pwr = 2; 274 pwr = 3;
274 else if (params->frequency > 1600000) pwr = 1; 275 else if (p->frequency > 1800000)
275 else if (params->frequency > 1200000) pwr = 0; 276 pwr = 2;
276 else if (params->frequency >= 1100000) pwr = 1; 277 else if (p->frequency > 1600000)
278 pwr = 1;
279 else if (p->frequency > 1200000)
280 pwr = 0;
281 else if (p->frequency >= 1100000)
282 pwr = 1;
277 else pwr = 2; 283 else pwr = 2;
278 284
279 buf[0] = (div >> 8) & 0x7f; 285 buf[0] = (div >> 8) & 0x7f;
@@ -297,14 +303,15 @@ static struct ves1x93_config alps_bsrv2_config = {
297 .invert_pwm = 0, 303 .invert_pwm = 0,
298}; 304};
299 305
300static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 306static int grundig_29504_451_tuner_set_params(struct dvb_frontend *fe)
301{ 307{
308 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
302 struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv; 309 struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv;
303 u32 div; 310 u32 div;
304 u8 data[4]; 311 u8 data[4];
305 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; 312 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
306 313
307 div = params->frequency / 125; 314 div = p->frequency / 125;
308 data[0] = (div >> 8) & 0x7f; 315 data[0] = (div >> 8) & 0x7f;
309 data[1] = div & 0xff; 316 data[1] = div & 0xff;
310 data[2] = 0x8e; 317 data[2] = 0x8e;
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index d238fb9371a7..b21bcce66708 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -200,19 +200,25 @@ static int budget_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t m
200 return 0; 200 return 0;
201} 201}
202 202
203static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 203static int alps_bsrv2_tuner_set_params(struct dvb_frontend *fe)
204{ 204{
205 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
205 struct budget* budget = (struct budget*) fe->dvb->priv; 206 struct budget* budget = (struct budget*) fe->dvb->priv;
206 u8 pwr = 0; 207 u8 pwr = 0;
207 u8 buf[4]; 208 u8 buf[4];
208 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; 209 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) };
209 u32 div = (params->frequency + 479500) / 125; 210 u32 div = (c->frequency + 479500) / 125;
210 211
211 if (params->frequency > 2000000) pwr = 3; 212 if (c->frequency > 2000000)
212 else if (params->frequency > 1800000) pwr = 2; 213 pwr = 3;
213 else if (params->frequency > 1600000) pwr = 1; 214 else if (c->frequency > 1800000)
214 else if (params->frequency > 1200000) pwr = 0; 215 pwr = 2;
215 else if (params->frequency >= 1100000) pwr = 1; 216 else if (c->frequency > 1600000)
217 pwr = 1;
218 else if (c->frequency > 1200000)
219 pwr = 0;
220 else if (c->frequency >= 1100000)
221 pwr = 1;
216 else pwr = 2; 222 else pwr = 2;
217 223
218 buf[0] = (div >> 8) & 0x7f; 224 buf[0] = (div >> 8) & 0x7f;
@@ -236,19 +242,20 @@ static struct ves1x93_config alps_bsrv2_config =
236 .invert_pwm = 0, 242 .invert_pwm = 0,
237}; 243};
238 244
239static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 245static int alps_tdbe2_tuner_set_params(struct dvb_frontend *fe)
240{ 246{
247 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
241 struct budget* budget = (struct budget*) fe->dvb->priv; 248 struct budget* budget = (struct budget*) fe->dvb->priv;
242 u32 div; 249 u32 div;
243 u8 data[4]; 250 u8 data[4];
244 struct i2c_msg msg = { .addr = 0x62, .flags = 0, .buf = data, .len = sizeof(data) }; 251 struct i2c_msg msg = { .addr = 0x62, .flags = 0, .buf = data, .len = sizeof(data) };
245 252
246 div = (params->frequency + 35937500 + 31250) / 62500; 253 div = (c->frequency + 35937500 + 31250) / 62500;
247 254
248 data[0] = (div >> 8) & 0x7f; 255 data[0] = (div >> 8) & 0x7f;
249 data[1] = div & 0xff; 256 data[1] = div & 0xff;
250 data[2] = 0x85 | ((div >> 10) & 0x60); 257 data[2] = 0x85 | ((div >> 10) & 0x60);
251 data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); 258 data[3] = (c->frequency < 174000000 ? 0x88 : c->frequency < 470000000 ? 0x84 : 0x81);
252 259
253 if (fe->ops.i2c_gate_ctrl) 260 if (fe->ops.i2c_gate_ctrl)
254 fe->ops.i2c_gate_ctrl(fe, 1); 261 fe->ops.i2c_gate_ctrl(fe, 1);
@@ -263,8 +270,9 @@ static struct ves1820_config alps_tdbe2_config = {
263 .selagc = VES1820_SELAGC_SIGNAMPERR, 270 .selagc = VES1820_SELAGC_SIGNAMPERR,
264}; 271};
265 272
266static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 273static int grundig_29504_401_tuner_set_params(struct dvb_frontend *fe)
267{ 274{
275 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
268 struct budget *budget = fe->dvb->priv; 276 struct budget *budget = fe->dvb->priv;
269 u8 *tuner_addr = fe->tuner_priv; 277 u8 *tuner_addr = fe->tuner_priv;
270 u32 div; 278 u32 div;
@@ -277,19 +285,27 @@ static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dv
277 else 285 else
278 msg.addr = 0x61; 286 msg.addr = 0x61;
279 287
280 div = (36125000 + params->frequency) / 166666; 288 div = (36125000 + c->frequency) / 166666;
281 289
282 cfg = 0x88; 290 cfg = 0x88;
283 291
284 if (params->frequency < 175000000) cpump = 2; 292 if (c->frequency < 175000000)
285 else if (params->frequency < 390000000) cpump = 1; 293 cpump = 2;
286 else if (params->frequency < 470000000) cpump = 2; 294 else if (c->frequency < 390000000)
287 else if (params->frequency < 750000000) cpump = 1; 295 cpump = 1;
288 else cpump = 3; 296 else if (c->frequency < 470000000)
297 cpump = 2;
298 else if (c->frequency < 750000000)
299 cpump = 1;
300 else
301 cpump = 3;
289 302
290 if (params->frequency < 175000000) band_select = 0x0e; 303 if (c->frequency < 175000000)
291 else if (params->frequency < 470000000) band_select = 0x05; 304 band_select = 0x0e;
292 else band_select = 0x03; 305 else if (c->frequency < 470000000)
306 band_select = 0x05;
307 else
308 band_select = 0x03;
293 309
294 data[0] = (div >> 8) & 0x7f; 310 data[0] = (div >> 8) & 0x7f;
295 data[1] = div & 0xff; 311 data[1] = div & 0xff;
@@ -312,14 +328,15 @@ static struct l64781_config grundig_29504_401_config_activy = {
312 328
313static u8 tuner_address_grundig_29504_401_activy = 0x60; 329static u8 tuner_address_grundig_29504_401_activy = 0x60;
314 330
315static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 331static int grundig_29504_451_tuner_set_params(struct dvb_frontend *fe)
316{ 332{
333 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
317 struct budget* budget = (struct budget*) fe->dvb->priv; 334 struct budget* budget = (struct budget*) fe->dvb->priv;
318 u32 div; 335 u32 div;
319 u8 data[4]; 336 u8 data[4];
320 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; 337 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
321 338
322 div = params->frequency / 125; 339 div = c->frequency / 125;
323 data[0] = (div >> 8) & 0x7f; 340 data[0] = (div >> 8) & 0x7f;
324 data[1] = div & 0xff; 341 data[1] = div & 0xff;
325 data[2] = 0x8e; 342 data[2] = 0x8e;
@@ -335,14 +352,15 @@ static struct tda8083_config grundig_29504_451_config = {
335 .demod_address = 0x68, 352 .demod_address = 0x68,
336}; 353};
337 354
338static int s5h1420_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 355static int s5h1420_tuner_set_params(struct dvb_frontend *fe)
339{ 356{
357 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
340 struct budget* budget = (struct budget*) fe->dvb->priv; 358 struct budget* budget = (struct budget*) fe->dvb->priv;
341 u32 div; 359 u32 div;
342 u8 data[4]; 360 u8 data[4];
343 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; 361 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
344 362
345 div = params->frequency / 1000; 363 div = c->frequency / 1000;
346 data[0] = (div >> 8) & 0x7f; 364 data[0] = (div >> 8) & 0x7f;
347 data[1] = div & 0xff; 365 data[1] = div & 0xff;
348 data[2] = 0xc2; 366 data[2] = 0xc2;