18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *    Support for LGDT3302 and LGDT3303 - VSB/QAM
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *    Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef LGDT330X_H
98c2ecf20Sopenharmony_ci#define LGDT330X_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/dvb/frontend.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_citypedef enum lg_chip_t {
148c2ecf20Sopenharmony_ci		UNDEFINED,
158c2ecf20Sopenharmony_ci		LGDT3302,
168c2ecf20Sopenharmony_ci		LGDT3303
178c2ecf20Sopenharmony_ci}lg_chip_type;
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/**
208c2ecf20Sopenharmony_ci * struct lgdt330x_config - contains lgdt330x configuration
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * @demod_chip:		LG demodulator chip LGDT3302 or LGDT3303
238c2ecf20Sopenharmony_ci * @serial_mpeg:	MPEG hardware interface - 0:parallel 1:serial
248c2ecf20Sopenharmony_ci * @pll_rf_set:		Callback function to set PLL interface
258c2ecf20Sopenharmony_ci * @set_ts_params:	Callback function to set device param for start_dma
268c2ecf20Sopenharmony_ci * @clock_polarity_flip:
278c2ecf20Sopenharmony_ci *	Flip the polarity of the mpeg data transfer clock using alternate
288c2ecf20Sopenharmony_ci *	init data.
298c2ecf20Sopenharmony_ci *	This option applies ONLY to LGDT3303 - 0:disabled (default) 1:enabled
308c2ecf20Sopenharmony_ci * @get_dvb_frontend:
318c2ecf20Sopenharmony_ci *	returns the frontend associated with this I2C client.
328c2ecf20Sopenharmony_ci *	Filled by the driver.
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_cistruct lgdt330x_config
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	lg_chip_type demod_chip;
378c2ecf20Sopenharmony_ci	int serial_mpeg;
388c2ecf20Sopenharmony_ci	int (*pll_rf_set) (struct dvb_frontend* fe, int index);
398c2ecf20Sopenharmony_ci	int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
408c2ecf20Sopenharmony_ci	int clock_polarity_flip;
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
438c2ecf20Sopenharmony_ci};
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_LGDT330X)
468c2ecf20Sopenharmony_cistruct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *config,
478c2ecf20Sopenharmony_ci				     u8 demod_address,
488c2ecf20Sopenharmony_ci				     struct i2c_adapter *i2c);
498c2ecf20Sopenharmony_ci#else
508c2ecf20Sopenharmony_cistatic inline
518c2ecf20Sopenharmony_cistruct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *config,
528c2ecf20Sopenharmony_ci				     u8 demod_address,
538c2ecf20Sopenharmony_ci				     struct i2c_adapter *i2c)
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_LGDT330X
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#endif /* LGDT330X_H */
61