xref: /openbmc/linux/drivers/media/tuners/si2157_priv.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
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;
2657df5373SGon Solo 	unsigned int active:1;
2757df5373SGon Solo 	unsigned int inversion:1;
2857df5373SGon Solo 	unsigned int dont_load_firmware:1;
29805d5a08SMauro Carvalho Chehab 	u8 part_id;
30ee3c3e46SOlli Salonen 	u8 if_port;
31c28aebe1SOlli Salonen 	u32 if_frequency;
327e80a8d1SBrad Love 	u32 bandwidth;
337e80a8d1SBrad Love 	u32 frequency;
342f1ea29fSAntti Palosaari 	struct delayed_work stat_work;
358b0a81c7SMauro Carvalho Chehab 
368b0a81c7SMauro Carvalho Chehab #if defined(CONFIG_MEDIA_CONTROLLER)
378b0a81c7SMauro Carvalho Chehab 	struct media_device	*mdev;
388b0a81c7SMauro Carvalho Chehab 	struct media_entity	ent;
39552b926fSMauro Carvalho Chehab 	struct media_pad	pad[SI2157_NUM_PADS];
408b0a81c7SMauro Carvalho Chehab #endif
418b0a81c7SMauro Carvalho Chehab 
42930a8730SAntti Palosaari };
43930a8730SAntti Palosaari 
441c35ba3bSMauro Carvalho Chehab enum si2157_part_id {
451c35ba3bSMauro Carvalho Chehab 	SI2141 = 41,
461c35ba3bSMauro Carvalho Chehab 	SI2146 = 46,
471c35ba3bSMauro Carvalho Chehab 	SI2147 = 47,
481c35ba3bSMauro Carvalho Chehab 	SI2148 = 48,
491c35ba3bSMauro Carvalho Chehab 	SI2157 = 57,
501c35ba3bSMauro Carvalho Chehab 	SI2158 = 58,
511c35ba3bSMauro Carvalho Chehab 	SI2177 = 77,
521c35ba3bSMauro Carvalho Chehab };
531c35ba3bSMauro Carvalho Chehab 
541c35ba3bSMauro Carvalho Chehab struct si2157_tuner_info {
551c35ba3bSMauro Carvalho Chehab 	enum si2157_part_id	part_id;
561c35ba3bSMauro Carvalho Chehab 	unsigned char		rom_id;
571c35ba3bSMauro Carvalho Chehab 	bool			required;
581c35ba3bSMauro Carvalho Chehab 	const char		*fw_name, *fw_alt_name;
591c35ba3bSMauro Carvalho Chehab };
601c35ba3bSMauro Carvalho Chehab 
61073f3849SOlli Salonen /* firmware command struct */
62930a8730SAntti Palosaari #define SI2157_ARGLEN      30
63930a8730SAntti Palosaari struct si2157_cmd {
64930a8730SAntti Palosaari 	u8 args[SI2157_ARGLEN];
65e6b4380fSAntti Palosaari 	unsigned wlen;
66e6b4380fSAntti Palosaari 	unsigned rlen;
67930a8730SAntti Palosaari };
68930a8730SAntti Palosaari 
6998c65a3dSMauro Carvalho Chehab #define SUPPORTS_1700KHz(dev) (((dev)->part_id == SI2141) || \
7098c65a3dSMauro Carvalho Chehab 			       ((dev)->part_id == SI2147) || \
7198c65a3dSMauro Carvalho Chehab 			       ((dev)->part_id == SI2157) || \
7298c65a3dSMauro Carvalho Chehab 			       ((dev)->part_id == SI2177))
7398c65a3dSMauro Carvalho Chehab 
74*b9aafbd4SMauro Carvalho Chehab #define SUPPORTS_ATV_IF(dev) (((dev)->part_id == SI2157) || \
75*b9aafbd4SMauro Carvalho Chehab 			      ((dev)->part_id == SI2158))
76*b9aafbd4SMauro Carvalho Chehab 
771c35ba3bSMauro Carvalho Chehab /* Old firmware namespace */
781b92373fSOlli Salonen #define SI2158_A20_FIRMWARE "dvb-tuner-si2158-a20-01.fw"
793a2824c7SStefan Brüns #define SI2141_A10_FIRMWARE "dvb-tuner-si2141-a10-01.fw"
80d5cb82b0SBrad Love #define SI2157_A30_FIRMWARE "dvb-tuner-si2157-a30-01.fw"
811c35ba3bSMauro Carvalho Chehab 
821c35ba3bSMauro Carvalho Chehab /* New firmware namespace */
831c35ba3bSMauro Carvalho Chehab #define SI2141_60_FIRMWARE "dvb_driver_si2141_rom60.fw"
841c35ba3bSMauro Carvalho Chehab #define SI2141_61_FIRMWARE "dvb_driver_si2141_rom61.fw"
851c35ba3bSMauro Carvalho Chehab #define SI2146_11_FIRMWARE "dvb_driver_si2146_rom11.fw"
861c35ba3bSMauro Carvalho Chehab #define SI2147_50_FIRMWARE "dvb_driver_si2147_rom50.fw"
871c35ba3bSMauro Carvalho Chehab #define SI2148_32_FIRMWARE "dvb_driver_si2148_rom32.fw"
881c35ba3bSMauro Carvalho Chehab #define SI2148_33_FIRMWARE "dvb_driver_si2148_rom33.fw"
891c35ba3bSMauro Carvalho Chehab #define SI2157_50_FIRMWARE "dvb_driver_si2157_rom50.fw"
901c35ba3bSMauro Carvalho Chehab #define SI2158_50_FIRMWARE "dvb_driver_si2178_rom50.fw"
911c35ba3bSMauro Carvalho Chehab #define SI2158_51_FIRMWARE "dvb_driver_si2158_rom51.fw"
921c35ba3bSMauro Carvalho Chehab #define SI2177_50_FIRMWARE "dvb_driver_si2177_rom50.fw"
931c35ba3bSMauro Carvalho Chehab 
94930a8730SAntti Palosaari #endif
95