xref: /openbmc/linux/drivers/media/tuners/si2157_priv.h (revision 57df53738a8134955beee6ab1b3b006669c0e82e)
1c942fddfSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2ba92ae0fSAntti Palosaari /*
317ad09f1SCrazyCat  * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver
4ba92ae0fSAntti Palosaari  *
5ba92ae0fSAntti Palosaari  * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
6ba92ae0fSAntti Palosaari  */
7ba92ae0fSAntti Palosaari 
8930a8730SAntti Palosaari #ifndef SI2157_PRIV_H
9930a8730SAntti Palosaari #define SI2157_PRIV_H
10930a8730SAntti Palosaari 
111b92373fSOlli Salonen #include <linux/firmware.h>
128b0a81c7SMauro Carvalho Chehab #include <media/v4l2-mc.h>
13930a8730SAntti Palosaari #include "si2157.h"
14930a8730SAntti Palosaari 
15552b926fSMauro Carvalho Chehab enum si2157_pads {
16552b926fSMauro Carvalho Chehab 	SI2157_PAD_RF_INPUT,
17552b926fSMauro Carvalho Chehab 	SI2157_PAD_VID_OUT,
18552b926fSMauro Carvalho Chehab 	SI2157_PAD_AUD_OUT,
19552b926fSMauro Carvalho Chehab 	SI2157_NUM_PADS
20552b926fSMauro Carvalho Chehab };
21552b926fSMauro Carvalho Chehab 
22930a8730SAntti Palosaari /* state struct */
2370f13ff0SAntti Palosaari struct si2157_dev {
24930a8730SAntti Palosaari 	struct mutex i2c_mutex;
25930a8730SAntti Palosaari 	struct dvb_frontend *fe;
26*57df5373SGon Solo 	unsigned int active:1;
27*57df5373SGon Solo 	unsigned int inversion:1;
28*57df5373SGon Solo 	unsigned int dont_load_firmware:1;
29073f3849SOlli Salonen 	u8 chiptype;
30ee3c3e46SOlli Salonen 	u8 if_port;
31c28aebe1SOlli Salonen 	u32 if_frequency;
322f1ea29fSAntti Palosaari 	struct delayed_work stat_work;
338b0a81c7SMauro Carvalho Chehab 
348b0a81c7SMauro Carvalho Chehab #if defined(CONFIG_MEDIA_CONTROLLER)
358b0a81c7SMauro Carvalho Chehab 	struct media_device	*mdev;
368b0a81c7SMauro Carvalho Chehab 	struct media_entity	ent;
37552b926fSMauro Carvalho Chehab 	struct media_pad	pad[SI2157_NUM_PADS];
388b0a81c7SMauro Carvalho Chehab #endif
398b0a81c7SMauro Carvalho Chehab 
40930a8730SAntti Palosaari };
41930a8730SAntti Palosaari 
42073f3849SOlli Salonen #define SI2157_CHIPTYPE_SI2157 0
43073f3849SOlli Salonen #define SI2157_CHIPTYPE_SI2146 1
443a2824c7SStefan Brüns #define SI2157_CHIPTYPE_SI2141 2
45d5cb82b0SBrad Love #define SI2157_CHIPTYPE_SI2177 3
46073f3849SOlli Salonen 
47073f3849SOlli Salonen /* firmware command struct */
48930a8730SAntti Palosaari #define SI2157_ARGLEN      30
49930a8730SAntti Palosaari struct si2157_cmd {
50930a8730SAntti Palosaari 	u8 args[SI2157_ARGLEN];
51e6b4380fSAntti Palosaari 	unsigned wlen;
52e6b4380fSAntti Palosaari 	unsigned rlen;
53930a8730SAntti Palosaari };
54930a8730SAntti Palosaari 
551b92373fSOlli Salonen #define SI2158_A20_FIRMWARE "dvb-tuner-si2158-a20-01.fw"
563a2824c7SStefan Brüns #define SI2141_A10_FIRMWARE "dvb-tuner-si2141-a10-01.fw"
57d5cb82b0SBrad Love #define SI2157_A30_FIRMWARE "dvb-tuner-si2157-a30-01.fw"
58930a8730SAntti Palosaari #endif
59