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