summaryrefslogtreecommitdiff
path: root/include/media/rc-core.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/rc-core.h')
-rw-r--r--include/media/rc-core.h69
1 files changed, 53 insertions, 16 deletions
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index 314a1edb6189..aed4272d47f5 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -17,6 +17,7 @@
#define _RC_CORE
#include <linux/spinlock.h>
+#include <linux/cdev.h>
#include <linux/kfifo.h>
#include <linux/time.h>
#include <linux/timer.h>
@@ -30,9 +31,9 @@ do { \
} while (0)
/**
- * enum rc_driver_type - type of the RC output
+ * enum rc_driver_type - type of the RC driver.
*
- * @RC_DRIVER_SCANCODE: Driver or hardware generates a scancode
+ * @RC_DRIVER_SCANCODE: Driver or hardware generates a scancode.
* @RC_DRIVER_IR_RAW: Driver or hardware generates pulse/space sequences.
* It needs a Infra-Red pulse/space decoder
* @RC_DRIVER_IR_RAW_TX: Device transmitter only,
@@ -68,6 +69,33 @@ enum rc_filter_type {
};
/**
+ * struct lirc_fh - represents an open lirc file
+ * @list: list of open file handles
+ * @rc: rcdev for this lirc chardev
+ * @carrier_low: when setting the carrier range, first the low end must be
+ * set with an ioctl and then the high end with another ioctl
+ * @send_timeout_reports: report timeouts in lirc raw IR.
+ * @rawir: queue for incoming raw IR
+ * @scancodes: queue for incoming decoded scancodes
+ * @wait_poll: poll struct for lirc device
+ * @send_mode: lirc mode for sending, either LIRC_MODE_SCANCODE or
+ * LIRC_MODE_PULSE
+ * @rec_mode: lirc mode for receiving, either LIRC_MODE_SCANCODE or
+ * LIRC_MODE_MODE2
+ */
+struct lirc_fh {
+ struct list_head list;
+ struct rc_dev *rc;
+ int carrier_low;
+ bool send_timeout_reports;
+ DECLARE_KFIFO_PTR(rawir, unsigned int);
+ DECLARE_KFIFO_PTR(scancodes, struct lirc_scancode);
+ wait_queue_head_t wait_poll;
+ u8 send_mode;
+ u8 rec_mode;
+};
+
+/**
* struct rc_dev - represents a remote control device
* @dev: driver model's view of this device
* @managed_alloc: devm_rc_allocate_device was used to create rc_dev
@@ -106,6 +134,8 @@ enum rc_filter_type {
* @keypressed: whether a key is currently pressed
* @keyup_jiffies: time (in jiffies) when the current keypress should be released
* @timer_keyup: timer for releasing a keypress
+ * @timer_repeat: timer for autorepeat events. This is needed for CEC, which
+ * has non-standard repeats.
* @last_keycode: keycode of last keypress
* @last_protocol: protocol of last keypress
* @last_scancode: scancode of last keypress
@@ -115,6 +145,15 @@ enum rc_filter_type {
* @max_timeout: maximum timeout supported by device
* @rx_resolution : resolution (in ns) of input sampler
* @tx_resolution: resolution (in ns) of output sampler
+ * @lirc_dev: lirc device
+ * @lirc_cdev: lirc char cdev
+ * @gap_start: time when gap starts
+ * @gap_duration: duration of initial gap
+ * @gap: true if we're in a gap
+ * @lirc_fh_lock: protects lirc_fh list
+ * @lirc_fh: list of open files
+ * @registered: set to true by rc_register_device(), false by
+ * rc_unregister_device
* @change_protocol: allow changing the protocol used on hardware decoders
* @open: callback to allow drivers to enable polling/irq when IR input device
* is opened.
@@ -165,6 +204,7 @@ struct rc_dev {
bool keypressed;
unsigned long keyup_jiffies;
struct timer_list timer_keyup;
+ struct timer_list timer_repeat;
u32 last_keycode;
enum rc_proto last_protocol;
u32 last_scancode;
@@ -174,6 +214,16 @@ struct rc_dev {
u32 max_timeout;
u32 rx_resolution;
u32 tx_resolution;
+#ifdef CONFIG_LIRC
+ struct device lirc_dev;
+ struct cdev lirc_cdev;
+ ktime_t gap_start;
+ u64 gap_duration;
+ bool gap;
+ spinlock_t lirc_fh_lock;
+ struct list_head lirc_fh;
+#endif
+ bool registered;
int (*change_protocol)(struct rc_dev *dev, u64 *rc_proto);
int (*open)(struct rc_dev *dev);
void (*close)(struct rc_dev *dev);
@@ -248,20 +298,6 @@ int devm_rc_register_device(struct device *parent, struct rc_dev *dev);
*/
void rc_unregister_device(struct rc_dev *dev);
-/**
- * rc_open - Opens a RC device
- *
- * @rdev: pointer to struct rc_dev.
- */
-int rc_open(struct rc_dev *rdev);
-
-/**
- * rc_close - Closes a RC device
- *
- * @rdev: pointer to struct rc_dev.
- */
-void rc_close(struct rc_dev *rdev);
-
void rc_repeat(struct rc_dev *dev);
void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u32 scancode,
u8 toggle);
@@ -309,6 +345,7 @@ int ir_raw_event_store_with_filter(struct rc_dev *dev,
void ir_raw_event_set_idle(struct rc_dev *dev, bool idle);
int ir_raw_encode_scancode(enum rc_proto protocol, u32 scancode,
struct ir_raw_event *events, unsigned int max);
+int ir_raw_encode_carrier(enum rc_proto protocol);
static inline void ir_raw_event_reset(struct rc_dev *dev)
{