18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci    NXP TDA10048HN DVB OFDM demodulator driver
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci    Copyright (C) 2009 Steven Toth <stoth@kernellabs.com>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci*/
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef TDA10048_H
118c2ecf20Sopenharmony_ci#define TDA10048_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <linux/dvb/frontend.h>
148c2ecf20Sopenharmony_ci#include <linux/firmware.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistruct tda10048_config {
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci	/* the demodulator's i2c address */
198c2ecf20Sopenharmony_ci	u8 demod_address;
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci	/* serial/parallel output */
228c2ecf20Sopenharmony_ci#define TDA10048_PARALLEL_OUTPUT 0
238c2ecf20Sopenharmony_ci#define TDA10048_SERIAL_OUTPUT   1
248c2ecf20Sopenharmony_ci	u8 output_mode;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define TDA10048_BULKWRITE_200	200
278c2ecf20Sopenharmony_ci#define TDA10048_BULKWRITE_50	50
288c2ecf20Sopenharmony_ci	u8 fwbulkwritelen;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	/* Spectral Inversion */
318c2ecf20Sopenharmony_ci#define TDA10048_INVERSION_OFF 0
328c2ecf20Sopenharmony_ci#define TDA10048_INVERSION_ON  1
338c2ecf20Sopenharmony_ci	u8 inversion;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define TDA10048_IF_3300  3300
368c2ecf20Sopenharmony_ci#define TDA10048_IF_3500  3500
378c2ecf20Sopenharmony_ci#define TDA10048_IF_3800  3800
388c2ecf20Sopenharmony_ci#define TDA10048_IF_4000  4000
398c2ecf20Sopenharmony_ci#define TDA10048_IF_4300  4300
408c2ecf20Sopenharmony_ci#define TDA10048_IF_4500  4500
418c2ecf20Sopenharmony_ci#define TDA10048_IF_4750  4750
428c2ecf20Sopenharmony_ci#define TDA10048_IF_5000  5000
438c2ecf20Sopenharmony_ci#define TDA10048_IF_36130 36130
448c2ecf20Sopenharmony_ci	u16 dtv6_if_freq_khz;
458c2ecf20Sopenharmony_ci	u16 dtv7_if_freq_khz;
468c2ecf20Sopenharmony_ci	u16 dtv8_if_freq_khz;
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define TDA10048_CLK_4000  4000
498c2ecf20Sopenharmony_ci#define TDA10048_CLK_16000 16000
508c2ecf20Sopenharmony_ci	u16 clk_freq_khz;
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci	/* Disable I2C gate access */
538c2ecf20Sopenharmony_ci	u8 disable_gate_access;
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci	bool no_firmware;
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci	bool set_pll;
588c2ecf20Sopenharmony_ci	u8 pll_m;
598c2ecf20Sopenharmony_ci	u8 pll_p;
608c2ecf20Sopenharmony_ci	u8 pll_n;
618c2ecf20Sopenharmony_ci};
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_TDA10048)
648c2ecf20Sopenharmony_ciextern struct dvb_frontend *tda10048_attach(
658c2ecf20Sopenharmony_ci	const struct tda10048_config *config,
668c2ecf20Sopenharmony_ci	struct i2c_adapter *i2c);
678c2ecf20Sopenharmony_ci#else
688c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *tda10048_attach(
698c2ecf20Sopenharmony_ci	const struct tda10048_config *config,
708c2ecf20Sopenharmony_ci	struct i2c_adapter *i2c)
718c2ecf20Sopenharmony_ci{
728c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
738c2ecf20Sopenharmony_ci	return NULL;
748c2ecf20Sopenharmony_ci}
758c2ecf20Sopenharmony_ci#endif /* CONFIG_DVB_TDA10048 */
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#endif /* TDA10048_H */
78