1 /*
2  * Silicon Labs Si2168 DVB-T/T2/C demodulator driver
3  *
4  * Copyright (C) 2014 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 
17 #ifndef SI2168_PRIV_H
18 #define SI2168_PRIV_H
19 
20 #include "si2168.h"
21 #include <media/dvb_frontend.h>
22 #include <linux/firmware.h>
23 #include <linux/i2c-mux.h>
24 #include <linux/kernel.h>
25 
26 #define SI2168_A20_FIRMWARE "dvb-demod-si2168-a20-01.fw"
27 #define SI2168_A30_FIRMWARE "dvb-demod-si2168-a30-01.fw"
28 #define SI2168_B40_FIRMWARE "dvb-demod-si2168-b40-01.fw"
29 #define SI2168_D60_FIRMWARE "dvb-demod-si2168-d60-01.fw"
30 #define SI2168_B40_FIRMWARE_FALLBACK "dvb-demod-si2168-02.fw"
31 
32 /* state struct */
33 struct si2168_dev {
34 	struct mutex i2c_mutex;
35 	struct i2c_mux_core *muxc;
36 	struct dvb_frontend fe;
37 	enum fe_delivery_system delivery_system;
38 	enum fe_status fe_status;
39 	#define SI2168_CHIP_ID_A20 ('A' << 24 | 68 << 16 | '2' << 8 | '0' << 0)
40 	#define SI2168_CHIP_ID_A30 ('A' << 24 | 68 << 16 | '3' << 8 | '0' << 0)
41 	#define SI2168_CHIP_ID_B40 ('B' << 24 | 68 << 16 | '4' << 8 | '0' << 0)
42 	#define SI2168_CHIP_ID_D60 ('D' << 24 | 68 << 16 | '6' << 8 | '0' << 0)
43 	unsigned int chip_id;
44 	unsigned int version;
45 	const char *firmware_name;
46 	bool active;
47 	bool warm;
48 	u8 ts_mode;
49 	bool ts_clock_inv;
50 	bool ts_clock_gapped;
51 	bool spectral_inversion;
52 };
53 
54 /* firmware command struct */
55 #define SI2168_ARGLEN      30
56 struct si2168_cmd {
57 	u8 args[SI2168_ARGLEN];
58 	unsigned wlen;
59 	unsigned rlen;
60 };
61 
62 #endif
63