blob: 7b58bc06e35caba4a9bd392aca7337affcd9ae1b [file] [log] [blame]
Mauro Carvalho Chehab0c20e8c2017-12-01 08:47:09 -05001/*
2 * SPDX-License-Identifier: GPL-2.0
3 * tuner-xc2028
Mauro Carvalho Chehab6cb45872007-10-02 11:57:03 -03004 *
Mauro Carvalho Chehab32590812018-04-25 05:34:48 -04005 * Copyright (c) 2007-2008 Mauro Carvalho Chehab <mchehab@kernel.org>
Mauro Carvalho Chehab6cb45872007-10-02 11:57:03 -03006 */
7
Mauro Carvalho Chehab215b95b2007-10-23 15:24:06 -03008#ifndef __TUNER_XC2028_H__
9#define __TUNER_XC2028_H__
10
Mauro Carvalho Chehabfada1932017-12-28 13:03:51 -050011#include <media/dvb_frontend.h>
Mauro Carvalho Chehab215b95b2007-10-23 15:24:06 -030012
Mauro Carvalho Chehabde3fe212007-10-24 09:22:08 -030013#define XC2028_DEFAULT_FIRMWARE "xc3028-v27.fw"
Devin Heitmueller5ea7fe42008-09-16 02:02:12 -030014#define XC3028L_DEFAULT_FIRMWARE "xc3028L-v36.fw"
Mauro Carvalho Chehabde3fe212007-10-24 09:22:08 -030015
Mauro Carvalho Chehab66c2d532007-11-25 19:26:36 -030016/* Dmoduler IF (kHz) */
Mauro Carvalho Chehab33e53162008-04-21 06:58:48 -030017#define XC3028_FE_DEFAULT 0 /* Don't load SCODE */
Mauro Carvalho Chehab66c2d532007-11-25 19:26:36 -030018#define XC3028_FE_LG60 6000
19#define XC3028_FE_ATI638 6380
20#define XC3028_FE_OREN538 5380
21#define XC3028_FE_OREN36 3600
22#define XC3028_FE_TOYOTA388 3880
23#define XC3028_FE_TOYOTA794 7940
24#define XC3028_FE_DIBCOM52 5200
25#define XC3028_FE_ZARLINK456 4560
26#define XC3028_FE_CHINA 5200
Mauro Carvalho Chehabb542dfd2007-11-24 11:07:12 -030027
Mauro Carvalho Chehab0975fc62008-09-28 02:24:44 -030028enum firmware_type {
29 XC2028_AUTO = 0, /* By default, auto-detects */
30 XC2028_D2633,
31 XC2028_D2620,
32};
33
Mauro Carvalho Chehabde3fe212007-10-24 09:22:08 -030034struct xc2028_ctrl {
Mauro Carvalho Chehabde3fe212007-10-24 09:22:08 -030035 char *fname;
Mauro Carvalho Chehab352fae12007-11-01 16:56:26 -030036 int max_len;
Mauro Carvalho Chehabe5cc2bf2008-01-08 11:26:59 -030037 int msleep;
Chris Pascoee0f0b372007-11-19 11:22:03 -030038 unsigned int scode_table;
Mauro Carvalho Chehabd74cb252007-11-24 10:20:15 -030039 unsigned int mts :1;
Mauro Carvalho Chehabd74cb252007-11-24 10:20:15 -030040 unsigned int input1:1;
Chris Pascoe3dfefc52007-12-02 10:07:06 -030041 unsigned int vhfbw7:1;
42 unsigned int uhfbw8:1;
Devin Heitmueller93b99922009-08-03 22:52:59 -030043 unsigned int disable_power_mgmt:1;
Mauro Carvalho Chehab2d5024a2009-09-14 10:23:20 -030044 unsigned int read_not_reliable:1;
Mauro Carvalho Chehab66c2d532007-11-25 19:26:36 -030045 unsigned int demod;
Mauro Carvalho Chehab0975fc62008-09-28 02:24:44 -030046 enum firmware_type type:2;
Mauro Carvalho Chehabde3fe212007-10-24 09:22:08 -030047};
48
Michel Ludwiga37b4c92007-11-16 07:46:14 -030049struct xc2028_config {
50 struct i2c_adapter *i2c_adap;
Mauro Carvalho Chehab6e6a8b52018-01-04 13:08:56 -050051 u8 i2c_addr;
Mauro Carvalho Chehab71a2ee32007-11-22 12:19:37 -030052 struct xc2028_ctrl *ctrl;
Michel Ludwiga37b4c92007-11-16 07:46:14 -030053};
54
Mauro Carvalho Chehab6cb45872007-10-02 11:57:03 -030055/* xc2028 commands for callback */
56#define XC2028_TUNER_RESET 0
57#define XC2028_RESET_CLK 1
Thierry Reding4d37ece2011-08-04 04:13:59 -030058#define XC2028_I2C_FLUSH 2
Michel Ludwig701672e2007-07-18 10:29:10 -030059
Arnd Bergmann9b174522015-02-18 14:12:42 -030060#if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC2028)
Michael Krufky7972f982007-12-21 16:12:09 -030061extern struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
62 struct xc2028_config *cfg);
Mauro Carvalho Chehab215b95b2007-10-23 15:24:06 -030063#else
Michael Krufky7972f982007-12-21 16:12:09 -030064static inline struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
65 struct xc2028_config *cfg)
Mauro Carvalho Chehab215b95b2007-10-23 15:24:06 -030066{
67 printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n",
Harvey Harrison7e28adb2008-04-08 23:20:00 -030068 __func__);
Michael Krufky7972f982007-12-21 16:12:09 -030069 return NULL;
Mauro Carvalho Chehab215b95b2007-10-23 15:24:06 -030070}
71#endif
72
73#endif /* __TUNER_XC2028_H__ */