^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Support for AltoBeam GB20600 (a.k.a DMB-TH) demodulator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * ATBM8830, ATBM8831
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2009 David T.L. Wong <davidtlwong@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifndef __ATBM8830_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define __ATBM8830_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/dvb/frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define ATBM8830_PROD_8830 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define ATBM8830_PROD_8831 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct atbm8830_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /* product type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) u8 prod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /* the demodulator's i2c address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) u8 demod_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* parallel or serial transport stream */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) u8 serial_ts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /* transport stream clock output only when receiving valid stream */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) u8 ts_clk_gated;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* Decoder sample TS data at rising edge of clock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) u8 ts_sampling_edge;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /* Oscillator clock frequency */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u32 osc_clk_freq; /* in kHz */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* IF frequency */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) u32 if_freq; /* in kHz */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /* Swap I/Q for zero IF */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) u8 zif_swap_iq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /* Tuner AGC settings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) u8 agc_min;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) u8 agc_max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) u8 agc_hold_loop;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #if IS_REACHABLE(CONFIG_DVB_ATBM8830)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) extern struct dvb_frontend *atbm8830_attach(const struct atbm8830_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct i2c_adapter *i2c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct dvb_frontend *atbm8830_attach(const struct atbm8830_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct i2c_adapter *i2c) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #endif /* CONFIG_DVB_ATBM8830 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #endif /* __ATBM8830_H__ */