Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: cx88: add IR remote support for NotOnlyTV LV3H

The PCI hybrid card NotOnlyTV LV3H has a built-in IR receiver connected
via I2C bus, currently not supported. This receiver is probably present
in more Geniatech cards. It has no capability for repeating when a key is
held down.

Add support for this built-in IR receiver. Use the existing Total Media
In Hand_02 remote keytable (Geniatech Mygica X8507) which matches exactly
the LV3H remote.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
Signed-off-by: Marek Kidawski <mark_kiddy@wp.pl>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Daniel González Cabanelas and committed by
Mauro Carvalho Chehab
39dfd52d 51e1440d

+50 -1
+47
drivers/media/i2c/ir-kbd-i2c.c
··· 238 238 return 1; 239 239 } 240 240 241 + static int get_key_geniatech(struct IR_i2c *ir, enum rc_proto *protocol, 242 + u32 *scancode, u8 *toggle) 243 + { 244 + int i, rc; 245 + unsigned char b; 246 + 247 + /* poll IR chip */ 248 + for (i = 0; i < 4; i++) { 249 + rc = i2c_master_recv(ir->c, &b, 1); 250 + if (rc == 1) 251 + break; 252 + msleep(20); 253 + } 254 + if (rc != 1) { 255 + dev_dbg(&ir->rc->dev, "read error\n"); 256 + if (rc < 0) 257 + return rc; 258 + return -EIO; 259 + } 260 + 261 + /* don't repeat the key */ 262 + if (ir->old == b) 263 + return 0; 264 + ir->old = b; 265 + 266 + /* decode to RC5 */ 267 + b &= 0x7f; 268 + b = (b - 1) / 2; 269 + 270 + dev_dbg(&ir->rc->dev, "key %02x\n", b); 271 + 272 + *protocol = RC_PROTO_RC5; 273 + *scancode = b; 274 + *toggle = ir->old >> 7; 275 + return 1; 276 + } 277 + 241 278 static int get_key_avermedia_cardbus(struct IR_i2c *ir, enum rc_proto *protocol, 242 279 u32 *scancode, u8 *toggle) 243 280 { ··· 803 766 rc_proto = RC_PROTO_BIT_OTHER; 804 767 ir_codes = RC_MAP_EMPTY; 805 768 break; 769 + case 0x33: 770 + name = "Geniatech"; 771 + ir->get_key = get_key_geniatech; 772 + rc_proto = RC_PROTO_BIT_RC5; 773 + ir_codes = RC_MAP_TOTAL_MEDIA_IN_HAND_02; 774 + ir->old = 0xfc; 775 + break; 806 776 case 0x6b: 807 777 name = "FusionHDTV"; 808 778 ir->get_key = get_key_fusionhdtv; ··· 868 824 break; 869 825 case IR_KBD_GET_KEY_KNC1: 870 826 ir->get_key = get_key_knc1; 827 + break; 828 + case IR_KBD_GET_KEY_GENIATECH: 829 + ir->get_key = get_key_geniatech; 871 830 break; 872 831 case IR_KBD_GET_KEY_FUSIONHDTV: 873 832 ir->get_key = get_key_fusionhdtv;
+1 -1
drivers/media/pci/cx88/cx88-input.c
··· 586 586 { 587 587 struct i2c_board_info info; 588 588 static const unsigned short default_addr_list[] = { 589 - 0x18, 0x6b, 0x71, 589 + 0x18, 0x33, 0x6b, 0x71, 590 590 I2C_CLIENT_END 591 591 }; 592 592 static const unsigned short pvr2000_addr_list[] = {
+1
drivers/media/pci/cx88/cx88-video.c
··· 1388 1388 } 1389 1389 fallthrough; 1390 1390 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: 1391 + case CX88_BOARD_NOTONLYTV_LV3H: 1391 1392 request_module("ir-kbd-i2c"); 1392 1393 } 1393 1394
+1
include/media/i2c/ir-kbd-i2c.h
··· 35 35 IR_KBD_GET_KEY_PIXELVIEW, 36 36 IR_KBD_GET_KEY_HAUP, 37 37 IR_KBD_GET_KEY_KNC1, 38 + IR_KBD_GET_KEY_GENIATECH, 38 39 IR_KBD_GET_KEY_FUSIONHDTV, 39 40 IR_KBD_GET_KEY_HAUP_XVR, 40 41 IR_KBD_GET_KEY_AVERMEDIA_CARDBUS,