diff options
author | Jarod Wilson <jarod@redhat.com> | 2010-07-08 11:38:57 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-02 15:42:43 -0400 |
commit | 22b0766b62d517a597d8155d828c5f93e3523cfa (patch) | |
tree | 142cf3481a52076fa182ef53ae51615a768b39fc /drivers/media/IR | |
parent | ca17a4f0bfc48feb3b4eb3f671a82adfe89530fb (diff) |
V4L/DVB: IR/mceusb: more streamlining of device init
Spent a while last night getting device initialization packet captures
under Windows for all generations of devices. There are a few places
where we were doing things differently, and few things we were doing
that we don't need to do, particularly on gen3 hardware, and I *think*
one of those things is what was locking up my pinnacle hw from time to
time -- at least, its been perfectly well behaved every time its been
plugged in since making this change.
First up, we're adding a bit more to the gen1 init routine here. Its
not absolutely necessary, the hardware works the same both with and
without it, but I'd like to be consistent w/Windows here.
Second, DEVICE_RESET is never called when initializing either of my
gen3 devices, its only called for gen1 and gen2. The bits in the gen3
init after removing that, are safe (and interesting) to run on all
hardware, so there's no more gen3-specific init done, there's instead
a generic mceusb_get_parameters() that is run for all hardware.
Third, the gen3 flag isn't needed. We only care if hardware is gen3
during probe, so I've dropped that from the device flags struct.
Successfully tested on all three generations of mceusb hardware.
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR')
-rw-r--r-- | drivers/media/IR/mceusb.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c index e368b8213c3b..78bf7f77a1a0 100644 --- a/drivers/media/IR/mceusb.c +++ b/drivers/media/IR/mceusb.c | |||
@@ -254,8 +254,7 @@ struct mceusb_dev { | |||
254 | u32 connected:1; | 254 | u32 connected:1; |
255 | u32 tx_mask_inverted:1; | 255 | u32 tx_mask_inverted:1; |
256 | u32 microsoft_gen1:1; | 256 | u32 microsoft_gen1:1; |
257 | u32 gen3:1; | 257 | u32 reserved:29; |
258 | u32 reserved:28; | ||
259 | } flags; | 258 | } flags; |
260 | 259 | ||
261 | /* transmit support */ | 260 | /* transmit support */ |
@@ -292,6 +291,7 @@ struct mceusb_dev { | |||
292 | static char DEVICE_RESET[] = {0x00, 0xff, 0xaa}; | 291 | static char DEVICE_RESET[] = {0x00, 0xff, 0xaa}; |
293 | static char GET_REVISION[] = {0xff, 0x0b}; | 292 | static char GET_REVISION[] = {0xff, 0x0b}; |
294 | static char GET_UNKNOWN[] = {0xff, 0x18}; | 293 | static char GET_UNKNOWN[] = {0xff, 0x18}; |
294 | static char GET_UNKNOWN2[] = {0x9f, 0x05}; | ||
295 | static char GET_CARRIER_FREQ[] = {0x9f, 0x07}; | 295 | static char GET_CARRIER_FREQ[] = {0x9f, 0x07}; |
296 | static char GET_RX_TIMEOUT[] = {0x9f, 0x0d}; | 296 | static char GET_RX_TIMEOUT[] = {0x9f, 0x0d}; |
297 | static char GET_TX_BITMASK[] = {0x9f, 0x13}; | 297 | static char GET_TX_BITMASK[] = {0x9f, 0x13}; |
@@ -766,6 +766,7 @@ static void mceusb_dev_recv(struct urb *urb, struct pt_regs *regs) | |||
766 | static void mceusb_gen1_init(struct mceusb_dev *ir) | 766 | static void mceusb_gen1_init(struct mceusb_dev *ir) |
767 | { | 767 | { |
768 | int ret; | 768 | int ret; |
769 | int maxp = ir->len_in; | ||
769 | struct device *dev = ir->dev; | 770 | struct device *dev = ir->dev; |
770 | char *data; | 771 | char *data; |
771 | 772 | ||
@@ -805,6 +806,14 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) | |||
805 | 0x0000, 0x0100, NULL, 0, HZ * 3); | 806 | 0x0000, 0x0100, NULL, 0, HZ * 3); |
806 | dev_dbg(dev, "%s - retC = %d\n", __func__, ret); | 807 | dev_dbg(dev, "%s - retC = %d\n", __func__, ret); |
807 | 808 | ||
809 | /* device reset */ | ||
810 | mce_async_out(ir, DEVICE_RESET, sizeof(DEVICE_RESET)); | ||
811 | mce_sync_in(ir, NULL, maxp); | ||
812 | |||
813 | /* get hw/sw revision? */ | ||
814 | mce_async_out(ir, GET_REVISION, sizeof(GET_REVISION)); | ||
815 | mce_sync_in(ir, NULL, maxp); | ||
816 | |||
808 | kfree(data); | 817 | kfree(data); |
809 | }; | 818 | }; |
810 | 819 | ||
@@ -820,19 +829,17 @@ static void mceusb_gen2_init(struct mceusb_dev *ir) | |||
820 | mce_async_out(ir, GET_REVISION, sizeof(GET_REVISION)); | 829 | mce_async_out(ir, GET_REVISION, sizeof(GET_REVISION)); |
821 | mce_sync_in(ir, NULL, maxp); | 830 | mce_sync_in(ir, NULL, maxp); |
822 | 831 | ||
823 | /* unknown what this actually returns... */ | 832 | /* unknown what the next two actually return... */ |
824 | mce_async_out(ir, GET_UNKNOWN, sizeof(GET_UNKNOWN)); | 833 | mce_async_out(ir, GET_UNKNOWN, sizeof(GET_UNKNOWN)); |
825 | mce_sync_in(ir, NULL, maxp); | 834 | mce_sync_in(ir, NULL, maxp); |
835 | mce_async_out(ir, GET_UNKNOWN2, sizeof(GET_UNKNOWN2)); | ||
836 | mce_sync_in(ir, NULL, maxp); | ||
826 | } | 837 | } |
827 | 838 | ||
828 | static void mceusb_gen3_init(struct mceusb_dev *ir) | 839 | static void mceusb_get_parameters(struct mceusb_dev *ir) |
829 | { | 840 | { |
830 | int maxp = ir->len_in; | 841 | int maxp = ir->len_in; |
831 | 842 | ||
832 | /* device reset */ | ||
833 | mce_async_out(ir, DEVICE_RESET, sizeof(DEVICE_RESET)); | ||
834 | mce_sync_in(ir, NULL, maxp); | ||
835 | |||
836 | /* get the carrier and frequency */ | 843 | /* get the carrier and frequency */ |
837 | mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); | 844 | mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); |
838 | mce_sync_in(ir, NULL, maxp); | 845 | mce_sync_in(ir, NULL, maxp); |
@@ -999,7 +1006,6 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
999 | ir->usbdev = dev; | 1006 | ir->usbdev = dev; |
1000 | ir->dev = &intf->dev; | 1007 | ir->dev = &intf->dev; |
1001 | ir->len_in = maxp; | 1008 | ir->len_in = maxp; |
1002 | ir->flags.gen3 = is_gen3; | ||
1003 | ir->flags.microsoft_gen1 = is_microsoft_gen1; | 1009 | ir->flags.microsoft_gen1 = is_microsoft_gen1; |
1004 | ir->flags.tx_mask_inverted = tx_mask_inverted; | 1010 | ir->flags.tx_mask_inverted = tx_mask_inverted; |
1005 | 1011 | ||
@@ -1032,16 +1038,12 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1032 | ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 1038 | ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
1033 | 1039 | ||
1034 | /* initialize device */ | 1040 | /* initialize device */ |
1035 | if (ir->flags.gen3) | 1041 | if (ir->flags.microsoft_gen1) |
1036 | mceusb_gen3_init(ir); | ||
1037 | |||
1038 | else if (ir->flags.microsoft_gen1) | ||
1039 | mceusb_gen1_init(ir); | 1042 | mceusb_gen1_init(ir); |
1040 | 1043 | else if (!is_gen3) | |
1041 | else | ||
1042 | mceusb_gen2_init(ir); | 1044 | mceusb_gen2_init(ir); |
1043 | 1045 | ||
1044 | mce_sync_in(ir, NULL, maxp); | 1046 | mceusb_get_parameters(ir); |
1045 | 1047 | ||
1046 | mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); | 1048 | mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); |
1047 | 1049 | ||