18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Afatech AF9013 demodulator driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
68c2ecf20Sopenharmony_ci * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Thanks to Afatech who kindly provided information.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef AF9013_H
128c2ecf20Sopenharmony_ci#define AF9013_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/dvb/frontend.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*
178c2ecf20Sopenharmony_ci * I2C address: 0x1c, 0x1d
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci/**
218c2ecf20Sopenharmony_ci * struct af9013_platform_data - Platform data for the af9013 driver
228c2ecf20Sopenharmony_ci * @clk: Clock frequency.
238c2ecf20Sopenharmony_ci * @tuner: Used tuner model.
248c2ecf20Sopenharmony_ci * @if_frequency: IF frequency.
258c2ecf20Sopenharmony_ci * @ts_mode: TS mode.
268c2ecf20Sopenharmony_ci * @ts_output_pin: TS output pin.
278c2ecf20Sopenharmony_ci * @spec_inv: Input spectrum inverted.
288c2ecf20Sopenharmony_ci * @api_version: Firmware API version.
298c2ecf20Sopenharmony_ci * @gpio: GPIOs.
308c2ecf20Sopenharmony_ci * @get_dvb_frontend: Get DVB frontend callback.
318c2ecf20Sopenharmony_ci * @get_i2c_adapter: Get I2C adapter.
328c2ecf20Sopenharmony_ci * @pid_filter_ctrl: Control PID filter.
338c2ecf20Sopenharmony_ci * @pid_filter: Set PID to PID filter.
348c2ecf20Sopenharmony_ci */
358c2ecf20Sopenharmony_cistruct af9013_platform_data {
368c2ecf20Sopenharmony_ci	/*
378c2ecf20Sopenharmony_ci	 * 20480000, 25000000, 28000000, 28800000
388c2ecf20Sopenharmony_ci	 */
398c2ecf20Sopenharmony_ci	u32 clk;
408c2ecf20Sopenharmony_ci#define AF9013_TUNER_MXL5003D      3 /* MaxLinear */
418c2ecf20Sopenharmony_ci#define AF9013_TUNER_MXL5005D     13 /* MaxLinear */
428c2ecf20Sopenharmony_ci#define AF9013_TUNER_MXL5005R     30 /* MaxLinear */
438c2ecf20Sopenharmony_ci#define AF9013_TUNER_ENV77H11D5  129 /* Panasonic */
448c2ecf20Sopenharmony_ci#define AF9013_TUNER_MT2060      130 /* Microtune */
458c2ecf20Sopenharmony_ci#define AF9013_TUNER_MC44S803    133 /* Freescale */
468c2ecf20Sopenharmony_ci#define AF9013_TUNER_QT1010      134 /* Quantek */
478c2ecf20Sopenharmony_ci#define AF9013_TUNER_UNKNOWN     140 /* for can tuners ? */
488c2ecf20Sopenharmony_ci#define AF9013_TUNER_MT2060_2    147 /* Microtune */
498c2ecf20Sopenharmony_ci#define AF9013_TUNER_TDA18271    156 /* NXP */
508c2ecf20Sopenharmony_ci#define AF9013_TUNER_QT1010A     162 /* Quantek */
518c2ecf20Sopenharmony_ci#define AF9013_TUNER_MXL5007T    177 /* MaxLinear */
528c2ecf20Sopenharmony_ci#define AF9013_TUNER_TDA18218    179 /* NXP */
538c2ecf20Sopenharmony_ci	u8 tuner;
548c2ecf20Sopenharmony_ci	u32 if_frequency;
558c2ecf20Sopenharmony_ci#define AF9013_TS_MODE_USB       0
568c2ecf20Sopenharmony_ci#define AF9013_TS_MODE_PARALLEL  1
578c2ecf20Sopenharmony_ci#define AF9013_TS_MODE_SERIAL    2
588c2ecf20Sopenharmony_ci	u8 ts_mode;
598c2ecf20Sopenharmony_ci	u8 ts_output_pin;
608c2ecf20Sopenharmony_ci	bool spec_inv;
618c2ecf20Sopenharmony_ci	u8 api_version[4];
628c2ecf20Sopenharmony_ci#define AF9013_GPIO_ON (1 << 0)
638c2ecf20Sopenharmony_ci#define AF9013_GPIO_EN (1 << 1)
648c2ecf20Sopenharmony_ci#define AF9013_GPIO_O  (1 << 2)
658c2ecf20Sopenharmony_ci#define AF9013_GPIO_I  (1 << 3)
668c2ecf20Sopenharmony_ci#define AF9013_GPIO_LO (AF9013_GPIO_ON|AF9013_GPIO_EN)
678c2ecf20Sopenharmony_ci#define AF9013_GPIO_HI (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
688c2ecf20Sopenharmony_ci#define AF9013_GPIO_TUNER_ON  (AF9013_GPIO_ON|AF9013_GPIO_EN)
698c2ecf20Sopenharmony_ci#define AF9013_GPIO_TUNER_OFF (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
708c2ecf20Sopenharmony_ci	u8 gpio[4];
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci	struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
738c2ecf20Sopenharmony_ci	struct i2c_adapter* (*get_i2c_adapter)(struct i2c_client *);
748c2ecf20Sopenharmony_ci	int (*pid_filter_ctrl)(struct dvb_frontend *, int);
758c2ecf20Sopenharmony_ci	int (*pid_filter)(struct dvb_frontend *, u8, u16, int);
768c2ecf20Sopenharmony_ci};
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci/*
798c2ecf20Sopenharmony_ci * AF9013/5 GPIOs (mostly guessed)
808c2ecf20Sopenharmony_ci * demod#1-gpio#0 - set demod#2 i2c-addr for dual devices
818c2ecf20Sopenharmony_ci * demod#1-gpio#1 - xtal setting (?)
828c2ecf20Sopenharmony_ci * demod#1-gpio#3 - tuner#1
838c2ecf20Sopenharmony_ci * demod#2-gpio#0 - tuner#2
848c2ecf20Sopenharmony_ci * demod#2-gpio#1 - xtal setting (?)
858c2ecf20Sopenharmony_ci */
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#endif /* AF9013_H */
88