Commit Graph

321361 Commits

Author SHA1 Message Date
Antti Palosaari
f093c388ef [media] dvb_usb_v2: use pointers to properties
Use pointers to properties as device and adapter properties are
constant. No need to embed and copy those structures.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:30 -03:00
Antti Palosaari
53dc194f0c [media] af9015: suspend/resume
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:30 -03:00
Antti Palosaari
acaec14f3e [media] dvb_usb_v2: use keyword const for USB ID table
Let optimize that code to the text segment.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:30 -03:00
Antti Palosaari
2d2b37c75a [media] dvb_usb_v2: move few callbacks one level up
Move frontend_attach, tuner_attach, frontend_ctrl and streaming_ctrl
from adapter to device.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:30 -03:00
Antti Palosaari
b00a901801 [media] dvb_usb_v2: Cypress firmware download module
Firmware handling routines for various Cypress chips.
Cypress AN2135
Cypress AN2235
Cypress FX2

These were split out from general DVB USB module by
Patrick Boettcher. I did only small changes.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:30 -03:00
Antti Palosaari
ef81e9ebbe [media] dvb_usb_v2: suspend/resume stop/start USB streaming
Stop remote polling and USB streaming before suspend and resume
those when back to normal operation.

It is far away from complete implementation, but at least it does
not hang system anymore on suspend while streaming is ongoing.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:29 -03:00
Antti Palosaari
5b6a63cc2f [media] dvb_usb_v2: add .disconnect() callback
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:29 -03:00
Antti Palosaari
823eebac89 [media] dvb_usb_v2: probe/disconnect error handling
In my understanding we never call .disconnect() when .probe()
returns error. Change .probe() to return error all cases it cannot
handle given interface and simplify .disconnect() handling.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:29 -03:00
Antti Palosaari
d496eb8ae4 [media] dvb_usb_v2: misc cleanup changes
Error handling, remove unneeded stuff, renaming, etc.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:29 -03:00
Antti Palosaari
0fba999f13 [media] dvb_usb_v2: I2C adapter cleanup changes
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:28 -03:00
Antti Palosaari
77f54517fd [media] af9015: use USB core soft_unbind
I think it is better to allow driver finish pending operations and
disconnect device. Killing all ongoing USB transfers could have very
bad effect, even break hardware in worst case.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:28 -03:00
Antti Palosaari
a3645e5430 [media] af9015: switch to new DVB-USB
Almost all hacks are now removed and much less code.
Reducing af9015 driver code from 2084 to 1609, it is almost
500 LOC less!

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:28 -03:00
Antti Palosaari
597843435c [media] dvb_usb_v2: enable compile
Compilation was disabled as it was failing with allyesconfig.
Rename duplicate functions and enable building.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:28 -03:00
Antti Palosaari
3238aafbc3 [media] dvb_usb_v2: do not free resources until delayed init is done
It was possible to free resources by unloading module while
initialization was still ongoing on delayed work.

Use PID to make decision on .disconnect() if caller is our
work or some other as work also calls .disconnect() in error
case. There could be better solution still...

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:28 -03:00
Antti Palosaari
36a5c2bded [media] dvb_usb_v2: fix dvb_usb_generic_rw() debug
Debug prints write operation data instead of read data was
intention.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:28 -03:00
Antti Palosaari
65de8f978f [media] dvb_usb_v2: add missing new line for log writings
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:27 -03:00
Antti Palosaari
3676403764 [media] dvb_usb_v2: add .bInterfaceNumber match
There is no USB match flag for used USB interface. It is rather
common there is multiple interfaces offering different services.
For example one for television and one for remote controller.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:27 -03:00
Antti Palosaari
6b8c8c4089 [media] dvb_usb_v2: rename device_init/device_exit to probe/disconnect
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:27 -03:00
Antti Palosaari
a177c72bf5 [media] dvb_usb_v2: move I2C adapter code to different file
No worth to keep it on own file as it is only 30 LOC.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:27 -03:00
Antti Palosaari
23d8e63a90 [media] dvb_usb_v2: use Kernel logging (pr_debug/pr_err/pr_info)
Use Kernel logging insteads of own macros.
Get rid of old debugs and use dynamic debug.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:27 -03:00
Antti Palosaari
cce99cf933 [media] dvb_usb_v2: unregister all frontends in error case
Unregister all if there is any error meet during
frontend initialization.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:27 -03:00
Antti Palosaari
96ffea88cd [media] dvb_usb_v2: remove usb_clear_halt()
Calling usb_clear_halt() during device init is not correct.
2 of 7 AF9015 devices I have timeouts next USB control message
after usb_clear_halt(). It was originally performed between
tuner_attach() and rc_query() and likely not causing problems
since rc_query() is repeated continously. None could see it when
first rc_query() failed...

Secondly it was not called for .generic_bulk_ctrl_endpoint_response.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:26 -03:00
Antti Palosaari
4f208d4e2d [media] dvb_usb_v2: refactor delayed init
Move work to the struct dvb_usb_device that we can access
it inside .disconnect().

Also many other minor changes.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:26 -03:00
Antti Palosaari
0a8673569f [media] dvb_usb_v2: ensure driver_info is not null
It could be null in case of driver does not set it
properly, like missing dynamic ID handling.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:26 -03:00
Antti Palosaari
e48b2a6861 [media] dvb_usb_v2: frontend switching changes
Some error checking changes and refactoring.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:26 -03:00
Antti Palosaari
e80e9af308 [media] dvb_usb_v2: remove various unneeded variables
Adapter priv is not really needed, use device priv instead.
There is only driver or two using that.

Device caps are not needed. There was only "has I2C adapter"
capability defined. It is useless as we can see same just
checking existence of i2c_algo callback.

And also remove some totally not used at all variables.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:26 -03:00
Antti Palosaari
19ec2728d7 [media] dvb_usb_v2: use dynamic debugs
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:26 -03:00
Antti Palosaari
0359b5fa9e [media] dvb_usb_v2: add macro for filling usb_device_id table entry
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:25 -03:00
Antti Palosaari
a0d72d246d [media] dvb_usb_v2: clean firmware downloading routines
Remove Cypress USB-interface firmware downloading routines.
That is common module and having single vendor chip routines
in common module is wrong. Just move those elsewhere.

Move single function out from the dvb_usb_firmware.c and
remove that file.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:25 -03:00
Antti Palosaari
21f5a32e1f [media] dvb_usb_v2: delay firmware download as it blocks module init
Delay firmware download and whole driver initialization using
workqueue. udev causes problems when blocking firmware download
was done during module init. This will likely resolve all
DVB USB firmware downloading issues we have had during recent years.

Fixes bug in case of DVB USB driver:
https://bugzilla.redhat.com/show_bug.cgi?id=827538

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:25 -03:00
Antti Palosaari
1c9c73b7db [media] dvb_usb_v2: remove .num_frontends
It is no longer needed because all frontends are attached as a one go.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:25 -03:00
Antti Palosaari
20bb9cc483 [media] dvb_usb_v2: get rid of (struct dvb_usb_adapter_fe_properties)
Get rid of (struct dvb_usb_adapter_fe_properties) as we no longer
need it. Frontends are now defined as a array of pointers inside
adapter struct.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:24 -03:00
Antti Palosaari
fec88df01d [media] dvb_usb_v2: move 3 callbacks from the frontend to adapter
Move .frontend_attach(), .tuner_attach() and .streaming_ctrl()
from the frontend to adapter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:24 -03:00
Antti Palosaari
e46c5b66da [media] dvb_usb_v2: move PID filters from frontend to adapter
Filtering given PIDs from the transport stream is done by the
DVB USB bridge. It is highly possible there is limitations what
kind of stream DVB USB bridge can PID filter, but it still does
not make sense to define filters for each frontend as frontend
could offer different stream types for different standards.

Likely new way is to enable / disable PID filters are needed to
make decision at runtime (callback). PID filters are quite legacy
stuff as those are aimed cut stream smaller to fit for the USB1.1...

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:24 -03:00
Antti Palosaari
3024985d15 [media] dvb_usb_v2: move (struct usb_data_stream_properties) to upper level
Move USB stream properties from frontend to adapter.
It is property of adapter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:24 -03:00
Antti Palosaari
b6ecf8bb4e [media] dvb_usb_v2: add .get_ts_config() callback
Add new callback in order to resolve used TS (MPEG transport stream)
configuration. Normal TS is 188 byte payload only but there is
currently 204 byte TS and raw TS supported too.

Traditionally TS type was mapped as a frontend property but it
does not work no longer after we changed from MFE (multi-frontend)
to SFE (single-frontend). So it is not possible to map TS for the
given FE as there could be only one FE instead of multiple.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:23 -03:00
Antti Palosaari
3256cdef6e [media] dvb_usb_v2: move (struct usb_data_stream) to one level up
Move stream from the frontend to adapter. There could be only
one stream per adapter. One adapter can has multiple frontends
but only one can stream at the time.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:23 -03:00
Antti Palosaari
39831f094f [media] dvb_usb_v2: add .get_usb_stream_config()
New callback to resolve current USB stream configuration.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:23 -03:00
Antti Palosaari
15072bba79 [media] dvb_usb_v2: usb_urb.c use dynamic debugs
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:23 -03:00
Antti Palosaari
bce1c02902 [media] dvb_usb_v2: dynamic USB stream URB configuration
Change URB count, buffer size and type [BULK/ISOC]
dynamically when needed if existing URB buffers are
big enough.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:22 -03:00
Antti Palosaari
0575289041 [media] dvb_usb_v2: remote controller changes
Add .get_rc_config() callback and remove old static configs.
Refactor remote controller routines.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:22 -03:00
Antti Palosaari
19b308c035 [media] dvb_usb_v2: init I2C and USB mutex earlier
Those must be initialized earlier as we now pass
(struct dvb_usb_device *) to the firmware download
callbacks too.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:22 -03:00
Antti Palosaari
005bc3fce7 [media] dvb_usb_v2: restore .firmware - pointer to name
Most commonly only one firmware is used by the driver
and it is not needed to selected run time. So restore
old functionality but allow .get_firmware_name() callback
to override it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:22 -03:00
Antti Palosaari
649216704a [media] dvb_usb_v2: remote controller
* remove old legacy code totally
* move default RC keymap definition the the (struct dvb_usb_driver_info)

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:22 -03:00
Antti Palosaari
43402bbde5 [media] dvb_usb_v2: implement .read_config()
That callback is called	only once when device is connected.
Call is done after the possible firmware is downloaded to the device,
just after the .power_ctrl() and before adapters are created.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:22 -03:00
Antti Palosaari
5b85300413 [media] dvb_usb_v2: implement .get_adapter_count()
Callback to resolve adapter count of current device.
Old static .num_adapters field can be still used but
the new .get_adapter_count() has priority if both
offered by the driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:21 -03:00
Antti Palosaari
7dfd1242aa [media] dvb_usb_v2: pass device name too using (struct usb_device_id)
Pass all the needed data to the DVB USB core using
(struct usb_device_id) .driver_info. That simplifies
old code a lot and saves memory	as all device IDs and
names are not defined inside (struct dvb_usb_device_properties)
as earlier.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:21 -03:00
Antti Palosaari
4e60d951ea [media] dvb_usb_v2: fix issues raised by checkpatch.pl
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:21 -03:00
Antti Palosaari
8b9dff5828 [media] dvb_usb_v2: implement .get_firmware_name()
Use callback to return firmware name instead of static firmware name.
There is some chips that needs to select firmware name according to
chip revision.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:21 -03:00
Antti Palosaari
496e827899 [media] dvb_usb_v2: pass (struct dvb_usb_device *) as a parameter for fw download
Change parameter (struct usb_device *) => (struct dvb_usb_device *)
for .identify_state() and .download_firmware() callbacks.

struct usb_device * did not provide handle for the DVB USB driver state.
Change DVB USB framework to alloc space	for the	priv earlier and pass
that pointer to the device driver using (struct dvb_usb_device *)
as a callback parameter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-04 07:56:20 -03:00