aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/IR/ir-sysfs.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-04-06 22:21:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:57:02 -0400
commit626cf6979e99bf2c642456308bed7bb25a37569b (patch)
tree4a5654588a37399f9240639d75064901c8737d8c /drivers/media/IR/ir-sysfs.c
parentde88f31cef8fee7c890cf2128bec8dae06bb20f2 (diff)
V4L/DVB: ir-core: Distinguish sysfs attributes for in-hardware and raw decoders
Some devices have in-hardware Remote Controller decoder, while others need a software decoder to get the IR code. As each software decoder can be enabled/disabled individually, allowing multiple protocol decoding capability. On the other hand, hardware decoders have a limited protocol support, often being able of decoding just one protocol each time. So, each type needs a different set of capabilities to control the supported protocol(s). Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR/ir-sysfs.c')
-rw-r--r--drivers/media/IR/ir-sysfs.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index c33333f1f60e..81eebd8eae5a 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -152,22 +152,26 @@ static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env)
152static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR, 152static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR,
153 show_protocol, store_protocol); 153 show_protocol, store_protocol);
154 154
155static struct attribute *ir_dev_attrs[] = { 155static struct attribute *ir_hw_dev_attrs[] = {
156 &dev_attr_current_protocol.attr, 156 &dev_attr_current_protocol.attr,
157 NULL, 157 NULL,
158}; 158};
159 159
160static struct attribute_group ir_dev_attr_grp = { 160static struct attribute_group ir_hw_dev_attr_grp = {
161 .attrs = ir_dev_attrs, 161 .attrs = ir_hw_dev_attrs,
162}; 162};
163 163
164static const struct attribute_group *ir_dev_attr_groups[] = { 164static const struct attribute_group *ir_hw_dev_attr_groups[] = {
165 &ir_dev_attr_grp, 165 &ir_hw_dev_attr_grp,
166 NULL 166 NULL
167}; 167};
168 168
169static struct device_type ir_dev_type = { 169static struct device_type rc_dev_type = {
170 .groups = ir_dev_attr_groups, 170 .groups = ir_hw_dev_attr_groups,
171 .uevent = ir_dev_uevent,
172};
173
174static struct device_type ir_raw_dev_type = {
171 .uevent = ir_dev_uevent, 175 .uevent = ir_dev_uevent,
172}; 176};
173 177
@@ -181,7 +185,6 @@ int ir_register_class(struct input_dev *input_dev)
181{ 185{
182 int rc; 186 int rc;
183 const char *path; 187 const char *path;
184
185 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); 188 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
186 int devno = find_first_zero_bit(&ir_core_dev_number, 189 int devno = find_first_zero_bit(&ir_core_dev_number,
187 IRRCV_NUM_DEVICES); 190 IRRCV_NUM_DEVICES);
@@ -189,7 +192,11 @@ int ir_register_class(struct input_dev *input_dev)
189 if (unlikely(devno < 0)) 192 if (unlikely(devno < 0))
190 return devno; 193 return devno;
191 194
192 ir_dev->dev.type = &ir_dev_type; 195 if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE)
196 ir_dev->dev.type = &rc_dev_type;
197 else
198 ir_dev->dev.type = &ir_raw_dev_type;
199
193 ir_dev->dev.class = &ir_input_class; 200 ir_dev->dev.class = &ir_input_class;
194 ir_dev->dev.parent = input_dev->dev.parent; 201 ir_dev->dev.parent = input_dev->dev.parent;
195 dev_set_name(&ir_dev->dev, "rc%d", devno); 202 dev_set_name(&ir_dev->dev, "rc%d", devno);