blob: 69fdca00f364f82d5e210817f273e1b92bb957da [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Ralph Metzler43dd07f2011-07-03 13:42:18 -03002#ifndef _DRXK_H_
3#define _DRXK_H_
4
5#include <linux/types.h>
6#include <linux/i2c.h>
7
Mauro Carvalho Chehab147e1102011-07-10 08:24:26 -03008/**
9 * struct drxk_config - Configure the initial parameters for DRX-K
10 *
Mauro Carvalho Chehabcd7a67a2013-04-28 11:47:44 -030011 * @adr: I2C address of the DRX-K
Mauro Carvalho Chehab67f04612012-01-20 18:30:58 -030012 * @parallel_ts: True means that the device uses parallel TS,
Mauro Carvalho Chehab4a3fad72018-01-04 06:47:28 -050013 * Serial otherwise.
Mauro Carvalho Chehab67f04612012-01-20 18:30:58 -030014 * @dynamic_clk: True means that the clock will be dynamically
15 * adjusted. Static clock otherwise.
Mauro Carvalho Chehabd5856812012-01-21 07:57:06 -030016 * @enable_merr_cfg: Enable SIO_PDR_PERR_CFG/SIO_PDR_MVAL_CFG.
Mauro Carvalho Chehab67f04612012-01-20 18:30:58 -030017 * @single_master: Device is on the single master mode
18 * @no_i2c_bridge: Don't switch the I2C bridge to talk with tuner
19 * @antenna_gpio: GPIO bit used to control the antenna
20 * @antenna_dvbt: GPIO bit for changing antenna to DVB-C. A value of 1
Mauro Carvalho Chehab90796ac2011-07-10 09:36:30 -030021 * means that 1=DVBC, 0 = DVBT. Zero means the opposite.
Mauro Carvalho Chehab6fb65a62012-01-20 19:13:07 -030022 * @mpeg_out_clk_strength: DRXK Mpeg output clock drive strength.
Mauro Carvalho Chehabb95b0c92017-11-29 12:39:19 -050023 * @chunk_size: maximum size for I2C messages
Mauro Carvalho Chehab67f04612012-01-20 18:30:58 -030024 * @microcode_name: Name of the firmware file with the microcode
Martin Blumenstingl9e23f50a2012-07-04 17:36:55 -030025 * @qam_demod_parameter_count: The number of parameters used for the command
26 * to set the demodulator parameters. All
Mauro Carvalho Chehab868c9a12019-02-18 14:28:55 -050027 * firmwares are using the 2-parameter command.
Mauro Carvalho Chehabb95b0c92017-11-29 12:39:19 -050028 * An exception is the ``drxk_a3.mc`` firmware,
Martin Blumenstingl9e23f50a2012-07-04 17:36:55 -030029 * which uses the 4-parameter command.
30 * A value of 0 (default) or lower indicates that
31 * the correct number of parameters will be
32 * automatically detected.
Mauro Carvalho Chehab90796ac2011-07-10 09:36:30 -030033 *
Mauro Carvalho Chehabb95b0c92017-11-29 12:39:19 -050034 * On the ``*_gpio`` vars, bit 0 is UIO-1, bit 1 is UIO-2 and bit 2 is
Mauro Carvalho Chehab90796ac2011-07-10 09:36:30 -030035 * UIO-3.
Mauro Carvalho Chehab147e1102011-07-10 08:24:26 -030036 */
Mauro Carvalho Chehab0fc55e82011-07-09 12:36:58 -030037struct drxk_config {
Mauro Carvalho Chehab147e1102011-07-10 08:24:26 -030038 u8 adr;
39 bool single_master;
40 bool no_i2c_bridge;
Mauro Carvalho Chehab534e0482011-07-24 14:59:20 -030041 bool parallel_ts;
Mauro Carvalho Chehab67f04612012-01-20 18:30:58 -030042 bool dynamic_clk;
Mauro Carvalho Chehabd5856812012-01-21 07:57:06 -030043 bool enable_merr_cfg;
Mauro Carvalho Chehab147e1102011-07-10 08:24:26 -030044
Mauro Carvalho Chehab90796ac2011-07-10 09:36:30 -030045 bool antenna_dvbt;
46 u16 antenna_gpio;
Mauro Carvalho Chehab147e1102011-07-10 08:24:26 -030047
Mauro Carvalho Chehab6fb65a62012-01-20 19:13:07 -030048 u8 mpeg_out_clk_strength;
49 int chunk_size;
Eddi De Pieri82e7dbb2011-11-19 11:37:14 -030050
Martin Blumenstingl9e23f50a2012-07-04 17:36:55 -030051 const char *microcode_name;
52 int qam_demod_parameter_count;
Mauro Carvalho Chehab0fc55e82011-07-09 12:36:58 -030053};
54
Arnd Bergmann9b174522015-02-18 14:12:42 -030055#if IS_REACHABLE(CONFIG_DVB_DRXK)
Mauro Carvalho Chehabbe9b53c2017-11-29 14:02:22 -050056/**
Mauro Carvalho Chehabb0649452020-10-23 16:08:10 +020057 * drxk_attach - Attach a drxk demod
Mauro Carvalho Chehabbe9b53c2017-11-29 14:02:22 -050058 *
59 * @config: pointer to &struct drxk_config with demod configuration.
60 * @i2c: i2c adapter to use.
61 *
62 * return: FE pointer on success, NULL on failure.
63 */
Mauro Carvalho Chehab0fc55e82011-07-09 12:36:58 -030064extern struct dvb_frontend *drxk_attach(const struct drxk_config *config,
Mauro Carvalho Chehabfa4b2a12012-01-05 08:07:32 -020065 struct i2c_adapter *i2c);
Mauro Carvalho Chehabfd0b08142011-07-11 14:56:30 -030066#else
67static inline struct dvb_frontend *drxk_attach(const struct drxk_config *config,
Mauro Carvalho Chehabfa4b2a12012-01-05 08:07:32 -020068 struct i2c_adapter *i2c)
Mauro Carvalho Chehabfd0b08142011-07-11 14:56:30 -030069{
Mauro Carvalho Chehab4a3fad72018-01-04 06:47:28 -050070 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
71 return NULL;
Mauro Carvalho Chehabfd0b08142011-07-11 14:56:30 -030072}
73#endif
74
Ralph Metzler43dd07f2011-07-03 13:42:18 -030075#endif