brintos

brintos / linux-shallow public Read only

0
0
Text · 7.2 KiB · 29d0e1f Raw
255 lines · c
1/*2 * drivers/media/radio/si4713-i2c.h3 *4 * Property and commands definitions for Si4713 radio transmitter chip.5 *6 * Copyright (c) 2008 Instituto Nokia de Tecnologia - INdT7 * Contact: Eduardo Valentin <eduardo.valentin@nokia.com>8 *9 * This file is licensed under the terms of the GNU General Public License10 * version 2. This program is licensed "as is" without any warranty of any11 * kind, whether express or implied.12 *13 */14 15#ifndef SI4713_I2C_H16#define SI4713_I2C_H17 18#include <linux/platform_device.h>19#include <linux/regulator/consumer.h>20#include <linux/gpio/consumer.h>21#include <media/v4l2-subdev.h>22#include <media/v4l2-ctrls.h>23#include <linux/platform_data/media/si4713.h>24 25#define SI4713_PRODUCT_NUMBER		0x0D26 27/* Command Timeouts */28#define DEFAULT_TIMEOUT			50029#define TIMEOUT_SET_PROPERTY		2030#define TIMEOUT_TX_TUNE_POWER		3000031#define TIMEOUT_TX_TUNE			11000032#define TIMEOUT_POWER_UP		20000033 34/*35 * Command and its arguments definitions36 */37#define SI4713_PWUP_CTSIEN		(1<<7)38#define SI4713_PWUP_GPO2OEN		(1<<6)39#define SI4713_PWUP_PATCH		(1<<5)40#define SI4713_PWUP_XOSCEN		(1<<4)41#define SI4713_PWUP_FUNC_TX		0x0242#define SI4713_PWUP_FUNC_PATCH		0x0F43#define SI4713_PWUP_OPMOD_ANALOG	0x5044#define SI4713_PWUP_OPMOD_DIGITAL	0x0F45#define SI4713_PWUP_NARGS		246#define SI4713_PWUP_NRESP		147#define SI4713_CMD_POWER_UP		0x0148 49#define SI4713_GETREV_NRESP		950#define SI4713_CMD_GET_REV		0x1051 52#define SI4713_PWDN_NRESP		153#define SI4713_CMD_POWER_DOWN		0x1154 55#define SI4713_SET_PROP_NARGS		556#define SI4713_SET_PROP_NRESP		157#define SI4713_CMD_SET_PROPERTY		0x1258 59#define SI4713_GET_PROP_NARGS		360#define SI4713_GET_PROP_NRESP		461#define SI4713_CMD_GET_PROPERTY		0x1362 63#define SI4713_GET_STATUS_NRESP		164#define SI4713_CMD_GET_INT_STATUS	0x1465 66#define SI4713_CMD_PATCH_ARGS		0x1567#define SI4713_CMD_PATCH_DATA		0x1668 69#define SI4713_MAX_FREQ			1080070#define SI4713_MIN_FREQ			760071#define SI4713_TXFREQ_NARGS		372#define SI4713_TXFREQ_NRESP		173#define SI4713_CMD_TX_TUNE_FREQ		0x3074 75#define SI4713_MAX_POWER		12076#define SI4713_MIN_POWER		8877#define SI4713_MAX_ANTCAP		19178#define SI4713_MIN_ANTCAP		079#define SI4713_TXPWR_NARGS		480#define SI4713_TXPWR_NRESP		181#define SI4713_CMD_TX_TUNE_POWER	0x3182 83#define SI4713_TXMEA_NARGS		484#define SI4713_TXMEA_NRESP		185#define SI4713_CMD_TX_TUNE_MEASURE	0x3286 87#define SI4713_INTACK_MASK		0x0188#define SI4713_TXSTATUS_NARGS		189#define SI4713_TXSTATUS_NRESP		890#define SI4713_CMD_TX_TUNE_STATUS	0x3391 92#define SI4713_OVERMOD_BIT		(1 << 2)93#define SI4713_IALH_BIT			(1 << 1)94#define SI4713_IALL_BIT			(1 << 0)95#define SI4713_ASQSTATUS_NARGS		196#define SI4713_ASQSTATUS_NRESP		597#define SI4713_CMD_TX_ASQ_STATUS	0x3498 99#define SI4713_RDSBUFF_MODE_MASK	0x87100#define SI4713_RDSBUFF_NARGS		7101#define SI4713_RDSBUFF_NRESP		6102#define SI4713_CMD_TX_RDS_BUFF		0x35103 104#define SI4713_RDSPS_PSID_MASK		0x1F105#define SI4713_RDSPS_NARGS		5106#define SI4713_RDSPS_NRESP		1107#define SI4713_CMD_TX_RDS_PS		0x36108 109#define SI4713_CMD_GPO_CTL		0x80110#define SI4713_CMD_GPO_SET		0x81111 112/*113 * Bits from status response114 */115#define SI4713_CTS			(1<<7)116#define SI4713_ERR			(1<<6)117#define SI4713_RDS_INT			(1<<2)118#define SI4713_ASQ_INT			(1<<1)119#define SI4713_STC_INT			(1<<0)120 121/*122 * Property definitions123 */124#define SI4713_GPO_IEN			0x0001125#define SI4713_DIG_INPUT_FORMAT		0x0101126#define SI4713_DIG_INPUT_SAMPLE_RATE	0x0103127#define SI4713_REFCLK_FREQ		0x0201128#define SI4713_REFCLK_PRESCALE		0x0202129#define SI4713_TX_COMPONENT_ENABLE	0x2100130#define SI4713_TX_AUDIO_DEVIATION	0x2101131#define SI4713_TX_PILOT_DEVIATION	0x2102132#define SI4713_TX_RDS_DEVIATION		0x2103133#define SI4713_TX_LINE_INPUT_LEVEL	0x2104134#define SI4713_TX_LINE_INPUT_MUTE	0x2105135#define SI4713_TX_PREEMPHASIS		0x2106136#define SI4713_TX_PILOT_FREQUENCY	0x2107137#define SI4713_TX_ACOMP_ENABLE		0x2200138#define SI4713_TX_ACOMP_THRESHOLD	0x2201139#define SI4713_TX_ACOMP_ATTACK_TIME	0x2202140#define SI4713_TX_ACOMP_RELEASE_TIME	0x2203141#define SI4713_TX_ACOMP_GAIN		0x2204142#define SI4713_TX_LIMITER_RELEASE_TIME	0x2205143#define SI4713_TX_ASQ_INTERRUPT_SOURCE	0x2300144#define SI4713_TX_ASQ_LEVEL_LOW		0x2301145#define SI4713_TX_ASQ_DURATION_LOW	0x2302146#define SI4713_TX_ASQ_LEVEL_HIGH	0x2303147#define SI4713_TX_ASQ_DURATION_HIGH	0x2304148#define SI4713_TX_RDS_INTERRUPT_SOURCE	0x2C00149#define SI4713_TX_RDS_PI		0x2C01150#define SI4713_TX_RDS_PS_MIX		0x2C02151#define SI4713_TX_RDS_PS_MISC		0x2C03152#define SI4713_TX_RDS_PS_REPEAT_COUNT	0x2C04153#define SI4713_TX_RDS_PS_MESSAGE_COUNT	0x2C05154#define SI4713_TX_RDS_PS_AF		0x2C06155#define SI4713_TX_RDS_FIFO_SIZE		0x2C07156 157#define PREEMPHASIS_USA			75158#define PREEMPHASIS_EU			50159#define PREEMPHASIS_DISABLED		0160#define FMPE_USA			0x00161#define FMPE_EU				0x01162#define FMPE_DISABLED			0x02163 164#define POWER_UP			0x01165#define POWER_DOWN			0x00166 167#define MAX_RDS_PTY			31168#define MAX_RDS_DEVIATION		90000169 170/*171 * PSNAME is known to be defined as 8 character sized (RDS Spec).172 * However, there is receivers which scroll PSNAME 8xN sized.173 */174#define MAX_RDS_PS_NAME			96175 176/*177 * MAX_RDS_RADIO_TEXT is known to be defined as 32 (2A group) or 64 (2B group)178 * character sized (RDS Spec).179 * However, there is receivers which scroll them as well.180 */181#define MAX_RDS_RADIO_TEXT		384182 183#define MAX_LIMITER_RELEASE_TIME	102390184#define MAX_LIMITER_DEVIATION		90000185 186#define MAX_PILOT_DEVIATION		90000187#define MAX_PILOT_FREQUENCY		19000188 189#define MAX_ACOMP_RELEASE_TIME		1000000190#define MAX_ACOMP_ATTACK_TIME		5000191#define MAX_ACOMP_THRESHOLD		0192#define MIN_ACOMP_THRESHOLD		(-40)193#define MAX_ACOMP_GAIN			20194 195/*196 * si4713_device - private data197 */198struct si4713_device {199	/* v4l2_subdev and i2c reference (v4l2_subdev priv data) */200	struct v4l2_subdev sd;201	struct v4l2_ctrl_handler ctrl_handler;202	/* private data structures */203	struct { /* si4713 control cluster */204		/* This is one big cluster since the mute control205		 * powers off the device and after unmuting again all206		 * controls need to be set at once. The only way of doing207		 * that is by making it one big cluster. */208		struct v4l2_ctrl *mute;209		struct v4l2_ctrl *rds_ps_name;210		struct v4l2_ctrl *rds_radio_text;211		struct v4l2_ctrl *rds_pi;212		struct v4l2_ctrl *rds_deviation;213		struct v4l2_ctrl *rds_pty;214		struct v4l2_ctrl *rds_compressed;215		struct v4l2_ctrl *rds_art_head;216		struct v4l2_ctrl *rds_stereo;217		struct v4l2_ctrl *rds_ta;218		struct v4l2_ctrl *rds_tp;219		struct v4l2_ctrl *rds_ms;220		struct v4l2_ctrl *rds_dyn_pty;221		struct v4l2_ctrl *rds_alt_freqs_enable;222		struct v4l2_ctrl *rds_alt_freqs;223		struct v4l2_ctrl *compression_enabled;224		struct v4l2_ctrl *compression_threshold;225		struct v4l2_ctrl *compression_gain;226		struct v4l2_ctrl *compression_attack_time;227		struct v4l2_ctrl *compression_release_time;228		struct v4l2_ctrl *pilot_tone_enabled;229		struct v4l2_ctrl *pilot_tone_freq;230		struct v4l2_ctrl *pilot_tone_deviation;231		struct v4l2_ctrl *limiter_enabled;232		struct v4l2_ctrl *limiter_deviation;233		struct v4l2_ctrl *limiter_release_time;234		struct v4l2_ctrl *tune_preemphasis;235		struct v4l2_ctrl *tune_pwr_level;236		struct v4l2_ctrl *tune_ant_cap;237	};238	struct completion work;239	struct regulator *vdd;240	struct regulator *vio;241	struct gpio_desc *gpio_reset;242	struct platform_device *pd;243	u32 power_state;244	u32 rds_enabled;245	u32 frequency;246	u32 preemphasis;247	u32 stereo;248	u32 tune_rnl;249};250 251struct radio_si4713_platform_data {252	struct i2c_client *subdev;253};254#endif /* ifndef SI4713_I2C_H */255