Release 4.7 drivers/media/usb/dvb-usb/dvb-usb-dvb.c
/* dvb-usb-dvb.c is part of the DVB USB library.
*
* Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@posteo.de)
* see dvb-usb-init.c for copyright information.
*
* This file contains functions for initializing and handling the
* linux-dvb API.
*/
#include "dvb-usb-common.h"
#include <media/media-device.h>
/* does the complete input transfer handling */
static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
{
struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv;
int newfeedcount, ret;
if (adap == NULL)
return -ENODEV;
if ((adap->active_fe < 0) ||
(adap->active_fe >= adap->num_frontends_initialized)) {
return -EINVAL;
}
newfeedcount = adap->feedcount + (onoff ? 1 : -1);
/* stop feed before setting a new pid if there will be no pid anymore */
if (newfeedcount == 0) {
deb_ts("stop feeding\n");
usb_urb_kill(&adap->fe_adap[adap->active_fe].stream);
if (adap->props.fe[adap->active_fe].streaming_ctrl != NULL) {
ret = adap->props.fe[adap->active_fe].streaming_ctrl(adap, 0);
if (ret < 0) {
err("error while stopping stream.");
return ret;
}
}
}
adap->feedcount = newfeedcount;
/* 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 ?
"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);
/* start the feed if this was the first feed and there is still a feed
* for reception.
*/
if (adap->feedcount == onoff && adap->feedcount > 0) {
deb_ts("submitting all URBs\n");
usb_urb_submit(&adap->fe_adap[adap->active_fe].stream);
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 &
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,
adap->fe_adap[adap->active_fe].pid_filtering);
if (ret < 0) {
err("could not handle pid_parser");
return ret;
}
}
deb_ts("start feeding\n");
if (adap->props.fe[adap->active_fe].streaming_ctrl != NULL) {
ret = adap->props.fe[adap->active_fe].streaming_ctrl(adap, 1);
if (ret < 0) {
err("error while enabling fifo.");
return ret;
}
}
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johannes stezenbach | johannes stezenbach | 239 | 50.00% | 1 | 14.29% |
michael krufky | michael krufky | 138 | 28.87% | 2 | 28.57% |
patrick boettcher | patrick boettcher | 58 | 12.13% | 2 | 28.57% |
malcolm priestley | malcolm priestley | 43 | 9.00% | 2 | 28.57% |
| Total | 478 | 100.00% | 7 | 100.00% |
static int dvb_usb_start_feed(struct dvb_demux_feed *dvbdmxfeed)
{
deb_ts("start pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid,
dvbdmxfeed->type);
return dvb_usb_ctrl_feed(dvbdmxfeed, 1);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johannes stezenbach | johannes stezenbach | 32 | 100.00% | 1 | 100.00% |
| Total | 32 | 100.00% | 1 | 100.00% |
static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
{
deb_ts("stop pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid, dvbdmxfeed->type);
return dvb_usb_ctrl_feed(dvbdmxfeed, 0);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johannes stezenbach | johannes stezenbach | 32 | 100.00% | 1 | 100.00% |
| Total | 32 | 100.00% | 1 | 100.00% |
static int dvb_usb_media_device_init(struct dvb_usb_adapter *adap)
{
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
struct media_device *mdev;
struct dvb_usb_device *d = adap->dev;
struct usb_device *udev = d->udev;
mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
if (!mdev)
return -ENOMEM;
media_device_usb_init(mdev, udev, d->desc->name);
dvb_register_media_controller(&adap->dvb_adap, mdev);
dev_info(&d->udev->dev, "media controller created\n");
#endif
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rafael lourenco de lima chehab | rafael lourenco de lima chehab | 53 | 53.54% | 1 | 14.29% |
mauro carvalho chehab | mauro carvalho chehab | 45 | 45.45% | 5 | 71.43% |
javier martinez canillas | javier martinez canillas | 1 | 1.01% | 1 | 14.29% |
| Total | 99 | 100.00% | 7 | 100.00% |
static int dvb_usb_media_device_register(struct dvb_usb_adapter *adap)
{
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
return media_device_register(adap->dvb_adap.mdev);
#else
return 0;
#endif
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
javier martinez canillas | javier martinez canillas | 23 | 74.19% | 1 | 50.00% |
mauro carvalho chehab | mauro carvalho chehab | 8 | 25.81% | 1 | 50.00% |
| Total | 31 | 100.00% | 2 | 100.00% |
static void dvb_usb_media_device_unregister(struct dvb_usb_adapter *adap)
{
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
if (!adap->dvb_adap.mdev)
return;
media_device_unregister(adap->dvb_adap.mdev);
media_device_cleanup(adap->dvb_adap.mdev);
kfree(adap->dvb_adap.mdev);
adap->dvb_adap.mdev = NULL;
#endif
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rafael lourenco de lima chehab | rafael lourenco de lima chehab | 34 | 55.74% | 1 | 33.33% |
mauro carvalho chehab | mauro carvalho chehab | 18 | 29.51% | 1 | 33.33% |
javier martinez canillas | javier martinez canillas | 9 | 14.75% | 1 | 33.33% |
| Total | 61 | 100.00% | 3 | 100.00% |
int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums)
{
int i;
int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name,
adap->dev->owner, &adap->dev->udev->dev,
adapter_nums);
if (ret < 0) {
deb_info("dvb_register_adapter failed: error %d", ret);
goto err;
}
adap->dvb_adap.priv = adap;
ret = dvb_usb_media_device_init(adap);
if (ret < 0) {
deb_info("dvb_usb_media_device_init failed: error %d", ret);
goto err_mc;
}
if (adap->dev->props.read_mac_address) {
if (adap->dev->props.read_mac_address(adap->dev, adap->dvb_adap.proposed_mac) == 0)
info("MAC address: %pM", adap->dvb_adap.proposed_mac);
else
err("MAC address reading failed.");
}
adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING;
adap->demux.priv = 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;
}
adap->demux.feednum = adap->demux.filternum;
adap->demux.start_feed = dvb_usb_start_feed;
adap->demux.stop_feed = dvb_usb_stop_feed;
adap->demux.write_to_decoder = NULL;
if ((ret = dvb_dmx_init(&adap->demux)) < 0) {
err("dvb_dmx_init failed: error %d", ret);
goto err_dmx;
}
adap->dmxdev.filternum = adap->demux.filternum;
adap->dmxdev.demux = &adap->demux.dmx;
adap->dmxdev.capabilities = 0;
if ((ret = dvb_dmxdev_init(&adap->dmxdev, &adap->dvb_adap)) < 0) {
err("dvb_dmxdev_init failed: error %d", ret);
goto err_dmx_dev;
}
if ((ret = dvb_net_init(&adap->dvb_adap, &adap->dvb_net,
&adap->demux.dmx)) < 0) {
err("dvb_net_init failed: error %d", ret);
goto err_net_init;
}
adap->state |= DVB_USB_ADAP_STATE_DVB;
return 0;
err_net_init:
dvb_dmxdev_release(&adap->dmxdev);
err_dmx_dev:
dvb_dmx_release(&adap->demux);
err_dmx:
dvb_usb_media_device_unregister(adap);
err_mc:
dvb_unregister_adapter(&adap->dvb_adap);
err:
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johannes stezenbach | johannes stezenbach | 260 | 57.02% | 1 | 9.09% |
michael krufky | michael krufky | 59 | 12.94% | 1 | 9.09% |
patrick boettcher | patrick boettcher | 50 | 10.96% | 1 | 9.09% |
jonathan nieder | jonathan nieder | 30 | 6.58% | 1 | 9.09% |
mauro carvalho chehab | mauro carvalho chehab | 22 | 4.82% | 1 | 9.09% |
janne grunau | janne grunau | 11 | 2.41% | 1 | 9.09% |
rafael lourenco de lima chehab | rafael lourenco de lima chehab | 9 | 1.97% | 1 | 9.09% |
trent piepho | trent piepho | 7 | 1.54% | 1 | 9.09% |
andrew de quincey | andrew de quincey | 6 | 1.32% | 1 | 9.09% |
javier martinez canillas | javier martinez canillas | 1 | 0.22% | 1 | 9.09% |
johannes berg | johannes berg | 1 | 0.22% | 1 | 9.09% |
| Total | 456 | 100.00% | 11 | 100.00% |
int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap)
{
if (adap->state & DVB_USB_ADAP_STATE_DVB) {
deb_info("unregistering DVB part\n");
dvb_net_release(&adap->dvb_net);
adap->demux.dmx.close(&adap->demux.dmx);
dvb_dmxdev_release(&adap->dmxdev);
dvb_dmx_release(&adap->demux);
dvb_usb_media_device_unregister(adap);
dvb_unregister_adapter(&adap->dvb_adap);
adap->state &= ~DVB_USB_ADAP_STATE_DVB;
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johannes stezenbach | johannes stezenbach | 70 | 79.55% | 1 | 33.33% |
patrick boettcher | patrick boettcher | 13 | 14.77% | 1 | 33.33% |
rafael lourenco de lima chehab | rafael lourenco de lima chehab | 5 | 5.68% | 1 | 33.33% |
| Total | 88 | 100.00% | 3 | 100.00% |
static int dvb_usb_set_active_fe(struct dvb_frontend *fe, int onoff)
{
struct dvb_usb_adapter *adap = fe->dvb->priv;
int ret = (adap->props.frontend_ctrl) ?
adap->props.frontend_ctrl(fe, onoff) : 0;
if (ret < 0) {
err("frontend_ctrl request failed");
return ret;
}
if (onoff)
adap->active_fe = fe->id;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
michael krufky | michael krufky | 51 | 63.75% | 1 | 33.33% |
johannes stezenbach | johannes stezenbach | 24 | 30.00% | 1 | 33.33% |
patrick boettcher | patrick boettcher | 5 | 6.25% | 1 | 33.33% |
| Total | 80 | 100.00% | 3 | 100.00% |
static int dvb_usb_fe_wakeup(struct dvb_frontend *fe)
{
struct dvb_usb_adapter *adap = fe->dvb->priv;
dvb_usb_device_power_ctrl(adap->dev, 1);
dvb_usb_set_active_fe(fe, 1);
if (adap->fe_adap[fe->id].fe_init)
adap->fe_adap[fe->id].fe_init(fe);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
michael krufky | michael krufky | 37 | 54.41% | 1 | 25.00% |
antti palosaari | antti palosaari | 21 | 30.88% | 1 | 25.00% |
johannes stezenbach | johannes stezenbach | 9 | 13.24% | 1 | 25.00% |
patrick boettcher | patrick boettcher | 1 | 1.47% | 1 | 25.00% |
| Total | 68 | 100.00% | 4 | 100.00% |
static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
{
struct dvb_usb_adapter *adap = fe->dvb->priv;
if (adap->fe_adap[fe->id].fe_sleep)
adap->fe_adap[fe->id].fe_sleep(fe);
dvb_usb_set_active_fe(fe, 0);
return dvb_usb_device_power_ctrl(adap->dev, 0);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johannes stezenbach | johannes stezenbach | 34 | 51.52% | 1 | 25.00% |
antti palosaari | antti palosaari | 14 | 21.21% | 1 | 25.00% |
patrick boettcher | patrick boettcher | 9 | 13.64% | 1 | 25.00% |
michael krufky | michael krufky | 9 | 13.64% | 1 | 25.00% |
| Total | 66 | 100.00% | 4 | 100.00% |
int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap)
{
int ret, i;
/* register all given adapter frontends */
for (i = 0; i < adap->props.num_frontends; i++) {
if (adap->props.fe[i].frontend_attach == NULL) {
err("strange: '%s' #%d,%d "
"doesn't want to attach a frontend.",
adap->dev->desc->name, adap->id, i);
return 0;
}
ret = adap->props.fe[i].frontend_attach(adap);
if (ret || adap->fe_adap[i].fe == NULL) {
/* only print error when there is no FE at all */
if (i == 0)
err("no frontend was attached by '%s'",
adap->dev->desc->name);
return 0;
}
adap->fe_adap[i].fe->id = i;
/* re-assign sleep and wakeup functions */
adap->fe_adap[i].fe_init = adap->fe_adap[i].fe->ops.init;
adap->fe_adap[i].fe->ops.init = dvb_usb_fe_wakeup;
adap->fe_adap[i].fe_sleep = adap->fe_adap[i].fe->ops.sleep;
adap->fe_adap[i].fe->ops.sleep = dvb_usb_fe_sleep;
if (dvb_register_frontend(&adap->dvb_adap, adap->fe_adap[i].fe)) {
err("Frontend %d registration failed.", i);
dvb_frontend_detach(adap->fe_adap[i].fe);
adap->fe_adap[i].fe = NULL;
/* In error case, do not try register more FEs,
* still leaving already registered FEs alive. */
if (i == 0)
return -ENODEV;
else
return 0;
}
/* only attach the tuner if the demod is there */
if (adap->props.fe[i].tuner_attach != NULL)
adap->props.fe[i].tuner_attach(adap);
adap->num_frontends_initialized++;
}
if (ret)
return ret;
ret = dvb_create_media_graph(&adap->dvb_adap, true);
if (ret)
return ret;
ret = dvb_usb_media_device_register(adap);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johannes stezenbach | johannes stezenbach | 111 | 31.18% | 1 | 6.25% |
antti palosaari | antti palosaari | 100 | 28.09% | 2 | 12.50% |
michael krufky | michael krufky | 77 | 21.63% | 1 | 6.25% |
patrick boettcher | patrick boettcher | 33 | 9.27% | 4 | 25.00% |
mauro carvalho chehab | mauro carvalho chehab | 23 | 6.46% | 5 | 31.25% |
rafael lourenco de lima chehab | rafael lourenco de lima chehab | 6 | 1.69% | 1 | 6.25% |
javier martinez canillas | javier martinez canillas | 5 | 1.40% | 1 | 6.25% |
andrew de quincey | andrew de quincey | 1 | 0.28% | 1 | 6.25% |
| Total | 356 | 100.00% | 16 | 100.00% |
int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap)
{
int i = adap->num_frontends_initialized - 1;
/* unregister all given adapter frontends */
for (; i >= 0; i--) {
if (adap->fe_adap[i].fe != NULL) {
dvb_unregister_frontend(adap->fe_adap[i].fe);
dvb_frontend_detach(adap->fe_adap[i].fe);
}
}
adap->num_frontends_initialized = 0;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
antti palosaari | antti palosaari | 27 | 33.75% | 2 | 33.33% |
johannes stezenbach | johannes stezenbach | 21 | 26.25% | 1 | 16.67% |
michael krufky | michael krufky | 19 | 23.75% | 1 | 16.67% |
patrick boettcher | patrick boettcher | 13 | 16.25% | 2 | 33.33% |
| Total | 80 | 100.00% | 6 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johannes stezenbach | johannes stezenbach | 835 | 43.15% | 1 | 3.33% |
michael krufky | michael krufky | 390 | 20.16% | 2 | 6.67% |
patrick boettcher | patrick boettcher | 184 | 9.51% | 6 | 20.00% |
antti palosaari | antti palosaari | 162 | 8.37% | 2 | 6.67% |
mauro carvalho chehab | mauro carvalho chehab | 119 | 6.15% | 9 | 30.00% |
rafael lourenco de lima chehab | rafael lourenco de lima chehab | 107 | 5.53% | 1 | 3.33% |
malcolm priestley | malcolm priestley | 43 | 2.22% | 2 | 6.67% |
javier martinez canillas | javier martinez canillas | 39 | 2.02% | 1 | 3.33% |
jonathan nieder | jonathan nieder | 30 | 1.55% | 1 | 3.33% |
janne grunau | janne grunau | 11 | 0.57% | 1 | 3.33% |
andrew de quincey | andrew de quincey | 7 | 0.36% | 2 | 6.67% |
trent piepho | trent piepho | 7 | 0.36% | 1 | 3.33% |
johannes berg | johannes berg | 1 | 0.05% | 1 | 3.33% |
| Total | 1935 | 100.00% | 30 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.