Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56083
b: refs/heads/master
c: 9ad4eef
h: refs/heads/master
i:
  56081: bda76f1
  56079: 5efaac8
v: v3
  • Loading branch information
Aapo Tahkola authored and Mauro Carvalho Chehab committed May 9, 2007
1 parent a6f2bb9 commit e13449c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 41 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: 4fd74a776f8f451e424ec6cd6bdff690c83b07c2
refs/heads/master: 9ad4eef2f429bdab5279fcde38b7ba789e2658f7
63 changes: 23 additions & 40 deletions trunk/drivers/media/dvb/dvb-usb/m920x.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,10 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
int i, ret = 0;
u8 rc_state[2];

if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE,
rc_state, 1)) != 0)
if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0)
goto unlock;

if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY,
rc_state + 1, 1)) != 0)
if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0)
goto unlock;

for (i = 0; i < d->props.rc_key_map_size; i++)
Expand Down Expand Up @@ -142,8 +140,7 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
}

/* I2C */
static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
int num)
static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
{
struct dvb_usb_device *d = i2c_get_adapdata(adap);
int i, j;
Expand All @@ -156,8 +153,7 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
return -EAGAIN;

for (i = 0; i < num; i++) {
if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK |
I2C_M_TEN) || msg[i].len == 0) {
if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | I2C_M_TEN) || msg[i].len == 0) {
/* For a 0 byte message, I think sending the address
* to index 0x80|0x40 would be the correct thing to
* do. However, zero byte messages are only used for
Expand All @@ -170,32 +166,27 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
if (!(msg[i].flags & I2C_M_NOSTART)) {
if ((ret = m920x_write(d->udev, M9206_I2C,
(msg[i].addr << 1) |
(msg[i].flags & I2C_M_RD ? 0x01 : 0),
0x80)) != 0)
(msg[i].flags & I2C_M_RD ? 0x01 : 0), 0x80)) != 0)
goto unlock;
/* Should check for ack here, if we knew how. */
}
if (msg[i].flags & I2C_M_RD) {
for (j = 0; j < msg[i].len; j++) {
/* Last byte of transaction?
* Send STOP, otherwise send ACK. */
int stop = (i+1 == num && j+1 == msg[i].len)
? 0x40 : 0x01;
int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x01;

if ((ret = m920x_read(d->udev, M9206_I2C, 0x0,
0x20|stop,
0x20 | stop,
&msg[i].buf[j], 1)) != 0)
goto unlock;
}
} else {
for (j = 0; j < msg[i].len; j++) {
/* Last byte of transaction? Then send STOP. */
int stop = (i+1 == num && j+1 == msg[i].len)
? 0x40 : 0x00;
int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x00;

if ((ret = m920x_write(d->udev, M9206_I2C,
msg[i].buf[j],
stop)) != 0)
if ((ret = m920x_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0)
goto unlock;
/* Should check for ack here too. */
}
Expand Down Expand Up @@ -230,12 +221,10 @@ static int m920x_set_filter(struct dvb_usb_adapter *adap,

pid |= 0x8000;

if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, pid,
(type << 8) | (idx * 4) )) != 0)
if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
return ret;

if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, 0,
(type << 8) | (idx * 4) )) != 0)
if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
return ret;

return ret;
Expand Down Expand Up @@ -268,8 +257,7 @@ static int m920x_update_filters(struct dvb_usb_adapter *adap)
if (m->filters[i] == 0)
continue;

if ((ret = m920x_set_filter(adap, 0x81, filter + 2,
m->filters[i])) != 0)
if ((ret = m920x_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0)
return ret;

filter++;
Expand All @@ -291,8 +279,7 @@ static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
return m920x_update_filters(adap);
}

static int m920x_pid_filter(struct dvb_usb_adapter *adap,
int index, u16 pid, int onoff)
static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
{
struct m920x_state *m = adap->dev->priv;

Expand All @@ -301,8 +288,7 @@ static int m920x_pid_filter(struct dvb_usb_adapter *adap,
return m920x_update_filters(adap);
}

static int m920x_firmware_download(struct usb_device *udev,
const struct firmware *fw)
static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw)
{
u16 value, index, size;
u8 read[4], *buff;
Expand Down Expand Up @@ -334,9 +320,9 @@ static int m920x_firmware_download(struct usb_device *udev,
memcpy(buff, fw->data + i, size);

ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
M9206_FW,
USB_TYPE_VENDOR | USB_DIR_OUT,
value, index, buff, size, 20);
M9206_FW,
USB_TYPE_VENDOR | USB_DIR_OUT,
value, index, buff, size, 20);
if (ret != size) {
deb("error while uploading fw!\n");
ret = -EIO;
Expand Down Expand Up @@ -445,7 +431,8 @@ static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap)
{
deb("%s\n",__FUNCTION__);

if ((adap->fe = dvb_attach(mt352_attach, &m920x_mt352_config,
if ((adap->fe = dvb_attach(mt352_attach,
&m920x_mt352_config,
&adap->dev->i2c_adap)) == NULL)
return -EIO;

Expand Down Expand Up @@ -480,8 +467,7 @@ static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
{
deb("%s\n",__FUNCTION__);

if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap,
&m920x_qt1010_config) == NULL)
if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL)
return -ENODEV;

return 0;
Expand All @@ -491,8 +477,7 @@ static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap)
{
deb("%s\n",__FUNCTION__);

if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap,
NULL) == NULL)
if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL)
return -ENODEV;

return 0;
Expand All @@ -502,8 +487,7 @@ static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap)
{
deb("%s\n",__FUNCTION__);

if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap,
NULL) == NULL)
if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL)
return -ENODEV;

return 0;
Expand Down Expand Up @@ -593,8 +577,7 @@ static int m920x_probe(struct usb_interface *intf,
goto found;
}

if ((ret = dvb_usb_device_init(intf,
&digivox_mini_ii_properties,
if ((ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,
THIS_MODULE, &d)) == 0) {
/* No remote control, so no rc_init_seq */
goto found;
Expand Down

0 comments on commit e13449c

Please sign in to comment.