diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-17 00:15:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-17 00:15:42 -0400 |
commit | 0dd5198672dd2bbeb933862e1fc82162e0b636be (patch) | |
tree | c9efed20d90603c4d1626c21bd7aab1e7fc74a58 /drivers/media/video/saa7134/saa7134-input.c | |
parent | c868d550115b9ccc0027c67265b9520790f05601 (diff) | |
parent | 11c635a25b9f3a5d87409ce46cf2e05c500251ec (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (425 commits)
V4L/DVB (11870): gspca - main: VIDIOC_ENUM_FRAMESIZES ioctl added.
V4L/DVB (12004): poll method lose race condition
V4L/DVB (11894): flexcop-pci: dmesg visible names broken
V4L/DVB (11892): Siano: smsendian - declare function as extern
V4L/DVB (11891): Siano: smscore - bind the GPIO SMS protocol
V4L/DVB (11890): Siano: smscore - remove redundant code
V4L/DVB (11889): Siano: smsdvb - add DVB v3 events
V4L/DVB (11888): Siano: smsusb - remove redundant ifdef
V4L/DVB (11887): Siano: smscards - add board (target) events
V4L/DVB (11886): Siano: smscore - fix some new GPIO definitions names
V4L/DVB (11885): Siano: Add new GPIO management interface
V4L/DVB (11884): Siano: smssdio - revert to stand alone module
V4L/DVB (11883): Siano: cards - add two additional (USB) devices
V4L/DVB (11824): Siano: smsusb - change exit func debug msg
V4L/DVB (11823): Siano: smsusb - fix typo in module description
V4L/DVB (11822): Siano: smscore - bug fix at get_device_mode
V4L/DVB (11821): Siano: smscore - fix isdb-t firmware name
V4L/DVB (11820): Siano: smscore - fix byte ordering bug
V4L/DVB (11819): Siano: smscore - fix get_common_buffer bug
V4L/DVB (11818): Siano: smscards - assign gpio to HPG targets
...
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-input.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 118 |
1 files changed, 84 insertions, 34 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 8a106d36e723..6e219c2db841 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -60,7 +60,7 @@ MODULE_PARM_DESC(disable_other_ir, "disable full codes of " | |||
60 | #define dprintk(fmt, arg...) if (ir_debug) \ | 60 | #define dprintk(fmt, arg...) if (ir_debug) \ |
61 | printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg) | 61 | printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg) |
62 | #define i2cdprintk(fmt, arg...) if (ir_debug) \ | 62 | #define i2cdprintk(fmt, arg...) if (ir_debug) \ |
63 | printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg) | 63 | printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg) |
64 | 64 | ||
65 | /* Helper functions for RC5 and NEC decoding at GPIO16 or GPIO18 */ | 65 | /* Helper functions for RC5 and NEC decoding at GPIO16 or GPIO18 */ |
66 | static int saa7134_rc5_irq(struct saa7134_dev *dev); | 66 | static int saa7134_rc5_irq(struct saa7134_dev *dev); |
@@ -134,10 +134,10 @@ static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key, | |||
134 | int gpio; | 134 | int gpio; |
135 | 135 | ||
136 | /* <dev> is needed to access GPIO. Used by the saa_readl macro. */ | 136 | /* <dev> is needed to access GPIO. Used by the saa_readl macro. */ |
137 | struct saa7134_dev *dev = ir->c.adapter->algo_data; | 137 | struct saa7134_dev *dev = ir->c->adapter->algo_data; |
138 | if (dev == NULL) { | 138 | if (dev == NULL) { |
139 | dprintk("get_key_msi_tvanywhere_plus: " | 139 | dprintk("get_key_msi_tvanywhere_plus: " |
140 | "gir->c.adapter->algo_data is NULL!\n"); | 140 | "gir->c->adapter->algo_data is NULL!\n"); |
141 | return -EIO; | 141 | return -EIO; |
142 | } | 142 | } |
143 | 143 | ||
@@ -156,7 +156,7 @@ static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key, | |||
156 | 156 | ||
157 | /* GPIO says there is a button press. Get it. */ | 157 | /* GPIO says there is a button press. Get it. */ |
158 | 158 | ||
159 | if (1 != i2c_master_recv(&ir->c, &b, 1)) { | 159 | if (1 != i2c_master_recv(ir->c, &b, 1)) { |
160 | i2cdprintk("read error\n"); | 160 | i2cdprintk("read error\n"); |
161 | return -EIO; | 161 | return -EIO; |
162 | } | 162 | } |
@@ -179,7 +179,7 @@ static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
179 | unsigned char b; | 179 | unsigned char b; |
180 | 180 | ||
181 | /* poll IR chip */ | 181 | /* poll IR chip */ |
182 | if (1 != i2c_master_recv(&ir->c,&b,1)) { | 182 | if (1 != i2c_master_recv(ir->c, &b, 1)) { |
183 | i2cdprintk("read error\n"); | 183 | i2cdprintk("read error\n"); |
184 | return -EIO; | 184 | return -EIO; |
185 | } | 185 | } |
@@ -202,7 +202,7 @@ static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
202 | unsigned char buf[5], cod4, code3, code4; | 202 | unsigned char buf[5], cod4, code3, code4; |
203 | 203 | ||
204 | /* poll IR chip */ | 204 | /* poll IR chip */ |
205 | if (5 != i2c_master_recv(&ir->c,buf,5)) | 205 | if (5 != i2c_master_recv(ir->c, buf, 5)) |
206 | return -EIO; | 206 | return -EIO; |
207 | 207 | ||
208 | cod4 = buf[4]; | 208 | cod4 = buf[4]; |
@@ -224,7 +224,7 @@ static int get_key_beholdm6xx(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
224 | unsigned char data[12]; | 224 | unsigned char data[12]; |
225 | u32 gpio; | 225 | u32 gpio; |
226 | 226 | ||
227 | struct saa7134_dev *dev = ir->c.adapter->algo_data; | 227 | struct saa7134_dev *dev = ir->c->adapter->algo_data; |
228 | 228 | ||
229 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ | 229 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ |
230 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | 230 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); |
@@ -235,9 +235,9 @@ static int get_key_beholdm6xx(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
235 | if (0x400000 & ~gpio) | 235 | if (0x400000 & ~gpio) |
236 | return 0; /* No button press */ | 236 | return 0; /* No button press */ |
237 | 237 | ||
238 | ir->c.addr = 0x5a >> 1; | 238 | ir->c->addr = 0x5a >> 1; |
239 | 239 | ||
240 | if (12 != i2c_master_recv(&ir->c, data, 12)) { | 240 | if (12 != i2c_master_recv(ir->c, data, 12)) { |
241 | i2cdprintk("read error\n"); | 241 | i2cdprintk("read error\n"); |
242 | return -EIO; | 242 | return -EIO; |
243 | } | 243 | } |
@@ -267,7 +267,7 @@ static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw, | |||
267 | unsigned int start = 0,parity = 0,code = 0; | 267 | unsigned int start = 0,parity = 0,code = 0; |
268 | 268 | ||
269 | /* poll IR chip */ | 269 | /* poll IR chip */ |
270 | if (4 != i2c_master_recv(&ir->c, b, 4)) { | 270 | if (4 != i2c_master_recv(ir->c, b, 4)) { |
271 | i2cdprintk("read error\n"); | 271 | i2cdprintk("read error\n"); |
272 | return -EIO; | 272 | return -EIO; |
273 | } | 273 | } |
@@ -447,6 +447,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
447 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: | 447 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: |
448 | case SAA7134_BOARD_AVERMEDIA_STUDIO_307: | 448 | case SAA7134_BOARD_AVERMEDIA_STUDIO_307: |
449 | case SAA7134_BOARD_AVERMEDIA_STUDIO_507: | 449 | case SAA7134_BOARD_AVERMEDIA_STUDIO_507: |
450 | case SAA7134_BOARD_AVERMEDIA_STUDIO_507UA: | ||
450 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM: | 451 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM: |
451 | case SAA7134_BOARD_AVERMEDIA_M102: | 452 | case SAA7134_BOARD_AVERMEDIA_M102: |
452 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS: | 453 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS: |
@@ -506,7 +507,10 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
506 | case SAA7134_BOARD_BEHOLD_407FM: | 507 | case SAA7134_BOARD_BEHOLD_407FM: |
507 | case SAA7134_BOARD_BEHOLD_409: | 508 | case SAA7134_BOARD_BEHOLD_409: |
508 | case SAA7134_BOARD_BEHOLD_505FM: | 509 | case SAA7134_BOARD_BEHOLD_505FM: |
510 | case SAA7134_BOARD_BEHOLD_505RDS: | ||
509 | case SAA7134_BOARD_BEHOLD_507_9FM: | 511 | case SAA7134_BOARD_BEHOLD_507_9FM: |
512 | case SAA7134_BOARD_BEHOLD_507RDS_MK3: | ||
513 | case SAA7134_BOARD_BEHOLD_507RDS_MK5: | ||
510 | ir_codes = ir_codes_manli; | 514 | ir_codes = ir_codes_manli; |
511 | mask_keycode = 0x003f00; | 515 | mask_keycode = 0x003f00; |
512 | mask_keyup = 0x004000; | 516 | mask_keyup = 0x004000; |
@@ -678,55 +682,101 @@ void saa7134_input_fini(struct saa7134_dev *dev) | |||
678 | dev->remote = NULL; | 682 | dev->remote = NULL; |
679 | } | 683 | } |
680 | 684 | ||
681 | void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) | 685 | void saa7134_probe_i2c_ir(struct saa7134_dev *dev) |
682 | { | 686 | { |
687 | struct i2c_board_info info; | ||
688 | struct IR_i2c_init_data init_data; | ||
689 | const unsigned short addr_list[] = { | ||
690 | 0x7a, 0x47, 0x71, 0x2d, | ||
691 | I2C_CLIENT_END | ||
692 | }; | ||
693 | |||
694 | struct i2c_msg msg_msi = { | ||
695 | .addr = 0x50, | ||
696 | .flags = I2C_M_RD, | ||
697 | .len = 0, | ||
698 | .buf = NULL, | ||
699 | }; | ||
700 | |||
701 | int rc; | ||
702 | |||
683 | if (disable_ir) { | 703 | if (disable_ir) { |
684 | dprintk("Found supported i2c remote, but IR has been disabled\n"); | 704 | dprintk("IR has been disabled, not probing for i2c remote\n"); |
685 | ir->get_key=NULL; | ||
686 | return; | 705 | return; |
687 | } | 706 | } |
688 | 707 | ||
708 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
709 | memset(&init_data, 0, sizeof(struct IR_i2c_init_data)); | ||
710 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | ||
711 | |||
689 | switch (dev->board) { | 712 | switch (dev->board) { |
690 | case SAA7134_BOARD_PINNACLE_PCTV_110i: | 713 | case SAA7134_BOARD_PINNACLE_PCTV_110i: |
691 | case SAA7134_BOARD_PINNACLE_PCTV_310i: | 714 | case SAA7134_BOARD_PINNACLE_PCTV_310i: |
692 | snprintf(ir->c.name, sizeof(ir->c.name), "Pinnacle PCTV"); | 715 | init_data.name = "Pinnacle PCTV"; |
693 | if (pinnacle_remote == 0) { | 716 | if (pinnacle_remote == 0) { |
694 | ir->get_key = get_key_pinnacle_color; | 717 | init_data.get_key = get_key_pinnacle_color; |
695 | ir->ir_codes = ir_codes_pinnacle_color; | 718 | init_data.ir_codes = ir_codes_pinnacle_color; |
696 | } else { | 719 | } else { |
697 | ir->get_key = get_key_pinnacle_grey; | 720 | init_data.get_key = get_key_pinnacle_grey; |
698 | ir->ir_codes = ir_codes_pinnacle_grey; | 721 | init_data.ir_codes = ir_codes_pinnacle_grey; |
699 | } | 722 | } |
700 | break; | 723 | break; |
701 | case SAA7134_BOARD_UPMOST_PURPLE_TV: | 724 | case SAA7134_BOARD_UPMOST_PURPLE_TV: |
702 | snprintf(ir->c.name, sizeof(ir->c.name), "Purple TV"); | 725 | init_data.name = "Purple TV"; |
703 | ir->get_key = get_key_purpletv; | 726 | init_data.get_key = get_key_purpletv; |
704 | ir->ir_codes = ir_codes_purpletv; | 727 | init_data.ir_codes = ir_codes_purpletv; |
705 | break; | 728 | break; |
706 | case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: | 729 | case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: |
707 | snprintf(ir->c.name, sizeof(ir->c.name), "MSI TV@nywhere Plus"); | 730 | init_data.name = "MSI TV@nywhere Plus"; |
708 | ir->get_key = get_key_msi_tvanywhere_plus; | 731 | init_data.get_key = get_key_msi_tvanywhere_plus; |
709 | ir->ir_codes = ir_codes_msi_tvanywhere_plus; | 732 | init_data.ir_codes = ir_codes_msi_tvanywhere_plus; |
733 | info.addr = 0x30; | ||
734 | /* MSI TV@nywhere Plus controller doesn't seem to | ||
735 | respond to probes unless we read something from | ||
736 | an existing device. Weird... | ||
737 | REVISIT: might no longer be needed */ | ||
738 | rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1); | ||
739 | dprintk(KERN_DEBUG "probe 0x%02x @ %s: %s\n", | ||
740 | msg_msi.addr, dev->i2c_adap.name, | ||
741 | (1 == rc) ? "yes" : "no"); | ||
710 | break; | 742 | break; |
711 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: | 743 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
712 | snprintf(ir->c.name, sizeof(ir->c.name), "HVR 1110"); | 744 | init_data.name = "HVR 1110"; |
713 | ir->get_key = get_key_hvr1110; | 745 | init_data.get_key = get_key_hvr1110; |
714 | ir->ir_codes = ir_codes_hauppauge_new; | 746 | init_data.ir_codes = ir_codes_hauppauge_new; |
715 | break; | 747 | break; |
716 | case SAA7134_BOARD_BEHOLD_607_9FM: | 748 | case SAA7134_BOARD_BEHOLD_607FM_MK3: |
749 | case SAA7134_BOARD_BEHOLD_607FM_MK5: | ||
750 | case SAA7134_BOARD_BEHOLD_609FM_MK3: | ||
751 | case SAA7134_BOARD_BEHOLD_609FM_MK5: | ||
752 | case SAA7134_BOARD_BEHOLD_607RDS_MK3: | ||
753 | case SAA7134_BOARD_BEHOLD_607RDS_MK5: | ||
754 | case SAA7134_BOARD_BEHOLD_609RDS_MK3: | ||
755 | case SAA7134_BOARD_BEHOLD_609RDS_MK5: | ||
717 | case SAA7134_BOARD_BEHOLD_M6: | 756 | case SAA7134_BOARD_BEHOLD_M6: |
718 | case SAA7134_BOARD_BEHOLD_M63: | 757 | case SAA7134_BOARD_BEHOLD_M63: |
719 | case SAA7134_BOARD_BEHOLD_M6_EXTRA: | 758 | case SAA7134_BOARD_BEHOLD_M6_EXTRA: |
720 | case SAA7134_BOARD_BEHOLD_H6: | 759 | case SAA7134_BOARD_BEHOLD_H6: |
721 | snprintf(ir->c.name, sizeof(ir->c.name), "BeholdTV"); | 760 | init_data.name = "BeholdTV"; |
722 | ir->get_key = get_key_beholdm6xx; | 761 | init_data.get_key = get_key_beholdm6xx; |
723 | ir->ir_codes = ir_codes_behold; | 762 | init_data.ir_codes = ir_codes_behold; |
724 | break; | 763 | break; |
725 | default: | 764 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_501: |
726 | dprintk("Shouldn't get here: Unknown board %x for I2C IR?\n",dev->board); | 765 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: |
766 | info.addr = 0x40; | ||
727 | break; | 767 | break; |
728 | } | 768 | } |
729 | 769 | ||
770 | if (init_data.name) | ||
771 | info.platform_data = &init_data; | ||
772 | /* No need to probe if address is known */ | ||
773 | if (info.addr) { | ||
774 | i2c_new_device(&dev->i2c_adap, &info); | ||
775 | return; | ||
776 | } | ||
777 | |||
778 | /* Address not known, fallback to probing */ | ||
779 | i2c_new_probed_device(&dev->i2c_adap, &info, addr_list); | ||
730 | } | 780 | } |
731 | 781 | ||
732 | static int saa7134_rc5_irq(struct saa7134_dev *dev) | 782 | static int saa7134_rc5_irq(struct saa7134_dev *dev) |