18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Afatech AF9033 demodulator driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
68c2ecf20Sopenharmony_ci * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef AF9033_H
108c2ecf20Sopenharmony_ci#define AF9033_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/*
138c2ecf20Sopenharmony_ci * I2C address: 0x1c, 0x1d, 0x1e, 0x1f
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_cistruct af9033_config {
168c2ecf20Sopenharmony_ci	/*
178c2ecf20Sopenharmony_ci	 * clock Hz
188c2ecf20Sopenharmony_ci	 * 12000000, 22000000, 24000000, 34000000, 32000000, 28000000, 26000000,
198c2ecf20Sopenharmony_ci	 * 30000000, 36000000, 20480000, 16384000
208c2ecf20Sopenharmony_ci	 */
218c2ecf20Sopenharmony_ci	u32 clock;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	/*
248c2ecf20Sopenharmony_ci	 * ADC multiplier
258c2ecf20Sopenharmony_ci	 */
268c2ecf20Sopenharmony_ci#define AF9033_ADC_MULTIPLIER_1X   0
278c2ecf20Sopenharmony_ci#define AF9033_ADC_MULTIPLIER_2X   1
288c2ecf20Sopenharmony_ci	u8 adc_multiplier;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	/*
318c2ecf20Sopenharmony_ci	 * tuner
328c2ecf20Sopenharmony_ci	 */
338c2ecf20Sopenharmony_ci#define AF9033_TUNER_TUA9001     0x27 /* Infineon TUA 9001 */
348c2ecf20Sopenharmony_ci#define AF9033_TUNER_FC0011      0x28 /* Fitipower FC0011 */
358c2ecf20Sopenharmony_ci#define AF9033_TUNER_FC0012      0x2e /* Fitipower FC0012 */
368c2ecf20Sopenharmony_ci#define AF9033_TUNER_MXL5007T    0xa0 /* MaxLinear MxL5007T */
378c2ecf20Sopenharmony_ci#define AF9033_TUNER_TDA18218    0xa1 /* NXP TDA 18218HN */
388c2ecf20Sopenharmony_ci#define AF9033_TUNER_FC2580      0x32 /* FCI FC2580 */
398c2ecf20Sopenharmony_ci/* 50-5f Omega */
408c2ecf20Sopenharmony_ci#define AF9033_TUNER_IT9135_38   0x38 /* Omega */
418c2ecf20Sopenharmony_ci#define AF9033_TUNER_IT9135_51   0x51 /* Omega LNA config 1 */
428c2ecf20Sopenharmony_ci#define AF9033_TUNER_IT9135_52   0x52 /* Omega LNA config 2 */
438c2ecf20Sopenharmony_ci/* 60-6f Omega v2 */
448c2ecf20Sopenharmony_ci#define AF9033_TUNER_IT9135_60   0x60 /* Omega v2 */
458c2ecf20Sopenharmony_ci#define AF9033_TUNER_IT9135_61   0x61 /* Omega v2 LNA config 1 */
468c2ecf20Sopenharmony_ci#define AF9033_TUNER_IT9135_62   0x62 /* Omega v2 LNA config 2 */
478c2ecf20Sopenharmony_ci	u8 tuner;
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci	/*
508c2ecf20Sopenharmony_ci	 * TS settings
518c2ecf20Sopenharmony_ci	 */
528c2ecf20Sopenharmony_ci#define AF9033_TS_MODE_USB       0
538c2ecf20Sopenharmony_ci#define AF9033_TS_MODE_PARALLEL  1
548c2ecf20Sopenharmony_ci#define AF9033_TS_MODE_SERIAL    2
558c2ecf20Sopenharmony_ci	u8 ts_mode:2;
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci	/*
588c2ecf20Sopenharmony_ci	 * input spectrum inversion
598c2ecf20Sopenharmony_ci	 */
608c2ecf20Sopenharmony_ci	bool spec_inv;
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci	/*
638c2ecf20Sopenharmony_ci	 *
648c2ecf20Sopenharmony_ci	 */
658c2ecf20Sopenharmony_ci	bool dyn0_clk;
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci	/*
688c2ecf20Sopenharmony_ci	 * PID filter ops
698c2ecf20Sopenharmony_ci	 */
708c2ecf20Sopenharmony_ci	struct af9033_ops *ops;
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci	/*
738c2ecf20Sopenharmony_ci	 * frontend
748c2ecf20Sopenharmony_ci	 * returned by that driver
758c2ecf20Sopenharmony_ci	 */
768c2ecf20Sopenharmony_ci	struct dvb_frontend **fe;
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci	/*
798c2ecf20Sopenharmony_ci	 * regmap for IT913x integrated tuner driver
808c2ecf20Sopenharmony_ci	 * returned by that driver
818c2ecf20Sopenharmony_ci	 */
828c2ecf20Sopenharmony_ci	struct regmap *regmap;
838c2ecf20Sopenharmony_ci};
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_cistruct af9033_ops {
868c2ecf20Sopenharmony_ci	int (*pid_filter_ctrl)(struct dvb_frontend *fe, int onoff);
878c2ecf20Sopenharmony_ci	int (*pid_filter)(struct dvb_frontend *fe, int index, u16 pid,
888c2ecf20Sopenharmony_ci			  int onoff);
898c2ecf20Sopenharmony_ci};
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#endif /* AF9033_H */
92