Merge branch 'work'

+212 -88
+1 -1
drivers/media/dvb/frontends/dvb-pll.c
··· 333 .name = "Samsung TBMV30111IN", 334 .min = 54000000, 335 .max = 860000000, 336 - .count = 4, 337 .entries = { 338 { 172000000, 44000000, 166666, 0xb4, 0x01 }, 339 { 214000000, 44000000, 166666, 0xb4, 0x02 },
··· 333 .name = "Samsung TBMV30111IN", 334 .min = 54000000, 335 .max = 860000000, 336 + .count = 6, 337 .entries = { 338 { 172000000, 44000000, 166666, 0xb4, 0x01 }, 339 { 214000000, 44000000, 166666, 0xb4, 0x02 },
+2 -2
drivers/media/video/cx88/cx88-alsa.c
··· 333 .channels_min = 1, 334 .channels_max = 2, 335 .buffer_bytes_max = (2*2048), 336 - .period_bytes_min = 256, 337 .period_bytes_max = 2048, 338 .periods_min = 2, 339 - .periods_max = 16, 340 }; 341 342 /*
··· 333 .channels_min = 1, 334 .channels_max = 2, 335 .buffer_bytes_max = (2*2048), 336 + .period_bytes_min = 2048, 337 .period_bytes_max = 2048, 338 .periods_min = 2, 339 + .periods_max = 2, 340 }; 341 342 /*
+77
drivers/media/video/em28xx/em28xx-input.c
··· 76 [ 0x40 ] = KEY_ZOOM, 77 }; 78 79 /* ----------------------------------------------------------------------- */ 80 81 static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) ··· 190 return 1; 191 } 192 193 /* ----------------------------------------------------------------------- */ 194 void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir) 195 { ··· 233 snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)"); 234 break; 235 case (EM2820_BOARD_PINNACLE_USB_2): 236 break; 237 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2): 238 ir->ir_codes = ir_codes_hauppauge_new;
··· 76 [ 0x40 ] = KEY_ZOOM, 77 }; 78 79 + static IR_KEYTAB_TYPE ir_codes_em_pinnacle_usb[IR_KEYTAB_SIZE] = { 80 + [ 0x3a ] = KEY_KP0, 81 + [ 0x31 ] = KEY_KP1, 82 + [ 0x32 ] = KEY_KP2, 83 + [ 0x33 ] = KEY_KP3, 84 + [ 0x34 ] = KEY_KP4, 85 + [ 0x35 ] = KEY_KP5, 86 + [ 0x36 ] = KEY_KP6, 87 + [ 0x37 ] = KEY_KP7, 88 + [ 0x38 ] = KEY_KP8, 89 + [ 0x39 ] = KEY_KP9, 90 + 91 + [ 0x2f ] = KEY_POWER, 92 + 93 + [ 0x2e ] = KEY_P, 94 + [ 0x1f ] = KEY_L, 95 + [ 0x2b ] = KEY_I, 96 + 97 + [ 0x2d ] = KEY_ZOOM, 98 + [ 0x1e ] = KEY_ZOOM, 99 + [ 0x1b ] = KEY_VOLUMEUP, 100 + [ 0x0f ] = KEY_VOLUMEDOWN, 101 + [ 0x17 ] = KEY_CHANNELUP, 102 + [ 0x1c ] = KEY_CHANNELDOWN, 103 + [ 0x25 ] = KEY_INFO, 104 + 105 + [ 0x3c ] = KEY_MUTE, 106 + 107 + [ 0x3d ] = KEY_LEFT, 108 + [ 0x3b ] = KEY_RIGHT, 109 + 110 + [ 0x3f ] = KEY_UP, 111 + [ 0x3e ] = KEY_DOWN, 112 + [ 0x1a ] = KEY_PAUSE, 113 + 114 + [ 0x1d ] = KEY_MENU, 115 + [ 0x19 ] = KEY_PLAY, 116 + [ 0x16 ] = KEY_REWIND, 117 + [ 0x13 ] = KEY_FORWARD, 118 + [ 0x15 ] = KEY_PAUSE, 119 + [ 0x0e ] = KEY_REWIND, 120 + [ 0x0d ] = KEY_PLAY, 121 + [ 0x0b ] = KEY_STOP, 122 + [ 0x07 ] = KEY_FORWARD, 123 + [ 0x27 ] = KEY_RECORD, 124 + [ 0x26 ] = KEY_TUNER, 125 + [ 0x29 ] = KEY_TEXT, 126 + [ 0x2a ] = KEY_MEDIA, 127 + [ 0x18 ] = KEY_EPG, 128 + [ 0x27 ] = KEY_RECORD, 129 + }; 130 + 131 /* ----------------------------------------------------------------------- */ 132 133 static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) ··· 138 return 1; 139 } 140 141 + static int get_key_pinnacle_usb(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 142 + { 143 + unsigned char buf[3]; 144 + 145 + /* poll IR chip */ 146 + 147 + if (3 != i2c_master_recv(&ir->c,buf,3)) { 148 + dprintk("read error\n"); 149 + return -EIO; 150 + } 151 + 152 + dprintk("key %02x\n", buf[2]&0x3f); 153 + if (buf[0]!=0x00){ 154 + return 0; 155 + } 156 + 157 + *ir_key = buf[2]&0x3f; 158 + *ir_raw = buf[2]&0x3f; 159 + 160 + return 1; 161 + } 162 + 163 /* ----------------------------------------------------------------------- */ 164 void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir) 165 { ··· 159 snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)"); 160 break; 161 case (EM2820_BOARD_PINNACLE_USB_2): 162 + ir->ir_codes = ir_codes_em_pinnacle_usb; 163 + ir->get_key = get_key_pinnacle_usb; 164 + snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Pinnacle PCTV)"); 165 break; 166 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2): 167 ir->ir_codes = ir_codes_hauppauge_new;
+2 -2
drivers/media/video/msp3400-driver.c
··· 1031 } 1032 1033 default: 1034 - /* nothing */ 1035 - break; 1036 } 1037 return 0; 1038 }
··· 1031 } 1032 1033 default: 1034 + /* unknown */ 1035 + return -EINVAL; 1036 } 1037 return 0; 1038 }
-8
drivers/media/video/msp3400.h
··· 6 7 /* ---------------------------------------------------------------------- */ 8 9 - struct msp_matrix { 10 - int input; 11 - int output; 12 - }; 13 - 14 - /* ioctl for MSP_SET_MATRIX will have to be registered */ 15 - #define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) 16 - 17 /* This macro is allowed for *constants* only, gcc must calculate it 18 at compile time. Remember -- no floats in kernel mode */ 19 #define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
··· 6 7 /* ---------------------------------------------------------------------- */ 8 9 /* This macro is allowed for *constants* only, gcc must calculate it 10 at compile time. Remember -- no floats in kernel mode */ 11 #define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
+6 -6
drivers/media/video/mt20xx.c
··· 353 } while (xok != 1 ); 354 t->xogc=xogc; 355 356 - t->tv_freq = mt2032_set_tv_freq; 357 - t->radio_freq = mt2032_set_radio_freq; 358 return(1); 359 } 360 ··· 481 i2c_master_recv(c,buf,1); 482 483 tuner_dbg("mt2050: sro is %x\n",buf[0]); 484 - t->tv_freq = mt2050_set_tv_freq; 485 - t->radio_freq = mt2050_set_radio_freq; 486 return 0; 487 } 488 ··· 494 int company_code; 495 496 memset(buf,0,sizeof(buf)); 497 - t->tv_freq = NULL; 498 - t->radio_freq = NULL; 499 t->standby = NULL; 500 if (t->std & V4L2_STD_525_60) { 501 tuner_dbg("pinnacle ntsc\n");
··· 353 } while (xok != 1 ); 354 t->xogc=xogc; 355 356 + t->set_tv_freq = mt2032_set_tv_freq; 357 + t->set_radio_freq = mt2032_set_radio_freq; 358 return(1); 359 } 360 ··· 481 i2c_master_recv(c,buf,1); 482 483 tuner_dbg("mt2050: sro is %x\n",buf[0]); 484 + t->set_tv_freq = mt2050_set_tv_freq; 485 + t->set_radio_freq = mt2050_set_radio_freq; 486 return 0; 487 } 488 ··· 494 int company_code; 495 496 memset(buf,0,sizeof(buf)); 497 + t->set_tv_freq = NULL; 498 + t->set_radio_freq = NULL; 499 t->standby = NULL; 500 if (t->std & V4L2_STD_525_60) { 501 tuner_dbg("pinnacle ntsc\n");
+2 -2
drivers/media/video/tda8290.c
··· 567 } 568 tuner_info("tuner: type set to %s\n", c->name); 569 570 - t->tv_freq = set_tv_freq; 571 - t->radio_freq = set_radio_freq; 572 t->has_signal = has_signal; 573 t->standby = standby; 574 t->tda827x_lpsel = 0;
··· 567 } 568 tuner_info("tuner: type set to %s\n", c->name); 569 570 + t->set_tv_freq = set_tv_freq; 571 + t->set_radio_freq = set_radio_freq; 572 t->has_signal = has_signal; 573 t->standby = standby; 574 t->tda827x_lpsel = 0;
+9 -9
drivers/media/video/tea5767.c
··· 62 63 #define TEA5767_PORT1_HIGH 0x01 64 65 - /* Forth register */ 66 #define TEA5767_PORT2_HIGH 0x80 67 /* Chips stops working. Only I2C bus remains on */ 68 #define TEA5767_STDBY 0x40 ··· 85 /* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */ 86 #define TEA5767_SRCH_IND 0x01 87 88 - /* Fiveth register */ 89 90 /* By activating, it will use Xtal at 13 MHz as reference for divider */ 91 #define TEA5767_PLLREF_ENABLE 0x80 ··· 109 #define TEA5767_STEREO_MASK 0x80 110 #define TEA5767_IF_CNTR_MASK 0x7f 111 112 - /* Four register */ 113 #define TEA5767_ADC_LEVEL_MASK 0xf0 114 115 /* should be 0 */ 116 #define TEA5767_CHIP_ID_MASK 0x0f 117 118 - /* Fiveth register */ 119 /* Reserved for future extensions */ 120 #define TEA5767_RESERVED_MASK 0xff 121 ··· 220 tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); 221 buffer[2] |= TEA5767_HIGH_LO_INJECT; 222 buffer[4] |= TEA5767_PLLREF_ENABLE; 223 - div = (frq * 4000 / 16 + 700000 + 225000 + 25000) / 50000; 224 break; 225 case TEA5767_LOW_LO_13MHz: 226 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); 227 228 buffer[4] |= TEA5767_PLLREF_ENABLE; 229 - div = (frq * 4000 / 16 - 700000 - 225000 + 25000) / 50000; 230 break; 231 case TEA5767_LOW_LO_32768: 232 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); 233 buffer[3] |= TEA5767_XTAL_32768; 234 /* const 700=4000*175 Khz - to adjust freq to right value */ 235 - div = ((frq * 4000 / 16 - 700000 - 225000) + 16384) >> 15; 236 break; 237 case TEA5767_HIGH_LO_32768: 238 default: ··· 350 tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); 351 strlcpy(c->name, "tea5767", sizeof(c->name)); 352 353 - t->tv_freq = set_tv_freq; 354 - t->radio_freq = set_radio_freq; 355 t->has_signal = tea5767_signal; 356 t->is_stereo = tea5767_stereo; 357 t->standby = tea5767_standby;
··· 62 63 #define TEA5767_PORT1_HIGH 0x01 64 65 + /* Fourth register */ 66 #define TEA5767_PORT2_HIGH 0x80 67 /* Chips stops working. Only I2C bus remains on */ 68 #define TEA5767_STDBY 0x40 ··· 85 /* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */ 86 #define TEA5767_SRCH_IND 0x01 87 88 + /* Fifth register */ 89 90 /* By activating, it will use Xtal at 13 MHz as reference for divider */ 91 #define TEA5767_PLLREF_ENABLE 0x80 ··· 109 #define TEA5767_STEREO_MASK 0x80 110 #define TEA5767_IF_CNTR_MASK 0x7f 111 112 + /* Fourth register */ 113 #define TEA5767_ADC_LEVEL_MASK 0xf0 114 115 /* should be 0 */ 116 #define TEA5767_CHIP_ID_MASK 0x0f 117 118 + /* Fifth register */ 119 /* Reserved for future extensions */ 120 #define TEA5767_RESERVED_MASK 0xff 121 ··· 220 tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); 221 buffer[2] |= TEA5767_HIGH_LO_INJECT; 222 buffer[4] |= TEA5767_PLLREF_ENABLE; 223 + div = (frq * (4000 / 16) + 700000 + 225000 + 25000) / 50000; 224 break; 225 case TEA5767_LOW_LO_13MHz: 226 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); 227 228 buffer[4] |= TEA5767_PLLREF_ENABLE; 229 + div = (frq * (4000 / 16) - 700000 - 225000 + 25000) / 50000; 230 break; 231 case TEA5767_LOW_LO_32768: 232 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); 233 buffer[3] |= TEA5767_XTAL_32768; 234 /* const 700=4000*175 Khz - to adjust freq to right value */ 235 + div = ((frq * (4000 / 16) - 700000 - 225000) + 16384) >> 15; 236 break; 237 case TEA5767_HIGH_LO_32768: 238 default: ··· 350 tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); 351 strlcpy(c->name, "tea5767", sizeof(c->name)); 352 353 + t->set_tv_freq = set_tv_freq; 354 + t->set_radio_freq = set_radio_freq; 355 t->has_signal = tea5767_signal; 356 t->is_stereo = tea5767_stereo; 357 t->standby = tea5767_standby;
+52 -33
drivers/media/video/tuner-core.c
··· 82 tuner_warn ("tuner type not set\n"); 83 return; 84 } 85 - if (NULL == t->tv_freq) { 86 tuner_warn ("Tuner has no way to set tv freq\n"); 87 return; 88 } ··· 90 tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n", 91 freq / 16, freq % 16 * 100 / 16, tv_range[0], 92 tv_range[1]); 93 } 94 - t->tv_freq(c, freq); 95 } 96 97 static void set_radio_freq(struct i2c_client *c, unsigned int freq) ··· 108 tuner_warn ("tuner type not set\n"); 109 return; 110 } 111 - if (NULL == t->radio_freq) { 112 tuner_warn ("tuner has no way to set radio frequency\n"); 113 return; 114 } 115 - if (freq <= radio_range[0] * 16000 || freq >= radio_range[1] * 16000) { 116 tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n", 117 freq / 16000, freq % 16000 * 100 / 16000, 118 radio_range[0], radio_range[1]); 119 } 120 121 - t->radio_freq(c, freq); 122 - return; 123 } 124 125 static void set_freq(struct i2c_client *c, unsigned long freq) ··· 136 tuner_dbg("radio freq set to %lu.%02lu\n", 137 freq / 16000, freq % 16000 * 100 / 16000); 138 set_radio_freq(c, freq); 139 break; 140 case V4L2_TUNER_ANALOG_TV: 141 case V4L2_TUNER_DIGITAL_TV: 142 tuner_dbg("tv freq set to %lu.%02lu\n", 143 freq / 16, freq % 16 * 100 / 16); 144 set_tv_freq(c, freq); 145 break; 146 } 147 - t->freq = freq; 148 } 149 150 static void set_type(struct i2c_client *c, unsigned int type, ··· 224 if (t->mode_mask == T_UNINITIALIZED) 225 t->mode_mask = new_mode_mask; 226 227 - set_freq(c, t->freq); 228 tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", 229 c->adapter->name, c->driver->driver.name, c->addr << 1, type, 230 t->mode_mask); ··· 389 default: p = "undefined"; break; 390 } 391 if (t->mode == V4L2_TUNER_RADIO) { 392 - freq = t->freq / 16000; 393 - freq_fraction = (t->freq % 16000) * 100 / 16000; 394 } else { 395 - freq = t->freq / 16; 396 - freq_fraction = (t->freq % 16) * 100 / 16; 397 } 398 tuner_info("Tuner mode: %s\n", p); 399 tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction); ··· 468 t->type = TUNER_TEA5767; 469 t->mode_mask = T_RADIO; 470 t->mode = T_STANDBY; 471 - t->freq = 87.5 * 16; /* Sets freq to FM range */ 472 default_mode_mask &= ~T_RADIO; 473 474 goto register_client; ··· 481 if (default_mode_mask != T_UNINITIALIZED) { 482 tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask); 483 t->mode_mask = default_mode_mask; 484 - t->freq = 400 * 16; /* Sets freq to VHF High */ 485 default_mode_mask = T_UNINITIALIZED; 486 } 487 ··· 578 set_addr(client, (struct tuner_setup *)arg); 579 break; 580 case AUDC_SET_RADIO: 581 - set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO"); 582 break; 583 case TUNER_SET_STANDBY: 584 - { 585 - if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) 586 - return 0; 587 - if (t->standby) 588 - t->standby (client); 589 - break; 590 - } 591 case VIDIOCSAUDIO: 592 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) 593 return 0; ··· 598 599 /* Should be implemented, since bttv calls it */ 600 tuner_dbg("VIDIOCSAUDIO not implemented.\n"); 601 - 602 break; 603 /* --- v4l ioctls --- */ 604 /* take care: bttv does userspace copying, we'll get a ··· 623 if (vc->norm < ARRAY_SIZE(map)) 624 t->std = map[vc->norm]; 625 tuner_fixup_std(t); 626 - if (t->freq) 627 - set_tv_freq(client, t->freq); 628 return 0; 629 } 630 case VIDIOCSFREQ: ··· 698 699 t->std = *id; 700 tuner_fixup_std(t); 701 - if (t->freq) 702 - set_freq(client, t->freq); 703 break; 704 } 705 case VIDIOC_S_FREQUENCY: 706 { 707 struct v4l2_frequency *f = arg; 708 709 - t->freq = f->frequency; 710 switch_v4l2(); 711 if (V4L2_TUNER_RADIO == f->type && 712 V4L2_TUNER_RADIO != t->mode) { ··· 713 == EINVAL) 714 return 0; 715 } 716 - set_freq(client,t->freq); 717 718 break; 719 } ··· 725 return 0; 726 switch_v4l2(); 727 f->type = t->mode; 728 - f->frequency = t->freq; 729 break; 730 } 731 case VIDIOC_G_TUNER: ··· 777 778 if (V4L2_TUNER_RADIO == t->mode) { 779 t->audmode = tuner->audmode; 780 - set_radio_freq(client, t->freq); 781 } 782 break; 783 } ··· 805 struct tuner *t = i2c_get_clientdata (c); 806 807 tuner_dbg ("resume\n"); 808 - if (t->freq) 809 - set_freq(c, t->freq); 810 return 0; 811 } 812
··· 82 tuner_warn ("tuner type not set\n"); 83 return; 84 } 85 + if (NULL == t->set_tv_freq) { 86 tuner_warn ("Tuner has no way to set tv freq\n"); 87 return; 88 } ··· 90 tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n", 91 freq / 16, freq % 16 * 100 / 16, tv_range[0], 92 tv_range[1]); 93 + /* V4L2 spec: if the freq is not possible then the closest 94 + possible value should be selected */ 95 + if (freq < tv_range[0] * 16) 96 + freq = tv_range[0] * 16; 97 + else 98 + freq = tv_range[1] * 16; 99 } 100 + t->set_tv_freq(c, freq); 101 } 102 103 static void set_radio_freq(struct i2c_client *c, unsigned int freq) ··· 102 tuner_warn ("tuner type not set\n"); 103 return; 104 } 105 + if (NULL == t->set_radio_freq) { 106 tuner_warn ("tuner has no way to set radio frequency\n"); 107 return; 108 } 109 + if (freq < radio_range[0] * 16000 || freq > radio_range[1] * 16000) { 110 tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n", 111 freq / 16000, freq % 16000 * 100 / 16000, 112 radio_range[0], radio_range[1]); 113 + /* V4L2 spec: if the freq is not possible then the closest 114 + possible value should be selected */ 115 + if (freq < radio_range[0] * 16000) 116 + freq = radio_range[0] * 16000; 117 + else 118 + freq = radio_range[1] * 16000; 119 } 120 121 + t->set_radio_freq(c, freq); 122 } 123 124 static void set_freq(struct i2c_client *c, unsigned long freq) ··· 125 tuner_dbg("radio freq set to %lu.%02lu\n", 126 freq / 16000, freq % 16000 * 100 / 16000); 127 set_radio_freq(c, freq); 128 + t->radio_freq = freq; 129 break; 130 case V4L2_TUNER_ANALOG_TV: 131 case V4L2_TUNER_DIGITAL_TV: 132 tuner_dbg("tv freq set to %lu.%02lu\n", 133 freq / 16, freq % 16 * 100 / 16); 134 set_tv_freq(c, freq); 135 + t->tv_freq = freq; 136 break; 137 } 138 } 139 140 static void set_type(struct i2c_client *c, unsigned int type, ··· 212 if (t->mode_mask == T_UNINITIALIZED) 213 t->mode_mask = new_mode_mask; 214 215 + set_freq(c, (V4L2_TUNER_RADIO == t->mode) ? t->radio_freq : t->tv_freq); 216 tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", 217 c->adapter->name, c->driver->driver.name, c->addr << 1, type, 218 t->mode_mask); ··· 377 default: p = "undefined"; break; 378 } 379 if (t->mode == V4L2_TUNER_RADIO) { 380 + freq = t->radio_freq / 16000; 381 + freq_fraction = (t->radio_freq % 16000) * 100 / 16000; 382 } else { 383 + freq = t->tv_freq / 16; 384 + freq_fraction = (t->tv_freq % 16) * 100 / 16; 385 } 386 tuner_info("Tuner mode: %s\n", p); 387 tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction); ··· 456 t->type = TUNER_TEA5767; 457 t->mode_mask = T_RADIO; 458 t->mode = T_STANDBY; 459 + t->radio_freq = 87.5 * 16000; /* Sets freq to FM range */ 460 default_mode_mask &= ~T_RADIO; 461 462 goto register_client; ··· 469 if (default_mode_mask != T_UNINITIALIZED) { 470 tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask); 471 t->mode_mask = default_mode_mask; 472 + t->tv_freq = 400 * 16; /* Sets freq to VHF High */ 473 + t->radio_freq = 87.5 * 16000; /* Sets freq to FM range */ 474 default_mode_mask = T_UNINITIALIZED; 475 } 476 ··· 565 set_addr(client, (struct tuner_setup *)arg); 566 break; 567 case AUDC_SET_RADIO: 568 + if (set_mode(client, t, V4L2_TUNER_RADIO, "AUDC_SET_RADIO") 569 + == EINVAL) 570 + return 0; 571 + if (t->radio_freq) 572 + set_freq(client, t->radio_freq); 573 break; 574 case TUNER_SET_STANDBY: 575 + if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) 576 + return 0; 577 + if (t->standby) 578 + t->standby (client); 579 + break; 580 case VIDIOCSAUDIO: 581 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) 582 return 0; ··· 583 584 /* Should be implemented, since bttv calls it */ 585 tuner_dbg("VIDIOCSAUDIO not implemented.\n"); 586 break; 587 /* --- v4l ioctls --- */ 588 /* take care: bttv does userspace copying, we'll get a ··· 609 if (vc->norm < ARRAY_SIZE(map)) 610 t->std = map[vc->norm]; 611 tuner_fixup_std(t); 612 + if (t->tv_freq) 613 + set_tv_freq(client, t->tv_freq); 614 return 0; 615 } 616 case VIDIOCSFREQ: ··· 684 685 t->std = *id; 686 tuner_fixup_std(t); 687 + if (t->tv_freq) 688 + set_freq(client, t->tv_freq); 689 break; 690 } 691 case VIDIOC_S_FREQUENCY: 692 { 693 struct v4l2_frequency *f = arg; 694 695 switch_v4l2(); 696 if (V4L2_TUNER_RADIO == f->type && 697 V4L2_TUNER_RADIO != t->mode) { ··· 700 == EINVAL) 701 return 0; 702 } 703 + set_freq(client,f->frequency); 704 705 break; 706 } ··· 712 return 0; 713 switch_v4l2(); 714 f->type = t->mode; 715 + f->frequency = (V4L2_TUNER_RADIO == t->mode) ? 716 + t->radio_freq : t->tv_freq; 717 break; 718 } 719 case VIDIOC_G_TUNER: ··· 763 764 if (V4L2_TUNER_RADIO == t->mode) { 765 t->audmode = tuner->audmode; 766 + set_radio_freq(client, t->radio_freq); 767 } 768 break; 769 } ··· 791 struct tuner *t = i2c_get_clientdata (c); 792 793 tuner_dbg ("resume\n"); 794 + if (V4L2_TUNER_RADIO == t->mode) { 795 + if (t->radio_freq) 796 + set_freq(c, t->radio_freq); 797 + } else { 798 + if (t->tv_freq) 799 + set_freq(c, t->tv_freq); 800 + } 801 return 0; 802 } 803
+23 -21
drivers/media/video/tuner-simple.c
··· 136 u8 config, tuneraddr; 137 u16 div; 138 struct tunertype *tun; 139 - unsigned char buffer[4]; 140 int rc, IFPCoff, i, j; 141 142 tun = &tuners[t->type]; ··· 146 if (freq > tun->params[j].ranges[i].limit) 147 continue; 148 break; 149 } 150 config = tun->params[j].ranges[i].cb; 151 /* i == 0 -> VHF_LO */ ··· 244 break; 245 } 246 247 - /* 248 - * Philips FI1216MK2 remark from specification : 249 - * for channel selection involving band switching, and to ensure 250 - * smooth tuning to the desired channel without causing 251 - * unnecessary charge pump action, it is recommended to consider 252 - * the difference between wanted channel frequency and the 253 - * current channel frequency. Unnecessary charge pump action 254 - * will result in very low tuning voltage which may drive the 255 - * oscillator to extreme conditions. 256 - * 257 - * Progfou: specification says to send config data before 258 - * frequency in case (wanted frequency < current frequency). 259 - */ 260 - 261 /* IFPCoff = Video Intermediate Frequency - Vif: 262 940 =16*58.75 NTSC/J (Japan) 263 732 =16*45.75 M/N STD ··· 275 offset / 16, offset % 16 * 100 / 16, 276 div); 277 278 - if (t->type == TUNER_PHILIPS_SECAM && freq < t->freq) { 279 buffer[0] = tun->params[j].config; 280 buffer[1] = config; 281 buffer[2] = (div>>8) & 0x7f; ··· 286 buffer[2] = tun->params[j].config; 287 buffer[3] = config; 288 } 289 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 290 buffer[0],buffer[1],buffer[2],buffer[3]); 291 ··· 329 { 330 struct tunertype *tun; 331 struct tuner *t = i2c_get_clientdata(c); 332 - unsigned char buffer[4]; 333 - unsigned div; 334 int rc, j; 335 336 tun = &tuners[t->type]; ··· 366 } 367 buffer[0] = (div>>8) & 0x7f; 368 buffer[1] = div & 0xff; 369 370 tuner_dbg("radio 0x%02x 0x%02x 0x%02x 0x%02x\n", 371 buffer[0],buffer[1],buffer[2],buffer[3]); 372 373 if (4 != (rc = i2c_master_send(c,buffer,4))) 374 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); ··· 392 t->type, tuners[t->type].name); 393 strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); 394 395 - t->tv_freq = default_set_tv_freq; 396 - t->radio_freq = default_set_radio_freq; 397 t->has_signal = tuner_signal; 398 - t->is_stereo = tuner_stereo; 399 t->standby = NULL; 400 401 return 0;
··· 136 u8 config, tuneraddr; 137 u16 div; 138 struct tunertype *tun; 139 + u8 buffer[4]; 140 int rc, IFPCoff, i, j; 141 142 tun = &tuners[t->type]; ··· 146 if (freq > tun->params[j].ranges[i].limit) 147 continue; 148 break; 149 + } 150 + if (i == tun->params[j].count) { 151 + tuner_dbg("TV frequency out of range (%d > %d)", 152 + freq, tun->params[j].ranges[i - 1].limit); 153 + freq = tun->params[j].ranges[--i].limit; 154 } 155 config = tun->params[j].ranges[i].cb; 156 /* i == 0 -> VHF_LO */ ··· 239 break; 240 } 241 242 /* IFPCoff = Video Intermediate Frequency - Vif: 243 940 =16*58.75 NTSC/J (Japan) 244 732 =16*45.75 M/N STD ··· 284 offset / 16, offset % 16 * 100 / 16, 285 div); 286 287 + if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) { 288 buffer[0] = tun->params[j].config; 289 buffer[1] = config; 290 buffer[2] = (div>>8) & 0x7f; ··· 295 buffer[2] = tun->params[j].config; 296 buffer[3] = config; 297 } 298 + t->last_div = div; 299 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 300 buffer[0],buffer[1],buffer[2],buffer[3]); 301 ··· 337 { 338 struct tunertype *tun; 339 struct tuner *t = i2c_get_clientdata(c); 340 + u8 buffer[4]; 341 + u16 div; 342 int rc, j; 343 344 tun = &tuners[t->type]; ··· 374 } 375 buffer[0] = (div>>8) & 0x7f; 376 buffer[1] = div & 0xff; 377 + if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) { 378 + buffer[0] = buffer[2]; 379 + buffer[1] = buffer[3]; 380 + buffer[2] = (div>>8) & 0x7f; 381 + buffer[3] = div & 0xff; 382 + } else { 383 + buffer[0] = (div>>8) & 0x7f; 384 + buffer[1] = div & 0xff; 385 + } 386 387 tuner_dbg("radio 0x%02x 0x%02x 0x%02x 0x%02x\n", 388 buffer[0],buffer[1],buffer[2],buffer[3]); 389 + t->last_div = div; 390 391 if (4 != (rc = i2c_master_send(c,buffer,4))) 392 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); ··· 390 t->type, tuners[t->type].name); 391 strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); 392 393 + t->set_tv_freq = default_set_tv_freq; 394 + t->set_radio_freq = default_set_radio_freq; 395 t->has_signal = tuner_signal; 396 + t->is_stereo = tuner_stereo; 397 t->standby = NULL; 398 399 return 0;
+6
drivers/media/video/tuner-types.c
··· 81 .ranges = tuner_philips_ntsc_ranges, 82 .count = ARRAY_SIZE(tuner_philips_ntsc_ranges), 83 .config = 0x8e, 84 }, 85 }; 86 ··· 99 .ranges = tuner_philips_secam_ranges, 100 .count = ARRAY_SIZE(tuner_philips_secam_ranges), 101 .config = 0x8e, 102 }, 103 }; 104 ··· 117 .ranges = tuner_philips_pal_ranges, 118 .count = ARRAY_SIZE(tuner_philips_pal_ranges), 119 .config = 0x8e, 120 }, 121 }; 122 ··· 599 .ranges = tuner_fm1216me_mk3_pal_ranges, 600 .count = ARRAY_SIZE(tuner_fm1216me_mk3_pal_ranges), 601 .config = 0x8e, 602 }, 603 }; 604 ··· 674 .ranges = tuner_fm1236_mk3_ntsc_ranges, 675 .count = ARRAY_SIZE(tuner_fm1236_mk3_ntsc_ranges), 676 .config = 0x8e, 677 }, 678 }; 679 ··· 789 .ranges = tuner_tcl_2002n_ntsc_ranges, 790 .count = ARRAY_SIZE(tuner_tcl_2002n_ntsc_ranges), 791 .config = 0x8e, 792 }, 793 }; 794
··· 81 .ranges = tuner_philips_ntsc_ranges, 82 .count = ARRAY_SIZE(tuner_philips_ntsc_ranges), 83 .config = 0x8e, 84 + .cb_first_if_lower_freq = 1, 85 }, 86 }; 87 ··· 98 .ranges = tuner_philips_secam_ranges, 99 .count = ARRAY_SIZE(tuner_philips_secam_ranges), 100 .config = 0x8e, 101 + .cb_first_if_lower_freq = 1, 102 }, 103 }; 104 ··· 115 .ranges = tuner_philips_pal_ranges, 116 .count = ARRAY_SIZE(tuner_philips_pal_ranges), 117 .config = 0x8e, 118 + .cb_first_if_lower_freq = 1, 119 }, 120 }; 121 ··· 596 .ranges = tuner_fm1216me_mk3_pal_ranges, 597 .count = ARRAY_SIZE(tuner_fm1216me_mk3_pal_ranges), 598 .config = 0x8e, 599 + .cb_first_if_lower_freq = 1, 600 }, 601 }; 602 ··· 670 .ranges = tuner_fm1236_mk3_ntsc_ranges, 671 .count = ARRAY_SIZE(tuner_fm1236_mk3_ntsc_ranges), 672 .config = 0x8e, 673 + .cb_first_if_lower_freq = 1, 674 }, 675 }; 676 ··· 784 .ranges = tuner_tcl_2002n_ntsc_ranges, 785 .count = ARRAY_SIZE(tuner_tcl_2002n_ntsc_ranges), 786 .config = 0x8e, 787 + .cb_first_if_lower_freq = 1, 788 }, 789 }; 790
+1
drivers/media/video/v4l2-common.c
··· 306 #endif 307 [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", 308 [_IOC_NR(AUDC_SET_INPUT)] = "AUDC_SET_INPUT", 309 310 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", 311 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY",
··· 306 #endif 307 [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", 308 [_IOC_NR(AUDC_SET_INPUT)] = "AUDC_SET_INPUT", 309 + [_IOC_NR(MSP_SET_MATRIX)] = "MSP_SET_MATRIX", 310 311 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", 312 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY",
+19 -1
include/media/tuner-types.h
··· 19 20 struct tuner_params { 21 enum param_type type; 22 unsigned char config; /* to be moved into struct tuner_range for dvb-pll merge */ 23 24 unsigned int count; ··· 46 47 struct tunertype { 48 char *name; 49 - unsigned int has_tda988x:1; 50 struct tuner_params *params; 51 }; 52
··· 19 20 struct tuner_params { 21 enum param_type type; 22 + /* Many Philips based tuners have a comment like this in their 23 + * datasheet: 24 + * 25 + * For channel selection involving band switching, and to ensure 26 + * smooth tuning to the desired channel without causing 27 + * unnecessary charge pump action, it is recommended to consider 28 + * the difference between wanted channel frequency and the 29 + * current channel frequency. Unnecessary charge pump action 30 + * will result in very low tuning voltage which may drive the 31 + * oscillator to extreme conditions. 32 + * 33 + * Set cb_first_if_lower_freq to 1, if this check is 34 + * required for this tuner. 35 + * 36 + * I tested this for PAL by first setting the TV frequency to 37 + * 203 MHz and then switching to 96.6 MHz FM radio. The result was 38 + * static unless the control byte was sent first. 39 + */ 40 + unsigned int cb_first_if_lower_freq:1; 41 unsigned char config; /* to be moved into struct tuner_range for dvb-pll merge */ 42 43 unsigned int count; ··· 27 28 struct tunertype { 29 char *name; 30 struct tuner_params *params; 31 }; 32
+5 -3
include/media/tuner.h
··· 179 unsigned int mode; 180 unsigned int mode_mask; /* Combination of allowable modes */ 181 182 - unsigned int freq; /* keep track of the current settings */ 183 unsigned int audmode; 184 v4l2_std_id std; 185 ··· 199 unsigned int sgIF; 200 201 /* function ptrs */ 202 - void (*tv_freq)(struct i2c_client *c, unsigned int freq); 203 - void (*radio_freq)(struct i2c_client *c, unsigned int freq); 204 int (*has_signal)(struct i2c_client *c); 205 int (*is_stereo)(struct i2c_client *c); 206 void (*standby)(struct i2c_client *c);
··· 179 unsigned int mode; 180 unsigned int mode_mask; /* Combination of allowable modes */ 181 182 + unsigned int tv_freq; /* keep track of the current settings */ 183 + unsigned int radio_freq; 184 + u16 last_div; 185 unsigned int audmode; 186 v4l2_std_id std; 187 ··· 197 unsigned int sgIF; 198 199 /* function ptrs */ 200 + void (*set_tv_freq)(struct i2c_client *c, unsigned int freq); 201 + void (*set_radio_freq)(struct i2c_client *c, unsigned int freq); 202 int (*has_signal)(struct i2c_client *c); 203 int (*is_stereo)(struct i2c_client *c); 204 void (*standby)(struct i2c_client *c);
+7
include/media/v4l2-common.h
··· 120 /* select from TV,radio,extern,MUTE */ 121 #define AUDC_SET_INPUT _IOW('d',89,int) 122 123 /* tuner ioctls */ 124 /* Sets tuner type and its I2C addr */ 125 #define TUNER_SET_TYPE_ADDR _IOW('d',90,int)
··· 120 /* select from TV,radio,extern,MUTE */ 121 #define AUDC_SET_INPUT _IOW('d',89,int) 122 123 + /* msp3400 ioctl: will be removed in the near future */ 124 + struct msp_matrix { 125 + int input; 126 + int output; 127 + }; 128 + #define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) 129 + 130 /* tuner ioctls */ 131 /* Sets tuner type and its I2C addr */ 132 #define TUNER_SET_TYPE_ADDR _IOW('d',90,int)