[PATCH] v4l: update for tuner cards and some V4L chips

Tuner improvements and additions. TEA5767 FM tuner added. Several small
fixes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Nickolay V Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Mauro Carvalho Chehab and committed by Linus Torvalds 56fc08ca b45009b0

+333 -155
+26 -13
drivers/media/common/ir-common.c
··· 1 /* 2 - * $Id: ir-common.c,v 1.8 2005/02/22 12:28:40 kraxel Exp $ 3 * 4 * some common structs and functions to handle infrared remotes via 5 * input layer ... ··· 131 [ 18 ] = KEY_KP0, 132 133 [ 0 ] = KEY_POWER, 134 - [ 27 ] = KEY_LANGUAGE, //MTS button 135 [ 2 ] = KEY_TUNER, // TV/FM 136 [ 30 ] = KEY_VIDEO, 137 - [ 22 ] = KEY_INFO, //display button 138 [ 4 ] = KEY_VOLUMEUP, 139 [ 8 ] = KEY_VOLUMEDOWN, 140 [ 12 ] = KEY_CHANNELUP, ··· 142 [ 3 ] = KEY_ZOOM, // fullscreen 143 [ 31 ] = KEY_SUBTITLE, // closed caption/teletext 144 [ 32 ] = KEY_SLEEP, 145 - [ 41 ] = KEY_SEARCH, //boss key 146 [ 20 ] = KEY_MUTE, 147 [ 43 ] = KEY_RED, 148 [ 44 ] = KEY_GREEN, ··· 150 [ 46 ] = KEY_BLUE, 151 [ 24 ] = KEY_KPPLUS, //fine tune + 152 [ 25 ] = KEY_KPMINUS, //fine tune - 153 - [ 42 ] = KEY_ANGLE, //picture in picture 154 - [ 33 ] = KEY_KPDOT, 155 [ 19 ] = KEY_KPENTER, 156 - [ 17 ] = KEY_AGAIN, //recall 157 [ 34 ] = KEY_BACK, 158 [ 35 ] = KEY_PLAYPAUSE, 159 [ 36 ] = KEY_NEXT, 160 - [ 37 ] = KEY_T, //time shifting 161 [ 38 ] = KEY_STOP, 162 - [ 39 ] = KEY_RECORD, 163 - [ 40 ] = KEY_SHUFFLE //snapshot 164 }; 165 EXPORT_SYMBOL_GPL(ir_codes_winfast); 166 ··· 184 [ 0x07 ] = KEY_KP7, // 7 185 [ 0x08 ] = KEY_KP8, // 8 186 [ 0x09 ] = KEY_KP9, // 9 187 [ 0x0b ] = KEY_RED, // red button 188 - [ 0x0c ] = KEY_OPTION, // black key without text 189 [ 0x0d ] = KEY_MENU, // menu 190 [ 0x0f ] = KEY_MUTE, // mute 191 [ 0x10 ] = KEY_VOLUMEUP, // volume + 192 [ 0x11 ] = KEY_VOLUMEDOWN, // volume - 193 - [ 0x1e ] = KEY_NEXT, // skip >| 194 [ 0x1f ] = KEY_EXIT, // back/exit 195 [ 0x20 ] = KEY_CHANNELUP, // channel / program + 196 [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - 197 [ 0x22 ] = KEY_CHANNEL, // source (old black remote) 198 - [ 0x24 ] = KEY_PREVIOUS, // replay |< 199 [ 0x25 ] = KEY_ENTER, // OK 200 [ 0x26 ] = KEY_SLEEP, // minimize (old black remote) 201 [ 0x29 ] = KEY_BLUE, // blue key ··· 424 * c-basic-offset: 8 425 * End: 426 */
··· 1 /* 2 + * $Id: ir-common.c,v 1.10 2005/05/22 19:23:39 nsh Exp $ 3 * 4 * some common structs and functions to handle infrared remotes via 5 * input layer ... ··· 131 [ 18 ] = KEY_KP0, 132 133 [ 0 ] = KEY_POWER, 134 + // [ 27 ] = MTS button 135 [ 2 ] = KEY_TUNER, // TV/FM 136 [ 30 ] = KEY_VIDEO, 137 + // [ 22 ] = display button 138 [ 4 ] = KEY_VOLUMEUP, 139 [ 8 ] = KEY_VOLUMEDOWN, 140 [ 12 ] = KEY_CHANNELUP, ··· 142 [ 3 ] = KEY_ZOOM, // fullscreen 143 [ 31 ] = KEY_SUBTITLE, // closed caption/teletext 144 [ 32 ] = KEY_SLEEP, 145 + // [ 41 ] = boss key 146 [ 20 ] = KEY_MUTE, 147 [ 43 ] = KEY_RED, 148 [ 44 ] = KEY_GREEN, ··· 150 [ 46 ] = KEY_BLUE, 151 [ 24 ] = KEY_KPPLUS, //fine tune + 152 [ 25 ] = KEY_KPMINUS, //fine tune - 153 + // [ 42 ] = picture in picture 154 + [ 33 ] = KEY_KPDOT, 155 [ 19 ] = KEY_KPENTER, 156 + // [ 17 ] = recall 157 [ 34 ] = KEY_BACK, 158 [ 35 ] = KEY_PLAYPAUSE, 159 [ 36 ] = KEY_NEXT, 160 + // [ 37 ] = time shifting 161 [ 38 ] = KEY_STOP, 162 + [ 39 ] = KEY_RECORD 163 + // [ 40 ] = snapshot 164 }; 165 EXPORT_SYMBOL_GPL(ir_codes_winfast); 166 ··· 184 [ 0x07 ] = KEY_KP7, // 7 185 [ 0x08 ] = KEY_KP8, // 8 186 [ 0x09 ] = KEY_KP9, // 9 187 + [ 0x0a ] = KEY_TEXT, // keypad asterisk as well 188 [ 0x0b ] = KEY_RED, // red button 189 + [ 0x0c ] = KEY_RADIO, // radio 190 [ 0x0d ] = KEY_MENU, // menu 191 + [ 0x0e ] = KEY_SUBTITLE, // also the # key 192 [ 0x0f ] = KEY_MUTE, // mute 193 [ 0x10 ] = KEY_VOLUMEUP, // volume + 194 [ 0x11 ] = KEY_VOLUMEDOWN, // volume - 195 + [ 0x12 ] = KEY_PREVIOUS, // previous channel 196 + [ 0x14 ] = KEY_UP, // up 197 + [ 0x15 ] = KEY_DOWN, // down 198 + [ 0x16 ] = KEY_LEFT, // left 199 + [ 0x17 ] = KEY_RIGHT, // right 200 + [ 0x18 ] = KEY_VIDEO, // Videos 201 + [ 0x19 ] = KEY_AUDIO, // Music 202 + [ 0x1a ] = KEY_MHP, // Pictures - presume this means "Multimedia Home Platform"- no "PICTURES" key in input.h 203 + [ 0x1b ] = KEY_EPG, // Guide 204 + [ 0x1c ] = KEY_TV, // TV 205 + [ 0x1e ] = KEY_NEXTSONG, // skip >| 206 [ 0x1f ] = KEY_EXIT, // back/exit 207 [ 0x20 ] = KEY_CHANNELUP, // channel / program + 208 [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - 209 [ 0x22 ] = KEY_CHANNEL, // source (old black remote) 210 + [ 0x24 ] = KEY_PREVIOUSSONG, // replay |< 211 [ 0x25 ] = KEY_ENTER, // OK 212 [ 0x26 ] = KEY_SLEEP, // minimize (old black remote) 213 [ 0x29 ] = KEY_BLUE, // blue key ··· 412 * c-basic-offset: 8 413 * End: 414 */ 415 +
+30 -20
drivers/media/video/bt832.c
··· 6 It outputs an 8-bit 4:2:2 YUV or YCrCb video signal which can be directly 7 connected to bt848/bt878 GPIO pins on this purpose. 8 (see: VLSI Vision Ltd. www.vvl.co.uk for camera datasheets) 9 - 10 Supported Cards: 11 - Pixelview Rev.4E: 0x8a 12 GPIO 0x400000 toggles Bt832 RESET, and the chip changes to i2c 0x88 ! ··· 31 #include <linux/errno.h> 32 #include <linux/slab.h> 33 34 - #include "id.h" 35 - #include "audiochip.h" 36 #include "bttv.h" 37 #include "bt832.h" 38 39 MODULE_LICENSE("GPL"); 40 41 /* Addresses to scan */ 42 - static unsigned short normal_i2c[] = { I2C_BT832_ALT1>>1, I2C_BT832_ALT2>>1, 43 - I2C_CLIENT_END }; 44 I2C_CLIENT_INSMOD; 45 46 /* ---------------------------------------------------------------------- */ ··· 95 96 buf=kmalloc(65,GFP_KERNEL); 97 bt832_hexdump(i2c_client_s,buf); 98 - 99 if(buf[0x40] != 0x31) { 100 printk("bt832: this i2c chip is no bt832 (id=%02x). Detaching.\n",buf[0x40]); 101 kfree(buf); ··· 135 buf[1]= 0x27 & (~0x01); // Default | !skip 136 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) 137 printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); 138 - 139 bt832_hexdump(i2c_client_s,buf); 140 141 #if 0 ··· 168 169 170 171 - static int bt832_attach(struct i2c_adapter *adap, int addr, 172 - unsigned short flags, int kind) 173 { 174 struct bt832 *t; 175 ··· 183 return -ENOMEM; 184 memset(t,0,sizeof(*t)); 185 t->client = client_template; 186 - t->client.data = t; 187 i2c_attach_client(&t->client); 188 189 if(! bt832_init(&t->client)) { 190 bt832_detach(&t->client); 191 return -1; 192 } 193 - 194 return 0; 195 } 196 197 static int bt832_probe(struct i2c_adapter *adap) 198 { 199 if (adap->class & I2C_CLASS_TV_ANALOG) 200 return i2c_probe(adap, &addr_data, bt832_attach); 201 return 0; 202 } 203 204 static int bt832_detach(struct i2c_client *client) 205 { 206 - struct bt832 *t = (struct bt832*)client->data; 207 208 printk("bt832: detach.\n"); 209 i2c_detach_client(client); ··· 219 static int 220 bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) 221 { 222 - struct bt832 *t = (struct bt832*)client->data; 223 224 printk("bt832: command %x\n",cmd); 225 ··· 253 }; 254 static struct i2c_client client_template = 255 { 256 - .name = "bt832", 257 - .flags = I2C_CLIENT_ALLOW_USE, 258 - .driver = &driver, 259 }; 260 261 262 - int bt832_init_module(void) 263 { 264 - i2c_add_driver(&driver); 265 - return 0; 266 } 267 268 - static void bt832_cleanup_module(void) 269 { 270 i2c_del_driver(&driver); 271 } ··· 272 module_init(bt832_init_module); 273 module_exit(bt832_cleanup_module); 274
··· 6 It outputs an 8-bit 4:2:2 YUV or YCrCb video signal which can be directly 7 connected to bt848/bt878 GPIO pins on this purpose. 8 (see: VLSI Vision Ltd. www.vvl.co.uk for camera datasheets) 9 + 10 Supported Cards: 11 - Pixelview Rev.4E: 0x8a 12 GPIO 0x400000 toggles Bt832 RESET, and the chip changes to i2c 0x88 ! ··· 31 #include <linux/errno.h> 32 #include <linux/slab.h> 33 34 + #include <media/audiochip.h> 35 + #include <media/id.h> 36 #include "bttv.h" 37 #include "bt832.h" 38 39 MODULE_LICENSE("GPL"); 40 41 /* Addresses to scan */ 42 + static unsigned short normal_i2c[] = {I2C_CLIENT_END}; 43 + static unsigned short normal_i2c_range[] = {I2C_BT832_ALT1>>1,I2C_BT832_ALT2>>1,I2C_CLIENT_END}; 44 I2C_CLIENT_INSMOD; 45 46 /* ---------------------------------------------------------------------- */ ··· 95 96 buf=kmalloc(65,GFP_KERNEL); 97 bt832_hexdump(i2c_client_s,buf); 98 + 99 if(buf[0x40] != 0x31) { 100 printk("bt832: this i2c chip is no bt832 (id=%02x). Detaching.\n",buf[0x40]); 101 kfree(buf); ··· 135 buf[1]= 0x27 & (~0x01); // Default | !skip 136 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) 137 printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); 138 + 139 bt832_hexdump(i2c_client_s,buf); 140 141 #if 0 ··· 168 169 170 171 + static int bt832_attach(struct i2c_adapter *adap, int addr, int kind) 172 { 173 struct bt832 *t; 174 ··· 184 return -ENOMEM; 185 memset(t,0,sizeof(*t)); 186 t->client = client_template; 187 + i2c_set_clientdata(&t->client, t); 188 i2c_attach_client(&t->client); 189 190 if(! bt832_init(&t->client)) { 191 bt832_detach(&t->client); 192 return -1; 193 } 194 + 195 return 0; 196 } 197 198 static int bt832_probe(struct i2c_adapter *adap) 199 { 200 + #ifdef I2C_CLASS_TV_ANALOG 201 if (adap->class & I2C_CLASS_TV_ANALOG) 202 return i2c_probe(adap, &addr_data, bt832_attach); 203 + #else 204 + if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848)) 205 + return i2c_probe(adap, &addr_data, bt832_attach); 206 + #endif 207 return 0; 208 } 209 210 static int bt832_detach(struct i2c_client *client) 211 { 212 + struct bt832 *t = i2c_get_clientdata(client); 213 214 printk("bt832: detach.\n"); 215 i2c_detach_client(client); ··· 215 static int 216 bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) 217 { 218 + struct bt832 *t = i2c_get_clientdata(client); 219 220 printk("bt832: command %x\n",cmd); 221 ··· 249 }; 250 static struct i2c_client client_template = 251 { 252 + I2C_DEVNAME("bt832"), 253 + .flags = I2C_CLIENT_ALLOW_USE, 254 + .driver = &driver, 255 }; 256 257 258 + static int __init bt832_init_module(void) 259 { 260 + return i2c_add_driver(&driver); 261 } 262 263 + static void __exit bt832_cleanup_module(void) 264 { 265 i2c_del_driver(&driver); 266 } ··· 269 module_init(bt832_init_module); 270 module_exit(bt832_cleanup_module); 271 272 + /* 273 + * Overrides for Emacs so that we follow Linus's tabbing style. 274 + * --------------------------------------------------------------------------- 275 + * Local variables: 276 + * c-basic-offset: 8 277 + * End: 278 + */
+18 -18
drivers/media/video/bt832.h
··· 1 /* Bt832 CMOS Camera Video Processor (VP) 2 3 - The Bt832 CMOS Camera Video Processor chip connects a Quartsight CMOS 4 color digital camera directly to video capture devices via an 8-bit, 5 4:2:2 YUV or YCrCb video interface. 6 ··· 85 #define BT832_DEVICE_ID 63 86 # define BT832_DEVICE_ID__31 0x31 // Bt832 has ID 0x31 87 88 - /* STMicroelectronivcs VV5404 camera module 89 i2c: 0x20: sensor address 90 i2c: 0xa0: eeprom for ccd defect map 91 */ ··· 256 //=========================================================================== 257 // Timing generator SRAM table values for CCIR601 720x480 NTSC 258 //=========================================================================== 259 - // For NTSC CCIR656 260 BYTE BtCard::SRAMTable_NTSC[] = 261 { 262 // SRAM Timing Table for NTSC 263 - 0x0c, 0xc0, 0x00, 264 - 0x00, 0x90, 0xc2, 265 - 0x03, 0x10, 0x03, 266 - 0x06, 0x10, 0x34, 267 - 0x12, 0x12, 0x65, 268 - 0x02, 0x13, 0x24, 269 - 0x19, 0x00, 0x24, 270 - 0x39, 0x00, 0x96, 271 - 0x59, 0x08, 0x93, 272 0x83, 0x08, 0x97, 273 - 0x03, 0x50, 0x30, 274 - 0xc0, 0x40, 0x30, 275 - 0x86, 0x01, 0x01, 276 - 0xa6, 0x0d, 0x62, 277 - 0x03, 0x11, 0x61, 278 - 0x05, 0x37, 0x30, 279 0xac, 0x21, 0x50 280 }; 281
··· 1 /* Bt832 CMOS Camera Video Processor (VP) 2 3 + The Bt832 CMOS Camera Video Processor chip connects a Quartsight CMOS 4 color digital camera directly to video capture devices via an 8-bit, 5 4:2:2 YUV or YCrCb video interface. 6 ··· 85 #define BT832_DEVICE_ID 63 86 # define BT832_DEVICE_ID__31 0x31 // Bt832 has ID 0x31 87 88 + /* STMicroelectronivcs VV5404 camera module 89 i2c: 0x20: sensor address 90 i2c: 0xa0: eeprom for ccd defect map 91 */ ··· 256 //=========================================================================== 257 // Timing generator SRAM table values for CCIR601 720x480 NTSC 258 //=========================================================================== 259 + // For NTSC CCIR656 260 BYTE BtCard::SRAMTable_NTSC[] = 261 { 262 // SRAM Timing Table for NTSC 263 + 0x0c, 0xc0, 0x00, 264 + 0x00, 0x90, 0xc2, 265 + 0x03, 0x10, 0x03, 266 + 0x06, 0x10, 0x34, 267 + 0x12, 0x12, 0x65, 268 + 0x02, 0x13, 0x24, 269 + 0x19, 0x00, 0x24, 270 + 0x39, 0x00, 0x96, 271 + 0x59, 0x08, 0x93, 272 0x83, 0x08, 0x97, 273 + 0x03, 0x50, 0x30, 274 + 0xc0, 0x40, 0x30, 275 + 0x86, 0x01, 0x01, 276 + 0xa6, 0x0d, 0x62, 277 + 0x03, 0x11, 0x61, 278 + 0x05, 0x37, 0x30, 279 0xac, 0x21, 0x50 280 }; 281
+5 -8
drivers/media/video/msp3400.c
··· 147 I2C_MSP3400C_ALT >> 1, 148 I2C_CLIENT_END 149 }; 150 I2C_CLIENT_INSMOD; 151 152 /* ----------------------------------------------------------------------- */ ··· 736 { 737 DECLARE_WAITQUEUE(wait, current); 738 739 - again: 740 add_wait_queue(&msp->wq, &wait); 741 if (!kthread_should_stop()) { 742 if (timeout < 0) { ··· 751 #endif 752 } 753 } 754 - 755 remove_wait_queue(&msp->wq, &wait); 756 - 757 - if (try_to_freeze(PF_FREEZE)) 758 - goto again; 759 - 760 return msp->restart; 761 } 762 ··· 1433 static int msp_probe(struct i2c_adapter *adap); 1434 static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg); 1435 1436 - static int msp_suspend(struct device * dev, pm_message_t state, u32 level); 1437 static int msp_resume(struct device * dev, u32 level); 1438 1439 static void msp_wake_thread(struct i2c_client *client); ··· 1838 return 0; 1839 } 1840 1841 - static int msp_suspend(struct device * dev, pm_message_t state, u32 level) 1842 { 1843 struct i2c_client *c = container_of(dev, struct i2c_client, dev); 1844
··· 147 I2C_MSP3400C_ALT >> 1, 148 I2C_CLIENT_END 149 }; 150 + static unsigned short normal_i2c_range[] = {I2C_CLIENT_END,I2C_CLIENT_END}; 151 I2C_CLIENT_INSMOD; 152 153 /* ----------------------------------------------------------------------- */ ··· 735 { 736 DECLARE_WAITQUEUE(wait, current); 737 738 add_wait_queue(&msp->wq, &wait); 739 if (!kthread_should_stop()) { 740 if (timeout < 0) { ··· 751 #endif 752 } 753 } 754 + if (current->flags & PF_FREEZE) 755 + refrigerator(PF_FREEZE); 756 remove_wait_queue(&msp->wq, &wait); 757 return msp->restart; 758 } 759 ··· 1436 static int msp_probe(struct i2c_adapter *adap); 1437 static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg); 1438 1439 + static int msp_suspend(struct device * dev, u32 state, u32 level); 1440 static int msp_resume(struct device * dev, u32 level); 1441 1442 static void msp_wake_thread(struct i2c_client *client); ··· 1841 return 0; 1842 } 1843 1844 + static int msp_suspend(struct device * dev, u32 state, u32 level) 1845 { 1846 struct i2c_client *c = container_of(dev, struct i2c_client, dev); 1847
+4
drivers/media/video/msp3400.h
··· 1 #ifndef MSP3400_H 2 #define MSP3400_H 3
··· 1 + /* 2 + * $Id: msp3400.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $ 3 + */ 4 + 5 #ifndef MSP3400_H 6 #define MSP3400_H 7
+1
drivers/media/video/tda7432.c
··· 74 I2C_TDA7432 >> 1, 75 I2C_CLIENT_END, 76 }; 77 I2C_CLIENT_INSMOD; 78 79 /* Structure of address and subaddresses for the tda7432 */
··· 74 I2C_TDA7432 >> 1, 75 I2C_CLIENT_END, 76 }; 77 + static unsigned short normal_i2c_range[] = { I2C_CLIENT_END, I2C_CLIENT_END }; 78 I2C_CLIENT_INSMOD; 79 80 /* Structure of address and subaddresses for the tda7432 */
+1
drivers/media/video/tda9875.c
··· 44 I2C_TDA9875 >> 1, 45 I2C_CLIENT_END 46 }; 47 I2C_CLIENT_INSMOD; 48 49 /* This is a superset of the TDA9875 */
··· 44 I2C_TDA9875 >> 1, 45 I2C_CLIENT_END 46 }; 47 + static unsigned short normal_i2c_range[] = {I2C_CLIENT_END}; 48 I2C_CLIENT_INSMOD; 49 50 /* This is a superset of the TDA9875 */
+36 -5
drivers/media/video/tda9887.c
··· 33 0x96 >>1, 34 I2C_CLIENT_END, 35 }; 36 I2C_CLIENT_INSMOD; 37 38 /* insmod options */ ··· 54 unsigned int config; 55 unsigned int pinnacle_id; 56 unsigned int using_v4l2; 57 }; 58 59 struct tvnorm { ··· 214 } 215 }; 216 217 - static struct tvnorm radio = { 218 - .name = "radio", 219 .b = ( cFmRadio | 220 cQSS ), 221 .c = ( cDeemphasisON | 222 - cDeemphasis50 ), 223 .e = ( cAudioIF_5_5 | 224 cRadioIF_38_90 ), 225 }; ··· 366 int i; 367 368 if (t->radio) { 369 - norm = &radio; 370 } else { 371 for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { 372 if (tvnorms[i].std & t->std) { ··· 560 561 memset(buf,0,sizeof(buf)); 562 tda9887_set_tvnorm(t,buf); 563 buf[1] |= cOutputPort1Inactive; 564 buf[1] |= cOutputPort2Inactive; 565 if (UNSET != t->pinnacle_id) { 566 tda9887_set_pinnacle(t,buf); 567 } 568 tda9887_set_config(t,buf); 569 tda9887_set_insmod(t,buf); 570 ··· 610 if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) 611 return -ENOMEM; 612 memset(t,0,sizeof(*t)); 613 t->client = client_template; 614 t->std = 0; 615 t->pinnacle_id = UNSET; 616 i2c_set_clientdata(&t->client, t); 617 i2c_attach_client(&t->client); 618 ··· 754 } 755 break; 756 } 757 default: 758 /* nothing */ 759 break; ··· 771 return 0; 772 } 773 774 - static int tda9887_suspend(struct device * dev, pm_message_t state, u32 level) 775 { 776 dprintk("tda9887: suspend\n"); 777 return 0;
··· 33 0x96 >>1, 34 I2C_CLIENT_END, 35 }; 36 + static unsigned short normal_i2c_range[] = {I2C_CLIENT_END,I2C_CLIENT_END}; 37 I2C_CLIENT_INSMOD; 38 39 /* insmod options */ ··· 53 unsigned int config; 54 unsigned int pinnacle_id; 55 unsigned int using_v4l2; 56 + unsigned int radio_mode; 57 }; 58 59 struct tvnorm { ··· 212 } 213 }; 214 215 + static struct tvnorm radio_stereo = { 216 + .name = "Radio Stereo", 217 + .b = ( cFmRadio | 218 + cQSS ), 219 + .c = ( cDeemphasisOFF | 220 + cAudioGain6 ), 221 + .e = ( cAudioIF_5_5 | 222 + cRadioIF_38_90 ), 223 + }; 224 + 225 + static struct tvnorm radio_mono = { 226 + .name = "Radio Mono", 227 .b = ( cFmRadio | 228 cQSS ), 229 .c = ( cDeemphasisON | 230 + cDeemphasis50), 231 .e = ( cAudioIF_5_5 | 232 cRadioIF_38_90 ), 233 }; ··· 354 int i; 355 356 if (t->radio) { 357 + if (t->radio_mode == V4L2_TUNER_MODE_MONO) 358 + norm = &radio_mono; 359 + else 360 + norm = &radio_stereo; 361 } else { 362 for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { 363 if (tvnorms[i].std & t->std) { ··· 545 546 memset(buf,0,sizeof(buf)); 547 tda9887_set_tvnorm(t,buf); 548 + 549 buf[1] |= cOutputPort1Inactive; 550 buf[1] |= cOutputPort2Inactive; 551 + 552 if (UNSET != t->pinnacle_id) { 553 tda9887_set_pinnacle(t,buf); 554 } 555 + 556 tda9887_set_config(t,buf); 557 tda9887_set_insmod(t,buf); 558 ··· 592 if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) 593 return -ENOMEM; 594 memset(t,0,sizeof(*t)); 595 + 596 t->client = client_template; 597 t->std = 0; 598 t->pinnacle_id = UNSET; 599 + t->radio_mode = V4L2_TUNER_MODE_STEREO; 600 + 601 i2c_set_clientdata(&t->client, t); 602 i2c_attach_client(&t->client); 603 ··· 733 } 734 break; 735 } 736 + case VIDIOC_S_TUNER: 737 + { 738 + struct v4l2_tuner* tuner = arg; 739 + 740 + if (t->radio) { 741 + t->radio_mode = tuner->audmode; 742 + tda9887_configure (t); 743 + } 744 + break; 745 + } 746 default: 747 /* nothing */ 748 break; ··· 740 return 0; 741 } 742 743 + static int tda9887_suspend(struct device * dev, u32 state, u32 level) 744 { 745 dprintk("tda9887: suspend\n"); 746 return 0;
+145 -67
drivers/media/video/tuner-core.c
··· 1 /* 2 - * $Id: tuner-core.c,v 1.7 2005/05/30 02:02:47 mchehab Exp $ 3 * 4 * i2c tv tuner chip device driver 5 * core core, i.e. kernel interfaces, registering and so on ··· 26 /* 27 * comment line bellow to return to old behavor, where only one I2C device is supported 28 */ 29 - /* #define CONFIG_TUNER_MULTI_I2C */ 30 31 #define UNSET (-1U) 32 33 /* standard i2c insmod options */ 34 static unsigned short normal_i2c[] = { 35 0x4b, /* tda8290 */ 36 - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 37 - 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 38 I2C_CLIENT_END 39 }; 40 I2C_CLIENT_INSMOD; ··· 61 62 static int this_adap; 63 #ifdef CONFIG_TUNER_MULTI_I2C 64 - static unsigned short tv_tuner, radio_tuner; 65 #endif 66 67 static struct i2c_driver driver; ··· 69 70 /* ---------------------------------------------------------------------- */ 71 72 - // Set tuner frequency, freq in Units of 62.5kHz = 1/16MHz 73 static void set_tv_freq(struct i2c_client *c, unsigned int freq) 74 { 75 struct tuner *t = i2c_get_clientdata(c); ··· 83 return; 84 } 85 if (freq < tv_range[0]*16 || freq > tv_range[1]*16) { 86 - /* FIXME: better do that chip-specific, but 87 - right now we don't have that in the config 88 - struct and this way is still better than no 89 - check at all */ 90 - tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", 91 - freq/16,freq%16*100/16,tv_range[0],tv_range[1]); 92 - return; 93 } 94 t->tv_freq(c,freq); 95 } 96 ··· 119 return; 120 } 121 if (freq < radio_range[0]*16 || freq > radio_range[1]*16) { 122 - tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n", 123 freq/16,freq%16*100/16, 124 - radio_range[0],radio_range[1]); 125 - return; 126 } 127 t->radio_freq(c,freq); 128 } 129 ··· 165 t->freq = freq; 166 } 167 168 - #ifdef CONFIG_TUNER_MULTI_I2C 169 - static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr) 170 - { 171 - struct tuner *t = i2c_get_clientdata(c); 172 - 173 - switch (tun_addr->type) { 174 - case V4L2_TUNER_RADIO: 175 - radio_tuner=tun_addr->addr; 176 - tuner_dbg("radio tuner set to I2C address 0x%02x\n",radio_tuner<<1); 177 - 178 - break; 179 - default: 180 - tv_tuner=tun_addr->addr; 181 - tuner_dbg("TV tuner set to I2C address 0x%02x\n",tv_tuner<<1); 182 - break; 183 - } 184 - } 185 - #else 186 - #define set_addr(c,tun_addr) \ 187 - tuner_warn("It is recommended to enable CONFIG_TUNER_MULTI_I2C for this card.\n"); 188 - #endif 189 - 190 static void set_type(struct i2c_client *c, unsigned int type) 191 { 192 struct tuner *t = i2c_get_clientdata(c); 193 194 /* sanity check */ 195 - if (type == UNSET || type == TUNER_ABSENT) 196 return; 197 if (type >= tuner_count) 198 return; ··· 186 return; 187 188 t->initialized = 1; 189 t->type = type; 190 switch (t->type) { 191 case TUNER_MT2032: ··· 200 break; 201 } 202 } 203 204 static char pal[] = "-"; 205 module_param_string(pal, pal, sizeof(pal), 0644); ··· 292 #else 293 /* by default, first I2C card is both tv and radio tuner */ 294 if (this_adap == 0) { 295 tv_tuner = addr; 296 radio_tuner = addr; 297 } ··· 309 memcpy(&t->i2c,&client_template,sizeof(struct i2c_client)); 310 i2c_set_clientdata(&t->i2c, t); 311 t->type = UNSET; 312 - t->radio_if2 = 10700*1000; // 10.7MHz - FM radio 313 314 i2c_attach_client(&t->i2c); 315 tuner_info("chip found @ 0x%x (%s)\n", 316 addr << 1, adap->name); 317 set_type(&t->i2c, t->type); 318 return 0; 319 } ··· 322 static int tuner_probe(struct i2c_adapter *adap) 323 { 324 if (0 != addr) { 325 - normal_i2c[0] = addr; 326 - normal_i2c[1] = I2C_CLIENT_END; 327 } 328 this_adap = 0; 329 330 #ifdef CONFIG_TUNER_MULTI_I2C 331 tv_tuner = 0; 332 radio_tuner = 0; 333 #endif ··· 361 tuner_info("ignore v4l1 call\n"); \ 362 return 0; } 363 364 - #ifdef CONFIG_TUNER_MULTI_I2C 365 - #define CHECK_ADDR(tp,cmd) if (client->addr!=tp) { \ 366 - tuner_info ("Cmd %s to addr 0x%02x rejected.\n",cmd,client->addr<<1); \ 367 - return 0; } 368 - #define CHECK_MODE(cmd) if (t->mode == V4L2_TUNER_RADIO) { \ 369 - CHECK_ADDR(radio_tuner,cmd) } else { CHECK_ADDR(tv_tuner,cmd); } 370 - #else 371 - #define CHECK_ADDR(tp,cmd) 372 - #define CHECK_MODE(cmd) 373 - #endif 374 - 375 static int 376 tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) 377 { ··· 372 case TUNER_SET_TYPE: 373 set_type(client,*iarg); 374 break; 375 - case TUNER_SET_ADDR: 376 set_addr(client,(struct tuner_addr *)arg); 377 break; 378 case AUDC_SET_RADIO: 379 - CHECK_ADDR(radio_tuner,"AUDC_SET_RADIO"); 380 381 if (V4L2_TUNER_RADIO != t->mode) { 382 set_tv_freq(client,400 * 16); 383 - t->mode = V4L2_TUNER_RADIO; 384 } 385 break; 386 case AUDC_CONFIG_PINNACLE: 387 - CHECK_ADDR(tv_tuner,"AUDC_CONFIG_PINNACLE"); 388 switch (*iarg) { 389 case 2: 390 tuner_dbg("pinnacle pal\n"); ··· 412 }; 413 struct video_channel *vc = arg; 414 415 - CHECK_ADDR(tv_tuner,"VIDIOCSCHAN"); 416 CHECK_V4L2; 417 t->mode = V4L2_TUNER_ANALOG_TV; 418 if (vc->norm < ARRAY_SIZE(map)) 419 t->std = map[vc->norm]; 420 tuner_fixup_std(t); ··· 436 { 437 struct video_tuner *vt = arg; 438 439 - CHECK_ADDR(radio_tuner,"VIDIOCGTUNER:"); 440 CHECK_V4L2; 441 - if (V4L2_TUNER_RADIO == t->mode && t->has_signal) 442 - vt->signal = t->has_signal(client); 443 return 0; 444 } 445 case VIDIOCGAUDIO: 446 { 447 struct video_audio *va = arg; 448 449 - CHECK_ADDR(radio_tuner,"VIDIOCGAUDIO"); 450 CHECK_V4L2; 451 if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) 452 va->mode = t->is_stereo(client) ··· 469 { 470 v4l2_std_id *id = arg; 471 472 - CHECK_ADDR(tv_tuner,"VIDIOC_S_STD"); 473 SWITCH_V4L2; 474 t->mode = V4L2_TUNER_ANALOG_TV; 475 t->std = *id; 476 tuner_fixup_std(t); 477 if (t->freq) ··· 508 509 CHECK_MODE("VIDIOC_G_TUNER"); 510 SWITCH_V4L2; 511 - if (V4L2_TUNER_RADIO == t->mode && t->has_signal) 512 - tuner->signal = t->has_signal(client); 513 tuner->rangelow = tv_range[0] * 16; 514 - tuner->rangehigh = tv_range[1] * 16; 515 break; 516 } 517 default: 518 /* nothing */ 519 break; 520 } ··· 536 return 0; 537 } 538 539 - static int tuner_suspend(struct device * dev, pm_message_t state, u32 level) 540 { 541 struct i2c_client *c = container_of(dev, struct i2c_client, dev); 542 struct tuner *t = i2c_get_clientdata(c);
··· 1 /* 2 + * $Id: tuner-core.c,v 1.15 2005/06/12 01:36:14 mchehab Exp $ 3 * 4 * i2c tv tuner chip device driver 5 * core core, i.e. kernel interfaces, registering and so on ··· 26 /* 27 * comment line bellow to return to old behavor, where only one I2C device is supported 28 */ 29 + #define CONFIG_TUNER_MULTI_I2C /**/ 30 31 #define UNSET (-1U) 32 33 /* standard i2c insmod options */ 34 static unsigned short normal_i2c[] = { 35 0x4b, /* tda8290 */ 36 + I2C_CLIENT_END 37 + }; 38 + static unsigned short normal_i2c_range[] = { 39 + 0x60, 0x6f, 40 I2C_CLIENT_END 41 }; 42 I2C_CLIENT_INSMOD; ··· 59 60 static int this_adap; 61 #ifdef CONFIG_TUNER_MULTI_I2C 62 + static unsigned short first_tuner, tv_tuner, radio_tuner; 63 #endif 64 65 static struct i2c_driver driver; ··· 67 68 /* ---------------------------------------------------------------------- */ 69 70 + /* Set tuner frequency, freq in Units of 62.5kHz = 1/16MHz */ 71 static void set_tv_freq(struct i2c_client *c, unsigned int freq) 72 { 73 struct tuner *t = i2c_get_clientdata(c); ··· 81 return; 82 } 83 if (freq < tv_range[0]*16 || freq > tv_range[1]*16) { 84 + 85 + if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) { 86 + /* V4L2_TUNER_CAP_LOW frequency */ 87 + 88 + tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for TV. Tuners yet doesn't support converting it to valid freq.\n"); 89 + 90 + t->tv_freq(c,freq>>10); 91 + 92 + return; 93 + } else { 94 + /* FIXME: better do that chip-specific, but 95 + right now we don't have that in the config 96 + struct and this way is still better than no 97 + check at all */ 98 + tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", 99 + freq/16,freq%16*100/16,tv_range[0],tv_range[1]); 100 + return; 101 + } 102 } 103 + tuner_dbg("62.5 Khz freq step selected for TV.\n"); 104 t->tv_freq(c,freq); 105 } 106 ··· 105 return; 106 } 107 if (freq < radio_range[0]*16 || freq > radio_range[1]*16) { 108 + if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) { 109 + /* V4L2_TUNER_CAP_LOW frequency */ 110 + if (t->type == TUNER_TEA5767) { 111 + tuner_info("radio freq step 62.5Hz (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000); 112 + t->radio_freq(c,freq>>10); 113 + return; 114 + } 115 + 116 + tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for Radio. Tuners yet doesn't support converting it to valid freq.\n"); 117 + 118 + tuner_info("radio freq (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000); 119 + 120 + t->radio_freq(c,freq>>10); 121 + return; 122 + 123 + } else { 124 + tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n", 125 freq/16,freq%16*100/16, 126 + radio_range[0],radio_range[1]); 127 + return; 128 + } 129 } 130 + tuner_dbg("62.5 Khz freq step selected for Radio.\n"); 131 t->radio_freq(c,freq); 132 } 133 ··· 133 t->freq = freq; 134 } 135 136 static void set_type(struct i2c_client *c, unsigned int type) 137 { 138 struct tuner *t = i2c_get_clientdata(c); 139 140 + tuner_dbg ("I2C addr 0x%02x with type %d\n",c->addr<<1,type); 141 /* sanity check */ 142 + if (type == UNSET || type == TUNER_ABSENT) 143 return; 144 if (type >= tuner_count) 145 return; ··· 175 return; 176 177 t->initialized = 1; 178 + 179 t->type = type; 180 switch (t->type) { 181 case TUNER_MT2032: ··· 188 break; 189 } 190 } 191 + 192 + #ifdef CONFIG_TUNER_MULTI_I2C 193 + #define CHECK_ADDR(tp,cmd,tun) if (client->addr!=tp) { \ 194 + return 0; } else \ 195 + tuner_info ("Cmd %s accepted to "tun"\n",cmd); 196 + #define CHECK_MODE(cmd) if (t->mode == V4L2_TUNER_RADIO) { \ 197 + CHECK_ADDR(radio_tuner,cmd,"radio") } else \ 198 + { CHECK_ADDR(tv_tuner,cmd,"TV"); } 199 + #else 200 + #define CHECK_ADDR(tp,cmd,tun) tuner_info ("Cmd %s accepted to "tun"\n",cmd); 201 + #define CHECK_MODE(cmd) tuner_info ("Cmd %s accepted\n",cmd); 202 + #endif 203 + 204 + #ifdef CONFIG_TUNER_MULTI_I2C 205 + 206 + static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr) 207 + { 208 + /* ADDR_UNSET defaults to first available tuner */ 209 + if ( tun_addr->addr == ADDR_UNSET ) { 210 + if (first_tuner != c->addr) 211 + return; 212 + switch (tun_addr->v4l2_tuner) { 213 + case V4L2_TUNER_RADIO: 214 + radio_tuner=c->addr; 215 + break; 216 + default: 217 + tv_tuner=c->addr; 218 + break; 219 + } 220 + } else { 221 + /* Sets tuner to its configured value */ 222 + switch (tun_addr->v4l2_tuner) { 223 + case V4L2_TUNER_RADIO: 224 + radio_tuner=tun_addr->addr; 225 + if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type); 226 + return; 227 + default: 228 + tv_tuner=tun_addr->addr; 229 + if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type); 230 + return; 231 + } 232 + } 233 + set_type(c,tun_addr->type); 234 + } 235 + #else 236 + #define set_addr(c,tun_addr) set_type(c,(tun_addr)->type) 237 + #endif 238 239 static char pal[] = "-"; 240 module_param_string(pal, pal, sizeof(pal), 0644); ··· 233 #else 234 /* by default, first I2C card is both tv and radio tuner */ 235 if (this_adap == 0) { 236 + first_tuner = addr; 237 tv_tuner = addr; 238 radio_tuner = addr; 239 } ··· 249 memcpy(&t->i2c,&client_template,sizeof(struct i2c_client)); 250 i2c_set_clientdata(&t->i2c, t); 251 t->type = UNSET; 252 + t->radio_if2 = 10700*1000; /* 10.7MHz - FM radio */ 253 254 i2c_attach_client(&t->i2c); 255 tuner_info("chip found @ 0x%x (%s)\n", 256 addr << 1, adap->name); 257 + 258 set_type(&t->i2c, t->type); 259 return 0; 260 } ··· 261 static int tuner_probe(struct i2c_adapter *adap) 262 { 263 if (0 != addr) { 264 + normal_i2c[0] = addr; 265 + normal_i2c_range[0] = addr; 266 + normal_i2c_range[1] = addr; 267 } 268 this_adap = 0; 269 270 #ifdef CONFIG_TUNER_MULTI_I2C 271 + first_tuner = 0; 272 tv_tuner = 0; 273 radio_tuner = 0; 274 #endif ··· 298 tuner_info("ignore v4l1 call\n"); \ 299 return 0; } 300 301 static int 302 tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) 303 { ··· 320 case TUNER_SET_TYPE: 321 set_type(client,*iarg); 322 break; 323 + case TUNER_SET_TYPE_ADDR: 324 set_addr(client,(struct tuner_addr *)arg); 325 break; 326 case AUDC_SET_RADIO: 327 + t->mode = V4L2_TUNER_RADIO; 328 + CHECK_ADDR(tv_tuner,"AUDC_SET_RADIO","TV"); 329 330 if (V4L2_TUNER_RADIO != t->mode) { 331 set_tv_freq(client,400 * 16); 332 } 333 break; 334 case AUDC_CONFIG_PINNACLE: 335 + CHECK_ADDR(tv_tuner,"AUDC_CONFIG_PINNACLE","TV"); 336 switch (*iarg) { 337 case 2: 338 tuner_dbg("pinnacle pal\n"); ··· 360 }; 361 struct video_channel *vc = arg; 362 363 CHECK_V4L2; 364 t->mode = V4L2_TUNER_ANALOG_TV; 365 + CHECK_ADDR(tv_tuner,"VIDIOCSCHAN","TV"); 366 + 367 if (vc->norm < ARRAY_SIZE(map)) 368 t->std = map[vc->norm]; 369 tuner_fixup_std(t); ··· 383 { 384 struct video_tuner *vt = arg; 385 386 + CHECK_ADDR(radio_tuner,"VIDIOCGTUNER","radio"); 387 CHECK_V4L2; 388 + if (V4L2_TUNER_RADIO == t->mode) { 389 + if (t->has_signal) 390 + vt->signal = t->has_signal(client); 391 + if (t->is_stereo) { 392 + if (t->is_stereo(client)) 393 + vt-> flags |= VIDEO_TUNER_STEREO_ON; 394 + else 395 + vt-> flags &= 0xffff ^ VIDEO_TUNER_STEREO_ON; 396 + } 397 + vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */ 398 + } 399 + 400 return 0; 401 } 402 case VIDIOCGAUDIO: 403 { 404 struct video_audio *va = arg; 405 406 + CHECK_ADDR(radio_tuner,"VIDIOCGAUDIO","radio"); 407 CHECK_V4L2; 408 if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) 409 va->mode = t->is_stereo(client) ··· 406 { 407 v4l2_std_id *id = arg; 408 409 SWITCH_V4L2; 410 t->mode = V4L2_TUNER_ANALOG_TV; 411 + CHECK_ADDR(tv_tuner,"VIDIOC_S_STD","TV"); 412 + 413 t->std = *id; 414 tuner_fixup_std(t); 415 if (t->freq) ··· 444 445 CHECK_MODE("VIDIOC_G_TUNER"); 446 SWITCH_V4L2; 447 + if (V4L2_TUNER_RADIO == t->mode) { 448 + if (t->has_signal) 449 + tuner -> signal = t->has_signal(client); 450 + if (t->is_stereo) { 451 + if (t->is_stereo(client)) { 452 + tuner -> capability |= V4L2_TUNER_CAP_STEREO; 453 + tuner -> rxsubchans |= V4L2_TUNER_SUB_STEREO; 454 + } else { 455 + tuner -> rxsubchans &= 0xffff ^ V4L2_TUNER_SUB_STEREO; 456 + } 457 + } 458 + } 459 + /* Wow to deal with V4L2_TUNER_CAP_LOW ? For now, it accepts from low at 62.5KHz step to high at 62.5 Hz */ 460 tuner->rangelow = tv_range[0] * 16; 461 + // tuner->rangehigh = tv_range[1] * 16; 462 + // tuner->rangelow = tv_range[0] * 16384; 463 + tuner->rangehigh = tv_range[1] * 16384; 464 break; 465 } 466 default: 467 + tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd); 468 /* nothing */ 469 break; 470 } ··· 458 return 0; 459 } 460 461 + static int tuner_suspend(struct device * dev, u32 state, u32 level) 462 { 463 struct i2c_client *c = container_of(dev, struct i2c_client, dev); 464 struct tuner *t = i2c_get_clientdata(c);
+33 -19
drivers/media/video/tuner-simple.c
··· 1 /* 2 - * $Id: tuner-simple.c,v 1.14 2005/05/30 02:02:47 mchehab Exp $ 3 * 4 * i2c tv tuner chip device driver 5 * controls all those simple 4-control-bytes style tuners. ··· 220 221 { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, 222 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, 223 }; 224 unsigned const int tuner_count = ARRAY_SIZE(tuners); 225 226 /* ---------------------------------------------------------------------- */ ··· 241 242 if (1 != i2c_master_recv(c,&byte,1)) 243 return 0; 244 return byte; 245 } 246 ··· 250 #define TUNER_MODE 0x38 251 #define TUNER_AFC 0x07 252 253 - #define TUNER_STEREO 0x10 /* radio mode */ 254 - #define TUNER_SIGNAL 0x07 /* radio mode */ 255 256 static int tuner_signal(struct i2c_client *c) 257 { 258 - return (tuner_getstatus(c) & TUNER_SIGNAL)<<13; 259 } 260 261 static int tuner_stereo(struct i2c_client *c) 262 { 263 - return (tuner_getstatus (c) & TUNER_STEREO); 264 } 265 266 #if 0 /* unused */ ··· 459 buffer[2] = tun->config; 460 461 switch (t->type) { 462 case TUNER_YMEC_TVF_5533MF: 463 464 /*These values are empirically determinated */ ··· 500 tuner_info("type set to %d (%s)\n", 501 t->type, tuners[t->type].name); 502 strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); 503 - 504 - switch (t->type) { 505 - case TUNER_YMEC_TVF_5533MF: 506 - { 507 - struct tuner_addr tun_addr = { V4L2_TUNER_ANALOG_TV, 0xc2>>1 }; 508 - 509 - if (c->driver->command) { 510 - c->driver->command(c, TUNER_SET_ADDR, &tun_addr); 511 - } else { 512 - tuner_warn("Couldn't set TV tuner I2C address to 0x%02x\n",tun_addr.addr<<1); 513 - } 514 - break; 515 - } 516 - } 517 518 t->tv_freq = default_set_tv_freq; 519 t->radio_freq = default_set_radio_freq;
··· 1 /* 2 + * $Id: tuner-simple.c,v 1.21 2005/06/10 19:53:26 nsh Exp $ 3 * 4 * i2c tv tuner chip device driver 5 * controls all those simple 4-control-bytes style tuners. ··· 220 221 { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, 222 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, 223 + { "Tena TNF9533-D/IF", LGINNOTEK, PAL, 224 + 16*160.25, 16*464.25, 0x01,0x02,0x08,0x8e,623}, 225 + 226 + /* 227 + * This entry is for TEA5767 FM radio only chip used on several boards 228 + * w/TV tuner 229 + */ 230 + { TEA5767_TUNER_NAME, Philips, RADIO, 231 + -1, -1, 0, 0, 0, TEA5767_LOW_LO_32768,0}, 232 }; 233 + 234 unsigned const int tuner_count = ARRAY_SIZE(tuners); 235 236 /* ---------------------------------------------------------------------- */ ··· 231 232 if (1 != i2c_master_recv(c,&byte,1)) 233 return 0; 234 + 235 return byte; 236 } 237 ··· 239 #define TUNER_MODE 0x38 240 #define TUNER_AFC 0x07 241 242 + #define TUNER_STEREO 0x10 /* radio mode */ 243 + #define TUNER_STEREO_MK3 0x04 /* radio mode */ 244 + #define TUNER_SIGNAL 0x07 /* radio mode */ 245 246 static int tuner_signal(struct i2c_client *c) 247 { 248 + return (tuner_getstatus(c) & TUNER_SIGNAL) << 13; 249 } 250 251 static int tuner_stereo(struct i2c_client *c) 252 { 253 + int stereo, status; 254 + struct tuner *t = i2c_get_clientdata(c); 255 + 256 + status = tuner_getstatus (c); 257 + 258 + switch (t->type) { 259 + case TUNER_PHILIPS_FM1216ME_MK3: 260 + case TUNER_PHILIPS_FM1236_MK3: 261 + case TUNER_PHILIPS_FM1256_IH3: 262 + stereo = ((status & TUNER_SIGNAL) == TUNER_STEREO_MK3); 263 + break; 264 + default: 265 + stereo = status & TUNER_STEREO; 266 + } 267 + 268 + return stereo; 269 } 270 271 #if 0 /* unused */ ··· 432 buffer[2] = tun->config; 433 434 switch (t->type) { 435 + case TUNER_TENA_9533_DI: 436 case TUNER_YMEC_TVF_5533MF: 437 438 /*These values are empirically determinated */ ··· 472 tuner_info("type set to %d (%s)\n", 473 t->type, tuners[t->type].name); 474 strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); 475 476 t->tv_freq = default_set_tv_freq; 477 t->radio_freq = default_set_radio_freq;
+1 -1
drivers/media/video/tvaudio.c
··· 148 I2C_TDA9874 >> 1, 149 I2C_PIC16C54 >> 1, 150 I2C_CLIENT_END }; 151 I2C_CLIENT_INSMOD; 152 153 static struct i2c_driver driver; ··· 286 schedule(); 287 } 288 remove_wait_queue(&chip->wq, &wait); 289 - try_to_freeze(PF_FREEZE); 290 if (chip->done || signal_pending(current)) 291 break; 292 dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c));
··· 148 I2C_TDA9874 >> 1, 149 I2C_PIC16C54 >> 1, 150 I2C_CLIENT_END }; 151 + static unsigned short normal_i2c_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; 152 I2C_CLIENT_INSMOD; 153 154 static struct i2c_driver driver; ··· 285 schedule(); 286 } 287 remove_wait_queue(&chip->wq, &wait); 288 if (chip->done || signal_pending(current)) 289 break; 290 dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c));
+4
drivers/media/video/tvmixer.c
··· 1 #include <linux/module.h> 2 #include <linux/moduleparam.h> 3 #include <linux/kernel.h>
··· 1 + /* 2 + * $Id: tvmixer.c,v 1.8 2005/06/12 04:19:19 mchehab Exp $ 3 + */ 4 + 5 #include <linux/module.h> 6 #include <linux/moduleparam.h> 7 #include <linux/kernel.h>
+4
include/media/audiochip.h
··· 1 #ifndef AUDIOCHIP_H 2 #define AUDIOCHIP_H 3
··· 1 + /* 2 + * $Id: audiochip.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $ 3 + */ 4 + 5 #ifndef AUDIOCHIP_H 6 #define AUDIOCHIP_H 7
+4
include/media/id.h
··· 1 /* FIXME: this temporarely, until these are included in linux/i2c-id.h */ 2 3 /* drivers */
··· 1 + /* 2 + * $Id: id.h,v 1.4 2005/06/12 04:19:19 mchehab Exp $ 3 + */ 4 + 5 /* FIXME: this temporarely, until these are included in linux/i2c-id.h */ 6 7 /* drivers */
+1 -1
include/media/ir-common.h
··· 1 /* 2 - * $Id: ir-common.h,v 1.8 2005/02/22 12:28:40 kraxel Exp $ 3 * 4 * some common structs and functions to handle infrared remotes via 5 * input layer ...
··· 1 /* 2 + * $Id: ir-common.h,v 1.9 2005/05/15 19:01:26 mchehab Exp $ 3 * 4 * some common structs and functions to handle infrared remotes via 5 * input layer ...
+20 -3
include/media/tuner.h
··· 25 26 #include "id.h" 27 28 #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ 29 #define TUNER_PHILIPS_PAL_I 1 30 #define TUNER_PHILIPS_NTSC 2 ··· 102 103 #define TUNER_YMEC_TVF_8531MF 58 104 #define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ 105 106 #define TUNER_THOMSON_DTT7611 60 107 ··· 116 #define NTSC 3 117 #define SECAM 4 118 #define ATSC 5 119 120 #define NoTuner 0 121 #define Philips 1 ··· 132 #define TCL 11 133 #define THOMSON 12 134 135 #define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */ 136 #define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */ 137 - #define TUNER_SET_ADDR _IOW('T',3,int) /* Chooses tuner I2C address */ 138 139 #define TDA9887_SET_CONFIG _IOW('t',5,int) 140 ··· 167 #define I2C_ADDR_TDA8275 0x61 168 169 struct tuner_addr { 170 - enum v4l2_tuner_type type; 171 - unsigned short addr; 172 }; 173 174 struct tuner {
··· 25 26 #include "id.h" 27 28 + #define ADDR_UNSET (255) 29 + 30 #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ 31 #define TUNER_PHILIPS_PAL_I 1 32 #define TUNER_PHILIPS_NTSC 2 ··· 100 101 #define TUNER_YMEC_TVF_8531MF 58 102 #define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ 103 + #define TUNER_THOMSON_DTT7611 60 104 + #define TUNER_TENA_9533_DI 61 105 + #define TUNER_TEA5767 62 /* Only FM Radio Tuner */ 106 + 107 + #define TEA5767_TUNER_NAME "Philips TEA5767HN FM Radio" 108 109 #define TUNER_THOMSON_DTT7611 60 110 ··· 109 #define NTSC 3 110 #define SECAM 4 111 #define ATSC 5 112 + #define RADIO 6 113 114 #define NoTuner 0 115 #define Philips 1 ··· 124 #define TCL 11 125 #define THOMSON 12 126 127 + enum v4l_radio_tuner { 128 + TEA5767_LOW_LO_32768 = 0, 129 + TEA5767_HIGH_LO_32768 = 1, 130 + TEA5767_LOW_LO_13MHz = 2, 131 + TEA5767_HIGH_LO_13MHz = 3, 132 + }; 133 + 134 + 135 #define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */ 136 #define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */ 137 + #define TUNER_SET_TYPE_ADDR _IOW('T',3,int) /* set tuner type and I2C addr */ 138 139 #define TDA9887_SET_CONFIG _IOW('t',5,int) 140 ··· 151 #define I2C_ADDR_TDA8275 0x61 152 153 struct tuner_addr { 154 + enum v4l2_tuner_type v4l2_tuner; 155 + unsigned int type; 156 + unsigned short addr; 157 }; 158 159 struct tuner {