diff options
author | Antti Palosaari <crope@iki.fi> | 2017-06-10 20:53:42 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-06-20 10:15:58 -0300 |
commit | 82d1ce3eba6952929efa770e693d3be6e55bd7ab (patch) | |
tree | 86eeaecfb007a0902b6fff56717edd034f9453cb /drivers/media/dvb-frontends/af9013.h | |
parent | a4e2b6fe0edc16a80a3879bab409e18203c57a07 (diff) | |
download | linux-82d1ce3eba6952929efa770e693d3be6e55bd7ab.tar.gz linux-82d1ce3eba6952929efa770e693d3be6e55bd7ab.tar.bz2 linux-82d1ce3eba6952929efa770e693d3be6e55bd7ab.zip |
[media] af9013: add i2c client bindings
Add kernel i2c driver bindings.
That allows dev_* logging, regmap and more.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-frontends/af9013.h')
-rw-r--r-- | drivers/media/dvb-frontends/af9013.h | 84 |
1 files changed, 41 insertions, 43 deletions
diff --git a/drivers/media/dvb-frontends/af9013.h b/drivers/media/dvb-frontends/af9013.h index 277112863719..3f18258b64d4 100644 --- a/drivers/media/dvb-frontends/af9013.h +++ b/drivers/media/dvb-frontends/af9013.h @@ -23,29 +23,26 @@ #include <linux/dvb/frontend.h> -/* AF9013/5 GPIOs (mostly guessed) - demod#1-gpio#0 - set demod#2 i2c-addr for dual devices - demod#1-gpio#1 - xtal setting (?) - demod#1-gpio#3 - tuner#1 - demod#2-gpio#0 - tuner#2 - demod#2-gpio#1 - xtal setting (?) -*/ - -struct af9013_config { - /* - * I2C address - */ - u8 i2c_addr; +/* + * I2C address: 0x1c, 0x1d + */ +/** + * struct af9013_platform_data - Platform data for the af9013 driver + * @clk: Clock frequency. + * @tuner: Used tuner model. + * @if_frequency: IF frequency. + * @ts_mode: TS mode. + * @spec_inv: Input spectrum inverted. + * @api_version: Firmware API version. + * @gpio: GPIOs. + * @get_dvb_frontend: Get DVB frontend callback. + */ +struct af9013_platform_data { /* - * clock * 20480000, 25000000, 28000000, 28800000 */ - u32 clock; - - /* - * tuner - */ + u32 clk; #define AF9013_TUNER_MXL5003D 3 /* MaxLinear */ #define AF9013_TUNER_MXL5005D 13 /* MaxLinear */ #define AF9013_TUNER_MXL5005R 30 /* MaxLinear */ @@ -60,33 +57,13 @@ struct af9013_config { #define AF9013_TUNER_MXL5007T 177 /* MaxLinear */ #define AF9013_TUNER_TDA18218 179 /* NXP */ u8 tuner; - - /* - * IF frequency - */ u32 if_frequency; - - /* - * TS settings - */ -#define AF9013_TS_USB 0 -#define AF9013_TS_PARALLEL 1 -#define AF9013_TS_SERIAL 2 - u8 ts_mode:2; - - /* - * input spectrum inversion - */ +#define AF9013_TS_MODE_USB 0 +#define AF9013_TS_MODE_PARALLEL 1 +#define AF9013_TS_MODE_SERIAL 2 + u8 ts_mode; bool spec_inv; - - /* - * firmware API version - */ u8 api_version[4]; - - /* - * GPIOs - */ #define AF9013_GPIO_ON (1 << 0) #define AF9013_GPIO_EN (1 << 1) #define AF9013_GPIO_O (1 << 2) @@ -96,8 +73,29 @@ struct af9013_config { #define AF9013_GPIO_TUNER_ON (AF9013_GPIO_ON|AF9013_GPIO_EN) #define AF9013_GPIO_TUNER_OFF (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O) u8 gpio[4]; + + struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *); + +/* private: For legacy media attach wrapper. Do not set value. */ + bool attach_in_use; + u8 i2c_addr; + u32 clock; }; +#define af9013_config af9013_platform_data +#define AF9013_TS_USB AF9013_TS_MODE_USB +#define AF9013_TS_PARALLEL AF9013_TS_MODE_PARALLEL +#define AF9013_TS_SERIAL AF9013_TS_MODE_SERIAL + +/* + * AF9013/5 GPIOs (mostly guessed) + * demod#1-gpio#0 - set demod#2 i2c-addr for dual devices + * demod#1-gpio#1 - xtal setting (?) + * demod#1-gpio#3 - tuner#1 + * demod#2-gpio#0 - tuner#2 + * demod#2-gpio#1 - xtal setting (?) + */ + #if IS_REACHABLE(CONFIG_DVB_AF9013) extern struct dvb_frontend *af9013_attach(const struct af9013_config *config, struct i2c_adapter *i2c); |