blob: d56c2fe3efa2987b57cf46a07ff3bd72094ca62f [file] [log] [blame]
Michael Krufky6ca04de2007-11-23 16:52:15 -03001/*
2 tda18271-priv.h - private header for the NXP TDA18271 silicon tuner
3
4 Copyright (C) 2007 Michael Krufky (mkrufky@linuxtv.org)
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 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef __TDA18271_PRIV_H__
22#define __TDA18271_PRIV_H__
23
Michael Krufkyb5f3e1e2007-12-02 16:36:05 -030024#include <linux/kernel.h>
Michael Krufky6ca04de2007-11-23 16:52:15 -030025#include <linux/types.h>
26
27#define R_ID 0x00 /* ID byte */
28#define R_TM 0x01 /* Thermo byte */
29#define R_PL 0x02 /* Power level byte */
30#define R_EP1 0x03 /* Easy Prog byte 1 */
31#define R_EP2 0x04 /* Easy Prog byte 2 */
32#define R_EP3 0x05 /* Easy Prog byte 3 */
33#define R_EP4 0x06 /* Easy Prog byte 4 */
34#define R_EP5 0x07 /* Easy Prog byte 5 */
35#define R_CPD 0x08 /* Cal Post-Divider byte */
36#define R_CD1 0x09 /* Cal Divider byte 1 */
37#define R_CD2 0x0a /* Cal Divider byte 2 */
38#define R_CD3 0x0b /* Cal Divider byte 3 */
39#define R_MPD 0x0c /* Main Post-Divider byte */
40#define R_MD1 0x0d /* Main Divider byte 1 */
41#define R_MD2 0x0e /* Main Divider byte 2 */
42#define R_MD3 0x0f /* Main Divider byte 3 */
43#define R_EB1 0x10 /* Extended byte 1 */
44#define R_EB2 0x11 /* Extended byte 2 */
45#define R_EB3 0x12 /* Extended byte 3 */
46#define R_EB4 0x13 /* Extended byte 4 */
47#define R_EB5 0x14 /* Extended byte 5 */
48#define R_EB6 0x15 /* Extended byte 6 */
49#define R_EB7 0x16 /* Extended byte 7 */
50#define R_EB8 0x17 /* Extended byte 8 */
51#define R_EB9 0x18 /* Extended byte 9 */
52#define R_EB10 0x19 /* Extended byte 10 */
53#define R_EB11 0x1a /* Extended byte 11 */
54#define R_EB12 0x1b /* Extended byte 12 */
55#define R_EB13 0x1c /* Extended byte 13 */
56#define R_EB14 0x1d /* Extended byte 14 */
57#define R_EB15 0x1e /* Extended byte 15 */
58#define R_EB16 0x1f /* Extended byte 16 */
59#define R_EB17 0x20 /* Extended byte 17 */
60#define R_EB18 0x21 /* Extended byte 18 */
61#define R_EB19 0x22 /* Extended byte 19 */
62#define R_EB20 0x23 /* Extended byte 20 */
63#define R_EB21 0x24 /* Extended byte 21 */
64#define R_EB22 0x25 /* Extended byte 22 */
65#define R_EB23 0x26 /* Extended byte 23 */
66
67#define TDA18271_NUM_REGS 39
68
Michael Krufkyb5f3e1e2007-12-02 16:36:05 -030069extern int tda18271_debug;
Michael Krufky6ca04de2007-11-23 16:52:15 -030070
Michael Krufkyb5f3e1e2007-12-02 16:36:05 -030071#define dprintk(level, fmt, arg...) do {\
72 if (tda18271_debug & level) \
73 printk(KERN_DEBUG "%s: " fmt, __FUNCTION__, ##arg); } while (0)
Michael Krufky6ca04de2007-11-23 16:52:15 -030074
Michael Krufkyb5f3e1e2007-12-02 16:36:05 -030075#define DBG_INFO 1
76#define DBG_MAP 2
77#define DBG_REG 4
Michael Krufky6ca04de2007-11-23 16:52:15 -030078
Michael Krufkyb5f3e1e2007-12-02 16:36:05 -030079#define dbg_info(fmt, arg...) dprintk(DBG_INFO, fmt, ##arg)
80#define dbg_map(fmt, arg...) dprintk(DBG_MAP, fmt, ##arg)
81#define dbg_reg(fmt, arg...) dprintk(DBG_REG, fmt, ##arg)
82
83/*---------------------------------------------------------------------*/
84
85extern void tda18271_calc_cal_pll(u32 *freq, u8 *post_div, u8 *div);
86extern void tda18271_calc_main_pll(u32 *freq, u8 *post_div, u8 *div);
87
88extern void tda18271_calc_bp_filter(u32 *freq, u8 *val);
89extern void tda18271_calc_km(u32 *freq, u8 *val);
90extern void tda18271_calc_rf_band(u32 *freq, u8 *val);
91extern void tda18271_calc_gain_taper(u32 *freq, u8 *val);
92extern void tda18271_calc_rf_cal(u32 *freq, u8 *val);
93extern void tda18271_calc_ir_measure(u32 *freq, u8 *val);
Michael Krufky6ca04de2007-11-23 16:52:15 -030094
95#endif /* __TDA18271_PRIV_H__ */
96
97/*
98 * Overrides for Emacs so that we follow Linus's tabbing style.
99 * ---------------------------------------------------------------------------
100 * Local variables:
101 * c-basic-offset: 8
102 * End:
103 */