Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)     tda18271.h - header for the Philips / NXP TDA18271 silicon tuner
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)     Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #ifndef __TDA18271_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #define __TDA18271_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <media/dvb_frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) struct tda18271_std_map_item {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	u16 if_freq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	/* EP3[4:3] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	unsigned int agc_mode:2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	/* EP3[2:0] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	unsigned int std:3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	/* EP4[7] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	unsigned int fm_rfn:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	/* EP4[4:2] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	unsigned int if_lvl:3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	/* EB22[6:0] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	unsigned int rfagc_top:7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) struct tda18271_std_map {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	struct tda18271_std_map_item fm_radio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	struct tda18271_std_map_item atv_b;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	struct tda18271_std_map_item atv_dk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	struct tda18271_std_map_item atv_gh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	struct tda18271_std_map_item atv_i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	struct tda18271_std_map_item atv_l;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	struct tda18271_std_map_item atv_lc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	struct tda18271_std_map_item atv_mn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	struct tda18271_std_map_item atsc_6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	struct tda18271_std_map_item dvbt_6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	struct tda18271_std_map_item dvbt_7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	struct tda18271_std_map_item dvbt_8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	struct tda18271_std_map_item qam_6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	struct tda18271_std_map_item qam_7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	struct tda18271_std_map_item qam_8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) enum tda18271_role {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	TDA18271_MASTER = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	TDA18271_SLAVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) enum tda18271_i2c_gate {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	TDA18271_GATE_AUTO = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	TDA18271_GATE_ANALOG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	TDA18271_GATE_DIGITAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) enum tda18271_output_options {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	/* slave tuner output & loop through & xtal oscillator always on */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	TDA18271_OUTPUT_LT_XT_ON = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	/* slave tuner output loop through off */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	TDA18271_OUTPUT_LT_OFF = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	/* xtal oscillator off */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	TDA18271_OUTPUT_XT_OFF = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) enum tda18271_small_i2c {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	TDA18271_39_BYTE_CHUNK_INIT = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	TDA18271_16_BYTE_CHUNK_INIT = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	TDA18271_08_BYTE_CHUNK_INIT = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	TDA18271_03_BYTE_CHUNK_INIT = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) struct tda18271_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	/* override default if freq / std settings (optional) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	struct tda18271_std_map *std_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	/* master / slave tuner: master uses main pll, slave uses cal pll */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	enum tda18271_role role;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	/* use i2c gate provided by analog or digital demod */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	enum tda18271_i2c_gate gate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	/* output options that can be disabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	enum tda18271_output_options output_opt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	/* some i2c providers can't write all 39 registers at once */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	enum tda18271_small_i2c small_i2c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	/* force rf tracking filter calibration on startup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	unsigned int rf_cal_on_startup:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	/* prevent any register access during attach(),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	 * delaying both IR & RF calibration until init()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	 * module option 'cal' overrides this delay */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	unsigned int delay_cal:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	/* interface to saa713x / tda829x */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	unsigned int config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #define TDA18271_CALLBACK_CMD_AGC_ENABLE 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) enum tda18271_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	TDA18271_ANALOG = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	TDA18271_DIGITAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA18271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 					    struct i2c_adapter *i2c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 					    struct tda18271_config *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 						   u8 addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 						   struct i2c_adapter *i2c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 						   struct tda18271_config *cfg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #endif /* __TDA18271_H__ */