2 * Montage Technology M88DS3103/M88RS6000 demodulator driver
4 * Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
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.
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 * GNU General Public License for more details.
20 #include <linux/dvb/frontend.h>
28 * enum m88ds3103_ts_mode - TS connection mode
29 * @M88DS3103_TS_SERIAL: TS output pin D0, normal
30 * @M88DS3103_TS_SERIAL_D7: TS output pin D7
31 * @M88DS3103_TS_PARALLEL: TS Parallel mode
32 * @M88DS3103_TS_CI: TS CI Mode
34 enum m88ds3103_ts_mode
{
36 M88DS3103_TS_SERIAL_D7
,
37 M88DS3103_TS_PARALLEL
,
42 * enum m88ds3103_clock_out
43 * @M88DS3103_CLOCK_OUT_DISABLED: Clock output is disabled
44 * @M88DS3103_CLOCK_OUT_ENABLED: Clock output is enabled with crystal
46 * @M88DS3103_CLOCK_OUT_ENABLED_DIV2: Clock output is enabled with half
49 enum m88ds3103_clock_out
{
50 M88DS3103_CLOCK_OUT_DISABLED
,
51 M88DS3103_CLOCK_OUT_ENABLED
,
52 M88DS3103_CLOCK_OUT_ENABLED_DIV2
56 * struct m88ds3103_platform_data - Platform data for the m88ds3103 driver
57 * @clk: Clock frequency.
58 * @i2c_wr_max: Max bytes I2C adapter can write at once.
60 * @ts_clk: TS clock (KHz).
61 * @ts_clk_pol: TS clk polarity. 1-active at falling edge; 0-active at rising
63 * @spec_inv: Input spectrum inversion.
64 * @agc: AGC configuration.
65 * @agc_inv: AGC polarity.
66 * @clk_out: Clock output.
67 * @envelope_mode: DiSEqC envelope mode.
68 * @lnb_hv_pol: LNB H/V pin polarity. 0: pin high set to VOLTAGE_18, pin low to
69 * set VOLTAGE_13. 1: pin high set to VOLTAGE_13, pin low to set VOLTAGE_18.
70 * @lnb_en_pol: LNB enable pin polarity. 0: pin high to disable, pin low to
71 * enable. 1: pin high to enable, pin low to disable.
72 * @get_dvb_frontend: Get DVB frontend.
73 * @get_i2c_adapter: Get I2C adapter.
75 struct m88ds3103_platform_data
{
78 enum m88ds3103_ts_mode ts_mode
;
80 enum m88ds3103_clock_out clk_out
;
89 struct dvb_frontend
* (*get_dvb_frontend
)(struct i2c_client
*);
90 struct i2c_adapter
* (*get_i2c_adapter
)(struct i2c_client
*);
92 /* private: For legacy media attach wrapper. Do not set value. */
97 * struct m88ds3103_config - m88ds3102 configuration
99 * @i2c_addr: I2C address. Default: none, must set. Example: 0x68, ...
100 * @clock: Device's clock. Default: none, must set. Example: 27000000
101 * @i2c_wr_max: Max bytes I2C provider is asked to write at once.
102 * Default: none, must set. Example: 33, 65, ...
103 * @ts_mode: TS output mode, as defined by &enum m88ds3103_ts_mode.
104 * Default: M88DS3103_TS_SERIAL.
105 * @ts_clk: TS clk in KHz. Default: 0.
106 * @ts_clk_pol: TS clk polarity.Default: 0.
107 * 1-active at falling edge; 0-active at rising edge.
108 * @spec_inv: Spectrum inversion. Default: 0.
109 * @agc_inv: AGC polarity. Default: 0.
110 * @clock_out: Clock output, as defined by &enum m88ds3103_clock_out.
111 * Default: M88DS3103_CLOCK_OUT_DISABLED.
112 * @envelope_mode: DiSEqC envelope mode. Default: 0.
113 * @agc: AGC configuration. Default: none, must set.
114 * @lnb_hv_pol: LNB H/V pin polarity. Default: 0. Values:
115 * 1: pin high set to VOLTAGE_13, pin low to set VOLTAGE_18;
116 * 0: pin high set to VOLTAGE_18, pin low to set VOLTAGE_13.
117 * @lnb_en_pol: LNB enable pin polarity. Default: 0. Values:
118 * 1: pin high to enable, pin low to disable;
119 * 0: pin high to disable, pin low to enable.
121 struct m88ds3103_config
{
137 #if defined(CONFIG_DVB_M88DS3103) || \
138 (defined(CONFIG_DVB_M88DS3103_MODULE) && defined(MODULE))
140 * Attach a m88ds3103 demod
142 * @config: pointer to &struct m88ds3103_config with demod configuration.
143 * @i2c: i2c adapter to use.
144 * @tuner_i2c: on success, returns the I2C adapter associated with
147 * return: FE pointer on success, NULL on failure.
148 * Note: Do not add new m88ds3103_attach() users! Use I2C bindings instead.
150 extern struct dvb_frontend
*m88ds3103_attach(
151 const struct m88ds3103_config
*config
,
152 struct i2c_adapter
*i2c
,
153 struct i2c_adapter
**tuner_i2c
);
154 extern int m88ds3103_get_agc_pwm(struct dvb_frontend
*fe
, u8
*_agc_pwm
);
156 static inline struct dvb_frontend
*m88ds3103_attach(
157 const struct m88ds3103_config
*config
,
158 struct i2c_adapter
*i2c
,
159 struct i2c_adapter
**tuner_i2c
)
161 pr_warn("%s: driver disabled by Kconfig\n", __func__
);
164 #define m88ds3103_get_agc_pwm NULL