Commit 82d1ce3e authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] af9013: add i2c client bindings

Add kernel i2c driver bindings.
That allows dev_* logging, regmap and more.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent a4e2b6fe
This diff is collapsed.
...@@ -23,29 +23,26 @@ ...@@ -23,29 +23,26 @@
#include <linux/dvb/frontend.h> #include <linux/dvb/frontend.h>
/* AF9013/5 GPIOs (mostly guessed) /*
demod#1-gpio#0 - set demod#2 i2c-addr for dual devices * I2C address: 0x1c, 0x1d
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;
/* /**
* clock * struct af9013_platform_data - Platform data for the af9013 driver
* 20480000, 25000000, 28000000, 28800000 * @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.
*/ */
u32 clock; struct af9013_platform_data {
/* /*
* tuner * 20480000, 25000000, 28000000, 28800000
*/ */
u32 clk;
#define AF9013_TUNER_MXL5003D 3 /* MaxLinear */ #define AF9013_TUNER_MXL5003D 3 /* MaxLinear */
#define AF9013_TUNER_MXL5005D 13 /* MaxLinear */ #define AF9013_TUNER_MXL5005D 13 /* MaxLinear */
#define AF9013_TUNER_MXL5005R 30 /* MaxLinear */ #define AF9013_TUNER_MXL5005R 30 /* MaxLinear */
...@@ -60,33 +57,13 @@ struct af9013_config { ...@@ -60,33 +57,13 @@ struct af9013_config {
#define AF9013_TUNER_MXL5007T 177 /* MaxLinear */ #define AF9013_TUNER_MXL5007T 177 /* MaxLinear */
#define AF9013_TUNER_TDA18218 179 /* NXP */ #define AF9013_TUNER_TDA18218 179 /* NXP */
u8 tuner; u8 tuner;
/*
* IF frequency
*/
u32 if_frequency; u32 if_frequency;
#define AF9013_TS_MODE_USB 0
/* #define AF9013_TS_MODE_PARALLEL 1
* TS settings #define AF9013_TS_MODE_SERIAL 2
*/ u8 ts_mode;
#define AF9013_TS_USB 0
#define AF9013_TS_PARALLEL 1
#define AF9013_TS_SERIAL 2
u8 ts_mode:2;
/*
* input spectrum inversion
*/
bool spec_inv; bool spec_inv;
/*
* firmware API version
*/
u8 api_version[4]; u8 api_version[4];
/*
* GPIOs
*/
#define AF9013_GPIO_ON (1 << 0) #define AF9013_GPIO_ON (1 << 0)
#define AF9013_GPIO_EN (1 << 1) #define AF9013_GPIO_EN (1 << 1)
#define AF9013_GPIO_O (1 << 2) #define AF9013_GPIO_O (1 << 2)
...@@ -96,8 +73,29 @@ struct af9013_config { ...@@ -96,8 +73,29 @@ struct af9013_config {
#define AF9013_GPIO_TUNER_ON (AF9013_GPIO_ON|AF9013_GPIO_EN) #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) #define AF9013_GPIO_TUNER_OFF (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
u8 gpio[4]; 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) #if IS_REACHABLE(CONFIG_DVB_AF9013)
extern struct dvb_frontend *af9013_attach(const struct af9013_config *config, extern struct dvb_frontend *af9013_attach(const struct af9013_config *config,
struct i2c_adapter *i2c); struct i2c_adapter *i2c);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment