pdata.h 5.0 KB
Newer Older
M
Mark Brown 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/*
 * include/linux/mfd/wm8994/pdata.h -- Platform data for WM8994
 *
 * Copyright 2009 Wolfson Microelectronics PLC.
 *
 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
 *
 *  This program is free software; you can redistribute  it and/or modify it
 *  under  the terms of  the GNU General  Public License as published by the
 *  Free Software Foundation;  either version 2 of the  License, or (at your
 *  option) any later version.
 *
 */

#ifndef __MFD_WM8994_PDATA_H__
#define __MFD_WM8994_PDATA_H__

#define WM8994_NUM_LDO   2
#define WM8994_NUM_GPIO 11

struct wm8994_ldo_pdata {
	/** GPIOs to enable regulator, 0 or less if not available */
	int enable;

	const char *supply;
	struct regulator_init_data *init_data;
};

29
#define WM8994_CONFIGURE_GPIO 0x10000
M
Mark Brown 已提交
30 31

#define WM8994_DRC_REGS 5
32
#define WM8994_EQ_REGS  20
33 34
#define WM8958_MBC_CUTOFF_REGS 20
#define WM8958_MBC_COEFF_REGS  48
M
Mark Brown 已提交
35 36 37
#define WM8958_MBC_COMBINED_REGS 56
#define WM8958_VSS_HPF_REGS 2
#define WM8958_VSS_REGS 148
38
#define WM8958_ENH_EQ_REGS 32
M
Mark Brown 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

/**
 * DRC configurations are specified with a label and a set of register
 * values to write (the enable bits will be ignored).  At runtime an
 * enumerated control will be presented for each DRC block allowing
 * the user to choose the configration to use.
 *
 * Configurations may be generated by hand or by using the DRC control
 * panel provided by the WISCE - see  http://www.wolfsonmicro.com/wisce/
 * for details.
 */
struct wm8994_drc_cfg {
        const char *name;
        u16 regs[WM8994_DRC_REGS];
};

/**
 * ReTune Mobile configurations are specified with a label, sample
 * rate and set of values to write (the enable bits will be ignored).
 *
 * Configurations are expected to be generated using the ReTune Mobile
 * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
 */
struct wm8994_retune_mobile_cfg {
        const char *name;
        unsigned int rate;
        u16 regs[WM8994_EQ_REGS];
};

68 69 70 71 72 73 74 75 76 77
/**
 * Multiband compressor configurations are specified with a label and
 * two sets of values to write.  Configurations are expected to be
 * generated using the multiband compressor configuration panel in
 * WISCE - see http://www.wolfsonmicro.com/wisce/
 */
struct wm8958_mbc_cfg {
	const char *name;
	u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS];
	u16 coeff_regs[WM8958_MBC_COEFF_REGS];
M
Mark Brown 已提交
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102

	/* Coefficient layout when using MBC+VSS firmware */
	u16 combined_regs[WM8958_MBC_COMBINED_REGS];
};

/**
 * VSS HPF configurations are specified with a label and two values to
 * write.  Configurations are expected to be generated using the
 * multiband compressor configuration panel in WISCE - see
 * http://www.wolfsonmicro.com/wisce/
 */
struct wm8958_vss_hpf_cfg {
	const char *name;
	u16 regs[WM8958_VSS_HPF_REGS];
};

/**
 * VSS configurations are specified with a label and array of values
 * to write.  Configurations are expected to be generated using the
 * multiband compressor configuration panel in WISCE - see
 * http://www.wolfsonmicro.com/wisce/
 */
struct wm8958_vss_cfg {
	const char *name;
	u16 regs[WM8958_VSS_REGS];
103 104
};

105 106 107 108 109 110 111 112 113 114 115
/**
 * Enhanced EQ configurations are specified with a label and array of
 * values to write.  Configurations are expected to be generated using
 * the multiband compressor configuration panel in WISCE - see
 * http://www.wolfsonmicro.com/wisce/
 */
struct wm8958_enh_eq_cfg {
	const char *name;
	u16 regs[WM8958_ENH_EQ_REGS];
};

M
Mark Brown 已提交
116 117 118 119 120 121 122 123 124 125 126
struct wm8994_pdata {
	int gpio_base;

	/**
	 * Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO
	 * can be used for all zero values.
	 */
	int gpio_defaults[WM8994_NUM_GPIO];

	struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];

127
	int irq_base;  /** Base IRQ number for WM8994, required for IRQs */
M
Mark Brown 已提交
128 129 130 131 132 133 134

        int num_drc_cfgs;
        struct wm8994_drc_cfg *drc_cfgs;

        int num_retune_mobile_cfgs;
        struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;

135 136 137
	int num_mbc_cfgs;
	struct wm8958_mbc_cfg *mbc_cfgs;

M
Mark Brown 已提交
138 139 140 141 142 143
	int num_vss_cfgs;
	struct wm8958_vss_cfg *vss_cfgs;

	int num_vss_hpf_cfgs;
	struct wm8958_vss_hpf_cfg *vss_hpf_cfgs;

144 145 146
	int num_enh_eq_cfgs;
	struct wm8958_enh_eq_cfg *enh_eq_cfgs;

M
Mark Brown 已提交
147 148 149 150 151 152 153 154
        /* LINEOUT can be differential or single ended */
        unsigned int lineout1_diff:1;
        unsigned int lineout2_diff:1;

        /* Common mode feedback */
        unsigned int lineout1fb:1;
        unsigned int lineout2fb:1;

155 156 157 158 159
	/* IRQ for microphone detection if brought out directly as a
	 * signal.
	 */
	int micdet_irq;

160
        /* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
M
Mark Brown 已提交
161 162 163
        unsigned int micbias1_lvl:1;
        unsigned int micbias2_lvl:1;

164
        /* WM8994 jack detect threashold levels, see datasheet for values */
M
Mark Brown 已提交
165 166
        unsigned int jd_scthr:2;
        unsigned int jd_thr:2;
167 168 169

	/* WM8958 microphone bias configuration */
	int micbias[2];
170 171 172 173 174 175 176

	/* Disable the internal pull downs on the LDOs if they are
	 * always driven (eg, connected to an always on supply or
	 * GPIO that always drives an output.  If they float power
	 * consumption will rise.
	 */
	bool ldo_ena_always_driven;
M
Mark Brown 已提交
177 178 179 180 181 182

	/*
	 * SPKMODE must be pulled internally by the device on this
	 * system.
	 */
	bool spkmode_pu;
M
Mark Brown 已提交
183 184 185
};

#endif