pdata.h 5.4 KB
Newer Older
M
Mark Brown 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
 * Platform data for Arizona devices
 *
 * Copyright 2012 Wolfson Microelectronics. PLC.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef _ARIZONA_PDATA_H
#define _ARIZONA_PDATA_H

14 15
#include <dt-bindings/mfd/arizona.h>

M
Mark Brown 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#define ARIZONA_GPN_DIR_MASK                     0x8000  /* GPN_DIR */
#define ARIZONA_GPN_DIR_SHIFT                        15  /* GPN_DIR */
#define ARIZONA_GPN_DIR_WIDTH                         1  /* GPN_DIR */
#define ARIZONA_GPN_PU_MASK                      0x4000  /* GPN_PU */
#define ARIZONA_GPN_PU_SHIFT                         14  /* GPN_PU */
#define ARIZONA_GPN_PU_WIDTH                          1  /* GPN_PU */
#define ARIZONA_GPN_PD_MASK                      0x2000  /* GPN_PD */
#define ARIZONA_GPN_PD_SHIFT                         13  /* GPN_PD */
#define ARIZONA_GPN_PD_WIDTH                          1  /* GPN_PD */
#define ARIZONA_GPN_LVL_MASK                     0x0800  /* GPN_LVL */
#define ARIZONA_GPN_LVL_SHIFT                        11  /* GPN_LVL */
#define ARIZONA_GPN_LVL_WIDTH                         1  /* GPN_LVL */
#define ARIZONA_GPN_POL_MASK                     0x0400  /* GPN_POL */
#define ARIZONA_GPN_POL_SHIFT                        10  /* GPN_POL */
#define ARIZONA_GPN_POL_WIDTH                         1  /* GPN_POL */
#define ARIZONA_GPN_OP_CFG_MASK                  0x0200  /* GPN_OP_CFG */
#define ARIZONA_GPN_OP_CFG_SHIFT                      9  /* GPN_OP_CFG */
#define ARIZONA_GPN_OP_CFG_WIDTH                      1  /* GPN_OP_CFG */
#define ARIZONA_GPN_DB_MASK                      0x0100  /* GPN_DB */
#define ARIZONA_GPN_DB_SHIFT                          8  /* GPN_DB */
#define ARIZONA_GPN_DB_WIDTH                          1  /* GPN_DB */
#define ARIZONA_GPN_FN_MASK                      0x007F  /* GPN_FN - [6:0] */
#define ARIZONA_GPN_FN_SHIFT                          0  /* GPN_FN - [6:0] */
#define ARIZONA_GPN_FN_WIDTH                          7  /* GPN_FN - [6:0] */

#define ARIZONA_MAX_GPIO 5

M
Mark Brown 已提交
43
#define ARIZONA_MAX_INPUT 4
M
Mark Brown 已提交
44

45 46
#define ARIZONA_MAX_MICBIAS 3

M
Mark Brown 已提交
47
#define ARIZONA_MAX_OUTPUT 6
M
Mark Brown 已提交
48

49 50
#define ARIZONA_MAX_AIF 3

51 52 53
#define ARIZONA_HAP_ACT_ERM 0
#define ARIZONA_HAP_ACT_LRA 2

54
#define ARIZONA_MAX_PDM_SPK 2
M
Mark Brown 已提交
55 56 57

struct regulator_init_data;

58 59 60 61
struct arizona_micbias {
	int mV;                    /** Regulated voltage */
	unsigned int ext_cap:1;    /** External capacitor fitted */
	unsigned int discharge:1;  /** Actively discharge */
62
	unsigned int soft_start:1; /** Disable aggressive startup ramp rate */
63
	unsigned int bypass:1;     /** Use bypass mode */
64 65
};

M
Mark Brown 已提交
66 67 68 69 70 71
struct arizona_micd_config {
	unsigned int src;
	unsigned int bias;
	bool gpio;
};

72 73 74 75 76
struct arizona_micd_range {
	int max;  /** Ohms */
	int key;  /** Key to report to input layer */
};

M
Mark Brown 已提交
77 78 79 80 81 82 83 84 85 86 87 88 89
struct arizona_pdata {
	int reset;      /** GPIO controlling /RESET, if any */
	int ldoena;     /** GPIO controlling LODENA, if any */

	/** Regulator configuration for MICVDD */
	struct regulator_init_data *micvdd;

	/** Regulator configuration for LDO1 */
	struct regulator_init_data *ldo1;

	/** If a direct 32kHz clock is provided on an MCLK specify it here */
	int clk32k_src;

90 91
	/** Mode for primary IRQ (defaults to active low) */
	unsigned int irq_flags;
M
Mark Brown 已提交
92 93 94 95 96

	/* Base GPIO */
	int gpio_base;

	/** Pin state for GPIO pins */
97
	unsigned int gpio_defaults[ARIZONA_MAX_GPIO];
M
Mark Brown 已提交
98

99 100 101 102 103
	/**
	 * Maximum number of channels clocks will be generated for,
	 * useful for systems where and I2S bus with multiple data
	 * lines is mastered.
	 */
104
	unsigned int max_channels_clocked[ARIZONA_MAX_AIF];
105

106 107 108
	/** GPIO5 is used for jack detection */
	bool jd_gpio5;

109 110 111
	/** Internal pull on GPIO5 is disabled when used for jack detection */
	bool jd_gpio5_nopull;

112 113 114
	/** set to true if jackdet contact opens on insert */
	bool jd_invert;

115 116 117
	/** Use the headphone detect circuit to identify the accessory */
	bool hpdet_acc_id;

118 119 120
	/** Check for line output with HPDET method */
	bool hpdet_acc_id_line;

121 122 123
	/** GPIO used for mic isolation with HPDET */
	int hpdet_id_gpio;

124 125 126
	/** Channel to use for headphone detection */
	unsigned int hpdet_channel;

127
	/** Extra debounce timeout used during initial mic detection (ms) */
128
	unsigned int micd_detect_debounce;
129

M
Mark Brown 已提交
130 131 132
	/** GPIO for mic detection polarity */
	int micd_pol_gpio;

133
	/** Mic detect ramp rate */
134
	unsigned int micd_bias_start_time;
135

136
	/** Mic detect sample rate */
137
	unsigned int micd_rate;
138 139

	/** Mic detect debounce level */
140
	unsigned int micd_dbtime;
141

142
	/** Mic detect timeout (ms) */
143
	unsigned int micd_timeout;
144

145 146 147
	/** Force MICBIAS on for mic detect */
	bool micd_force_micbias;

148 149 150 151
	/** Mic detect level parameters */
	const struct arizona_micd_range *micd_ranges;
	int num_micd_ranges;

M
Mark Brown 已提交
152 153 154 155 156 157 158
	/** Headset polarity configurations */
	struct arizona_micd_config *micd_configs;
	int num_micd_configs;

	/** Reference voltage for DMIC inputs */
	int dmic_ref[ARIZONA_MAX_INPUT];

159 160 161
	/** MICBIAS configurations */
	struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS];

162 163 164 165
	/**
	 * Mode of input structures
	 * One of the ARIZONA_INMODE_xxx values
	 */
M
Mark Brown 已提交
166 167 168 169 170 171 172 173 174 175
	int inmode[ARIZONA_MAX_INPUT];

	/** Mode for outputs */
	bool out_mono[ARIZONA_MAX_OUTPUT];

	/** PDM speaker mute setting */
	unsigned int spk_mute[ARIZONA_MAX_PDM_SPK];

	/** PDM speaker format */
	unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK];
176 177 178

	/** Haptic actuator type */
	unsigned int hap_act;
179 180 181

	/** GPIO for primary IRQ (used for edge triggered emulation) */
	int irq_gpio;
M
Mark Brown 已提交
182 183 184
};

#endif