mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 04:42:12 +00:00
ASoC: codecs: Add da7219 codec driver
This adds support for the DA7219 audio codec with built-in advanced accessory detect features. Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
c25c79b468
commit
6d817c0e9f
99
include/sound/da7219-aad.h
Normal file
99
include/sound/da7219-aad.h
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* da7219-aad.h - DA7322 ASoC Codec AAD Driver Platform Data
|
||||
*
|
||||
* Copyright (c) 2015 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.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 __DA7219_AAD_PDATA_H
|
||||
#define __DA7219_AAD_PDATA_H
|
||||
|
||||
enum da7219_aad_micbias_pulse_lvl {
|
||||
DA7219_AAD_MICBIAS_PULSE_LVL_OFF = 0,
|
||||
DA7219_AAD_MICBIAS_PULSE_LVL_2_8V = 6,
|
||||
DA7219_AAD_MICBIAS_PULSE_LVL_2_9V,
|
||||
};
|
||||
|
||||
enum da7219_aad_btn_cfg {
|
||||
DA7219_AAD_BTN_CFG_2MS = 1,
|
||||
DA7219_AAD_BTN_CFG_5MS,
|
||||
DA7219_AAD_BTN_CFG_10MS,
|
||||
DA7219_AAD_BTN_CFG_50MS,
|
||||
DA7219_AAD_BTN_CFG_100MS,
|
||||
DA7219_AAD_BTN_CFG_200MS,
|
||||
DA7219_AAD_BTN_CFG_500MS,
|
||||
};
|
||||
|
||||
enum da7219_aad_mic_det_thr {
|
||||
DA7219_AAD_MIC_DET_THR_200_OHMS = 0,
|
||||
DA7219_AAD_MIC_DET_THR_500_OHMS,
|
||||
DA7219_AAD_MIC_DET_THR_750_OHMS,
|
||||
DA7219_AAD_MIC_DET_THR_1000_OHMS,
|
||||
};
|
||||
|
||||
enum da7219_aad_jack_ins_deb {
|
||||
DA7219_AAD_JACK_INS_DEB_5MS = 0,
|
||||
DA7219_AAD_JACK_INS_DEB_10MS,
|
||||
DA7219_AAD_JACK_INS_DEB_20MS,
|
||||
DA7219_AAD_JACK_INS_DEB_50MS,
|
||||
DA7219_AAD_JACK_INS_DEB_100MS,
|
||||
DA7219_AAD_JACK_INS_DEB_200MS,
|
||||
DA7219_AAD_JACK_INS_DEB_500MS,
|
||||
DA7219_AAD_JACK_INS_DEB_1S,
|
||||
};
|
||||
|
||||
enum da7219_aad_jack_det_rate {
|
||||
DA7219_AAD_JACK_DET_RATE_32_64MS = 0,
|
||||
DA7219_AAD_JACK_DET_RATE_64_128MS,
|
||||
DA7219_AAD_JACK_DET_RATE_128_256MS,
|
||||
DA7219_AAD_JACK_DET_RATE_256_512MS,
|
||||
};
|
||||
|
||||
enum da7219_aad_jack_rem_deb {
|
||||
DA7219_AAD_JACK_REM_DEB_1MS = 0,
|
||||
DA7219_AAD_JACK_REM_DEB_5MS,
|
||||
DA7219_AAD_JACK_REM_DEB_10MS,
|
||||
DA7219_AAD_JACK_REM_DEB_20MS,
|
||||
};
|
||||
|
||||
enum da7219_aad_btn_avg {
|
||||
DA7219_AAD_BTN_AVG_1 = 0,
|
||||
DA7219_AAD_BTN_AVG_2,
|
||||
DA7219_AAD_BTN_AVG_4,
|
||||
DA7219_AAD_BTN_AVG_8,
|
||||
};
|
||||
|
||||
enum da7219_aad_adc_1bit_rpt {
|
||||
DA7219_AAD_ADC_1BIT_RPT_1 = 0,
|
||||
DA7219_AAD_ADC_1BIT_RPT_2,
|
||||
DA7219_AAD_ADC_1BIT_RPT_4,
|
||||
DA7219_AAD_ADC_1BIT_RPT_8,
|
||||
};
|
||||
|
||||
struct da7219_aad_pdata {
|
||||
int irq;
|
||||
|
||||
enum da7219_aad_micbias_pulse_lvl micbias_pulse_lvl;
|
||||
u32 micbias_pulse_time;
|
||||
enum da7219_aad_btn_cfg btn_cfg;
|
||||
enum da7219_aad_mic_det_thr mic_det_thr;
|
||||
enum da7219_aad_jack_ins_deb jack_ins_deb;
|
||||
enum da7219_aad_jack_det_rate jack_det_rate;
|
||||
enum da7219_aad_jack_rem_deb jack_rem_deb;
|
||||
|
||||
u8 a_d_btn_thr;
|
||||
u8 d_b_btn_thr;
|
||||
u8 b_c_btn_thr;
|
||||
u8 c_mic_btn_thr;
|
||||
|
||||
enum da7219_aad_btn_avg btn_avg;
|
||||
enum da7219_aad_adc_1bit_rpt adc_1bit_rpt;
|
||||
};
|
||||
|
||||
#endif /* __DA7219_AAD_PDATA_H */
|
55
include/sound/da7219.h
Normal file
55
include/sound/da7219.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* da7219.h - DA7219 ASoC Codec Driver Platform Data
|
||||
*
|
||||
* Copyright (c) 2015 Dialog Semiconductor
|
||||
*
|
||||
* Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.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 __DA7219_PDATA_H
|
||||
#define __DA7219_PDATA_H
|
||||
|
||||
/* LDO */
|
||||
enum da7219_ldo_lvl_sel {
|
||||
DA7219_LDO_LVL_SEL_1_05V = 0,
|
||||
DA7219_LDO_LVL_SEL_1_10V,
|
||||
DA7219_LDO_LVL_SEL_1_20V,
|
||||
DA7219_LDO_LVL_SEL_1_40V,
|
||||
};
|
||||
|
||||
/* Mic Bias */
|
||||
enum da7219_micbias_voltage {
|
||||
DA7219_MICBIAS_1_8V = 1,
|
||||
DA7219_MICBIAS_2_0V,
|
||||
DA7219_MICBIAS_2_2V,
|
||||
DA7219_MICBIAS_2_4V,
|
||||
DA7219_MICBIAS_2_6V,
|
||||
};
|
||||
|
||||
/* Mic input type */
|
||||
enum da7219_mic_amp_in_sel {
|
||||
DA7219_MIC_AMP_IN_SEL_DIFF = 0,
|
||||
DA7219_MIC_AMP_IN_SEL_SE_P,
|
||||
DA7219_MIC_AMP_IN_SEL_SE_N,
|
||||
};
|
||||
|
||||
struct da7219_aad_pdata;
|
||||
|
||||
struct da7219_pdata {
|
||||
/* Internal LDO */
|
||||
enum da7219_ldo_lvl_sel ldo_lvl_sel;
|
||||
|
||||
/* Mic */
|
||||
enum da7219_micbias_voltage micbias_lvl;
|
||||
enum da7219_mic_amp_in_sel mic_amp_in_sel;
|
||||
|
||||
/* AAD */
|
||||
struct da7219_aad_pdata *aad_pdata;
|
||||
};
|
||||
|
||||
#endif /* __DA7219_PDATA_H */
|
@ -57,6 +57,7 @@ config SND_SOC_ALL_CODECS
|
||||
select SND_SOC_CX20442 if TTY
|
||||
select SND_SOC_DA7210 if SND_SOC_I2C_AND_SPI
|
||||
select SND_SOC_DA7213 if I2C
|
||||
select SND_SOC_DA7219 if I2C
|
||||
select SND_SOC_DA732X if I2C
|
||||
select SND_SOC_DA9055 if I2C
|
||||
select SND_SOC_DMIC
|
||||
@ -430,6 +431,9 @@ config SND_SOC_DA7210
|
||||
config SND_SOC_DA7213
|
||||
tristate
|
||||
|
||||
config SND_SOC_DA7219
|
||||
tristate
|
||||
|
||||
config SND_SOC_DA732X
|
||||
tristate
|
||||
|
||||
|
@ -49,6 +49,7 @@ snd-soc-cs4349-objs := cs4349.o
|
||||
snd-soc-cx20442-objs := cx20442.o
|
||||
snd-soc-da7210-objs := da7210.o
|
||||
snd-soc-da7213-objs := da7213.o
|
||||
snd-soc-da7219-objs := da7219.o da7219-aad.o
|
||||
snd-soc-da732x-objs := da732x.o
|
||||
snd-soc-da9055-objs := da9055.o
|
||||
snd-soc-bt-sco-objs := bt-sco.o
|
||||
@ -241,6 +242,7 @@ obj-$(CONFIG_SND_SOC_CS4349) += snd-soc-cs4349.o
|
||||
obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o
|
||||
obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o
|
||||
obj-$(CONFIG_SND_SOC_DA7213) += snd-soc-da7213.o
|
||||
obj-$(CONFIG_SND_SOC_DA7219) += snd-soc-da7219.o
|
||||
obj-$(CONFIG_SND_SOC_DA732X) += snd-soc-da732x.o
|
||||
obj-$(CONFIG_SND_SOC_DA9055) += snd-soc-da9055.o
|
||||
obj-$(CONFIG_SND_SOC_BT_SCO) += snd-soc-bt-sco.o
|
||||
|
823
sound/soc/codecs/da7219-aad.c
Normal file
823
sound/soc/codecs/da7219-aad.c
Normal file
@ -0,0 +1,823 @@
|
||||
/*
|
||||
* da7219-aad.c - Dialog DA7219 ALSA SoC AAD Driver
|
||||
*
|
||||
* Copyright (c) 2015 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.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.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/pm_wakeirq.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <sound/soc.h>
|
||||
#include <sound/jack.h>
|
||||
#include <sound/da7219.h>
|
||||
|
||||
#include "da7219.h"
|
||||
#include "da7219-aad.h"
|
||||
|
||||
|
||||
/*
|
||||
* Detection control
|
||||
*/
|
||||
|
||||
void da7219_aad_jack_det(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
|
||||
{
|
||||
struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
da7219->aad->jack = jack;
|
||||
da7219->aad->jack_inserted = false;
|
||||
|
||||
/* Send an initial empty report */
|
||||
snd_soc_jack_report(jack, 0, DA7219_AAD_REPORT_ALL_MASK);
|
||||
|
||||
/* Enable/Disable jack detection */
|
||||
snd_soc_update_bits(codec, DA7219_ACCDET_CONFIG_1,
|
||||
DA7219_ACCDET_EN_MASK,
|
||||
(jack ? DA7219_ACCDET_EN_MASK : 0));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(da7219_aad_jack_det);
|
||||
|
||||
/*
|
||||
* Button/HPTest work
|
||||
*/
|
||||
|
||||
static void da7219_aad_btn_det_work(struct work_struct *work)
|
||||
{
|
||||
struct da7219_aad_priv *da7219_aad =
|
||||
container_of(work, struct da7219_aad_priv, btn_det_work);
|
||||
struct snd_soc_codec *codec = da7219_aad->codec;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
u8 statusa, micbias_ctrl;
|
||||
bool micbias_up = false;
|
||||
int retries = 0;
|
||||
|
||||
/* Drive headphones/lineout */
|
||||
snd_soc_update_bits(codec, DA7219_HP_L_CTRL,
|
||||
DA7219_HP_L_AMP_OE_MASK,
|
||||
DA7219_HP_L_AMP_OE_MASK);
|
||||
snd_soc_update_bits(codec, DA7219_HP_R_CTRL,
|
||||
DA7219_HP_R_AMP_OE_MASK,
|
||||
DA7219_HP_R_AMP_OE_MASK);
|
||||
|
||||
/* Make sure mic bias is up */
|
||||
snd_soc_dapm_force_enable_pin(dapm, "Mic Bias");
|
||||
snd_soc_dapm_sync(dapm);
|
||||
|
||||
do {
|
||||
statusa = snd_soc_read(codec, DA7219_ACCDET_STATUS_A);
|
||||
if (statusa & DA7219_MICBIAS_UP_STS_MASK)
|
||||
micbias_up = true;
|
||||
else if (retries++ < DA7219_AAD_MICBIAS_CHK_RETRIES)
|
||||
msleep(DA7219_AAD_MICBIAS_CHK_DELAY);
|
||||
} while ((!micbias_up) && (retries < DA7219_AAD_MICBIAS_CHK_RETRIES));
|
||||
|
||||
if (retries >= DA7219_AAD_MICBIAS_CHK_RETRIES)
|
||||
dev_warn(codec->dev, "Mic bias status check timed out");
|
||||
|
||||
/*
|
||||
* Mic bias pulse required to enable mic, must be done before enabling
|
||||
* button detection to prevent erroneous button readings.
|
||||
*/
|
||||
if (da7219_aad->micbias_pulse_lvl && da7219_aad->micbias_pulse_time) {
|
||||
/* Pulse higher level voltage */
|
||||
micbias_ctrl = snd_soc_read(codec, DA7219_MICBIAS_CTRL);
|
||||
snd_soc_update_bits(codec, DA7219_MICBIAS_CTRL,
|
||||
DA7219_MICBIAS1_LEVEL_MASK,
|
||||
da7219_aad->micbias_pulse_lvl);
|
||||
msleep(da7219_aad->micbias_pulse_time);
|
||||
snd_soc_write(codec, DA7219_MICBIAS_CTRL, micbias_ctrl);
|
||||
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, DA7219_ACCDET_CONFIG_1,
|
||||
DA7219_BUTTON_CONFIG_MASK,
|
||||
da7219_aad->btn_cfg);
|
||||
}
|
||||
|
||||
static void da7219_aad_hptest_work(struct work_struct *work)
|
||||
{
|
||||
struct da7219_aad_priv *da7219_aad =
|
||||
container_of(work, struct da7219_aad_priv, hptest_work);
|
||||
struct snd_soc_codec *codec = da7219_aad->codec;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
u16 tonegen_freq_hptest;
|
||||
u8 accdet_cfg8;
|
||||
int report = 0;
|
||||
|
||||
/* Lock DAPM and any Kcontrols that are affected by this test */
|
||||
snd_soc_dapm_mutex_lock(dapm);
|
||||
mutex_lock(&da7219->lock);
|
||||
|
||||
/* Bypass cache so it saves current settings */
|
||||
regcache_cache_bypass(da7219->regmap, true);
|
||||
|
||||
/* Make sure Tone Generator is disabled */
|
||||
snd_soc_write(codec, DA7219_TONE_GEN_CFG1, 0);
|
||||
|
||||
/* Enable HPTest block, 1KOhms check */
|
||||
snd_soc_update_bits(codec, DA7219_ACCDET_CONFIG_8,
|
||||
DA7219_HPTEST_EN_MASK | DA7219_HPTEST_RES_SEL_MASK,
|
||||
DA7219_HPTEST_EN_MASK |
|
||||
DA7219_HPTEST_RES_SEL_1KOHMS);
|
||||
|
||||
/* Set gains to 0db */
|
||||
snd_soc_write(codec, DA7219_DAC_L_GAIN, DA7219_DAC_DIGITAL_GAIN_0DB);
|
||||
snd_soc_write(codec, DA7219_DAC_R_GAIN, DA7219_DAC_DIGITAL_GAIN_0DB);
|
||||
snd_soc_write(codec, DA7219_HP_L_GAIN, DA7219_HP_AMP_GAIN_0DB);
|
||||
snd_soc_write(codec, DA7219_HP_R_GAIN, DA7219_HP_AMP_GAIN_0DB);
|
||||
|
||||
/* Disable DAC filters, EQs and soft mute */
|
||||
snd_soc_update_bits(codec, DA7219_DAC_FILTERS1, DA7219_HPF_MODE_MASK,
|
||||
0);
|
||||
snd_soc_update_bits(codec, DA7219_DAC_FILTERS4, DA7219_DAC_EQ_EN_MASK,
|
||||
0);
|
||||
snd_soc_update_bits(codec, DA7219_DAC_FILTERS5,
|
||||
DA7219_DAC_SOFTMUTE_EN_MASK, 0);
|
||||
|
||||
/* Enable HP left & right paths */
|
||||
snd_soc_update_bits(codec, DA7219_CP_CTRL, DA7219_CP_EN_MASK,
|
||||
DA7219_CP_EN_MASK);
|
||||
snd_soc_update_bits(codec, DA7219_DIG_ROUTING_DAC,
|
||||
DA7219_DAC_L_SRC_MASK | DA7219_DAC_R_SRC_MASK,
|
||||
DA7219_DAC_L_SRC_TONEGEN |
|
||||
DA7219_DAC_R_SRC_TONEGEN);
|
||||
snd_soc_update_bits(codec, DA7219_DAC_L_CTRL,
|
||||
DA7219_DAC_L_EN_MASK | DA7219_DAC_L_MUTE_EN_MASK,
|
||||
DA7219_DAC_L_EN_MASK);
|
||||
snd_soc_update_bits(codec, DA7219_DAC_R_CTRL,
|
||||
DA7219_DAC_R_EN_MASK | DA7219_DAC_R_MUTE_EN_MASK,
|
||||
DA7219_DAC_R_EN_MASK);
|
||||
snd_soc_update_bits(codec, DA7219_MIXOUT_L_SELECT,
|
||||
DA7219_MIXOUT_L_MIX_SELECT_MASK,
|
||||
DA7219_MIXOUT_L_MIX_SELECT_MASK);
|
||||
snd_soc_update_bits(codec, DA7219_MIXOUT_R_SELECT,
|
||||
DA7219_MIXOUT_R_MIX_SELECT_MASK,
|
||||
DA7219_MIXOUT_R_MIX_SELECT_MASK);
|
||||
snd_soc_update_bits(codec, DA7219_DROUTING_ST_OUTFILT_1L,
|
||||
DA7219_OUTFILT_ST_1L_SRC_MASK,
|
||||
DA7219_DMIX_ST_SRC_OUTFILT1L);
|
||||
snd_soc_update_bits(codec, DA7219_DROUTING_ST_OUTFILT_1R,
|
||||
DA7219_OUTFILT_ST_1R_SRC_MASK,
|
||||
DA7219_DMIX_ST_SRC_OUTFILT1R);
|
||||
snd_soc_update_bits(codec, DA7219_MIXOUT_L_CTRL,
|
||||
DA7219_MIXOUT_L_AMP_EN_MASK,
|
||||
DA7219_MIXOUT_L_AMP_EN_MASK);
|
||||
snd_soc_update_bits(codec, DA7219_MIXOUT_R_CTRL,
|
||||
DA7219_MIXOUT_R_AMP_EN_MASK,
|
||||
DA7219_MIXOUT_R_AMP_EN_MASK);
|
||||
snd_soc_write(codec, DA7219_HP_L_CTRL,
|
||||
DA7219_HP_L_AMP_OE_MASK | DA7219_HP_L_AMP_EN_MASK);
|
||||
snd_soc_write(codec, DA7219_HP_R_CTRL,
|
||||
DA7219_HP_R_AMP_OE_MASK | DA7219_HP_R_AMP_EN_MASK);
|
||||
|
||||
/* Configure & start Tone Generator */
|
||||
snd_soc_write(codec, DA7219_TONE_GEN_ON_PER, DA7219_BEEP_ON_PER_MASK);
|
||||
tonegen_freq_hptest = cpu_to_le16(DA7219_AAD_HPTEST_RAMP_FREQ);
|
||||
regmap_raw_write(da7219->regmap, DA7219_TONE_GEN_FREQ1_L,
|
||||
&tonegen_freq_hptest, sizeof(tonegen_freq_hptest));
|
||||
snd_soc_update_bits(codec, DA7219_TONE_GEN_CFG2,
|
||||
DA7219_SWG_SEL_MASK | DA7219_TONE_GEN_GAIN_MASK,
|
||||
DA7219_SWG_SEL_SRAMP |
|
||||
DA7219_TONE_GEN_GAIN_MINUS_15DB);
|
||||
snd_soc_write(codec, DA7219_TONE_GEN_CFG1, DA7219_START_STOPN_MASK);
|
||||
|
||||
msleep(DA7219_AAD_HPTEST_PERIOD);
|
||||
|
||||
/* Grab comparator reading */
|
||||
accdet_cfg8 = snd_soc_read(codec, DA7219_ACCDET_CONFIG_8);
|
||||
if (accdet_cfg8 & DA7219_HPTEST_COMP_MASK)
|
||||
report |= SND_JACK_HEADPHONE;
|
||||
else
|
||||
report |= SND_JACK_LINEOUT;
|
||||
|
||||
/* Stop tone generator */
|
||||
snd_soc_write(codec, DA7219_TONE_GEN_CFG1, 0);
|
||||
|
||||
msleep(DA7219_AAD_HPTEST_PERIOD);
|
||||
|
||||
/* Restore original settings from cache */
|
||||
regcache_mark_dirty(da7219->regmap);
|
||||
regcache_sync_region(da7219->regmap, DA7219_HP_L_CTRL,
|
||||
DA7219_HP_R_CTRL);
|
||||
regcache_sync_region(da7219->regmap, DA7219_MIXOUT_L_CTRL,
|
||||
DA7219_MIXOUT_R_CTRL);
|
||||
regcache_sync_region(da7219->regmap, DA7219_DROUTING_ST_OUTFILT_1L,
|
||||
DA7219_DROUTING_ST_OUTFILT_1R);
|
||||
regcache_sync_region(da7219->regmap, DA7219_MIXOUT_L_SELECT,
|
||||
DA7219_MIXOUT_R_SELECT);
|
||||
regcache_sync_region(da7219->regmap, DA7219_DAC_L_CTRL,
|
||||
DA7219_DAC_R_CTRL);
|
||||
regcache_sync_region(da7219->regmap, DA7219_DIG_ROUTING_DAC,
|
||||
DA7219_DIG_ROUTING_DAC);
|
||||
regcache_sync_region(da7219->regmap, DA7219_CP_CTRL, DA7219_CP_CTRL);
|
||||
regcache_sync_region(da7219->regmap, DA7219_DAC_FILTERS5,
|
||||
DA7219_DAC_FILTERS5);
|
||||
regcache_sync_region(da7219->regmap, DA7219_DAC_FILTERS4,
|
||||
DA7219_DAC_FILTERS1);
|
||||
regcache_sync_region(da7219->regmap, DA7219_HP_L_GAIN,
|
||||
DA7219_HP_R_GAIN);
|
||||
regcache_sync_region(da7219->regmap, DA7219_DAC_L_GAIN,
|
||||
DA7219_DAC_R_GAIN);
|
||||
regcache_sync_region(da7219->regmap, DA7219_TONE_GEN_ON_PER,
|
||||
DA7219_TONE_GEN_ON_PER);
|
||||
regcache_sync_region(da7219->regmap, DA7219_TONE_GEN_FREQ1_L,
|
||||
DA7219_TONE_GEN_FREQ1_U);
|
||||
regcache_sync_region(da7219->regmap, DA7219_TONE_GEN_CFG1,
|
||||
DA7219_TONE_GEN_CFG2);
|
||||
|
||||
regcache_cache_bypass(da7219->regmap, false);
|
||||
|
||||
/* Disable HPTest block */
|
||||
snd_soc_update_bits(codec, DA7219_ACCDET_CONFIG_8,
|
||||
DA7219_HPTEST_EN_MASK, 0);
|
||||
|
||||
/* Drive Headphones/lineout */
|
||||
snd_soc_update_bits(codec, DA7219_HP_L_CTRL, DA7219_HP_L_AMP_OE_MASK,
|
||||
DA7219_HP_L_AMP_OE_MASK);
|
||||
snd_soc_update_bits(codec, DA7219_HP_R_CTRL, DA7219_HP_R_AMP_OE_MASK,
|
||||
DA7219_HP_R_AMP_OE_MASK);
|
||||
|
||||
mutex_unlock(&da7219->lock);
|
||||
snd_soc_dapm_mutex_unlock(dapm);
|
||||
|
||||
/*
|
||||
* Only send report if jack hasn't been removed during process,
|
||||
* otherwise it's invalid and we drop it.
|
||||
*/
|
||||
if (da7219_aad->jack_inserted)
|
||||
snd_soc_jack_report(da7219_aad->jack, report,
|
||||
SND_JACK_HEADSET | SND_JACK_LINEOUT);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* IRQ
|
||||
*/
|
||||
|
||||
static irqreturn_t da7219_aad_irq_thread(int irq, void *data)
|
||||
{
|
||||
struct da7219_aad_priv *da7219_aad = data;
|
||||
struct snd_soc_codec *codec = da7219_aad->codec;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec);
|
||||
u8 events[DA7219_AAD_IRQ_REG_MAX];
|
||||
u8 statusa;
|
||||
int i, report = 0, mask = 0;
|
||||
|
||||
/* Read current IRQ events */
|
||||
regmap_bulk_read(da7219->regmap, DA7219_ACCDET_IRQ_EVENT_A,
|
||||
events, DA7219_AAD_IRQ_REG_MAX);
|
||||
|
||||
if (!events[DA7219_AAD_IRQ_REG_A] && !events[DA7219_AAD_IRQ_REG_B])
|
||||
return IRQ_NONE;
|
||||
|
||||
/* Read status register for jack insertion & type status */
|
||||
statusa = snd_soc_read(codec, DA7219_ACCDET_STATUS_A);
|
||||
|
||||
/* Clear events */
|
||||
regmap_bulk_write(da7219->regmap, DA7219_ACCDET_IRQ_EVENT_A,
|
||||
events, DA7219_AAD_IRQ_REG_MAX);
|
||||
|
||||
dev_dbg(codec->dev, "IRQ events = 0x%x|0x%x, status = 0x%x\n",
|
||||
events[DA7219_AAD_IRQ_REG_A], events[DA7219_AAD_IRQ_REG_B],
|
||||
statusa);
|
||||
|
||||
if (statusa & DA7219_JACK_INSERTION_STS_MASK) {
|
||||
/* Jack Insertion */
|
||||
if (events[DA7219_AAD_IRQ_REG_A] &
|
||||
DA7219_E_JACK_INSERTED_MASK) {
|
||||
report |= SND_JACK_MECHANICAL;
|
||||
mask |= SND_JACK_MECHANICAL;
|
||||
da7219_aad->jack_inserted = true;
|
||||
}
|
||||
|
||||
/* Jack type detection */
|
||||
if (events[DA7219_AAD_IRQ_REG_A] &
|
||||
DA7219_E_JACK_DETECT_COMPLETE_MASK) {
|
||||
/*
|
||||
* If 4-pole, then enable button detection, else perform
|
||||
* HP impedance test to determine output type to report.
|
||||
*
|
||||
* We schedule work here as the tasks themselves can
|
||||
* take time to complete, and in particular for hptest
|
||||
* we want to be able to check if the jack was removed
|
||||
* during the procedure as this will invalidate the
|
||||
* result. By doing this as work, the IRQ thread can
|
||||
* handle a removal, and we can check at the end of
|
||||
* hptest if we have a valid result or not.
|
||||
*/
|
||||
if (statusa & DA7219_JACK_TYPE_STS_MASK) {
|
||||
report |= SND_JACK_HEADSET;
|
||||
mask |= SND_JACK_HEADSET | SND_JACK_LINEOUT;
|
||||
schedule_work(&da7219_aad->btn_det_work);
|
||||
} else {
|
||||
schedule_work(&da7219_aad->hptest_work);
|
||||
}
|
||||
}
|
||||
|
||||
/* Button support for 4-pole jack */
|
||||
if (statusa & DA7219_JACK_TYPE_STS_MASK) {
|
||||
for (i = 0; i < DA7219_AAD_MAX_BUTTONS; ++i) {
|
||||
/* Button Press */
|
||||
if (events[DA7219_AAD_IRQ_REG_B] &
|
||||
(DA7219_E_BUTTON_A_PRESSED_MASK << i)) {
|
||||
report |= SND_JACK_BTN_0 >> i;
|
||||
mask |= SND_JACK_BTN_0 >> i;
|
||||
}
|
||||
}
|
||||
snd_soc_jack_report(da7219_aad->jack, report, mask);
|
||||
|
||||
for (i = 0; i < DA7219_AAD_MAX_BUTTONS; ++i) {
|
||||
/* Button Release */
|
||||
if (events[DA7219_AAD_IRQ_REG_B] &
|
||||
(DA7219_E_BUTTON_A_RELEASED_MASK >> i)) {
|
||||
report &= ~(SND_JACK_BTN_0 >> i);
|
||||
mask |= SND_JACK_BTN_0 >> i;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Jack removal */
|
||||
if (events[DA7219_AAD_IRQ_REG_A] & DA7219_E_JACK_REMOVED_MASK) {
|
||||
report = 0;
|
||||
mask |= DA7219_AAD_REPORT_ALL_MASK;
|
||||
da7219_aad->jack_inserted = false;
|
||||
|
||||
/* Un-drive headphones/lineout */
|
||||
snd_soc_update_bits(codec, DA7219_HP_R_CTRL,
|
||||
DA7219_HP_R_AMP_OE_MASK, 0);
|
||||
snd_soc_update_bits(codec, DA7219_HP_L_CTRL,
|
||||
DA7219_HP_L_AMP_OE_MASK, 0);
|
||||
|
||||
/* Ensure button detection disabled */
|
||||
snd_soc_update_bits(codec, DA7219_ACCDET_CONFIG_1,
|
||||
DA7219_BUTTON_CONFIG_MASK, 0);
|
||||
|
||||
/* Disable mic bias */
|
||||
snd_soc_dapm_disable_pin(dapm, "Mic Bias");
|
||||
snd_soc_dapm_sync(dapm);
|
||||
|
||||
/* Cancel any pending work */
|
||||
cancel_work_sync(&da7219_aad->btn_det_work);
|
||||
cancel_work_sync(&da7219_aad->hptest_work);
|
||||
}
|
||||
}
|
||||
|
||||
snd_soc_jack_report(da7219_aad->jack, report, mask);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
/*
|
||||
* DT to pdata conversion
|
||||
*/
|
||||
|
||||
static enum da7219_aad_micbias_pulse_lvl
|
||||
da7219_aad_of_micbias_pulse_lvl(struct snd_soc_codec *codec, u32 val)
|
||||
{
|
||||
switch (val) {
|
||||
case 2800:
|
||||
return DA7219_AAD_MICBIAS_PULSE_LVL_2_8V;
|
||||
case 2900:
|
||||
return DA7219_AAD_MICBIAS_PULSE_LVL_2_9V;
|
||||
default:
|
||||
dev_warn(codec->dev, "Invalid micbias pulse level");
|
||||
return DA7219_AAD_MICBIAS_PULSE_LVL_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
static enum da7219_aad_btn_cfg
|
||||
da7219_aad_of_btn_cfg(struct snd_soc_codec *codec, u32 val)
|
||||
{
|
||||
switch (val) {
|
||||
case 2:
|
||||
return DA7219_AAD_BTN_CFG_2MS;
|
||||
case 5:
|
||||
return DA7219_AAD_BTN_CFG_5MS;
|
||||
case 10:
|
||||
return DA7219_AAD_BTN_CFG_10MS;
|
||||
case 50:
|
||||
return DA7219_AAD_BTN_CFG_50MS;
|
||||
case 100:
|
||||
return DA7219_AAD_BTN_CFG_100MS;
|
||||
case 200:
|
||||
return DA7219_AAD_BTN_CFG_200MS;
|
||||
case 500:
|
||||
return DA7219_AAD_BTN_CFG_500MS;
|
||||
default:
|
||||
dev_warn(codec->dev, "Invalid button config");
|
||||
return DA7219_AAD_BTN_CFG_10MS;
|
||||
}
|
||||
}
|
||||
|
||||
static enum da7219_aad_mic_det_thr
|
||||
da7219_aad_of_mic_det_thr(struct snd_soc_codec *codec, u32 val)
|
||||
{
|
||||
switch (val) {
|
||||
case 200:
|
||||
return DA7219_AAD_MIC_DET_THR_200_OHMS;
|
||||
case 500:
|
||||
return DA7219_AAD_MIC_DET_THR_500_OHMS;
|
||||
case 750:
|
||||
return DA7219_AAD_MIC_DET_THR_750_OHMS;
|
||||
case 1000:
|
||||
return DA7219_AAD_MIC_DET_THR_1000_OHMS;
|
||||
default:
|
||||
dev_warn(codec->dev, "Invalid mic detect threshold");
|
||||
return DA7219_AAD_MIC_DET_THR_500_OHMS;
|
||||
}
|
||||
}
|
||||
|
||||
static enum da7219_aad_jack_ins_deb
|
||||
da7219_aad_of_jack_ins_deb(struct snd_soc_codec *codec, u32 val)
|
||||
{
|
||||
switch (val) {
|
||||
case 5:
|
||||
return DA7219_AAD_JACK_INS_DEB_5MS;
|
||||
case 10:
|
||||
return DA7219_AAD_JACK_INS_DEB_10MS;
|
||||
case 20:
|
||||
return DA7219_AAD_JACK_INS_DEB_20MS;
|
||||
case 50:
|
||||
return DA7219_AAD_JACK_INS_DEB_50MS;
|
||||
case 100:
|
||||
return DA7219_AAD_JACK_INS_DEB_100MS;
|
||||
case 200:
|
||||
return DA7219_AAD_JACK_INS_DEB_200MS;
|
||||
case 500:
|
||||
return DA7219_AAD_JACK_INS_DEB_500MS;
|
||||
case 1000:
|
||||
return DA7219_AAD_JACK_INS_DEB_1S;
|
||||
default:
|
||||
dev_warn(codec->dev, "Invalid jack insert debounce");
|
||||
return DA7219_AAD_JACK_INS_DEB_20MS;
|
||||
}
|
||||
}
|
||||
|
||||
static enum da7219_aad_jack_det_rate
|
||||
da7219_aad_of_jack_det_rate(struct snd_soc_codec *codec, const char *str)
|
||||
{
|
||||
if (!strcmp(str, "32ms_64ms")) {
|
||||
return DA7219_AAD_JACK_DET_RATE_32_64MS;
|
||||
} else if (!strcmp(str, "64ms_128ms")) {
|
||||
return DA7219_AAD_JACK_DET_RATE_64_128MS;
|
||||
} else if (!strcmp(str, "128ms_256ms")) {
|
||||
return DA7219_AAD_JACK_DET_RATE_128_256MS;
|
||||
} else if (!strcmp(str, "256ms_512ms")) {
|
||||
return DA7219_AAD_JACK_DET_RATE_256_512MS;
|
||||
} else {
|
||||
dev_warn(codec->dev, "Invalid jack detect rate");
|
||||
return DA7219_AAD_JACK_DET_RATE_256_512MS;
|
||||
}
|
||||
}
|
||||
|
||||
static enum da7219_aad_jack_rem_deb
|
||||
da7219_aad_of_jack_rem_deb(struct snd_soc_codec *codec, u32 val)
|
||||
{
|
||||
switch (val) {
|
||||
case 1:
|
||||
return DA7219_AAD_JACK_REM_DEB_1MS;
|
||||
case 5:
|
||||
return DA7219_AAD_JACK_REM_DEB_5MS;
|
||||
case 10:
|
||||
return DA7219_AAD_JACK_REM_DEB_10MS;
|
||||
case 20:
|
||||
return DA7219_AAD_JACK_REM_DEB_20MS;
|
||||
default:
|
||||
dev_warn(codec->dev, "Invalid jack removal debounce");
|
||||
return DA7219_AAD_JACK_REM_DEB_1MS;
|
||||
}
|
||||
}
|
||||
|
||||
static enum da7219_aad_btn_avg
|
||||
da7219_aad_of_btn_avg(struct snd_soc_codec *codec, u32 val)
|
||||
{
|
||||
switch (val) {
|
||||
case 1:
|
||||
return DA7219_AAD_BTN_AVG_1;
|
||||
case 2:
|
||||
return DA7219_AAD_BTN_AVG_2;
|
||||
case 4:
|
||||
return DA7219_AAD_BTN_AVG_4;
|
||||
case 8:
|
||||
return DA7219_AAD_BTN_AVG_8;
|
||||
default:
|
||||
dev_warn(codec->dev, "Invalid button average value");
|
||||
return DA7219_AAD_BTN_AVG_2;
|
||||
}
|
||||
}
|
||||
|
||||
static enum da7219_aad_adc_1bit_rpt
|
||||
da7219_aad_of_adc_1bit_rpt(struct snd_soc_codec *codec, u32 val)
|
||||
{
|
||||
switch (val) {
|
||||
case 1:
|
||||
return DA7219_AAD_ADC_1BIT_RPT_1;
|
||||
case 2:
|
||||
return DA7219_AAD_ADC_1BIT_RPT_2;
|
||||
case 4:
|
||||
return DA7219_AAD_ADC_1BIT_RPT_4;
|
||||
case 8:
|
||||
return DA7219_AAD_ADC_1BIT_RPT_8;
|
||||
default:
|
||||
dev_warn(codec->dev, "Invalid ADC 1-bit repeat value");
|
||||
return DA7219_AAD_ADC_1BIT_RPT_1;
|
||||
}
|
||||
}
|
||||
|
||||
static struct da7219_aad_pdata *da7219_aad_of_to_pdata(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct device_node *np = codec->dev->of_node;
|
||||
struct device_node *aad_np = of_find_node_by_name(np, "da7219_aad");
|
||||
struct da7219_aad_pdata *aad_pdata;
|
||||
const char *of_str;
|
||||
u32 of_val32;
|
||||
|
||||
if (!aad_np)
|
||||
return NULL;
|
||||
|
||||
aad_pdata = devm_kzalloc(codec->dev, sizeof(*aad_pdata), GFP_KERNEL);
|
||||
if (!aad_pdata)
|
||||
goto out;
|
||||
|
||||
aad_pdata->irq = irq_of_parse_and_map(np, 0);
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,micbias-pulse-lvl",
|
||||
&of_val32) >= 0)
|
||||
aad_pdata->micbias_pulse_lvl =
|
||||
da7219_aad_of_micbias_pulse_lvl(codec, of_val32);
|
||||
else
|
||||
aad_pdata->micbias_pulse_lvl = DA7219_AAD_MICBIAS_PULSE_LVL_OFF;
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,micbias-pulse-time",
|
||||
&of_val32) >= 0)
|
||||
aad_pdata->micbias_pulse_time = of_val32;
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,btn-cfg", &of_val32) >= 0)
|
||||
aad_pdata->btn_cfg = da7219_aad_of_btn_cfg(codec, of_val32);
|
||||
else
|
||||
aad_pdata->btn_cfg = DA7219_AAD_BTN_CFG_10MS;
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,mic-det-thr", &of_val32) >= 0)
|
||||
aad_pdata->mic_det_thr =
|
||||
da7219_aad_of_mic_det_thr(codec, of_val32);
|
||||
else
|
||||
aad_pdata->mic_det_thr = DA7219_AAD_MIC_DET_THR_500_OHMS;
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,jack-ins-deb", &of_val32) >= 0)
|
||||
aad_pdata->jack_ins_deb =
|
||||
da7219_aad_of_jack_ins_deb(codec, of_val32);
|
||||
else
|
||||
aad_pdata->jack_ins_deb = DA7219_AAD_JACK_INS_DEB_20MS;
|
||||
|
||||
if (!of_property_read_string(aad_np, "dlg,jack-det-rate", &of_str))
|
||||
aad_pdata->jack_det_rate =
|
||||
da7219_aad_of_jack_det_rate(codec, of_str);
|
||||
else
|
||||
aad_pdata->jack_det_rate = DA7219_AAD_JACK_DET_RATE_256_512MS;
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,jack-rem-deb", &of_val32) >= 0)
|
||||
aad_pdata->jack_rem_deb =
|
||||
da7219_aad_of_jack_rem_deb(codec, of_val32);
|
||||
else
|
||||
aad_pdata->jack_rem_deb = DA7219_AAD_JACK_REM_DEB_1MS;
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,a-d-btn-thr", &of_val32) >= 0)
|
||||
aad_pdata->a_d_btn_thr = (u8) of_val32;
|
||||
else
|
||||
aad_pdata->a_d_btn_thr = 0xA;
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,d-b-btn-thr", &of_val32) >= 0)
|
||||
aad_pdata->d_b_btn_thr = (u8) of_val32;
|
||||
else
|
||||
aad_pdata->d_b_btn_thr = 0x16;
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,b-c-btn-thr", &of_val32) >= 0)
|
||||
aad_pdata->b_c_btn_thr = (u8) of_val32;
|
||||
else
|
||||
aad_pdata->b_c_btn_thr = 0x21;
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,c-mic-btn-thr", &of_val32) >= 0)
|
||||
aad_pdata->c_mic_btn_thr = (u8) of_val32;
|
||||
else
|
||||
aad_pdata->c_mic_btn_thr = 0x3E;
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,btn-avg", &of_val32) >= 0)
|
||||
aad_pdata->btn_avg = da7219_aad_of_btn_avg(codec, of_val32);
|
||||
else
|
||||
aad_pdata->btn_avg = DA7219_AAD_BTN_AVG_2;
|
||||
|
||||
if (of_property_read_u32(aad_np, "dlg,adc-1bit-rpt", &of_val32) >= 0)
|
||||
aad_pdata->adc_1bit_rpt =
|
||||
da7219_aad_of_adc_1bit_rpt(codec, of_val32);
|
||||
else
|
||||
aad_pdata->adc_1bit_rpt = DA7219_AAD_ADC_1BIT_RPT_1;
|
||||
|
||||
out:
|
||||
of_node_put(aad_np);
|
||||
|
||||
return aad_pdata;
|
||||
}
|
||||
|
||||
static void da7219_aad_handle_pdata(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec);
|
||||
struct da7219_aad_priv *da7219_aad = da7219->aad;
|
||||
struct da7219_pdata *pdata = da7219->pdata;
|
||||
|
||||
if ((pdata) && (pdata->aad_pdata)) {
|
||||
struct da7219_aad_pdata *aad_pdata = pdata->aad_pdata;
|
||||
u8 cfg, mask;
|
||||
|
||||
da7219_aad->irq = aad_pdata->irq;
|
||||
|
||||
switch (aad_pdata->micbias_pulse_lvl) {
|
||||
case DA7219_AAD_MICBIAS_PULSE_LVL_2_8V:
|
||||
case DA7219_AAD_MICBIAS_PULSE_LVL_2_9V:
|
||||
da7219_aad->micbias_pulse_lvl =
|
||||
(aad_pdata->micbias_pulse_lvl <<
|
||||
DA7219_MICBIAS1_LEVEL_SHIFT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
da7219_aad->micbias_pulse_time = aad_pdata->micbias_pulse_time;
|
||||
|
||||
switch (aad_pdata->btn_cfg) {
|
||||
case DA7219_AAD_BTN_CFG_2MS:
|
||||
case DA7219_AAD_BTN_CFG_5MS:
|
||||
case DA7219_AAD_BTN_CFG_10MS:
|
||||
case DA7219_AAD_BTN_CFG_50MS:
|
||||
case DA7219_AAD_BTN_CFG_100MS:
|
||||
case DA7219_AAD_BTN_CFG_200MS:
|
||||
case DA7219_AAD_BTN_CFG_500MS:
|
||||
da7219_aad->btn_cfg = (aad_pdata->btn_cfg <<
|
||||
DA7219_BUTTON_CONFIG_SHIFT);
|
||||
}
|
||||
|
||||
cfg = 0;
|
||||
mask = 0;
|
||||
switch (aad_pdata->mic_det_thr) {
|
||||
case DA7219_AAD_MIC_DET_THR_200_OHMS:
|
||||
case DA7219_AAD_MIC_DET_THR_500_OHMS:
|
||||
case DA7219_AAD_MIC_DET_THR_750_OHMS:
|
||||
case DA7219_AAD_MIC_DET_THR_1000_OHMS:
|
||||
cfg |= (aad_pdata->mic_det_thr <<
|
||||
DA7219_MIC_DET_THRESH_SHIFT);
|
||||
mask |= DA7219_MIC_DET_THRESH_MASK;
|
||||
}
|
||||
snd_soc_update_bits(codec, DA7219_ACCDET_CONFIG_1, mask, cfg);
|
||||
|
||||
cfg = 0;
|
||||
mask = 0;
|
||||
switch (aad_pdata->jack_ins_deb) {
|
||||
case DA7219_AAD_JACK_INS_DEB_5MS:
|
||||
case DA7219_AAD_JACK_INS_DEB_10MS:
|
||||
case DA7219_AAD_JACK_INS_DEB_20MS:
|
||||
case DA7219_AAD_JACK_INS_DEB_50MS:
|
||||
case DA7219_AAD_JACK_INS_DEB_100MS:
|
||||
case DA7219_AAD_JACK_INS_DEB_200MS:
|
||||
case DA7219_AAD_JACK_INS_DEB_500MS:
|
||||
case DA7219_AAD_JACK_INS_DEB_1S:
|
||||
cfg |= (aad_pdata->jack_ins_deb <<
|
||||
DA7219_JACKDET_DEBOUNCE_SHIFT);
|
||||
mask |= DA7219_JACKDET_DEBOUNCE_MASK;
|
||||
}
|
||||
switch (aad_pdata->jack_det_rate) {
|
||||
case DA7219_AAD_JACK_DET_RATE_32_64MS:
|
||||
case DA7219_AAD_JACK_DET_RATE_64_128MS:
|
||||
case DA7219_AAD_JACK_DET_RATE_128_256MS:
|
||||
case DA7219_AAD_JACK_DET_RATE_256_512MS:
|
||||
cfg |= (aad_pdata->jack_det_rate <<
|
||||
DA7219_JACK_DETECT_RATE_SHIFT);
|
||||
mask |= DA7219_JACK_DETECT_RATE_MASK;
|
||||
}
|
||||
switch (aad_pdata->jack_rem_deb) {
|
||||
case DA7219_AAD_JACK_REM_DEB_1MS:
|
||||
case DA7219_AAD_JACK_REM_DEB_5MS:
|
||||
case DA7219_AAD_JACK_REM_DEB_10MS:
|
||||
case DA7219_AAD_JACK_REM_DEB_20MS:
|
||||
cfg |= (aad_pdata->jack_rem_deb <<
|
||||
DA7219_JACKDET_REM_DEB_SHIFT);
|
||||
mask |= DA7219_JACKDET_REM_DEB_MASK;
|
||||
}
|
||||
snd_soc_update_bits(codec, DA7219_ACCDET_CONFIG_2, mask, cfg);
|
||||
|
||||
snd_soc_write(codec, DA7219_ACCDET_CONFIG_3,
|
||||
aad_pdata->a_d_btn_thr);
|
||||
snd_soc_write(codec, DA7219_ACCDET_CONFIG_4,
|
||||
aad_pdata->d_b_btn_thr);
|
||||
snd_soc_write(codec, DA7219_ACCDET_CONFIG_5,
|
||||
aad_pdata->b_c_btn_thr);
|
||||
snd_soc_write(codec, DA7219_ACCDET_CONFIG_6,
|
||||
aad_pdata->c_mic_btn_thr);
|
||||
|
||||
cfg = 0;
|
||||
mask = 0;
|
||||
switch (aad_pdata->btn_avg) {
|
||||
case DA7219_AAD_BTN_AVG_1:
|
||||
case DA7219_AAD_BTN_AVG_2:
|
||||
case DA7219_AAD_BTN_AVG_4:
|
||||
case DA7219_AAD_BTN_AVG_8:
|
||||
cfg |= (aad_pdata->btn_avg <<
|
||||
DA7219_BUTTON_AVERAGE_SHIFT);
|
||||
mask |= DA7219_BUTTON_AVERAGE_MASK;
|
||||
}
|
||||
switch (aad_pdata->adc_1bit_rpt) {
|
||||
case DA7219_AAD_ADC_1BIT_RPT_1:
|
||||
case DA7219_AAD_ADC_1BIT_RPT_2:
|
||||
case DA7219_AAD_ADC_1BIT_RPT_4:
|
||||
case DA7219_AAD_ADC_1BIT_RPT_8:
|
||||
cfg |= (aad_pdata->adc_1bit_rpt <<
|
||||
DA7219_ADC_1_BIT_REPEAT_SHIFT);
|
||||
mask |= DA7219_ADC_1_BIT_REPEAT_MASK;
|
||||
}
|
||||
snd_soc_update_bits(codec, DA7219_ACCDET_CONFIG_7, mask, cfg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Init/Exit
|
||||
*/
|
||||
|
||||
int da7219_aad_init(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec);
|
||||
struct da7219_aad_priv *da7219_aad;
|
||||
u8 mask[DA7219_AAD_IRQ_REG_MAX];
|
||||
int ret;
|
||||
|
||||
da7219_aad = devm_kzalloc(codec->dev, sizeof(*da7219_aad), GFP_KERNEL);
|
||||
if (!da7219_aad)
|
||||
return -ENOMEM;
|
||||
|
||||
da7219->aad = da7219_aad;
|
||||
da7219_aad->codec = codec;
|
||||
|
||||
/* Handle any DT/platform data */
|
||||
if ((codec->dev->of_node) && (da7219->pdata))
|
||||
da7219->pdata->aad_pdata = da7219_aad_of_to_pdata(codec);
|
||||
|
||||
da7219_aad_handle_pdata(codec);
|
||||
|
||||
/* Disable button detection */
|
||||
snd_soc_update_bits(codec, DA7219_ACCDET_CONFIG_1,
|
||||
DA7219_BUTTON_CONFIG_MASK, 0);
|
||||
|
||||
INIT_WORK(&da7219_aad->btn_det_work, da7219_aad_btn_det_work);
|
||||
INIT_WORK(&da7219_aad->hptest_work, da7219_aad_hptest_work);
|
||||
|
||||
ret = request_threaded_irq(da7219_aad->irq, NULL,
|
||||
da7219_aad_irq_thread,
|
||||
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
|
||||
"da7219-aad", da7219_aad);
|
||||
if (ret) {
|
||||
dev_err(codec->dev, "Failed to request IRQ: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Unmask AAD IRQs */
|
||||
memset(mask, 0, DA7219_AAD_IRQ_REG_MAX);
|
||||
regmap_bulk_write(da7219->regmap, DA7219_ACCDET_IRQ_MASK_A,
|
||||
&mask, DA7219_AAD_IRQ_REG_MAX);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(da7219_aad_init);
|
||||
|
||||
void da7219_aad_exit(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec);
|
||||
struct da7219_aad_priv *da7219_aad = da7219->aad;
|
||||
u8 mask[DA7219_AAD_IRQ_REG_MAX];
|
||||
|
||||
/* Mask off AAD IRQs */
|
||||
memset(mask, DA7219_BYTE_MASK, DA7219_AAD_IRQ_REG_MAX);
|
||||
regmap_bulk_write(da7219->regmap, DA7219_ACCDET_IRQ_MASK_A,
|
||||
mask, DA7219_AAD_IRQ_REG_MAX);
|
||||
|
||||
free_irq(da7219_aad->irq, da7219_aad);
|
||||
|
||||
cancel_work_sync(&da7219_aad->btn_det_work);
|
||||
cancel_work_sync(&da7219_aad->hptest_work);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(da7219_aad_exit);
|
||||
|
||||
MODULE_DESCRIPTION("ASoC DA7219 AAD Driver");
|
||||
MODULE_AUTHOR("Adam Thomson <Adam.Thomson.Opensource@diasemi.com>");
|
||||
MODULE_LICENSE("GPL");
|
212
sound/soc/codecs/da7219-aad.h
Normal file
212
sound/soc/codecs/da7219-aad.h
Normal file
@ -0,0 +1,212 @@
|
||||
/*
|
||||
* da7219-aad.h - DA7322 ASoC AAD Driver
|
||||
*
|
||||
* Copyright (c) 2015 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.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 __DA7219_AAD_H
|
||||
#define __DA7219_AAD_H
|
||||
|
||||
#include <linux/timer.h>
|
||||
#include <sound/soc.h>
|
||||
#include <sound/jack.h>
|
||||
#include <sound/da7219-aad.h>
|
||||
|
||||
/*
|
||||
* Registers
|
||||
*/
|
||||
|
||||
#define DA7219_ACCDET_STATUS_A 0xC0
|
||||
#define DA7219_ACCDET_STATUS_B 0xC1
|
||||
#define DA7219_ACCDET_IRQ_EVENT_A 0xC2
|
||||
#define DA7219_ACCDET_IRQ_EVENT_B 0xC3
|
||||
#define DA7219_ACCDET_IRQ_MASK_A 0xC4
|
||||
#define DA7219_ACCDET_IRQ_MASK_B 0xC5
|
||||
#define DA7219_ACCDET_CONFIG_1 0xC6
|
||||
#define DA7219_ACCDET_CONFIG_2 0xC7
|
||||
#define DA7219_ACCDET_CONFIG_3 0xC8
|
||||
#define DA7219_ACCDET_CONFIG_4 0xC9
|
||||
#define DA7219_ACCDET_CONFIG_5 0xCA
|
||||
#define DA7219_ACCDET_CONFIG_6 0xCB
|
||||
#define DA7219_ACCDET_CONFIG_7 0xCC
|
||||
#define DA7219_ACCDET_CONFIG_8 0xCD
|
||||
|
||||
|
||||
/*
|
||||
* Bit Fields
|
||||
*/
|
||||
|
||||
/* DA7219_ACCDET_STATUS_A = 0xC0 */
|
||||
#define DA7219_JACK_INSERTION_STS_SHIFT 0
|
||||
#define DA7219_JACK_INSERTION_STS_MASK (0x1 << 0)
|
||||
#define DA7219_JACK_TYPE_STS_SHIFT 1
|
||||
#define DA7219_JACK_TYPE_STS_MASK (0x1 << 1)
|
||||
#define DA7219_JACK_PIN_ORDER_STS_SHIFT 2
|
||||
#define DA7219_JACK_PIN_ORDER_STS_MASK (0x1 << 2)
|
||||
#define DA7219_MICBIAS_UP_STS_SHIFT 3
|
||||
#define DA7219_MICBIAS_UP_STS_MASK (0x1 << 3)
|
||||
|
||||
/* DA7219_ACCDET_STATUS_B = 0xC1 */
|
||||
#define DA7219_BUTTON_TYPE_STS_SHIFT 0
|
||||
#define DA7219_BUTTON_TYPE_STS_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_ACCDET_IRQ_EVENT_A = 0xC2 */
|
||||
#define DA7219_E_JACK_INSERTED_SHIFT 0
|
||||
#define DA7219_E_JACK_INSERTED_MASK (0x1 << 0)
|
||||
#define DA7219_E_JACK_REMOVED_SHIFT 1
|
||||
#define DA7219_E_JACK_REMOVED_MASK (0x1 << 1)
|
||||
#define DA7219_E_JACK_DETECT_COMPLETE_SHIFT 2
|
||||
#define DA7219_E_JACK_DETECT_COMPLETE_MASK (0x1 << 2)
|
||||
|
||||
/* DA7219_ACCDET_IRQ_EVENT_B = 0xC3 */
|
||||
#define DA7219_E_BUTTON_A_PRESSED_SHIFT 0
|
||||
#define DA7219_E_BUTTON_A_PRESSED_MASK (0x1 << 0)
|
||||
#define DA7219_E_BUTTON_B_PRESSED_SHIFT 1
|
||||
#define DA7219_E_BUTTON_B_PRESSED_MASK (0x1 << 1)
|
||||
#define DA7219_E_BUTTON_C_PRESSED_SHIFT 2
|
||||
#define DA7219_E_BUTTON_C_PRESSED_MASK (0x1 << 2)
|
||||
#define DA7219_E_BUTTON_D_PRESSED_SHIFT 3
|
||||
#define DA7219_E_BUTTON_D_PRESSED_MASK (0x1 << 3)
|
||||
#define DA7219_E_BUTTON_D_RELEASED_SHIFT 4
|
||||
#define DA7219_E_BUTTON_D_RELEASED_MASK (0x1 << 4)
|
||||
#define DA7219_E_BUTTON_C_RELEASED_SHIFT 5
|
||||
#define DA7219_E_BUTTON_C_RELEASED_MASK (0x1 << 5)
|
||||
#define DA7219_E_BUTTON_B_RELEASED_SHIFT 6
|
||||
#define DA7219_E_BUTTON_B_RELEASED_MASK (0x1 << 6)
|
||||
#define DA7219_E_BUTTON_A_RELEASED_SHIFT 7
|
||||
#define DA7219_E_BUTTON_A_RELEASED_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_ACCDET_IRQ_MASK_A = 0xC4 */
|
||||
#define DA7219_M_JACK_INSERTED_SHIFT 0
|
||||
#define DA7219_M_JACK_INSERTED_MASK (0x1 << 0)
|
||||
#define DA7219_M_JACK_REMOVED_SHIFT 1
|
||||
#define DA7219_M_JACK_REMOVED_MASK (0x1 << 1)
|
||||
#define DA7219_M_JACK_DETECT_COMPLETE_SHIFT 2
|
||||
#define DA7219_M_JACK_DETECT_COMPLETE_MASK (0x1 << 2)
|
||||
|
||||
/* DA7219_ACCDET_IRQ_MASK_B = 0xC5 */
|
||||
#define DA7219_M_BUTTON_A_PRESSED_SHIFT 0
|
||||
#define DA7219_M_BUTTON_A_PRESSED_MASK (0x1 << 0)
|
||||
#define DA7219_M_BUTTON_B_PRESSED_SHIFT 1
|
||||
#define DA7219_M_BUTTON_B_PRESSED_MASK (0x1 << 1)
|
||||
#define DA7219_M_BUTTON_C_PRESSED_SHIFT 2
|
||||
#define DA7219_M_BUTTON_C_PRESSED_MASK (0x1 << 2)
|
||||
#define DA7219_M_BUTTON_D_PRESSED_SHIFT 3
|
||||
#define DA7219_M_BUTTON_D_PRESSED_MASK (0x1 << 3)
|
||||
#define DA7219_M_BUTTON_D_RELEASED_SHIFT 4
|
||||
#define DA7219_M_BUTTON_D_RELEASED_MASK (0x1 << 4)
|
||||
#define DA7219_M_BUTTON_C_RELEASED_SHIFT 5
|
||||
#define DA7219_M_BUTTON_C_RELEASED_MASK (0x1 << 5)
|
||||
#define DA7219_M_BUTTON_B_RELEASED_SHIFT 6
|
||||
#define DA7219_M_BUTTON_B_RELEASED_MASK (0x1 << 6)
|
||||
#define DA7219_M_BUTTON_A_RELEASED_SHIFT 7
|
||||
#define DA7219_M_BUTTON_A_RELEASED_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_ACCDET_CONFIG_1 = 0xC6 */
|
||||
#define DA7219_ACCDET_EN_SHIFT 0
|
||||
#define DA7219_ACCDET_EN_MASK (0x1 << 0)
|
||||
#define DA7219_BUTTON_CONFIG_SHIFT 1
|
||||
#define DA7219_BUTTON_CONFIG_MASK (0x7 << 1)
|
||||
#define DA7219_MIC_DET_THRESH_SHIFT 4
|
||||
#define DA7219_MIC_DET_THRESH_MASK (0x3 << 4)
|
||||
#define DA7219_JACK_TYPE_DET_EN_SHIFT 6
|
||||
#define DA7219_JACK_TYPE_DET_EN_MASK (0x1 << 6)
|
||||
#define DA7219_PIN_ORDER_DET_EN_SHIFT 7
|
||||
#define DA7219_PIN_ORDER_DET_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_ACCDET_CONFIG_2 = 0xC7 */
|
||||
#define DA7219_ACCDET_PAUSE_SHIFT 0
|
||||
#define DA7219_ACCDET_PAUSE_MASK (0x1 << 0)
|
||||
#define DA7219_JACKDET_DEBOUNCE_SHIFT 1
|
||||
#define DA7219_JACKDET_DEBOUNCE_MASK (0x7 << 1)
|
||||
#define DA7219_JACK_DETECT_RATE_SHIFT 4
|
||||
#define DA7219_JACK_DETECT_RATE_MASK (0x3 << 4)
|
||||
#define DA7219_JACKDET_REM_DEB_SHIFT 6
|
||||
#define DA7219_JACKDET_REM_DEB_MASK (0x3 << 6)
|
||||
|
||||
/* DA7219_ACCDET_CONFIG_3 = 0xC8 */
|
||||
#define DA7219_A_D_BUTTON_THRESH_SHIFT 0
|
||||
#define DA7219_A_D_BUTTON_THRESH_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_ACCDET_CONFIG_4 = 0xC9 */
|
||||
#define DA7219_D_B_BUTTON_THRESH_SHIFT 0
|
||||
#define DA7219_D_B_BUTTON_THRESH_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_ACCDET_CONFIG_5 = 0xCA */
|
||||
#define DA7219_B_C_BUTTON_THRESH_SHIFT 0
|
||||
#define DA7219_B_C_BUTTON_THRESH_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_ACCDET_CONFIG_6 = 0xCB */
|
||||
#define DA7219_C_MIC_BUTTON_THRESH_SHIFT 0
|
||||
#define DA7219_C_MIC_BUTTON_THRESH_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_ACCDET_CONFIG_7 = 0xCC */
|
||||
#define DA7219_BUTTON_AVERAGE_SHIFT 0
|
||||
#define DA7219_BUTTON_AVERAGE_MASK (0x3 << 0)
|
||||
#define DA7219_ADC_1_BIT_REPEAT_SHIFT 2
|
||||
#define DA7219_ADC_1_BIT_REPEAT_MASK (0x3 << 2)
|
||||
#define DA7219_PIN_ORDER_FORCE_SHIFT 4
|
||||
#define DA7219_PIN_ORDER_FORCE_MASK (0x1 << 4)
|
||||
#define DA7219_JACK_TYPE_FORCE_SHIFT 5
|
||||
#define DA7219_JACK_TYPE_FORCE_MASK (0x1 << 5)
|
||||
|
||||
/* DA7219_ACCDET_CONFIG_8 = 0xCD */
|
||||
#define DA7219_HPTEST_EN_SHIFT 0
|
||||
#define DA7219_HPTEST_EN_MASK (0x1 << 0)
|
||||
#define DA7219_HPTEST_RES_SEL_SHIFT 1
|
||||
#define DA7219_HPTEST_RES_SEL_MASK (0x3 << 1)
|
||||
#define DA7219_HPTEST_RES_SEL_1KOHMS (0x0 << 1)
|
||||
#define DA7219_HPTEST_COMP_SHIFT 4
|
||||
#define DA7219_HPTEST_COMP_MASK (0x1 << 4)
|
||||
|
||||
|
||||
#define DA7219_AAD_MAX_BUTTONS 4
|
||||
#define DA7219_AAD_REPORT_ALL_MASK (SND_JACK_MECHANICAL | \
|
||||
SND_JACK_HEADSET | SND_JACK_LINEOUT | \
|
||||
SND_JACK_BTN_0 | SND_JACK_BTN_1 | \
|
||||
SND_JACK_BTN_2 | SND_JACK_BTN_3)
|
||||
|
||||
#define DA7219_AAD_MICBIAS_CHK_DELAY 10
|
||||
#define DA7219_AAD_MICBIAS_CHK_RETRIES 5
|
||||
|
||||
#define DA7219_AAD_HPTEST_RAMP_FREQ 0x28
|
||||
#define DA7219_AAD_HPTEST_PERIOD 65
|
||||
|
||||
enum da7219_aad_event_regs {
|
||||
DA7219_AAD_IRQ_REG_A = 0,
|
||||
DA7219_AAD_IRQ_REG_B,
|
||||
DA7219_AAD_IRQ_REG_MAX,
|
||||
};
|
||||
|
||||
/* Private data */
|
||||
struct da7219_aad_priv {
|
||||
struct snd_soc_codec *codec;
|
||||
int irq;
|
||||
|
||||
u8 micbias_pulse_lvl;
|
||||
u32 micbias_pulse_time;
|
||||
|
||||
u8 btn_cfg;
|
||||
|
||||
struct work_struct btn_det_work;
|
||||
struct work_struct hptest_work;
|
||||
|
||||
struct snd_soc_jack *jack;
|
||||
bool jack_inserted;
|
||||
};
|
||||
|
||||
/* AAD control */
|
||||
void da7219_aad_jack_det(struct snd_soc_codec *codec, struct snd_soc_jack *jack);
|
||||
|
||||
/* Init/Exit */
|
||||
int da7219_aad_init(struct snd_soc_codec *codec);
|
||||
void da7219_aad_exit(struct snd_soc_codec *codec);
|
||||
|
||||
#endif /* __DA7219_AAD_H */
|
1940
sound/soc/codecs/da7219.c
Normal file
1940
sound/soc/codecs/da7219.c
Normal file
File diff suppressed because it is too large
Load Diff
820
sound/soc/codecs/da7219.h
Normal file
820
sound/soc/codecs/da7219.h
Normal file
@ -0,0 +1,820 @@
|
||||
/*
|
||||
* da7219.h - DA7219 ALSA SoC Codec Driver
|
||||
*
|
||||
* Copyright (c) 2015 Dialog Semiconductor
|
||||
*
|
||||
* Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.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 __DA7219_H
|
||||
#define __DA7219_H
|
||||
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <sound/da7219.h>
|
||||
|
||||
/*
|
||||
* Registers
|
||||
*/
|
||||
|
||||
#define DA7219_MIC_1_GAIN_STATUS 0x6
|
||||
#define DA7219_MIXIN_L_GAIN_STATUS 0x8
|
||||
#define DA7219_ADC_L_GAIN_STATUS 0xA
|
||||
#define DA7219_DAC_L_GAIN_STATUS 0xC
|
||||
#define DA7219_DAC_R_GAIN_STATUS 0xD
|
||||
#define DA7219_HP_L_GAIN_STATUS 0xE
|
||||
#define DA7219_HP_R_GAIN_STATUS 0xF
|
||||
#define DA7219_MIC_1_SELECT 0x10
|
||||
#define DA7219_CIF_TIMEOUT_CTRL 0x12
|
||||
#define DA7219_CIF_CTRL 0x13
|
||||
#define DA7219_SR_24_48 0x16
|
||||
#define DA7219_SR 0x17
|
||||
#define DA7219_CIF_I2C_ADDR_CFG 0x1B
|
||||
#define DA7219_PLL_CTRL 0x20
|
||||
#define DA7219_PLL_FRAC_TOP 0x22
|
||||
#define DA7219_PLL_FRAC_BOT 0x23
|
||||
#define DA7219_PLL_INTEGER 0x24
|
||||
#define DA7219_PLL_SRM_STS 0x25
|
||||
#define DA7219_DIG_ROUTING_DAI 0x2A
|
||||
#define DA7219_DAI_CLK_MODE 0x2B
|
||||
#define DA7219_DAI_CTRL 0x2C
|
||||
#define DA7219_DAI_TDM_CTRL 0x2D
|
||||
#define DA7219_DIG_ROUTING_DAC 0x2E
|
||||
#define DA7219_ALC_CTRL1 0x2F
|
||||
#define DA7219_DAI_OFFSET_LOWER 0x30
|
||||
#define DA7219_DAI_OFFSET_UPPER 0x31
|
||||
#define DA7219_REFERENCES 0x32
|
||||
#define DA7219_MIXIN_L_SELECT 0x33
|
||||
#define DA7219_MIXIN_L_GAIN 0x34
|
||||
#define DA7219_ADC_L_GAIN 0x36
|
||||
#define DA7219_ADC_FILTERS1 0x38
|
||||
#define DA7219_MIC_1_GAIN 0x39
|
||||
#define DA7219_SIDETONE_CTRL 0x3A
|
||||
#define DA7219_SIDETONE_GAIN 0x3B
|
||||
#define DA7219_DROUTING_ST_OUTFILT_1L 0x3C
|
||||
#define DA7219_DROUTING_ST_OUTFILT_1R 0x3D
|
||||
#define DA7219_DAC_FILTERS5 0x40
|
||||
#define DA7219_DAC_FILTERS2 0x41
|
||||
#define DA7219_DAC_FILTERS3 0x42
|
||||
#define DA7219_DAC_FILTERS4 0x43
|
||||
#define DA7219_DAC_FILTERS1 0x44
|
||||
#define DA7219_DAC_L_GAIN 0x45
|
||||
#define DA7219_DAC_R_GAIN 0x46
|
||||
#define DA7219_CP_CTRL 0x47
|
||||
#define DA7219_HP_L_GAIN 0x48
|
||||
#define DA7219_HP_R_GAIN 0x49
|
||||
#define DA7219_MIXOUT_L_SELECT 0x4B
|
||||
#define DA7219_MIXOUT_R_SELECT 0x4C
|
||||
#define DA7219_SYSTEM_MODES_INPUT 0x50
|
||||
#define DA7219_SYSTEM_MODES_OUTPUT 0x51
|
||||
#define DA7219_MICBIAS_CTRL 0x62
|
||||
#define DA7219_MIC_1_CTRL 0x63
|
||||
#define DA7219_MIXIN_L_CTRL 0x65
|
||||
#define DA7219_ADC_L_CTRL 0x67
|
||||
#define DA7219_DAC_L_CTRL 0x69
|
||||
#define DA7219_DAC_R_CTRL 0x6A
|
||||
#define DA7219_HP_L_CTRL 0x6B
|
||||
#define DA7219_HP_R_CTRL 0x6C
|
||||
#define DA7219_MIXOUT_L_CTRL 0x6E
|
||||
#define DA7219_MIXOUT_R_CTRL 0x6F
|
||||
#define DA7219_CHIP_ID1 0x81
|
||||
#define DA7219_CHIP_ID2 0x82
|
||||
#define DA7219_CHIP_REVISION 0x83
|
||||
#define DA7219_LDO_CTRL 0x90
|
||||
#define DA7219_IO_CTRL 0x91
|
||||
#define DA7219_GAIN_RAMP_CTRL 0x92
|
||||
#define DA7219_PC_COUNT 0x94
|
||||
#define DA7219_CP_VOL_THRESHOLD1 0x95
|
||||
#define DA7219_CP_DELAY 0x96
|
||||
#define DA7219_DIG_CTRL 0x99
|
||||
#define DA7219_ALC_CTRL2 0x9A
|
||||
#define DA7219_ALC_CTRL3 0x9B
|
||||
#define DA7219_ALC_NOISE 0x9C
|
||||
#define DA7219_ALC_TARGET_MIN 0x9D
|
||||
#define DA7219_ALC_TARGET_MAX 0x9E
|
||||
#define DA7219_ALC_GAIN_LIMITS 0x9F
|
||||
#define DA7219_ALC_ANA_GAIN_LIMITS 0xA0
|
||||
#define DA7219_ALC_ANTICLIP_CTRL 0xA1
|
||||
#define DA7219_ALC_ANTICLIP_LEVEL 0xA2
|
||||
#define DA7219_ALC_OFFSET_AUTO_M_L 0xA3
|
||||
#define DA7219_ALC_OFFSET_AUTO_U_L 0xA4
|
||||
#define DA7219_DAC_NG_SETUP_TIME 0xAF
|
||||
#define DA7219_DAC_NG_OFF_THRESH 0xB0
|
||||
#define DA7219_DAC_NG_ON_THRESH 0xB1
|
||||
#define DA7219_DAC_NG_CTRL 0xB2
|
||||
#define DA7219_TONE_GEN_CFG1 0xB4
|
||||
#define DA7219_TONE_GEN_CFG2 0xB5
|
||||
#define DA7219_TONE_GEN_CYCLES 0xB6
|
||||
#define DA7219_TONE_GEN_FREQ1_L 0xB7
|
||||
#define DA7219_TONE_GEN_FREQ1_U 0xB8
|
||||
#define DA7219_TONE_GEN_FREQ2_L 0xB9
|
||||
#define DA7219_TONE_GEN_FREQ2_U 0xBA
|
||||
#define DA7219_TONE_GEN_ON_PER 0xBB
|
||||
#define DA7219_TONE_GEN_OFF_PER 0xBC
|
||||
#define DA7219_SYSTEM_STATUS 0xE0
|
||||
#define DA7219_SYSTEM_ACTIVE 0xFD
|
||||
|
||||
|
||||
/*
|
||||
* Bit Fields
|
||||
*/
|
||||
|
||||
#define DA7219_SWITCH_EN_MAX 0x1
|
||||
|
||||
/* DA7219_MIC_1_GAIN_STATUS = 0x6 */
|
||||
#define DA7219_MIC_1_AMP_GAIN_STATUS_SHIFT 0
|
||||
#define DA7219_MIC_1_AMP_GAIN_STATUS_MASK (0x7 << 0)
|
||||
#define DA7219_MIC_1_AMP_GAIN_MAX 0x7
|
||||
|
||||
/* DA7219_MIXIN_L_GAIN_STATUS = 0x8 */
|
||||
#define DA7219_MIXIN_L_AMP_GAIN_STATUS_SHIFT 0
|
||||
#define DA7219_MIXIN_L_AMP_GAIN_STATUS_MASK (0xF << 0)
|
||||
|
||||
/* DA7219_ADC_L_GAIN_STATUS = 0xA */
|
||||
#define DA7219_ADC_L_DIGITAL_GAIN_STATUS_SHIFT 0
|
||||
#define DA7219_ADC_L_DIGITAL_GAIN_STATUS_MASK (0x7F << 0)
|
||||
|
||||
/* DA7219_DAC_L_GAIN_STATUS = 0xC */
|
||||
#define DA7219_DAC_L_DIGITAL_GAIN_STATUS_SHIFT 0
|
||||
#define DA7219_DAC_L_DIGITAL_GAIN_STATUS_MASK (0x7F << 0)
|
||||
|
||||
/* DA7219_DAC_R_GAIN_STATUS = 0xD */
|
||||
#define DA7219_DAC_R_DIGITAL_GAIN_STATUS_SHIFT 0
|
||||
#define DA7219_DAC_R_DIGITAL_GAIN_STATUS_MASK (0x7F << 0)
|
||||
|
||||
/* DA7219_HP_L_GAIN_STATUS = 0xE */
|
||||
#define DA7219_HP_L_AMP_GAIN_STATUS_SHIFT 0
|
||||
#define DA7219_HP_L_AMP_GAIN_STATUS_MASK (0x3F << 0)
|
||||
|
||||
/* DA7219_HP_R_GAIN_STATUS = 0xF */
|
||||
#define DA7219_HP_R_AMP_GAIN_STATUS_SHIFT 0
|
||||
#define DA7219_HP_R_AMP_GAIN_STATUS_MASK (0x3F << 0)
|
||||
|
||||
/* DA7219_MIC_1_SELECT = 0x10 */
|
||||
#define DA7219_MIC_1_AMP_IN_SEL_SHIFT 0
|
||||
#define DA7219_MIC_1_AMP_IN_SEL_MASK (0x3 << 0)
|
||||
|
||||
/* DA7219_CIF_TIMEOUT_CTRL = 0x12 */
|
||||
#define DA7219_I2C_TIMEOUT_EN_SHIFT 0
|
||||
#define DA7219_I2C_TIMEOUT_EN_MASK (0x1 << 0)
|
||||
|
||||
/* DA7219_CIF_CTRL = 0x13 */
|
||||
#define DA7219_CIF_I2C_WRITE_MODE_SHIFT 0
|
||||
#define DA7219_CIF_I2C_WRITE_MODE_MASK (0x1 << 0)
|
||||
#define DA7219_CIF_REG_SOFT_RESET_SHIFT 7
|
||||
#define DA7219_CIF_REG_SOFT_RESET_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_SR_24_48 = 0x16 */
|
||||
#define DA7219_SR_24_48_SHIFT 0
|
||||
#define DA7219_SR_24_48_MASK (0x1 << 0)
|
||||
|
||||
/* DA7219_SR = 0x17 */
|
||||
#define DA7219_SR_SHIFT 0
|
||||
#define DA7219_SR_MASK (0xF << 0)
|
||||
#define DA7219_SR_8000 (0x01 << 0)
|
||||
#define DA7219_SR_11025 (0x02 << 0)
|
||||
#define DA7219_SR_12000 (0x03 << 0)
|
||||
#define DA7219_SR_16000 (0x05 << 0)
|
||||
#define DA7219_SR_22050 (0x06 << 0)
|
||||
#define DA7219_SR_24000 (0x07 << 0)
|
||||
#define DA7219_SR_32000 (0x09 << 0)
|
||||
#define DA7219_SR_44100 (0x0A << 0)
|
||||
#define DA7219_SR_48000 (0x0B << 0)
|
||||
#define DA7219_SR_88200 (0x0E << 0)
|
||||
#define DA7219_SR_96000 (0x0F << 0)
|
||||
|
||||
/* DA7219_CIF_I2C_ADDR_CFG = 0x1B */
|
||||
#define DA7219_CIF_I2C_ADDR_CFG_SHIFT 0
|
||||
#define DA7219_CIF_I2C_ADDR_CFG_MASK (0x3 << 0)
|
||||
|
||||
/* DA7219_PLL_CTRL = 0x20 */
|
||||
#define DA7219_PLL_INDIV_SHIFT 2
|
||||
#define DA7219_PLL_INDIV_MASK (0x7 << 2)
|
||||
#define DA7219_PLL_INDIV_2_5_MHZ (0x0 << 2)
|
||||
#define DA7219_PLL_INDIV_5_10_MHZ (0x1 << 2)
|
||||
#define DA7219_PLL_INDIV_10_20_MHZ (0x2 << 2)
|
||||
#define DA7219_PLL_INDIV_20_40_MHZ (0x3 << 2)
|
||||
#define DA7219_PLL_INDIV_40_54_MHZ (0x4 << 2)
|
||||
#define DA7219_PLL_MCLK_SQR_EN_SHIFT 5
|
||||
#define DA7219_PLL_MCLK_SQR_EN_MASK (0x1 << 5)
|
||||
#define DA7219_PLL_MODE_SHIFT 6
|
||||
#define DA7219_PLL_MODE_MASK (0x3 << 6)
|
||||
#define DA7219_PLL_MODE_BYPASS (0x0 << 6)
|
||||
#define DA7219_PLL_MODE_NORMAL (0x1 << 6)
|
||||
#define DA7219_PLL_MODE_SRM (0x2 << 6)
|
||||
#define DA7219_PLL_MODE_32KHZ (0x3 << 6)
|
||||
|
||||
/* DA7219_PLL_FRAC_TOP = 0x22 */
|
||||
#define DA7219_PLL_FBDIV_FRAC_TOP_SHIFT 0
|
||||
#define DA7219_PLL_FBDIV_FRAC_TOP_MASK (0x1F << 0)
|
||||
|
||||
/* DA7219_PLL_FRAC_BOT = 0x23 */
|
||||
#define DA7219_PLL_FBDIV_FRAC_BOT_SHIFT 0
|
||||
#define DA7219_PLL_FBDIV_FRAC_BOT_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_PLL_INTEGER = 0x24 */
|
||||
#define DA7219_PLL_FBDIV_INTEGER_SHIFT 0
|
||||
#define DA7219_PLL_FBDIV_INTEGER_MASK (0x7F << 0)
|
||||
|
||||
/* DA7219_PLL_SRM_STS = 0x25 */
|
||||
#define DA7219_PLL_SRM_STATE_SHIFT 0
|
||||
#define DA7219_PLL_SRM_STATE_MASK (0xF << 0)
|
||||
#define DA7219_PLL_SRM_STATUS_SHIFT 4
|
||||
#define DA7219_PLL_SRM_STATUS_MASK (0xF << 4)
|
||||
#define DA7219_PLL_SRM_STS_SRM_LOCK (0x1 << 7)
|
||||
|
||||
/* DA7219_DIG_ROUTING_DAI = 0x2A */
|
||||
#define DA7219_DAI_L_SRC_SHIFT 0
|
||||
#define DA7219_DAI_L_SRC_MASK (0x3 << 0)
|
||||
#define DA7219_DAI_R_SRC_SHIFT 4
|
||||
#define DA7219_DAI_R_SRC_MASK (0x3 << 4)
|
||||
#define DA7219_OUT_SRC_MAX 4
|
||||
|
||||
/* DA7219_DAI_CLK_MODE = 0x2B */
|
||||
#define DA7219_DAI_BCLKS_PER_WCLK_SHIFT 0
|
||||
#define DA7219_DAI_BCLKS_PER_WCLK_MASK (0x3 << 0)
|
||||
#define DA7219_DAI_BCLKS_PER_WCLK_32 (0x0 << 0)
|
||||
#define DA7219_DAI_BCLKS_PER_WCLK_64 (0x1 << 0)
|
||||
#define DA7219_DAI_BCLKS_PER_WCLK_128 (0x2 << 0)
|
||||
#define DA7219_DAI_BCLKS_PER_WCLK_256 (0x3 << 0)
|
||||
#define DA7219_DAI_CLK_POL_SHIFT 2
|
||||
#define DA7219_DAI_CLK_POL_MASK (0x1 << 2)
|
||||
#define DA7219_DAI_CLK_POL_INV (0x1 << 2)
|
||||
#define DA7219_DAI_WCLK_POL_SHIFT 3
|
||||
#define DA7219_DAI_WCLK_POL_MASK (0x1 << 3)
|
||||
#define DA7219_DAI_WCLK_POL_INV (0x1 << 3)
|
||||
#define DA7219_DAI_WCLK_TRI_STATE_SHIFT 4
|
||||
#define DA7219_DAI_WCLK_TRI_STATE_MASK (0x1 << 4)
|
||||
#define DA7219_DAI_CLK_EN_SHIFT 7
|
||||
#define DA7219_DAI_CLK_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_DAI_CTRL = 0x2C */
|
||||
#define DA7219_DAI_FORMAT_SHIFT 0
|
||||
#define DA7219_DAI_FORMAT_MASK (0x3 << 0)
|
||||
#define DA7219_DAI_FORMAT_I2S (0x0 << 0)
|
||||
#define DA7219_DAI_FORMAT_LEFT_J (0x1 << 0)
|
||||
#define DA7219_DAI_FORMAT_RIGHT_J (0x2 << 0)
|
||||
#define DA7219_DAI_FORMAT_DSP (0x3 << 0)
|
||||
#define DA7219_DAI_WORD_LENGTH_SHIFT 2
|
||||
#define DA7219_DAI_WORD_LENGTH_MASK (0x3 << 2)
|
||||
#define DA7219_DAI_WORD_LENGTH_S16_LE (0x0 << 2)
|
||||
#define DA7219_DAI_WORD_LENGTH_S20_LE (0x1 << 2)
|
||||
#define DA7219_DAI_WORD_LENGTH_S24_LE (0x2 << 2)
|
||||
#define DA7219_DAI_WORD_LENGTH_S32_LE (0x3 << 2)
|
||||
#define DA7219_DAI_CH_NUM_SHIFT 4
|
||||
#define DA7219_DAI_CH_NUM_MASK (0x3 << 4)
|
||||
#define DA7219_DAI_CH_NUM_MAX 2
|
||||
#define DA7219_DAI_EN_SHIFT 7
|
||||
#define DA7219_DAI_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_DAI_TDM_CTRL = 0x2D */
|
||||
#define DA7219_DAI_TDM_CH_EN_SHIFT 0
|
||||
#define DA7219_DAI_TDM_CH_EN_MASK (0x3 << 0)
|
||||
#define DA7219_DAI_OE_SHIFT 6
|
||||
#define DA7219_DAI_OE_MASK (0x1 << 6)
|
||||
#define DA7219_DAI_TDM_MODE_EN_SHIFT 7
|
||||
#define DA7219_DAI_TDM_MODE_EN_MASK (0x1 << 7)
|
||||
#define DA7219_DAI_TDM_MAX_SLOTS 2
|
||||
|
||||
/* DA7219_DIG_ROUTING_DAC = 0x2E */
|
||||
#define DA7219_DAC_L_SRC_SHIFT 0
|
||||
#define DA7219_DAC_L_SRC_MASK (0x3 << 0)
|
||||
#define DA7219_DAC_L_SRC_TONEGEN (0x1 << 0)
|
||||
#define DA7219_DAC_L_MONO_SHIFT 3
|
||||
#define DA7219_DAC_L_MONO_MASK (0x1 << 3)
|
||||
#define DA7219_DAC_R_SRC_SHIFT 4
|
||||
#define DA7219_DAC_R_SRC_MASK (0x3 << 4)
|
||||
#define DA7219_DAC_R_SRC_TONEGEN (0x1 << 4)
|
||||
#define DA7219_DAC_R_MONO_SHIFT 7
|
||||
#define DA7219_DAC_R_MONO_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_ALC_CTRL1 = 0x2F */
|
||||
#define DA7219_ALC_OFFSET_EN_SHIFT 0
|
||||
#define DA7219_ALC_OFFSET_EN_MASK (0x1 << 0)
|
||||
#define DA7219_ALC_SYNC_MODE_SHIFT 1
|
||||
#define DA7219_ALC_SYNC_MODE_MASK (0x1 << 1)
|
||||
#define DA7219_ALC_EN_SHIFT 3
|
||||
#define DA7219_ALC_EN_MASK (0x1 << 3)
|
||||
#define DA7219_ALC_AUTO_CALIB_EN_SHIFT 4
|
||||
#define DA7219_ALC_AUTO_CALIB_EN_MASK (0x1 << 4)
|
||||
#define DA7219_ALC_CALIB_OVERFLOW_SHIFT 5
|
||||
#define DA7219_ALC_CALIB_OVERFLOW_MASK (0x1 << 5)
|
||||
|
||||
/* DA7219_DAI_OFFSET_LOWER = 0x30 */
|
||||
#define DA7219_DAI_OFFSET_LOWER_SHIFT 0
|
||||
#define DA7219_DAI_OFFSET_LOWER_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_DAI_OFFSET_UPPER = 0x31 */
|
||||
#define DA7219_DAI_OFFSET_UPPER_SHIFT 0
|
||||
#define DA7219_DAI_OFFSET_UPPER_MASK (0x7 << 0)
|
||||
#define DA7219_DAI_OFFSET_MAX 0x2FF
|
||||
|
||||
/* DA7219_REFERENCES = 0x32 */
|
||||
#define DA7219_BIAS_EN_SHIFT 3
|
||||
#define DA7219_BIAS_EN_MASK (0x1 << 3)
|
||||
#define DA7219_VMID_FAST_CHARGE_SHIFT 4
|
||||
#define DA7219_VMID_FAST_CHARGE_MASK (0x1 << 4)
|
||||
|
||||
/* DA7219_MIXIN_L_SELECT = 0x33 */
|
||||
#define DA7219_MIXIN_L_MIX_SELECT_SHIFT 0
|
||||
#define DA7219_MIXIN_L_MIX_SELECT_MASK (0x1 << 0)
|
||||
|
||||
/* DA7219_MIXIN_L_GAIN = 0x34 */
|
||||
#define DA7219_MIXIN_L_AMP_GAIN_SHIFT 0
|
||||
#define DA7219_MIXIN_L_AMP_GAIN_MASK (0xF << 0)
|
||||
#define DA7219_MIXIN_L_AMP_GAIN_MAX 0xF
|
||||
|
||||
/* DA7219_ADC_L_GAIN = 0x36 */
|
||||
#define DA7219_ADC_L_DIGITAL_GAIN_SHIFT 0
|
||||
#define DA7219_ADC_L_DIGITAL_GAIN_MASK (0x7F << 0)
|
||||
#define DA7219_ADC_L_DIGITAL_GAIN_MAX 0x7F
|
||||
|
||||
/* DA7219_ADC_FILTERS1 = 0x38 */
|
||||
#define DA7219_ADC_VOICE_HPF_CORNER_SHIFT 0
|
||||
#define DA7219_ADC_VOICE_HPF_CORNER_MASK (0x7 << 0)
|
||||
#define DA7219_VOICE_HPF_CORNER_MAX 8
|
||||
#define DA7219_ADC_VOICE_EN_SHIFT 3
|
||||
#define DA7219_ADC_VOICE_EN_MASK (0x1 << 3)
|
||||
#define DA7219_ADC_AUDIO_HPF_CORNER_SHIFT 4
|
||||
#define DA7219_ADC_AUDIO_HPF_CORNER_MASK (0x3 << 4)
|
||||
#define DA7219_AUDIO_HPF_CORNER_MAX 4
|
||||
#define DA7219_ADC_HPF_EN_SHIFT 7
|
||||
#define DA7219_ADC_HPF_EN_MASK (0x1 << 7)
|
||||
#define DA7219_HPF_MODE_SHIFT 0
|
||||
#define DA7219_HPF_DISABLED ((0x0 << 3) | (0x0 << 7))
|
||||
#define DA7219_HPF_AUDIO_EN ((0x0 << 3) | (0x1 << 7))
|
||||
#define DA7219_HPF_VOICE_EN ((0x1 << 3) | (0x1 << 7))
|
||||
#define DA7219_HPF_MODE_MASK ((0x1 << 3) | (0x1 << 7))
|
||||
#define DA7219_HPF_MODE_MAX 3
|
||||
|
||||
/* DA7219_MIC_1_GAIN = 0x39 */
|
||||
#define DA7219_MIC_1_AMP_GAIN_SHIFT 0
|
||||
#define DA7219_MIC_1_AMP_GAIN_MASK (0x7 << 0)
|
||||
|
||||
/* DA7219_SIDETONE_CTRL = 0x3A */
|
||||
#define DA7219_SIDETONE_MUTE_EN_SHIFT 6
|
||||
#define DA7219_SIDETONE_MUTE_EN_MASK (0x1 << 6)
|
||||
#define DA7219_SIDETONE_EN_SHIFT 7
|
||||
#define DA7219_SIDETONE_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_SIDETONE_GAIN = 0x3B */
|
||||
#define DA7219_SIDETONE_GAIN_SHIFT 0
|
||||
#define DA7219_SIDETONE_GAIN_MASK (0xF << 0)
|
||||
#define DA7219_SIDETONE_GAIN_MAX 0xE
|
||||
|
||||
/* DA7219_DROUTING_ST_OUTFILT_1L = 0x3C */
|
||||
#define DA7219_OUTFILT_ST_1L_SRC_SHIFT 0
|
||||
#define DA7219_OUTFILT_ST_1L_SRC_MASK (0x7 << 0)
|
||||
#define DA7219_DMIX_ST_SRC_OUTFILT1L_SHIFT 0
|
||||
#define DA7219_DMIX_ST_SRC_OUTFILT1R_SHIFT 1
|
||||
#define DA7219_DMIX_ST_SRC_SIDETONE_SHIFT 2
|
||||
#define DA7219_DMIX_ST_SRC_OUTFILT1L (0x1 << 0)
|
||||
#define DA7219_DMIX_ST_SRC_OUTFILT1R (0x1 << 1)
|
||||
|
||||
/* DA7219_DROUTING_ST_OUTFILT_1R = 0x3D */
|
||||
#define DA7219_OUTFILT_ST_1R_SRC_SHIFT 0
|
||||
#define DA7219_OUTFILT_ST_1R_SRC_MASK (0x7 << 0)
|
||||
|
||||
/* DA7219_DAC_FILTERS5 = 0x40 */
|
||||
#define DA7219_DAC_SOFTMUTE_RATE_SHIFT 4
|
||||
#define DA7219_DAC_SOFTMUTE_RATE_MASK (0x7 << 4)
|
||||
#define DA7219_DAC_SOFTMUTE_RATE_MAX 7
|
||||
#define DA7219_DAC_SOFTMUTE_EN_SHIFT 7
|
||||
#define DA7219_DAC_SOFTMUTE_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_DAC_FILTERS2 = 0x41 */
|
||||
#define DA7219_DAC_EQ_BAND1_SHIFT 0
|
||||
#define DA7219_DAC_EQ_BAND1_MASK (0xF << 0)
|
||||
#define DA7219_DAC_EQ_BAND2_SHIFT 4
|
||||
#define DA7219_DAC_EQ_BAND2_MASK (0xF << 4)
|
||||
#define DA7219_DAC_EQ_BAND_MAX 0xF
|
||||
|
||||
/* DA7219_DAC_FILTERS3 = 0x42 */
|
||||
#define DA7219_DAC_EQ_BAND3_SHIFT 0
|
||||
#define DA7219_DAC_EQ_BAND3_MASK (0xF << 0)
|
||||
#define DA7219_DAC_EQ_BAND4_SHIFT 4
|
||||
#define DA7219_DAC_EQ_BAND4_MASK (0xF << 4)
|
||||
|
||||
/* DA7219_DAC_FILTERS4 = 0x43 */
|
||||
#define DA7219_DAC_EQ_BAND5_SHIFT 0
|
||||
#define DA7219_DAC_EQ_BAND5_MASK (0xF << 0)
|
||||
#define DA7219_DAC_EQ_EN_SHIFT 7
|
||||
#define DA7219_DAC_EQ_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_DAC_FILTERS1 = 0x44 */
|
||||
#define DA7219_DAC_VOICE_HPF_CORNER_SHIFT 0
|
||||
#define DA7219_DAC_VOICE_HPF_CORNER_MASK (0x7 << 0)
|
||||
#define DA7219_DAC_VOICE_EN_SHIFT 3
|
||||
#define DA7219_DAC_VOICE_EN_MASK (0x1 << 3)
|
||||
#define DA7219_DAC_AUDIO_HPF_CORNER_SHIFT 4
|
||||
#define DA7219_DAC_AUDIO_HPF_CORNER_MASK (0x3 << 4)
|
||||
#define DA7219_DAC_HPF_EN_SHIFT 7
|
||||
#define DA7219_DAC_HPF_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_DAC_L_GAIN = 0x45 */
|
||||
#define DA7219_DAC_L_DIGITAL_GAIN_SHIFT 0
|
||||
#define DA7219_DAC_L_DIGITAL_GAIN_MASK (0x7F << 0)
|
||||
#define DA7219_DAC_DIGITAL_GAIN_MAX 0x7F
|
||||
#define DA7219_DAC_DIGITAL_GAIN_0DB (0x6F << 0)
|
||||
|
||||
/* DA7219_DAC_R_GAIN = 0x46 */
|
||||
#define DA7219_DAC_R_DIGITAL_GAIN_SHIFT 0
|
||||
#define DA7219_DAC_R_DIGITAL_GAIN_MASK (0x7F << 0)
|
||||
|
||||
/* DA7219_CP_CTRL = 0x47 */
|
||||
#define DA7219_CP_MCHANGE_SHIFT 4
|
||||
#define DA7219_CP_MCHANGE_MASK (0x3 << 4)
|
||||
#define DA7219_CP_MCHANGE_REL_MASK 0x3
|
||||
#define DA7219_CP_MCHANGE_MAX 3
|
||||
#define DA7219_CP_MCHANGE_LARGEST_VOL 0x1
|
||||
#define DA7219_CP_MCHANGE_DAC_VOL 0x2
|
||||
#define DA7219_CP_MCHANGE_SIG_MAG 0x3
|
||||
#define DA7219_CP_EN_SHIFT 7
|
||||
#define DA7219_CP_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_HP_L_GAIN = 0x48 */
|
||||
#define DA7219_HP_L_AMP_GAIN_SHIFT 0
|
||||
#define DA7219_HP_L_AMP_GAIN_MASK (0x3F << 0)
|
||||
#define DA7219_HP_AMP_GAIN_MAX 0x3F
|
||||
#define DA7219_HP_AMP_GAIN_0DB (0x39 << 0)
|
||||
|
||||
/* DA7219_HP_R_GAIN = 0x49 */
|
||||
#define DA7219_HP_R_AMP_GAIN_SHIFT 0
|
||||
#define DA7219_HP_R_AMP_GAIN_MASK (0x3F << 0)
|
||||
|
||||
/* DA7219_MIXOUT_L_SELECT = 0x4B */
|
||||
#define DA7219_MIXOUT_L_MIX_SELECT_SHIFT 0
|
||||
#define DA7219_MIXOUT_L_MIX_SELECT_MASK (0x1 << 0)
|
||||
|
||||
/* DA7219_MIXOUT_R_SELECT = 0x4C */
|
||||
#define DA7219_MIXOUT_R_MIX_SELECT_SHIFT 0
|
||||
#define DA7219_MIXOUT_R_MIX_SELECT_MASK (0x1 << 0)
|
||||
|
||||
/* DA7219_SYSTEM_MODES_INPUT = 0x50 */
|
||||
#define DA7219_MODE_SUBMIT_SHIFT 0
|
||||
#define DA7219_MODE_SUBMIT_MASK (0x1 << 0)
|
||||
#define DA7219_ADC_MODE_SHIFT 1
|
||||
#define DA7219_ADC_MODE_MASK (0x7F << 1)
|
||||
|
||||
/* DA7219_SYSTEM_MODES_OUTPUT = 0x51 */
|
||||
#define DA7219_MODE_SUBMIT_SHIFT 0
|
||||
#define DA7219_MODE_SUBMIT_MASK (0x1 << 0)
|
||||
#define DA7219_DAC_MODE_SHIFT 1
|
||||
#define DA7219_DAC_MODE_MASK (0x7F << 1)
|
||||
|
||||
/* DA7219_MICBIAS_CTRL = 0x62 */
|
||||
#define DA7219_MICBIAS1_LEVEL_SHIFT 0
|
||||
#define DA7219_MICBIAS1_LEVEL_MASK (0x7 << 0)
|
||||
#define DA7219_MICBIAS1_EN_SHIFT 3
|
||||
#define DA7219_MICBIAS1_EN_MASK (0x1 << 3)
|
||||
|
||||
/* DA7219_MIC_1_CTRL = 0x63 */
|
||||
#define DA7219_MIC_1_AMP_RAMP_EN_SHIFT 5
|
||||
#define DA7219_MIC_1_AMP_RAMP_EN_MASK (0x1 << 5)
|
||||
#define DA7219_MIC_1_AMP_MUTE_EN_SHIFT 6
|
||||
#define DA7219_MIC_1_AMP_MUTE_EN_MASK (0x1 << 6)
|
||||
#define DA7219_MIC_1_AMP_EN_SHIFT 7
|
||||
#define DA7219_MIC_1_AMP_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_MIXIN_L_CTRL = 0x65 */
|
||||
#define DA7219_MIXIN_L_MIX_EN_SHIFT 3
|
||||
#define DA7219_MIXIN_L_MIX_EN_MASK (0x1 << 3)
|
||||
#define DA7219_MIXIN_L_AMP_ZC_EN_SHIFT 4
|
||||
#define DA7219_MIXIN_L_AMP_ZC_EN_MASK (0x1 << 4)
|
||||
#define DA7219_MIXIN_L_AMP_RAMP_EN_SHIFT 5
|
||||
#define DA7219_MIXIN_L_AMP_RAMP_EN_MASK (0x1 << 5)
|
||||
#define DA7219_MIXIN_L_AMP_MUTE_EN_SHIFT 6
|
||||
#define DA7219_MIXIN_L_AMP_MUTE_EN_MASK (0x1 << 6)
|
||||
#define DA7219_MIXIN_L_AMP_EN_SHIFT 7
|
||||
#define DA7219_MIXIN_L_AMP_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_ADC_L_CTRL = 0x67 */
|
||||
#define DA7219_ADC_L_BIAS_SHIFT 0
|
||||
#define DA7219_ADC_L_BIAS_MASK (0x3 << 0)
|
||||
#define DA7219_ADC_L_RAMP_EN_SHIFT 5
|
||||
#define DA7219_ADC_L_RAMP_EN_MASK (0x1 << 5)
|
||||
#define DA7219_ADC_L_MUTE_EN_SHIFT 6
|
||||
#define DA7219_ADC_L_MUTE_EN_MASK (0x1 << 6)
|
||||
#define DA7219_ADC_L_EN_SHIFT 7
|
||||
#define DA7219_ADC_L_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_DAC_L_CTRL = 0x69 */
|
||||
#define DA7219_DAC_L_RAMP_EN_SHIFT 5
|
||||
#define DA7219_DAC_L_RAMP_EN_MASK (0x1 << 5)
|
||||
#define DA7219_DAC_L_MUTE_EN_SHIFT 6
|
||||
#define DA7219_DAC_L_MUTE_EN_MASK (0x1 << 6)
|
||||
#define DA7219_DAC_L_EN_SHIFT 7
|
||||
#define DA7219_DAC_L_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_DAC_R_CTRL = 0x6A */
|
||||
#define DA7219_DAC_R_RAMP_EN_SHIFT 5
|
||||
#define DA7219_DAC_R_RAMP_EN_MASK (0x1 << 5)
|
||||
#define DA7219_DAC_R_MUTE_EN_SHIFT 6
|
||||
#define DA7219_DAC_R_MUTE_EN_MASK (0x1 << 6)
|
||||
#define DA7219_DAC_R_EN_SHIFT 7
|
||||
#define DA7219_DAC_R_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_HP_L_CTRL = 0x6B */
|
||||
#define DA7219_HP_L_AMP_MIN_GAIN_EN_SHIFT 2
|
||||
#define DA7219_HP_L_AMP_MIN_GAIN_EN_MASK (0x1 << 2)
|
||||
#define DA7219_HP_L_AMP_OE_SHIFT 3
|
||||
#define DA7219_HP_L_AMP_OE_MASK (0x1 << 3)
|
||||
#define DA7219_HP_L_AMP_ZC_EN_SHIFT 4
|
||||
#define DA7219_HP_L_AMP_ZC_EN_MASK (0x1 << 4)
|
||||
#define DA7219_HP_L_AMP_RAMP_EN_SHIFT 5
|
||||
#define DA7219_HP_L_AMP_RAMP_EN_MASK (0x1 << 5)
|
||||
#define DA7219_HP_L_AMP_MUTE_EN_SHIFT 6
|
||||
#define DA7219_HP_L_AMP_MUTE_EN_MASK (0x1 << 6)
|
||||
#define DA7219_HP_L_AMP_EN_SHIFT 7
|
||||
#define DA7219_HP_L_AMP_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_HP_R_CTRL = 0x6C */
|
||||
#define DA7219_HP_R_AMP_MIN_GAIN_EN_SHIFT 2
|
||||
#define DA7219_HP_R_AMP_MIN_GAIN_EN_MASK (0x1 << 2)
|
||||
#define DA7219_HP_R_AMP_OE_SHIFT 3
|
||||
#define DA7219_HP_R_AMP_OE_MASK (0x1 << 3)
|
||||
#define DA7219_HP_R_AMP_ZC_EN_SHIFT 4
|
||||
#define DA7219_HP_R_AMP_ZC_EN_MASK (0x1 << 4)
|
||||
#define DA7219_HP_R_AMP_RAMP_EN_SHIFT 5
|
||||
#define DA7219_HP_R_AMP_RAMP_EN_MASK (0x1 << 5)
|
||||
#define DA7219_HP_R_AMP_MUTE_EN_SHIFT 6
|
||||
#define DA7219_HP_R_AMP_MUTE_EN_MASK (0x1 << 6)
|
||||
#define DA7219_HP_R_AMP_EN_SHIFT 7
|
||||
#define DA7219_HP_R_AMP_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_MIXOUT_L_CTRL = 0x6E */
|
||||
#define DA7219_MIXOUT_L_AMP_EN_SHIFT 7
|
||||
#define DA7219_MIXOUT_L_AMP_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_MIXOUT_R_CTRL = 0x6F */
|
||||
#define DA7219_MIXOUT_R_AMP_EN_SHIFT 7
|
||||
#define DA7219_MIXOUT_R_AMP_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_CHIP_ID1 = 0x81 */
|
||||
#define DA7219_CHIP_ID1_SHIFT 0
|
||||
#define DA7219_CHIP_ID1_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_CHIP_ID2 = 0x82 */
|
||||
#define DA7219_CHIP_ID2_SHIFT 0
|
||||
#define DA7219_CHIP_ID2_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_CHIP_REVISION = 0x83 */
|
||||
#define DA7219_CHIP_MINOR_SHIFT 0
|
||||
#define DA7219_CHIP_MINOR_MASK (0xF << 0)
|
||||
#define DA7219_CHIP_MAJOR_SHIFT 4
|
||||
#define DA7219_CHIP_MAJOR_MASK (0xF << 4)
|
||||
|
||||
/* DA7219_LDO_CTRL = 0x90 */
|
||||
#define DA7219_LDO_LEVEL_SELECT_SHIFT 4
|
||||
#define DA7219_LDO_LEVEL_SELECT_MASK (0x3 << 4)
|
||||
#define DA7219_LDO_EN_SHIFT 7
|
||||
#define DA7219_LDO_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_IO_CTRL = 0x91 */
|
||||
#define DA7219_IO_VOLTAGE_LEVEL_SHIFT 0
|
||||
#define DA7219_IO_VOLTAGE_LEVEL_MASK (0x1 << 0)
|
||||
#define DA7219_IO_VOLTAGE_LEVEL_2_5V_3_6V 0
|
||||
#define DA7219_IO_VOLTAGE_LEVEL_1_2V_2_8V 1
|
||||
|
||||
/* DA7219_GAIN_RAMP_CTRL = 0x92 */
|
||||
#define DA7219_GAIN_RAMP_RATE_SHIFT 0
|
||||
#define DA7219_GAIN_RAMP_RATE_MASK (0x3 << 0)
|
||||
#define DA7219_GAIN_RAMP_RATE_MAX 4
|
||||
|
||||
/* DA7219_PC_COUNT = 0x94 */
|
||||
#define DA7219_PC_FREERUN_SHIFT 0
|
||||
#define DA7219_PC_FREERUN_MASK (0x1 << 0)
|
||||
#define DA7219_PC_RESYNC_AUTO_SHIFT 1
|
||||
#define DA7219_PC_RESYNC_AUTO_MASK (0x1 << 1)
|
||||
|
||||
/* DA7219_CP_VOL_THRESHOLD1 = 0x95 */
|
||||
#define DA7219_CP_THRESH_VDD2_SHIFT 0
|
||||
#define DA7219_CP_THRESH_VDD2_MASK (0x3F << 0)
|
||||
#define DA7219_CP_THRESH_VDD2_MAX 0x3F
|
||||
|
||||
/* DA7219_DIG_CTRL = 0x99 */
|
||||
#define DA7219_DAC_L_INV_SHIFT 3
|
||||
#define DA7219_DAC_L_INV_MASK (0x1 << 3)
|
||||
#define DA7219_DAC_R_INV_SHIFT 7
|
||||
#define DA7219_DAC_R_INV_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_ALC_CTRL2 = 0x9A */
|
||||
#define DA7219_ALC_ATTACK_SHIFT 0
|
||||
#define DA7219_ALC_ATTACK_MASK (0xF << 0)
|
||||
#define DA7219_ALC_ATTACK_MAX 13
|
||||
#define DA7219_ALC_RELEASE_SHIFT 4
|
||||
#define DA7219_ALC_RELEASE_MASK (0xF << 4)
|
||||
#define DA7219_ALC_RELEASE_MAX 11
|
||||
|
||||
/* DA7219_ALC_CTRL3 = 0x9B */
|
||||
#define DA7219_ALC_HOLD_SHIFT 0
|
||||
#define DA7219_ALC_HOLD_MASK (0xF << 0)
|
||||
#define DA7219_ALC_HOLD_MAX 16
|
||||
#define DA7219_ALC_INTEG_ATTACK_SHIFT 4
|
||||
#define DA7219_ALC_INTEG_ATTACK_MASK (0x3 << 4)
|
||||
#define DA7219_ALC_INTEG_RELEASE_SHIFT 6
|
||||
#define DA7219_ALC_INTEG_RELEASE_MASK (0x3 << 6)
|
||||
#define DA7219_ALC_INTEG_MAX 4
|
||||
|
||||
/* DA7219_ALC_NOISE = 0x9C */
|
||||
#define DA7219_ALC_NOISE_SHIFT 0
|
||||
#define DA7219_ALC_NOISE_MASK (0x3F << 0)
|
||||
#define DA7219_ALC_THRESHOLD_MAX 0x3F
|
||||
|
||||
/* DA7219_ALC_TARGET_MIN = 0x9D */
|
||||
#define DA7219_ALC_THRESHOLD_MIN_SHIFT 0
|
||||
#define DA7219_ALC_THRESHOLD_MIN_MASK (0x3F << 0)
|
||||
|
||||
/* DA7219_ALC_TARGET_MAX = 0x9E */
|
||||
#define DA7219_ALC_THRESHOLD_MAX_SHIFT 0
|
||||
#define DA7219_ALC_THRESHOLD_MAX_MASK (0x3F << 0)
|
||||
|
||||
/* DA7219_ALC_GAIN_LIMITS = 0x9F */
|
||||
#define DA7219_ALC_ATTEN_MAX_SHIFT 0
|
||||
#define DA7219_ALC_ATTEN_MAX_MASK (0xF << 0)
|
||||
#define DA7219_ALC_GAIN_MAX_SHIFT 4
|
||||
#define DA7219_ALC_GAIN_MAX_MASK (0xF << 4)
|
||||
#define DA7219_ALC_ATTEN_GAIN_MAX 0xF
|
||||
|
||||
/* DA7219_ALC_ANA_GAIN_LIMITS = 0xA0 */
|
||||
#define DA7219_ALC_ANA_GAIN_MIN_SHIFT 0
|
||||
#define DA7219_ALC_ANA_GAIN_MIN_MASK (0x7 << 0)
|
||||
#define DA7219_ALC_ANA_GAIN_MIN 0x1
|
||||
#define DA7219_ALC_ANA_GAIN_MAX_SHIFT 4
|
||||
#define DA7219_ALC_ANA_GAIN_MAX_MASK (0x7 << 4)
|
||||
#define DA7219_ALC_ANA_GAIN_MAX 0x7
|
||||
|
||||
/* DA7219_ALC_ANTICLIP_CTRL = 0xA1 */
|
||||
#define DA7219_ALC_ANTICLIP_STEP_SHIFT 0
|
||||
#define DA7219_ALC_ANTICLIP_STEP_MASK (0x3 << 0)
|
||||
#define DA7219_ALC_ANTICLIP_STEP_MAX 4
|
||||
#define DA7219_ALC_ANTIPCLIP_EN_SHIFT 7
|
||||
#define DA7219_ALC_ANTIPCLIP_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_ALC_ANTICLIP_LEVEL = 0xA2 */
|
||||
#define DA7219_ALC_ANTICLIP_LEVEL_SHIFT 0
|
||||
#define DA7219_ALC_ANTICLIP_LEVEL_MASK (0x7F << 0)
|
||||
|
||||
/* DA7219_ALC_OFFSET_AUTO_M_L = 0xA3 */
|
||||
#define DA7219_ALC_OFFSET_AUTO_M_L_SHIFT 0
|
||||
#define DA7219_ALC_OFFSET_AUTO_M_L_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_ALC_OFFSET_AUTO_U_L = 0xA4 */
|
||||
#define DA7219_ALC_OFFSET_AUTO_U_L_SHIFT 0
|
||||
#define DA7219_ALC_OFFSET_AUTO_U_L_MASK (0xF << 0)
|
||||
|
||||
/* DA7219_DAC_NG_SETUP_TIME = 0xAF */
|
||||
#define DA7219_DAC_NG_SETUP_TIME_SHIFT 0
|
||||
#define DA7219_DAC_NG_SETUP_TIME_MASK (0x3 << 0)
|
||||
#define DA7219_DAC_NG_SETUP_TIME_MAX 4
|
||||
#define DA7219_DAC_NG_RAMPUP_RATE_SHIFT 2
|
||||
#define DA7219_DAC_NG_RAMPUP_RATE_MASK (0x1 << 2)
|
||||
#define DA7219_DAC_NG_RAMPDN_RATE_SHIFT 3
|
||||
#define DA7219_DAC_NG_RAMPDN_RATE_MASK (0x1 << 3)
|
||||
#define DA7219_DAC_NG_RAMP_RATE_MAX 2
|
||||
|
||||
/* DA7219_DAC_NG_OFF_THRESH = 0xB0 */
|
||||
#define DA7219_DAC_NG_OFF_THRESHOLD_SHIFT 0
|
||||
#define DA7219_DAC_NG_OFF_THRESHOLD_MASK (0x7 << 0)
|
||||
#define DA7219_DAC_NG_THRESHOLD_MAX 0x7
|
||||
|
||||
/* DA7219_DAC_NG_ON_THRESH = 0xB1 */
|
||||
#define DA7219_DAC_NG_ON_THRESHOLD_SHIFT 0
|
||||
#define DA7219_DAC_NG_ON_THRESHOLD_MASK (0x7 << 0)
|
||||
|
||||
/* DA7219_DAC_NG_CTRL = 0xB2 */
|
||||
#define DA7219_DAC_NG_EN_SHIFT 7
|
||||
#define DA7219_DAC_NG_EN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_TONE_GEN_CFG1 = 0xB4 */
|
||||
#define DA7219_DTMF_REG_SHIFT 0
|
||||
#define DA7219_DTMF_REG_MASK (0xF << 0)
|
||||
#define DA7219_DTMF_REG_MAX 16
|
||||
#define DA7219_DTMF_EN_SHIFT 4
|
||||
#define DA7219_DTMF_EN_MASK (0x1 << 4)
|
||||
#define DA7219_START_STOPN_SHIFT 7
|
||||
#define DA7219_START_STOPN_MASK (0x1 << 7)
|
||||
|
||||
/* DA7219_TONE_GEN_CFG2 = 0xB5 */
|
||||
#define DA7219_SWG_SEL_SHIFT 0
|
||||
#define DA7219_SWG_SEL_MASK (0x3 << 0)
|
||||
#define DA7219_SWG_SEL_MAX 4
|
||||
#define DA7219_SWG_SEL_SRAMP (0x3 << 0)
|
||||
#define DA7219_TONE_GEN_GAIN_SHIFT 4
|
||||
#define DA7219_TONE_GEN_GAIN_MASK (0xF << 4)
|
||||
#define DA7219_TONE_GEN_GAIN_MAX 0xF
|
||||
#define DA7219_TONE_GEN_GAIN_MINUS_9DB (0x3 << 4)
|
||||
#define DA7219_TONE_GEN_GAIN_MINUS_15DB (0x5 << 4)
|
||||
|
||||
/* DA7219_TONE_GEN_CYCLES = 0xB6 */
|
||||
#define DA7219_BEEP_CYCLES_SHIFT 0
|
||||
#define DA7219_BEEP_CYCLES_MASK (0x7 << 0)
|
||||
|
||||
/* DA7219_TONE_GEN_FREQ1_L = 0xB7 */
|
||||
#define DA7219_FREQ1_L_SHIFT 0
|
||||
#define DA7219_FREQ1_L_MASK (0xFF << 0)
|
||||
#define DA7219_FREQ_MAX 0xFFFF
|
||||
|
||||
/* DA7219_TONE_GEN_FREQ1_U = 0xB8 */
|
||||
#define DA7219_FREQ1_U_SHIFT 0
|
||||
#define DA7219_FREQ1_U_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_TONE_GEN_FREQ2_L = 0xB9 */
|
||||
#define DA7219_FREQ2_L_SHIFT 0
|
||||
#define DA7219_FREQ2_L_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_TONE_GEN_FREQ2_U = 0xBA */
|
||||
#define DA7219_FREQ2_U_SHIFT 0
|
||||
#define DA7219_FREQ2_U_MASK (0xFF << 0)
|
||||
|
||||
/* DA7219_TONE_GEN_ON_PER = 0xBB */
|
||||
#define DA7219_BEEP_ON_PER_SHIFT 0
|
||||
#define DA7219_BEEP_ON_PER_MASK (0x3F << 0)
|
||||
#define DA7219_BEEP_ON_OFF_MAX 0x3F
|
||||
|
||||
/* DA7219_TONE_GEN_OFF_PER = 0xBC */
|
||||
#define DA7219_BEEP_OFF_PER_SHIFT 0
|
||||
#define DA7219_BEEP_OFF_PER_MASK (0x3F << 0)
|
||||
|
||||
/* DA7219_SYSTEM_STATUS = 0xE0 */
|
||||
#define DA7219_SC1_BUSY_SHIFT 0
|
||||
#define DA7219_SC1_BUSY_MASK (0x1 << 0)
|
||||
#define DA7219_SC2_BUSY_SHIFT 1
|
||||
#define DA7219_SC2_BUSY_MASK (0x1 << 1)
|
||||
|
||||
/* DA7219_SYSTEM_ACTIVE = 0xFD */
|
||||
#define DA7219_SYSTEM_ACTIVE_SHIFT 0
|
||||
#define DA7219_SYSTEM_ACTIVE_MASK (0x1 << 0)
|
||||
|
||||
|
||||
/*
|
||||
* General defines & data
|
||||
*/
|
||||
|
||||
/* Register inversion */
|
||||
#define DA7219_NO_INVERT 0
|
||||
#define DA7219_INVERT 1
|
||||
|
||||
/* Byte related defines */
|
||||
#define DA7219_BYTE_SHIFT 8
|
||||
#define DA7219_BYTE_MASK 0xFF
|
||||
|
||||
/* PLL Output Frequencies */
|
||||
#define DA7219_PLL_FREQ_OUT_90316 90316800
|
||||
#define DA7219_PLL_FREQ_OUT_98304 98304000
|
||||
|
||||
/* PLL Frequency Dividers */
|
||||
#define DA7219_PLL_INDIV_2_5_MHZ_VAL 1
|
||||
#define DA7219_PLL_INDIV_5_10_MHZ_VAL 2
|
||||
#define DA7219_PLL_INDIV_10_20_MHZ_VAL 4
|
||||
#define DA7219_PLL_INDIV_20_40_MHZ_VAL 8
|
||||
#define DA7219_PLL_INDIV_40_54_MHZ_VAL 16
|
||||
|
||||
/* SRM */
|
||||
#define DA7219_SRM_CHECK_RETRIES 8
|
||||
|
||||
enum da7219_clk_src {
|
||||
DA7219_CLKSRC_MCLK = 0,
|
||||
DA7219_CLKSRC_MCLK_SQR,
|
||||
};
|
||||
|
||||
enum da7219_sys_clk {
|
||||
DA7219_SYSCLK_MCLK = 0,
|
||||
DA7219_SYSCLK_PLL,
|
||||
DA7219_SYSCLK_PLL_SRM,
|
||||
DA7219_SYSCLK_PLL_32KHZ
|
||||
};
|
||||
|
||||
/* Regulators */
|
||||
enum da7219_supplies {
|
||||
DA7219_SUPPLY_VDD = 0,
|
||||
DA7219_SUPPLY_VDDMIC,
|
||||
DA7219_SUPPLY_VDDIO,
|
||||
DA7219_NUM_SUPPLIES,
|
||||
};
|
||||
|
||||
struct da7219_aad_priv;
|
||||
|
||||
/* Private data */
|
||||
struct da7219_priv {
|
||||
struct da7219_aad_priv *aad;
|
||||
struct da7219_pdata *pdata;
|
||||
|
||||
struct regulator_bulk_data supplies[DA7219_NUM_SUPPLIES];
|
||||
struct regmap *regmap;
|
||||
struct mutex lock;
|
||||
|
||||
struct clk *mclk;
|
||||
unsigned int mclk_rate;
|
||||
int clk_src;
|
||||
|
||||
bool master;
|
||||
bool alc_en;
|
||||
};
|
||||
|
||||
#endif /* __DA7219_H */
|
Loading…
Reference in New Issue
Block a user