Commit Graph
17 Commits
Author SHA1 Message Date
Himangi Saraogi 5611588b86 [media] rc-core: use USB API functions rather than constants
This patch introduces the use of !usb_endpoint_dir_in(epd) and
!usb_endpoint_xfer_int(epd).

The Coccinelle semantic patch that makes these changes is as follows:

- ((epd->bEndpointAddress & \(USB_ENDPOINT_DIR_MASK\|0x80\)) !=
-  \(USB_DIR_IN\|0x80\))
+ !usb_endpoint_dir_in(epd)

@@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\)) !=
- \(USB_ENDPOINT_XFER_INT\|3\))
+ !usb_endpoint_xfer_int(epd)

Signed-off-by: Himangi Saraogi <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-09-22 17:27:01 -03:00
David Härdeman e87b540be2 [media] rc-core: merge rc5 and streamzap decoders
Now that the protocol is part of the scancode, it is pretty easy to merge
the rc5 and streamzap decoders. An additional advantage is that the decoder
is now stricter as it waits for the trailing silence before determining that
a command is a valid rc5/streamzap command (which avoids collisions that I've
seen with e.g. Sony protocols).

Signed-off-by: David Härdeman <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-07-25 19:10:44 -03:00
David Härdeman c5540fbb9d [media] rc-core: remove protocol arrays
The basic API of rc-core used to be:

	dev = rc_allocate_device();
	dev->x = a;
	dev->y = b;
	dev->z = c;
	rc_register_device();

which is a pretty common pattern in the kernel, after the introduction of
protocol arrays the API looks something like:

	dev = rc_allocate_device();
	dev->x = a;
	rc_set_allowed_protocols(dev, RC_BIT_X);
	dev->z = c;
	rc_register_device();

There's no real need for the protocols to be an array, so change it
back to be consistent (and in preparation for the following patches).

[[email protected]: added missing changes at some files]
Signed-off-by: David Härdeman <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-07-25 19:10:43 -03:00
Greg Kroah-Hartman 834b4d5136 USB: media: streamzap: remove CONFIG_USB_DEBUG
It wasn't even being used for anything, so remove the test for the
config option (as the config option isn't present anymore), and remove
the unused module parameter "debug" so as to not confuse anyone.

Cc: Mauro Carvalho Chehab <[email protected]>
Cc: James Hogan <[email protected]>
Cc: "Antti Seppälä" <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-29 11:22:47 -07:00
James Hogan 1a1934fab0 [media] rc: abstract access to allowed/enabled protocols
The allowed and enabled protocol masks need to be expanded to be per
filter type in order to support wakeup filter protocol selection. To
ease that process abstract access to the rc_dev::allowed_protos and
rc_dev::enabled_protocols members with inline functions.

Signed-off-by: James Hogan <[email protected]>
Reviewed-by: Antti Seppälä <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-03-11 13:24:39 -03:00
Greg Kroah-Hartman 4c62e9764a Drivers: media: remove __dev* attributes.
CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-01-03 15:57:02 -08:00
David Härdeman c003ab1bed [media] rc-core: add separate defines for protocol bitmaps and numbers
The RC_TYPE_* defines are currently used both where a single protocol is
expected and where a bitmap of protocols is expected.

Functions like rc_keydown() and functions which add/remove entries to the
keytable want a single protocol. Future userspace APIs would also
benefit from numeric protocols (rather than bitmap ones). Keytables are
smaller if they can use a small(ish) integer rather than a bitmap.

Other functions or struct members (e.g. allowed_protos,
enabled_protocols, etc) accept multiple protocols and need a bitmap.

Using different types reduces the risk of programmer error. Using a
protocol enum whereever possible also makes for a more future-proof
user-space API as we don't need to worry about a sufficient number of
bits being available (e.g. in structs used for ioctl() calls).

The use of both a number and a corresponding bit is dalso one in e.g.
the input subsystem as well (see all the references to set/clear bit when
changing keytables for example).

This patch separate the different usages in preparation for
upcoming patches.

Where a single protocol is expected, enum rc_type is used; where one or more
protocol(s) are expected, something like u64 is used.

The patch has been rewritten so that the format of the sysfs "protocols"
file is no longer altered (at the loss of some detail). The file itself
should probably be deprecated in the future though.

Signed-off-by: David Härdeman <[email protected]>
Cc: Andy Walls <[email protected]>
Cc: Maxim Levitsky <[email protected]>
Cc: Antti Palosaari <[email protected]>
Cc: Mike Isely <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2012-10-27 11:49:51 -02:00
Rusty Russell 90ab5ee941 module_param: make bool parameters really bool (drivers & misc)
module_param(bool) used to counter-intuitively take an int.  In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option.  For this version
it'll simply give a warning, but it'll break next kernel version.

Acked-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
2012-01-13 09:32:20 +10:30
Greg Kroah-Hartman ecb3b2b35d USB: convert drivers/media/* to use module_usb_driver()
This converts the drivers in drivers/media/* to use the
module_usb_driver() macro which makes the code smaller and a bit
simpler.

Added bonus is that it removes some unneeded kernel log messages about
drivers loading and/or unloading.

Cc: Mauro Carvalho Chehab <[email protected]>
Cc: Luca Risolia <[email protected]>
Cc: Jean-Francois Moine <[email protected]>
Cc: Frank Zago <[email protected]>
Cc: Olivier Lorin <[email protected]>
Cc: Erik Andren <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Brian Johnson <[email protected]>
Cc: Leandro Costantino <[email protected]>
Cc: Antoine Jacquet <[email protected]>
Cc: Jarod Wilson <[email protected]>
Cc: Florian Mickler <[email protected]>
Cc: Antti Palosaari <[email protected]>
Cc: Michael Krufky <[email protected]>
Cc: "David Härdeman" <[email protected]>
Cc: Florent Audebert <[email protected]>
Cc: Sam Doshi <[email protected]>
Cc: Manu Abraham <[email protected]>
Cc: Olivier Grenie <[email protected]>
Cc: Patrick Boettcher <[email protected]>
Cc: "Igor M. Liplianin" <[email protected]>
Cc: Derek Kelly <[email protected]>
Cc: Malcolm Priestley <[email protected]>
Cc: Steven Toth <[email protected]>
Cc: "André Weidemann" <[email protected]>
Cc: Martin Wilks <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Jose Alberto Reguero <[email protected]>
Cc: David Henningsson <[email protected]>
Cc: Paul Gortmaker <[email protected]>
Cc: Joe Perches <[email protected]>
Cc: Jesper Juhl <[email protected]>
Cc: Lucas De Marchi <[email protected]>
Cc: Hans Verkuil <[email protected]>
Cc: Alexey Khoroshilov <[email protected]>
Cc: Anssi Hannula <[email protected]>
Cc: Rafi Rubin <[email protected]>
Cc: Dan Carpenter <[email protected]>
Cc: Paul Bender <[email protected]>
Cc: Devin Heitmueller <[email protected]>
Cc: "Márcio A Alves" <[email protected]>
Cc: Julia Lawall <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Chris Rankin <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Andy Walls <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Mike Frysinger <[email protected]>
Cc: Dean Anderson <[email protected]>
Cc: Pete Eberlein <[email protected]>
Cc: Arvydas Sidorenko <[email protected]>
Cc: Andrea Anacleto <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2011-11-18 09:46:12 -08:00
Jarod Wilson 56b0ec30c4 [media] rc/streamzap: fix reporting response times
The streamzap driver has relatively low sampling resolution, and any
delays in reporting events seem to cause some minor problems for the
likes of irw when using the lirc bridge driver, resulting in a single
keypress registering as multiple independent ones, rather than as a
single press with repeats. If we call ir_raw_event_handle() more
frequently and reset the rawir kfifo at end-of-signal, the behavior
improves quite a bit.

Signed-off-by: Jarod Wilson <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2011-01-31 12:22:13 -02:00
Jarod Wilson b4608faee0 [media] rc: use time unit conversion macros correctly
Due to my own stupidity, some of the wrong time unit conversion macros
were being used inside some of the IR drivers I've been working on. Fix
that, and convert over some additional places to also use the macros.

Signed-off-by: Jarod Wilson <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2011-01-31 12:20:11 -02:00
Mauro Carvalho Chehab 0170f6bcb2 [media] streamzap: Fix a compilation warning when compiled builtin
drivers/media/rc/streamzap.c: In function ‘streamzap_probe’:
drivers/media/rc/streamzap.c:460:2: warning: statement with no effect

Cc: Jarod Wilson <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2010-12-29 08:17:14 -02:00
Paul Bender 5ad1a55542 [media] rc: fix sysfs entry for mceusb and streamzap
When trying to create persistent device names for mceusb and streamzap
devices, I noticed that their respective drivers are not creating the rc
device as a child of the USB device. Rather it creates it as virtual
device. As a result, udev cannot use the USB device information to
create persistent device names for event and lirc devices associated
with the rc device. Not having persistent device names makes it more

difficult to make use of the devices in userspace as their names can
change.

Forward-ported to media_tree staging/for_v2.6.38 and tested with
both streamzap and mceusb devices:
$ ll /dev/input/by-id/
...
lrwxrwxrwx. 1 root root 9 Nov 17 17:06 usb-Streamzap__Inc._Streamzap_Remote_Control-event-if00 -> ../event6
lrwxrwxrwx. 1 root root 9 Nov 17 17:05 usb-Topseed_Technology_Corp._eHome_Infrared_Transceiver_TS000BzY-event-if00 -> ../event5
Previously, nada.

Signed-off-by: Paul Bender <[email protected]>
Tested-by: Jarod Wilson <[email protected]>
Signed-off-by: Jarod Wilson <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2010-12-29 08:16:57 -02:00
Mauro Carvalho Chehab 52b661449a [media] rc: Rename remote controller type to rc_type instead of ir_type
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,IR_TYPE,RC_TYPE,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_type,rc_type,g <$i >a && mv a $i; done

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2010-12-29 08:16:50 -02:00
Mauro Carvalho Chehab 6bda96447c [media] rc: rename the remaining things to rc_core
The Remote Controller subsystem is meant to be used not only by Infra Red
but also for similar types of Remote Controllers. The core is not specific
to Infra Red. As such, rename:
	- ir-core.h to rc-core.h
	- IR_CORE to RC_CORE
	- namespace inside rc-core.c/rc-core.h

To be consistent with the other changes.

No functional change on this patch.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2010-12-29 08:16:50 -02:00
David Härdeman d8b4b5822f [media] ir-core: make struct rc_dev the primary interface
This patch merges the ir_input_dev and ir_dev_props structs into a single
struct called rc_dev. The drivers and various functions in rc-core used
by the drivers are also changed to use rc_dev as the primary interface
when dealing with rc-core.

This means that the input_dev is abstracted away from the drivers which
is necessary if we ever want to support multiple input devs per rc device.

The new API is similar to what the input subsystem uses, i.e:
rc_device_alloc()
rc_device_free()
rc_device_register()
rc_device_unregister()

[[email protected]: Fix compilation on mceusb and cx231xx, due to merge conflicts]
Signed-off-by: David Härdeman <[email protected]>
Acked-by: Jarod Wilson <[email protected]>
Tested-by: Jarod Wilson <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2010-12-29 08:16:37 -02:00
Mauro Carvalho Chehab 32cf86f6d1 [media] rename drivers/media/IR to drives/media/rc
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2010-12-29 08:16:36 -02:00