diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-09-12 12:31:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:37:09 -0400 |
commit | d7cba043d7ec840d67bd5143779d1febe7d83407 (patch) | |
tree | 4fb46684538e0ad7d3229f592182ed6121049d69 /drivers/media/common/tuners/tuner-xc2028.c | |
parent | ebb8d68a5c8c236acd8e8cf8f0d6046e027a8e21 (diff) |
V4L/DVB (9049): convert tuner drivers to use dvb_frontend->callback
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common/tuners/tuner-xc2028.c')
-rw-r--r-- | drivers/media/common/tuners/tuner-xc2028.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index 4dd1d2421cc5..fc82d154c8c2 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c | |||
@@ -71,9 +71,6 @@ struct firmware_properties { | |||
71 | struct xc2028_data { | 71 | struct xc2028_data { |
72 | struct list_head hybrid_tuner_instance_list; | 72 | struct list_head hybrid_tuner_instance_list; |
73 | struct tuner_i2c_props i2c_props; | 73 | struct tuner_i2c_props i2c_props; |
74 | int (*tuner_callback) (void *dev, | ||
75 | int command, int arg); | ||
76 | void *video_dev; | ||
77 | __u32 frequency; | 74 | __u32 frequency; |
78 | 75 | ||
79 | struct firmware_description *firm; | 76 | struct firmware_description *firm; |
@@ -492,6 +489,23 @@ ret: | |||
492 | return i; | 489 | return i; |
493 | } | 490 | } |
494 | 491 | ||
492 | static inline int do_tuner_callback(struct dvb_frontend *fe, int cmd, int arg) | ||
493 | { | ||
494 | struct xc2028_data *priv = fe->tuner_priv; | ||
495 | |||
496 | /* analog side (tuner-core) uses i2c_adap->algo_data. | ||
497 | * digital side is not guaranteed to have algo_data defined. | ||
498 | * | ||
499 | * digital side will always have fe->dvb defined. | ||
500 | * analog side (tuner-core) doesn't (yet) define fe->dvb. | ||
501 | */ | ||
502 | |||
503 | return (!fe->callback) ? -EINVAL : | ||
504 | fe->callback(((fe->dvb) && (fe->dvb->priv)) ? | ||
505 | fe->dvb->priv : priv->i2c_props.adap->algo_data, | ||
506 | DVB_FRONTEND_COMPONENT_TUNER, cmd, arg); | ||
507 | } | ||
508 | |||
495 | static int load_firmware(struct dvb_frontend *fe, unsigned int type, | 509 | static int load_firmware(struct dvb_frontend *fe, unsigned int type, |
496 | v4l2_std_id *id) | 510 | v4l2_std_id *id) |
497 | { | 511 | { |
@@ -530,8 +544,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, | |||
530 | 544 | ||
531 | if (!size) { | 545 | if (!size) { |
532 | /* Special callback command received */ | 546 | /* Special callback command received */ |
533 | rc = priv->tuner_callback(priv->video_dev, | 547 | rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0); |
534 | XC2028_TUNER_RESET, 0); | ||
535 | if (rc < 0) { | 548 | if (rc < 0) { |
536 | tuner_err("Error at RESET code %d\n", | 549 | tuner_err("Error at RESET code %d\n", |
537 | (*p) & 0x7f); | 550 | (*p) & 0x7f); |
@@ -542,8 +555,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, | |||
542 | if (size >= 0xff00) { | 555 | if (size >= 0xff00) { |
543 | switch (size) { | 556 | switch (size) { |
544 | case 0xff00: | 557 | case 0xff00: |
545 | rc = priv->tuner_callback(priv->video_dev, | 558 | rc = do_tuner_callback(fe, XC2028_RESET_CLK, 0); |
546 | XC2028_RESET_CLK, 0); | ||
547 | if (rc < 0) { | 559 | if (rc < 0) { |
548 | tuner_err("Error at RESET code %d\n", | 560 | tuner_err("Error at RESET code %d\n", |
549 | (*p) & 0x7f); | 561 | (*p) & 0x7f); |
@@ -715,8 +727,7 @@ retry: | |||
715 | memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); | 727 | memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); |
716 | 728 | ||
717 | /* Reset is needed before loading firmware */ | 729 | /* Reset is needed before loading firmware */ |
718 | rc = priv->tuner_callback(priv->video_dev, | 730 | rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0); |
719 | XC2028_TUNER_RESET, 0); | ||
720 | if (rc < 0) | 731 | if (rc < 0) |
721 | goto fail; | 732 | goto fail; |
722 | 733 | ||
@@ -933,7 +944,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, | |||
933 | The reset CLK is needed only with tm6000. | 944 | The reset CLK is needed only with tm6000. |
934 | Driver should work fine even if this fails. | 945 | Driver should work fine even if this fails. |
935 | */ | 946 | */ |
936 | priv->tuner_callback(priv->video_dev, XC2028_RESET_CLK, 1); | 947 | do_tuner_callback(fe, XC2028_RESET_CLK, 1); |
937 | 948 | ||
938 | msleep(10); | 949 | msleep(10); |
939 | 950 | ||
@@ -1177,20 +1188,10 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe, | |||
1177 | break; | 1188 | break; |
1178 | case 1: | 1189 | case 1: |
1179 | /* new tuner instance */ | 1190 | /* new tuner instance */ |
1180 | priv->tuner_callback = cfg->callback; | ||
1181 | priv->ctrl.max_len = 13; | 1191 | priv->ctrl.max_len = 13; |
1182 | 1192 | ||
1183 | mutex_init(&priv->lock); | 1193 | mutex_init(&priv->lock); |
1184 | 1194 | ||
1185 | /* analog side (tuner-core) uses i2c_adap->algo_data. | ||
1186 | * digital side is not guaranteed to have algo_data defined. | ||
1187 | * | ||
1188 | * digital side will always have fe->dvb defined. | ||
1189 | * analog side (tuner-core) doesn't (yet) define fe->dvb. | ||
1190 | */ | ||
1191 | priv->video_dev = ((fe->dvb) && (fe->dvb->priv)) ? | ||
1192 | fe->dvb->priv : cfg->i2c_adap->algo_data; | ||
1193 | |||
1194 | fe->tuner_priv = priv; | 1195 | fe->tuner_priv = priv; |
1195 | break; | 1196 | break; |
1196 | case 2: | 1197 | case 2: |