19a0bf528SMauro Carvalho Chehab /* 29a0bf528SMauro Carvalho Chehab * Afatech AF9013 demodulator driver 39a0bf528SMauro Carvalho Chehab * 49a0bf528SMauro Carvalho Chehab * Copyright (C) 2007 Antti Palosaari <crope@iki.fi> 59a0bf528SMauro Carvalho Chehab * Copyright (C) 2011 Antti Palosaari <crope@iki.fi> 69a0bf528SMauro Carvalho Chehab * 79a0bf528SMauro Carvalho Chehab * Thanks to Afatech who kindly provided information. 89a0bf528SMauro Carvalho Chehab * 99a0bf528SMauro Carvalho Chehab * This program is free software; you can redistribute it and/or modify 109a0bf528SMauro Carvalho Chehab * it under the terms of the GNU General Public License as published by 119a0bf528SMauro Carvalho Chehab * the Free Software Foundation; either version 2 of the License, or 129a0bf528SMauro Carvalho Chehab * (at your option) any later version. 139a0bf528SMauro Carvalho Chehab * 149a0bf528SMauro Carvalho Chehab * This program is distributed in the hope that it will be useful, 159a0bf528SMauro Carvalho Chehab * but WITHOUT ANY WARRANTY; without even the implied warranty of 169a0bf528SMauro Carvalho Chehab * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 179a0bf528SMauro Carvalho Chehab * GNU General Public License for more details. 189a0bf528SMauro Carvalho Chehab * 199a0bf528SMauro Carvalho Chehab */ 209a0bf528SMauro Carvalho Chehab 219a0bf528SMauro Carvalho Chehab #ifndef AF9013_H 229a0bf528SMauro Carvalho Chehab #define AF9013_H 239a0bf528SMauro Carvalho Chehab 249a0bf528SMauro Carvalho Chehab #include <linux/dvb/frontend.h> 259a0bf528SMauro Carvalho Chehab 2682d1ce3eSAntti Palosaari /* 2782d1ce3eSAntti Palosaari * I2C address: 0x1c, 0x1d 289a0bf528SMauro Carvalho Chehab */ 299a0bf528SMauro Carvalho Chehab 3082d1ce3eSAntti Palosaari /** 3182d1ce3eSAntti Palosaari * struct af9013_platform_data - Platform data for the af9013 driver 3282d1ce3eSAntti Palosaari * @clk: Clock frequency. 3382d1ce3eSAntti Palosaari * @tuner: Used tuner model. 3482d1ce3eSAntti Palosaari * @if_frequency: IF frequency. 3582d1ce3eSAntti Palosaari * @ts_mode: TS mode. 36*eaa455f0SAntti Palosaari * @ts_output_pin: TS output pin. 3782d1ce3eSAntti Palosaari * @spec_inv: Input spectrum inverted. 3882d1ce3eSAntti Palosaari * @api_version: Firmware API version. 3982d1ce3eSAntti Palosaari * @gpio: GPIOs. 4082d1ce3eSAntti Palosaari * @get_dvb_frontend: Get DVB frontend callback. 419a0bf528SMauro Carvalho Chehab */ 4282d1ce3eSAntti Palosaari struct af9013_platform_data { 439a0bf528SMauro Carvalho Chehab /* 449a0bf528SMauro Carvalho Chehab * 20480000, 25000000, 28000000, 28800000 459a0bf528SMauro Carvalho Chehab */ 4682d1ce3eSAntti Palosaari u32 clk; 479a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MXL5003D 3 /* MaxLinear */ 489a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MXL5005D 13 /* MaxLinear */ 499a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MXL5005R 30 /* MaxLinear */ 509a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_ENV77H11D5 129 /* Panasonic */ 519a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MT2060 130 /* Microtune */ 529a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MC44S803 133 /* Freescale */ 539a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_QT1010 134 /* Quantek */ 549a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_UNKNOWN 140 /* for can tuners ? */ 559a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MT2060_2 147 /* Microtune */ 569a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_TDA18271 156 /* NXP */ 579a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_QT1010A 162 /* Quantek */ 589a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MXL5007T 177 /* MaxLinear */ 599a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_TDA18218 179 /* NXP */ 609a0bf528SMauro Carvalho Chehab u8 tuner; 619a0bf528SMauro Carvalho Chehab u32 if_frequency; 6282d1ce3eSAntti Palosaari #define AF9013_TS_MODE_USB 0 6382d1ce3eSAntti Palosaari #define AF9013_TS_MODE_PARALLEL 1 6482d1ce3eSAntti Palosaari #define AF9013_TS_MODE_SERIAL 2 6582d1ce3eSAntti Palosaari u8 ts_mode; 66*eaa455f0SAntti Palosaari u8 ts_output_pin; 679a0bf528SMauro Carvalho Chehab bool spec_inv; 689a0bf528SMauro Carvalho Chehab u8 api_version[4]; 699a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_ON (1 << 0) 709a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_EN (1 << 1) 719a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_O (1 << 2) 729a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_I (1 << 3) 739a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_LO (AF9013_GPIO_ON|AF9013_GPIO_EN) 749a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_HI (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O) 759a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_TUNER_ON (AF9013_GPIO_ON|AF9013_GPIO_EN) 769a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_TUNER_OFF (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O) 779a0bf528SMauro Carvalho Chehab u8 gpio[4]; 7882d1ce3eSAntti Palosaari 7982d1ce3eSAntti Palosaari struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *); 8082d1ce3eSAntti Palosaari 8182d1ce3eSAntti Palosaari /* private: For legacy media attach wrapper. Do not set value. */ 8282d1ce3eSAntti Palosaari bool attach_in_use; 8382d1ce3eSAntti Palosaari u8 i2c_addr; 8482d1ce3eSAntti Palosaari u32 clock; 859a0bf528SMauro Carvalho Chehab }; 869a0bf528SMauro Carvalho Chehab 8782d1ce3eSAntti Palosaari #define af9013_config af9013_platform_data 8882d1ce3eSAntti Palosaari #define AF9013_TS_USB AF9013_TS_MODE_USB 8982d1ce3eSAntti Palosaari #define AF9013_TS_PARALLEL AF9013_TS_MODE_PARALLEL 9082d1ce3eSAntti Palosaari #define AF9013_TS_SERIAL AF9013_TS_MODE_SERIAL 9182d1ce3eSAntti Palosaari 9282d1ce3eSAntti Palosaari /* 9382d1ce3eSAntti Palosaari * AF9013/5 GPIOs (mostly guessed) 9482d1ce3eSAntti Palosaari * demod#1-gpio#0 - set demod#2 i2c-addr for dual devices 9582d1ce3eSAntti Palosaari * demod#1-gpio#1 - xtal setting (?) 9682d1ce3eSAntti Palosaari * demod#1-gpio#3 - tuner#1 9782d1ce3eSAntti Palosaari * demod#2-gpio#0 - tuner#2 9882d1ce3eSAntti Palosaari * demod#2-gpio#1 - xtal setting (?) 9982d1ce3eSAntti Palosaari */ 10082d1ce3eSAntti Palosaari 1019b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_AF9013) 1029a0bf528SMauro Carvalho Chehab extern struct dvb_frontend *af9013_attach(const struct af9013_config *config, 1039a0bf528SMauro Carvalho Chehab struct i2c_adapter *i2c); 1049a0bf528SMauro Carvalho Chehab #else 1059a0bf528SMauro Carvalho Chehab static inline struct dvb_frontend *af9013_attach( 1069a0bf528SMauro Carvalho Chehab const struct af9013_config *config, struct i2c_adapter *i2c) 1079a0bf528SMauro Carvalho Chehab { 1088df379c5SAntti Palosaari pr_warn("%s: driver disabled by Kconfig\n", __func__); 1099a0bf528SMauro Carvalho Chehab return NULL; 1109a0bf528SMauro Carvalho Chehab } 1119a0bf528SMauro Carvalho Chehab #endif /* CONFIG_DVB_AF9013 */ 1129a0bf528SMauro Carvalho Chehab 1139a0bf528SMauro Carvalho Chehab #endif /* AF9013_H */ 114