Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330580
b: refs/heads/master
c: e46c5b6
h: refs/heads/master
v: v3
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Aug 4, 2012
1 parent b95b2e8 commit ffdb9cc
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 79 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3024985d15bdf5e8a55468a35c86ed9fa8c3eec5
refs/heads/master: e46c5b66da84d8eccf4566216f0582964a28b73e
33 changes: 15 additions & 18 deletions trunk/drivers/media/dvb/dvb-usb/dvb_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,7 @@ struct usb_data_stream_properties {
* @stream: configuration of the USB streaming
*/
struct dvb_usb_adapter_fe_properties {
#define DVB_USB_ADAP_HAS_PID_FILTER 0x01
#define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02
#define DVB_USB_ADAP_NEED_PID_FILTERING 0x04
#define DVB_USB_ADAP_RECEIVES_204_BYTE_TS 0x08
#define DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD 0x10
int caps;
int pid_filter_count;

int (*streaming_ctrl) (struct dvb_usb_adapter *, int);
int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int);
int (*pid_filter) (struct dvb_usb_adapter *, int, u16, int);

int (*frontend_attach) (struct dvb_usb_adapter *);
int (*tuner_attach) (struct dvb_usb_adapter *);
Expand All @@ -134,8 +124,18 @@ struct dvb_usb_adapter_fe_properties {

#define MAX_NO_OF_FE_PER_ADAP 3
struct dvb_usb_adapter_properties {
#define DVB_USB_ADAP_HAS_PID_FILTER 0x01
#define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02
#define DVB_USB_ADAP_NEED_PID_FILTERING 0x04
#define DVB_USB_ADAP_RECEIVES_204_BYTE_TS 0x08
#define DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD 0x10
int caps;
int size_of_priv;

int pid_filter_count;
int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int);
int (*pid_filter) (struct dvb_usb_adapter *, int, u16, int);

int (*frontend_ctrl) (struct dvb_frontend *, int);
int (*fe_ioctl_override) (struct dvb_frontend *,
unsigned int, void *, unsigned int);
Expand Down Expand Up @@ -314,24 +314,21 @@ struct dvb_usb_fe_adapter {
int (*fe_init) (struct dvb_frontend *);
int (*fe_sleep) (struct dvb_frontend *);

int pid_filtering;
int max_feed_count;

void *priv;
};

struct dvb_usb_adapter {
struct dvb_usb_device *dev;
struct dvb_usb_adapter_properties props;
struct usb_data_stream stream;

#define DVB_USB_ADAP_STATE_INIT 0x000
#define DVB_USB_ADAP_STATE_DVB 0x001
int state;

struct dvb_usb_device *dev;
struct dvb_usb_adapter_properties props;
struct usb_data_stream stream;
u8 id;

int pid_filtering;
int feedcount;
int max_feed_count;

/* dvb */
struct dvb_adapter dvb_adap;
Expand Down
26 changes: 13 additions & 13 deletions trunk/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)

/* activate the pid on the device specific pid_filter */
deb_ts("setting pid (%s): %5d %04x at index %d '%s'\n",
adap->fe_adap[adap->active_fe].pid_filtering ?
adap->pid_filtering ?
"yes" : "no", dvbdmxfeed->pid, dvbdmxfeed->pid,
dvbdmxfeed->index, onoff ? "on" : "off");
if (adap->props.fe[adap->active_fe].caps & DVB_USB_ADAP_HAS_PID_FILTER &&
adap->fe_adap[adap->active_fe].pid_filtering &&
adap->props.fe[adap->active_fe].pid_filter != NULL)
adap->props.fe[adap->active_fe].pid_filter(adap,
dvbdmxfeed->index, dvbdmxfeed->pid, onoff);
if (adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER &&
adap->pid_filtering &&
adap->props.pid_filter != NULL)
adap->props.pid_filter(adap, dvbdmxfeed->index,
dvbdmxfeed->pid, onoff);

/* start the feed if this was the first feed and there is still a feed
* for reception.
Expand Down Expand Up @@ -146,13 +146,13 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
usb_urb_submit(&adap->stream, &stream_props);

deb_ts("controlling pid parser\n");
if (adap->props.fe[adap->active_fe].caps & DVB_USB_ADAP_HAS_PID_FILTER &&
adap->props.fe[adap->active_fe].caps &
if (adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER &&
adap->props.caps &
DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF &&
adap->props.fe[adap->active_fe].pid_filter_ctrl != NULL) {
ret = adap->props.fe[adap->active_fe].pid_filter_ctrl(
adap->props.pid_filter_ctrl != NULL) {
ret = adap->props.pid_filter_ctrl(
adap,
adap->fe_adap[adap->active_fe].pid_filtering);
adap->pid_filtering);
if (ret < 0) {
err("could not handle pid_parser");
return ret;
Expand Down Expand Up @@ -214,8 +214,8 @@ int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap)

adap->demux.filternum = 0;
for (i = 0; i < adap->props.num_frontends; i++) {
if (adap->demux.filternum < adap->fe_adap[i].max_feed_count)
adap->demux.filternum = adap->fe_adap[i].max_feed_count;
if (adap->demux.filternum < adap->max_feed_count)
adap->demux.filternum = adap->max_feed_count;
}
adap->demux.feednum = adap->demux.filternum;
adap->demux.start_feed = dvb_usb_start_feed;
Expand Down
74 changes: 27 additions & 47 deletions trunk/drivers/media/dvb/dvb-usb/dvb_usb_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a" \
static int dvb_usb_adapter_init(struct dvb_usb_device *d)
{
struct dvb_usb_adapter *adap;
int ret, n, o, adapter_count;
int ret, n, adapter_count;

/* resolve adapter count */
adapter_count = d->props.num_adapters;
Expand All @@ -54,57 +54,37 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d)
memcpy(&adap->props, &d->props.adapter[n],
sizeof(struct dvb_usb_adapter_properties));

for (o = 0; o < adap->props.num_frontends; o++) {
struct dvb_usb_adapter_fe_properties *props =
&adap->props.fe[o];
/* speed - when running at FULL speed we need a HW
* PID filter */
if (d->udev->speed == USB_SPEED_FULL &&
!(props->caps & DVB_USB_ADAP_HAS_PID_FILTER)) {
err("This USB2.0 device cannot be run on a" \
" USB1.1 port. (it lacks a" \
" hardware PID filter)");
return -ENODEV;
}

if ((d->udev->speed == USB_SPEED_FULL &&
props->caps & DVB_USB_ADAP_HAS_PID_FILTER) ||
(props->caps & DVB_USB_ADAP_NEED_PID_FILTERING)) {
info("will use the device's hardware PID" \
" filter (table count: %d).",
props->pid_filter_count);
adap->fe_adap[o].pid_filtering = 1;
adap->fe_adap[o].max_feed_count =
props->pid_filter_count;
} else {
info("will pass the complete MPEG2 transport" \
" stream to the software demuxer.");
adap->fe_adap[o].pid_filtering = 0;
adap->fe_adap[o].max_feed_count = 255;
}
/* speed - when running at FULL speed we need a HW PID filter */
if (d->udev->speed == USB_SPEED_FULL &&
!(adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER)) {
err("This USB2.0 device cannot be run on a" \
" USB1.1 port. (it lacks a" \
" hardware PID filter)");
return -ENODEV;
} else if ((d->udev->speed == USB_SPEED_FULL &&
adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER) ||
(adap->props.caps & DVB_USB_ADAP_NEED_PID_FILTERING)) {
info("will use the device's hardware PID" \
" filter (table count: %d).",
adap->props.pid_filter_count);
adap->pid_filtering = 1;
adap->max_feed_count = adap->props.pid_filter_count;
} else {
info("will pass the complete MPEG2 transport" \
" stream to the software demuxer.");
adap->pid_filtering = 0;
adap->max_feed_count = 255;
}

if (!adap->fe_adap[o].pid_filtering &&
dvb_usb_force_pid_filter_usage &&
props->caps & DVB_USB_ADAP_HAS_PID_FILTER) {
if (!adap->pid_filtering && dvb_usb_force_pid_filter_usage &&
adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER) {
info("pid filter enabled by module option.");
adap->fe_adap[o].pid_filtering = 1;
adap->fe_adap[o].max_feed_count =
props->pid_filter_count;
}

if (props->size_of_priv > 0) {
adap->fe_adap[o].priv = kzalloc(props->size_of_priv, GFP_KERNEL);
if (adap->fe_adap[o].priv == NULL) {
err("no memory for priv for adapter" \
" %d fe %d.", n, o);
return -ENOMEM;
}
}
adap->pid_filtering = 1;
adap->max_feed_count = adap->props.pid_filter_count;
}

if (adap->props.size_of_priv > 0) {
adap->priv = kzalloc(adap->props.size_of_priv,
GFP_KERNEL);
adap->priv = kzalloc(adap->props.size_of_priv, GFP_KERNEL);
if (adap->priv == NULL) {
err("no memory for priv for adapter %d.", n);
return -ENOMEM;
Expand Down

0 comments on commit ffdb9cc

Please sign in to comment.