• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/media/dvb/frontends/
1/*
2 *  Driver for Micronas DVB-T drx397xD demodulator
3 *
4 *  Copyright (C) 2007 Henk vergonet <Henk.Vergonet@gmail.com>
5 *
6 *  This program is free software; you can redistribute it and/or modify
7 *  it under the terms of the GNU General Public License as published by
8 *  the Free Software Foundation; either version 2 of the License, or
9 *  (at your option) any later version.
10 *
11 *  This program is distributed in the hope that it will be useful,
12 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 *
15 *  GNU General Public License for more details.
16 *
17 *  You should have received a copy of the GNU General Public License
18 *  along with this program; if not, write to the Free Software
19 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.=
20 */
21
22#ifndef _DRX397XD_H_INCLUDED
23#define _DRX397XD_H_INCLUDED
24
25#include <linux/dvb/frontend.h>
26
27#define DRX_F_STEPSIZE	166667
28#define DRX_F_OFFSET	36000000
29
30#define I2C_ADR_C0(x) \
31(	cpu_to_le32( \
32		(u32)( \
33			(((u32)(x) & (u32)0x000000ffUL)      ) | \
34			(((u32)(x) & (u32)0x0000ff00UL) << 16) | \
35			(((u32)(x) & (u32)0x0fff0000UL) >>  8) | \
36			 (	     (u32)0x00c00000UL)          \
37		      )) \
38)
39
40#define I2C_ADR_E0(x) \
41(	cpu_to_le32( \
42		(u32)( \
43			(((u32)(x) & (u32)0x000000ffUL)      ) | \
44			(((u32)(x) & (u32)0x0000ff00UL) << 16) | \
45			(((u32)(x) & (u32)0x0fff0000UL) >>  8) | \
46			 (	     (u32)0x00e00000UL)          \
47		      )) \
48)
49
50struct drx397xD_CfgRfAgc	/* 0x7c */
51{
52	int d00;	/* 2 */
53	u16 w04;
54	u16 w06;
55};
56
57struct drx397xD_CfgIfAgc	/* 0x68 */
58{
59	int d00;	/* 0 */
60	u16 w04;	/* 0 */
61	u16 w06;
62	u16 w08;
63	u16 w0A;
64	u16 w0C;
65};
66
67struct drx397xD_s20 {
68	int d04;
69	u32 d18;
70	u32 d1C;
71	u32 d20;
72	u32 d14;
73	u32 d24;
74	u32 d0C;
75	u32 d08;
76};
77
78struct drx397xD_config
79{
80	/* demodulator's I2C address */
81	u8	demod_address;		/* 0x0f */
82
83	struct drx397xD_CfgIfAgc  ifagc;  /* 0x68 */
84	struct drx397xD_CfgRfAgc  rfagc;  /* 0x7c */
85	u32	s20d24;
86
87	/* HI_CfgCommand parameters */
88	u16	w50, w52, /* w54, */ w56;
89
90	int	d5C;
91	int	d60;
92	int	d48;
93	int	d28;
94
95	u32	f_if;	/* d14: intermediate frequency [Hz]		*/
96			/*	36000000 on Cinergy 2400i DT		*/
97			/*	42800000 on Pinnacle Hybrid PRO 330e	*/
98
99	u16	f_osc;	/* s66: 48000 oscillator frequency [kHz]	*/
100
101	u16	w92;	/* 20000 */
102
103	u16	wA0;
104	u16	w98;
105	u16	w9A;
106
107	u16	w9C;	/* 0xe0 */
108	u16	w9E;	/* 0x00 */
109
110	/* used for signal strength calculations in
111	   drx397x_read_signal_strength
112	*/
113	u16	ss78;	// 2200
114	u16	ss7A;	// 150
115	u16	ss76;	// 820
116};
117
118#if defined(CONFIG_DVB_DRX397XD) || (defined(CONFIG_DVB_DRX397XD_MODULE) && \
119	defined(MODULE))
120extern struct dvb_frontend* drx397xD_attach(const struct drx397xD_config *config,
121					   struct i2c_adapter *i2c);
122#else
123static inline struct dvb_frontend* drx397xD_attach(const struct drx397xD_config *config,
124					   struct i2c_adapter *i2c)
125{
126	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
127	return NULL;
128}
129#endif /* CONFIG_DVB_DRX397XD */
130
131#endif /* _DRX397XD_H_INCLUDED */
132