| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * TTUSB DVB driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2002 Holger Waechtler <holger@convergence.de> |
|---|
| 5 | 6 | * Copyright (c) 2003 Felix Domke <tmbinc@elitedvb.net> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or |
|---|
| 8 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 9 | | - * published by the Free Software Foundation; either version 2 of |
|---|
| 10 | | - * the License, or (at your option) any later version. |
|---|
| 11 | 7 | */ |
|---|
| 8 | + |
|---|
| 9 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| 10 | + |
|---|
| 12 | 11 | #include <linux/init.h> |
|---|
| 13 | 12 | #include <linux/slab.h> |
|---|
| 14 | 13 | #include <linux/wait.h> |
|---|
| .. | .. |
|---|
| 63 | 62 | |
|---|
| 64 | 63 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
|---|
| 65 | 64 | |
|---|
| 66 | | -#define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0) |
|---|
| 65 | +#define dprintk(fmt, arg...) do { \ |
|---|
| 66 | + if (debug) \ |
|---|
| 67 | + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ |
|---|
| 68 | + __func__, ##arg); \ |
|---|
| 69 | +} while (0) |
|---|
| 70 | + |
|---|
| 67 | 71 | |
|---|
| 68 | 72 | #define ISO_BUF_COUNT 4 |
|---|
| 69 | 73 | #define FRAMES_PER_ISO_BUF 4 |
|---|
| .. | .. |
|---|
| 75 | 79 | |
|---|
| 76 | 80 | #define TTUSB_REV_2_2 0x22 |
|---|
| 77 | 81 | #define TTUSB_BUDGET_NAME "ttusb_stc_fw" |
|---|
| 82 | + |
|---|
| 83 | +#define MAX_SEND 0x28 |
|---|
| 84 | +#define MAX_RCV 0x20 |
|---|
| 78 | 85 | |
|---|
| 79 | 86 | /* |
|---|
| 80 | 87 | * since we're casting (struct ttusb*) <-> (struct dvb_demux*) around |
|---|
| .. | .. |
|---|
| 123 | 130 | int cc; /* MuxCounter - will increment on EVERY MUX PACKET */ |
|---|
| 124 | 131 | /* (including stuffing. yes. really.) */ |
|---|
| 125 | 132 | |
|---|
| 126 | | - u8 last_result[32]; |
|---|
| 133 | + u8 send_buf[MAX_SEND]; |
|---|
| 134 | + u8 last_result[MAX_RCV]; |
|---|
| 127 | 135 | |
|---|
| 128 | 136 | int revision; |
|---|
| 129 | 137 | |
|---|
| 130 | 138 | struct dvb_frontend* fe; |
|---|
| 131 | 139 | }; |
|---|
| 132 | 140 | |
|---|
| 133 | | -/* ugly workaround ... don't know why it's necessary to read */ |
|---|
| 134 | | -/* all result codes. */ |
|---|
| 135 | | - |
|---|
| 136 | | -static int ttusb_cmd(struct ttusb *ttusb, |
|---|
| 137 | | - const u8 * data, int len, int needresult) |
|---|
| 141 | +static int ttusb_cmd(struct ttusb *ttusb, u8 *data, int len, int len_result) |
|---|
| 138 | 142 | { |
|---|
| 139 | 143 | int actual_len; |
|---|
| 140 | 144 | int err; |
|---|
| 141 | | - int i; |
|---|
| 142 | | - |
|---|
| 143 | | - if (debug >= 3) { |
|---|
| 144 | | - printk(KERN_DEBUG ">"); |
|---|
| 145 | | - for (i = 0; i < len; ++i) |
|---|
| 146 | | - printk(KERN_CONT " %02x", data[i]); |
|---|
| 147 | | - printk(KERN_CONT "\n"); |
|---|
| 148 | | - } |
|---|
| 149 | 145 | |
|---|
| 150 | 146 | if (mutex_lock_interruptible(&ttusb->semusb) < 0) |
|---|
| 151 | 147 | return -EAGAIN; |
|---|
| 152 | 148 | |
|---|
| 149 | + if (debug >= 3) |
|---|
| 150 | + dprintk("> %*ph\n", len, data); |
|---|
| 151 | + |
|---|
| 152 | + memcpy(data, ttusb->send_buf, len); |
|---|
| 153 | + |
|---|
| 153 | 154 | err = usb_bulk_msg(ttusb->dev, ttusb->bulk_out_pipe, |
|---|
| 154 | | - (u8 *) data, len, &actual_len, 1000); |
|---|
| 155 | + ttusb->send_buf, len, &actual_len, 1000); |
|---|
| 155 | 156 | if (err != 0) { |
|---|
| 156 | | - dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n", |
|---|
| 157 | | - __func__, err); |
|---|
| 158 | | - mutex_unlock(&ttusb->semusb); |
|---|
| 159 | | - return err; |
|---|
| 157 | + dprintk("usb_bulk_msg(send) failed, err == %i!\n", err); |
|---|
| 158 | + goto err; |
|---|
| 160 | 159 | } |
|---|
| 161 | 160 | if (actual_len != len) { |
|---|
| 162 | | - dprintk("%s: only wrote %d of %d bytes\n", __func__, |
|---|
| 161 | + err = -EIO; |
|---|
| 162 | + dprintk("only wrote %d of %d bytes\n", |
|---|
| 163 | 163 | actual_len, len); |
|---|
| 164 | | - mutex_unlock(&ttusb->semusb); |
|---|
| 165 | | - return -1; |
|---|
| 164 | + goto err; |
|---|
| 166 | 165 | } |
|---|
| 167 | 166 | |
|---|
| 168 | 167 | err = usb_bulk_msg(ttusb->dev, ttusb->bulk_in_pipe, |
|---|
| 169 | | - ttusb->last_result, 32, &actual_len, 1000); |
|---|
| 168 | + ttusb->last_result, MAX_RCV, &actual_len, 1000); |
|---|
| 170 | 169 | |
|---|
| 171 | 170 | if (err != 0) { |
|---|
| 172 | | - printk("%s: failed, receive error %d\n", __func__, |
|---|
| 173 | | - err); |
|---|
| 174 | | - mutex_unlock(&ttusb->semusb); |
|---|
| 175 | | - return err; |
|---|
| 171 | + pr_err("cmd xter failed, receive error %d\n", err); |
|---|
| 172 | + goto err; |
|---|
| 176 | 173 | } |
|---|
| 177 | 174 | |
|---|
| 178 | 175 | if (debug >= 3) { |
|---|
| 179 | 176 | actual_len = ttusb->last_result[3] + 4; |
|---|
| 180 | | - printk(KERN_DEBUG "<"); |
|---|
| 181 | | - for (i = 0; i < actual_len; ++i) |
|---|
| 182 | | - printk(KERN_CONT " %02x", ttusb->last_result[i]); |
|---|
| 183 | | - printk(KERN_CONT "\n"); |
|---|
| 177 | + dprintk("< %*ph\n", actual_len, ttusb->last_result); |
|---|
| 184 | 178 | } |
|---|
| 185 | 179 | |
|---|
| 186 | | - if (!needresult) |
|---|
| 187 | | - mutex_unlock(&ttusb->semusb); |
|---|
| 188 | | - return 0; |
|---|
| 189 | | -} |
|---|
| 180 | + if (len_result) |
|---|
| 181 | + memcpy(ttusb->send_buf, ttusb->last_result, len_result); |
|---|
| 190 | 182 | |
|---|
| 191 | | -static int ttusb_result(struct ttusb *ttusb, u8 * data, int len) |
|---|
| 192 | | -{ |
|---|
| 193 | | - memcpy(data, ttusb->last_result, len); |
|---|
| 183 | +err: |
|---|
| 194 | 184 | mutex_unlock(&ttusb->semusb); |
|---|
| 195 | | - return 0; |
|---|
| 185 | + return err; |
|---|
| 196 | 186 | } |
|---|
| 197 | 187 | |
|---|
| 198 | 188 | static int ttusb_i2c_msg(struct ttusb *ttusb, |
|---|
| 199 | 189 | u8 addr, u8 * snd_buf, u8 snd_len, u8 * rcv_buf, |
|---|
| 200 | 190 | u8 rcv_len) |
|---|
| 201 | 191 | { |
|---|
| 202 | | - u8 b[0x28]; |
|---|
| 192 | + u8 b[MAX_SEND]; |
|---|
| 203 | 193 | u8 id = ++ttusb->c; |
|---|
| 204 | 194 | int i, err; |
|---|
| 205 | 195 | |
|---|
| 206 | | - if (snd_len > 0x28 - 7 || rcv_len > 0x20 - 7) |
|---|
| 196 | + if (snd_len > MAX_SEND - 7 || rcv_len > MAX_RCV - 7) |
|---|
| 207 | 197 | return -EINVAL; |
|---|
| 208 | 198 | |
|---|
| 209 | 199 | b[0] = 0xaa; |
|---|
| .. | .. |
|---|
| 217 | 207 | for (i = 0; i < snd_len; i++) |
|---|
| 218 | 208 | b[7 + i] = snd_buf[i]; |
|---|
| 219 | 209 | |
|---|
| 220 | | - err = ttusb_cmd(ttusb, b, snd_len + 7, 1); |
|---|
| 210 | + err = ttusb_cmd(ttusb, b, snd_len + 7, MAX_RCV); |
|---|
| 221 | 211 | |
|---|
| 222 | 212 | if (err) |
|---|
| 223 | 213 | return -EREMOTEIO; |
|---|
| 224 | | - |
|---|
| 225 | | - err = ttusb_result(ttusb, b, 0x20); |
|---|
| 226 | 214 | |
|---|
| 227 | 215 | /* check if the i2c transaction was successful */ |
|---|
| 228 | 216 | if ((snd_len != b[5]) || (rcv_len != b[6])) return -EREMOTEIO; |
|---|
| .. | .. |
|---|
| 230 | 218 | if (rcv_len > 0) { |
|---|
| 231 | 219 | |
|---|
| 232 | 220 | if (err || b[0] != 0x55 || b[1] != id) { |
|---|
| 233 | | - dprintk |
|---|
| 234 | | - ("%s: usb_bulk_msg(recv) failed, err == %i, id == %02x, b == ", |
|---|
| 235 | | - __func__, err, id); |
|---|
| 221 | + dprintk("usb_bulk_msg(recv) failed, err == %i, id == %02x, b == ", |
|---|
| 222 | + err, id); |
|---|
| 236 | 223 | return -EREMOTEIO; |
|---|
| 237 | 224 | } |
|---|
| 238 | 225 | |
|---|
| .. | .. |
|---|
| 276 | 263 | snd_buf, snd_len, rcv_buf, rcv_len); |
|---|
| 277 | 264 | |
|---|
| 278 | 265 | if (err < rcv_len) { |
|---|
| 279 | | - dprintk("%s: i == %i\n", __func__, i); |
|---|
| 266 | + dprintk("i == %i\n", i); |
|---|
| 280 | 267 | break; |
|---|
| 281 | 268 | } |
|---|
| 282 | 269 | |
|---|
| .. | .. |
|---|
| 296 | 283 | err = request_firmware(&fw, "ttusb-budget/dspbootcode.bin", |
|---|
| 297 | 284 | &ttusb->dev->dev); |
|---|
| 298 | 285 | if (err) { |
|---|
| 299 | | - printk(KERN_ERR "ttusb-budget: failed to request firmware\n"); |
|---|
| 286 | + pr_err("failed to request firmware\n"); |
|---|
| 300 | 287 | return err; |
|---|
| 301 | 288 | } |
|---|
| 302 | 289 | |
|---|
| .. | .. |
|---|
| 306 | 293 | b[3] = 28; |
|---|
| 307 | 294 | |
|---|
| 308 | 295 | /* upload dsp code in 32 byte steps (36 didn't work for me ...) */ |
|---|
| 309 | | - /* 32 is max packet size, no messages should be splitted. */ |
|---|
| 296 | + /* 32 is max packet size, no messages should be split. */ |
|---|
| 310 | 297 | for (i = 0; i < fw->size; i += 28) { |
|---|
| 311 | 298 | memcpy(&b[4], &fw->data[i], 28); |
|---|
| 312 | 299 | |
|---|
| .. | .. |
|---|
| 336 | 323 | done: |
|---|
| 337 | 324 | release_firmware(fw); |
|---|
| 338 | 325 | if (err) { |
|---|
| 339 | | - dprintk("%s: usb_bulk_msg() failed, return value %i!\n", |
|---|
| 340 | | - __func__, err); |
|---|
| 326 | + dprintk("usb_bulk_msg() failed, return value %i!\n", err); |
|---|
| 341 | 327 | } |
|---|
| 342 | 328 | |
|---|
| 343 | 329 | return err; |
|---|
| .. | .. |
|---|
| 404 | 390 | /* i2c write read: 5 bytes, addr 0x10, 0x02 bytes write, 1 bytes read. */ |
|---|
| 405 | 391 | u8 b3[] = |
|---|
| 406 | 392 | { 0xaa, ++ttusb->c, 0x31, 5, 0x10, 0x02, 0x01, 0x00, 0x1e }; |
|---|
| 407 | | - u8 b4[] = |
|---|
| 408 | | - { 0x55, ttusb->c, 0x31, 4, 0x10, 0x02, 0x01, 0x00, 0x1e }; |
|---|
| 409 | 393 | |
|---|
| 410 | 394 | u8 get_version[] = { 0xaa, ++ttusb->c, 0x17, 5, 0, 0, 0, 0, 0 }; |
|---|
| 411 | 395 | u8 get_dsp_version[0x20] = |
|---|
| .. | .. |
|---|
| 426 | 410 | if ((err = ttusb_cmd(ttusb, b2, sizeof(b2), 0))) |
|---|
| 427 | 411 | return err; |
|---|
| 428 | 412 | |
|---|
| 429 | | - if ((err = ttusb_cmd(ttusb, b3, sizeof(b3), 1))) |
|---|
| 413 | + if ((err = ttusb_cmd(ttusb, b3, sizeof(b3), 0))) |
|---|
| 430 | 414 | return err; |
|---|
| 431 | 415 | |
|---|
| 432 | | - err = ttusb_result(ttusb, b4, sizeof(b4)); |
|---|
| 433 | | - |
|---|
| 434 | | - if ((err = ttusb_cmd(ttusb, get_version, sizeof(get_version), 1))) |
|---|
| 416 | + if ((err = ttusb_cmd(ttusb, get_version, |
|---|
| 417 | + sizeof(get_version), sizeof(get_version)))) |
|---|
| 435 | 418 | return err; |
|---|
| 436 | 419 | |
|---|
| 437 | | - if ((err = ttusb_result(ttusb, get_version, sizeof(get_version)))) |
|---|
| 438 | | - return err; |
|---|
| 439 | | - |
|---|
| 440 | | - dprintk("%s: stc-version: %c%c%c%c%c\n", __func__, |
|---|
| 441 | | - get_version[4], get_version[5], get_version[6], |
|---|
| 442 | | - get_version[7], get_version[8]); |
|---|
| 420 | + dprintk("stc-version: %c%c%c%c%c\n", get_version[4], get_version[5], |
|---|
| 421 | + get_version[6], get_version[7], get_version[8]); |
|---|
| 443 | 422 | |
|---|
| 444 | 423 | if (memcmp(get_version + 4, "V 0.0", 5) && |
|---|
| 445 | 424 | memcmp(get_version + 4, "V 1.1", 5) && |
|---|
| 446 | 425 | memcmp(get_version + 4, "V 2.1", 5) && |
|---|
| 447 | 426 | memcmp(get_version + 4, "V 2.2", 5)) { |
|---|
| 448 | | - printk |
|---|
| 449 | | - ("%s: unknown STC version %c%c%c%c%c, please report!\n", |
|---|
| 450 | | - __func__, get_version[4], get_version[5], |
|---|
| 451 | | - get_version[6], get_version[7], get_version[8]); |
|---|
| 427 | + pr_err("unknown STC version %c%c%c%c%c, please report!\n", |
|---|
| 428 | + get_version[4], get_version[5], |
|---|
| 429 | + get_version[6], get_version[7], get_version[8]); |
|---|
| 452 | 430 | } |
|---|
| 453 | 431 | |
|---|
| 454 | 432 | ttusb->revision = ((get_version[6] - '0') << 4) | |
|---|
| 455 | 433 | (get_version[8] - '0'); |
|---|
| 456 | 434 | |
|---|
| 457 | 435 | err = |
|---|
| 458 | | - ttusb_cmd(ttusb, get_dsp_version, sizeof(get_dsp_version), 1); |
|---|
| 436 | + ttusb_cmd(ttusb, get_dsp_version, |
|---|
| 437 | + sizeof(get_dsp_version), sizeof(get_dsp_version)); |
|---|
| 459 | 438 | if (err) |
|---|
| 460 | 439 | return err; |
|---|
| 461 | 440 | |
|---|
| 462 | | - err = |
|---|
| 463 | | - ttusb_result(ttusb, get_dsp_version, sizeof(get_dsp_version)); |
|---|
| 464 | | - if (err) |
|---|
| 465 | | - return err; |
|---|
| 466 | | - printk("%s: dsp-version: %c%c%c\n", __func__, |
|---|
| 441 | + pr_info("dsp-version: %c%c%c\n", |
|---|
| 467 | 442 | get_dsp_version[4], get_dsp_version[5], get_dsp_version[6]); |
|---|
| 468 | 443 | return 0; |
|---|
| 469 | 444 | } |
|---|
| .. | .. |
|---|
| 485 | 460 | |
|---|
| 486 | 461 | /* Diseqc */ |
|---|
| 487 | 462 | if ((err = ttusb_cmd(ttusb, b, 4 + b[3], 0))) { |
|---|
| 488 | | - dprintk("%s: usb_bulk_msg() failed, return value %i!\n", |
|---|
| 489 | | - __func__, err); |
|---|
| 463 | + dprintk("usb_bulk_msg() failed, return value %i!\n", err); |
|---|
| 490 | 464 | } |
|---|
| 491 | 465 | |
|---|
| 492 | 466 | return err; |
|---|
| .. | .. |
|---|
| 503 | 477 | |
|---|
| 504 | 478 | /* SetLNB */ |
|---|
| 505 | 479 | if ((err = ttusb_cmd(ttusb, b, sizeof(b), 0))) { |
|---|
| 506 | | - dprintk("%s: usb_bulk_msg() failed, return value %i!\n", |
|---|
| 507 | | - __func__, err); |
|---|
| 480 | + dprintk("usb_bulk_msg() failed, return value %i!\n", err); |
|---|
| 508 | 481 | } |
|---|
| 509 | 482 | |
|---|
| 510 | 483 | return err; |
|---|
| .. | .. |
|---|
| 538 | 511 | |
|---|
| 539 | 512 | err = ttusb_cmd(ttusb, b, sizeof(b), 0); |
|---|
| 540 | 513 | if (err) { |
|---|
| 541 | | - dprintk("%s: usb_bulk_msg() failed, return value %i!\n", |
|---|
| 542 | | - __func__, err); |
|---|
| 514 | + dprintk("usb_bulk_msg() failed, return value %i!\n", err); |
|---|
| 543 | 515 | } |
|---|
| 544 | 516 | } |
|---|
| 545 | 517 | #endif |
|---|
| .. | .. |
|---|
| 563 | 535 | int i; |
|---|
| 564 | 536 | |
|---|
| 565 | 537 | if (len < 4 || len & 0x1) { |
|---|
| 566 | | - pr_warn("%s: muxpack has invalid len %d\n", __func__, len); |
|---|
| 538 | + pr_warn("muxpack has invalid len %d\n", len); |
|---|
| 567 | 539 | numinvalid++; |
|---|
| 568 | 540 | return; |
|---|
| 569 | 541 | } |
|---|
| .. | .. |
|---|
| 571 | 543 | for (i = 0; i < len; i += 2) |
|---|
| 572 | 544 | csum ^= le16_to_cpup((__le16 *) (muxpack + i)); |
|---|
| 573 | 545 | if (csum) { |
|---|
| 574 | | - printk("%s: muxpack with incorrect checksum, ignoring\n", |
|---|
| 575 | | - __func__); |
|---|
| 546 | + pr_warn("muxpack with incorrect checksum, ignoring\n"); |
|---|
| 576 | 547 | numinvalid++; |
|---|
| 577 | 548 | return; |
|---|
| 578 | 549 | } |
|---|
| .. | .. |
|---|
| 580 | 551 | cc = (muxpack[len - 4] << 8) | muxpack[len - 3]; |
|---|
| 581 | 552 | cc &= 0x7FFF; |
|---|
| 582 | 553 | if ((cc != ttusb->cc) && (ttusb->cc != -1)) |
|---|
| 583 | | - printk("%s: cc discontinuity (%d frames missing)\n", |
|---|
| 584 | | - __func__, (cc - ttusb->cc) & 0x7FFF); |
|---|
| 554 | + pr_warn("cc discontinuity (%d frames missing)\n", |
|---|
| 555 | + (cc - ttusb->cc) & 0x7FFF); |
|---|
| 585 | 556 | ttusb->cc = (cc + 1) & 0x7FFF; |
|---|
| 586 | 557 | if (muxpack[0] & 0x80) { |
|---|
| 587 | 558 | #ifdef TTUSB_HWSECTIONS |
|---|
| .. | .. |
|---|
| 602 | 573 | !!(ttusb->muxpack[1] & 1)) |
|---|
| 603 | 574 | data++; |
|---|
| 604 | 575 | #warning TODO: pusi |
|---|
| 605 | | - printk("cc: %04x\n", (data[0] << 8) | data[1]); |
|---|
| 576 | + dprintk("cc: %04x\n", (data[0] << 8) | data[1]); |
|---|
| 606 | 577 | #endif |
|---|
| 607 | 578 | numsec++; |
|---|
| 608 | 579 | } else if (muxpack[0] == 0x47) { |
|---|
| .. | .. |
|---|
| 621 | 592 | dvb_dmx_swfilter_packets(&ttusb->dvb_demux, muxpack, 1); |
|---|
| 622 | 593 | } else if (muxpack[0] != 0) { |
|---|
| 623 | 594 | numinvalid++; |
|---|
| 624 | | - printk("illegal muxpack type %02x\n", muxpack[0]); |
|---|
| 595 | + pr_err("illegal muxpack type %02x\n", muxpack[0]); |
|---|
| 625 | 596 | } else |
|---|
| 626 | 597 | numstuff++; |
|---|
| 627 | 598 | } |
|---|
| .. | .. |
|---|
| 631 | 602 | int maxwork = 1024; |
|---|
| 632 | 603 | while (len) { |
|---|
| 633 | 604 | if (!(maxwork--)) { |
|---|
| 634 | | - printk("%s: too much work\n", __func__); |
|---|
| 605 | + pr_err("too much work\n"); |
|---|
| 635 | 606 | break; |
|---|
| 636 | 607 | } |
|---|
| 637 | 608 | |
|---|
| .. | .. |
|---|
| 645 | 616 | else { |
|---|
| 646 | 617 | ttusb->mux_state = 0; |
|---|
| 647 | 618 | if (ttusb->insync) { |
|---|
| 648 | | - dprintk("%s: %02x\n", |
|---|
| 649 | | - __func__, data[-1]); |
|---|
| 650 | | - printk(KERN_INFO "%s: lost sync.\n", |
|---|
| 651 | | - __func__); |
|---|
| 619 | + pr_info("lost sync.\n"); |
|---|
| 652 | 620 | ttusb->insync = 0; |
|---|
| 653 | 621 | } |
|---|
| 654 | 622 | } |
|---|
| .. | .. |
|---|
| 704 | 672 | ttusb->muxpack[1] + 2 + |
|---|
| 705 | 673 | 4; |
|---|
| 706 | 674 | else { |
|---|
| 707 | | - dprintk |
|---|
| 708 | | - ("%s: invalid state: first byte is %x\n", |
|---|
| 709 | | - __func__, |
|---|
| 710 | | - ttusb->muxpack[0]); |
|---|
| 675 | + dprintk("invalid state: first byte is %x\n", |
|---|
| 676 | + ttusb->muxpack[0]); |
|---|
| 711 | 677 | ttusb->mux_state = 0; |
|---|
| 712 | 678 | } |
|---|
| 713 | 679 | } |
|---|
| .. | .. |
|---|
| 755 | 721 | |
|---|
| 756 | 722 | if (!ttusb->iso_streaming) |
|---|
| 757 | 723 | return; |
|---|
| 758 | | - |
|---|
| 759 | | -#if 0 |
|---|
| 760 | | - printk("%s: status %d, errcount == %d, length == %i\n", |
|---|
| 761 | | - __func__, |
|---|
| 762 | | - urb->status, urb->error_count, urb->actual_length); |
|---|
| 763 | | -#endif |
|---|
| 764 | 724 | |
|---|
| 765 | 725 | if (!urb->status) { |
|---|
| 766 | 726 | for (i = 0; i < urb->number_of_packets; ++i) { |
|---|
| .. | .. |
|---|
| 834 | 794 | int i, j, err, buffer_offset = 0; |
|---|
| 835 | 795 | |
|---|
| 836 | 796 | if (ttusb->iso_streaming) { |
|---|
| 837 | | - printk("%s: iso xfer already running!\n", __func__); |
|---|
| 797 | + pr_err("iso xfer already running!\n"); |
|---|
| 838 | 798 | return 0; |
|---|
| 839 | 799 | } |
|---|
| 840 | 800 | |
|---|
| .. | .. |
|---|
| 868 | 828 | for (i = 0; i < ISO_BUF_COUNT; i++) { |
|---|
| 869 | 829 | if ((err = usb_submit_urb(ttusb->iso_urb[i], GFP_ATOMIC))) { |
|---|
| 870 | 830 | ttusb_stop_iso_xfer(ttusb); |
|---|
| 871 | | - printk |
|---|
| 872 | | - ("%s: failed urb submission (%i: err = %i)!\n", |
|---|
| 873 | | - __func__, i, err); |
|---|
| 831 | + pr_err("failed urb submission (%i: err = %i)!\n", |
|---|
| 832 | + i, err); |
|---|
| 874 | 833 | return err; |
|---|
| 875 | 834 | } |
|---|
| 876 | 835 | } |
|---|
| .. | .. |
|---|
| 1430 | 1389 | if (fe->ops.i2c_gate_ctrl) |
|---|
| 1431 | 1390 | fe->ops.i2c_gate_ctrl(fe, 1); |
|---|
| 1432 | 1391 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { |
|---|
| 1433 | | - printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 1\n"); |
|---|
| 1392 | + pr_err("dvbc_philips_tdm1316l_pll_set Error 1\n"); |
|---|
| 1434 | 1393 | return -EIO; |
|---|
| 1435 | 1394 | } |
|---|
| 1436 | 1395 | |
|---|
| .. | .. |
|---|
| 1439 | 1398 | if (fe->ops.i2c_gate_ctrl) |
|---|
| 1440 | 1399 | fe->ops.i2c_gate_ctrl(fe, 1); |
|---|
| 1441 | 1400 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { |
|---|
| 1442 | | - printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 2\n"); |
|---|
| 1401 | + pr_err("dvbc_philips_tdm1316l_pll_set Error 2\n"); |
|---|
| 1443 | 1402 | return -EIO; |
|---|
| 1444 | 1403 | } |
|---|
| 1445 | 1404 | |
|---|
| .. | .. |
|---|
| 1616 | 1575 | } |
|---|
| 1617 | 1576 | |
|---|
| 1618 | 1577 | if (ttusb->fe == NULL) { |
|---|
| 1619 | | - printk("dvb-ttusb-budget: A frontend driver was not found for device [%04x:%04x]\n", |
|---|
| 1578 | + pr_err("no frontend driver found for device [%04x:%04x]\n", |
|---|
| 1620 | 1579 | le16_to_cpu(ttusb->dev->descriptor.idVendor), |
|---|
| 1621 | 1580 | le16_to_cpu(ttusb->dev->descriptor.idProduct)); |
|---|
| 1622 | 1581 | } else { |
|---|
| 1623 | 1582 | if (dvb_register_frontend(&ttusb->adapter, ttusb->fe)) { |
|---|
| 1624 | | - printk("dvb-ttusb-budget: Frontend registration failed!\n"); |
|---|
| 1583 | + pr_err("Frontend registration failed!\n"); |
|---|
| 1625 | 1584 | dvb_frontend_detach(ttusb->fe); |
|---|
| 1626 | 1585 | ttusb->fe = NULL; |
|---|
| 1627 | 1586 | } |
|---|
| .. | .. |
|---|
| 1641 | 1600 | struct ttusb *ttusb; |
|---|
| 1642 | 1601 | int result; |
|---|
| 1643 | 1602 | |
|---|
| 1644 | | - dprintk("%s: TTUSB DVB connected\n", __func__); |
|---|
| 1603 | + dprintk("TTUSB DVB connected\n"); |
|---|
| 1645 | 1604 | |
|---|
| 1646 | 1605 | udev = interface_to_usbdev(intf); |
|---|
| 1647 | 1606 | |
|---|
| .. | .. |
|---|
| 1663 | 1622 | |
|---|
| 1664 | 1623 | result = ttusb_alloc_iso_urbs(ttusb); |
|---|
| 1665 | 1624 | if (result < 0) { |
|---|
| 1666 | | - dprintk("%s: ttusb_alloc_iso_urbs - failed\n", __func__); |
|---|
| 1625 | + dprintk("ttusb_alloc_iso_urbs - failed\n"); |
|---|
| 1667 | 1626 | mutex_unlock(&ttusb->semi2c); |
|---|
| 1668 | 1627 | kfree(ttusb); |
|---|
| 1669 | 1628 | return result; |
|---|
| 1670 | 1629 | } |
|---|
| 1671 | 1630 | |
|---|
| 1672 | 1631 | if (ttusb_init_controller(ttusb)) |
|---|
| 1673 | | - printk("ttusb_init_controller: error\n"); |
|---|
| 1632 | + pr_err("ttusb_init_controller: error\n"); |
|---|
| 1674 | 1633 | |
|---|
| 1675 | 1634 | mutex_unlock(&ttusb->semi2c); |
|---|
| 1676 | 1635 | |
|---|
| .. | .. |
|---|
| 1686 | 1645 | |
|---|
| 1687 | 1646 | /* i2c */ |
|---|
| 1688 | 1647 | memset(&ttusb->i2c_adap, 0, sizeof(struct i2c_adapter)); |
|---|
| 1689 | | - strcpy(ttusb->i2c_adap.name, "TTUSB DEC"); |
|---|
| 1648 | + strscpy(ttusb->i2c_adap.name, "TTUSB DEC", sizeof(ttusb->i2c_adap.name)); |
|---|
| 1690 | 1649 | |
|---|
| 1691 | 1650 | i2c_set_adapdata(&ttusb->i2c_adap, ttusb); |
|---|
| 1692 | 1651 | |
|---|
| .. | .. |
|---|
| 1715 | 1674 | |
|---|
| 1716 | 1675 | result = dvb_dmx_init(&ttusb->dvb_demux); |
|---|
| 1717 | 1676 | if (result < 0) { |
|---|
| 1718 | | - printk("ttusb_dvb: dvb_dmx_init failed (errno = %d)\n", result); |
|---|
| 1677 | + pr_err("dvb_dmx_init failed (errno = %d)\n", result); |
|---|
| 1719 | 1678 | result = -ENODEV; |
|---|
| 1720 | 1679 | goto err_i2c_del_adapter; |
|---|
| 1721 | 1680 | } |
|---|
| .. | .. |
|---|
| 1726 | 1685 | |
|---|
| 1727 | 1686 | result = dvb_dmxdev_init(&ttusb->dmxdev, &ttusb->adapter); |
|---|
| 1728 | 1687 | if (result < 0) { |
|---|
| 1729 | | - printk("ttusb_dvb: dvb_dmxdev_init failed (errno = %d)\n", |
|---|
| 1688 | + pr_err("dvb_dmxdev_init failed (errno = %d)\n", |
|---|
| 1730 | 1689 | result); |
|---|
| 1731 | 1690 | result = -ENODEV; |
|---|
| 1732 | 1691 | goto err_release_dmx; |
|---|
| 1733 | 1692 | } |
|---|
| 1734 | 1693 | |
|---|
| 1735 | 1694 | if (dvb_net_init(&ttusb->adapter, &ttusb->dvbnet, &ttusb->dvb_demux.dmx)) { |
|---|
| 1736 | | - printk("ttusb_dvb: dvb_net_init failed!\n"); |
|---|
| 1695 | + pr_err("dvb_net_init failed!\n"); |
|---|
| 1737 | 1696 | result = -ENODEV; |
|---|
| 1738 | 1697 | goto err_release_dmxdev; |
|---|
| 1739 | 1698 | } |
|---|
| .. | .. |
|---|
| 1782 | 1741 | |
|---|
| 1783 | 1742 | kfree(ttusb); |
|---|
| 1784 | 1743 | |
|---|
| 1785 | | - dprintk("%s: TTUSB DVB disconnected\n", __func__); |
|---|
| 1744 | + dprintk("TTUSB DVB disconnected\n"); |
|---|
| 1786 | 1745 | } |
|---|
| 1787 | 1746 | |
|---|
| 1788 | 1747 | static const struct usb_device_id ttusb_table[] = { |
|---|