Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 366674
b: refs/heads/master
c: bada342
h: refs/heads/master
v: v3
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Mar 21, 2013
1 parent 1f5e973 commit d52b44a
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 4 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: a7816b7667d227e97d91e4dee4657862affea7a1
refs/heads/master: bada342e0845f459f0abd80cf7c86ec871980c1a
85 changes: 82 additions & 3 deletions trunk/drivers/media/usb/dvb-usb-v2/af9035.c
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,12 @@ static int af9035_frontend_callback(void *adapter_priv, int component,
static int af9035_get_adapter_count(struct dvb_usb_device *d)
{
struct state *state = d_to_priv(d);
return state->dual_mode + 1;

/* disable 2nd adapter as we don't have PID filters implemented */
if (d->udev->speed == USB_SPEED_FULL)
return 1;
else
return state->dual_mode + 1;
}

static int af9035_frontend_attach(struct dvb_usb_adapter *adap)
Expand Down Expand Up @@ -1201,8 +1206,8 @@ static int af9035_init(struct dvb_usb_device *d)
{
struct state *state = d_to_priv(d);
int ret, i;
u16 frame_size = 87 * 188 / 4;
u8 packet_size = 512 / 4;
u16 frame_size = (d->udev->speed == USB_SPEED_FULL ? 5 : 87) * 188 / 4;
u8 packet_size = (d->udev->speed == USB_SPEED_FULL ? 64 : 512) / 4;
struct reg_val_mask tab[] = {
{ 0x80f99d, 0x01, 0x01 },
{ 0x80f9a4, 0x01, 0x01 },
Expand Down Expand Up @@ -1328,6 +1333,72 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
#define af9035_get_rc_config NULL
#endif

static int af9035_get_stream_config(struct dvb_frontend *fe, u8 *ts_type,
struct usb_data_stream_properties *stream)
{
struct dvb_usb_device *d = fe_to_d(fe);
dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, fe_to_adap(fe)->id);

if (d->udev->speed == USB_SPEED_FULL)
stream->u.bulk.buffersize = 5 * 188;

return 0;
}

/*
* FIXME: PID filter is property of demodulator and should be moved to the
* correct driver. Also we support only adapter #0 PID filter and will
* disable adapter #1 if USB1.1 is used.
*/
static int af9035_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
{
struct dvb_usb_device *d = adap_to_d(adap);
int ret;

dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff);

ret = af9035_wr_reg_mask(d, 0x80f993, onoff, 0x01);
if (ret < 0)
goto err;

return 0;

err:
dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);

return ret;
}

static int af9035_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
int onoff)
{
struct dvb_usb_device *d = adap_to_d(adap);
int ret;
u8 wbuf[2] = {(pid >> 0) & 0xff, (pid >> 8) & 0xff};

dev_dbg(&d->udev->dev, "%s: index=%d pid=%04x onoff=%d\n",
__func__, index, pid, onoff);

ret = af9035_wr_regs(d, 0x80f996, wbuf, 2);
if (ret < 0)
goto err;

ret = af9035_wr_reg(d, 0x80f994, onoff);
if (ret < 0)
goto err;

ret = af9035_wr_reg(d, 0x80f995, index);
if (ret < 0)
goto err;

return 0;

err:
dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);

return ret;
}

static int af9035_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
Expand Down Expand Up @@ -1385,10 +1456,18 @@ static const struct dvb_usb_device_properties af9035_props = {
.tuner_attach = af9035_tuner_attach,
.init = af9035_init,
.get_rc_config = af9035_get_rc_config,
.get_stream_config = af9035_get_stream_config,

.get_adapter_count = af9035_get_adapter_count,
.adapter = {
{
.caps = DVB_USB_ADAP_HAS_PID_FILTER |
DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,

.pid_filter_count = 32,
.pid_filter_ctrl = af9035_pid_filter_ctrl,
.pid_filter = af9035_pid_filter,

.stream = DVB_USB_STREAM_BULK(0x84, 6, 87 * 188),
}, {
.stream = DVB_USB_STREAM_BULK(0x85, 6, 87 * 188),
Expand Down

0 comments on commit d52b44a

Please sign in to comment.