Skip to contentSkip to conversation

lmedm04 2.06 conversion to dvb-usb-v2 version 2

PATCH In review Malcolm Priestley 3 participants 4 messages Aug 6, 2012 – Aug 7, 2012 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lmedm04 2.06 conversion to dvb-usb-v2 version 2

Conversion of lmedm04 to dvb-usb-v2

Functional changes m88rs2000 tuner now uses all callbacks. TODO migrate other tuners to the callbacks.

This patch is applied on top of [BUG] Re: dvb_usb_lmedm04 crash Kernel (rs2000)
http://patchwork.linuxtv.org/patch/13584/

---
 drivers/media/dvb/dvb-usb-v2/Kconfig               |   13 +
 drivers/media/dvb/dvb-usb-v2/Makefile              |    3 +
 .../media/dvb/{dvb-usb => dvb-usb-v2}/lmedm04.c    |  588 +++++++++-----------
 .../media/dvb/{dvb-usb => dvb-usb-v2}/lmedm04.h    |    0
 drivers/media/dvb/dvb-usb/Kconfig                  |   13 -
 drivers/media/dvb/dvb-usb/Makefile                 |    3 -
 6 files changed, 291 insertions(+), 329 deletions(-)
 rename drivers/media/dvb/{dvb-usb => dvb-usb-v2}/lmedm04.c (69%)
 rename drivers/media/dvb/{dvb-usb => dvb-usb-v2}/lmedm04.h (100%)
drivers/media/dvb/dvb-usb-v2/Kconfig +13 -0
index e7ff148..14a635b 100644
@@ -102,6 +102,19 @@ config DVB_USB_GL861
 	  Say Y here to support the MSI Megasky 580 (55801) DVB-T USB2.0
 	  receiver with USB ID 0db0:5581.
 
+config DVB_USB_LME2510
+	tristate "LME DM04/QQBOX DVB-S USB2.0 support"
+	depends on DVB_USB_V2
+	select DVB_TDA10086 if !DVB_FE_CUSTOMISE
+	select DVB_TDA826X if !DVB_FE_CUSTOMISE
+	select DVB_STV0288 if !DVB_FE_CUSTOMISE
+	select DVB_IX2505V if !DVB_FE_CUSTOMISE
+	select DVB_STV0299 if !DVB_FE_CUSTOMISE
+	select DVB_PLL if !DVB_FE_CUSTOMISE
+	select DVB_M88RS2000 if !DVB_FE_CUSTOMISE
+	help
+	  Say Y here to support the LME DM04/QQBOX DVB-S USB2.0
+
 config DVB_USB_MXL111SF
 	tristate "MxL111SF DTV USB2.0 support"
 	depends on DVB_USB_V2
drivers/media/dvb/dvb-usb-v2/Makefile +3 -0
index a784bf4..26659bc 100644
@@ -25,6 +25,9 @@ obj-$(CONFIG_DVB_USB_CE6230) += dvb-usb-ce6230.o
 dvb-usb-ec168-objs = ec168.o
 obj-$(CONFIG_DVB_USB_EC168) += dvb-usb-ec168.o
 
+dvb-usb-lmedm04-objs = lmedm04.o
+obj-$(CONFIG_DVB_USB_LME2510) += dvb-usb-lmedm04.o
+
 dvb-usb-gl861-objs = gl861.o
 obj-$(CONFIG_DVB_USB_GL861) += dvb-usb-gl861.o
 
drivers/media/dvb/dvb-usb-v2/lmedm04.c renamed from drivers/media/dvb/dvb-usb/lmedm04.c +275 -313

1,018 lines not on this page · raw message

drivers/media/dvb/dvb-usb-v2/lmedm04.h renamed from drivers/media/dvb/dvb-usb/lmedm04.h +0 -0
similarity index 100%
rename from drivers/media/dvb/dvb-usb/lmedm04.h
rename to drivers/media/dvb/dvb-usb-v2/lmedm04.h
drivers/media/dvb/dvb-usb/Kconfig +0 -13
index 29bba9a..8e13877 100644
@@ -304,19 +304,6 @@ config DVB_USB_AZ6027
 	help
 	  Say Y here to support the AZ6027 device
 
-config DVB_USB_LME2510
-	tristate "LME DM04/QQBOX DVB-S USB2.0 support"
-	depends on DVB_USB
-	select DVB_TDA10086 if !DVB_FE_CUSTOMISE
-	select DVB_TDA826X if !DVB_FE_CUSTOMISE
-	select DVB_STV0288 if !DVB_FE_CUSTOMISE
-	select DVB_IX2505V if !DVB_FE_CUSTOMISE
-	select DVB_STV0299 if !DVB_FE_CUSTOMISE
-	select DVB_PLL if !DVB_FE_CUSTOMISE
-	select DVB_M88RS2000 if !DVB_FE_CUSTOMISE
-	help
-	  Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 .
-
 config DVB_USB_TECHNISAT_USB2
 	tristate "Technisat DVB-S/S2 USB2.0 support"
 	depends on DVB_USB
drivers/media/dvb/dvb-usb/Makefile +0 -3
index 5261c7d..859baf9 100644
@@ -72,9 +72,6 @@ obj-$(CONFIG_DVB_USB_FRIIO) += dvb-usb-friio.o
 dvb-usb-az6027-objs = az6027.o
 obj-$(CONFIG_DVB_USB_AZ6027) += dvb-usb-az6027.o
 
-dvb-usb-lmedm04-objs = lmedm04.o
-obj-$(CONFIG_DVB_USB_LME2510) += dvb-usb-lmedm04.o
-
 dvb-usb-technisat-usb2-objs = technisat-usb2.o
 obj-$(CONFIG_DVB_USB_TECHNISAT_USB2) += dvb-usb-technisat-usb2.o
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 10 lines · Malcolm Priestley

Conversion of lmedm04 to dvb-usb-v2

Functional changes m88rs2000 tuner now uses all callbacks. TODO migrate other tuners to the callbacks.

This patch is applied on top of [BUG] Re: dvb_usb_lmedm04 crash Kernel (rs2000)
http://patchwork.linuxtv.org/patch/13584/

Could you try to make this driver more generic?

You use some internals of dvb-usb directly and most likely those are without a reason. For example data streaming, lme2510_kill_urb() kills directly urbs allocated and submitted by dvb-usb. Guess that driver is broken just after someone changes dvb-usb streaming code.

lme2510_usb_talk() could be replaced by generic dvb_usbv2_generic_rw().

What is function of lme2510_int_read() ? I see you use own low level URB routines for here too. It starts "polling", reads remote, tuner, demod, etc, and updates state. You would better to implement I2C-adapter correctly and then start Kernel work-queue, which reads same information using I2C-adapter. Or you could even abuse remote controller polling function provided by dvb-usb.

lme2510_get_stream_config() enables pid-filter again over the dvb-usb, but I can live with it because there is no dynamic configuration for that. Anyhow, is that really needed?

I can live with the pid-filter "abuse", but killing stream URBs on behalf of DVB-USB is something I don't like to see. If you have very good explanation and I cannot fix DVB USB to meet it I could consider that kind of hack. And it should be documented clearly adding necessary comments to code.

Re-implementing that driver to use 100% DVB-USB services will reduce around 50% of code or more.

regards
Antti

Signature · 1 line
http://palosaari.fi/
#2 lore raw

Em 07-08-2012 13:28, Antti Palosaari escreveu:

Quoted 10 lines · Malcolm Priestley
Quoted 9 lines

Conversion of lmedm04 to dvb-usb-v2

Functional changes m88rs2000 tuner now uses all callbacks. TODO migrate other tuners to the callbacks.

This patch is applied on top of [BUG] Re: dvb_usb_lmedm04 crash Kernel (rs2000)
http://patchwork.linuxtv.org/patch/13584/

Quoted 8 lines
Quoted 1 line

Could you try to make this driver more generic?

You use some internals of dvb-usb directly and most likely those are without a reason. For example data streaming, lme2510_kill_urb() kills directly urbs allocated and submitted by dvb-usb. Guess that driver is broken just after someone changes
dvb-usb streaming code.

Yeah, it is better to replace it by the dvb-usb-v2 solution (usb_clear_halt), as some special treatment there might be needed due to suspend/resume.

Quoted 6 lines

lme2510_usb_talk() could be replaced by generic dvb_usbv2_generic_rw().

What is function of lme2510_int_read() ? I see you use own low level URB routines for here too. It starts "polling", reads remote, tuner, demod, etc, and updates state. You would better to implement I2C-adapter correctly and then start Kernel work-queue, which reads same information using I2C-adapter. Or you could even abuse remote controller polling function provided by dvb-usb.

While I don't know any technical details about this device, this looks similar to what dib0700_core does.

Instead of polling IR, with is expensive, it sets an special endpoint to receive IR data, and sends an URB request. That URB request will be pending until someone kicks the IR. If nothing is pressed, no URB is received. This is a way better than polling, as no traffic happens while a key is not pressed.

Quoted 1 line

From what I saw at the driver, the mpeg stream is at endpoint 0x08, and

it uses bulk transfer; for IR data, it uses endpoint 0x0a, and interrupt URB.

So, this extra control is needed. It may make sense to move part of this code to the dvb-usb-v2 core (the part that starts/stops the URB handling), in order to properly handle device suspend/resume, as, depending on the suspend level, you might need to stop it, restarting at resume.

The payload handling should be driver-specific, of course.

So, in summary, that seems to be OK, for the current dvb-usb-v2 core, requiring further changes for suspend/resume to work properly.

Quoted 6 lines

lme2510_get_stream_config() enables pid-filter again over the dvb-usb, but I can live with it because there is no dynamic configuration for that. Anyhow, is that really needed?

I can live with the pid-filter "abuse", but killing stream URBs on behalf of DVB-USB is something I don't like to see. If you have very good explanation and I cannot fix DVB USB to meet it I could consider that kind of hack. And it should be documented clearly adding necessary comments to code.

Re-implementing that driver to use 100% DVB-USB services will reduce around 50% of code or more.

The thing that bother me at the code is the implementation of a device-specific set_voltage() callback. This should be part of dvb-usb-v2 core, and, during suspend, it makes sense to set voltage to OFF, returning it to its original state during resume.

Regards,
Mauro

Acked-by Tested-by
#3 lore raw
Quoted 60 lines · Mauro Carvalho Chehab

Em 07-08-2012 13:28, Antti Palosaari escreveu:

Quoted 10 lines · Malcolm Priestley
Quoted 9 lines

Conversion of lmedm04 to dvb-usb-v2

Functional changes m88rs2000 tuner now uses all callbacks. TODO migrate other tuners to the callbacks.

This patch is applied on top of [BUG] Re: dvb_usb_lmedm04 crash Kernel (rs2000)
http://patchwork.linuxtv.org/patch/13584/

Quoted 8 lines
Quoted 1 line

Could you try to make this driver more generic?

You use some internals of dvb-usb directly and most likely those are without a reason. For example data streaming, lme2510_kill_urb() kills directly urbs allocated and submitted by dvb-usb. Guess that driver is broken just after someone changes
dvb-usb streaming code.

Yeah, it is better to replace it by the dvb-usb-v2 solution (usb_clear_halt), as some special treatment there might be needed due to suspend/resume.

Quoted 6 lines

lme2510_usb_talk() could be replaced by generic dvb_usbv2_generic_rw().

What is function of lme2510_int_read() ? I see you use own low level URB routines for here too. It starts "polling", reads remote, tuner, demod, etc, and updates state. You would better to implement I2C-adapter correctly and then start Kernel work-queue, which reads same information using I2C-adapter. Or you could even abuse remote controller polling function provided by dvb-usb.

While I don't know any technical details about this device, this looks similar to what dib0700_core does.

Instead of polling IR, with is expensive, it sets an special endpoint to receive IR data, and sends an URB request. That URB request will be pending until someone kicks the IR. If nothing is pressed, no URB is received. This is a way better than polling, as no traffic happens while a key is not pressed.

Quoted 1 line

From what I saw at the driver, the mpeg stream is at endpoint 0x08, and

it uses bulk transfer; for IR data, it uses endpoint 0x0a, and interrupt URB.

So, this extra control is needed. It may make sense to move part of this code to the dvb-usb-v2 core (the part that starts/stops the URB handling), in order to properly handle device suspend/resume, as, depending on the suspend level, you might need to stop it, restarting at resume.

The payload handling should be driver-specific, of course.

So, in summary, that seems to be OK, for the current dvb-usb-v2 core, requiring further changes for suspend/resume to work properly.

Quoted 6 lines

lme2510_get_stream_config() enables pid-filter again over the dvb-usb, but I can live with it because there is no dynamic configuration for that. Anyhow, is that really needed?

I can live with the pid-filter "abuse", but killing stream URBs on behalf of DVB-USB is something I don't like to see. If you have very good explanation and I cannot fix DVB USB to meet it I could consider that kind of hack. And it should be documented clearly adding necessary comments to code.

Re-implementing that driver to use 100% DVB-USB services will reduce around 50% of code or more.

Quoted 7 lines

The thing that bother me at the code is the implementation of a device-specific set_voltage() callback. This should be part of dvb-usb-v2 core, and, during suspend, it makes sense to set voltage to OFF, returning it to its original state during resume.

Regards,
Mauro

I think it is better to merge that now as is and try to improve those later. It does support suspend/resume currently (as callbacks are not defined at all). Also I have some upcoming patches for suspend/resume power-management. Due to that suspend/resume is not even worth to implement that driver until those are merged. Tested using LME2510C + M88RS2000 device.

regards
Antti

Signature · 1 line
http://palosaari.fi/