.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * driver for the SAA7146 based AV110 cards (like the Fujitsu-Siemens DVB) |
---|
3 | 4 | * av7110.c: initialization and demux stuff |
---|
.. | .. |
---|
7 | 8 | * |
---|
8 | 9 | * originally based on code by: |
---|
9 | 10 | * Copyright (C) 1998,1999 Christian Theiss <mistert@rz.fh-augsburg.de> |
---|
10 | | - * |
---|
11 | | - * This program is free software; you can redistribute it and/or |
---|
12 | | - * modify it under the terms of the GNU General Public License |
---|
13 | | - * as published by the Free Software Foundation; either version 2 |
---|
14 | | - * of the License, or (at your option) any later version. |
---|
15 | | - * |
---|
16 | | - * |
---|
17 | | - * This program is distributed in the hope that it will be useful, |
---|
18 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
19 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
20 | | - * GNU General Public License for more details. |
---|
21 | | - * |
---|
22 | | - * To obtain the license, point your browser to |
---|
23 | | - * http://www.gnu.org/copyleft/gpl.html |
---|
24 | | - * |
---|
25 | 11 | * |
---|
26 | 12 | * the project's page is at https://linuxtv.org |
---|
27 | 13 | */ |
---|
.. | .. |
---|
232 | 218 | restart_feeds(av7110); |
---|
233 | 219 | |
---|
234 | 220 | #if IS_ENABLED(CONFIG_DVB_AV7110_IR) |
---|
235 | | - av7110_check_ir_config(av7110, true); |
---|
| 221 | + av7110_set_ir_config(av7110); |
---|
236 | 222 | #endif |
---|
237 | 223 | } |
---|
238 | 224 | |
---|
.. | .. |
---|
263 | 249 | |
---|
264 | 250 | if (!av7110->arm_ready) |
---|
265 | 251 | continue; |
---|
266 | | - |
---|
267 | | -#if IS_ENABLED(CONFIG_DVB_AV7110_IR) |
---|
268 | | - av7110_check_ir_config(av7110, false); |
---|
269 | | -#endif |
---|
270 | 252 | |
---|
271 | 253 | if (mutex_lock_interruptible(&av7110->dcomlock)) |
---|
272 | 254 | break; |
---|
.. | .. |
---|
375 | 357 | irdebi(av7110, DEBISWAB, addr, 0, len); |
---|
376 | 358 | } |
---|
377 | 359 | |
---|
378 | | -static void debiirq(unsigned long cookie) |
---|
| 360 | +static void debiirq(struct tasklet_struct *t) |
---|
379 | 361 | { |
---|
380 | | - struct av7110 *av7110 = (struct av7110 *)cookie; |
---|
| 362 | + struct av7110 *av7110 = from_tasklet(av7110, t, debi_tasklet); |
---|
381 | 363 | int type = av7110->debitype; |
---|
382 | 364 | int handle = (type >> 8) & 0x1f; |
---|
383 | 365 | unsigned int xfer = 0; |
---|
.. | .. |
---|
476 | 458 | } |
---|
477 | 459 | |
---|
478 | 460 | /* irq from av7110 firmware writing the mailbox register in the DPRAM */ |
---|
479 | | -static void gpioirq(unsigned long cookie) |
---|
| 461 | +static void gpioirq(struct tasklet_struct *t) |
---|
480 | 462 | { |
---|
481 | | - struct av7110 *av7110 = (struct av7110 *)cookie; |
---|
| 463 | + struct av7110 *av7110 = from_tasklet(av7110, t, gpio_tasklet); |
---|
482 | 464 | u32 rxbuf, txbuf; |
---|
483 | 465 | int len; |
---|
484 | 466 | |
---|
.. | .. |
---|
655 | 637 | iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2); |
---|
656 | 638 | break; |
---|
657 | 639 | } |
---|
658 | | - /* fall through */ |
---|
| 640 | + fallthrough; |
---|
659 | 641 | |
---|
660 | 642 | case DATA_TS_RECORD: |
---|
661 | 643 | case DATA_PES_RECORD: |
---|
.. | .. |
---|
674 | 656 | return; |
---|
675 | 657 | |
---|
676 | 658 | case DATA_IRCOMMAND: |
---|
677 | | - if (av7110->ir.ir_handler) |
---|
678 | | - av7110->ir.ir_handler(av7110, |
---|
679 | | - swahw32(irdebi(av7110, DEBINOSWAP, Reserved, 0, 4))); |
---|
| 659 | +#if IS_ENABLED(CONFIG_DVB_AV7110_IR) |
---|
| 660 | + av7110_ir_handler(av7110, |
---|
| 661 | + swahw32(irdebi(av7110, DEBINOSWAP, Reserved, |
---|
| 662 | + 0, 4))); |
---|
| 663 | +#endif |
---|
680 | 664 | iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2); |
---|
681 | 665 | break; |
---|
682 | 666 | |
---|
.. | .. |
---|
1246 | 1230 | return status; |
---|
1247 | 1231 | } |
---|
1248 | 1232 | |
---|
1249 | | -static void vpeirq(unsigned long cookie) |
---|
| 1233 | +static void vpeirq(struct tasklet_struct *t) |
---|
1250 | 1234 | { |
---|
1251 | | - struct av7110 *budget = (struct av7110 *)cookie; |
---|
| 1235 | + struct av7110 *budget = from_tasklet(budget, t, vpe_tasklet); |
---|
1252 | 1236 | u8 *mem = (u8 *) (budget->grabbing); |
---|
1253 | 1237 | u32 olddma = budget->ttbp; |
---|
1254 | 1238 | u32 newdma = saa7146_read(budget->dev, PCI_VDP3); |
---|
.. | .. |
---|
2192 | 2176 | break; |
---|
2193 | 2177 | } |
---|
2194 | 2178 | } |
---|
2195 | | - /* fall-thru */ |
---|
| 2179 | + fallthrough; |
---|
2196 | 2180 | |
---|
2197 | 2181 | case 0x0008: // Hauppauge/TT DVB-T |
---|
2198 | 2182 | // Grundig 29504-401 |
---|
.. | .. |
---|
2314 | 2298 | * (n in defined in the RPS_THRESH1 counter threshold) |
---|
2315 | 2299 | * I think HS is raised high on the beginning of the n-th line |
---|
2316 | 2300 | * and remains high until this n-th line that triggered |
---|
2317 | | - * it is completely received. When the receiption of n-th line |
---|
| 2301 | + * it is completely received. When the reception of n-th line |
---|
2318 | 2302 | * ends, HS is lowered. |
---|
2319 | 2303 | * |
---|
2320 | 2304 | * To transmit data over DMA, 7146 needs changing state at |
---|
.. | .. |
---|
2348 | 2332 | * hardware debug note: a working budget card (including budget patch) |
---|
2349 | 2333 | * with vpeirq() interrupt setup in mode "0x90" (every 64K) will |
---|
2350 | 2334 | * generate 3 interrupts per 25-Hz DMA frame of 2*188*512 bytes |
---|
2351 | | - * and that means 3*25=75 Hz of interrupt freqency, as seen by |
---|
| 2335 | + * and that means 3*25=75 Hz of interrupt frequency, as seen by |
---|
2352 | 2336 | * watch cat /proc/interrupts |
---|
2353 | 2337 | * |
---|
2354 | 2338 | * If this frequency is 3x lower (and data received in the DMA |
---|
.. | .. |
---|
2357 | 2341 | * this means VSYNC line is not connected in the hardware. |
---|
2358 | 2342 | * (check soldering pcb and pins) |
---|
2359 | 2343 | * The same behaviour of missing VSYNC can be duplicated on budget |
---|
2360 | | - * cards, by seting DD1_INIT trigger mode 7 in 3rd nibble. |
---|
| 2344 | + * cards, by setting DD1_INIT trigger mode 7 in 3rd nibble. |
---|
2361 | 2345 | */ |
---|
2362 | 2346 | static int av7110_attach(struct saa7146_dev* dev, |
---|
2363 | 2347 | struct saa7146_pci_extension_data *pci_ext) |
---|
.. | .. |
---|
2483 | 2467 | get recognized before the main driver is fully loaded */ |
---|
2484 | 2468 | saa7146_write(dev, GPIO_CTRL, 0x500000); |
---|
2485 | 2469 | |
---|
2486 | | - strlcpy(av7110->i2c_adap.name, pci_ext->ext_priv, sizeof(av7110->i2c_adap.name)); |
---|
| 2470 | + strscpy(av7110->i2c_adap.name, pci_ext->ext_priv, |
---|
| 2471 | + sizeof(av7110->i2c_adap.name)); |
---|
2487 | 2472 | |
---|
2488 | 2473 | saa7146_i2c_adapter_prepare(dev, &av7110->i2c_adap, SAA7146_I2C_BUS_BIT_RATE_120); /* 275 kHz */ |
---|
2489 | 2474 | |
---|
.. | .. |
---|
2533 | 2518 | saa7146_write(dev, NUM_LINE_BYTE3, (TS_HEIGHT << 16) | TS_WIDTH); |
---|
2534 | 2519 | saa7146_write(dev, MC2, MASK_04 | MASK_20); |
---|
2535 | 2520 | |
---|
2536 | | - tasklet_init(&av7110->vpe_tasklet, vpeirq, (unsigned long) av7110); |
---|
| 2521 | + tasklet_setup(&av7110->vpe_tasklet, vpeirq); |
---|
2537 | 2522 | |
---|
2538 | 2523 | } else if (budgetpatch) { |
---|
2539 | 2524 | spin_lock_init(&av7110->feedlock1); |
---|
.. | .. |
---|
2614 | 2599 | saa7146_write(dev, MC1, (MASK_13 | MASK_29)); |
---|
2615 | 2600 | |
---|
2616 | 2601 | /* end of budgetpatch register initialization */ |
---|
2617 | | - tasklet_init (&av7110->vpe_tasklet, vpeirq, (unsigned long) av7110); |
---|
| 2602 | + tasklet_setup(&av7110->vpe_tasklet, vpeirq); |
---|
2618 | 2603 | } else { |
---|
2619 | 2604 | saa7146_write(dev, PCI_BT_V1, 0x1c00101f); |
---|
2620 | 2605 | saa7146_write(dev, BCS_CTRL, 0x80400040); |
---|
.. | .. |
---|
2629 | 2614 | saa7146_write(dev, GPIO_CTRL, 0x000000); |
---|
2630 | 2615 | } |
---|
2631 | 2616 | |
---|
2632 | | - tasklet_init (&av7110->debi_tasklet, debiirq, (unsigned long) av7110); |
---|
2633 | | - tasklet_init (&av7110->gpio_tasklet, gpioirq, (unsigned long) av7110); |
---|
| 2617 | + tasklet_setup(&av7110->debi_tasklet, debiirq); |
---|
| 2618 | + tasklet_setup(&av7110->gpio_tasklet, gpioirq); |
---|
2634 | 2619 | |
---|
2635 | 2620 | mutex_init(&av7110->pid_mutex); |
---|
2636 | 2621 | |
---|