summaryrefslogtreecommitdiff
path: root/drivers/media/IR
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-12-14 02:55:03 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 15:10:24 -0300
commitd4b778d36889b4d51d79a99f8a96e110def8541c (patch)
tree641bb024dabf3785cb7cfce53a1e95d69153be00 /drivers/media/IR
parent950b0f5a0bf764663a6aa4397d105ad571c64a83 (diff)
downloadlinux-3.10-d4b778d36889b4d51d79a99f8a96e110def8541c.tar.gz
linux-3.10-d4b778d36889b4d51d79a99f8a96e110def8541c.tar.bz2
linux-3.10-d4b778d36889b4d51d79a99f8a96e110def8541c.zip
V4L/DVB (13638): ir-core: documment missed functions
While here, change ir_core_dev_number to be static Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR')
-rw-r--r--drivers/media/IR/ir-keytable.c13
-rw-r--r--drivers/media/IR/ir-sysfs.c50
2 files changed, 56 insertions, 7 deletions
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index b2d498c3183..68aceb8d63a 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -402,9 +402,10 @@ EXPORT_SYMBOL_GPL(ir_g_keycode_from_table);
* @input_dev: the struct input_dev descriptor of the device
* @rc_tab: the struct ir_scancode_table table of scancode/keymap
*
- * This routine is used to initialize the input infrastructure to work with
- * an IR.
- * It should be called before registering the IR device.
+ * This routine is used to initialize the input infrastructure
+ * to work with an IR.
+ * It will register the input/evdev interface for the device and
+ * register the syfs code for IR class
*/
int ir_input_register(struct input_dev *input_dev,
const struct ir_scancode_table *rc_tab,
@@ -471,6 +472,12 @@ err:
}
EXPORT_SYMBOL_GPL(ir_input_register);
+/**
+ * ir_input_unregister() - unregisters IR and frees resources
+ * @input_dev: the struct input_dev descriptor of the device
+
+ * This routine is used to free memory and de-register interfaces.
+ */
void ir_input_unregister(struct input_dev *dev)
{
struct ir_input_dev *ir_dev = input_get_drvdata(dev);
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index aede78ddbac..a96738135bb 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -18,11 +18,22 @@
#define IRRCV_NUM_DEVICES 256
-unsigned long ir_core_dev_number;
+/* bit array to represent IR sysfs device number */
+static unsigned long ir_core_dev_number;
+/* class for /sys/class/irrcv */
static struct class *ir_input_class;
-
+/**
+ * show_protocol() - shows the current IR protocol
+ * @d: the device descriptor
+ * @mattr: the device attribute struct (unused)
+ * @buf: a pointer to the output buffer
+ *
+ * This routine is a callback routine for input read the IR protocol type.
+ * it is trigged by reading /sys/class/irrcv/irrcv?/current_protocol.
+ * It returns the protocol name, as understood by the driver.
+ */
static ssize_t show_protocol(struct device *d,
struct device_attribute *mattr, char *buf)
{
@@ -47,7 +58,19 @@ static ssize_t show_protocol(struct device *d,
return sprintf(buf, "%s\n", s);
}
-
+/**
+ * store_protocol() - shows the current IR protocol
+ * @d: the device descriptor
+ * @mattr: the device attribute struct (unused)
+ * @buf: a pointer to the input buffer
+ * @len: length of the input buffer
+ *
+ * This routine is a callback routine for changing the IR protocol type.
+ * it is trigged by reading /sys/class/irrcv/irrcv?/current_protocol.
+ * It changes the IR the protocol name, if the IR type is recognized
+ * by the driver.
+ * If an unknown protocol name is used, returns -EINVAL.
+ */
static ssize_t store_protocol(struct device *d,
struct device_attribute *mattr,
const char *data,
@@ -88,7 +111,9 @@ static ssize_t store_protocol(struct device *d,
return len;
}
-
+/*
+ * Static device attribute struct with the sysfs attributes for IR's
+ */
static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR,
show_protocol, store_protocol);
@@ -96,6 +121,12 @@ static struct attribute *ir_dev_attrs[] = {
&dev_attr_current_protocol.attr,
};
+/**
+ * ir_register_class() - creates the sysfs for /sys/class/irrcv/irrcv?
+ * @input_dev: the struct input_dev descriptor of the device
+ *
+ * This routine is used to register the syfs code for IR class
+ */
int ir_register_class(struct input_dev *input_dev)
{
int rc;
@@ -127,6 +158,13 @@ int ir_register_class(struct input_dev *input_dev)
return 0;
};
+/**
+ * ir_unregister_class() - removes the sysfs for sysfs for
+ * /sys/class/irrcv/irrcv?
+ * @input_dev: the struct input_dev descriptor of the device
+ *
+ * This routine is used to unregister the syfs code for IR class
+ */
void ir_unregister_class(struct input_dev *input_dev)
{
struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
@@ -142,6 +180,10 @@ void ir_unregister_class(struct input_dev *input_dev)
kfree(ir_dev->attr.name);
}
+/*
+ * Init/exit code for the module. Basically, creates/removes /sys/class/irrcv
+ */
+
static int __init ir_core_init(void)
{
ir_input_class = class_create(THIS_MODULE, "irrcv");