From fcfcc128910473bdf3411a074894ae36c808106a Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Sat, 11 Oct 2008 15:05:50 +0100 Subject: S2API: Add Multiple-frontend on a single adapter support. From: Steven Toth A detailed description from the original patches 2 years ago: "The WinTV-HVR3000 has a single transport bus which is shared between a DVB-T and DVB-S modulator. These patches build on the bus acquisition cx88 work from a few weeks ago to add support for this. So to applications the HVR3000 looks like this: /dev/dvb/adapter0/fe0 (cx24123 DVB-S demod) /dev/dvb/adapter0/fe1 (cx22702 DVB-T demod) Additional boards continue as before, eg: /dev/dvb/adapter1/fe0 (lgdt3302 ATSC demod) The basic change is removing the single instance of the videobuf_dvb in cx8802_dev and saa7134_dev(?) and replacing it with a list and some supporting functions. *NOTE* This branch was taken before v4l-dvb was closed for 2.6.19 so two or three current cx88 patches appear to be reversed by this tree, this will be cleaned up in the near future. The patches missing change the mutex handing to core->lock, fix an enumeration problem." It should be recognised that a number of people have been maintaining this patchset. Significant levels of Kudos to everyone one involved, including but not limited to: Darron Broad Fabio M. Di Nitto Carlo Scarfoglio Hans Werner Without the work of these people, and countless others, my two year old patches would of died on the Mercurial linuxtv.org vine a long time ago. TODO: Revise these patches a little further so that the need for demux1 and dvr0 is optional, not mandatory on the HVR3000. HISTORY (darron): This is the last update to MFE prepared by Hans which is based upon the `scratchpad' diff created by Carlo. All MFE work prior to that point must be attributed to Fabio who ported and maintained Steve's original patch up to that time. Priority: normal Signed-off-by: Steven Toth Signed-off-by: Darron Broad --- linux/include/media/videobuf-dvb.h | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'linux/include/media') diff --git a/linux/include/media/videobuf-dvb.h b/linux/include/media/videobuf-dvb.h index b77748696..09547ec3f 100644 --- a/linux/include/media/videobuf-dvb.h +++ b/linux/include/media/videobuf-dvb.h @@ -24,12 +24,42 @@ struct videobuf_dvb { struct dvb_net net; }; -int videobuf_dvb_register(struct videobuf_dvb *dvb, +struct videobuf_dvb_frontend { + void *dev; + struct list_head felist; + int id; + struct videobuf_dvb dvb; +}; + +struct videobuf_dvb_frontends { + struct mutex lock; + struct dvb_adapter adapter; + int active_fe_id; /* Indicates which frontend in the felist is in use */ + struct videobuf_dvb_frontend frontend; +}; + +int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, struct module *module, void *adapter_priv, struct device *device, - short *adapter_nr); -void videobuf_dvb_unregister(struct videobuf_dvb *dvb); + short *adapter_nr); //NEW + +void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); + +int videobuf_dvb_register_adapter(struct videobuf_dvb_frontends *f, + struct module *module, + void *adapter_priv, + struct device *device, + char *adapter_name, + short *adapter_nr); //NEW + +int videobuf_dvb_register_frontend(struct dvb_adapter *adapter, struct videobuf_dvb *dvb); + +struct videobuf_dvb_frontend * videobuf_dvb_alloc_frontend(void *private, struct videobuf_dvb_frontends *f, int id); + +struct videobuf_dvb_frontend * videobuf_dvb_get_frontend(struct videobuf_dvb_frontends *f, int id); +int videobuf_dvb_find_frontend(struct videobuf_dvb_frontends *f, struct dvb_frontend *p); + /* * Local variables: -- cgit v1.2.3 From 872031679e22f84f4df51a299225015f12a73f1a Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Sat, 11 Oct 2008 15:31:41 +0100 Subject: MFE: Add configurable gate control From: Darron Broad This adds a configurable (one per card) gate control option for multi-frontend. Prior to this point gate control was assumed to be on the primary frontend, this is a fault when the gate to the analogue section is on the secondary which is the default for both the HVR-3000 and HVR-4000 in MFE. Priority: normal Signed-off-by: Darron Broad --- linux/include/media/videobuf-dvb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/include/media') diff --git a/linux/include/media/videobuf-dvb.h b/linux/include/media/videobuf-dvb.h index 09547ec3f..47bc2c5e7 100644 --- a/linux/include/media/videobuf-dvb.h +++ b/linux/include/media/videobuf-dvb.h @@ -36,6 +36,7 @@ struct videobuf_dvb_frontends { struct dvb_adapter adapter; int active_fe_id; /* Indicates which frontend in the felist is in use */ struct videobuf_dvb_frontend frontend; + int gate; /* Frontend with gate control 0=!MFE,1=fe0,2=fe1 etc */ }; int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, -- cgit v1.2.3 From e792b162282b2a6897d82cb48a3ee6222bc01686 Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Sat, 11 Oct 2008 15:44:05 +0100 Subject: MFE: Add multi-frontend mutual exclusion From: Darron Broad This add frontend R/W mutual exclusion. Prior to this point in time it was possible to open both frontends simultaneously which an MFE card cannot support. In order to stop this, a delayed open is performed which has the following function: Return EBUSY after a configurable amount of time if a frontend is unavailable due to the other being in use. Only allow opening of a frontend if the kernel thread of the other has stopped. This solution was chosen to allow switching between frontends to work as seamlessly as possible. When both frontends are actually opened simultaneously then one will only open, but if quick switching is performed between one of many then the new open will succeed in a clean fashion rather than interrupting a kernel thread. Priority: normal Signed-off-by: Darron Broad --- linux/include/media/videobuf-dvb.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'linux/include/media') diff --git a/linux/include/media/videobuf-dvb.h b/linux/include/media/videobuf-dvb.h index 47bc2c5e7..1a401f732 100644 --- a/linux/include/media/videobuf-dvb.h +++ b/linux/include/media/videobuf-dvb.h @@ -43,7 +43,8 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, struct module *module, void *adapter_priv, struct device *device, - short *adapter_nr); //NEW + short *adapter_nr, + int mfe_shared); void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); @@ -52,7 +53,8 @@ int videobuf_dvb_register_adapter(struct videobuf_dvb_frontends *f, void *adapter_priv, struct device *device, char *adapter_name, - short *adapter_nr); //NEW + short *adapter_nr, + int mfe_shared); int videobuf_dvb_register_frontend(struct dvb_adapter *adapter, struct videobuf_dvb *dvb); -- cgit v1.2.3