^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _DRXK_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _DRXK_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * struct drxk_config - Configure the initial parameters for DRX-K
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * @adr: I2C address of the DRX-K
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * @parallel_ts: True means that the device uses parallel TS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * Serial otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * @dynamic_clk: True means that the clock will be dynamically
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * adjusted. Static clock otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * @enable_merr_cfg: Enable SIO_PDR_PERR_CFG/SIO_PDR_MVAL_CFG.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * @single_master: Device is on the single master mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * @no_i2c_bridge: Don't switch the I2C bridge to talk with tuner
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * @antenna_gpio: GPIO bit used to control the antenna
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * @antenna_dvbt: GPIO bit for changing antenna to DVB-C. A value of 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * means that 1=DVBC, 0 = DVBT. Zero means the opposite.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * @mpeg_out_clk_strength: DRXK Mpeg output clock drive strength.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * @chunk_size: maximum size for I2C messages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * @microcode_name: Name of the firmware file with the microcode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * @qam_demod_parameter_count: The number of parameters used for the command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * to set the demodulator parameters. All
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * firmwares are using the 2-parameter command.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * An exception is the ``drxk_a3.mc`` firmware,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * which uses the 4-parameter command.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * A value of 0 (default) or lower indicates that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * the correct number of parameters will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * automatically detected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * On the ``*_gpio`` vars, bit 0 is UIO-1, bit 1 is UIO-2 and bit 2 is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * UIO-3.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) struct drxk_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) u8 adr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) bool single_master;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) bool no_i2c_bridge;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) bool parallel_ts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) bool dynamic_clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) bool enable_merr_cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) bool antenna_dvbt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) u16 antenna_gpio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) u8 mpeg_out_clk_strength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int chunk_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) const char *microcode_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int qam_demod_parameter_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #if IS_REACHABLE(CONFIG_DVB_DRXK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * Attach a drxk demod
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * @config: pointer to &struct drxk_config with demod configuration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * @i2c: i2c adapter to use.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * return: FE pointer on success, NULL on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) extern struct dvb_frontend *drxk_attach(const struct drxk_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) struct i2c_adapter *i2c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) static inline struct dvb_frontend *drxk_attach(const struct drxk_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) struct i2c_adapter *i2c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #endif