aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAapo Tahkola <aet@rasterburn.org>2007-04-20 12:34:25 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-05-09 09:13:03 -0400
commit9ad4eef2f429bdab5279fcde38b7ba789e2658f7 (patch)
tree39c993cd8b16748a0489c1cbb84da94770f86265 /drivers/media
parent4fd74a776f8f451e424ec6cd6bdff690c83b07c2 (diff)
V4L/DVB (5613): M920x: loosen up 80-col limit
Do not follow 80-col limit where it would cause inconsistency. Signed-off-by: Aapo Tahkola <aet@rasterburn.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/m920x.c63
1 files changed, 23 insertions, 40 deletions
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c
index 49e57f85f99b..fbb735d93b7a 100644
--- a/drivers/media/dvb/dvb-usb/m920x.c
+++ b/drivers/media/dvb/dvb-usb/m920x.c
@@ -85,12 +85,10 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
85 int i, ret = 0; 85 int i, ret = 0;
86 u8 rc_state[2]; 86 u8 rc_state[2];
87 87
88 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, 88 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0)
89 rc_state, 1)) != 0)
90 goto unlock; 89 goto unlock;
91 90
92 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, 91 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0)
93 rc_state + 1, 1)) != 0)
94 goto unlock; 92 goto unlock;
95 93
96 for (i = 0; i < d->props.rc_key_map_size; i++) 94 for (i = 0; i < d->props.rc_key_map_size; i++)
@@ -142,8 +140,7 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
142} 140}
143 141
144/* I2C */ 142/* I2C */
145static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], 143static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
146 int num)
147{ 144{
148 struct dvb_usb_device *d = i2c_get_adapdata(adap); 145 struct dvb_usb_device *d = i2c_get_adapdata(adap);
149 int i, j; 146 int i, j;
@@ -156,8 +153,7 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
156 return -EAGAIN; 153 return -EAGAIN;
157 154
158 for (i = 0; i < num; i++) { 155 for (i = 0; i < num; i++) {
159 if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | 156 if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | I2C_M_TEN) || msg[i].len == 0) {
160 I2C_M_TEN) || msg[i].len == 0) {
161 /* For a 0 byte message, I think sending the address 157 /* For a 0 byte message, I think sending the address
162 * to index 0x80|0x40 would be the correct thing to 158 * to index 0x80|0x40 would be the correct thing to
163 * do. However, zero byte messages are only used for 159 * do. However, zero byte messages are only used for
@@ -170,8 +166,7 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
170 if (!(msg[i].flags & I2C_M_NOSTART)) { 166 if (!(msg[i].flags & I2C_M_NOSTART)) {
171 if ((ret = m920x_write(d->udev, M9206_I2C, 167 if ((ret = m920x_write(d->udev, M9206_I2C,
172 (msg[i].addr << 1) | 168 (msg[i].addr << 1) |
173 (msg[i].flags & I2C_M_RD ? 0x01 : 0), 169 (msg[i].flags & I2C_M_RD ? 0x01 : 0), 0x80)) != 0)
174 0x80)) != 0)
175 goto unlock; 170 goto unlock;
176 /* Should check for ack here, if we knew how. */ 171 /* Should check for ack here, if we knew how. */
177 } 172 }
@@ -179,23 +174,19 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
179 for (j = 0; j < msg[i].len; j++) { 174 for (j = 0; j < msg[i].len; j++) {
180 /* Last byte of transaction? 175 /* Last byte of transaction?
181 * Send STOP, otherwise send ACK. */ 176 * Send STOP, otherwise send ACK. */
182 int stop = (i+1 == num && j+1 == msg[i].len) 177 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x01;
183 ? 0x40 : 0x01;
184 178
185 if ((ret = m920x_read(d->udev, M9206_I2C, 0x0, 179 if ((ret = m920x_read(d->udev, M9206_I2C, 0x0,
186 0x20|stop, 180 0x20 | stop,
187 &msg[i].buf[j], 1)) != 0) 181 &msg[i].buf[j], 1)) != 0)
188 goto unlock; 182 goto unlock;
189 } 183 }
190 } else { 184 } else {
191 for (j = 0; j < msg[i].len; j++) { 185 for (j = 0; j < msg[i].len; j++) {
192 /* Last byte of transaction? Then send STOP. */ 186 /* Last byte of transaction? Then send STOP. */
193 int stop = (i+1 == num && j+1 == msg[i].len) 187 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x00;
194 ? 0x40 : 0x00;
195 188
196 if ((ret = m920x_write(d->udev, M9206_I2C, 189 if ((ret = m920x_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0)
197 msg[i].buf[j],
198 stop)) != 0)
199 goto unlock; 190 goto unlock;
200 /* Should check for ack here too. */ 191 /* Should check for ack here too. */
201 } 192 }
@@ -230,12 +221,10 @@ static int m920x_set_filter(struct dvb_usb_adapter *adap,
230 221
231 pid |= 0x8000; 222 pid |= 0x8000;
232 223
233 if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, pid, 224 if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
234 (type << 8) | (idx * 4) )) != 0)
235 return ret; 225 return ret;
236 226
237 if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, 0, 227 if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
238 (type << 8) | (idx * 4) )) != 0)
239 return ret; 228 return ret;
240 229
241 return ret; 230 return ret;
@@ -268,8 +257,7 @@ static int m920x_update_filters(struct dvb_usb_adapter *adap)
268 if (m->filters[i] == 0) 257 if (m->filters[i] == 0)
269 continue; 258 continue;
270 259
271 if ((ret = m920x_set_filter(adap, 0x81, filter + 2, 260 if ((ret = m920x_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0)
272 m->filters[i])) != 0)
273 return ret; 261 return ret;
274 262
275 filter++; 263 filter++;
@@ -291,8 +279,7 @@ static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
291 return m920x_update_filters(adap); 279 return m920x_update_filters(adap);
292} 280}
293 281
294static int m920x_pid_filter(struct dvb_usb_adapter *adap, 282static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
295 int index, u16 pid, int onoff)
296{ 283{
297 struct m920x_state *m = adap->dev->priv; 284 struct m920x_state *m = adap->dev->priv;
298 285
@@ -301,8 +288,7 @@ static int m920x_pid_filter(struct dvb_usb_adapter *adap,
301 return m920x_update_filters(adap); 288 return m920x_update_filters(adap);
302} 289}
303 290
304static int m920x_firmware_download(struct usb_device *udev, 291static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw)
305 const struct firmware *fw)
306{ 292{
307 u16 value, index, size; 293 u16 value, index, size;
308 u8 read[4], *buff; 294 u8 read[4], *buff;
@@ -334,9 +320,9 @@ static int m920x_firmware_download(struct usb_device *udev,
334 memcpy(buff, fw->data + i, size); 320 memcpy(buff, fw->data + i, size);
335 321
336 ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0), 322 ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
337 M9206_FW, 323 M9206_FW,
338 USB_TYPE_VENDOR | USB_DIR_OUT, 324 USB_TYPE_VENDOR | USB_DIR_OUT,
339 value, index, buff, size, 20); 325 value, index, buff, size, 20);
340 if (ret != size) { 326 if (ret != size) {
341 deb("error while uploading fw!\n"); 327 deb("error while uploading fw!\n");
342 ret = -EIO; 328 ret = -EIO;
@@ -445,7 +431,8 @@ static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap)
445{ 431{
446 deb("%s\n",__FUNCTION__); 432 deb("%s\n",__FUNCTION__);
447 433
448 if ((adap->fe = dvb_attach(mt352_attach, &m920x_mt352_config, 434 if ((adap->fe = dvb_attach(mt352_attach,
435 &m920x_mt352_config,
449 &adap->dev->i2c_adap)) == NULL) 436 &adap->dev->i2c_adap)) == NULL)
450 return -EIO; 437 return -EIO;
451 438
@@ -480,8 +467,7 @@ static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
480{ 467{
481 deb("%s\n",__FUNCTION__); 468 deb("%s\n",__FUNCTION__);
482 469
483 if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, 470 if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL)
484 &m920x_qt1010_config) == NULL)
485 return -ENODEV; 471 return -ENODEV;
486 472
487 return 0; 473 return 0;
@@ -491,8 +477,7 @@ static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap)
491{ 477{
492 deb("%s\n",__FUNCTION__); 478 deb("%s\n",__FUNCTION__);
493 479
494 if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, 480 if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL)
495 NULL) == NULL)
496 return -ENODEV; 481 return -ENODEV;
497 482
498 return 0; 483 return 0;
@@ -502,8 +487,7 @@ static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap)
502{ 487{
503 deb("%s\n",__FUNCTION__); 488 deb("%s\n",__FUNCTION__);
504 489
505 if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, 490 if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL)
506 NULL) == NULL)
507 return -ENODEV; 491 return -ENODEV;
508 492
509 return 0; 493 return 0;
@@ -593,8 +577,7 @@ static int m920x_probe(struct usb_interface *intf,
593 goto found; 577 goto found;
594 } 578 }
595 579
596 if ((ret = dvb_usb_device_init(intf, 580 if ((ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,
597 &digivox_mini_ii_properties,
598 THIS_MODULE, &d)) == 0) { 581 THIS_MODULE, &d)) == 0) {
599 /* No remote control, so no rc_init_seq */ 582 /* No remote control, so no rc_init_seq */
600 goto found; 583 goto found;