xref: /openbmc/linux/drivers/media/tuners/si2157_priv.h (revision c942fddf8793b2013be8c901b47d0a8dc02bf99f)
1*c942fddfSThomas 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;
26930a8730SAntti Palosaari 	bool active;
2705024efeSMatthias Schwarzott 	bool inversion;
28073f3849SOlli Salonen 	u8 chiptype;
29ee3c3e46SOlli Salonen 	u8 if_port;
30c28aebe1SOlli Salonen 	u32 if_frequency;
312f1ea29fSAntti Palosaari 	struct delayed_work stat_work;
328b0a81c7SMauro Carvalho Chehab 
338b0a81c7SMauro Carvalho Chehab #if defined(CONFIG_MEDIA_CONTROLLER)
348b0a81c7SMauro Carvalho Chehab 	struct media_device	*mdev;
358b0a81c7SMauro Carvalho Chehab 	struct media_entity	ent;
36552b926fSMauro Carvalho Chehab 	struct media_pad	pad[SI2157_NUM_PADS];
378b0a81c7SMauro Carvalho Chehab #endif
388b0a81c7SMauro Carvalho Chehab 
39930a8730SAntti Palosaari };
40930a8730SAntti Palosaari 
41073f3849SOlli Salonen #define SI2157_CHIPTYPE_SI2157 0
42073f3849SOlli Salonen #define SI2157_CHIPTYPE_SI2146 1
433a2824c7SStefan Brüns #define SI2157_CHIPTYPE_SI2141 2
44073f3849SOlli Salonen 
45073f3849SOlli Salonen /* firmware command struct */
46930a8730SAntti Palosaari #define SI2157_ARGLEN      30
47930a8730SAntti Palosaari struct si2157_cmd {
48930a8730SAntti Palosaari 	u8 args[SI2157_ARGLEN];
49e6b4380fSAntti Palosaari 	unsigned wlen;
50e6b4380fSAntti Palosaari 	unsigned rlen;
51930a8730SAntti Palosaari };
52930a8730SAntti Palosaari 
531b92373fSOlli Salonen #define SI2158_A20_FIRMWARE "dvb-tuner-si2158-a20-01.fw"
543a2824c7SStefan Brüns #define SI2141_A10_FIRMWARE "dvb-tuner-si2141-a10-01.fw"
551b92373fSOlli Salonen 
56930a8730SAntti Palosaari #endif
57