18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * tuner-xc2028
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2007-2008 Mauro Carvalho Chehab <mchehab@kernel.org>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __TUNER_XC2028_H__
98c2ecf20Sopenharmony_ci#define __TUNER_XC2028_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <media/dvb_frontend.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define XC2028_DEFAULT_FIRMWARE "xc3028-v27.fw"
148c2ecf20Sopenharmony_ci#define XC3028L_DEFAULT_FIRMWARE "xc3028L-v36.fw"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*      Dmoduler		IF (kHz) */
178c2ecf20Sopenharmony_ci#define	XC3028_FE_DEFAULT	0		/* Don't load SCODE */
188c2ecf20Sopenharmony_ci#define XC3028_FE_LG60		6000
198c2ecf20Sopenharmony_ci#define	XC3028_FE_ATI638	6380
208c2ecf20Sopenharmony_ci#define	XC3028_FE_OREN538	5380
218c2ecf20Sopenharmony_ci#define	XC3028_FE_OREN36	3600
228c2ecf20Sopenharmony_ci#define	XC3028_FE_TOYOTA388	3880
238c2ecf20Sopenharmony_ci#define	XC3028_FE_TOYOTA794	7940
248c2ecf20Sopenharmony_ci#define	XC3028_FE_DIBCOM52	5200
258c2ecf20Sopenharmony_ci#define	XC3028_FE_ZARLINK456	4560
268c2ecf20Sopenharmony_ci#define	XC3028_FE_CHINA		5200
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cienum firmware_type {
298c2ecf20Sopenharmony_ci	XC2028_AUTO = 0,        /* By default, auto-detects */
308c2ecf20Sopenharmony_ci	XC2028_D2633,
318c2ecf20Sopenharmony_ci	XC2028_D2620,
328c2ecf20Sopenharmony_ci};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistruct xc2028_ctrl {
358c2ecf20Sopenharmony_ci	char			*fname;
368c2ecf20Sopenharmony_ci	int			max_len;
378c2ecf20Sopenharmony_ci	int			msleep;
388c2ecf20Sopenharmony_ci	unsigned int		scode_table;
398c2ecf20Sopenharmony_ci	unsigned int		mts   :1;
408c2ecf20Sopenharmony_ci	unsigned int		input1:1;
418c2ecf20Sopenharmony_ci	unsigned int		vhfbw7:1;
428c2ecf20Sopenharmony_ci	unsigned int		uhfbw8:1;
438c2ecf20Sopenharmony_ci	unsigned int		disable_power_mgmt:1;
448c2ecf20Sopenharmony_ci	unsigned int            read_not_reliable:1;
458c2ecf20Sopenharmony_ci	unsigned int		demod;
468c2ecf20Sopenharmony_ci	enum firmware_type	type:2;
478c2ecf20Sopenharmony_ci};
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_cistruct xc2028_config {
508c2ecf20Sopenharmony_ci	struct i2c_adapter *i2c_adap;
518c2ecf20Sopenharmony_ci	u8		   i2c_addr;
528c2ecf20Sopenharmony_ci	struct xc2028_ctrl *ctrl;
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/* xc2028 commands for callback */
568c2ecf20Sopenharmony_ci#define XC2028_TUNER_RESET	0
578c2ecf20Sopenharmony_ci#define XC2028_RESET_CLK	1
588c2ecf20Sopenharmony_ci#define XC2028_I2C_FLUSH	2
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC2028)
618c2ecf20Sopenharmony_ciextern struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
628c2ecf20Sopenharmony_ci					  struct xc2028_config *cfg);
638c2ecf20Sopenharmony_ci#else
648c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
658c2ecf20Sopenharmony_ci						 struct xc2028_config *cfg)
668c2ecf20Sopenharmony_ci{
678c2ecf20Sopenharmony_ci	printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n",
688c2ecf20Sopenharmony_ci	       __func__);
698c2ecf20Sopenharmony_ci	return NULL;
708c2ecf20Sopenharmony_ci}
718c2ecf20Sopenharmony_ci#endif
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#endif /* __TUNER_XC2028_H__ */
74