18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci    TDA10021/TDA10023  - Single Chip Cable Channel Receiver driver module
48c2ecf20Sopenharmony_ci			 used on the the Siemens DVB-C cards
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci    Copyright (C) 1999 Convergence Integrated Media GmbH <ralph@convergence.de>
78c2ecf20Sopenharmony_ci    Copyright (C) 2004 Markus Schulz <msc@antzsystem.de>
88c2ecf20Sopenharmony_ci		   Support for TDA10021
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci*/
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifndef TDA1002x_H
138c2ecf20Sopenharmony_ci#define TDA1002x_H
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <linux/dvb/frontend.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistruct tda1002x_config {
188c2ecf20Sopenharmony_ci	/* the demodulator's i2c address */
198c2ecf20Sopenharmony_ci	u8 demod_address;
208c2ecf20Sopenharmony_ci	u8 invert;
218c2ecf20Sopenharmony_ci};
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cienum tda10023_output_mode {
248c2ecf20Sopenharmony_ci	TDA10023_OUTPUT_MODE_PARALLEL_A = 0xe0,
258c2ecf20Sopenharmony_ci	TDA10023_OUTPUT_MODE_PARALLEL_B = 0xa1,
268c2ecf20Sopenharmony_ci	TDA10023_OUTPUT_MODE_PARALLEL_C = 0xa0,
278c2ecf20Sopenharmony_ci	TDA10023_OUTPUT_MODE_SERIAL, /* TODO: not implemented */
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistruct tda10023_config {
318c2ecf20Sopenharmony_ci	/* the demodulator's i2c address */
328c2ecf20Sopenharmony_ci	u8 demod_address;
338c2ecf20Sopenharmony_ci	u8 invert;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	/* clock settings */
368c2ecf20Sopenharmony_ci	u32 xtal; /* defaults: 28920000 */
378c2ecf20Sopenharmony_ci	u8 pll_m; /* defaults: 8 */
388c2ecf20Sopenharmony_ci	u8 pll_p; /* defaults: 4 */
398c2ecf20Sopenharmony_ci	u8 pll_n; /* defaults: 1 */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	/* MPEG2 TS output mode */
428c2ecf20Sopenharmony_ci	u8 output_mode;
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	/* input freq offset + baseband conversion type */
458c2ecf20Sopenharmony_ci	u16 deltaf;
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_TDA10021)
498c2ecf20Sopenharmony_ciextern struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config,
508c2ecf20Sopenharmony_ci					    struct i2c_adapter* i2c, u8 pwm);
518c2ecf20Sopenharmony_ci#else
528c2ecf20Sopenharmony_cistatic inline struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config,
538c2ecf20Sopenharmony_ci					    struct i2c_adapter* i2c, u8 pwm)
548c2ecf20Sopenharmony_ci{
558c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
568c2ecf20Sopenharmony_ci	return NULL;
578c2ecf20Sopenharmony_ci}
588c2ecf20Sopenharmony_ci#endif // CONFIG_DVB_TDA10021
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_TDA10023)
618c2ecf20Sopenharmony_ciextern struct dvb_frontend *tda10023_attach(
628c2ecf20Sopenharmony_ci	const struct tda10023_config *config,
638c2ecf20Sopenharmony_ci	struct i2c_adapter *i2c, u8 pwm);
648c2ecf20Sopenharmony_ci#else
658c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *tda10023_attach(
668c2ecf20Sopenharmony_ci	const struct tda10023_config *config,
678c2ecf20Sopenharmony_ci	struct i2c_adapter *i2c, u8 pwm)
688c2ecf20Sopenharmony_ci{
698c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
708c2ecf20Sopenharmony_ci	return NULL;
718c2ecf20Sopenharmony_ci}
728c2ecf20Sopenharmony_ci#endif // CONFIG_DVB_TDA10023
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#endif // TDA1002x_H
75