18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *    Support for AltoBeam GB20600 (a.k.a DMB-TH) demodulator
48c2ecf20Sopenharmony_ci *    ATBM8830, ATBM8831
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci *    Copyright (C) 2009 David T.L. Wong <davidtlwong@gmail.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __ATBM8830_H__
108c2ecf20Sopenharmony_ci#define __ATBM8830_H__
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/dvb/frontend.h>
138c2ecf20Sopenharmony_ci#include <linux/i2c.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define ATBM8830_PROD_8830 0
168c2ecf20Sopenharmony_ci#define ATBM8830_PROD_8831 1
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistruct atbm8830_config {
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci	/* product type */
218c2ecf20Sopenharmony_ci	u8 prod;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	/* the demodulator's i2c address */
248c2ecf20Sopenharmony_ci	u8 demod_address;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	/* parallel or serial transport stream */
278c2ecf20Sopenharmony_ci	u8 serial_ts;
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	/* transport stream clock output only when receiving valid stream */
308c2ecf20Sopenharmony_ci	u8 ts_clk_gated;
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci	/* Decoder sample TS data at rising edge of clock */
338c2ecf20Sopenharmony_ci	u8 ts_sampling_edge;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	/* Oscillator clock frequency */
368c2ecf20Sopenharmony_ci	u32 osc_clk_freq; /* in kHz */
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci	/* IF frequency */
398c2ecf20Sopenharmony_ci	u32 if_freq; /* in kHz */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	/* Swap I/Q for zero IF */
428c2ecf20Sopenharmony_ci	u8 zif_swap_iq;
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	/* Tuner AGC settings */
458c2ecf20Sopenharmony_ci	u8 agc_min;
468c2ecf20Sopenharmony_ci	u8 agc_max;
478c2ecf20Sopenharmony_ci	u8 agc_hold_loop;
488c2ecf20Sopenharmony_ci};
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_ATBM8830)
518c2ecf20Sopenharmony_ciextern struct dvb_frontend *atbm8830_attach(const struct atbm8830_config *config,
528c2ecf20Sopenharmony_ci		struct i2c_adapter *i2c);
538c2ecf20Sopenharmony_ci#else
548c2ecf20Sopenharmony_cistatic inline
558c2ecf20Sopenharmony_cistruct dvb_frontend *atbm8830_attach(const struct atbm8830_config *config,
568c2ecf20Sopenharmony_ci		struct i2c_adapter *i2c) {
578c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
588c2ecf20Sopenharmony_ci	return NULL;
598c2ecf20Sopenharmony_ci}
608c2ecf20Sopenharmony_ci#endif /* CONFIG_DVB_ATBM8830 */
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#endif /* __ATBM8830_H__ */
63