diff options
author | Sean Young <sean@mess.org> | 2016-07-20 13:03:50 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-09-22 11:46:12 -0400 |
commit | d6ae162bd13998a6511e5efbc7c19ab542ba1555 (patch) | |
tree | 2179637c02cf2a8e01d8a890140991ff73d88e3b | |
parent | c7470ff210521e4ca2f4c5217b0d3405528a9b40 (diff) |
[media] redrat3: hardware-specific parameters
Add these options as module parameters for now; should other drivers
need similar options we could add it to the LIRC api.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/rc/redrat3.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index f4fae0934eca..05ba47bc0b61 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c | |||
@@ -124,6 +124,41 @@ | |||
124 | #define USB_RR3USB_PRODUCT_ID 0x0001 | 124 | #define USB_RR3USB_PRODUCT_ID 0x0001 |
125 | #define USB_RR3IIUSB_PRODUCT_ID 0x0005 | 125 | #define USB_RR3IIUSB_PRODUCT_ID 0x0005 |
126 | 126 | ||
127 | |||
128 | /* | ||
129 | * The redrat3 encodes an IR signal as set of different lengths and a set | ||
130 | * of indices into those lengths. This sets how much two lengths must | ||
131 | * differ before they are considered distinct, the value is specified | ||
132 | * in microseconds. | ||
133 | * Default 5, value 0 to 127. | ||
134 | */ | ||
135 | static int length_fuzz = 5; | ||
136 | module_param(length_fuzz, uint, 0644); | ||
137 | MODULE_PARM_DESC(length_fuzz, "Length Fuzz (0-127)"); | ||
138 | |||
139 | /* | ||
140 | * When receiving a continuous ir stream (for example when a user is | ||
141 | * holding a button down on a remote), this specifies the minimum size | ||
142 | * of a space when the redrat3 sends a irdata packet to the host. Specified | ||
143 | * in miliseconds. Default value 18ms. | ||
144 | * The value can be between 2 and 30 inclusive. | ||
145 | */ | ||
146 | static int minimum_pause = 18; | ||
147 | module_param(minimum_pause, uint, 0644); | ||
148 | MODULE_PARM_DESC(minimum_pause, "Minimum Pause in ms (2-30)"); | ||
149 | |||
150 | /* | ||
151 | * The carrier frequency is measured during the first pulse of the IR | ||
152 | * signal. The larger the number of periods used To measure, the more | ||
153 | * accurate the result is likely to be, however some signals have short | ||
154 | * initial pulses, so in some case it may be necessary to reduce this value. | ||
155 | * Default 8, value 1 to 255. | ||
156 | */ | ||
157 | static int periods_measure_carrier = 8; | ||
158 | module_param(periods_measure_carrier, uint, 0644); | ||
159 | MODULE_PARM_DESC(periods_measure_carrier, "Number of Periods to Measure Carrier (1-255)"); | ||
160 | |||
161 | |||
127 | struct redrat3_header { | 162 | struct redrat3_header { |
128 | __be16 length; | 163 | __be16 length; |
129 | __be16 transfer_type; | 164 | __be16 transfer_type; |
@@ -525,12 +560,25 @@ static void redrat3_reset(struct redrat3_dev *rr3) | |||
525 | RR3_CPUCS_REG_ADDR, 0, val, len, HZ * 25); | 560 | RR3_CPUCS_REG_ADDR, 0, val, len, HZ * 25); |
526 | dev_dbg(dev, "reset returned 0x%02x\n", rc); | 561 | dev_dbg(dev, "reset returned 0x%02x\n", rc); |
527 | 562 | ||
528 | *val = 5; | 563 | *val = length_fuzz; |
529 | rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, | 564 | rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
530 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | 565 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
531 | RR3_IR_IO_LENGTH_FUZZ, 0, val, len, HZ * 25); | 566 | RR3_IR_IO_LENGTH_FUZZ, 0, val, len, HZ * 25); |
532 | dev_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); | 567 | dev_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); |
533 | 568 | ||
569 | *val = (65536 - (minimum_pause * 2000)) / 256; | ||
570 | rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, | ||
571 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
572 | RR3_IR_IO_MIN_PAUSE, 0, val, len, HZ * 25); | ||
573 | dev_dbg(dev, "set ir parm min pause %d rc 0x%02x\n", *val, rc); | ||
574 | |||
575 | *val = periods_measure_carrier; | ||
576 | rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, | ||
577 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
578 | RR3_IR_IO_PERIODS_MF, 0, val, len, HZ * 25); | ||
579 | dev_dbg(dev, "set ir parm periods measure carrier %d rc 0x%02x", *val, | ||
580 | rc); | ||
581 | |||
534 | *val = RR3_DRIVER_MAXLENS; | 582 | *val = RR3_DRIVER_MAXLENS; |
535 | rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, | 583 | rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
536 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | 584 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |