forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/media/dvb-frontends/dib7000p.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Linux-DVB Driver for DiBcom's second generation DiB7000P (PC).
34 *
45 * Copyright (C) 2005-7 DiBcom (http://www.dibcom.fr/)
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License as
8
- * published by the Free Software Foundation, version 2.
96 */
107
118 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -94,7 +91,7 @@
9491 DIB7000P_POWER_INTERFACE_ONLY,
9592 };
9693
97
-/* dib7090 specific fonctions */
94
+/* dib7090 specific functions */
9895 static int dib7090_set_output_mode(struct dvb_frontend *fe, int mode);
9996 static int dib7090_set_diversity_in(struct dvb_frontend *fe, int onoff);
10097 static void dib7090_setDibTxMux(struct dib7000p_state *state, int mode);
....@@ -279,7 +276,7 @@
279276 if (state->version != SOC7090)
280277 reg_1280 &= ~((1 << 11));
281278 reg_1280 &= ~(1 << 6);
282
- /* fall-through */
279
+ fallthrough;
283280 case DIB7000P_POWER_INTERFACE_ONLY:
284281 /* just leave power on the control-interfaces: GPIO and (I2C or SDIO) */
285282 /* TODO power up either SDIO or I2C */
....@@ -319,7 +316,7 @@
319316
320317 dib7000p_write_word(state, 1925, reg | (1 << 4) | (1 << 2)); /* en_slowAdc = 1 & reset_sladc = 1 */
321318
322
- reg = dib7000p_read_word(state, 1925); /* read acces to make it works... strange ... */
319
+ reg = dib7000p_read_word(state, 1925); /* read access to make it works... strange ... */
323320 msleep(200);
324321 dib7000p_write_word(state, 1925, reg & ~(1 << 4)); /* en_slowAdc = 1 & reset_sladc = 0 */
325322
....@@ -918,7 +915,7 @@
918915
919916 dib7000p_restart_agc(state);
920917
921
- dprintk("SPLIT %p: %hd\n", demod, agc_split);
918
+ dprintk("SPLIT %p: %u\n", demod, agc_split);
922919
923920 (*agc_state)++;
924921 ret = 5;
....@@ -1101,7 +1098,7 @@
11011098 else
11021099 state->div_sync_wait = (value * 3) / 2 + state->cfg.diversity_delay;
11031100
1104
- /* deactive the possibility of diversity reception if extended interleaver */
1101
+ /* deactivate the possibility of diversity reception if extended interleaver */
11051102 state->div_force_off = !1 && ch->transmission_mode != TRANSMISSION_MODE_8K;
11061103 dib7000p_set_diversity_in(&state->demod, state->div_state);
11071104
....@@ -1871,9 +1868,12 @@
18711868 break;
18721869 }
18731870
1874
- interleaving = interleaving;
1875
-
18761871 denom = bits_per_symbol * rate_num * fft_div * 384;
1872
+
1873
+ /*
1874
+ * FIXME: check if the math makes sense. If so, fill the
1875
+ * interleaving var.
1876
+ */
18771877
18781878 /* If calculus gets wrong, wait for 1s for the next stats */
18791879 if (!denom)
....@@ -2036,7 +2036,8 @@
20362036 if (i2c_transfer(i2c_adap, msg, 2) == 2)
20372037 if (rx[0] == 0x01 && rx[1] == 0xb3) {
20382038 dprintk("-D- DiB7000PC detected\n");
2039
- return 1;
2039
+ ret = 1;
2040
+ goto out;
20402041 }
20412042
20422043 msg[0].addr = msg[1].addr = 0x40;
....@@ -2044,11 +2045,13 @@
20442045 if (i2c_transfer(i2c_adap, msg, 2) == 2)
20452046 if (rx[0] == 0x01 && rx[1] == 0xb3) {
20462047 dprintk("-D- DiB7000PC detected\n");
2047
- return 1;
2048
+ ret = 1;
2049
+ goto out;
20482050 }
20492051
20502052 dprintk("-D- DiB7000PC not detected\n");
20512053
2054
+out:
20522055 kfree(rx);
20532056 rx_memory_error:
20542057 kfree(tx);
....@@ -2375,7 +2378,7 @@
23752378 }
23762379 }
23772380
2378
- if (apb_address != 0) /* R/W acces via APB */
2381
+ if (apb_address != 0) /* R/W access via APB */
23792382 return dib7090p_rw_on_apb(i2c_adap, msg, num, apb_address);
23802383 else /* R/W access via SERPAR */
23812384 return w7090p_tuner_rw_serpar(i2c_adap, msg, num);
....@@ -2771,7 +2774,8 @@
27712774 dibx000_init_i2c_master(&st->i2c_master, DIB7000P, st->i2c_adap, st->i2c_addr);
27722775
27732776 /* init 7090 tuner adapter */
2774
- strncpy(st->dib7090_tuner_adap.name, "DiB7090 tuner interface", sizeof(st->dib7090_tuner_adap.name));
2777
+ strscpy(st->dib7090_tuner_adap.name, "DiB7090 tuner interface",
2778
+ sizeof(st->dib7090_tuner_adap.name));
27752779 st->dib7090_tuner_adap.algo = &dib7090_tuner_xfer_algo;
27762780 st->dib7090_tuner_adap.algo_data = NULL;
27772781 st->dib7090_tuner_adap.dev.parent = st->i2c_adap->dev.parent;