aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/m920x.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-03-22 18:03:37 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-05-09 09:12:59 -0400
commitd3911eaa0d7d0e6963f194e748cf21d7502584bf (patch)
tree4b1bdc74a3fd3c720df0fdfd49a41b687d80a8f3 /drivers/media/dvb/dvb-usb/m920x.c
parentf8e0bd5db4cc636fec35264c2396adb1b633ee05 (diff)
V4L/DVB (5608): M920x: various whitespace cleanups
- 80-column cleanups - spaces between operators - tabbing style Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/m920x.c')
-rw-r--r--drivers/media/dvb/dvb-usb/m920x.c229
1 files changed, 127 insertions, 102 deletions
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c
index 44e0d6e2c76b..4d63d1f16295 100644
--- a/drivers/media/dvb/dvb-usb/m920x.c
+++ b/drivers/media/dvb/dvb-usb/m920x.c
@@ -3,8 +3,8 @@
3 * Copyright (C) 2006 Aapo Tahkola (aet@rasterburn.org) 3 * Copyright (C) 2006 Aapo Tahkola (aet@rasterburn.org)
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free 6 * under the terms of the GNU General Public License as published by the
7 * Software Foundation, version 2. 7 * Free Software Foundation, version 2.
8 * 8 *
9 * see Documentation/dvb/README.dvb-usb for more information 9 * see Documentation/dvb/README.dvb-usb for more information
10 */ 10 */
@@ -61,7 +61,7 @@ static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = {
61 { 0x0, 0x1e, KEY_VOLUMEUP }, 61 { 0x0, 0x1e, KEY_VOLUMEUP },
62}; 62};
63 63
64static inline int m9206_read(struct usb_device *udev, u8 request, u16 value,\ 64static inline int m9206_read(struct usb_device *udev, u8 request, u16 value,
65 u16 index, void *data, int size) 65 u16 index, void *data, int size)
66{ 66{
67 int ret; 67 int ret;
@@ -102,7 +102,9 @@ static int m9206_init(struct dvb_usb_device *d, struct m9206_inits *rc_seq)
102 if (d->props.rc_query) { 102 if (d->props.rc_query) {
103 deb_rc("Initialising remote control\n"); 103 deb_rc("Initialising remote control\n");
104 while (rc_seq->address) { 104 while (rc_seq->address) {
105 if ((ret = m9206_write(d->udev, M9206_CORE, rc_seq->data, rc_seq->address)) != 0) { 105 if ((ret = m9206_write(d->udev, M9206_CORE,
106 rc_seq->data,
107 rc_seq->address)) != 0) {
106 deb_rc("Initialising remote control failed\n"); 108 deb_rc("Initialising remote control failed\n");
107 return ret; 109 return ret;
108 } 110 }
@@ -122,10 +124,12 @@ static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
122 int i, ret = 0; 124 int i, ret = 0;
123 u8 rc_state[2]; 125 u8 rc_state[2];
124 126
125 if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0) 127 if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE,
128 rc_state, 1)) != 0)
126 goto unlock; 129 goto unlock;
127 130
128 if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) 131 if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY,
132 rc_state + 1, 1)) != 0)
129 goto unlock; 133 goto unlock;
130 134
131 for (i = 0; i < d->props.rc_key_map_size; i++) 135 for (i = 0; i < d->props.rc_key_map_size; i++)
@@ -160,7 +164,8 @@ static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
160 goto unlock; 164 goto unlock;
161 165
162 default: 166 default:
163 deb_rc("Unexpected rc state %02x\n", rc_state[0]); 167 deb_rc("Unexpected rc state %02x\n",
168 rc_state[0]);
164 *state = REMOTE_NO_KEY_PRESSED; 169 *state = REMOTE_NO_KEY_PRESSED;
165 goto unlock; 170 goto unlock;
166 } 171 }
@@ -171,7 +176,7 @@ static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
171 176
172 *state = REMOTE_NO_KEY_PRESSED; 177 *state = REMOTE_NO_KEY_PRESSED;
173 178
174 unlock: 179 unlock:
175 180
176 return ret; 181 return ret;
177} 182}
@@ -191,33 +196,46 @@ static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
191 return -EAGAIN; 196 return -EAGAIN;
192 197
193 for (i = 0; i < num; i++) { 198 for (i = 0; i < num; i++) {
194 if (msg[i].flags & (I2C_M_NO_RD_ACK|I2C_M_IGNORE_NAK|I2C_M_TEN) || 199 if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK |
195 msg[i].len == 0) { 200 I2C_M_TEN) || msg[i].len == 0) {
196 /* For a 0 byte message, I think sending the address to index 0x80|0x40 201 /* For a 0 byte message, I think sending the address
197 * would be the correct thing to do. However, zero byte messages are 202 * to index 0x80|0x40 would be the correct thing to
198 * only used for probing, and since we don't know how to get the slave's 203 * do. However, zero byte messages are only used for
199 * ack, we can't probe. */ 204 * probing, and since we don't know how to get the
205 * slave's ack, we can't probe. */
200 ret = -ENOTSUPP; 206 ret = -ENOTSUPP;
201 goto unlock; 207 goto unlock;
202 } 208 }
203 /* Send START & address/RW bit */ 209 /* Send START & address/RW bit */
204 if (!(msg[i].flags & I2C_M_NOSTART)) { 210 if (!(msg[i].flags & I2C_M_NOSTART)) {
205 if ((ret = m9206_write(d->udev, M9206_I2C, (msg[i].addr<<1)|(msg[i].flags&I2C_M_RD?0x01:0), 0x80)) != 0) 211 if ((ret = m9206_write(d->udev, M9206_I2C,
212 (msg[i].addr << 1) |
213 (msg[i].flags & I2C_M_RD ? 0x01 : 0),
214 0x80)) != 0)
206 goto unlock; 215 goto unlock;
207 /* Should check for ack here, if we knew how. */ 216 /* Should check for ack here, if we knew how. */
208 } 217 }
209 if (msg[i].flags & I2C_M_RD) { 218 if (msg[i].flags & I2C_M_RD) {
210 for (j = 0; j < msg[i].len; j++) { 219 for (j = 0; j < msg[i].len; j++) {
211 /* Last byte of transaction? Send STOP, otherwise send ACK. */ 220 /* Last byte of transaction?
212 int stop = (i+1 == num && j+1 == msg[i].len)?0x40:0x01; 221 * Send STOP, otherwise send ACK. */
213 if ((ret = m9206_read(d->udev, M9206_I2C, 0x0, 0x20|stop, &msg[i].buf[j], 1)) != 0) 222 int stop = (i+1 == num && j+1 == msg[i].len)
223 ? 0x40 : 0x01;
224
225 if ((ret = m9206_read(d->udev, M9206_I2C, 0x0,
226 0x20|stop,
227 &msg[i].buf[j], 1)) != 0)
214 goto unlock; 228 goto unlock;
215 } 229 }
216 } else { 230 } else {
217 for (j = 0; j < msg[i].len; j++) { 231 for (j = 0; j < msg[i].len; j++) {
218 /* Last byte of transaction? Then send STOP. */ 232 /* Last byte of transaction? Then send STOP. */
219 int stop = (i+1 == num && j+1 == msg[i].len)?0x40:0x00; 233 int stop = (i+1 == num && j+1 == msg[i].len)
220 if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0) 234 ? 0x40 : 0x00;
235
236 if ((ret = m9206_write(d->udev, M9206_I2C,
237 msg[i].buf[j],
238 stop)) != 0)
221 goto unlock; 239 goto unlock;
222 /* Should check for ack here too. */ 240 /* Should check for ack here too. */
223 } 241 }
@@ -225,7 +243,7 @@ static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
225 } 243 }
226 ret = num; 244 ret = num;
227 245
228unlock: 246 unlock:
229 mutex_unlock(&d->i2c_mutex); 247 mutex_unlock(&d->i2c_mutex);
230 248
231 return ret; 249 return ret;
@@ -242,8 +260,8 @@ static struct i2c_algorithm m9206_i2c_algo = {
242}; 260};
243 261
244 262
245static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx, 263static int m9206_set_filter(struct dvb_usb_adapter *adap,
246 int pid) 264 int type, int idx, int pid)
247{ 265{
248 int ret = 0; 266 int ret = 0;
249 267
@@ -252,10 +270,12 @@ static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx,
252 270
253 pid |= 0x8000; 271 pid |= 0x8000;
254 272
255 if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0) 273 if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, pid,
274 (type << 8) | (idx * 4) )) != 0)
256 return ret; 275 return ret;
257 276
258 if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0) 277 if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, 0,
278 (type << 8) | (idx * 4) )) != 0)
259 return ret; 279 return ret;
260 280
261 return ret; 281 return ret;
@@ -288,7 +308,8 @@ static int m9206_update_filters(struct dvb_usb_adapter *adap)
288 if (m->filters[i] == 0) 308 if (m->filters[i] == 0)
289 continue; 309 continue;
290 310
291 if ((ret = m9206_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0) 311 if ((ret = m9206_set_filter(adap, 0x81, filter + 2,
312 m->filters[i])) != 0)
292 return ret; 313 return ret;
293 314
294 filter++; 315 filter++;
@@ -310,8 +331,8 @@ static int m9206_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
310 return m9206_update_filters(adap); 331 return m9206_update_filters(adap);
311} 332}
312 333
313static int m9206_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, 334static int m9206_pid_filter(struct dvb_usb_adapter *adap,
314 int onoff) 335 int index, u16 pid, int onoff)
315{ 336{
316 struct m9206_state *m = adap->dev->priv; 337 struct m9206_state *m = adap->dev->priv;
317 338
@@ -378,7 +399,7 @@ static int m9206_firmware_download(struct usb_device *udev,
378 (void) m9206_write(udev, M9206_CORE, 0x01, M9206_FW_GO); 399 (void) m9206_write(udev, M9206_CORE, 0x01, M9206_FW_GO);
379 deb_rc("firmware uploaded!\n"); 400 deb_rc("firmware uploaded!\n");
380 401
381 done: 402 done:
382 kfree(buff); 403 kfree(buff);
383 404
384 return ret; 405 return ret;
@@ -433,7 +454,8 @@ static int megasky_mt352_frontend_attach(struct dvb_usb_adapter *adap)
433{ 454{
434 deb_rc("megasky_frontend_attach!\n"); 455 deb_rc("megasky_frontend_attach!\n");
435 456
436 if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config, &adap->dev->i2c_adap)) == NULL) 457 if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config,
458 &adap->dev->i2c_adap)) == NULL)
437 return -EIO; 459 return -EIO;
438 460
439 return 0; 461 return 0;
@@ -524,10 +546,13 @@ static int tvwalkertwin_0_tda10046_frontend_attach(struct dvb_usb_adapter *adap)
524{ 546{
525 deb_rc("tvwalkertwin_0_tda10046_frontend_attach!\n"); 547 deb_rc("tvwalkertwin_0_tda10046_frontend_attach!\n");
526 548
527 if ((adap->fe = dvb_attach(tda10046_attach, &tvwalkertwin_0_tda10046_config, &adap->dev->i2c_adap)) == NULL) 549 if ((adap->fe = dvb_attach(tda10046_attach,
550 &tvwalkertwin_0_tda10046_config,
551 &adap->dev->i2c_adap)) == NULL)
528 return -EIO; 552 return -EIO;
529 553
530 deb_rc("Attached demod 0 at address %02x\n", tvwalkertwin_0_tda10046_config.demod_address); 554 deb_rc("Attached demod 0 at address %02x\n",
555 tvwalkertwin_0_tda10046_config.demod_address);
531 556
532 return 0; 557 return 0;
533} 558}
@@ -536,10 +561,13 @@ static int tvwalkertwin_1_tda10046_frontend_attach(struct dvb_usb_adapter *adap)
536{ 561{
537 deb_rc("tvwalkertwin_1_tda10046_frontend_attach!\n"); 562 deb_rc("tvwalkertwin_1_tda10046_frontend_attach!\n");
538 563
539 if ((adap->fe = dvb_attach(tda10046_attach, &tvwalkertwin_1_tda10046_config, &adap->dev->i2c_adap)) == NULL) 564 if ((adap->fe = dvb_attach(tda10046_attach,
565 &tvwalkertwin_1_tda10046_config,
566 &adap->dev->i2c_adap)) == NULL)
540 return -EIO; 567 return -EIO;
541 568
542 deb_rc("Attached demod 1 at address %02x\n", tvwalkertwin_1_tda10046_config.demod_address); 569 deb_rc("Attached demod 1 at address %02x\n",
570 tvwalkertwin_1_tda10046_config.demod_address);
543 571
544 return 0; 572 return 0;
545} 573}
@@ -588,6 +616,7 @@ static struct dvb_usb_device_properties megasky_properties;
588static struct dvb_usb_device_properties digivox_mini_ii_properties; 616static struct dvb_usb_device_properties digivox_mini_ii_properties;
589static struct dvb_usb_device_properties tvwalkertwin_properties; 617static struct dvb_usb_device_properties tvwalkertwin_properties;
590static struct dvb_usb_device_properties dposh_properties; 618static struct dvb_usb_device_properties dposh_properties;
619
591static struct m9206_inits megasky_rc_init []; 620static struct m9206_inits megasky_rc_init [];
592static struct m9206_inits tvwalkertwin_rc_init []; 621static struct m9206_inits tvwalkertwin_rc_init [];
593 622
@@ -608,25 +637,27 @@ static int m920x_probe(struct usb_interface *intf,
608 */ 637 */
609 638
610 if ((ret = dvb_usb_device_init(intf, &megasky_properties, 639 if ((ret = dvb_usb_device_init(intf, &megasky_properties,
611 THIS_MODULE, &d)) == 0) { 640 THIS_MODULE, &d)) == 0) {
612 rc_init_seq = megasky_rc_init; 641 rc_init_seq = megasky_rc_init;
613 goto found; 642 goto found;
614 } 643 }
615 644
616 if ((ret = dvb_usb_device_init(intf, 645 if ((ret = dvb_usb_device_init(intf,
617 &digivox_mini_ii_properties, THIS_MODULE, &d)) == 0) { 646 &digivox_mini_ii_properties,
647 THIS_MODULE, &d)) == 0) {
618 /* No remote control, so no rc_init_seq */ 648 /* No remote control, so no rc_init_seq */
619 goto found; 649 goto found;
620 } 650 }
621 651
622 /* This configures both tuners on the TV Walker Twin */ 652 /* This configures both tuners on the TV Walker Twin */
623 if ((ret = dvb_usb_device_init(intf, &tvwalkertwin_properties, 653 if ((ret = dvb_usb_device_init(intf, &tvwalkertwin_properties,
624 THIS_MODULE, &d)) == 0) { 654 THIS_MODULE, &d)) == 0) {
625 rc_init_seq = tvwalkertwin_rc_init; 655 rc_init_seq = tvwalkertwin_rc_init;
626 goto found; 656 goto found;
627 } 657 }
628 658
629 if ((ret = dvb_usb_device_init(intf, &dposh_properties, THIS_MODULE, &d)) == 0) { 659 if ((ret = dvb_usb_device_init(intf, &dposh_properties,
660 THIS_MODULE, &d)) == 0) {
630 /* Remote controller not supported yet. */ 661 /* Remote controller not supported yet. */
631 goto found; 662 goto found;
632 } 663 }
@@ -737,7 +768,7 @@ static struct dvb_usb_device_properties digivox_mini_ii_properties = {
737 .num_adapters = 1, 768 .num_adapters = 1,
738 .adapter = {{ 769 .adapter = {{
739 .caps = DVB_USB_ADAP_HAS_PID_FILTER | 770 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
740 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 771 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
741 772
742 .pid_filter_count = 8, 773 .pid_filter_count = 8,
743 .pid_filter = m9206_pid_filter, 774 .pid_filter = m9206_pid_filter,
@@ -786,52 +817,48 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = {
786 817
787 .identify_state = m920x_identify_state, 818 .identify_state = m920x_identify_state,
788 .num_adapters = 2, 819 .num_adapters = 2,
789 .adapter = { 820 .adapter = {{
790 { 821 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
791 .caps = DVB_USB_ADAP_HAS_PID_FILTER | 822 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
792 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 823
793 824 .pid_filter_count = 8,
794 .pid_filter_count = 8, 825 .pid_filter = m9206_pid_filter,
795 .pid_filter = m9206_pid_filter, 826 .pid_filter_ctrl = m9206_pid_filter_ctrl,
796 .pid_filter_ctrl = m9206_pid_filter_ctrl, 827
797 828 .frontend_attach = tvwalkertwin_0_tda10046_frontend_attach,
798 .frontend_attach = tvwalkertwin_0_tda10046_frontend_attach, 829 .tuner_attach = tvwalkertwin_0_tda8275_tuner_attach,
799 .tuner_attach = tvwalkertwin_0_tda8275_tuner_attach, 830
800 831 .stream = {
801 .stream = { 832 .type = USB_BULK,
802 .type = USB_BULK, 833 .count = 8,
803 .count = 8, 834 .endpoint = 0x81,
804 .endpoint = 0x81, 835 .u = {
805 .u = { 836 .bulk = {
806 .bulk = { 837 .buffersize = 512,
807 .buffersize = 512, 838 }
808 } 839 }
809 } 840 }},{
810 }, 841 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
842 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
843
844 .pid_filter_count = 8,
845 .pid_filter = m9206_pid_filter,
846 .pid_filter_ctrl = m9206_pid_filter_ctrl,
847
848 .frontend_attach = tvwalkertwin_1_tda10046_frontend_attach,
849 .tuner_attach = tvwalkertwin_1_tda8275_tuner_attach,
850
851 .stream = {
852 .type = USB_BULK,
853 .count = 8,
854 .endpoint = 0x82,
855 .u = {
856 .bulk = {
857 .buffersize = 512,
858 }
859 }
811 }, 860 },
812 { 861 }},
813 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
814 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
815
816 .pid_filter_count = 8,
817 .pid_filter = m9206_pid_filter,
818 .pid_filter_ctrl = m9206_pid_filter_ctrl,
819
820 .frontend_attach = tvwalkertwin_1_tda10046_frontend_attach,
821 .tuner_attach = tvwalkertwin_1_tda8275_tuner_attach,
822
823 .stream = {
824 .type = USB_BULK,
825 .count = 8,
826 .endpoint = 0x82,
827 .u = {
828 .bulk = {
829 .buffersize = 512,
830 }
831 }
832 },
833 }
834 },
835 .i2c_algo = &m9206_i2c_algo, 862 .i2c_algo = &m9206_i2c_algo,
836 863
837 .num_device_descs = 1, 864 .num_device_descs = 1,
@@ -850,29 +877,27 @@ static struct dvb_usb_device_properties dposh_properties = {
850 .firmware = "dvb-usb-dposh-01.fw", 877 .firmware = "dvb-usb-dposh-01.fw",
851 .download_firmware = m9206_firmware_download, 878 .download_firmware = m9206_firmware_download,
852 879
853 /* Remote controller not supported yet. */
854
855 .size_of_priv = sizeof(struct m9206_state), 880 .size_of_priv = sizeof(struct m9206_state),
856 881
857 .identify_state = m920x_identify_state, 882 .identify_state = m920x_identify_state,
858 .num_adapters = 1, 883 .num_adapters = 1,
859 .adapter = {{ 884 .adapter = {{
860 /* Nardware pid filters don't work with this device/firmware. */ 885 /* Hardware pid filters don't work with this device/firmware */
861 886
862 .frontend_attach = megasky_mt352_frontend_attach, 887 .frontend_attach = megasky_mt352_frontend_attach,
863 .tuner_attach = megasky_qt1010_tuner_attach, 888 .tuner_attach = megasky_qt1010_tuner_attach,
864 889
865 .stream = { 890 .stream = {
866 .type = USB_BULK, 891 .type = USB_BULK,
867 .count = 8, 892 .count = 8,
868 .endpoint = 0x81, 893 .endpoint = 0x81,
869 .u = { 894 .u = {
870 .bulk = { 895 .bulk = {
871 .buffersize = 512, 896 .buffersize = 512,
872 } 897 }
873 } 898 }
874 }, 899 },
875 }}, 900 }},
876 .i2c_algo = &m9206_i2c_algo, 901 .i2c_algo = &m9206_i2c_algo,
877 902
878 .num_device_descs = 1, 903 .num_device_descs = 1,