mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-25 16:12:05 +00:00
dm: sound: max98095: Pass private data to internal functions
At present the driver-private data is global. To allow this code to be used with driver model, change it to pass the data down to each function. Use the name 'priv' consistently throughout. Also rename max98095_update_bits() to max98095_bic_or() which is more descriptive and shorter, thus breaking fewer lines with the parameter addition. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
107ab83e61
commit
a832a3e36f
1 changed files with 78 additions and 74 deletions
|
@ -41,12 +41,14 @@ int rate_table[] = {0, 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000,
|
||||||
/*
|
/*
|
||||||
* Writes value to a device register through i2c
|
* Writes value to a device register through i2c
|
||||||
*
|
*
|
||||||
|
* @param priv Private data for driver
|
||||||
* @param reg reg number to be write
|
* @param reg reg number to be write
|
||||||
* @param data data to be writen to the above registor
|
* @param data data to be writen to the above registor
|
||||||
*
|
*
|
||||||
* @return int value 1 for change, 0 for no change or negative error code.
|
* @return int value 1 for change, 0 for no change or negative error code.
|
||||||
*/
|
*/
|
||||||
static int max98095_i2c_write(unsigned int reg, unsigned char data)
|
static int max98095_i2c_write(struct max98095_priv *priv, unsigned int reg,
|
||||||
|
unsigned char data)
|
||||||
{
|
{
|
||||||
debug("%s: Write Addr : 0x%02X, Data : 0x%02X\n",
|
debug("%s: Write Addr : 0x%02X, Data : 0x%02X\n",
|
||||||
__func__, reg, data);
|
__func__, reg, data);
|
||||||
|
@ -56,12 +58,14 @@ static int max98095_i2c_write(unsigned int reg, unsigned char data)
|
||||||
/*
|
/*
|
||||||
* Read a value from a device register through i2c
|
* Read a value from a device register through i2c
|
||||||
*
|
*
|
||||||
|
* @param priv Private data for driver
|
||||||
* @param reg reg number to be read
|
* @param reg reg number to be read
|
||||||
* @param data address of read data to be stored
|
* @param data address of read data to be stored
|
||||||
*
|
*
|
||||||
* @return int value 0 for success, -1 in case of error.
|
* @return int value 0 for success, -1 in case of error.
|
||||||
*/
|
*/
|
||||||
static unsigned int max98095_i2c_read(unsigned int reg, unsigned char *data)
|
static unsigned int max98095_i2c_read(struct max98095_priv *priv,
|
||||||
|
unsigned int reg, unsigned char *data)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -78,24 +82,25 @@ static unsigned int max98095_i2c_read(unsigned int reg, unsigned char *data)
|
||||||
/*
|
/*
|
||||||
* update device register bits through i2c
|
* update device register bits through i2c
|
||||||
*
|
*
|
||||||
|
* @param priv Private data for driver
|
||||||
* @param reg codec register
|
* @param reg codec register
|
||||||
* @param mask register mask
|
* @param mask register mask
|
||||||
* @param value new value
|
* @param value new value
|
||||||
*
|
*
|
||||||
* @return int value 0 for success, non-zero error code.
|
* @return int value 0 for success, non-zero error code.
|
||||||
*/
|
*/
|
||||||
static int max98095_update_bits(unsigned int reg, unsigned char mask,
|
static int max98095_bic_or(struct max98095_priv *priv, unsigned int reg,
|
||||||
unsigned char value)
|
unsigned char mask, unsigned char value)
|
||||||
{
|
{
|
||||||
int change, ret = 0;
|
int change, ret = 0;
|
||||||
unsigned char old, new;
|
unsigned char old, new;
|
||||||
|
|
||||||
if (max98095_i2c_read(reg, &old) != 0)
|
if (max98095_i2c_read(priv, reg, &old) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
new = (old & ~mask) | (value & mask);
|
new = (old & ~mask) | (value & mask);
|
||||||
change = (old != new) ? 1 : 0;
|
change = (old != new) ? 1 : 0;
|
||||||
if (change)
|
if (change)
|
||||||
ret = max98095_i2c_write(reg, new);
|
ret = max98095_i2c_write(priv, reg, new);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -128,13 +133,13 @@ static int rate_value(int rate, u8 *value)
|
||||||
/*
|
/*
|
||||||
* Sets hw params for max98095
|
* Sets hw params for max98095
|
||||||
*
|
*
|
||||||
* @param max98095 max98095 information pointer
|
* @param priv max98095 information pointer
|
||||||
* @param rate Sampling rate
|
* @param rate Sampling rate
|
||||||
* @param bits_per_sample Bits per sample
|
* @param bits_per_sample Bits per sample
|
||||||
*
|
*
|
||||||
* @return -1 for error and 0 Success.
|
* @return -1 for error and 0 Success.
|
||||||
*/
|
*/
|
||||||
static int max98095_hw_params(struct max98095_priv *max98095,
|
static int max98095_hw_params(struct max98095_priv *priv,
|
||||||
enum en_max_audio_interface aif_id,
|
enum en_max_audio_interface aif_id,
|
||||||
unsigned int rate, unsigned int bits_per_sample)
|
unsigned int rate, unsigned int bits_per_sample)
|
||||||
{
|
{
|
||||||
|
@ -156,12 +161,12 @@ static int max98095_hw_params(struct max98095_priv *max98095,
|
||||||
|
|
||||||
switch (bits_per_sample) {
|
switch (bits_per_sample) {
|
||||||
case 16:
|
case 16:
|
||||||
error = max98095_update_bits(M98095_DAI_FORMAT,
|
error = max98095_bic_or(priv, M98095_DAI_FORMAT, M98095_DAI_WS,
|
||||||
M98095_DAI_WS, 0);
|
0);
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
error = max98095_update_bits(M98095_DAI_FORMAT,
|
error = max98095_bic_or(priv, M98095_DAI_FORMAT, M98095_DAI_WS,
|
||||||
M98095_DAI_WS, M98095_DAI_WS);
|
M98095_DAI_WS);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
debug("%s: Illegal bits per sample %d.\n",
|
debug("%s: Illegal bits per sample %d.\n",
|
||||||
|
@ -174,18 +179,18 @@ static int max98095_hw_params(struct max98095_priv *max98095,
|
||||||
__func__, rate);
|
__func__, rate);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
max98095->rate = rate;
|
priv->rate = rate;
|
||||||
|
|
||||||
error |= max98095_update_bits(M98095_DAI_CLKMODE,
|
error |= max98095_bic_or(priv, M98095_DAI_CLKMODE, M98095_CLKMODE_MASK,
|
||||||
M98095_CLKMODE_MASK, regval);
|
regval);
|
||||||
|
|
||||||
/* Update sample rate mode */
|
/* Update sample rate mode */
|
||||||
if (rate < 50000)
|
if (rate < 50000)
|
||||||
error |= max98095_update_bits(M98095_DAI_FILTERS,
|
error |= max98095_bic_or(priv, M98095_DAI_FILTERS,
|
||||||
M98095_DAI_DHF, 0);
|
M98095_DAI_DHF, 0);
|
||||||
else
|
else
|
||||||
error |= max98095_update_bits(M98095_DAI_FILTERS,
|
error |= max98095_bic_or(priv, M98095_DAI_FILTERS,
|
||||||
M98095_DAI_DHF, M98095_DAI_DHF);
|
M98095_DAI_DHF, M98095_DAI_DHF);
|
||||||
|
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
debug("%s: Error setting hardware params.\n", __func__);
|
debug("%s: Error setting hardware params.\n", __func__);
|
||||||
|
@ -198,18 +203,17 @@ static int max98095_hw_params(struct max98095_priv *max98095,
|
||||||
/*
|
/*
|
||||||
* Configures Audio interface system clock for the given frequency
|
* Configures Audio interface system clock for the given frequency
|
||||||
*
|
*
|
||||||
* @param max98095 max98095 information
|
* @param priv max98095 information
|
||||||
* @param freq Sampling frequency in Hz
|
* @param freq Sampling frequency in Hz
|
||||||
*
|
*
|
||||||
* @return -1 for error and 0 success.
|
* @return -1 for error and 0 success.
|
||||||
*/
|
*/
|
||||||
static int max98095_set_sysclk(struct max98095_priv *max98095,
|
static int max98095_set_sysclk(struct max98095_priv *priv, unsigned int freq)
|
||||||
unsigned int freq)
|
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
/* Requested clock frequency is already setup */
|
/* Requested clock frequency is already setup */
|
||||||
if (freq == max98095->sysclk)
|
if (freq == priv->sysclk)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Setup clocks for slave mode, and using the PLL
|
/* Setup clocks for slave mode, and using the PLL
|
||||||
|
@ -218,11 +222,11 @@ static int max98095_set_sysclk(struct max98095_priv *max98095,
|
||||||
* 0x03 (when master clk is 40MHz to 60MHz)..
|
* 0x03 (when master clk is 40MHz to 60MHz)..
|
||||||
*/
|
*/
|
||||||
if ((freq >= 10000000) && (freq < 20000000)) {
|
if ((freq >= 10000000) && (freq < 20000000)) {
|
||||||
error = max98095_i2c_write(M98095_026_SYS_CLK, 0x10);
|
error = max98095_i2c_write(priv, M98095_026_SYS_CLK, 0x10);
|
||||||
} else if ((freq >= 20000000) && (freq < 40000000)) {
|
} else if ((freq >= 20000000) && (freq < 40000000)) {
|
||||||
error = max98095_i2c_write(M98095_026_SYS_CLK, 0x20);
|
error = max98095_i2c_write(priv, M98095_026_SYS_CLK, 0x20);
|
||||||
} else if ((freq >= 40000000) && (freq < 60000000)) {
|
} else if ((freq >= 40000000) && (freq < 60000000)) {
|
||||||
error = max98095_i2c_write(M98095_026_SYS_CLK, 0x30);
|
error = max98095_i2c_write(priv, M98095_026_SYS_CLK, 0x30);
|
||||||
} else {
|
} else {
|
||||||
debug("%s: Invalid master clock frequency\n", __func__);
|
debug("%s: Invalid master clock frequency\n", __func__);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -233,20 +237,20 @@ static int max98095_set_sysclk(struct max98095_priv *max98095,
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
max98095->sysclk = freq;
|
priv->sysclk = freq;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets Max98095 I2S format
|
* Sets Max98095 I2S format
|
||||||
*
|
*
|
||||||
* @param max98095 max98095 information
|
* @param priv max98095 information
|
||||||
* @param fmt i2S format - supports a subset of the options defined
|
* @param fmt i2S format - supports a subset of the options defined
|
||||||
* in i2s.h.
|
* in i2s.h.
|
||||||
*
|
*
|
||||||
* @return -1 for error and 0 Success.
|
* @return -1 for error and 0 Success.
|
||||||
*/
|
*/
|
||||||
static int max98095_set_fmt(struct max98095_priv *max98095, int fmt,
|
static int max98095_set_fmt(struct max98095_priv *priv, int fmt,
|
||||||
enum en_max_audio_interface aif_id)
|
enum en_max_audio_interface aif_id)
|
||||||
{
|
{
|
||||||
u8 regval = 0;
|
u8 regval = 0;
|
||||||
|
@ -256,10 +260,10 @@ static int max98095_set_fmt(struct max98095_priv *max98095, int fmt,
|
||||||
unsigned short M98095_DAI_FORMAT;
|
unsigned short M98095_DAI_FORMAT;
|
||||||
unsigned short M98095_DAI_CLOCK;
|
unsigned short M98095_DAI_CLOCK;
|
||||||
|
|
||||||
if (fmt == max98095->fmt)
|
if (fmt == priv->fmt)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
max98095->fmt = fmt;
|
priv->fmt = fmt;
|
||||||
|
|
||||||
if (aif_id == AIF1) {
|
if (aif_id == AIF1) {
|
||||||
M98095_DAI_CLKCFG_HI = M98095_028_DAI1_CLKCFG_HI;
|
M98095_DAI_CLKCFG_HI = M98095_028_DAI1_CLKCFG_HI;
|
||||||
|
@ -276,10 +280,8 @@ static int max98095_set_fmt(struct max98095_priv *max98095, int fmt,
|
||||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||||
case SND_SOC_DAIFMT_CBS_CFS:
|
case SND_SOC_DAIFMT_CBS_CFS:
|
||||||
/* Slave mode PLL */
|
/* Slave mode PLL */
|
||||||
error |= max98095_i2c_write(M98095_DAI_CLKCFG_HI,
|
error |= max98095_i2c_write(priv, M98095_DAI_CLKCFG_HI, 0x80);
|
||||||
0x80);
|
error |= max98095_i2c_write(priv, M98095_DAI_CLKCFG_LO, 0x00);
|
||||||
error |= max98095_i2c_write(M98095_DAI_CLKCFG_LO,
|
|
||||||
0x00);
|
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAIFMT_CBM_CFM:
|
case SND_SOC_DAIFMT_CBM_CFM:
|
||||||
/* Set to master mode */
|
/* Set to master mode */
|
||||||
|
@ -320,13 +322,11 @@ static int max98095_set_fmt(struct max98095_priv *max98095, int fmt,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
error |= max98095_update_bits(M98095_DAI_FORMAT,
|
error |= max98095_bic_or(priv, M98095_DAI_FORMAT,
|
||||||
M98095_DAI_MAS | M98095_DAI_DLY |
|
M98095_DAI_MAS | M98095_DAI_DLY |
|
||||||
M98095_DAI_BCI | M98095_DAI_WCI,
|
M98095_DAI_BCI | M98095_DAI_WCI, regval);
|
||||||
regval);
|
|
||||||
|
|
||||||
error |= max98095_i2c_write(M98095_DAI_CLOCK,
|
error |= max98095_i2c_write(priv, M98095_DAI_CLOCK, M98095_DAI_BSEL64);
|
||||||
M98095_DAI_BSEL64);
|
|
||||||
|
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
debug("%s: Error setting i2s format.\n", __func__);
|
debug("%s: Error setting i2s format.\n", __func__);
|
||||||
|
@ -339,9 +339,10 @@ static int max98095_set_fmt(struct max98095_priv *max98095, int fmt,
|
||||||
/*
|
/*
|
||||||
* resets the audio codec
|
* resets the audio codec
|
||||||
*
|
*
|
||||||
|
* @param priv Private data for driver
|
||||||
* @return -1 for error and 0 success.
|
* @return -1 for error and 0 success.
|
||||||
*/
|
*/
|
||||||
static int max98095_reset(void)
|
static int max98095_reset(struct max98095_priv *priv)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
|
@ -349,13 +350,13 @@ static int max98095_reset(void)
|
||||||
* Gracefully reset the DSP core and the codec hardware in a proper
|
* Gracefully reset the DSP core and the codec hardware in a proper
|
||||||
* sequence.
|
* sequence.
|
||||||
*/
|
*/
|
||||||
ret = max98095_i2c_write(M98095_00F_HOST_CFG, 0);
|
ret = max98095_i2c_write(priv, M98095_00F_HOST_CFG, 0);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
debug("%s: Failed to reset DSP: %d\n", __func__, ret);
|
debug("%s: Failed to reset DSP: %d\n", __func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = max98095_i2c_write(M98095_097_PWR_SYS, 0);
|
ret = max98095_i2c_write(priv, M98095_097_PWR_SYS, 0);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
debug("%s: Failed to reset codec: %d\n", __func__, ret);
|
debug("%s: Failed to reset codec: %d\n", __func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -366,7 +367,7 @@ static int max98095_reset(void)
|
||||||
* reset hardware control register.
|
* reset hardware control register.
|
||||||
*/
|
*/
|
||||||
for (i = M98095_010_HOST_INT_CFG; i < M98095_REG_MAX_CACHED; i++) {
|
for (i = M98095_010_HOST_INT_CFG; i < M98095_REG_MAX_CACHED; i++) {
|
||||||
ret = max98095_i2c_write(i, 0);
|
ret = max98095_i2c_write(priv, i, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
debug("%s: Failed to reset: %d\n", __func__, ret);
|
debug("%s: Failed to reset: %d\n", __func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -379,29 +380,29 @@ static int max98095_reset(void)
|
||||||
/*
|
/*
|
||||||
* Intialise max98095 codec device
|
* Intialise max98095 codec device
|
||||||
*
|
*
|
||||||
* @param max98095 max98095 information
|
* @param priv max98095 information
|
||||||
*
|
*
|
||||||
* @returns -1 for error and 0 Success.
|
* @returns -1 for error and 0 Success.
|
||||||
*/
|
*/
|
||||||
static int max98095_device_init(struct max98095_priv *max98095,
|
static int max98095_device_init(struct max98095_priv *priv,
|
||||||
enum en_max_audio_interface aif_id)
|
enum en_max_audio_interface aif_id)
|
||||||
{
|
{
|
||||||
unsigned char id;
|
unsigned char id;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
/* reset the codec, the DSP core, and disable all interrupts */
|
/* reset the codec, the DSP core, and disable all interrupts */
|
||||||
error = max98095_reset();
|
error = max98095_reset(priv);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
debug("Reset\n");
|
debug("Reset\n");
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize private data */
|
/* initialize private data */
|
||||||
max98095->sysclk = -1U;
|
priv->sysclk = -1U;
|
||||||
max98095->rate = -1U;
|
priv->rate = -1U;
|
||||||
max98095->fmt = -1U;
|
priv->fmt = -1U;
|
||||||
|
|
||||||
error = max98095_i2c_read(M98095_0FF_REV_ID, &id);
|
error = max98095_i2c_read(priv, M98095_0FF_REV_ID, &id);
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
debug("%s: Failure reading hardware revision: %d\n",
|
debug("%s: Failure reading hardware revision: %d\n",
|
||||||
__func__, id);
|
__func__, id);
|
||||||
|
@ -409,55 +410,58 @@ static int max98095_device_init(struct max98095_priv *max98095,
|
||||||
}
|
}
|
||||||
debug("%s: Hardware revision: %c\n", __func__, (id - 0x40) + 'A');
|
debug("%s: Hardware revision: %c\n", __func__, (id - 0x40) + 'A');
|
||||||
|
|
||||||
error |= max98095_i2c_write(M98095_097_PWR_SYS, M98095_PWRSV);
|
error |= max98095_i2c_write(priv, M98095_097_PWR_SYS, M98095_PWRSV);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize registers to hardware default configuring audio
|
* initialize registers to hardware default configuring audio
|
||||||
* interface2 to DAC
|
* interface2 to DAC
|
||||||
*/
|
*/
|
||||||
if (aif_id == AIF1)
|
if (aif_id == AIF1)
|
||||||
error |= max98095_i2c_write(M98095_048_MIX_DAC_LR,
|
error |= max98095_i2c_write(priv, M98095_048_MIX_DAC_LR,
|
||||||
M98095_DAI1L_TO_DACL |
|
M98095_DAI1L_TO_DACL |
|
||||||
M98095_DAI1R_TO_DACR);
|
M98095_DAI1R_TO_DACR);
|
||||||
else
|
else
|
||||||
error |= max98095_i2c_write(M98095_048_MIX_DAC_LR,
|
error |= max98095_i2c_write(priv, M98095_048_MIX_DAC_LR,
|
||||||
M98095_DAI2M_TO_DACL |
|
M98095_DAI2M_TO_DACL |
|
||||||
M98095_DAI2M_TO_DACR);
|
M98095_DAI2M_TO_DACR);
|
||||||
|
|
||||||
error |= max98095_i2c_write(M98095_092_PWR_EN_OUT,
|
error |= max98095_i2c_write(priv, M98095_092_PWR_EN_OUT,
|
||||||
M98095_SPK_SPREADSPECTRUM);
|
M98095_SPK_SPREADSPECTRUM);
|
||||||
error |= max98095_i2c_write(M98095_04E_CFG_HP, M98095_HPNORMAL);
|
error |= max98095_i2c_write(priv, M98095_04E_CFG_HP, M98095_HPNORMAL);
|
||||||
if (aif_id == AIF1)
|
if (aif_id == AIF1)
|
||||||
error |= max98095_i2c_write(M98095_02C_DAI1_IOCFG,
|
error |= max98095_i2c_write(priv, M98095_02C_DAI1_IOCFG,
|
||||||
M98095_S1NORMAL | M98095_SDATA);
|
M98095_S1NORMAL | M98095_SDATA);
|
||||||
else
|
else
|
||||||
error |= max98095_i2c_write(M98095_036_DAI2_IOCFG,
|
error |= max98095_i2c_write(priv, M98095_036_DAI2_IOCFG,
|
||||||
M98095_S2NORMAL | M98095_SDATA);
|
M98095_S2NORMAL | M98095_SDATA);
|
||||||
|
|
||||||
/* take the codec out of the shut down */
|
/* take the codec out of the shut down */
|
||||||
error |= max98095_update_bits(M98095_097_PWR_SYS, M98095_SHDNRUN,
|
error |= max98095_bic_or(priv, M98095_097_PWR_SYS, M98095_SHDNRUN,
|
||||||
M98095_SHDNRUN);
|
M98095_SHDNRUN);
|
||||||
/* route DACL and DACR output to HO and Spekers */
|
/*
|
||||||
error |= max98095_i2c_write(M98095_050_MIX_SPK_LEFT, 0x01); /* DACL */
|
* route DACL and DACR output to HO and Speakers
|
||||||
error |= max98095_i2c_write(M98095_051_MIX_SPK_RIGHT, 0x01);/* DACR */
|
* Ordering: DACL, DACR, DACL, DACR
|
||||||
error |= max98095_i2c_write(M98095_04C_MIX_HP_LEFT, 0x01); /* DACL */
|
*/
|
||||||
error |= max98095_i2c_write(M98095_04D_MIX_HP_RIGHT, 0x01); /* DACR */
|
error |= max98095_i2c_write(priv, M98095_050_MIX_SPK_LEFT, 0x01);
|
||||||
|
error |= max98095_i2c_write(priv, M98095_051_MIX_SPK_RIGHT, 0x01);
|
||||||
|
error |= max98095_i2c_write(priv, M98095_04C_MIX_HP_LEFT, 0x01);
|
||||||
|
error |= max98095_i2c_write(priv, M98095_04D_MIX_HP_RIGHT, 0x01);
|
||||||
|
|
||||||
/* power Enable */
|
/* power Enable */
|
||||||
error |= max98095_i2c_write(M98095_091_PWR_EN_OUT, 0xF3);
|
error |= max98095_i2c_write(priv, M98095_091_PWR_EN_OUT, 0xF3);
|
||||||
|
|
||||||
/* set Volume */
|
/* set Volume */
|
||||||
error |= max98095_i2c_write(M98095_064_LVL_HP_L, 15);
|
error |= max98095_i2c_write(priv, M98095_064_LVL_HP_L, 15);
|
||||||
error |= max98095_i2c_write(M98095_065_LVL_HP_R, 15);
|
error |= max98095_i2c_write(priv, M98095_065_LVL_HP_R, 15);
|
||||||
error |= max98095_i2c_write(M98095_067_LVL_SPK_L, 16);
|
error |= max98095_i2c_write(priv, M98095_067_LVL_SPK_L, 16);
|
||||||
error |= max98095_i2c_write(M98095_068_LVL_SPK_R, 16);
|
error |= max98095_i2c_write(priv, M98095_068_LVL_SPK_R, 16);
|
||||||
|
|
||||||
/* Enable DAIs */
|
/* Enable DAIs */
|
||||||
error |= max98095_i2c_write(M98095_093_BIAS_CTRL, 0x30);
|
error |= max98095_i2c_write(priv, M98095_093_BIAS_CTRL, 0x30);
|
||||||
if (aif_id == AIF1)
|
if (aif_id == AIF1)
|
||||||
error |= max98095_i2c_write(M98095_096_PWR_DAC_CK, 0x01);
|
error |= max98095_i2c_write(priv, M98095_096_PWR_DAC_CK, 0x01);
|
||||||
else
|
else
|
||||||
error |= max98095_i2c_write(M98095_096_PWR_DAC_CK, 0x07);
|
error |= max98095_i2c_write(priv, M98095_096_PWR_DAC_CK, 0x07);
|
||||||
|
|
||||||
err_access:
|
err_access:
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue