1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Montage Technology M88DS3103/M88RS6000 demodulator driver
5 * Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
11 #include <linux/dvb/frontend.h>
19 * enum m88ds3103_ts_mode - TS connection mode
20 * @M88DS3103_TS_SERIAL: TS output pin D0, normal
21 * @M88DS3103_TS_SERIAL_D7: TS output pin D7
22 * @M88DS3103_TS_PARALLEL: TS Parallel mode
23 * @M88DS3103_TS_CI: TS CI Mode
25 enum m88ds3103_ts_mode
{
27 M88DS3103_TS_SERIAL_D7
,
28 M88DS3103_TS_PARALLEL
,
33 * enum m88ds3103_clock_out
34 * @M88DS3103_CLOCK_OUT_DISABLED: Clock output is disabled
35 * @M88DS3103_CLOCK_OUT_ENABLED: Clock output is enabled with crystal
37 * @M88DS3103_CLOCK_OUT_ENABLED_DIV2: Clock output is enabled with half
40 enum m88ds3103_clock_out
{
41 M88DS3103_CLOCK_OUT_DISABLED
,
42 M88DS3103_CLOCK_OUT_ENABLED
,
43 M88DS3103_CLOCK_OUT_ENABLED_DIV2
47 * struct m88ds3103_platform_data - Platform data for the m88ds3103 driver
48 * @clk: Clock frequency.
49 * @i2c_wr_max: Max bytes I2C adapter can write at once.
51 * @ts_clk: TS clock (KHz).
52 * @ts_clk_pol: TS clk polarity. 1-active at falling edge; 0-active at rising
54 * @spec_inv: Input spectrum inversion.
55 * @agc: AGC configuration.
56 * @agc_inv: AGC polarity.
57 * @clk_out: Clock output.
58 * @envelope_mode: DiSEqC envelope mode.
59 * @lnb_hv_pol: LNB H/V pin polarity. 0: pin high set to VOLTAGE_18, pin low to
60 * set VOLTAGE_13. 1: pin high set to VOLTAGE_13, pin low to set VOLTAGE_18.
61 * @lnb_en_pol: LNB enable pin polarity. 0: pin high to disable, pin low to
62 * enable. 1: pin high to enable, pin low to disable.
63 * @get_dvb_frontend: Get DVB frontend.
64 * @get_i2c_adapter: Get I2C adapter.
66 struct m88ds3103_platform_data
{
69 enum m88ds3103_ts_mode ts_mode
;
71 enum m88ds3103_clock_out clk_out
;
80 struct dvb_frontend
* (*get_dvb_frontend
)(struct i2c_client
*);
81 struct i2c_adapter
* (*get_i2c_adapter
)(struct i2c_client
*);
83 /* private: For legacy media attach wrapper. Do not set value. */
88 * struct m88ds3103_config - m88ds3102 configuration
90 * @i2c_addr: I2C address. Default: none, must set. Example: 0x68, ...
91 * @clock: Device's clock. Default: none, must set. Example: 27000000
92 * @i2c_wr_max: Max bytes I2C provider is asked to write at once.
93 * Default: none, must set. Example: 33, 65, ...
94 * @ts_mode: TS output mode, as defined by &enum m88ds3103_ts_mode.
95 * Default: M88DS3103_TS_SERIAL.
96 * @ts_clk: TS clk in KHz. Default: 0.
97 * @ts_clk_pol: TS clk polarity.Default: 0.
98 * 1-active at falling edge; 0-active at rising edge.
99 * @spec_inv: Spectrum inversion. Default: 0.
100 * @agc_inv: AGC polarity. Default: 0.
101 * @clock_out: Clock output, as defined by &enum m88ds3103_clock_out.
102 * Default: M88DS3103_CLOCK_OUT_DISABLED.
103 * @envelope_mode: DiSEqC envelope mode. Default: 0.
104 * @agc: AGC configuration. Default: none, must set.
105 * @lnb_hv_pol: LNB H/V pin polarity. Default: 0. Values:
106 * 1: pin high set to VOLTAGE_13, pin low to set VOLTAGE_18;
107 * 0: pin high set to VOLTAGE_18, pin low to set VOLTAGE_13.
108 * @lnb_en_pol: LNB enable pin polarity. Default: 0. Values:
109 * 1: pin high to enable, pin low to disable;
110 * 0: pin high to disable, pin low to enable.
112 struct m88ds3103_config
{
128 #if defined(CONFIG_DVB_M88DS3103) || \
129 (defined(CONFIG_DVB_M88DS3103_MODULE) && defined(MODULE))
131 * Attach a m88ds3103 demod
133 * @config: pointer to &struct m88ds3103_config with demod configuration.
134 * @i2c: i2c adapter to use.
135 * @tuner_i2c: on success, returns the I2C adapter associated with
138 * return: FE pointer on success, NULL on failure.
139 * Note: Do not add new m88ds3103_attach() users! Use I2C bindings instead.
141 extern struct dvb_frontend
*m88ds3103_attach(
142 const struct m88ds3103_config
*config
,
143 struct i2c_adapter
*i2c
,
144 struct i2c_adapter
**tuner_i2c
);
145 extern int m88ds3103_get_agc_pwm(struct dvb_frontend
*fe
, u8
*_agc_pwm
);
147 static inline struct dvb_frontend
*m88ds3103_attach(
148 const struct m88ds3103_config
*config
,
149 struct i2c_adapter
*i2c
,
150 struct i2c_adapter
**tuner_i2c
)
152 pr_warn("%s: driver disabled by Kconfig\n", __func__
);
155 #define m88ds3103_get_agc_pwm NULL