diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-04-06 22:21:46 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:57:02 -0400 |
commit | 626cf6979e99bf2c642456308bed7bb25a37569b (patch) | |
tree | 4a5654588a37399f9240639d75064901c8737d8c /drivers/media/IR/ir-sysfs.c | |
parent | de88f31cef8fee7c890cf2128bec8dae06bb20f2 (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.c | 25 |
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) | |||
152 | static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR, | 152 | static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR, |
153 | show_protocol, store_protocol); | 153 | show_protocol, store_protocol); |
154 | 154 | ||
155 | static struct attribute *ir_dev_attrs[] = { | 155 | static 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 | ||
160 | static struct attribute_group ir_dev_attr_grp = { | 160 | static struct attribute_group ir_hw_dev_attr_grp = { |
161 | .attrs = ir_dev_attrs, | 161 | .attrs = ir_hw_dev_attrs, |
162 | }; | 162 | }; |
163 | 163 | ||
164 | static const struct attribute_group *ir_dev_attr_groups[] = { | 164 | static 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 | ||
169 | static struct device_type ir_dev_type = { | 169 | static 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 | |||
174 | static 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); |