Antti Palosaari [Thu, 5 Jul 2012 22:57:07 +0000 (19:57 -0300)]
[media] dvb_usb_v2: register device even no remote keymap defined
It failed to register device when remote keymap was not set.
Fix it to register device even keymap is NULL. In that case
just skip remote registration.
Driver should set RC_MAP_EMPTY to enable remote in case of
there is remote receiver but default keymap is unknown.
It is nice to have this debug, but as it generates very huge amount
of traffic, better to make it conditional. Use define macro to disable
it as I did not find out how to use dynamic debugs to dump variable
length buffers like that.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Tue, 19 Jun 2012 02:42:53 +0000 (23:42 -0300)]
[media] dvb_usb_v2: use identify_state() to resolve firmware name
Merge get_firmware_name() to identify_state().
It is wise to resolve firmware name in that routine as it does
decision wether or not to load firmware at all. It is one very
rarely needed callback less.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Tue, 19 Jun 2012 01:54:16 +0000 (22:54 -0300)]
[media] dvb_usb_v2: merge get_ts_config() to get_usb_stream_config()
Piggypag TS type callback to USB stream callback and change
callback name slightly to fit better.
Both of those are rather rare callback and has a relation. Transport
Stream, TS, is input stream and USB stream is output stream of
DVB USB bridge.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Sun, 17 Jun 2012 03:27:00 +0000 (00:27 -0300)]
[media] dvb_usb_v2: use lock to sync feed and frontend control
There was synchronization problem when streaming was stopped.
Frontend was ran down before stream which causes problems.
Use mutex to synchronization. Now it looks like that:
LOCK
start frontend
UNLOCK
LOCK
start streaming
[...]
stop streaming
UNLOCK
LOCK
stop frontend
UNLOCK
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Sat, 16 Jun 2012 19:02:57 +0000 (16:02 -0300)]
[media] dvb_usb_v2: change USB stream config logic
Initial / default USB stream configuration is now set always as a
dvb_usb_device_properties. Dynamic configuration is done top of
that if callback .get_usb_stream_config() exists. Default values
are set when callback is called so callback needs only change
values that are different than default.
In addition of that define two macros DVB_USB_STREAM_BULK() and
DVB_USB_STREAM_ISOC() for filling struct usb_data_stream_properties
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Give DVB adapter as a parameter for callback. MAC address is
adapter property and it could be (at least in theory) there
is devices having multiple adapters and all has own MAC.
Also add error handling. If callback fails error is returned
which leads device unregister.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Fri, 15 Jun 2012 03:29:36 +0000 (00:29 -0300)]
[media] dvb_usb_v2: try to remove all adapters on exit
It did not removed adapter on error case as .num_adapters_initialized
was set after success adapter initialization. It should be safe to
try remove all possible adapters in any-case.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Thu, 14 Jun 2012 23:07:02 +0000 (20:07 -0300)]
[media] dvb_usb_v2: do not release USB interface when device reconnects
USB core will call disconnect and remove driver for us as device
will disconnect itself. After that it is loaded again as a new
device but it is warm and no firmware loading needed.
[media] dvb_usb_v2: return the download ret in dvb_usb_download_firmware
The first being this patch, no return value from dvb_usb_download_firmware
causes system wide dead lock with COLD disconnect as system attempts to continue
to warm state.
Antti Palosaari [Thu, 14 Jun 2012 05:44:47 +0000 (02:44 -0300)]
[media] dvb_usb_v2: attach tuners later
It is more than nice to have all those frontend pointers when
attaching tuner to the frontend in question. Make that possible
attaching tuners after dvb_register_frontend()
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Wed, 13 Jun 2012 00:16:52 +0000 (21:16 -0300)]
[media] dvb_usb_v2: do not check active fe when stop streaming
Do not check active frontend as it could be already shutdown.
Add some more debugs.
It turns out that device is put sleep earlier than streaming
is stopped in some cases. That is because streaming is running
different task and there is no locking.
Maybe some locking could be good idea to force stop streaming
before device is shut down. I can guess there could be problems
in someday cases like chip is sleep but streaming control is
requested after that...
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
Antti Palosaari [Sun, 10 Jun 2012 00:22:06 +0000 (21:22 -0300)]
[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>
Antti Palosaari [Sun, 10 Jun 2012 00:11:28 +0000 (21:11 -0300)]
[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>
Antti Palosaari [Thu, 7 Jun 2012 20:34:41 +0000 (17:34 -0300)]
[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>
Antti Palosaari [Wed, 6 Jun 2012 18:01:32 +0000 (15:01 -0300)]
[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>
Antti Palosaari [Tue, 5 Jun 2012 01:18:34 +0000 (22:18 -0300)]
[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>
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>
Antti Palosaari [Sun, 3 Jun 2012 18:49:45 +0000 (15:49 -0300)]
[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>
Antti Palosaari [Tue, 29 May 2012 21:05:40 +0000 (18:05 -0300)]
[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>
Antti Palosaari [Tue, 29 May 2012 15:17:20 +0000 (12:17 -0300)]
[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>
Antti Palosaari [Tue, 29 May 2012 00:34:15 +0000 (21:34 -0300)]
[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>
Antti Palosaari [Fri, 25 May 2012 15:28:43 +0000 (12:28 -0300)]
[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>
Antti Palosaari [Fri, 25 May 2012 01:18:37 +0000 (22:18 -0300)]
[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>
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>
Antti Palosaari [Thu, 24 May 2012 23:00:28 +0000 (20:00 -0300)]
[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>
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>