Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003     tda18271.h - header for the Philips / NXP TDA18271 silicon tuner
0004 
0005     Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
0006 
0007 */
0008 
0009 #ifndef __TDA18271_H__
0010 #define __TDA18271_H__
0011 
0012 #include <linux/i2c.h>
0013 #include <media/dvb_frontend.h>
0014 
0015 struct tda18271_std_map_item {
0016     u16 if_freq;
0017 
0018     /* EP3[4:3] */
0019     unsigned int agc_mode:2;
0020     /* EP3[2:0] */
0021     unsigned int std:3;
0022     /* EP4[7] */
0023     unsigned int fm_rfn:1;
0024     /* EP4[4:2] */
0025     unsigned int if_lvl:3;
0026     /* EB22[6:0] */
0027     unsigned int rfagc_top:7;
0028 };
0029 
0030 struct tda18271_std_map {
0031     struct tda18271_std_map_item fm_radio;
0032     struct tda18271_std_map_item atv_b;
0033     struct tda18271_std_map_item atv_dk;
0034     struct tda18271_std_map_item atv_gh;
0035     struct tda18271_std_map_item atv_i;
0036     struct tda18271_std_map_item atv_l;
0037     struct tda18271_std_map_item atv_lc;
0038     struct tda18271_std_map_item atv_mn;
0039     struct tda18271_std_map_item atsc_6;
0040     struct tda18271_std_map_item dvbt_6;
0041     struct tda18271_std_map_item dvbt_7;
0042     struct tda18271_std_map_item dvbt_8;
0043     struct tda18271_std_map_item qam_6;
0044     struct tda18271_std_map_item qam_7;
0045     struct tda18271_std_map_item qam_8;
0046 };
0047 
0048 enum tda18271_role {
0049     TDA18271_MASTER = 0,
0050     TDA18271_SLAVE,
0051 };
0052 
0053 enum tda18271_i2c_gate {
0054     TDA18271_GATE_AUTO = 0,
0055     TDA18271_GATE_ANALOG,
0056     TDA18271_GATE_DIGITAL,
0057 };
0058 
0059 enum tda18271_output_options {
0060     /* slave tuner output & loop through & xtal oscillator always on */
0061     TDA18271_OUTPUT_LT_XT_ON = 0,
0062 
0063     /* slave tuner output loop through off */
0064     TDA18271_OUTPUT_LT_OFF = 1,
0065 
0066     /* xtal oscillator off */
0067     TDA18271_OUTPUT_XT_OFF = 2,
0068 };
0069 
0070 enum tda18271_small_i2c {
0071     TDA18271_39_BYTE_CHUNK_INIT = 0,
0072     TDA18271_16_BYTE_CHUNK_INIT = 16,
0073     TDA18271_08_BYTE_CHUNK_INIT = 8,
0074     TDA18271_03_BYTE_CHUNK_INIT = 3,
0075 };
0076 
0077 struct tda18271_config {
0078     /* override default if freq / std settings (optional) */
0079     struct tda18271_std_map *std_map;
0080 
0081     /* master / slave tuner: master uses main pll, slave uses cal pll */
0082     enum tda18271_role role;
0083 
0084     /* use i2c gate provided by analog or digital demod */
0085     enum tda18271_i2c_gate gate;
0086 
0087     /* output options that can be disabled */
0088     enum tda18271_output_options output_opt;
0089 
0090     /* some i2c providers can't write all 39 registers at once */
0091     enum tda18271_small_i2c small_i2c;
0092 
0093     /* force rf tracking filter calibration on startup */
0094     unsigned int rf_cal_on_startup:1;
0095 
0096     /* prevent any register access during attach(),
0097      * delaying both IR & RF calibration until init()
0098      * module option 'cal' overrides this delay */
0099     unsigned int delay_cal:1;
0100 
0101     /* interface to saa713x / tda829x */
0102     unsigned int config;
0103 };
0104 
0105 #define TDA18271_CALLBACK_CMD_AGC_ENABLE 0
0106 
0107 enum tda18271_mode {
0108     TDA18271_ANALOG = 0,
0109     TDA18271_DIGITAL,
0110 };
0111 
0112 #if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA18271)
0113 extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
0114                         struct i2c_adapter *i2c,
0115                         struct tda18271_config *cfg);
0116 #else
0117 static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe,
0118                            u8 addr,
0119                            struct i2c_adapter *i2c,
0120                            struct tda18271_config *cfg)
0121 {
0122     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0123     return NULL;
0124 }
0125 #endif
0126 
0127 #endif /* __TDA18271_H__ */