aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tuner-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/tuner-core.c')
-rw-r--r--drivers/media/video/tuner-core.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 1013b4de89a2..e95792fd70f8 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -199,7 +199,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
199 i2c_master_send(c, buffer, 4); 199 i2c_master_send(c, buffer, 4);
200 default_tuner_init(c); 200 default_tuner_init(c);
201 break; 201 break;
202 case TUNER_LG_TDVS_H062F: 202 case TUNER_LG_TDVS_H06XF:
203 /* Set the Auxiliary Byte. */ 203 /* Set the Auxiliary Byte. */
204 buffer[2] &= ~0x20; 204 buffer[2] &= ~0x20;
205 buffer[2] |= 0x18; 205 buffer[2] |= 0x18;
@@ -215,6 +215,9 @@ static void set_type(struct i2c_client *c, unsigned int type,
215 i2c_master_send(c,buffer,4); 215 i2c_master_send(c,buffer,4);
216 default_tuner_init(c); 216 default_tuner_init(c);
217 break; 217 break;
218 case TUNER_TDA9887:
219 tda9887_tuner_init(c);
220 break;
218 default: 221 default:
219 default_tuner_init(c); 222 default_tuner_init(c);
220 break; 223 break;
@@ -241,6 +244,8 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
241{ 244{
242 struct tuner *t = i2c_get_clientdata(c); 245 struct tuner *t = i2c_get_clientdata(c);
243 246
247 tuner_dbg("set addr for type %i\n", t->type);
248
244 if ( t->type == UNSET && ((tun_setup->addr == ADDR_UNSET && 249 if ( t->type == UNSET && ((tun_setup->addr == ADDR_UNSET &&
245 (t->mode_mask & tun_setup->mode_mask)) || 250 (t->mode_mask & tun_setup->mode_mask)) ||
246 tun_setup->addr == c->addr)) { 251 tun_setup->addr == c->addr)) {
@@ -436,6 +441,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
436 t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ 441 t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */
437 t->audmode = V4L2_TUNER_MODE_STEREO; 442 t->audmode = V4L2_TUNER_MODE_STEREO;
438 t->mode_mask = T_UNINITIALIZED; 443 t->mode_mask = T_UNINITIALIZED;
444 t->tuner_status = tuner_status;
439 if (tuner_debug_old) { 445 if (tuner_debug_old) {
440 tuner_debug = tuner_debug_old; 446 tuner_debug = tuner_debug_old;
441 printk(KERN_ERR "tuner: tuner_debug is deprecated and will be removed in 2.6.17.\n"); 447 printk(KERN_ERR "tuner: tuner_debug is deprecated and will be removed in 2.6.17.\n");
@@ -462,10 +468,14 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
462 case 0x4b: 468 case 0x4b:
463 /* If chip is not tda8290, don't register. 469 /* If chip is not tda8290, don't register.
464 since it can be tda9887*/ 470 since it can be tda9887*/
465 if (tda8290_probe(&t->i2c) != 0) { 471 if (tda8290_probe(&t->i2c) == 0) {
466 tuner_dbg("chip at addr %x is not a tda8290\n", addr); 472 tuner_dbg("chip at addr %x is a tda8290\n", addr);
467 kfree(t); 473 } else {
468 return 0; 474 /* Default is being tda9887 */
475 t->type = TUNER_TDA9887;
476 t->mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
477 t->mode = T_STANDBY;
478 goto register_client;
469 } 479 }
470 break; 480 break;
471 case 0x60: 481 case 0x60:
@@ -592,6 +602,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
592 case TUNER_SET_STANDBY: 602 case TUNER_SET_STANDBY:
593 if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) 603 if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL)
594 return 0; 604 return 0;
605 t->mode = T_STANDBY;
595 if (t->standby) 606 if (t->standby)
596 t->standby (client); 607 t->standby (client);
597 break; 608 break;
@@ -604,6 +615,14 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
604 /* Should be implemented, since bttv calls it */ 615 /* Should be implemented, since bttv calls it */
605 tuner_dbg("VIDIOCSAUDIO not implemented.\n"); 616 tuner_dbg("VIDIOCSAUDIO not implemented.\n");
606 break; 617 break;
618 case TDA9887_SET_CONFIG:
619 {
620 int *i = arg;
621
622 t->tda9887_config = *i;
623 set_freq(client, t->tv_freq);
624 break;
625 }
607 /* --- v4l ioctls --- */ 626 /* --- v4l ioctls --- */
608 /* take care: bttv does userspace copying, we'll get a 627 /* take care: bttv does userspace copying, we'll get a
609 kernel pointer here... */ 628 kernel pointer here... */
@@ -744,6 +763,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
744 switch_v4l2(); 763 switch_v4l2();
745 764
746 tuner->type = t->mode; 765 tuner->type = t->mode;
766 if (t->get_afc)
767 tuner->afc=t->get_afc(client);
747 if (t->mode == V4L2_TUNER_ANALOG_TV) 768 if (t->mode == V4L2_TUNER_ANALOG_TV)
748 tuner->capability |= V4L2_TUNER_CAP_NORM; 769 tuner->capability |= V4L2_TUNER_CAP_NORM;
749 if (t->mode != V4L2_TUNER_RADIO) { 770 if (t->mode != V4L2_TUNER_RADIO) {
@@ -787,7 +808,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
787 break; 808 break;
788 } 809 }
789 case VIDIOC_LOG_STATUS: 810 case VIDIOC_LOG_STATUS:
790 tuner_status(client); 811 if (t->tuner_status)
812 t->tuner_status(client);
791 break; 813 break;
792 } 814 }
793 815