blob: 7c219539fbd8e0752e7172d31d5d0f02788566da [file] [log] [blame]
Antti Palosaarieebb8762009-03-25 16:59:45 -03001/*
2 * DVB USB Linux driver for Intel CE6230 DVB-T USB2.0 receiver
3 *
4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
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
22#ifndef _DVB_USB_CE6230_H_
23#define _DVB_USB_CE6230_H_
24
25#define DVB_USB_LOG_PREFIX "ce6230"
Antti Palosaariab84f182012-06-13 23:03:08 -030026#include "dvb_usb.h"
27
28#ifdef CONFIG_DVB_USB_DEBUG
29#define dprintk(var, level, args...) \
30 do { if ((var & level)) printk(args); } while (0)
31#define DVB_USB_DEBUG_STATUS
32#else
33#define dprintk(args...)
34#define DVB_USB_DEBUG_STATUS " (debugging is not enabled)"
35#endif
36
37#undef err
38#define err(format, arg...) printk(KERN_ERR DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
39#undef info
40#define info(format, arg...) printk(KERN_INFO DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
41#undef warn
42#define warn(format, arg...) printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
Antti Palosaarieebb8762009-03-25 16:59:45 -030043
44#define deb_info(args...) dprintk(dvb_usb_ce6230_debug, 0x01, args)
45#define deb_rc(args...) dprintk(dvb_usb_ce6230_debug, 0x02, args)
46#define deb_xfer(args...) dprintk(dvb_usb_ce6230_debug, 0x04, args)
47#define deb_reg(args...) dprintk(dvb_usb_ce6230_debug, 0x08, args)
48#define deb_i2c(args...) dprintk(dvb_usb_ce6230_debug, 0x10, args)
49#define deb_fw(args...) dprintk(dvb_usb_ce6230_debug, 0x20, args)
50
51#define ce6230_debug_dump(r, t, v, i, b, l, func) { \
52 int loop_; \
53 func("%02x %02x %02x %02x %02x %02x %02x %02x", \
54 t, r, v & 0xff, v >> 8, i & 0xff, i >> 8, l & 0xff, l >> 8); \
55 if (t == (USB_TYPE_VENDOR | USB_DIR_OUT)) \
56 func(" >>> "); \
57 else \
58 func(" <<< "); \
59 for (loop_ = 0; loop_ < l; loop_++) \
60 func("%02x ", b[loop_]); \
61 func("\n");\
62}
63
64#define CE6230_USB_TIMEOUT 1000
65
66struct req_t {
67 u8 cmd; /* [1] */
68 u16 value; /* [2|3] */
69 u16 index; /* [4|5] */
70 u16 data_len; /* [6|7] */
71 u8 *data;
72};
73
74enum ce6230_cmd {
75 CONFIG_READ = 0xd0, /* rd 0 (unclear) */
76 UNKNOWN_WRITE = 0xc7, /* wr 7 (unclear) */
77 I2C_READ = 0xd9, /* rd 9 (unclear) */
78 I2C_WRITE = 0xca, /* wr a */
79 DEMOD_READ = 0xdb, /* rd b */
80 DEMOD_WRITE = 0xcc, /* wr c */
81 REG_READ = 0xde, /* rd e */
82 REG_WRITE = 0xcf, /* wr f */
83};
84
85#endif