GNU Linux-libre 6.9.1-gnu
[releases.git] / drivers / media / tuners / si2157_priv.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver
4  *
5  * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
6  */
7
8 #ifndef SI2157_PRIV_H
9 #define SI2157_PRIV_H
10
11 #include <linux/firmware.h>
12 #include <media/v4l2-mc.h>
13 #include "si2157.h"
14
15 enum si2157_pads {
16         SI2157_PAD_RF_INPUT,
17         SI2157_PAD_VID_OUT,
18         SI2157_PAD_AUD_OUT,
19         SI2157_NUM_PADS
20 };
21
22 /* state struct */
23 struct si2157_dev {
24         struct mutex i2c_mutex;
25         struct dvb_frontend *fe;
26         unsigned int active:1;
27         unsigned int inversion:1;
28         unsigned int dont_load_firmware:1;
29         u8 part_id;
30         u8 if_port;
31         u32 if_frequency;
32         u32 bandwidth;
33         u32 frequency;
34         struct delayed_work stat_work;
35
36 #if defined(CONFIG_MEDIA_CONTROLLER)
37         struct media_device     *mdev;
38         struct media_entity     ent;
39         struct media_pad        pad[SI2157_NUM_PADS];
40 #endif
41
42 };
43
44 enum si2157_part_id {
45         SI2141 = 41,
46         SI2146 = 46,
47         SI2147 = 47,
48         SI2148 = 48,
49         SI2157 = 57,
50         SI2158 = 58,
51         SI2177 = 77,
52 };
53
54 struct si2157_tuner_info {
55         enum si2157_part_id     part_id;
56         unsigned char           rom_id;
57         bool                    required;
58         const char              *fw_name, *fw_alt_name;
59 };
60
61 /* firmware command struct */
62 #define SI2157_ARGLEN      30
63 struct si2157_cmd {
64         u8 args[SI2157_ARGLEN];
65         unsigned wlen;
66         unsigned rlen;
67 };
68
69 #define SUPPORTS_1700KHz(dev) (((dev)->part_id == SI2141) || \
70                                ((dev)->part_id == SI2147) || \
71                                ((dev)->part_id == SI2157) || \
72                                ((dev)->part_id == SI2177))
73
74 #define SUPPORTS_ATV_IF(dev) (((dev)->part_id == SI2157) || \
75                               ((dev)->part_id == SI2158))
76
77 /* Old firmware namespace */
78 #define SI2158_A20_FIRMWARE "/*(DEBLOBBED)*/"
79 #define SI2141_A10_FIRMWARE "/*(DEBLOBBED)*/"
80 #define SI2157_A30_FIRMWARE "/*(DEBLOBBED)*/"
81
82 /* New firmware namespace */
83 #define SI2141_60_FIRMWARE "/*(DEBLOBBED)*/"
84 #define SI2141_61_FIRMWARE "/*(DEBLOBBED)*/"
85 #define SI2146_11_FIRMWARE "/*(DEBLOBBED)*/"
86 #define SI2147_50_FIRMWARE "/*(DEBLOBBED)*/"
87 #define SI2148_32_FIRMWARE "/*(DEBLOBBED)*/"
88 #define SI2148_33_FIRMWARE "/*(DEBLOBBED)*/"
89 #define SI2157_50_FIRMWARE "/*(DEBLOBBED)*/"
90 #define SI2158_50_FIRMWARE "/*(DEBLOBBED)*/"
91 #define SI2158_51_FIRMWARE "/*(DEBLOBBED)*/"
92 #define SI2177_50_FIRMWARE "/*(DEBLOBBED)*/"
93
94 #endif