| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Linux-DVB Driver for DiBcom's second generation DiB7000P (PC). |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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. |
|---|
| 9 | 6 | */ |
|---|
| 10 | 7 | |
|---|
| 11 | 8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 94 | 91 | DIB7000P_POWER_INTERFACE_ONLY, |
|---|
| 95 | 92 | }; |
|---|
| 96 | 93 | |
|---|
| 97 | | -/* dib7090 specific fonctions */ |
|---|
| 94 | +/* dib7090 specific functions */ |
|---|
| 98 | 95 | static int dib7090_set_output_mode(struct dvb_frontend *fe, int mode); |
|---|
| 99 | 96 | static int dib7090_set_diversity_in(struct dvb_frontend *fe, int onoff); |
|---|
| 100 | 97 | static void dib7090_setDibTxMux(struct dib7000p_state *state, int mode); |
|---|
| .. | .. |
|---|
| 279 | 276 | if (state->version != SOC7090) |
|---|
| 280 | 277 | reg_1280 &= ~((1 << 11)); |
|---|
| 281 | 278 | reg_1280 &= ~(1 << 6); |
|---|
| 282 | | - /* fall-through */ |
|---|
| 279 | + fallthrough; |
|---|
| 283 | 280 | case DIB7000P_POWER_INTERFACE_ONLY: |
|---|
| 284 | 281 | /* just leave power on the control-interfaces: GPIO and (I2C or SDIO) */ |
|---|
| 285 | 282 | /* TODO power up either SDIO or I2C */ |
|---|
| .. | .. |
|---|
| 319 | 316 | |
|---|
| 320 | 317 | dib7000p_write_word(state, 1925, reg | (1 << 4) | (1 << 2)); /* en_slowAdc = 1 & reset_sladc = 1 */ |
|---|
| 321 | 318 | |
|---|
| 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 ... */ |
|---|
| 323 | 320 | msleep(200); |
|---|
| 324 | 321 | dib7000p_write_word(state, 1925, reg & ~(1 << 4)); /* en_slowAdc = 1 & reset_sladc = 0 */ |
|---|
| 325 | 322 | |
|---|
| .. | .. |
|---|
| 918 | 915 | |
|---|
| 919 | 916 | dib7000p_restart_agc(state); |
|---|
| 920 | 917 | |
|---|
| 921 | | - dprintk("SPLIT %p: %hd\n", demod, agc_split); |
|---|
| 918 | + dprintk("SPLIT %p: %u\n", demod, agc_split); |
|---|
| 922 | 919 | |
|---|
| 923 | 920 | (*agc_state)++; |
|---|
| 924 | 921 | ret = 5; |
|---|
| .. | .. |
|---|
| 1101 | 1098 | else |
|---|
| 1102 | 1099 | state->div_sync_wait = (value * 3) / 2 + state->cfg.diversity_delay; |
|---|
| 1103 | 1100 | |
|---|
| 1104 | | - /* deactive the possibility of diversity reception if extended interleaver */ |
|---|
| 1101 | + /* deactivate the possibility of diversity reception if extended interleaver */ |
|---|
| 1105 | 1102 | state->div_force_off = !1 && ch->transmission_mode != TRANSMISSION_MODE_8K; |
|---|
| 1106 | 1103 | dib7000p_set_diversity_in(&state->demod, state->div_state); |
|---|
| 1107 | 1104 | |
|---|
| .. | .. |
|---|
| 1871 | 1868 | break; |
|---|
| 1872 | 1869 | } |
|---|
| 1873 | 1870 | |
|---|
| 1874 | | - interleaving = interleaving; |
|---|
| 1875 | | - |
|---|
| 1876 | 1871 | 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 | + */ |
|---|
| 1877 | 1877 | |
|---|
| 1878 | 1878 | /* If calculus gets wrong, wait for 1s for the next stats */ |
|---|
| 1879 | 1879 | if (!denom) |
|---|
| .. | .. |
|---|
| 2036 | 2036 | if (i2c_transfer(i2c_adap, msg, 2) == 2) |
|---|
| 2037 | 2037 | if (rx[0] == 0x01 && rx[1] == 0xb3) { |
|---|
| 2038 | 2038 | dprintk("-D- DiB7000PC detected\n"); |
|---|
| 2039 | | - return 1; |
|---|
| 2039 | + ret = 1; |
|---|
| 2040 | + goto out; |
|---|
| 2040 | 2041 | } |
|---|
| 2041 | 2042 | |
|---|
| 2042 | 2043 | msg[0].addr = msg[1].addr = 0x40; |
|---|
| .. | .. |
|---|
| 2044 | 2045 | if (i2c_transfer(i2c_adap, msg, 2) == 2) |
|---|
| 2045 | 2046 | if (rx[0] == 0x01 && rx[1] == 0xb3) { |
|---|
| 2046 | 2047 | dprintk("-D- DiB7000PC detected\n"); |
|---|
| 2047 | | - return 1; |
|---|
| 2048 | + ret = 1; |
|---|
| 2049 | + goto out; |
|---|
| 2048 | 2050 | } |
|---|
| 2049 | 2051 | |
|---|
| 2050 | 2052 | dprintk("-D- DiB7000PC not detected\n"); |
|---|
| 2051 | 2053 | |
|---|
| 2054 | +out: |
|---|
| 2052 | 2055 | kfree(rx); |
|---|
| 2053 | 2056 | rx_memory_error: |
|---|
| 2054 | 2057 | kfree(tx); |
|---|
| .. | .. |
|---|
| 2375 | 2378 | } |
|---|
| 2376 | 2379 | } |
|---|
| 2377 | 2380 | |
|---|
| 2378 | | - if (apb_address != 0) /* R/W acces via APB */ |
|---|
| 2381 | + if (apb_address != 0) /* R/W access via APB */ |
|---|
| 2379 | 2382 | return dib7090p_rw_on_apb(i2c_adap, msg, num, apb_address); |
|---|
| 2380 | 2383 | else /* R/W access via SERPAR */ |
|---|
| 2381 | 2384 | return w7090p_tuner_rw_serpar(i2c_adap, msg, num); |
|---|
| .. | .. |
|---|
| 2771 | 2774 | dibx000_init_i2c_master(&st->i2c_master, DIB7000P, st->i2c_adap, st->i2c_addr); |
|---|
| 2772 | 2775 | |
|---|
| 2773 | 2776 | /* 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)); |
|---|
| 2775 | 2779 | st->dib7090_tuner_adap.algo = &dib7090_tuner_xfer_algo; |
|---|
| 2776 | 2780 | st->dib7090_tuner_adap.algo_data = NULL; |
|---|
| 2777 | 2781 | st->dib7090_tuner_adap.dev.parent = st->i2c_adap->dev.parent; |
|---|