2012-06-19 23:31:53 +08:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2015-02-25 23:37:13 +08:00
|
|
|
#include <dt-bindings/mfd/arizona.h>
|
2017-04-18 18:43:52 +08:00
|
|
|
#include <linux/regulator/arizona-ldo1.h>
|
2017-04-18 18:43:49 +08:00
|
|
|
#include <linux/regulator/arizona-micsupp.h>
|
2015-02-25 23:37:13 +08:00
|
|
|
|
2012-06-19 23:31:53 +08:00
|
|
|
#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
|
|
|
|
|
2012-07-10 19:37:58 +08:00
|
|
|
#define ARIZONA_MAX_INPUT 4
|
2012-06-19 23:31:53 +08:00
|
|
|
|
2013-01-29 00:47:37 +08:00
|
|
|
#define ARIZONA_MAX_MICBIAS 3
|
|
|
|
|
2012-07-10 19:37:58 +08:00
|
|
|
#define ARIZONA_MAX_OUTPUT 6
|
2012-06-19 23:31:53 +08:00
|
|
|
|
2013-01-17 15:35:14 +08:00
|
|
|
#define ARIZONA_MAX_AIF 3
|
|
|
|
|
2012-11-27 05:17:21 +08:00
|
|
|
#define ARIZONA_HAP_ACT_ERM 0
|
|
|
|
#define ARIZONA_HAP_ACT_LRA 2
|
|
|
|
|
2012-07-10 02:33:14 +08:00
|
|
|
#define ARIZONA_MAX_PDM_SPK 2
|
2012-06-19 23:31:53 +08:00
|
|
|
|
|
|
|
struct regulator_init_data;
|
|
|
|
|
2013-01-29 00:47:37 +08:00
|
|
|
struct arizona_micbias {
|
|
|
|
int mV; /** Regulated voltage */
|
|
|
|
unsigned int ext_cap:1; /** External capacitor fitted */
|
|
|
|
unsigned int discharge:1; /** Actively discharge */
|
2013-05-21 21:56:58 +08:00
|
|
|
unsigned int soft_start:1; /** Disable aggressive startup ramp rate */
|
2013-01-29 18:44:41 +08:00
|
|
|
unsigned int bypass:1; /** Use bypass mode */
|
2013-01-29 00:47:37 +08:00
|
|
|
};
|
|
|
|
|
2012-06-19 23:31:53 +08:00
|
|
|
struct arizona_micd_config {
|
|
|
|
unsigned int src;
|
|
|
|
unsigned int bias;
|
|
|
|
bool gpio;
|
|
|
|
};
|
|
|
|
|
2013-04-02 05:03:06 +08:00
|
|
|
struct arizona_micd_range {
|
|
|
|
int max; /** Ohms */
|
|
|
|
int key; /** Key to report to input layer */
|
|
|
|
};
|
|
|
|
|
2012-06-19 23:31:53 +08:00
|
|
|
struct arizona_pdata {
|
|
|
|
int reset; /** GPIO controlling /RESET, if any */
|
|
|
|
|
|
|
|
/** Regulator configuration for MICVDD */
|
2017-04-18 18:43:49 +08:00
|
|
|
struct arizona_micsupp_pdata micvdd;
|
2012-06-19 23:31:53 +08:00
|
|
|
|
|
|
|
/** Regulator configuration for LDO1 */
|
2017-04-18 18:43:52 +08:00
|
|
|
struct arizona_ldo1_pdata ldo1;
|
2012-06-19 23:31:53 +08:00
|
|
|
|
|
|
|
/** If a direct 32kHz clock is provided on an MCLK specify it here */
|
|
|
|
int clk32k_src;
|
|
|
|
|
2013-03-22 19:59:33 +08:00
|
|
|
/** Mode for primary IRQ (defaults to active low) */
|
|
|
|
unsigned int irq_flags;
|
2012-06-19 23:31:53 +08:00
|
|
|
|
|
|
|
/* Base GPIO */
|
|
|
|
int gpio_base;
|
|
|
|
|
|
|
|
/** Pin state for GPIO pins */
|
2015-03-29 19:45:42 +08:00
|
|
|
unsigned int gpio_defaults[ARIZONA_MAX_GPIO];
|
2012-06-19 23:31:53 +08:00
|
|
|
|
2013-01-17 15:35:14 +08:00
|
|
|
/**
|
|
|
|
* Maximum number of channels clocks will be generated for,
|
|
|
|
* useful for systems where and I2S bus with multiple data
|
|
|
|
* lines is mastered.
|
|
|
|
*/
|
2015-06-19 18:24:27 +08:00
|
|
|
unsigned int max_channels_clocked[ARIZONA_MAX_AIF];
|
2013-01-17 15:35:14 +08:00
|
|
|
|
2013-01-11 07:55:39 +08:00
|
|
|
/** GPIO5 is used for jack detection */
|
|
|
|
bool jd_gpio5;
|
|
|
|
|
2013-04-02 02:03:52 +08:00
|
|
|
/** Internal pull on GPIO5 is disabled when used for jack detection */
|
|
|
|
bool jd_gpio5_nopull;
|
|
|
|
|
2014-05-23 19:54:57 +08:00
|
|
|
/** set to true if jackdet contact opens on insert */
|
|
|
|
bool jd_invert;
|
|
|
|
|
2013-01-11 07:55:51 +08:00
|
|
|
/** Use the headphone detect circuit to identify the accessory */
|
|
|
|
bool hpdet_acc_id;
|
|
|
|
|
2013-02-26 07:42:31 +08:00
|
|
|
/** Check for line output with HPDET method */
|
|
|
|
bool hpdet_acc_id_line;
|
|
|
|
|
2013-01-11 07:55:54 +08:00
|
|
|
/** GPIO used for mic isolation with HPDET */
|
|
|
|
int hpdet_id_gpio;
|
|
|
|
|
2015-05-04 12:42:13 +08:00
|
|
|
/** Channel to use for headphone detection */
|
|
|
|
unsigned int hpdet_channel;
|
|
|
|
|
2015-09-16 17:42:13 +08:00
|
|
|
/** Use software comparison to determine mic presence */
|
|
|
|
bool micd_software_compare;
|
|
|
|
|
2013-04-02 02:21:48 +08:00
|
|
|
/** Extra debounce timeout used during initial mic detection (ms) */
|
2015-06-19 18:24:27 +08:00
|
|
|
unsigned int micd_detect_debounce;
|
2013-04-02 02:21:48 +08:00
|
|
|
|
2012-06-19 23:31:53 +08:00
|
|
|
/** GPIO for mic detection polarity */
|
|
|
|
int micd_pol_gpio;
|
|
|
|
|
2013-01-11 07:55:24 +08:00
|
|
|
/** Mic detect ramp rate */
|
2015-06-19 18:24:27 +08:00
|
|
|
unsigned int micd_bias_start_time;
|
2013-01-11 07:55:24 +08:00
|
|
|
|
2013-01-21 16:36:33 +08:00
|
|
|
/** Mic detect sample rate */
|
2015-06-19 18:24:27 +08:00
|
|
|
unsigned int micd_rate;
|
2013-01-21 16:36:33 +08:00
|
|
|
|
|
|
|
/** Mic detect debounce level */
|
2015-06-19 18:24:27 +08:00
|
|
|
unsigned int micd_dbtime;
|
2013-01-21 16:36:33 +08:00
|
|
|
|
2013-04-02 02:25:55 +08:00
|
|
|
/** Mic detect timeout (ms) */
|
2015-06-19 18:24:27 +08:00
|
|
|
unsigned int micd_timeout;
|
2013-04-02 02:25:55 +08:00
|
|
|
|
2013-01-11 03:38:43 +08:00
|
|
|
/** Force MICBIAS on for mic detect */
|
|
|
|
bool micd_force_micbias;
|
|
|
|
|
2013-04-02 05:03:06 +08:00
|
|
|
/** Mic detect level parameters */
|
|
|
|
const struct arizona_micd_range *micd_ranges;
|
|
|
|
int num_micd_ranges;
|
|
|
|
|
2012-06-19 23:31:53 +08:00
|
|
|
/** Headset polarity configurations */
|
|
|
|
struct arizona_micd_config *micd_configs;
|
|
|
|
int num_micd_configs;
|
|
|
|
|
|
|
|
/** Reference voltage for DMIC inputs */
|
|
|
|
int dmic_ref[ARIZONA_MAX_INPUT];
|
|
|
|
|
2013-01-29 00:47:37 +08:00
|
|
|
/** MICBIAS configurations */
|
|
|
|
struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS];
|
|
|
|
|
2015-05-01 23:15:12 +08:00
|
|
|
/**
|
|
|
|
* Mode of input structures
|
|
|
|
* One of the ARIZONA_INMODE_xxx values
|
2015-07-03 23:16:35 +08:00
|
|
|
* wm5102/wm5110/wm8280/wm8997: [0]=IN1 [1]=IN2 [2]=IN3 [3]=IN4
|
|
|
|
* wm8998: [0]=IN1A [1]=IN2A [2]=IN1B [3]=IN2B
|
2015-05-01 23:15:12 +08:00
|
|
|
*/
|
2012-06-19 23:31:53 +08:00
|
|
|
int inmode[ARIZONA_MAX_INPUT];
|
|
|
|
|
|
|
|
/** Mode for outputs */
|
2015-12-14 18:19:11 +08:00
|
|
|
int out_mono[ARIZONA_MAX_OUTPUT];
|
2012-06-19 23:31:53 +08:00
|
|
|
|
2017-09-04 23:41:53 +08:00
|
|
|
/** Limit output volumes */
|
|
|
|
unsigned int out_vol_limit[2 * ARIZONA_MAX_OUTPUT];
|
|
|
|
|
2012-06-19 23:31:53 +08:00
|
|
|
/** PDM speaker mute setting */
|
|
|
|
unsigned int spk_mute[ARIZONA_MAX_PDM_SPK];
|
|
|
|
|
|
|
|
/** PDM speaker format */
|
|
|
|
unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK];
|
2012-11-27 05:17:21 +08:00
|
|
|
|
|
|
|
/** Haptic actuator type */
|
|
|
|
unsigned int hap_act;
|
2013-03-25 07:05:58 +08:00
|
|
|
|
|
|
|
/** GPIO for primary IRQ (used for edge triggered emulation) */
|
|
|
|
int irq_gpio;
|
2015-09-16 17:42:14 +08:00
|
|
|
|
|
|
|
/** General purpose switch control */
|
|
|
|
unsigned int gpsw;
|
2012-06-19 23:31:53 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|