xref: /openbmc/linux/drivers/media/tuners/si2157_priv.h (revision 552b926fa3b1671b3d3937641f0f5585e6659866)
1ba92ae0fSAntti Palosaari /*
217ad09f1SCrazyCat  * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver
3ba92ae0fSAntti Palosaari  *
4ba92ae0fSAntti Palosaari  * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
5ba92ae0fSAntti Palosaari  *
6ba92ae0fSAntti Palosaari  *    This program is free software; you can redistribute it and/or modify
7ba92ae0fSAntti Palosaari  *    it under the terms of the GNU General Public License as published by
8ba92ae0fSAntti Palosaari  *    the Free Software Foundation; either version 2 of the License, or
9ba92ae0fSAntti Palosaari  *    (at your option) any later version.
10ba92ae0fSAntti Palosaari  *
11ba92ae0fSAntti Palosaari  *    This program is distributed in the hope that it will be useful,
12ba92ae0fSAntti Palosaari  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
13ba92ae0fSAntti Palosaari  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14ba92ae0fSAntti Palosaari  *    GNU General Public License for more details.
15ba92ae0fSAntti Palosaari  */
16ba92ae0fSAntti Palosaari 
17930a8730SAntti Palosaari #ifndef SI2157_PRIV_H
18930a8730SAntti Palosaari #define SI2157_PRIV_H
19930a8730SAntti Palosaari 
201b92373fSOlli Salonen #include <linux/firmware.h>
218b0a81c7SMauro Carvalho Chehab #include <media/v4l2-mc.h>
22930a8730SAntti Palosaari #include "si2157.h"
23930a8730SAntti Palosaari 
24*552b926fSMauro Carvalho Chehab enum si2157_pads {
25*552b926fSMauro Carvalho Chehab 	SI2157_PAD_RF_INPUT,
26*552b926fSMauro Carvalho Chehab 	SI2157_PAD_VID_OUT,
27*552b926fSMauro Carvalho Chehab 	SI2157_PAD_AUD_OUT,
28*552b926fSMauro Carvalho Chehab 	SI2157_NUM_PADS
29*552b926fSMauro Carvalho Chehab };
30*552b926fSMauro Carvalho Chehab 
31930a8730SAntti Palosaari /* state struct */
3270f13ff0SAntti Palosaari struct si2157_dev {
33930a8730SAntti Palosaari 	struct mutex i2c_mutex;
34930a8730SAntti Palosaari 	struct dvb_frontend *fe;
35930a8730SAntti Palosaari 	bool active;
3605024efeSMatthias Schwarzott 	bool inversion;
37073f3849SOlli Salonen 	u8 chiptype;
38ee3c3e46SOlli Salonen 	u8 if_port;
39c28aebe1SOlli Salonen 	u32 if_frequency;
402f1ea29fSAntti Palosaari 	struct delayed_work stat_work;
418b0a81c7SMauro Carvalho Chehab 
428b0a81c7SMauro Carvalho Chehab #if defined(CONFIG_MEDIA_CONTROLLER)
438b0a81c7SMauro Carvalho Chehab 	struct media_device	*mdev;
448b0a81c7SMauro Carvalho Chehab 	struct media_entity	ent;
45*552b926fSMauro Carvalho Chehab 	struct media_pad	pad[SI2157_NUM_PADS];
468b0a81c7SMauro Carvalho Chehab #endif
478b0a81c7SMauro Carvalho Chehab 
48930a8730SAntti Palosaari };
49930a8730SAntti Palosaari 
50073f3849SOlli Salonen #define SI2157_CHIPTYPE_SI2157 0
51073f3849SOlli Salonen #define SI2157_CHIPTYPE_SI2146 1
523a2824c7SStefan Brüns #define SI2157_CHIPTYPE_SI2141 2
53073f3849SOlli Salonen 
54073f3849SOlli Salonen /* firmware command struct */
55930a8730SAntti Palosaari #define SI2157_ARGLEN      30
56930a8730SAntti Palosaari struct si2157_cmd {
57930a8730SAntti Palosaari 	u8 args[SI2157_ARGLEN];
58e6b4380fSAntti Palosaari 	unsigned wlen;
59e6b4380fSAntti Palosaari 	unsigned rlen;
60930a8730SAntti Palosaari };
61930a8730SAntti Palosaari 
621b92373fSOlli Salonen #define SI2158_A20_FIRMWARE "dvb-tuner-si2158-a20-01.fw"
633a2824c7SStefan Brüns #define SI2141_A10_FIRMWARE "dvb-tuner-si2141-a10-01.fw"
641b92373fSOlli Salonen 
65930a8730SAntti Palosaari #endif
66