diff options
author | Andreas Oberritter <obi@linuxtv.org> | 2005-09-09 16:02:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 16:57:38 -0400 |
commit | cfbfce1566f11c0dbad8a16173f0448b0c78cecb (patch) | |
tree | cd090616b3a13c130b72238f92390761bda71e39 /drivers/media/dvb | |
parent | 4ff4ac1beae58a2fea7ec2ad43d6c3b60d90ec61 (diff) |
[PATCH] dvb: frontend: stv0299: pass i2c bus to pll callback
Pass a pointer to the i2c bus to the pll callbacks (stv0299 only).
It was not possible to tell which i2c bus should be used if an adapter has
multiple frontends on multiple i2c buses.
Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/b2c2/flexcop-fe-tuner.c | 5 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stv0299.c | 6 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stv0299.h | 4 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/av7110.c | 10 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-av.c | 4 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 9 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-patch.c | 5 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget.c | 5 | ||||
-rw-r--r-- | drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 4 |
9 files changed, 23 insertions, 29 deletions
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index 0410cc96a48e..a36bec3a2bea 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c | |||
@@ -164,12 +164,11 @@ static int samsung_tbmu24112_set_symbol_rate(struct dvb_frontend* fe, u32 srate, | |||
164 | return 0; | 164 | return 0; |
165 | } | 165 | } |
166 | 166 | ||
167 | static int samsung_tbmu24112_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 167 | static int samsung_tbmu24112_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) |
168 | { | 168 | { |
169 | u8 buf[4]; | 169 | u8 buf[4]; |
170 | u32 div; | 170 | u32 div; |
171 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; | 171 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; |
172 | struct flexcop_device *fc = fe->dvb->priv; | ||
173 | 172 | ||
174 | div = params->frequency / 125; | 173 | div = params->frequency / 125; |
175 | 174 | ||
@@ -180,7 +179,7 @@ static int samsung_tbmu24112_pll_set(struct dvb_frontend* fe, struct dvb_fronten | |||
180 | 179 | ||
181 | if (params->frequency < 1500000) buf[3] |= 0x10; | 180 | if (params->frequency < 1500000) buf[3] |= 0x10; |
182 | 181 | ||
183 | if (i2c_transfer(&fc->i2c_adap, &msg, 1) != 1) | 182 | if (i2c_transfer(i2c, &msg, 1) != 1) |
184 | return -EIO; | 183 | return -EIO; |
185 | return 0; | 184 | return 0; |
186 | } | 185 | } |
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index cfa3928bb487..db66d417df38 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c | |||
@@ -481,7 +481,7 @@ static int stv0299_init (struct dvb_frontend* fe) | |||
481 | 481 | ||
482 | if (state->config->pll_init) { | 482 | if (state->config->pll_init) { |
483 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ | 483 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ |
484 | state->config->pll_init(fe); | 484 | state->config->pll_init(fe, state->i2c); |
485 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ | 485 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ |
486 | } | 486 | } |
487 | 487 | ||
@@ -603,7 +603,7 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
603 | } else { | 603 | } else { |
604 | /* A "normal" tune is requested */ | 604 | /* A "normal" tune is requested */ |
605 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ | 605 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ |
606 | state->config->pll_set(fe, p); | 606 | state->config->pll_set(fe, state->i2c, p); |
607 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ | 607 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ |
608 | 608 | ||
609 | stv0299_writeregI(state, 0x32, 0x80); | 609 | stv0299_writeregI(state, 0x32, 0x80); |
@@ -615,7 +615,7 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
615 | } | 615 | } |
616 | } else { | 616 | } else { |
617 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ | 617 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ |
618 | state->config->pll_set(fe, p); | 618 | state->config->pll_set(fe, state->i2c, p); |
619 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ | 619 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ |
620 | 620 | ||
621 | stv0299_set_FEC (state, p->u.qpsk.fec_inner); | 621 | stv0299_set_FEC (state, p->u.qpsk.fec_inner); |
diff --git a/drivers/media/dvb/frontends/stv0299.h b/drivers/media/dvb/frontends/stv0299.h index 79457a80a11f..d0c4484861e1 100644 --- a/drivers/media/dvb/frontends/stv0299.h +++ b/drivers/media/dvb/frontends/stv0299.h | |||
@@ -92,8 +92,8 @@ struct stv0299_config | |||
92 | int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio); | 92 | int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio); |
93 | 93 | ||
94 | /* PLL maintenance */ | 94 | /* PLL maintenance */ |
95 | int (*pll_init)(struct dvb_frontend* fe); | 95 | int (*pll_init)(struct dvb_frontend *fe, struct i2c_adapter *i2c); |
96 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); | 96 | int (*pll_set)(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params); |
97 | }; | 97 | }; |
98 | 98 | ||
99 | extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data); | 99 | extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data); |
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index e4c6e87f6c5d..c91cf8958b38 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -1668,9 +1668,8 @@ static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ra | |||
1668 | return 0; | 1668 | return 0; |
1669 | } | 1669 | } |
1670 | 1670 | ||
1671 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1671 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) |
1672 | { | 1672 | { |
1673 | struct av7110* av7110 = (struct av7110*) fe->dvb->priv; | ||
1674 | int ret; | 1673 | int ret; |
1675 | u8 data[4]; | 1674 | u8 data[4]; |
1676 | u32 div; | 1675 | u32 div; |
@@ -1687,7 +1686,7 @@ static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
1687 | 1686 | ||
1688 | if (params->frequency > 1530000) data[3] = 0xc0; | 1687 | if (params->frequency > 1530000) data[3] = 0xc0; |
1689 | 1688 | ||
1690 | ret = i2c_transfer(&av7110->i2c_adap, &msg, 1); | 1689 | ret = i2c_transfer(i2c, &msg, 1); |
1691 | if (ret != 1) | 1690 | if (ret != 1) |
1692 | return -EIO; | 1691 | return -EIO; |
1693 | return 0; | 1692 | return 0; |
@@ -1751,9 +1750,8 @@ static u8 alps_bsbe1_inittab[] = { | |||
1751 | 0xff, 0xff | 1750 | 0xff, 0xff |
1752 | }; | 1751 | }; |
1753 | 1752 | ||
1754 | static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1753 | static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) |
1755 | { | 1754 | { |
1756 | struct av7110* av7110 = (struct av7110*) fe->dvb->priv; | ||
1757 | int ret; | 1755 | int ret; |
1758 | u8 data[4]; | 1756 | u8 data[4]; |
1759 | u32 div; | 1757 | u32 div; |
@@ -1768,7 +1766,7 @@ static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
1768 | data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; | 1766 | data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; |
1769 | data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; | 1767 | data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; |
1770 | 1768 | ||
1771 | ret = i2c_transfer(&av7110->i2c_adap, &msg, 1); | 1769 | ret = i2c_transfer(i2c, &msg, 1); |
1772 | return (ret != 1) ? -EIO : 0; | 1770 | return (ret != 1) ? -EIO : 0; |
1773 | } | 1771 | } |
1774 | 1772 | ||
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 9746d2bb916f..311be50b2fce 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -453,9 +453,9 @@ static int philips_su1278_ty_ci_set_symbol_rate(struct dvb_frontend *fe, u32 sra | |||
453 | } | 453 | } |
454 | 454 | ||
455 | static int philips_su1278_ty_ci_pll_set(struct dvb_frontend *fe, | 455 | static int philips_su1278_ty_ci_pll_set(struct dvb_frontend *fe, |
456 | struct i2c_adapter *i2c, | ||
456 | struct dvb_frontend_parameters *params) | 457 | struct dvb_frontend_parameters *params) |
457 | { | 458 | { |
458 | struct budget_av *budget_av = (struct budget_av *) fe->dvb->priv; | ||
459 | u32 div; | 459 | u32 div; |
460 | u8 buf[4]; | 460 | u8 buf[4]; |
461 | struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; | 461 | struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; |
@@ -481,7 +481,7 @@ static int philips_su1278_ty_ci_pll_set(struct dvb_frontend *fe, | |||
481 | else if (params->frequency < 2150000) | 481 | else if (params->frequency < 2150000) |
482 | buf[3] |= 0xC0; | 482 | buf[3] |= 0xC0; |
483 | 483 | ||
484 | if (i2c_transfer(&budget_av->budget.i2c_adap, &msg, 1) != 1) | 484 | if (i2c_transfer(i2c, &msg, 1) != 1) |
485 | return -EIO; | 485 | return -EIO; |
486 | return 0; | 486 | return 0; |
487 | } | 487 | } |
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index a1267054bc01..88f27a532163 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -548,9 +548,8 @@ static int alps_bsru6_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ra | |||
548 | return 0; | 548 | return 0; |
549 | } | 549 | } |
550 | 550 | ||
551 | static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 551 | static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params) |
552 | { | 552 | { |
553 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | ||
554 | u8 buf[4]; | 553 | u8 buf[4]; |
555 | u32 div; | 554 | u32 div; |
556 | struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; | 555 | struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; |
@@ -567,7 +566,7 @@ static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct dvb_frontend_param | |||
567 | if (params->frequency > 1530000) | 566 | if (params->frequency > 1530000) |
568 | buf[3] = 0xc0; | 567 | buf[3] = 0xc0; |
569 | 568 | ||
570 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1) | 569 | if (i2c_transfer(i2c, &msg, 1) != 1) |
571 | return -EIO; | 570 | return -EIO; |
572 | return 0; | 571 | return 0; |
573 | } | 572 | } |
@@ -669,9 +668,9 @@ static int philips_su1278_tt_set_symbol_rate(struct dvb_frontend *fe, u32 srate, | |||
669 | } | 668 | } |
670 | 669 | ||
671 | static int philips_su1278_tt_pll_set(struct dvb_frontend *fe, | 670 | static int philips_su1278_tt_pll_set(struct dvb_frontend *fe, |
671 | struct i2c_adapter *i2c, | ||
672 | struct dvb_frontend_parameters *params) | 672 | struct dvb_frontend_parameters *params) |
673 | { | 673 | { |
674 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | ||
675 | u32 div; | 674 | u32 div; |
676 | u8 buf[4]; | 675 | u8 buf[4]; |
677 | struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; | 676 | struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; |
@@ -697,7 +696,7 @@ static int philips_su1278_tt_pll_set(struct dvb_frontend *fe, | |||
697 | else if (params->frequency < 2150000) | 696 | else if (params->frequency < 2150000) |
698 | buf[3] |= 0xC0; | 697 | buf[3] |= 0xC0; |
699 | 698 | ||
700 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1) | 699 | if (i2c_transfer(i2c, &msg, 1) != 1) |
701 | return -EIO; | 700 | return -EIO; |
702 | return 0; | 701 | return 0; |
703 | } | 702 | } |
diff --git a/drivers/media/dvb/ttpci/budget-patch.c b/drivers/media/dvb/ttpci/budget-patch.c index 8142e26b47f5..b1f21ef0e3b3 100644 --- a/drivers/media/dvb/ttpci/budget-patch.c +++ b/drivers/media/dvb/ttpci/budget-patch.c | |||
@@ -353,9 +353,8 @@ static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ra | |||
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
355 | 355 | ||
356 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 356 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) |
357 | { | 357 | { |
358 | struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv; | ||
359 | u8 data[4]; | 358 | u8 data[4]; |
360 | u32 div; | 359 | u32 div; |
361 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; | 360 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; |
@@ -370,7 +369,7 @@ static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
370 | 369 | ||
371 | if (params->frequency > 1530000) data[3] = 0xc0; | 370 | if (params->frequency > 1530000) data[3] = 0xc0; |
372 | 371 | ||
373 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | 372 | if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO; |
374 | return 0; | 373 | return 0; |
375 | } | 374 | } |
376 | 375 | ||
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 9961917e8a7f..5552ef501996 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -332,9 +332,8 @@ static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ra | |||
332 | return 0; | 332 | return 0; |
333 | } | 333 | } |
334 | 334 | ||
335 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 335 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) |
336 | { | 336 | { |
337 | struct budget* budget = (struct budget*) fe->dvb->priv; | ||
338 | u8 data[4]; | 337 | u8 data[4]; |
339 | u32 div; | 338 | u32 div; |
340 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; | 339 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; |
@@ -349,7 +348,7 @@ static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
349 | 348 | ||
350 | if (params->frequency > 1530000) data[3] = 0xc0; | 349 | if (params->frequency > 1530000) data[3] = 0xc0; |
351 | 350 | ||
352 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | 351 | if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO; |
353 | return 0; | 352 | return 0; |
354 | } | 353 | } |
355 | 354 | ||
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 7daf7b1598a0..c1acd4bb3499 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -1299,7 +1299,7 @@ static int alps_stv0299_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 | |||
1299 | return 0; | 1299 | return 0; |
1300 | } | 1300 | } |
1301 | 1301 | ||
1302 | static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 1302 | static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params) |
1303 | { | 1303 | { |
1304 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1304 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1305 | u8 buf[4]; | 1305 | u8 buf[4]; |
@@ -1322,7 +1322,7 @@ static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ | |||
1322 | if (ttusb->revision == TTUSB_REV_2_2) | 1322 | if (ttusb->revision == TTUSB_REV_2_2) |
1323 | buf[3] |= 0x20; | 1323 | buf[3] |= 0x20; |
1324 | 1324 | ||
1325 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) | 1325 | if (i2c_transfer(i2c, &msg, 1) != 1) |
1326 | return -EIO; | 1326 | return -EIO; |
1327 | 1327 | ||
1328 | return 0; | 1328 | return 0; |