| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for Dummy Frontend |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Written by Emard <emard@softhome.net> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 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 | | - * |
|---|
| 15 | | - * GNU General Public License for more details. |
|---|
| 16 | 6 | */ |
|---|
| 17 | 7 | |
|---|
| 18 | 8 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 41 | 31 | return 0; |
|---|
| 42 | 32 | } |
|---|
| 43 | 33 | |
|---|
| 44 | | -static int dvb_dummy_fe_read_ber(struct dvb_frontend* fe, u32* ber) |
|---|
| 34 | +static int dvb_dummy_fe_read_ber(struct dvb_frontend *fe, u32 *ber) |
|---|
| 45 | 35 | { |
|---|
| 46 | 36 | *ber = 0; |
|---|
| 47 | 37 | return 0; |
|---|
| 48 | 38 | } |
|---|
| 49 | 39 | |
|---|
| 50 | | -static int dvb_dummy_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
|---|
| 40 | +static int dvb_dummy_fe_read_signal_strength(struct dvb_frontend *fe, |
|---|
| 41 | + u16 *strength) |
|---|
| 51 | 42 | { |
|---|
| 52 | 43 | *strength = 0; |
|---|
| 53 | 44 | return 0; |
|---|
| 54 | 45 | } |
|---|
| 55 | 46 | |
|---|
| 56 | | -static int dvb_dummy_fe_read_snr(struct dvb_frontend* fe, u16* snr) |
|---|
| 47 | +static int dvb_dummy_fe_read_snr(struct dvb_frontend *fe, u16 *snr) |
|---|
| 57 | 48 | { |
|---|
| 58 | 49 | *snr = 0; |
|---|
| 59 | 50 | return 0; |
|---|
| 60 | 51 | } |
|---|
| 61 | 52 | |
|---|
| 62 | | -static int dvb_dummy_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
|---|
| 53 | +static int dvb_dummy_fe_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) |
|---|
| 63 | 54 | { |
|---|
| 64 | 55 | *ucblocks = 0; |
|---|
| 65 | 56 | return 0; |
|---|
| .. | .. |
|---|
| 87 | 78 | return 0; |
|---|
| 88 | 79 | } |
|---|
| 89 | 80 | |
|---|
| 90 | | -static int dvb_dummy_fe_sleep(struct dvb_frontend* fe) |
|---|
| 81 | +static int dvb_dummy_fe_sleep(struct dvb_frontend *fe) |
|---|
| 91 | 82 | { |
|---|
| 92 | 83 | return 0; |
|---|
| 93 | 84 | } |
|---|
| 94 | 85 | |
|---|
| 95 | | -static int dvb_dummy_fe_init(struct dvb_frontend* fe) |
|---|
| 86 | +static int dvb_dummy_fe_init(struct dvb_frontend *fe) |
|---|
| 96 | 87 | { |
|---|
| 97 | 88 | return 0; |
|---|
| 98 | 89 | } |
|---|
| .. | .. |
|---|
| 109 | 100 | return 0; |
|---|
| 110 | 101 | } |
|---|
| 111 | 102 | |
|---|
| 112 | | -static void dvb_dummy_fe_release(struct dvb_frontend* fe) |
|---|
| 103 | +static void dvb_dummy_fe_release(struct dvb_frontend *fe) |
|---|
| 113 | 104 | { |
|---|
| 114 | | - struct dvb_dummy_fe_state* state = fe->demodulator_priv; |
|---|
| 105 | + struct dvb_dummy_fe_state *state = fe->demodulator_priv; |
|---|
| 106 | + |
|---|
| 115 | 107 | kfree(state); |
|---|
| 116 | 108 | } |
|---|
| 117 | 109 | |
|---|
| 118 | 110 | static const struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops; |
|---|
| 119 | 111 | |
|---|
| 120 | | -struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void) |
|---|
| 112 | +struct dvb_frontend *dvb_dummy_fe_ofdm_attach(void) |
|---|
| 121 | 113 | { |
|---|
| 122 | | - struct dvb_dummy_fe_state* state = NULL; |
|---|
| 114 | + struct dvb_dummy_fe_state *state = NULL; |
|---|
| 123 | 115 | |
|---|
| 124 | 116 | /* allocate memory for the internal state */ |
|---|
| 125 | 117 | state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 127 | 119 | return NULL; |
|---|
| 128 | 120 | |
|---|
| 129 | 121 | /* create dvb_frontend */ |
|---|
| 130 | | - memcpy(&state->frontend.ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops)); |
|---|
| 122 | + memcpy(&state->frontend.ops, |
|---|
| 123 | + &dvb_dummy_fe_ofdm_ops, |
|---|
| 124 | + sizeof(struct dvb_frontend_ops)); |
|---|
| 125 | + |
|---|
| 131 | 126 | state->frontend.demodulator_priv = state; |
|---|
| 132 | 127 | return &state->frontend; |
|---|
| 133 | 128 | } |
|---|
| 129 | +EXPORT_SYMBOL(dvb_dummy_fe_ofdm_attach); |
|---|
| 134 | 130 | |
|---|
| 135 | 131 | static const struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops; |
|---|
| 136 | 132 | |
|---|
| 137 | 133 | struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void) |
|---|
| 138 | 134 | { |
|---|
| 139 | | - struct dvb_dummy_fe_state* state = NULL; |
|---|
| 135 | + struct dvb_dummy_fe_state *state = NULL; |
|---|
| 140 | 136 | |
|---|
| 141 | 137 | /* allocate memory for the internal state */ |
|---|
| 142 | 138 | state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 144 | 140 | return NULL; |
|---|
| 145 | 141 | |
|---|
| 146 | 142 | /* create dvb_frontend */ |
|---|
| 147 | | - memcpy(&state->frontend.ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops)); |
|---|
| 143 | + memcpy(&state->frontend.ops, |
|---|
| 144 | + &dvb_dummy_fe_qpsk_ops, |
|---|
| 145 | + sizeof(struct dvb_frontend_ops)); |
|---|
| 146 | + |
|---|
| 148 | 147 | state->frontend.demodulator_priv = state; |
|---|
| 149 | 148 | return &state->frontend; |
|---|
| 150 | 149 | } |
|---|
| 150 | +EXPORT_SYMBOL(dvb_dummy_fe_qpsk_attach); |
|---|
| 151 | 151 | |
|---|
| 152 | 152 | static const struct dvb_frontend_ops dvb_dummy_fe_qam_ops; |
|---|
| 153 | 153 | |
|---|
| 154 | 154 | struct dvb_frontend *dvb_dummy_fe_qam_attach(void) |
|---|
| 155 | 155 | { |
|---|
| 156 | | - struct dvb_dummy_fe_state* state = NULL; |
|---|
| 156 | + struct dvb_dummy_fe_state *state = NULL; |
|---|
| 157 | 157 | |
|---|
| 158 | 158 | /* allocate memory for the internal state */ |
|---|
| 159 | 159 | state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 161 | 161 | return NULL; |
|---|
| 162 | 162 | |
|---|
| 163 | 163 | /* create dvb_frontend */ |
|---|
| 164 | | - memcpy(&state->frontend.ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops)); |
|---|
| 164 | + memcpy(&state->frontend.ops, |
|---|
| 165 | + &dvb_dummy_fe_qam_ops, |
|---|
| 166 | + sizeof(struct dvb_frontend_ops)); |
|---|
| 167 | + |
|---|
| 165 | 168 | state->frontend.demodulator_priv = state; |
|---|
| 166 | 169 | return &state->frontend; |
|---|
| 167 | 170 | } |
|---|
| 171 | +EXPORT_SYMBOL(dvb_dummy_fe_qam_attach); |
|---|
| 168 | 172 | |
|---|
| 169 | 173 | static const struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = { |
|---|
| 170 | 174 | .delsys = { SYS_DVBT }, |
|---|
| .. | .. |
|---|
| 173 | 177 | .frequency_min_hz = 0, |
|---|
| 174 | 178 | .frequency_max_hz = 863250 * kHz, |
|---|
| 175 | 179 | .frequency_stepsize_hz = 62500, |
|---|
| 176 | | - .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | |
|---|
| 177 | | - FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | |
|---|
| 178 | | - FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO | |
|---|
| 179 | | - FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | |
|---|
| 180 | | - FE_CAN_TRANSMISSION_MODE_AUTO | |
|---|
| 181 | | - FE_CAN_GUARD_INTERVAL_AUTO | |
|---|
| 182 | | - FE_CAN_HIERARCHY_AUTO, |
|---|
| 180 | + .caps = FE_CAN_FEC_1_2 | |
|---|
| 181 | + FE_CAN_FEC_2_3 | |
|---|
| 182 | + FE_CAN_FEC_3_4 | |
|---|
| 183 | + FE_CAN_FEC_4_5 | |
|---|
| 184 | + FE_CAN_FEC_5_6 | |
|---|
| 185 | + FE_CAN_FEC_6_7 | |
|---|
| 186 | + FE_CAN_FEC_7_8 | |
|---|
| 187 | + FE_CAN_FEC_8_9 | |
|---|
| 188 | + FE_CAN_FEC_AUTO | |
|---|
| 189 | + FE_CAN_QAM_16 | |
|---|
| 190 | + FE_CAN_QAM_64 | |
|---|
| 191 | + FE_CAN_QAM_AUTO | |
|---|
| 192 | + FE_CAN_TRANSMISSION_MODE_AUTO | |
|---|
| 193 | + FE_CAN_GUARD_INTERVAL_AUTO | |
|---|
| 194 | + FE_CAN_HIERARCHY_AUTO, |
|---|
| 183 | 195 | }, |
|---|
| 184 | 196 | |
|---|
| 185 | 197 | .release = dvb_dummy_fe_release, |
|---|
| .. | .. |
|---|
| 204 | 216 | .frequency_min_hz = 51 * MHz, |
|---|
| 205 | 217 | .frequency_max_hz = 858 * MHz, |
|---|
| 206 | 218 | .frequency_stepsize_hz = 62500, |
|---|
| 207 | | - .symbol_rate_min = (57840000 / 2) / 64, /* SACLK/64 == (XIN/2)/64 */ |
|---|
| 219 | + /* symbol_rate_min: SACLK/64 == (XIN/2)/64 */ |
|---|
| 220 | + .symbol_rate_min = (57840000 / 2) / 64, |
|---|
| 208 | 221 | .symbol_rate_max = (57840000 / 2) / 4, /* SACLK/4 */ |
|---|
| 209 | | - .caps = FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 | |
|---|
| 210 | | - FE_CAN_QAM_128 | FE_CAN_QAM_256 | |
|---|
| 211 | | - FE_CAN_FEC_AUTO | FE_CAN_INVERSION_AUTO |
|---|
| 222 | + .caps = FE_CAN_QAM_16 | |
|---|
| 223 | + FE_CAN_QAM_32 | |
|---|
| 224 | + FE_CAN_QAM_64 | |
|---|
| 225 | + FE_CAN_QAM_128 | |
|---|
| 226 | + FE_CAN_QAM_256 | |
|---|
| 227 | + FE_CAN_FEC_AUTO | |
|---|
| 228 | + FE_CAN_INVERSION_AUTO |
|---|
| 212 | 229 | }, |
|---|
| 213 | 230 | |
|---|
| 214 | 231 | .release = dvb_dummy_fe_release, |
|---|
| .. | .. |
|---|
| 237 | 254 | .symbol_rate_min = 1000000, |
|---|
| 238 | 255 | .symbol_rate_max = 45000000, |
|---|
| 239 | 256 | .caps = FE_CAN_INVERSION_AUTO | |
|---|
| 240 | | - FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | |
|---|
| 241 | | - FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | |
|---|
| 257 | + FE_CAN_FEC_1_2 | |
|---|
| 258 | + FE_CAN_FEC_2_3 | |
|---|
| 259 | + FE_CAN_FEC_3_4 | |
|---|
| 260 | + FE_CAN_FEC_5_6 | |
|---|
| 261 | + FE_CAN_FEC_7_8 | |
|---|
| 262 | + FE_CAN_FEC_AUTO | |
|---|
| 242 | 263 | FE_CAN_QPSK |
|---|
| 243 | 264 | }, |
|---|
| 244 | 265 | |
|---|
| .. | .. |
|---|
| 263 | 284 | MODULE_DESCRIPTION("DVB DUMMY Frontend"); |
|---|
| 264 | 285 | MODULE_AUTHOR("Emard"); |
|---|
| 265 | 286 | MODULE_LICENSE("GPL"); |
|---|
| 266 | | - |
|---|
| 267 | | -EXPORT_SYMBOL(dvb_dummy_fe_ofdm_attach); |
|---|
| 268 | | -EXPORT_SYMBOL(dvb_dummy_fe_qam_attach); |
|---|
| 269 | | -EXPORT_SYMBOL(dvb_dummy_fe_qpsk_attach); |
|---|