From 6fc82557251cd84e165affd5cfe2d41cad0745f2 Mon Sep 17 00:00:00 2001 From: Tracy Yi Date: Thu, 3 Jan 2019 17:38:41 +0800 Subject: [PATCH] Add Boost OPT, and system mute function Signed-off-by: Tracy Yi --- tas2562-codec.c | 122 +++++++++++++++++++++++++++++++++++++++++------ tas2562-regmap.c | 9 ++-- tas2562.h | 106 ++++++++++++++++++++++++---------------- 3 files changed, 176 insertions(+), 61 deletions(-) diff --git a/tas2562-codec.c b/tas2562-codec.c index 2efdc07..9e1a87a 100644 --- a/tas2562-codec.c +++ b/tas2562-codec.c @@ -44,18 +44,42 @@ #include "tas2562.h" - #define TAS2562_MDELAY 0xFFFFFFFE -/* #define KCONTROL_CODEC */ +#define TAS2562_MSLEEP 0xFFFFFFFD static char pICN[] = {0x00, 0x03, 0x46, 0xdc}; static char const *iv_enable_text[] = {"Off", "On"}; static int tas2562iv_enable; +static int mbMute; static const struct soc_enum tas2562_enum[] = { SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(iv_enable_text), iv_enable_text), }; static int tas2562_set_fmt(struct tas2562_priv *pTAS2562, unsigned int fmt); +static int tas2562_i2c_load_data(struct tas2562_priv *pTAS2562, unsigned int *pData); +static int tas2562_mute_ctrl_get(struct snd_kcontrol *pKcontrol, + struct snd_ctl_elem_value *pValue); +static int tas2562_mute_ctrl_put(struct snd_kcontrol *pKcontrol, + struct snd_ctl_elem_value *pValue); + +static unsigned int p_tas2562_classH_D_data[] = { + /* reg address size values */ + TAS2562_ClassHHeadroom, 0x4, 0x09, 0x99, 0x99, 0x9a, + TAS2562_ClassHHysteresis, 0x4, 0x0, 0x0, 0x0, 0x0, + TAS2562_ClassHMtct, 0x4, 0xb, 0x0, 0x0, 0x0, + TAS2562_VBatFilter, 0x1, 0x38, + TAS2562_ClassHReleaseTimer, 0x1, 0x3c, + TAS2562_BoostSlope, 0x1, 0x78, + TAS2562_TestPageConfiguration, 0x1, 0xd, + TAS2562_ClassDConfiguration3, 0x1, 0x8e, + TAS2562_ClassDConfiguration2, 0x1, 0x49, + TAS2562_ClassDConfiguration4, 0x1, 0x21, + TAS2562_ClassDConfiguration1, 0x1, 0x80, + TAS2562_EfficiencyConfiguration, 0x1, 0xc1, + 0xFFFFFFFF, 0xFFFFFFFF +}; + + static unsigned int tas2562_codec_read(struct snd_soc_codec *codec, unsigned int reg) { @@ -63,9 +87,7 @@ static unsigned int tas2562_codec_read(struct snd_soc_codec *codec, int nResult = 0; unsigned int value = 0; - mutex_lock(&pTAS2562->dev_lock); - - nResult = regmap_read(pTAS2562->regmap, reg, &value); + nResult = pTAS2562->read(pTAS2562, reg, &value); if (nResult < 0) dev_err(pTAS2562->dev, "%s, ERROR, reg=0x%x, E=%d\n", @@ -74,8 +96,6 @@ static unsigned int tas2562_codec_read(struct snd_soc_codec *codec, dev_dbg(pTAS2562->dev, "%s, reg: 0x%x, value: 0x%x\n", __func__, reg, value); - mutex_unlock(&pTAS2562->dev_lock); - if (nResult >= 0) return value; else @@ -146,9 +166,7 @@ static int tas2562_codec_write(struct snd_soc_codec *codec, unsigned int reg, int nResult = 0; - mutex_lock(&pTAS2562->dev_lock); - - nResult = regmap_write(pTAS2562->regmap, reg, value); + nResult = pTAS2562->write(pTAS2562, reg, value); if (nResult < 0) dev_err(pTAS2562->dev, "%s, ERROR, reg=0x%x, E=%d\n", __func__, reg, nResult); @@ -156,13 +174,59 @@ static int tas2562_codec_write(struct snd_soc_codec *codec, unsigned int reg, dev_dbg(pTAS2562->dev, "%s, reg: 0x%x, 0x%x\n", __func__, reg, value); - mutex_unlock(&pTAS2562->dev_lock); - return nResult; } - - +static int tas2562_i2c_load_data(struct tas2562_priv *pTAS2562, unsigned int *pData) +{ + unsigned int nRegister; + unsigned int *nData; + unsigned char Buf[128]; + unsigned int nLength = 0; + unsigned int i = 0; + unsigned int nSize = 0; + int nResult = 0; + do { + nRegister = pData[nLength]; + nSize = pData[nLength + 1]; + nData = &pData[nLength + 2]; + if (nRegister == TAS2562_MSLEEP) { + msleep(nData[0]); + dev_dbg(pTAS2562->dev, "%s, msleep = %d\n", + __func__, nData[0]); + } else if (nRegister == TAS2562_MDELAY) { + mdelay(nData[0]); + dev_dbg(pTAS2562->dev, "%s, mdelay = %d\n", + __func__, nData[0]); + } else { + if (nRegister != 0xFFFFFFFF) { + if (nSize > 128) { + dev_err(pTAS2562->dev, + "%s, Line=%d, invalid size, maximum is 128 bytes!\n", + __func__, __LINE__); + break; + } + if (nSize > 1) { + for (i = 0; i < nSize; i++) + Buf[i] = (unsigned char)nData[i]; + nResult = pTAS2562->bulk_write(pTAS2562, nRegister, Buf, nSize); + if (nResult < 0) + break; + } else if (nSize == 1) { + nResult = pTAS2562->write(pTAS2562, nRegister, nData[0]); + if (nResult < 0) + break; + } else { + dev_err(pTAS2562->dev, + "%s, Line=%d,invalid size, minimum is 1 bytes!\n", + __func__, __LINE__); + } + } + } + nLength = nLength + 2 + pData[nLength + 1]; + } while (nRegister != 0xFFFFFFFF); + return nResult; +} static int tas2562_codec_suspend(struct snd_soc_codec *codec) { struct tas2562_priv *pTAS2562 = snd_soc_codec_get_drvdata(codec); @@ -205,6 +269,8 @@ static int tas2562_set_power_state(struct tas2562_priv *pTAS2562, int state) int nResult = 0; /*unsigned int nValue;*/ + if ((pTAS2562->mbMute) && (state == TAS2562_POWER_ACTIVE)) + state = TAS2562_POWER_MUTE; dev_err(pTAS2562->dev, "set power state: %d\n", state); switch (state) { @@ -505,8 +571,33 @@ static int tas2562_set_samplerate(struct tas2562_priv *pTAS2562, int samplerate) pTAS2562->mnSamplingRate = samplerate; return 0; } +static int tas2562_mute_ctrl_get(struct snd_kcontrol *pKcontrol, + struct snd_ctl_elem_value *pValue) +{ + struct snd_soc_codec *codec = snd_soc_kcontrol_codec(pKcontrol); + struct tas2562_priv *pTAS2562 = snd_soc_codec_get_drvdata(codec); + + pValue->value.integer.value[0] = pTAS2562->mbMute; + dev_dbg(pTAS2562->dev, "tas2562_mute_ctrl_get = %d\n", + pTAS2562->mbMute); + + return 0; +} +static int tas2562_mute_ctrl_put(struct snd_kcontrol *pKcontrol, + struct snd_ctl_elem_value *pValue) +{ + struct snd_soc_codec *codec = snd_soc_kcontrol_codec(pKcontrol); + struct tas2562_priv *pTAS2562 = snd_soc_codec_get_drvdata(codec); + + mbMute = pValue->value.integer.value[0]; + + dev_dbg(pTAS2562->dev, "tas2562_mute_ctrl_put = %d\n", mbMute); + pTAS2562->mbMute = !!mbMute; + + return 0; +} static int tas2562_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, @@ -687,6 +778,7 @@ static int tas2562_codec_probe(struct snd_soc_codec *codec) pTAS2562->codec = codec; dev_err(pTAS2562->dev, "%s\n", __func__); + tas2562_i2c_load_data(pTAS2562, p_tas2562_classH_D_data); return 0; } @@ -701,6 +793,8 @@ static const struct snd_kcontrol_new tas2562_snd_controls[] = { SOC_SINGLE_TLV("Amp Output Level", TAS2562_PlaybackConfigurationReg0, 0, 0x16, 0, tas2562_digital_tlv), + SOC_SINGLE_EXT("SmartPA Mute", SND_SOC_NOPM, 0, 0x0001, 0, + tas2562_mute_ctrl_get, tas2562_mute_ctrl_put), }; static struct snd_soc_codec_driver soc_codec_driver_tas2562 = { diff --git a/tas2562-regmap.c b/tas2562-regmap.c index cb293c5..b64941a 100644 --- a/tas2562-regmap.c +++ b/tas2562-regmap.c @@ -37,7 +37,6 @@ #include "tas2562.h" #include "tas2562-codec.h" -//Added/Modified 060356-PP #include "tas2562-misc.h" static int tas2562_change_book_page(struct tas2562_priv *pTAS2562, @@ -50,14 +49,14 @@ static int tas2562_change_book_page(struct tas2562_priv *pTAS2562, goto end; if (pTAS2562->mnCurrentBook != book) { - nResult = regmap_write(pTAS2562->regmap, TAS2562_BOOKCTL_PAGE, 0); + nResult = regmap_write(pTAS2562->regmap, TAS2562_BOOKCTL_PAGE, 0); if (nResult < 0) { dev_err(pTAS2562->dev, "%s, ERROR, L=%d, E=%d\n", __func__, __LINE__, nResult); goto end; } - pTAS2562->mnCurrentPage = 0; - nResult = regmap_write(pTAS2562->regmap, TAS2562_BOOKCTL_REG, book); + pTAS2562->mnCurrentPage = 0; + nResult = regmap_write(pTAS2562->regmap, TAS2562_BOOKCTL_REG, book); if (nResult < 0) { dev_err(pTAS2562->dev, "%s, ERROR, L=%d, E=%d\n", __func__, __LINE__, nResult); @@ -67,7 +66,7 @@ static int tas2562_change_book_page(struct tas2562_priv *pTAS2562, } if (pTAS2562->mnCurrentPage != page) { - nResult = regmap_write(pTAS2562->regmap, TAS2562_BOOKCTL_PAGE, page); + nResult = regmap_write(pTAS2562->regmap, TAS2562_BOOKCTL_PAGE, page); if (nResult < 0) { dev_err(pTAS2562->dev, "%s, ERROR, L=%d, E=%d\n", __func__, __LINE__, nResult); diff --git a/tas2562.h b/tas2562.h index b8d788f..d584126 100644 --- a/tas2562.h +++ b/tas2562.h @@ -2,17 +2,21 @@ #ifndef __TAS2562_ #define __TAS2562_ +/* Page Control Register */ +#define TAS2560_PAGECTL_REG 0 /* Book Control Register (available in page0 of each book) */ -#define TAS2562_BOOKCTL_PAGE 0 -#define TAS2562_BOOKCTL_REG 127 +#define TAS2562_BOOKCTL_PAGE 0 +#define TAS2562_BOOKCTL_REG 127 -#define TAS2562_REG(page, reg) ((page * 128) + reg) +#define TAS2562_REG(book, page, reg) (((book * 256 * 128) + \ + (page * 128)) + reg) +#if 0 /* Page */ -#define TAS2562_Page TAS2562_REG(0X0, 0x00) +#define TAS2562_Page TAS2562_REG(0x0, 0x0, 0x0) #define TAS2562_Page_Page_Mask (0xff << 0) - +#endif #define TAS2562_BOOK_ID(reg) (reg / (256 * 128)) @@ -24,13 +28,13 @@ /* Software Reset */ -#define TAS2562_SoftwareReset TAS2562_REG(0X0, 0x01) +#define TAS2562_SoftwareReset TAS2562_REG(0x0, 0x0, 0x01) #define TAS2562_SoftwareReset_SoftwareReset_Mask (0x1 << 0), #define TAS2562_SoftwareReset_SoftwareReset_DontReset (0x0 << 0) #define TAS2562_SoftwareReset_SoftwareReset_Reset (0x1 << 0) /* Power Control */ -#define TAS2562_PowerControl TAS2562_REG(0X0, 0x02) +#define TAS2562_PowerControl TAS2562_REG(0x0, 0x0, 0x02) #define TAS2562_PowerControl_ISNSPower_Mask (0x1 << 3) #define TAS2562_PowerControl_ISNSPower_Active (0x0 << 3) #define TAS2562_PowerControl_ISNSPower_PoweredDown (0x1 << 3) @@ -52,7 +56,7 @@ #define TAS2562_DAI_FMT_MASK (0x7 << TAS2562_DATAFORMAT_SHIFT) /* Playback Configuration Reg0 */ -#define TAS2562_PlaybackConfigurationReg0 TAS2562_REG(0X0, 0x03) +#define TAS2562_PlaybackConfigurationReg0 TAS2562_REG(0x0, 0x0, 0x03) #define TAS2562_PlaybackConfigurationReg0_PDMPinMapping_Mask (0x1 << 7) #define TAS2562_PlaybackConfigurationReg0_PDMPinMapping_Pdm0 (0x0 << 7) #define TAS2562_PlaybackConfigurationReg0_PDMPinMapping_Pdm1 (0x1 << 7) @@ -63,7 +67,7 @@ #define TAS2562_PlaybackConfigurationReg0_AmplifierLevel40_Mask (0x1f << 0) /* Misc Configuration Reg0 */ -#define TAS2562_MiscConfigurationReg0 TAS2562_REG(0X0, 0x04) +#define TAS2562_MiscConfigurationReg0 TAS2562_REG(0x0, 0x0, 0x04) #define TAS2562_MiscConfigurationReg0_CPPGRetry_Mask (0x1 << 7) #define TAS2562_MiscConfigurationReg0_CPPGRetry_DoNotRetry (0x0 << 7) #define TAS2562_MiscConfigurationReg0_CPPGRetry_Retry (0x1 << 7) @@ -84,7 +88,7 @@ #define TAS2562_MiscConfigurationReg0_AMPSS_Enabled (0x1 << 2) /* TDM Configuration Reg0 */ -#define TAS2562_TDMConfigurationReg0 TAS2562_REG(0X0, 0x06) +#define TAS2562_TDMConfigurationReg0 TAS2562_REG(0x0, 0x0, 0x06) #define TAS2562_TDMConfigurationReg0_SAMPRATERAMP_Mask (0x1 << 5) #define TAS2562_TDMConfigurationReg0_SAMPRATERAMP_48KHz (0x0 << 5) #define TAS2562_TDMConfigurationReg0_SAMPRATERAMP_44_1KHz (0x1 << 5) @@ -101,7 +105,7 @@ #define TAS2562_TDMConfigurationReg0_FRAMESTART_HighToLow (0x1 << 0) /* TDM Configuration Reg1 */ -#define TAS2562_TDMConfigurationReg1 TAS2562_REG(0X0, 0x07) +#define TAS2562_TDMConfigurationReg1 TAS2562_REG(0x0, 0x0, 0x07) #define TAS2562_TDMConfigurationReg1_RXJUSTIFY_Mask (0x1 << 6) #define TAS2562_TDMConfigurationReg1_RXJUSTIFY_Left (0x0 << 6) #define TAS2562_TDMConfigurationReg1_RXJUSTIFY_Right (0x1 << 6) @@ -112,7 +116,7 @@ #define TAS2562_TDMConfigurationReg1_RXEDGE_Falling (0x1 << 0) /* TDM Configuration Reg2 */ -#define TAS2562_TDMConfigurationReg2 TAS2562_REG(0X0, 0x08) +#define TAS2562_TDMConfigurationReg2 TAS2562_REG(0x0, 0x0, 0x08) #define TAS2562_TDMConfigurationReg2_RXSCFG54_Mask (0x3 << 4) #define TAS2562_TDMConfigurationReg2_RXSCFG54_Mono_I2C (0x0 << 4), #define TAS2562_TDMConfigurationReg2_RXSCFG54_Mono_Left (0x1 << 4), @@ -129,12 +133,12 @@ #define TAS2562_TDMConfigurationReg2_RXSLEN10_32Bits (0x2 << 0) /* TDM Configuration Reg3 */ -#define TAS2562_TDMConfigurationReg3 TAS2562_REG(0X0, 0x09) +#define TAS2562_TDMConfigurationReg3 TAS2562_REG(0x0, 0x0, 0x09) #define TAS2562_TDMConfigurationReg3_RXSLOTRight74_Mask (0xf << 4) #define TAS2562_TDMConfigurationReg3_RXSLOTLeft30_Mask (0xf << 0) /* TDM Configuration Reg4 */ -#define TAS2562_TDMConfigurationReg4 TAS2562_REG(0X0, 0x0A) +#define TAS2562_TDMConfigurationReg4 TAS2562_REG(0x0, 0x0, 0x0A) #define TAS2562_TDMConfigurationReg4_TXKEEPER_Mask (0x1 << 5) #define TAS2562_TDMConfigurationReg4_TXKEEPER_Disable (0x0 << 5) #define TAS2562_TDMConfigurationReg4_TXKEEPER_Enable (0x1 << 5) @@ -147,21 +151,21 @@ #define TAS2562_TDMConfigurationReg4_TXEDGE_Falling (0x1 << 0) /* TDM Configuration Reg5 */ -#define TAS2562_TDMConfigurationReg5 TAS2562_REG(0X0, 0x0B) +#define TAS2562_TDMConfigurationReg5 TAS2562_REG(0x0, 0x0, 0x0B) #define TAS2562_TDMConfigurationReg5_VSNSTX_Mask (0x1 << 6) #define TAS2562_TDMConfigurationReg5_VSNSTX_Disable (0x0 << 6), #define TAS2562_TDMConfigurationReg5_VSNSTX_Enable (0x1 << 6), #define TAS2562_TDMConfigurationReg5_VSNSSLOT50_Mask (0x3f << 0) /* TDM Configuration Reg6 */ -#define TAS2562_TDMConfigurationReg6 TAS2562_REG(0X0, 0x0C) +#define TAS2562_TDMConfigurationReg6 TAS2562_REG(0x0, 0x0, 0x0C) #define TAS2562_TDMConfigurationReg6_ISNSTX_Mask (0x1 << 6) #define TAS2562_TDMConfigurationReg6_ISNSTX_Disable (0x0 << 6), #define TAS2562_TDMConfigurationReg6_ISNSTX_Enable (0x1 << 6), #define TAS2562_TDMConfigurationReg6_ISNSSLOT50_Mask (0x3f << 0) /* TDM Configuration Reg7 */ -#define TAS2562_TDMConfigurationReg7 TAS2562_REG(0X0, 0x0D) +#define TAS2562_TDMConfigurationReg7 TAS2562_REG(0x0, 0x0, 0x0D) #define TAS2562_TDMConfigurationReg7_VBATSLEN_Mask (0x1 << 7) #define TAS2562_TDMConfigurationReg7_VBATSLEN_8Bits (0x0 << 7) #define TAS2562_TDMConfigurationReg7_VBATSLEN_16Bits (0x1 << 7) @@ -171,21 +175,21 @@ #define TAS2562_TDMConfigurationReg7_VBATSLOT50_Mask (0x3f << 0) /* TDM Configuration Reg8 */ -#define TAS2562_TDMConfigurationReg8 TAS2562_REG(0X0, 0x0E) +#define TAS2562_TDMConfigurationReg8 TAS2562_REG(0x0, 0x0, 0x0E) #define TAS2562_TDMConfigurationReg8_TEMPTX_Mask (0x1 << 6) #define TAS2562_TDMConfigurationReg8_TEMPTX_Disable (0x0 << 6) #define TAS2562_TDMConfigurationReg8_TEMPTX_Enable (0x1 << 6) #define TAS2562_TDMConfigurationReg8_TEMPSLOT50_Mask (0x3f << 0) /* TDM Configuration Reg9 */ -#define TAS2562_TDMConfigurationReg9 TAS2562_REG(0X0, 0x0F) +#define TAS2562_TDMConfigurationReg9 TAS2562_REG(0x0, 0x0, 0x0F) #define TAS2562_TDMConfigurationReg9_GAINTX_Mask (0x1 << 6) #define TAS2562_TDMConfigurationReg9_GAINTX_Disable (0x0 << 6) #define TAS2562_TDMConfigurationReg9_GAINTX_Enable (0x1 << 6) #define TAS2562_TDMConfigurationReg9_GAINSLOT50_Mask (0x3f << 0) /* Limiter Configuration Reg0 */ -#define TAS2562_LimiterConfigurationReg0 TAS2562_REG(0X0, 0x12) +#define TAS2562_LimiterConfigurationReg0 TAS2562_REG(0x0, 0x0, 0x12) #define TAS2562_LimiterConfigurationReg0_LIMATKST54_Mask (0x3 << 4) #define TAS2562_LimiterConfigurationReg0_LIMATKST54_1 (0x2 << 4) #define TAS2562_LimiterConfigurationReg0_LIMATKST54_2 (0x3 << 4) @@ -205,7 +209,7 @@ #define TAS2562_LimiterConfigurationReg0_LIMEN_Enabled (0x1 << 0) /* Limiter Configuration Reg1 */ -#define TAS2562_LimiterConfigurationReg1 TAS2562_REG(0X0, 0x13) +#define TAS2562_LimiterConfigurationReg1 TAS2562_REG(0x0, 0x0, 0x13) #define TAS2562_LimiterConfigurationReg1_LIMRLSST76_Mask (0x3 << 6) #define TAS2562_LimiterConfigurationReg1_LIMRLSST76_1 (0x2 << 6) #define TAS2562_LimiterConfigurationReg1_LIMRLSST76_2 (0x3 << 6) @@ -231,7 +235,7 @@ #define TAS2562_LimiterConfigurationReg1_LIMHLDTM20_1000 (0x7 << 0) /* Brown Out Prevention Reg0 */ -#define TAS2562_BrownOutPreventionReg0 TAS2562_REG(0X0, 0x14) +#define TAS2562_BrownOutPreventionReg0 TAS2562_REG(0x0, 0x0, 0x14) #define TAS2562_BrownOutPreventionReg0_BOPSDEN_Mask (0x1 << 4) #define TAS2562_BrownOutPreventionReg0_BOPSDEN_Disabled (0x0 << 4) #define TAS2562_BrownOutPreventionReg0_BOPSDEN_Enabled (0x1 << 4) @@ -249,7 +253,7 @@ #define TAS2562_BrownOutPreventionReg0_BOPEN_Enabled (0x1 << 0) /* Brown Out Prevention Reg1 */ -#define TAS2562_BrownOutPreventionReg1 TAS2562_REG(0X0, 0x15) +#define TAS2562_BrownOutPreventionReg1 TAS2562_REG(0x0, 0x0, 0x15) #define TAS2562_BrownOutPreventionReg1_BOPATKRT75_Mask (0x7 << 5) #define TAS2562_BrownOutPreventionReg1_BOPATKRT75_1 (0x0 << 5) #define TAS2562_BrownOutPreventionReg1_BOPATKRT75_2 (0x1 << 5) @@ -275,7 +279,7 @@ #define TAS2562_BrownOutPreventionReg1_BOPHLDTM20_1000 (0x7 << 0 /* Interrupt Mask Reg0 */ -#define TAS2562_InterruptMaskReg0 TAS2562_REG(0X0, 0x1A) +#define TAS2562_InterruptMaskReg0 TAS2562_REG(0x0, 0x0, 0x1A) #define TAS2562_InterruptMaskReg0_LIMMUTEINTMASK_Mask (0x1 << 7) #define TAS2562_InterruptMaskReg0_LIMMUTEINTMASK_Unmask (0x0 << 7) #define TAS2562_InterruptMaskReg0_LIMMUTEINTMASK_Disable (0x1 << 7) @@ -303,7 +307,7 @@ #define TAS2562_InterruptMaskReg0_Disable 0xff /* Interrupt Mask Reg1 */ -#define TAS2562_InterruptMaskReg1 TAS2562_REG(0X0, 0x1B) +#define TAS2562_InterruptMaskReg1 TAS2562_REG(0x0, 0x0, 0x1B) #define TAS2562_InterruptMaskReg1_DSPOUTPUTINTMASK_Mask (0x1 << 7) #define TAS2562_InterruptMaskReg1_DSPOUTPUTINTMASK_Unmask (0x0 << 7) #define TAS2562_InterruptMaskReg1_DSPOUTPUTINTMASK_Disable (0x1 << 7) @@ -322,7 +326,7 @@ #define TAS2562_InterruptMaskReg1_Disable 0xff /* Interrupt Mask Reg2 */ -#define TAS2562_InterruptMaskReg2 TAS2562_REG(0X0, 0x1C) +#define TAS2562_InterruptMaskReg2 TAS2562_REG(0x0, 0x0, 0x1C) #define TAS2562_InterruptMaskReg2_DACLKINTMASK_Mask (0x1 << 7) #define TAS2562_InterruptMaskReg2_DACLKINTMASK_Unmask (0x0 << 7) #define TAS2562_InterruptMaskReg2_DACLKINTMASK_Disable (0x1 << 7) @@ -340,7 +344,7 @@ #define TAS2562_InterruptMaskReg2_DCDETECTINTMASK_Disable (0x1 << 3) /* Live-Interrupt Reg0 */ -#define TAS2562_LiveInterruptReg0 TAS2562_REG(0X0, 0x1F) +#define TAS2562_LiveInterruptReg0 TAS2562_REG(0x0, 0x0, 0x1F) #define TAS2562_LiveInterruptReg0_LIMMUTE_Mask (0x1 << 7) #define TAS2562_LiveInterruptReg0_LIMMUTE_NoInterrupt (0x0 << 7) #define TAS2562_LiveInterruptReg0_LIMMUTE_Interrupt (0x1 << 7) @@ -367,7 +371,7 @@ #define TAS2562_LiveInterruptReg0_OTEFlag_Interrupt (0x1 << 0) /* Live-Interrupt Reg1 */ -#define TAS2562_LiveInterruptReg1 TAS2562_REG(0X0, 0x20) +#define TAS2562_LiveInterruptReg1 TAS2562_REG(0x0, 0x0, 0x20) #define TAS2562_LiveInterruptReg1_DSPINTOutput_Mask (0x1 << 7) #define TAS2562_LiveInterruptReg1_DSPINTOutput_NoInterrupt (0x0 << 7) #define TAS2562_LiveInterruptReg1_DSPINTOutput_Interrupt (0x1 << 7) @@ -382,7 +386,7 @@ #define TAS2562_LiveInterruptReg1_BrownOutDetected_Interrupt (0x1 << 1) /* Latched-Interrupt Reg0 */ -#define TAS2562_LatchedInterruptReg0 TAS2562_REG(0X0, 0x24) +#define TAS2562_LatchedInterruptReg0 TAS2562_REG(0x0, 0x0, 0x24) #define TAS2562_LatchedInterruptReg0_LIMMUTESticky_Mask (0x1 << 7) #define TAS2562_LatchedInterruptReg0_LIMMUTESticky_NoInterrupt (0x0 << 7) #define TAS2562_LatchedInterruptReg0_LIMMUTESticky_Interrupt (0x1 << 7) @@ -410,7 +414,7 @@ #define TAS2562_LatchedInterruptReg0_OTEFlagSticky_Interrupt (0x1 << 0) /* Latched-Interrupt Reg1 */ -#define TAS2562_LatchedInterruptReg1 TAS2562_REG(0X0, 0x25) +#define TAS2562_LatchedInterruptReg1 TAS2562_REG(0x0, 0x0, 0x25) #define TAS2562_LatchedInterruptReg1_PDMAUDDATAINVALIDSticky_Mask (0x1 << 7) #define TAS2562_LatchedInterruptReg1_PDMAUDDATAINVALIDSticky_NoInterrupt \ (0x0 << 7) @@ -430,20 +434,20 @@ #define TAS2562_LatchedInterruptReg1_PDMClockErrorSticky_Interrupt (0x1 << 0) /* VBAT MSB */ -#define TAS2562_VBATMSB TAS2562_REG(0X0, 0x2A) +#define TAS2562_VBATMSB TAS2562_REG(0x0, 0x0, 0x2A) #define TAS2562_VBATMSB_VBATMSB70_Mask (0xff << 0) /* VBAT LSB */ -#define TAS2562_VBATLSB TAS2562_REG(0X0, 0x2B) +#define TAS2562_VBATLSB TAS2562_REG(0x0, 0x0, 0x2B) #define TAS2562_VBATLSB_VBATLSB74_Mask (0xf << 4) /* TEMP */ -#define TAS2562_TEMP TAS2562_REG(0X0, 0x2C) +#define TAS2562_TEMP TAS2562_REG(0x0, 0x0, 0x2C) #define TAS2562_TEMP_TEMPMSB70_Mask (0xff << 0) /* Interrupt Configuration */ -#define TAS2562_InterruptConfiguration TAS2562_REG(0X0, 0x30) +#define TAS2562_InterruptConfiguration TAS2562_REG(0x0, 0x0, 0x30) #define TAS2562_InterruptConfiguration_LTCHINTClear_Mask (0x1 << 2) #define TAS2562_InterruptConfiguration_LTCHINTClear (0x1 << 2) #define TAS2562_InterruptConfiguration_PININTConfig10_Mask (0x3 << 0) @@ -460,7 +464,7 @@ TAS2562_InterruptConfiguration_PININTConfig10_Assert2msOnLatchedInterrupts \ (0x3 << 0) /* Digital Input Pin Pull Down */ -#define TAS2562_DigitalInputPinPullDown TAS2562_REG(0X0, 0x31) +#define TAS2562_DigitalInputPinPullDown TAS2562_REG(0x0, 0x0, 0x31) #define TAS2562_DigitalInputPinPullDown_WKPulldownSDOUT_Mask (0x1 << 7) #define TAS2562_DigitalInputPinPullDown_WKPulldownSDOUT_Disabled (0x0 << 7) #define TAS2562_DigitalInputPinPullDown_WKPulldownSDOUT_Enabled (0x1 << 7) @@ -487,7 +491,7 @@ TAS2562_InterruptConfiguration_PININTConfig10_Assert2msOnLatchedInterrupts \ #define TAS2562_DigitalInputPinPullDown_WKPulldownPDMCK1_Enabled (0x1 << 0) /* Misc IRQ */ -#define TAS2562_MiscIRQ TAS2562_REG(0X0, 0x32) +#define TAS2562_MiscIRQ TAS2562_REG(0x0, 0x0, 0x32) #define TAS2562_MiscIRQ_IRQZREQD_Mask (0x1 << 7) #define TAS2562_MiscIRQ_IRQZREQD_ActiveHigh (0x0 << 7) #define TAS2562_MiscIRQ_IRQZREQD_ActiveLow (0x1 << 7) @@ -495,9 +499,13 @@ TAS2562_InterruptConfiguration_PININTConfig10_Assert2msOnLatchedInterrupts \ #define TAS2562_MiscIRQ_IRQZBITBANG_IRQZInputBuf0 (0x0 << 0) #define TAS2562_MiscIRQ_IRQZBITBANG_IRQZInputBuf1 (0x1 << 0) +#define TAS2562_BoostSlope TAS2562_REG(0x0, 0x0, 0x35) +#define TAS2562_BoostSlope_Mask (0x3 << 2) +#define TAS2562_BoostSlope_3AV (0x1 << 2) +#define TAS2562_BoostSlope_2AV (0x2 << 2) /* Clock Configuration */ -#define TAS2562_ClockConfiguration TAS2562_REG(0X0, 0x38) +#define TAS2562_ClockConfiguration TAS2562_REG(0x0, 0x0, 0x38) #define TAS2562_ClockConfiguration_SBCLKtoFS52_Mask (0xf << 2) #define TAS2562_ClockConfiguration_SBCLKtoFS52_16 (0x0 << 2) #define TAS2562_ClockConfiguration_SBCLKtoFS52_24 (0x1 << 2) @@ -514,19 +522,33 @@ TAS2562_InterruptConfiguration_PININTConfig10_Assert2msOnLatchedInterrupts \ #define TAS2562_ClockConfiguration_DISCLKRateDetect10_Disabled (0x1 << 0) #define TAS2562_ClockConfiguration_DISCLKRateDetect10_Enabled (0x0 << 0) -#define TAS2562_ICN_REG TAS2562_REG(2, 0x5c) +#define TAS2562_VBatFilter TAS2562_REG(0x0, 0x0, 0x3b) +#define TAS2562_ClassHReleaseTimer TAS2562_REG(0x0, 0x0, 0x3c) + +#define TAS2562_ICN_REG TAS2562_REG(0x0, 0x2, 0x5c) + +#define TAS2562_TestPageConfiguration TAS2562_REG(0x0, 0xfd, 0xd) +#define TAS2562_ClassDConfiguration1 TAS2562_REG(0x0, 0xfd, 0x19) +#define TAS2562_ClassDConfiguration2 TAS2562_REG(0x0, 0xfd, 0x32) +#define TAS2562_ClassDConfiguration3 TAS2562_REG(0x0, 0xfd, 0x33) +#define TAS2562_ClassDConfiguration4 TAS2562_REG(0x0, 0xfd, 0x3f) +#define TAS2562_EfficiencyConfiguration TAS2562_REG(0x0, 0xfd, 0x5f) + +#define TAS2562_ClassHHeadroom TAS2562_REG(0x64, 0x7, 0x48) +#define TAS2562_ClassHHysteresis TAS2562_REG(0x64, 0x7, 0x4c) +#define TAS2562_ClassHMtct TAS2562_REG(0x64, 0x5, 0x4c) /* Revision and PG ID */ -#define TAS2562_RevisionandPGID TAS2562_REG(0X0, 0x7D) +#define TAS2562_RevisionandPGID TAS2562_REG(0x0, 0x0, 0x7D) #define TAS2562_RevisionandPGID_RevisionID74_Mask (0xf << 4) #define TAS2562_RevisionandPGID_PGID30_Mask (0xf << 0) /* I2C Checksum */ -#define TAS2562_I2CChecksum TAS2562_REG(0X0, 0x7E) +#define TAS2562_I2CChecksum TAS2562_REG(0x0, 0x0, 0x7E) #define TAS2562_I2CChecksum_I2CChecksum70_Mask (0xff << 0) /* Book */ -#define TAS2562_Book TAS2562_REG(0X0, 0x7F) +#define TAS2562_Book TAS2562_REG(0x0, 0x0, 0x7F) #define TAS2562_Book_Book70_Mask (0xff << 0) #define TAS2562_POWER_ACTIVE 0 @@ -587,8 +609,8 @@ int mnPLL; int mnPPG; int mnCh_size; int mnSlot_width; -int ch_size; int mnPCMFormat; +bool mbMute; int (*read)(struct tas2562_priv *pTAS2562, unsigned int reg, unsigned int *pValue); int (*write)(struct tas2562_priv *pTAS2562, -- 2.39.2