Hi Stefan > Am 29.11.2010 09:44, schrieb Dmitri Belimov: > > Hi > > > > I try add IR for our TV cards. > > After my some changes IR is working. But when I remove USB stick > > from USB port > What has you change? 1. Add vendor-specific init code for IR. 2. Add vendor-specific key filter for IR. 3. Add some code for show IR activity via power led 4. Move TV card defines to header file. > Has it received keys? Yes. I received keys, and can control any programm via lirc > Which protocol you it? Our remotes has NEC protocol. > As > I wrote that I haven't the right value for rc5 protocol, and nec > protocol works, that I have tested. IR over int works well. But I found two main problems: 1. crash after remove 2. disable IR after start video/radio. Try solve this problem right now. I attched my diffs. This file has some debug junk. With my best regards, Dmitry. > Stefan Ringel > > modules crashed with dmesg > > > > [ 133.881750] tm6000: New video device @ 480 Mbps (6000:dec0, > > ifnum 0) [ 133.881759] tm6000: Found Beholder Wander DVB-T/TV/FM > > USB2.0 [ 134.343012] Board version = 0x67980bf4 > > [ 134.484013] board=0x67980bf4 > > [ 134.575011] tm6000 #0: i2c eeprom 00: 42 59 54 45 12 01 00 02 00 > > 00 00 40 00 60 c0 de BYTE.......@.`.. [ 134.687012] tm6000 #0: > > i2c eeprom 10: 01 00 10 20 40 01 28 03 42 00 65 00 68 00 6f 00 ... > > @.(.B.e.h.o. [ 134.799014] tm6000 #0: i2c eeprom 20: 6c 00 64 00 > > 65 00 72 00 20 00 49 00 6e 00 74 00 l.d.e.r. .I.n.t. > > [ 134.911012] tm6000 #0: i2c eeprom 30: 6c 00 2e 00 20 00 4c 00 74 > > 00 64 00 2e 00 ff ff l... .L.t.d..... [ 135.023013] tm6000 #0: > > i2c eeprom 40: 22 03 42 00 65 00 68 00 6f 00 6c 00 64 00 20 00 > > ".B.e.h.o.l.d. . [ 135.135015] tm6000 #0: i2c eeprom 50: 54 00 56 > > 00 20 00 57 00 61 00 6e 00 64 00 65 00 T.V. .W.a.n.d.e. > > [ 135.247014] tm6000 #0: i2c eeprom 60: 72 00 ff ff ff ff ff ff ff > > ff 1a 03 56 00 69 00 r...........V.i. [ 135.359013] tm6000 #0: > > i2c eeprom 70: 64 00 65 00 6f 00 43 00 61 00 70 00 74 00 75 00 > > d.e.o.C.a.p.t.u. [ 135.471013] tm6000 #0: i2c eeprom 80: 72 00 65 > > 00 ff ff ff ff ff ff ff ff ff ff ff ff r.e............. > > [ 135.583010] tm6000 #0: i2c eeprom 90: ff ff ff ff 16 03 30 00 30 > > 00 30 00 30 00 30 00 ......0.0.0.0.0. [ 135.695010] tm6000 #0: > > i2c eeprom a0: 30 00 32 00 30 00 34 00 31 00 ff ff ff ff ff ff > > 0.2.0.4.1....... [ 135.807012] tm6000 #0: i2c eeprom b0: ff ff ff > > ff ff ff ff ff ff ff ff ff ff ff ff ff ................ > > [ 135.919011] tm6000 #0: i2c eeprom c0: ff ff ff ff ff ff ff ff ff > > ff ff ff ff ff ff ff ................ [ 136.031014] tm6000 #0: > > i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff > > ff ................ [ 136.143010] tm6000 #0: i2c eeprom e0: ff ff > > ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ > > [ 136.255014] tm6000 #0: i2c eeprom f0: ff ff ff ff ff ff ff ff ff > > ff ff ff ff ff ff ff ................ > > [ 136.360015] ................ [ 136.362337] tuner 7-0061: chip > > found @ 0xc2 (tm6000 #0) [ 136.421801] xc5000 7-0061: creating new > > instance [ 136.450015] xc5000: Successfully identified at address > > 0x61 [ 136.450019] xc5000: Firmware has not been loaded previously > > [ 136.450025] tuner 7-0061: Tuner frontend module has no way to > > set config [ 136.504012] xc5000: waiting for firmware upload > > (dvb-fe-xc5000-1.6.114.fw)... [ 136.564545] xc5000: firmware read > > 12401 bytes. [ 136.564549] xc5000: firmware uploading... > > [ 143.241011] xc5000: firmware upload complete... [ 144.670093] > > Trident TVMaster TM5600/TM6000/TM6010 USB2 board (Load status: 0) > > [ 144.671201] tm6000: open called (dev=video0) [ 144.825125] usb > > 1-1: link qh0-00ff/f6762340 start 0 [1/0 us] [ 144.888012] > > Registered IR keymap rc-behold-columbus [ 144.888159] input: > > tm5600/60x0 IR (tm6000 #0) as /class/input/input5 [ 144.888217] > > rc0: tm5600/60x0 IR (tm6000 #0) as /class/rc/rc0 [ 145.044067] > > usbcore: registered new interface driver tm6000 [ 145.882658] > > tm6000: open called (dev=video0) [ 156.860296] hub 1-0:1.0: state > > 7 ports 8 chg 0000 evt 0002 [ 156.860310] ehci_hcd 0000:00:1d.7: > > GetStatus port 1 status 001002 POWER sig=se0 CSC [ 156.860323] hub > > 1-0:1.0: port 1, status 0100, change 0001, 12 Mb/s [ 156.860328] > > usb 1-1: USB disconnect, address 2 [ 156.860332] usb 1-1: > > unregistering device [ 156.860336] usb 1-1: usb_disable_device > > nuking all URBs [ 156.860370] usb 1-1: unlink qh0-00ff/f6762340 > > start 0 [1/0 us] [ 156.860432] tm6000_ir_urb_received start > > [ 156.860435] not ready [ 156.860440] ehci_hcd 0000:00:1d.7: > > shutdown urb f4900cc0 ep3in-intr [ 156.860446] usb 1-1: > > unregistering interface 1-1:1.0 [ 156.860492] tm6000: > > disconnecting tm6000 #0 [ 156.860494] befor if (!ir) > > [ 156.860495] befor ir_input_unregister(ir->input->input_dev); > > [ 156.862220] BUG: unable to handle kernel NULL pointer > > dereference at 000000f0 [ 156.862223] IP: [<f80370a9>] > > ir_close+0x12/0x20 [ir_core] [ 156.862230] *pde = 00000000 > > [ 156.862232] Oops: 0000 [#1] PREEMPT SMP [ 156.862235] last > > sysfs file: /sys/class/video4linux/video0/uevent [ 156.862238] > > Modules linked in: rc_behold_columbus xc5000 tuner tm6000(C) > > v4l2_common ir_lirc_codec videodev lirc_dev ir_sony_decoder > > v4l1_compat videobuf_vmalloc ir_jvc_decoder videobuf_core > > ir_rc6_decoder ir_rc5_decoder ir_nec_decoder ir_common ir_core > > ppdev lp ipv6 nls_utf8 ntfs dm_snapshot dm_mirror dm_region_hash > > dm_log dm_mod sha1_generic arc4 ecb ppp_mppe ppp_generic slhc loop > > nvidia(P) snd_hda_codec_realtek snd_hda_intel snd_hda_codec > > snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss > > snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer > > snd_seq_device snd i2c_i801 psmouse parport_pc processor soundcore > > tpm_tis parport rng_core i2c_core intel_agp tpm button pcspkr > > serio_raw snd_page_alloc agpgart tpm_bios evdev ext3 jbd mbcache > > sr_mod sd_mod cdrom ata_generic ata_piix libata scsi_mod uhci_hcd > > ide_pci_generic ehci_hcd ide_core usbcore nls_base r8169 mii > > thermal thermal_sys [last unloaded: scsi_wait_scan] [ 156.862296] > > [ 156.862299] Pid: 570, comm: khubd Tainted: P C > > 2.6.35-tm6000-new3+ #1 G31M-S2L/G31M-ES2L [ 156.862302] EIP: > > 0060:[<f80370a9>] EFLAGS: 00010282 CPU: 1 [ 156.862305] EIP is at > > ir_close+0x12/0x20 [ir_core] [ 156.862307] EAX: 00000000 EBX: > > f497a000 ECX: 00000000 EDX: f8037097 [ 156.862309] ESI: f4903208 > > EDI: f497a790 EBP: f6401dc0 ESP: f6401dc0 [ 156.862311] DS: 007b > > ES: 007b FS: 00d8 GS: 0000 SS: 0068 [ 156.862314] Process khubd > > (pid: 570, ti=f6400000 task=f644c590 task.ti=f6400000) > > [ 156.862315] Stack: [ 156.862316] f6401dd4 c11c8867 f4903208 > > f4903200 f4903244 f6401dec f834dc91 f490323c [ 156.862321]<0> > > f4903208 f4903200 f490325c f6401e00 f834dcb9 f497a860 f497a000 > > f497a874 [ 156.862327]<0> f6401e14 c11c8b59 f497a7ac f7252800 > > f497a000 f6401e28 f8037ac6 f7252800 [ 156.862333] Call Trace: > > [ 156.862338] [<c11c8867>] ? input_close_device+0x43/0x5f > > [ 156.862345] [<f834dc91>] ? evdev_cleanup+0xbd/0xc5 [evdev] > > [ 156.862349] [<f834dcb9>] ? evdev_disconnect+0x20/0x33 [evdev] > > [ 156.862352] [<c11c8b59>] ? input_unregister_device+0x8c/0x11a > > [ 156.862356] [<f8037ac6>] ? ir_unregister_class+0x3a/0x50 > > [ir_core] [ 156.862359] [<f803707e>] ? > > ir_input_unregister+0x7e/0x97 [ir_core] [ 156.862363] > > [<f818d735>] ? tm6000_ir_fini+0x3d/0xda [tm6000] [ 156.862367] > > [<f81891aa>] ? tm6000_usb_disconnect+0x48/0xdb [tm6000] > > [ 156.862377] [<f810d572>] ? usb_unbind_interface+0x45/0xb7 > > [usbcore] [ 156.862384] [<c11bddf5>] ? > > __device_release_driver+0x5d/0x93 [ 156.862387] [<c11bded2>] ? > > device_release_driver+0x1d/0x28 [ 156.862390] [<c11bd521>] ? > > bus_remove_device+0x92/0xa9 [ 156.862393] [<c11bbde3>] ? > > device_del+0xfb/0x132 [ 156.862402] [<f810b45d>] ? > > usb_disable_device+0xb2/0x116 [usbcore] [ 156.862412] > > [<f8106aa2>] ? usb_disconnect+0x8e/0x10e [usbcore] [ 156.862422] > > [<f8107b9f>] ? hub_thread+0x56c/0xe91 [usbcore] [ 156.862428] > > [<c10486f1>] ? autoremove_wake_function+0x0/0x38 [ 156.862439] > > [<f8107633>] ? hub_thread+0x0/0xe91 [usbcore] [ 156.862442] > > [<c104830b>] ? kthread+0x66/0x6b [ 156.862445] [<c10482a5>] ? > > kthread+0x0/0x6b [ 156.862448] [<c1002eb6>] ? > > kernel_thread_helper+0x6/0x10 [ 156.862450] Code: 8b 83 c8 00 00 > > 00 e8 61 38 08 c9 89 d8 e8 5a 38 08 c9 8d 65 f8 5b 5e 5d c3 55 89 > > e5 0f 1f 44 00 00 05 ac 07 00 00 e8 a8 6c 18 c9<8b> 90 f0 00 00 00 > > 8b 42 20 ff 52 2c 5d c3 55 89 e5 0f 1f 44 00 [ 156.862481] EIP: > > [<f80370a9>] ir_close+0x12/0x20 [ir_core] SS:ESP 0068:f6401dc0 > > [ 156.862486] CR2: 00000000000000f0 [ 156.862488] ---[ end trace > > 7a803f828333ac48 ]--- > > > > > > Source tm6000-input > > > > int tm6000_ir_fini(struct tm6000_core *dev) > > { > > struct tm6000_IR *ir = dev->ir; > > > > /* skip detach on non attached board */ > > if (!ir) > > return 0; > > > > ir_input_unregister(ir->input->input_dev); > > > > > > The modules crashed when call ir_input_unregister > > > > And never called tm6000_ir_stop > > > > static void tm6000_ir_stop(void *priv) > > { > > struct tm6000_IR *ir = priv; > > > > cancel_delayed_work_sync(&ir->work); > > } > > > > And function default_polling_getkey is not dead. > > > > With my best regards, Dmitry. > >
diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig old mode 100644 new mode 100755 diff --git a/drivers/staging/tm6000/Makefile b/drivers/staging/tm6000/Makefile old mode 100644 new mode 100755 diff --git a/drivers/staging/tm6000/README b/drivers/staging/tm6000/README old mode 100644 new mode 100755 diff --git a/drivers/staging/tm6000/TODO b/drivers/staging/tm6000/TODO old mode 100644 new mode 100755 diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c old mode 100644 new mode 100755 index a99101f..6605260 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c @@ -326,7 +326,7 @@ static int snd_tm6000_card_trigger(struct snd_pcm_substream *substream, int cmd) struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream); int err; - spin_lock(&chip->reg_lock); +// spin_lock(&chip->reg_lock); switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -340,7 +340,7 @@ static int snd_tm6000_card_trigger(struct snd_pcm_substream *substream, int cmd) break; } - spin_unlock(&chip->reg_lock); +// spin_unlock(&chip->reg_lock); return err; } @@ -425,7 +425,7 @@ int tm6000_audio_init(struct tm6000_core *dev) chip->core = dev; chip->card = card; dev->adev = chip; - spin_lock_init(&chip->reg_lock); +// spin_lock_init(&chip->reg_lock); rc = snd_pcm_new(card, "TM6000 Audio", 0, 0, 1, &pcm); if (rc < 0) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c old mode 100644 new mode 100755 index 9d091c3..878e292 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -36,22 +36,6 @@ #include "tuner-xc2028.h" #include "xc5000.h" -#define TM6000_BOARD_UNKNOWN 0 -#define TM5600_BOARD_GENERIC 1 -#define TM6000_BOARD_GENERIC 2 -#define TM6010_BOARD_GENERIC 3 -#define TM5600_BOARD_10MOONS_UT821 4 -#define TM5600_BOARD_10MOONS_UT330 5 -#define TM6000_BOARD_ADSTECH_DUAL_TV 6 -#define TM6000_BOARD_FREECOM_AND_SIMILAR 7 -#define TM6000_BOARD_ADSTECH_MINI_DUAL_TV 8 -#define TM6010_BOARD_HAUPPAUGE_900H 9 -#define TM6010_BOARD_BEHOLD_WANDER 10 -#define TM6010_BOARD_BEHOLD_VOYAGER 11 -#define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE 12 -#define TM6010_BOARD_TWINHAN_TU501 13 - -#define TM6000_MAXBOARDS 16 static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; module_param_array(card, int, NULL, 0444); @@ -239,6 +223,7 @@ struct tm6000_board tm6000_boards[] = { .demod_reset = TM6010_GPIO_1, .power_led = TM6010_GPIO_6, }, + .ir_codes = RC_MAP_BEHOLD_COLUMBUS, }, [TM6010_BOARD_BEHOLD_VOYAGER] = { .name = "Beholder Voyager TV/FM USB2.0", @@ -256,6 +241,7 @@ struct tm6000_board tm6000_boards[] = { .tuner_reset = TM6010_GPIO_0, .power_led = TM6010_GPIO_6, }, + .ir_codes = RC_MAP_BEHOLD_COLUMBUS, }, [TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = { .name = "Terratec Cinergy Hybrid XE / Cinergy Hybrid-Stick", @@ -328,6 +314,46 @@ struct usb_device_id tm6000_id_table[] = { { }, }; +void tm6000_flash_led(struct tm6000_core *dev, u8 state) +{ + /* Power LED unconfigured */ + if (!dev->gpio.power_led) + return; + + /* ON Power LED */ + if (state) { + switch (dev->model) { + case TM6010_BOARD_HAUPPAUGE_900H: + case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: + case TM6010_BOARD_TWINHAN_TU501: + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->gpio.power_led, 0x00); + break; + case TM6010_BOARD_BEHOLD_WANDER: + case TM6010_BOARD_BEHOLD_VOYAGER: + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->gpio.power_led, 0x01); + break; + } + } + /* OFF Power LED */ + else { + switch (dev->model) { + case TM6010_BOARD_HAUPPAUGE_900H: + case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: + case TM6010_BOARD_TWINHAN_TU501: + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->gpio.power_led, 0x01); + break; + case TM6010_BOARD_BEHOLD_WANDER: + case TM6010_BOARD_BEHOLD_VOYAGER: + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->gpio.power_led, 0x00); + break; + } + } +} + /* Tuner callback to provide the proper gpio changes needed for xc5000 */ int tm6000_xc5000_callback(void *ptr, int component, int command, int arg) { @@ -857,7 +883,6 @@ static int tm6000_usb_probe(struct usb_interface *interface, } } - printk(KERN_INFO "tm6000: New video device @ %s Mbps (%04x:%04x, ifnum %d)\n", speed, le16_to_cpu(dev->udev->descriptor.idVendor), diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c old mode 100644 new mode 100755 diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c old mode 100644 new mode 100755 diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c old mode 100644 new mode 100755 diff --git a/drivers/staging/tm6000/tm6000-input.c b/drivers/staging/tm6000/tm6000-input.c old mode 100644 new mode 100755 index daca3a5..e1c624e --- a/drivers/staging/tm6000/tm6000-input.c +++ b/drivers/staging/tm6000/tm6000-input.c @@ -38,6 +38,10 @@ static unsigned int enable_ir = 1; module_param(enable_ir, int, 0644); MODULE_PARM_DESC(enable_ir, "enable ir (default is enable)"); +/* number of 50ms for ON-OFF-ON power led */ +/* show IR activity */ +#define PWLED_OFF 2 + #undef dprintk #define dprintk(fmt, arg...) \ @@ -61,6 +65,8 @@ struct tm6000_IR { struct delayed_work work; u8 wait:1; u8 key:1; + u8 pwled:1; + u8 pwledcnt; struct urb *int_urb; u8 *urb_data; @@ -91,26 +97,50 @@ static int tm6000_ir_config(struct tm6000_IR *ir) u8 buf[10]; int rc; - /* hack */ - buf[0] = 0xff; - buf[1] = 0xff; - buf[2] = 0xf2; - buf[3] = 0x2b; - buf[4] = 0x20; - buf[5] = 0x35; - buf[6] = 0x60; - buf[7] = 0x04; - buf[8] = 0xc0; - buf[9] = 0x08; - - rc = tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR | + switch (dev->model) { + case TM6010_BOARD_BEHOLD_WANDER: + case TM6010_BOARD_BEHOLD_VOYAGER: + /* Setup IR decoder for NEC standard */ + /* IR_LEADER_CNT = 0.9ms */ + tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_LEADER1, 0xaa); + tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_LEADER0, 0x30); + /* IR_PULSE_CNT = 0.7ms */ + tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_PULSE_CNT1, 0x20); + tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_PULSE_CNT0, 0xd0); + /* Remote WAKEUP = enable */ + tm6000_set_reg(dev, TM6010_REQ07_RE5_REMOTE_WAKEUP, 0xfe); + /* IR_WKUP_SEL = Low byte in decoded IR data */ + tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_WAKEUP_SEL, 0xfc); + /* IR_WKU_ADD code 0x12 */ + tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_WAKEUP_ADD, 0x12); + tm6000_flash_led(dev, 0); + msleep(100); + tm6000_flash_led(dev, 1); + break; + default: + /* hack */ + buf[0] = 0xff; + buf[1] = 0xff; + buf[2] = 0xf2; + buf[3] = 0x2b; + buf[4] = 0x20; + buf[5] = 0x35; + buf[6] = 0x60; + buf[7] = 0x04; + buf[8] = 0xc0; + buf[9] = 0x08; + + rc = tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, REQ_00_SET_IR_VALUE, 0, 0, buf, 0x0a); - msleep(100); + msleep(100); - if (rc < 0) { - printk(KERN_INFO "IR configuration failed"); - return rc; + if (rc < 0) { + printk(KERN_INFO "IR configuration failed"); + return rc; + } + break; } + return 0; } @@ -119,15 +149,15 @@ static void tm6000_ir_urb_received(struct urb *urb) struct tm6000_core *dev = urb->context; struct tm6000_IR *ir = dev->ir; int rc; - +printk("tm6000_ir_urb_received start\n"); if (urb->status != 0) printk(KERN_INFO "not ready\n"); else if (urb->actual_length > 0) { memcpy(ir->urb_data, urb->transfer_buffer, urb->actual_length); - +printk("int_in ir urb received %02x %02x %02x %02x\n", ir->urb_data[0], + ir->urb_data[1], ir->urb_data[2], ir->urb_data[3]); dprintk("data %02x %02x %02x %02x\n", ir->urb_data[0], ir->urb_data[1], ir->urb_data[2], ir->urb_data[3]); - ir->key = 1; } @@ -148,7 +178,15 @@ static int default_polling_getkey(struct tm6000_IR *ir, if (ir->ir.ir_type == IR_TYPE_RC5) poll_result->rc_data = ir->urb_data[0]; else - poll_result->rc_data = ir->urb_data[0] | ir->urb_data[1] << 8; + if (((dev->model == TM6010_BOARD_BEHOLD_WANDER) || + (dev->model == TM6010_BOARD_BEHOLD_VOYAGER)) && + (ir->urb_data[1] == 0x86)) { + poll_result->rc_data = ir->urb_data[0]; + } + else { + poll_result->rc_data = ir->urb_data[0] + | ir->urb_data[1] << 8; + } } else { tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 0); msleep(10); @@ -188,6 +226,7 @@ static int default_polling_getkey(struct tm6000_IR *ir, static void tm6000_ir_handle_key(struct tm6000_IR *ir) { + struct tm6000_core *dev = ir->dev; int result; struct tm6000_ir_poll_result poll_result; @@ -200,12 +239,25 @@ static void tm6000_ir_handle_key(struct tm6000_IR *ir) dprintk("ir->get_key result data=%04x\n", poll_result.rc_data); + if (ir->pwled) { + if (ir->pwledcnt >= PWLED_OFF) { + ir->pwled = 0; + ir->pwledcnt = 0; + tm6000_flash_led(dev, 1); + } + else + ir->pwledcnt += 1; + } + if (ir->key) { ir_input_keydown(ir->input->input_dev, &ir->ir, (u32)poll_result.rc_data); ir_input_nokey(ir->input->input_dev, &ir->ir); ir->key = 0; + ir->pwled = 1; + ir->pwledcnt = 0; + tm6000_flash_led(dev, 0); } return; } @@ -231,7 +283,7 @@ static int tm6000_ir_start(void *priv) static void tm6000_ir_stop(void *priv) { struct tm6000_IR *ir = priv; - +printk("tm600o_ir_stop\n"); cancel_delayed_work_sync(&ir->work); } @@ -283,6 +335,8 @@ int tm6000_ir_init(struct tm6000_core *dev) ir->props.driver_type = RC_DRIVER_SCANCODE; ir->polling = 50; + ir->pwled = 0; + ir->pwledcnt = 0; snprintf(ir->name, sizeof(ir->name), "tm5600/60x0 IR (%s)", dev->name); @@ -342,6 +396,7 @@ int tm6000_ir_init(struct tm6000_core *dev) if (err) goto err_out_stop; + return 0; err_out_stop: @@ -357,12 +412,12 @@ int tm6000_ir_fini(struct tm6000_core *dev) struct tm6000_IR *ir = dev->ir; /* skip detach on non attached board */ - +printk("befor if (!ir)\n"); if (!ir) return 0; - +printk("befor ir_input_unregister(ir->input->input_dev);\n"); ir_input_unregister(ir->input->input_dev); - +printk("befor if (ir->int_urb) {\n"); if (ir->int_urb) { usb_kill_urb(ir->int_urb); kfree(ir->int_urb->transfer_buffer); @@ -371,10 +426,12 @@ int tm6000_ir_fini(struct tm6000_core *dev) kfree(ir->urb_data); ir->urb_data = NULL; } - +printk("befor kfree(ir->input);\n"); kfree(ir->input); +printk("befor ir->input = NULL;\n"); ir->input = NULL; kfree(ir); +printk("befor dev->ir = NULL;\n"); dev->ir = NULL; return 0; diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h old mode 100644 new mode 100755 diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c old mode 100644 new mode 100755 diff --git a/drivers/staging/tm6000/tm6000-usb-isoc.h b/drivers/staging/tm6000/tm6000-usb-isoc.h old mode 100644 new mode 100755 diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c old mode 100644 new mode 100755 diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h old mode 100644 new mode 100755 index 1ec1bff..549d487 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -39,6 +39,23 @@ #define TM6000_VERSION KERNEL_VERSION(0, 0, 2) +#define TM6000_BOARD_UNKNOWN 0 +#define TM5600_BOARD_GENERIC 1 +#define TM6000_BOARD_GENERIC 2 +#define TM6010_BOARD_GENERIC 3 +#define TM5600_BOARD_10MOONS_UT821 4 +#define TM5600_BOARD_10MOONS_UT330 5 +#define TM6000_BOARD_ADSTECH_DUAL_TV 6 +#define TM6000_BOARD_FREECOM_AND_SIMILAR 7 +#define TM6000_BOARD_ADSTECH_MINI_DUAL_TV 8 +#define TM6010_BOARD_HAUPPAUGE_900H 9 +#define TM6010_BOARD_BEHOLD_WANDER 10 +#define TM6010_BOARD_BEHOLD_VOYAGER 11 +#define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE 12 +#define TM6010_BOARD_TWINHAN_TU501 13 + +#define TM6000_MAXBOARDS 16 + /* Inputs */ enum tm6000_itype { @@ -260,6 +277,7 @@ struct tm6000_fh { int tm6000_tuner_callback(void *ptr, int component, int command, int arg); int tm6000_xc5000_callback(void *ptr, int component, int command, int arg); int tm6000_cards_setup(struct tm6000_core *dev); +void tm6000_flash_led(struct tm6000_core *dev, u8 state); /* In tm6000-core.c */ @@ -270,6 +288,7 @@ int tm6000_get_reg16(struct tm6000_core *dev, u8 req, u16 value, u16 index); int tm6000_get_reg32(struct tm6000_core *dev, u8 req, u16 value, u16 index); int tm6000_set_reg(struct tm6000_core *dev, u8 req, u16 value, u16 index); int tm6000_i2c_reset(struct tm6000_core *dev, u16 tsleep); + int tm6000_init(struct tm6000_core *dev); int tm6000_init_analog_mode(struct tm6000_core *dev);