18e8e69d6SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
29b8e1a5eSAndrey Smirnov /*
39b8e1a5eSAndrey Smirnov  * include/media/si476x-platform.h -- Platform data specific definitions
49b8e1a5eSAndrey Smirnov  *
59b8e1a5eSAndrey Smirnov  * Copyright (C) 2013 Andrey Smirnov
69b8e1a5eSAndrey Smirnov  *
79b8e1a5eSAndrey Smirnov  * Author: Andrey Smirnov <andrew.smirnov@gmail.com>
89b8e1a5eSAndrey Smirnov  */
99b8e1a5eSAndrey Smirnov 
109b8e1a5eSAndrey Smirnov #ifndef __SI476X_PLATFORM_H__
119b8e1a5eSAndrey Smirnov #define __SI476X_PLATFORM_H__
129b8e1a5eSAndrey Smirnov 
139b8e1a5eSAndrey Smirnov /* It is possible to select one of the four adresses using pins A0
149b8e1a5eSAndrey Smirnov  * and A1 on SI476x */
159b8e1a5eSAndrey Smirnov #define SI476X_I2C_ADDR_1	0x60
169b8e1a5eSAndrey Smirnov #define SI476X_I2C_ADDR_2	0x61
179b8e1a5eSAndrey Smirnov #define SI476X_I2C_ADDR_3	0x62
189b8e1a5eSAndrey Smirnov #define SI476X_I2C_ADDR_4	0x63
199b8e1a5eSAndrey Smirnov 
209b8e1a5eSAndrey Smirnov enum si476x_iqclk_config {
219b8e1a5eSAndrey Smirnov 	SI476X_IQCLK_NOOP = 0,
229b8e1a5eSAndrey Smirnov 	SI476X_IQCLK_TRISTATE = 1,
239b8e1a5eSAndrey Smirnov 	SI476X_IQCLK_IQ = 21,
249b8e1a5eSAndrey Smirnov };
259b8e1a5eSAndrey Smirnov enum si476x_iqfs_config {
269b8e1a5eSAndrey Smirnov 	SI476X_IQFS_NOOP = 0,
279b8e1a5eSAndrey Smirnov 	SI476X_IQFS_TRISTATE = 1,
289b8e1a5eSAndrey Smirnov 	SI476X_IQFS_IQ = 21,
299b8e1a5eSAndrey Smirnov };
309b8e1a5eSAndrey Smirnov enum si476x_iout_config {
319b8e1a5eSAndrey Smirnov 	SI476X_IOUT_NOOP = 0,
329b8e1a5eSAndrey Smirnov 	SI476X_IOUT_TRISTATE = 1,
339b8e1a5eSAndrey Smirnov 	SI476X_IOUT_OUTPUT = 22,
349b8e1a5eSAndrey Smirnov };
359b8e1a5eSAndrey Smirnov enum si476x_qout_config {
369b8e1a5eSAndrey Smirnov 	SI476X_QOUT_NOOP = 0,
379b8e1a5eSAndrey Smirnov 	SI476X_QOUT_TRISTATE = 1,
389b8e1a5eSAndrey Smirnov 	SI476X_QOUT_OUTPUT = 22,
399b8e1a5eSAndrey Smirnov };
409b8e1a5eSAndrey Smirnov 
419b8e1a5eSAndrey Smirnov enum si476x_dclk_config {
429b8e1a5eSAndrey Smirnov 	SI476X_DCLK_NOOP      = 0,
439b8e1a5eSAndrey Smirnov 	SI476X_DCLK_TRISTATE  = 1,
449b8e1a5eSAndrey Smirnov 	SI476X_DCLK_DAUDIO    = 10,
459b8e1a5eSAndrey Smirnov };
469b8e1a5eSAndrey Smirnov 
479b8e1a5eSAndrey Smirnov enum si476x_dfs_config {
489b8e1a5eSAndrey Smirnov 	SI476X_DFS_NOOP      = 0,
499b8e1a5eSAndrey Smirnov 	SI476X_DFS_TRISTATE  = 1,
509b8e1a5eSAndrey Smirnov 	SI476X_DFS_DAUDIO    = 10,
519b8e1a5eSAndrey Smirnov };
529b8e1a5eSAndrey Smirnov 
539b8e1a5eSAndrey Smirnov enum si476x_dout_config {
549b8e1a5eSAndrey Smirnov 	SI476X_DOUT_NOOP       = 0,
559b8e1a5eSAndrey Smirnov 	SI476X_DOUT_TRISTATE   = 1,
569b8e1a5eSAndrey Smirnov 	SI476X_DOUT_I2S_OUTPUT = 12,
579b8e1a5eSAndrey Smirnov 	SI476X_DOUT_I2S_INPUT  = 13,
589b8e1a5eSAndrey Smirnov };
599b8e1a5eSAndrey Smirnov 
609b8e1a5eSAndrey Smirnov enum si476x_xout_config {
619b8e1a5eSAndrey Smirnov 	SI476X_XOUT_NOOP        = 0,
629b8e1a5eSAndrey Smirnov 	SI476X_XOUT_TRISTATE    = 1,
639b8e1a5eSAndrey Smirnov 	SI476X_XOUT_I2S_INPUT   = 13,
649b8e1a5eSAndrey Smirnov 	SI476X_XOUT_MODE_SELECT = 23,
659b8e1a5eSAndrey Smirnov };
669b8e1a5eSAndrey Smirnov 
679b8e1a5eSAndrey Smirnov enum si476x_icin_config {
689b8e1a5eSAndrey Smirnov 	SI476X_ICIN_NOOP	= 0,
699b8e1a5eSAndrey Smirnov 	SI476X_ICIN_TRISTATE	= 1,
709b8e1a5eSAndrey Smirnov 	SI476X_ICIN_GPO1_HIGH	= 2,
719b8e1a5eSAndrey Smirnov 	SI476X_ICIN_GPO1_LOW	= 3,
729b8e1a5eSAndrey Smirnov 	SI476X_ICIN_IC_LINK	= 30,
739b8e1a5eSAndrey Smirnov };
749b8e1a5eSAndrey Smirnov 
759b8e1a5eSAndrey Smirnov enum si476x_icip_config {
769b8e1a5eSAndrey Smirnov 	SI476X_ICIP_NOOP	= 0,
779b8e1a5eSAndrey Smirnov 	SI476X_ICIP_TRISTATE	= 1,
789b8e1a5eSAndrey Smirnov 	SI476X_ICIP_GPO2_HIGH	= 2,
799b8e1a5eSAndrey Smirnov 	SI476X_ICIP_GPO2_LOW	= 3,
809b8e1a5eSAndrey Smirnov 	SI476X_ICIP_IC_LINK	= 30,
819b8e1a5eSAndrey Smirnov };
829b8e1a5eSAndrey Smirnov 
839b8e1a5eSAndrey Smirnov enum si476x_icon_config {
849b8e1a5eSAndrey Smirnov 	SI476X_ICON_NOOP	= 0,
859b8e1a5eSAndrey Smirnov 	SI476X_ICON_TRISTATE	= 1,
869b8e1a5eSAndrey Smirnov 	SI476X_ICON_I2S		= 10,
879b8e1a5eSAndrey Smirnov 	SI476X_ICON_IC_LINK	= 30,
889b8e1a5eSAndrey Smirnov };
899b8e1a5eSAndrey Smirnov 
909b8e1a5eSAndrey Smirnov enum si476x_icop_config {
919b8e1a5eSAndrey Smirnov 	SI476X_ICOP_NOOP	= 0,
929b8e1a5eSAndrey Smirnov 	SI476X_ICOP_TRISTATE	= 1,
939b8e1a5eSAndrey Smirnov 	SI476X_ICOP_I2S		= 10,
949b8e1a5eSAndrey Smirnov 	SI476X_ICOP_IC_LINK	= 30,
959b8e1a5eSAndrey Smirnov };
969b8e1a5eSAndrey Smirnov 
979b8e1a5eSAndrey Smirnov 
989b8e1a5eSAndrey Smirnov enum si476x_lrout_config {
999b8e1a5eSAndrey Smirnov 	SI476X_LROUT_NOOP	= 0,
1009b8e1a5eSAndrey Smirnov 	SI476X_LROUT_TRISTATE	= 1,
1019b8e1a5eSAndrey Smirnov 	SI476X_LROUT_AUDIO	= 2,
1029b8e1a5eSAndrey Smirnov 	SI476X_LROUT_MPX	= 3,
1039b8e1a5eSAndrey Smirnov };
1049b8e1a5eSAndrey Smirnov 
1059b8e1a5eSAndrey Smirnov 
1069b8e1a5eSAndrey Smirnov enum si476x_intb_config {
1079b8e1a5eSAndrey Smirnov 	SI476X_INTB_NOOP     = 0,
1089b8e1a5eSAndrey Smirnov 	SI476X_INTB_TRISTATE = 1,
1099b8e1a5eSAndrey Smirnov 	SI476X_INTB_DAUDIO   = 10,
1109b8e1a5eSAndrey Smirnov 	SI476X_INTB_IRQ      = 40,
1119b8e1a5eSAndrey Smirnov };
1129b8e1a5eSAndrey Smirnov 
1139b8e1a5eSAndrey Smirnov enum si476x_a1_config {
1149b8e1a5eSAndrey Smirnov 	SI476X_A1_NOOP     = 0,
1159b8e1a5eSAndrey Smirnov 	SI476X_A1_TRISTATE = 1,
1169b8e1a5eSAndrey Smirnov 	SI476X_A1_IRQ      = 40,
1179b8e1a5eSAndrey Smirnov };
1189b8e1a5eSAndrey Smirnov 
1199b8e1a5eSAndrey Smirnov 
1209b8e1a5eSAndrey Smirnov struct si476x_pinmux {
1219b8e1a5eSAndrey Smirnov 	enum si476x_dclk_config  dclk;
1229b8e1a5eSAndrey Smirnov 	enum si476x_dfs_config   dfs;
1239b8e1a5eSAndrey Smirnov 	enum si476x_dout_config  dout;
1249b8e1a5eSAndrey Smirnov 	enum si476x_xout_config  xout;
1259b8e1a5eSAndrey Smirnov 
1269b8e1a5eSAndrey Smirnov 	enum si476x_iqclk_config iqclk;
1279b8e1a5eSAndrey Smirnov 	enum si476x_iqfs_config  iqfs;
1289b8e1a5eSAndrey Smirnov 	enum si476x_iout_config  iout;
1299b8e1a5eSAndrey Smirnov 	enum si476x_qout_config  qout;
1309b8e1a5eSAndrey Smirnov 
1319b8e1a5eSAndrey Smirnov 	enum si476x_icin_config  icin;
1329b8e1a5eSAndrey Smirnov 	enum si476x_icip_config  icip;
1339b8e1a5eSAndrey Smirnov 	enum si476x_icon_config  icon;
1349b8e1a5eSAndrey Smirnov 	enum si476x_icop_config  icop;
1359b8e1a5eSAndrey Smirnov 
1369b8e1a5eSAndrey Smirnov 	enum si476x_lrout_config lrout;
1379b8e1a5eSAndrey Smirnov 
1389b8e1a5eSAndrey Smirnov 	enum si476x_intb_config  intb;
1399b8e1a5eSAndrey Smirnov 	enum si476x_a1_config    a1;
1409b8e1a5eSAndrey Smirnov };
1419b8e1a5eSAndrey Smirnov 
1429b8e1a5eSAndrey Smirnov enum si476x_ibias6x {
1439b8e1a5eSAndrey Smirnov 	SI476X_IBIAS6X_OTHER			= 0,
1449b8e1a5eSAndrey Smirnov 	SI476X_IBIAS6X_RCVR1_NON_4MHZ_CLK	= 1,
1459b8e1a5eSAndrey Smirnov };
1469b8e1a5eSAndrey Smirnov 
1479b8e1a5eSAndrey Smirnov enum si476x_xstart {
1489b8e1a5eSAndrey Smirnov 	SI476X_XSTART_MULTIPLE_TUNER	= 0x11,
1499b8e1a5eSAndrey Smirnov 	SI476X_XSTART_NORMAL		= 0x77,
1509b8e1a5eSAndrey Smirnov };
1519b8e1a5eSAndrey Smirnov 
1529b8e1a5eSAndrey Smirnov enum si476x_freq {
1539b8e1a5eSAndrey Smirnov 	SI476X_FREQ_4_MHZ		= 0,
1549b8e1a5eSAndrey Smirnov 	SI476X_FREQ_37P209375_MHZ	= 1,
1559b8e1a5eSAndrey Smirnov 	SI476X_FREQ_36P4_MHZ		= 2,
1569b8e1a5eSAndrey Smirnov 	SI476X_FREQ_37P8_MHZ		=  3,
1579b8e1a5eSAndrey Smirnov };
1589b8e1a5eSAndrey Smirnov 
1599b8e1a5eSAndrey Smirnov enum si476x_xmode {
1609b8e1a5eSAndrey Smirnov 	SI476X_XMODE_CRYSTAL_RCVR1	= 1,
1619b8e1a5eSAndrey Smirnov 	SI476X_XMODE_EXT_CLOCK		= 2,
1629b8e1a5eSAndrey Smirnov 	SI476X_XMODE_CRYSTAL_RCVR2_3	= 3,
1639b8e1a5eSAndrey Smirnov };
1649b8e1a5eSAndrey Smirnov 
1659b8e1a5eSAndrey Smirnov enum si476x_xbiashc {
1669b8e1a5eSAndrey Smirnov 	SI476X_XBIASHC_SINGLE_RECEIVER = 0,
1679b8e1a5eSAndrey Smirnov 	SI476X_XBIASHC_MULTIPLE_RECEIVER = 1,
1689b8e1a5eSAndrey Smirnov };
1699b8e1a5eSAndrey Smirnov 
1709b8e1a5eSAndrey Smirnov enum si476x_xbias {
1719b8e1a5eSAndrey Smirnov 	SI476X_XBIAS_RCVR2_3	= 0,
1729b8e1a5eSAndrey Smirnov 	SI476X_XBIAS_4MHZ_RCVR1 = 3,
1739b8e1a5eSAndrey Smirnov 	SI476X_XBIAS_RCVR1	= 7,
1749b8e1a5eSAndrey Smirnov };
1759b8e1a5eSAndrey Smirnov 
1769b8e1a5eSAndrey Smirnov enum si476x_func {
1779b8e1a5eSAndrey Smirnov 	SI476X_FUNC_BOOTLOADER	= 0,
1789b8e1a5eSAndrey Smirnov 	SI476X_FUNC_FM_RECEIVER = 1,
1799b8e1a5eSAndrey Smirnov 	SI476X_FUNC_AM_RECEIVER = 2,
1809b8e1a5eSAndrey Smirnov 	SI476X_FUNC_WB_RECEIVER = 3,
1819b8e1a5eSAndrey Smirnov };
1829b8e1a5eSAndrey Smirnov 
1839b8e1a5eSAndrey Smirnov 
1849b8e1a5eSAndrey Smirnov /**
1859b8e1a5eSAndrey Smirnov  * @xcload: Selects the amount of additional on-chip capacitance to
1869b8e1a5eSAndrey Smirnov  *          be connected between XTAL1 and gnd and between XTAL2 and
1879b8e1a5eSAndrey Smirnov  *          GND. One half of the capacitance value shown here is the
1889b8e1a5eSAndrey Smirnov  *          additional load capacitance presented to the xtal. The
1899b8e1a5eSAndrey Smirnov  *          minimum step size is 0.277 pF. Recommended value is 0x28
1909b8e1a5eSAndrey Smirnov  *          but it will be layout dependent. Range is 0–0x3F i.e.
1919b8e1a5eSAndrey Smirnov  *          (0–16.33 pF)
1929b8e1a5eSAndrey Smirnov  * @ctsien: enable CTSINT(interrupt request when CTS condition
1939b8e1a5eSAndrey Smirnov  *          arises) when set
1949b8e1a5eSAndrey Smirnov  * @intsel: when set A1 pin becomes the interrupt pin; otherwise,
1959b8e1a5eSAndrey Smirnov  *          INTB is the interrupt pin
1969b8e1a5eSAndrey Smirnov  * @func:   selects the boot function of the device. I.e.
1979b8e1a5eSAndrey Smirnov  *          SI476X_BOOTLOADER  - Boot loader
1989b8e1a5eSAndrey Smirnov  *          SI476X_FM_RECEIVER - FM receiver
1999b8e1a5eSAndrey Smirnov  *          SI476X_AM_RECEIVER - AM receiver
2009b8e1a5eSAndrey Smirnov  *          SI476X_WB_RECEIVER - Weatherband receiver
2019b8e1a5eSAndrey Smirnov  * @freq:   oscillator's crystal frequency:
2029b8e1a5eSAndrey Smirnov  *          SI476X_XTAL_37P209375_MHZ - 37.209375 Mhz
2039b8e1a5eSAndrey Smirnov  *          SI476X_XTAL_36P4_MHZ      - 36.4 Mhz
2049b8e1a5eSAndrey Smirnov  *          SI476X_XTAL_37P8_MHZ      - 37.8 Mhz
2059b8e1a5eSAndrey Smirnov  */
2069b8e1a5eSAndrey Smirnov struct si476x_power_up_args {
2079b8e1a5eSAndrey Smirnov 	enum si476x_ibias6x ibias6x;
2089b8e1a5eSAndrey Smirnov 	enum si476x_xstart  xstart;
2099b8e1a5eSAndrey Smirnov 	u8   xcload;
2109b8e1a5eSAndrey Smirnov 	bool fastboot;
2119b8e1a5eSAndrey Smirnov 	enum si476x_xbiashc xbiashc;
2129b8e1a5eSAndrey Smirnov 	enum si476x_xbias   xbias;
2139b8e1a5eSAndrey Smirnov 	enum si476x_func    func;
2149b8e1a5eSAndrey Smirnov 	enum si476x_freq    freq;
2159b8e1a5eSAndrey Smirnov 	enum si476x_xmode   xmode;
2169b8e1a5eSAndrey Smirnov };
2179b8e1a5eSAndrey Smirnov 
2189b8e1a5eSAndrey Smirnov 
2199b8e1a5eSAndrey Smirnov /**
2209b8e1a5eSAndrey Smirnov  * enum si476x_phase_diversity_mode - possbile phase diversity modes
2219b8e1a5eSAndrey Smirnov  * for SI4764/5/6/7 chips.
2229b8e1a5eSAndrey Smirnov  *
2239b8e1a5eSAndrey Smirnov  * @SI476X_PHDIV_DISABLED:		Phase diversity feature is
2249b8e1a5eSAndrey Smirnov  *					disabled.
2259b8e1a5eSAndrey Smirnov  * @SI476X_PHDIV_PRIMARY_COMBINING:	Tuner works as a primary tuner
2269b8e1a5eSAndrey Smirnov  *					in combination with a
2279b8e1a5eSAndrey Smirnov  *					secondary one.
2289b8e1a5eSAndrey Smirnov  * @SI476X_PHDIV_PRIMARY_ANTENNA:	Tuner works as a primary tuner
2299b8e1a5eSAndrey Smirnov  *					using only its own antenna.
2309b8e1a5eSAndrey Smirnov  * @SI476X_PHDIV_SECONDARY_ANTENNA:	Tuner works as a primary tuner
2319b8e1a5eSAndrey Smirnov  *					usning seconary tuner's antenna.
2329b8e1a5eSAndrey Smirnov  * @SI476X_PHDIV_SECONDARY_COMBINING:	Tuner works as a secondary
2339b8e1a5eSAndrey Smirnov  *					tuner in combination with the
2349b8e1a5eSAndrey Smirnov  *					primary one.
2359b8e1a5eSAndrey Smirnov  */
2369b8e1a5eSAndrey Smirnov enum si476x_phase_diversity_mode {
2379b8e1a5eSAndrey Smirnov 	SI476X_PHDIV_DISABLED			= 0,
2389b8e1a5eSAndrey Smirnov 	SI476X_PHDIV_PRIMARY_COMBINING		= 1,
2399b8e1a5eSAndrey Smirnov 	SI476X_PHDIV_PRIMARY_ANTENNA		= 2,
2409b8e1a5eSAndrey Smirnov 	SI476X_PHDIV_SECONDARY_ANTENNA		= 3,
2419b8e1a5eSAndrey Smirnov 	SI476X_PHDIV_SECONDARY_COMBINING	= 5,
2429b8e1a5eSAndrey Smirnov };
2439b8e1a5eSAndrey Smirnov 
2449b8e1a5eSAndrey Smirnov 
2459b8e1a5eSAndrey Smirnov /*
2469b8e1a5eSAndrey Smirnov  * Platform dependent definition
2479b8e1a5eSAndrey Smirnov  */
2489b8e1a5eSAndrey Smirnov struct si476x_platform_data {
2499b8e1a5eSAndrey Smirnov 	int gpio_reset; /* < 0 if not used */
2509b8e1a5eSAndrey Smirnov 
2519b8e1a5eSAndrey Smirnov 	struct si476x_power_up_args power_up_parameters;
2529b8e1a5eSAndrey Smirnov 	enum si476x_phase_diversity_mode diversity_mode;
2539b8e1a5eSAndrey Smirnov 
2549b8e1a5eSAndrey Smirnov 	struct si476x_pinmux pinmux;
2559b8e1a5eSAndrey Smirnov };
2569b8e1a5eSAndrey Smirnov 
2579b8e1a5eSAndrey Smirnov 
2589b8e1a5eSAndrey Smirnov #endif /* __SI476X_PLATFORM_H__ */
259