1
0
Fork 0
forked from len0rd/rockbox

Submit first part of FS#12154. Whitespace removal and correction of several defines in WM8758 driver according to data sheet, no functional change. Thanks to Seheon Ryu.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30024 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andree Buschmann 2011-06-20 18:37:51 +00:00
parent f2ef42c1da
commit f0c032a523
3 changed files with 119 additions and 102 deletions

View file

@ -130,18 +130,18 @@ void audiohw_preinit(void)
wmcodec_write(RESET, RESET_RESET);
wmcodec_write(PWRMGMT1, PWRMGMT1_PLLEN | PWRMGMT1_BIASEN
| PWRMGMT1_VMIDSEL_5K);
| PWRMGMT1_VMIDSEL_10K);
wmcodec_write(PWRMGMT2, PWRMGMT2_ROUT1EN | PWRMGMT2_LOUT1EN);
wmcodec_write(PWRMGMT3, PWRMGMT3_LOUT2EN | PWRMGMT3_ROUT2EN
| PWRMGMT3_RMIXEN | PWRMGMT3_LMIXEN
| PWRMGMT3_DACENR | PWRMGMT3_DACENL);
wmcodec_write(AINTFCE, AINTFCE_IWL_16BIT | AINTFCE_FORMAT_I2S);
wmcodec_write(OUTCTRL, OUTCTRL_VROI);
wmcodec_write(CLKCTRL, CLKCTRL_MS); /* WM8758 is clock master */
audiohw_set_frequency(HW_FREQ_44);
wmcodec_write(LOUTMIX, LOUTMIX_DACL2LMIX);
wmcodec_write(ROUTMIX, ROUTMIX_DACR2RMIX);
}
@ -149,7 +149,7 @@ void audiohw_preinit(void)
void audiohw_postinit(void)
{
wmcodec_write(PWRMGMT1, PWRMGMT1_PLLEN | PWRMGMT1_BIASEN
| PWRMGMT1_VMIDSEL_75K);
| PWRMGMT1_VMIDSEL_100K);
/* lower the VMID power consumption */
audiohw_mute(false);
}
@ -159,12 +159,12 @@ void audiohw_set_master_vol(int vol_l, int vol_r)
int dac_l, amp_l, dac_r, amp_r;
get_volume_params(vol_l, &dac_l, &amp_l);
get_volume_params(vol_r, &dac_r, &amp_r);
/* set DAC
/* set DAC
Important: DAC is global and will also affect lineout */
wmcodec_write(LDACVOL, dac_l);
wmcodec_write(RDACVOL, dac_r | RDACVOL_DACVU);
/* set headphone amp OUT1 */
wmcodec_write(LOUT1VOL, amp_l | LOUT1VOL_LOUT1ZC);
wmcodec_write(ROUT1VOL, amp_r | ROUT1VOL_ROUT1ZC | ROUT1VOL_OUT1VU);
@ -175,7 +175,7 @@ void audiohw_set_lineout_vol(int vol_l, int vol_r)
int dac_l, amp_l, dac_r, amp_r;
get_volume_params(vol_l, &dac_l, &amp_l);
get_volume_params(vol_r, &dac_r, &amp_r);
/* set lineout amp OUT2 */
wmcodec_write(LOUT2VOL, amp_l | LOUT2VOL_LOUT2ZC);
wmcodec_write(ROUT2VOL, amp_r | ROUT2VOL_ROUT2ZC | ROUT2VOL_OUT2VU);
@ -186,7 +186,7 @@ void audiohw_enable_lineout(bool enable)
/* Initialize data without lineout enabling. */
int pwrmgmt3_data = PWRMGMT3_RMIXEN | PWRMGMT3_LMIXEN
| PWRMGMT3_DACENR | PWRMGMT3_DACENL;
/* Set lineout (OUT2), if enabled. */
/* Set lineout (OUT2), if enabled. */
if (enable)
pwrmgmt3_data |= PWRMGMT3_LOUT2EN | PWRMGMT3_ROUT2EN;
@ -209,13 +209,13 @@ void audiohw_set_bass_cutoff(int value)
void audiohw_set_treble(int value)
{
eq5_reg = (eq5_reg & ~EQ_GAIN_MASK) | EQ_GAIN_VALUE(value);
wmcodec_write(EQ5, eq5_reg);
wmcodec_write(EQ5, eq5_reg);
}
void audiohw_set_treble_cutoff(int value)
{
eq5_reg = (eq5_reg & ~EQ_CUTOFF_MASK) | EQ_CUTOFF_VALUE(value);
wmcodec_write(EQ5, eq5_reg);
wmcodec_write(EQ5, eq5_reg);
}
/* Nice shutdown of WM8758 codec */
@ -232,10 +232,10 @@ void audiohw_close(void)
void audiohw_set_frequency(int fsel)
{
/* CLKCTRL_MCLKDIV_MASK and ADDCTRL_SR_MASK don't overlap,
so they can both fit in one byte. Bit 0 selects PLL
so they can both fit in one byte. Bit 0 selects PLL
configuration via pll_setups.
*/
static const unsigned char freq_setups[HW_NUM_FREQ] =
static const unsigned char freq_setups[HW_NUM_FREQ] =
{
[HW_FREQ_48] = CLKCTRL_MCLKDIV_2 | ADDCTRL_SR_48kHz | 1,
[HW_FREQ_44] = CLKCTRL_MCLKDIV_2 | ADDCTRL_SR_48kHz,
@ -248,11 +248,11 @@ void audiohw_set_frequency(int fsel)
[HW_FREQ_8] = CLKCTRL_MCLKDIV_12 | ADDCTRL_SR_8kHz | 1
};
/* Each PLL configuration is an array consisting of
/* Each PLL configuration is an array consisting of
{ PLLN, PLLK1, PLLK2, PLLK3 }. The WM8983 datasheet requires
5 < PLLN < 13, and states optimum is PLLN = 8, f2 = 90 MHz
*/
static const unsigned short pll_setups[2][4] =
static const unsigned short pll_setups[2][4] =
{
/* f1 = 12 MHz, R = 7.5264, f2 = 90.3168 MHz, fPLLOUT = 22.5792 MHz */
{ PLLN_PLLPRESCALE | 0x7, 0x21, 0x161, 0x26 },
@ -267,12 +267,12 @@ void audiohw_set_frequency(int fsel)
wmcodec_write(PLLN + i, pll_setups[freq_setups[fsel] & 1][i]);
/* CLKCTRL_MCLKDIV divides fPLLOUT to get SYSCLK (256 * sample rate) */
wmcodec_write(CLKCTRL, CLKCTRL_CLKSEL
wmcodec_write(CLKCTRL, CLKCTRL_CLKSEL
| (freq_setups[fsel] & CLKCTRL_MCLKDIV_MASK)
| CLKCTRL_BCLKDIV_2 | CLKCTRL_MS);
/* set ADC and DAC filter characteristics according to sample rate */
wmcodec_write(ADDCTRL, (freq_setups[fsel] & ADDCTRL_SR_MASK)
wmcodec_write(ADDCTRL, (freq_setups[fsel] & ADDCTRL_SR_MASK)
| ADDCTRL_SLOWCLKEN);
/* SLOWCLK enabled for zero cross timeout to work */
}
@ -280,7 +280,7 @@ void audiohw_set_frequency(int fsel)
void audiohw_enable_recording(bool source_mic)
{
(void)source_mic; /* We only have a line-in (I think) */
wmcodec_write(PWRMGMT2, PWRMGMT2_ROUT1EN | PWRMGMT2_LOUT1EN
| PWRMGMT2_INPGAENR | PWRMGMT2_INPGAENL
| PWRMGMT2_ADCENR | PWRMGMT2_ADCENL);
@ -297,7 +297,7 @@ void audiohw_enable_recording(bool source_mic)
| ROUTMIX_BYPR2RMIX | ROUTMIX_DACR2RMIX);
}
void audiohw_disable_recording(void)
void audiohw_disable_recording(void)
{
wmcodec_write(LOUTMIX, LOUTMIX_DACL2LMIX);
wmcodec_write(ROUTMIX, ROUTMIX_DACR2RMIX);
@ -323,8 +323,7 @@ void audiohw_set_recvol(int left, int right, int type)
}
}
void audiohw_set_monitor(bool enable)
void audiohw_set_monitor(bool enable)
{
(void)enable;
}