18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Silicon Labs Si2168 DVB-T/T2/C demodulator driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef SI2168_PRIV_H
98c2ecf20Sopenharmony_ci#define SI2168_PRIV_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include "si2168.h"
128c2ecf20Sopenharmony_ci#include <media/dvb_frontend.h>
138c2ecf20Sopenharmony_ci#include <linux/firmware.h>
148c2ecf20Sopenharmony_ci#include <linux/i2c-mux.h>
158c2ecf20Sopenharmony_ci#include <linux/kernel.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define SI2168_A20_FIRMWARE "dvb-demod-si2168-a20-01.fw"
188c2ecf20Sopenharmony_ci#define SI2168_A30_FIRMWARE "dvb-demod-si2168-a30-01.fw"
198c2ecf20Sopenharmony_ci#define SI2168_B40_FIRMWARE "dvb-demod-si2168-b40-01.fw"
208c2ecf20Sopenharmony_ci#define SI2168_D60_FIRMWARE "dvb-demod-si2168-d60-01.fw"
218c2ecf20Sopenharmony_ci#define SI2168_B40_FIRMWARE_FALLBACK "dvb-demod-si2168-02.fw"
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* state struct */
248c2ecf20Sopenharmony_cistruct si2168_dev {
258c2ecf20Sopenharmony_ci	struct mutex i2c_mutex;
268c2ecf20Sopenharmony_ci	struct i2c_mux_core *muxc;
278c2ecf20Sopenharmony_ci	struct dvb_frontend fe;
288c2ecf20Sopenharmony_ci	enum fe_delivery_system delivery_system;
298c2ecf20Sopenharmony_ci	enum fe_status fe_status;
308c2ecf20Sopenharmony_ci	#define SI2168_CHIP_ID_A20 ('A' << 24 | 68 << 16 | '2' << 8 | '0' << 0)
318c2ecf20Sopenharmony_ci	#define SI2168_CHIP_ID_A30 ('A' << 24 | 68 << 16 | '3' << 8 | '0' << 0)
328c2ecf20Sopenharmony_ci	#define SI2168_CHIP_ID_B40 ('B' << 24 | 68 << 16 | '4' << 8 | '0' << 0)
338c2ecf20Sopenharmony_ci	#define SI2168_CHIP_ID_D60 ('D' << 24 | 68 << 16 | '6' << 8 | '0' << 0)
348c2ecf20Sopenharmony_ci	unsigned int chip_id;
358c2ecf20Sopenharmony_ci	unsigned int version;
368c2ecf20Sopenharmony_ci	const char *firmware_name;
378c2ecf20Sopenharmony_ci	u8 ts_mode;
388c2ecf20Sopenharmony_ci	unsigned int active:1;
398c2ecf20Sopenharmony_ci	unsigned int warm:1;
408c2ecf20Sopenharmony_ci	unsigned int ts_clock_inv:1;
418c2ecf20Sopenharmony_ci	unsigned int ts_clock_gapped:1;
428c2ecf20Sopenharmony_ci	unsigned int spectral_inversion:1;
438c2ecf20Sopenharmony_ci};
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* firmware command struct */
468c2ecf20Sopenharmony_ci#define SI2168_ARGLEN      30
478c2ecf20Sopenharmony_cistruct si2168_cmd {
488c2ecf20Sopenharmony_ci	u8 args[SI2168_ARGLEN];
498c2ecf20Sopenharmony_ci	unsigned wlen;
508c2ecf20Sopenharmony_ci	unsigned rlen;
518c2ecf20Sopenharmony_ci};
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#endif
54