hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/dvb-frontends/drxk_hard.c
....@@ -1,20 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * drxk_hard: DRX-K DVB-C/T demodulator driver
34 *
45 * Copyright (C) 2010-2011 Digital Devices GmbH
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
8
- * version 2 only, as published by the Free Software Foundation.
9
- *
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * To obtain the license, point your browser to
17
- * http://www.gnu.org/copyleft/gpl.html
186 */
197
208 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -166,17 +154,6 @@
166154 if (debug >= level) \
167155 printk(KERN_DEBUG KBUILD_MODNAME ": %s " fmt, __func__, ##arg); \
168156 } while (0)
169
-
170
-
171
-static inline u32 MulDiv32(u32 a, u32 b, u32 c)
172
-{
173
- u64 tmp64;
174
-
175
- tmp64 = (u64) a * (u64) b;
176
- do_div(tmp64, c);
177
-
178
- return (u32) tmp64;
179
-}
180157
181158 static inline u32 Frac28a(u32 a, u32 c)
182159 {
....@@ -723,7 +700,7 @@
723700 state->m_drxk_state = DRXK_UNINITIALIZED;
724701
725702 /* MPEG output configuration */
726
- state->m_enable_mpeg_output = true; /* If TRUE; enable MPEG ouput */
703
+ state->m_enable_mpeg_output = true; /* If TRUE; enable MPEG output */
727704 state->m_insert_rs_byte = false; /* If TRUE; insert RS byte */
728705 state->m_invert_data = false; /* If TRUE; invert DATA signals */
729706 state->m_invert_err = false; /* If TRUE; invert ERR signal */
....@@ -1034,8 +1011,7 @@
10341011 retry_count += 1;
10351012 status = read16(state, SIO_HI_RA_RAM_CMD__A,
10361013 &wait_cmd);
1037
- } while ((status < 0) && (retry_count < DRXK_MAX_RETRIES)
1038
- && (wait_cmd != 0));
1014
+ } while ((status < 0 || wait_cmd) && (retry_count < DRXK_MAX_RETRIES));
10391015 if (status < 0)
10401016 goto error;
10411017 status = read16(state, SIO_HI_RA_RAM_RES__A, p_result);
....@@ -1105,7 +1081,7 @@
11051081
11061082 static int mpegts_configure_pins(struct drxk_state *state, bool mpeg_enable)
11071083 {
1108
- int status = -1;
1084
+ int status;
11091085 u16 sio_pdr_mclk_cfg = 0;
11101086 u16 sio_pdr_mdx_cfg = 0;
11111087 u16 err_cfg = 0;
....@@ -1474,9 +1450,11 @@
14741450
14751451 /* assume that the command register is ready
14761452 since it is checked afterwards */
1477
- for (ii = parameter_len - 1; ii >= 0; ii -= 1) {
1478
- buffer[cnt++] = (parameter[ii] & 0xFF);
1479
- buffer[cnt++] = ((parameter[ii] >> 8) & 0xFF);
1453
+ if (parameter) {
1454
+ for (ii = parameter_len - 1; ii >= 0; ii -= 1) {
1455
+ buffer[cnt++] = (parameter[ii] & 0xFF);
1456
+ buffer[cnt++] = ((parameter[ii] >> 8) & 0xFF);
1457
+ }
14801458 }
14811459 buffer[cnt++] = (cmd & 0xFF);
14821460 buffer[cnt++] = ((cmd >> 8) & 0xFF);
....@@ -1777,7 +1755,7 @@
17771755 goto error;
17781756 state->m_operation_mode = OM_NONE;
17791757 break;
1780
- case OM_QAM_ITU_A: /* fallthrough */
1758
+ case OM_QAM_ITU_A:
17811759 case OM_QAM_ITU_C:
17821760 status = mpegts_stop(state);
17831761 if (status < 0)
....@@ -1804,7 +1782,7 @@
18041782 if (status < 0)
18051783 goto error;
18061784 break;
1807
- case OM_QAM_ITU_A: /* fallthrough */
1785
+ case OM_QAM_ITU_A:
18081786 case OM_QAM_ITU_C:
18091787 dprintk(1, ": DVB-C Annex %c\n",
18101788 (state->m_operation_mode == OM_QAM_ITU_A) ? 'A' : 'C');
....@@ -2033,7 +2011,7 @@
20332011 fec_oc_rcn_ctl_rate = 0xC00000;
20342012 static_clk = state->m_dvbt_static_clk;
20352013 break;
2036
- case OM_QAM_ITU_A: /* fallthrough */
2014
+ case OM_QAM_ITU_A:
20372015 case OM_QAM_ITU_C:
20382016 fec_oc_tmd_mode = 0x0004;
20392017 fec_oc_rcn_ctl_rate = 0xD2B4EE; /* good for >63 Mb/s */
....@@ -3270,11 +3248,11 @@
32703248 case OFDM_SC_RA_RAM_CMD_SET_PREF_PARAM:
32713249 case OFDM_SC_RA_RAM_CMD_PROGRAM_PARAM:
32723250 status |= write16(state, OFDM_SC_RA_RAM_PARAM1__A, param1);
3273
- /* fall through - All commands using 1 parameters */
3251
+ fallthrough; /* All commands using 1 parameters */
32743252 case OFDM_SC_RA_RAM_CMD_SET_ECHO_TIMING:
32753253 case OFDM_SC_RA_RAM_CMD_USER_IO:
32763254 status |= write16(state, OFDM_SC_RA_RAM_PARAM0__A, param0);
3277
- /* fall through - All commands using 0 parameters */
3255
+ fallthrough; /* All commands using 0 parameters */
32783256 case OFDM_SC_RA_RAM_CMD_GET_OP_PARAM:
32793257 case OFDM_SC_RA_RAM_CMD_NULL:
32803258 /* Write command */
....@@ -3782,7 +3760,7 @@
37823760 case TRANSMISSION_MODE_AUTO:
37833761 default:
37843762 operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_MODE__M;
3785
- /* fall through - try first guess DRX_FFTMODE_8K */
3763
+ fallthrough; /* try first guess DRX_FFTMODE_8K */
37863764 case TRANSMISSION_MODE_8K:
37873765 transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_MODE_8K;
37883766 break;
....@@ -3796,7 +3774,7 @@
37963774 default:
37973775 case GUARD_INTERVAL_AUTO:
37983776 operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_GUARD__M;
3799
- /* fall through - try first guess DRX_GUARD_1DIV4 */
3777
+ fallthrough; /* try first guess DRX_GUARD_1DIV4 */
38003778 case GUARD_INTERVAL_1_4:
38013779 transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_GUARD_4;
38023780 break;
....@@ -3819,7 +3797,7 @@
38193797 operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_HIER__M;
38203798 /* try first guess SC_RA_RAM_OP_PARAM_HIER_NO */
38213799 /* transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_HIER_NO; */
3822
- /* fall through */
3800
+ fallthrough;
38233801 case HIERARCHY_1:
38243802 transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_HIER_A1;
38253803 break;
....@@ -3837,7 +3815,7 @@
38373815 case QAM_AUTO:
38383816 default:
38393817 operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_CONST__M;
3840
- /* fall through - try first guess DRX_CONSTELLATION_QAM64 */
3818
+ fallthrough; /* try first guess DRX_CONSTELLATION_QAM64 */
38413819 case QAM_64:
38423820 transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_CONST_QAM64;
38433821 break;
....@@ -3862,13 +3840,13 @@
38623840 WR16(dev_addr, OFDM_EC_SB_PRIOR__A,
38633841 OFDM_EC_SB_PRIOR_HI));
38643842 break;
3865
- case DRX_PRIORITY_UNKNOWN: /* fall through */
3843
+ case DRX_PRIORITY_UNKNOWN:
38663844 default:
38673845 status = -EINVAL;
38683846 goto error;
38693847 }
38703848 #else
3871
- /* Set Priorty high */
3849
+ /* Set Priority high */
38723850 transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_PRIO_HI;
38733851 status = write16(state, OFDM_EC_SB_PRIOR__A, OFDM_EC_SB_PRIOR_HI);
38743852 if (status < 0)
....@@ -3880,7 +3858,7 @@
38803858 case FEC_AUTO:
38813859 default:
38823860 operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_RATE__M;
3883
- /* fall through - try first guess DRX_CODERATE_2DIV3 */
3861
+ fallthrough; /* try first guess DRX_CODERATE_2DIV3 */
38843862 case FEC_2_3:
38853863 transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_RATE_2_3;
38863864 break;
....@@ -3899,7 +3877,7 @@
38993877 }
39003878
39013879 /*
3902
- * SAW filter selection: normaly not necesarry, but if wanted
3880
+ * SAW filter selection: normally not necessary, but if wanted
39033881 * the application can select a SAW filter via the driver by
39043882 * using UIOs
39053883 */
....@@ -3914,7 +3892,7 @@
39143892 switch (state->props.bandwidth_hz) {
39153893 case 0:
39163894 state->props.bandwidth_hz = 8000000;
3917
- /* fall through */
3895
+ fallthrough;
39183896 case 8000000:
39193897 bandwidth = DRXK_BANDWIDTH_8MHZ_IN_HZ;
39203898 status = write16(state, OFDM_SC_RA_RAM_SRMM_FIX_FACT_8K__A,
....@@ -5421,7 +5399,7 @@
54215399
54225400 set_param_parameters[3] |= (QAM_MIRROR_AUTO_ON);
54235401 /* Env parameters */
5424
- /* check for LOCKRANGE Extented */
5402
+ /* check for LOCKRANGE Extended */
54255403 /* set_param_parameters[3] |= QAM_LOCKRANGE_NORMAL; */
54265404
54275405 status = scu_command(state,
....@@ -6694,7 +6672,7 @@
66946672 static int drxk_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
66956673 {
66966674 struct drxk_state *state = fe->demodulator_priv;
6697
- u16 err;
6675
+ u16 err = 0;
66986676
66996677 dprintk(1, "\n");
67006678
....@@ -6867,7 +6845,7 @@
68676845 kfree(state);
68686846 return NULL;
68696847 }
6870
-EXPORT_SYMBOL(drxk_attach);
6848
+EXPORT_SYMBOL_GPL(drxk_attach);
68716849
68726850 MODULE_DESCRIPTION("DRX-K driver");
68736851 MODULE_AUTHOR("Ralph Metzler");