hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/media/pci/ttpci/av7110.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * driver for the SAA7146 based AV110 cards (like the Fujitsu-Siemens DVB)
34 * av7110.c: initialization and demux stuff
....@@ -7,21 +8,6 @@
78 *
89 * originally based on code by:
910 * 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
- *
2511 *
2612 * the project's page is at https://linuxtv.org
2713 */
....@@ -232,7 +218,7 @@
232218 restart_feeds(av7110);
233219
234220 #if IS_ENABLED(CONFIG_DVB_AV7110_IR)
235
- av7110_check_ir_config(av7110, true);
221
+ av7110_set_ir_config(av7110);
236222 #endif
237223 }
238224
....@@ -263,10 +249,6 @@
263249
264250 if (!av7110->arm_ready)
265251 continue;
266
-
267
-#if IS_ENABLED(CONFIG_DVB_AV7110_IR)
268
- av7110_check_ir_config(av7110, false);
269
-#endif
270252
271253 if (mutex_lock_interruptible(&av7110->dcomlock))
272254 break;
....@@ -375,9 +357,9 @@
375357 irdebi(av7110, DEBISWAB, addr, 0, len);
376358 }
377359
378
-static void debiirq(unsigned long cookie)
360
+static void debiirq(struct tasklet_struct *t)
379361 {
380
- struct av7110 *av7110 = (struct av7110 *)cookie;
362
+ struct av7110 *av7110 = from_tasklet(av7110, t, debi_tasklet);
381363 int type = av7110->debitype;
382364 int handle = (type >> 8) & 0x1f;
383365 unsigned int xfer = 0;
....@@ -476,9 +458,9 @@
476458 }
477459
478460 /* 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)
480462 {
481
- struct av7110 *av7110 = (struct av7110 *)cookie;
463
+ struct av7110 *av7110 = from_tasklet(av7110, t, gpio_tasklet);
482464 u32 rxbuf, txbuf;
483465 int len;
484466
....@@ -655,7 +637,7 @@
655637 iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);
656638 break;
657639 }
658
- /* fall through */
640
+ fallthrough;
659641
660642 case DATA_TS_RECORD:
661643 case DATA_PES_RECORD:
....@@ -674,9 +656,11 @@
674656 return;
675657
676658 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
680664 iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);
681665 break;
682666
....@@ -1246,9 +1230,9 @@
12461230 return status;
12471231 }
12481232
1249
-static void vpeirq(unsigned long cookie)
1233
+static void vpeirq(struct tasklet_struct *t)
12501234 {
1251
- struct av7110 *budget = (struct av7110 *)cookie;
1235
+ struct av7110 *budget = from_tasklet(budget, t, vpe_tasklet);
12521236 u8 *mem = (u8 *) (budget->grabbing);
12531237 u32 olddma = budget->ttbp;
12541238 u32 newdma = saa7146_read(budget->dev, PCI_VDP3);
....@@ -2192,7 +2176,7 @@
21922176 break;
21932177 }
21942178 }
2195
- /* fall-thru */
2179
+ fallthrough;
21962180
21972181 case 0x0008: // Hauppauge/TT DVB-T
21982182 // Grundig 29504-401
....@@ -2314,7 +2298,7 @@
23142298 * (n in defined in the RPS_THRESH1 counter threshold)
23152299 * I think HS is raised high on the beginning of the n-th line
23162300 * 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
23182302 * ends, HS is lowered.
23192303 *
23202304 * To transmit data over DMA, 7146 needs changing state at
....@@ -2348,7 +2332,7 @@
23482332 * hardware debug note: a working budget card (including budget patch)
23492333 * with vpeirq() interrupt setup in mode "0x90" (every 64K) will
23502334 * 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
23522336 * watch cat /proc/interrupts
23532337 *
23542338 * If this frequency is 3x lower (and data received in the DMA
....@@ -2357,7 +2341,7 @@
23572341 * this means VSYNC line is not connected in the hardware.
23582342 * (check soldering pcb and pins)
23592343 * 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.
23612345 */
23622346 static int av7110_attach(struct saa7146_dev* dev,
23632347 struct saa7146_pci_extension_data *pci_ext)
....@@ -2483,7 +2467,8 @@
24832467 get recognized before the main driver is fully loaded */
24842468 saa7146_write(dev, GPIO_CTRL, 0x500000);
24852469
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));
24872472
24882473 saa7146_i2c_adapter_prepare(dev, &av7110->i2c_adap, SAA7146_I2C_BUS_BIT_RATE_120); /* 275 kHz */
24892474
....@@ -2533,7 +2518,7 @@
25332518 saa7146_write(dev, NUM_LINE_BYTE3, (TS_HEIGHT << 16) | TS_WIDTH);
25342519 saa7146_write(dev, MC2, MASK_04 | MASK_20);
25352520
2536
- tasklet_init(&av7110->vpe_tasklet, vpeirq, (unsigned long) av7110);
2521
+ tasklet_setup(&av7110->vpe_tasklet, vpeirq);
25372522
25382523 } else if (budgetpatch) {
25392524 spin_lock_init(&av7110->feedlock1);
....@@ -2614,7 +2599,7 @@
26142599 saa7146_write(dev, MC1, (MASK_13 | MASK_29));
26152600
26162601 /* end of budgetpatch register initialization */
2617
- tasklet_init (&av7110->vpe_tasklet, vpeirq, (unsigned long) av7110);
2602
+ tasklet_setup(&av7110->vpe_tasklet, vpeirq);
26182603 } else {
26192604 saa7146_write(dev, PCI_BT_V1, 0x1c00101f);
26202605 saa7146_write(dev, BCS_CTRL, 0x80400040);
....@@ -2629,8 +2614,8 @@
26292614 saa7146_write(dev, GPIO_CTRL, 0x000000);
26302615 }
26312616
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);
26342619
26352620 mutex_init(&av7110->pid_mutex);
26362621