2008-09-15 15:01:52 -03:00
/*
2010-06-17 21:19:13 -03:00
* Afatech AF9013 demodulator driver
2008-09-15 15:01:52 -03:00
*
* Copyright ( C ) 2007 Antti Palosaari < crope @ iki . fi >
2011-11-28 20:58:11 -03:00
* Copyright ( C ) 2011 Antti Palosaari < crope @ iki . fi >
2008-09-15 15:01:52 -03:00
*
* Thanks to Afatech who kindly provided information .
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
*/
2011-11-28 20:58:11 -03:00
# ifndef AF9013_H
# define AF9013_H
2008-09-15 15:01:52 -03:00
# include <linux/dvb/frontend.h>
2017-06-10 20:53:42 -03:00
/*
* I2C address : 0x1c , 0x1d
*/
2011-11-28 20:58:11 -03:00
2017-06-10 20:53:42 -03:00
/**
* 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 .
2017-06-13 20:32:15 -03:00
* @ ts_output_pin : TS output pin .
2017-06-10 20:53:42 -03:00
* @ spec_inv : Input spectrum inverted .
* @ api_version : Firmware API version .
* @ gpio : GPIOs .
* @ get_dvb_frontend : Get DVB frontend callback .
2017-11-29 14:02:22 -05:00
*
* 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 ( ? )
2017-06-10 20:53:42 -03:00
*/
struct af9013_platform_data {
2011-11-28 20:58:11 -03:00
/*
* 20480000 , 25000000 , 28000000 , 28800000
*/
2017-06-10 20:53:42 -03:00
u32 clk ;
2011-11-28 20:58:11 -03:00
# define AF9013_TUNER_MXL5003D 3 /* MaxLinear */
# define AF9013_TUNER_MXL5005D 13 /* MaxLinear */
# define AF9013_TUNER_MXL5005R 30 /* MaxLinear */
# define AF9013_TUNER_ENV77H11D5 129 /* Panasonic */
# define AF9013_TUNER_MT2060 130 /* Microtune */
# define AF9013_TUNER_MC44S803 133 /* Freescale */
# define AF9013_TUNER_QT1010 134 /* Quantek */
# define AF9013_TUNER_UNKNOWN 140 /* for can tuners ? */
# define AF9013_TUNER_MT2060_2 147 /* Microtune */
# define AF9013_TUNER_TDA18271 156 /* NXP */
# define AF9013_TUNER_QT1010A 162 /* Quantek */
# define AF9013_TUNER_MXL5007T 177 /* MaxLinear */
# define AF9013_TUNER_TDA18218 179 /* NXP */
u8 tuner ;
u32 if_frequency ;
2017-06-10 20:53:42 -03:00
# define AF9013_TS_MODE_USB 0
# define AF9013_TS_MODE_PARALLEL 1
# define AF9013_TS_MODE_SERIAL 2
u8 ts_mode ;
2017-06-13 20:32:15 -03:00
u8 ts_output_pin ;
2011-11-28 20:58:11 -03:00
bool spec_inv ;
u8 api_version [ 4 ] ;
2008-09-15 15:01:52 -03:00
# define AF9013_GPIO_ON (1 << 0)
# define AF9013_GPIO_EN (1 << 1)
# define AF9013_GPIO_O (1 << 2)
# define AF9013_GPIO_I (1 << 3)
# define AF9013_GPIO_LO (AF9013_GPIO_ON|AF9013_GPIO_EN)
# define AF9013_GPIO_HI (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
# 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 ] ;
2017-06-10 20:53:42 -03:00
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 ;
2008-09-15 15:01:52 -03:00
} ;
2017-06-10 20:53:42 -03:00
# 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
2015-02-18 14:12:42 -03:00
# if IS_REACHABLE(CONFIG_DVB_AF9013)
2017-11-29 14:02:22 -05:00
/**
* Attach an af9013 demod
*
* @ config : pointer to & struct af9013_config with demod configuration .
* @ i2c : i2c adapter to use .
*
* return : FE pointer on success , NULL on failure .
*/
2008-09-15 15:01:52 -03:00
extern struct dvb_frontend * af9013_attach ( const struct af9013_config * config ,
struct i2c_adapter * i2c ) ;
# else
static inline struct dvb_frontend * af9013_attach (
const struct af9013_config * config , struct i2c_adapter * i2c )
{
2012-09-12 20:23:43 -03:00
pr_warn ( " %s: driver disabled by Kconfig \n " , __func__ ) ;
2008-09-15 15:01:52 -03:00
return NULL ;
}
# endif /* CONFIG_DVB_AF9013 */
2011-11-28 20:58:11 -03:00
# endif /* AF9013_H */