18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef SI2157_PRIV_H
98c2ecf20Sopenharmony_ci#define SI2157_PRIV_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/firmware.h>
128c2ecf20Sopenharmony_ci#include <media/v4l2-mc.h>
138c2ecf20Sopenharmony_ci#include "si2157.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cienum si2157_pads {
168c2ecf20Sopenharmony_ci	SI2157_PAD_RF_INPUT,
178c2ecf20Sopenharmony_ci	SI2157_PAD_VID_OUT,
188c2ecf20Sopenharmony_ci	SI2157_PAD_AUD_OUT,
198c2ecf20Sopenharmony_ci	SI2157_NUM_PADS
208c2ecf20Sopenharmony_ci};
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* state struct */
238c2ecf20Sopenharmony_cistruct si2157_dev {
248c2ecf20Sopenharmony_ci	struct mutex i2c_mutex;
258c2ecf20Sopenharmony_ci	struct dvb_frontend *fe;
268c2ecf20Sopenharmony_ci	unsigned int active:1;
278c2ecf20Sopenharmony_ci	unsigned int inversion:1;
288c2ecf20Sopenharmony_ci	unsigned int dont_load_firmware:1;
298c2ecf20Sopenharmony_ci	u8 chiptype;
308c2ecf20Sopenharmony_ci	u8 if_port;
318c2ecf20Sopenharmony_ci	u32 if_frequency;
328c2ecf20Sopenharmony_ci	u32 bandwidth;
338c2ecf20Sopenharmony_ci	u32 frequency;
348c2ecf20Sopenharmony_ci	struct delayed_work stat_work;
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#if defined(CONFIG_MEDIA_CONTROLLER)
378c2ecf20Sopenharmony_ci	struct media_device	*mdev;
388c2ecf20Sopenharmony_ci	struct media_entity	ent;
398c2ecf20Sopenharmony_ci	struct media_pad	pad[SI2157_NUM_PADS];
408c2ecf20Sopenharmony_ci#endif
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci};
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define SI2157_CHIPTYPE_SI2157 0
458c2ecf20Sopenharmony_ci#define SI2157_CHIPTYPE_SI2146 1
468c2ecf20Sopenharmony_ci#define SI2157_CHIPTYPE_SI2141 2
478c2ecf20Sopenharmony_ci#define SI2157_CHIPTYPE_SI2177 3
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* firmware command struct */
508c2ecf20Sopenharmony_ci#define SI2157_ARGLEN      30
518c2ecf20Sopenharmony_cistruct si2157_cmd {
528c2ecf20Sopenharmony_ci	u8 args[SI2157_ARGLEN];
538c2ecf20Sopenharmony_ci	unsigned wlen;
548c2ecf20Sopenharmony_ci	unsigned rlen;
558c2ecf20Sopenharmony_ci};
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define SI2158_A20_FIRMWARE "dvb-tuner-si2158-a20-01.fw"
588c2ecf20Sopenharmony_ci#define SI2141_A10_FIRMWARE "dvb-tuner-si2141-a10-01.fw"
598c2ecf20Sopenharmony_ci#define SI2157_A30_FIRMWARE "dvb-tuner-si2157-a30-01.fw"
608c2ecf20Sopenharmony_ci#endif
61