Ejemplo n.º 1
0
int audiohw_set_linein_vol(int vol_l, int vol_r)
{
    MSG("audiohw_set_linein_vol\n");
    wmcodec_write(LINV, LINV_LINVOL(vol_l)|LINV_LIVU);
    wmcodec_write(RINV, RINV_RINVOL(vol_r)|RINV_RIVU);
    return 0;
}
Ejemplo n.º 2
0
/* Reset and power up the WM8751 */
void audiohw_preinit(void)
{
	int i;
	/*
	* 1. Switch on power supplies.
	*    By default the WM8751 is in Standby Mode, the DAC is
	*    digitally muted and the Audio Interface, Line outputs
	*    and Headphone outputs are all OFF (DACMU = 1 Power
	*    Management registers 1 and 2 are all zeros).
	*/
	//if(wmcodec_reg_data[RESET]!=0)
	//	return;
	
	memset(wmcodec_reg_data, 0 , sizeof(unsigned long)*48);
	
	wmcodec_write(RESET, RESET_RESET);    /*Reset*/
	
	//for(i = 0; i < 1000*HZ; i++);
	sleep(1);
	
	wmcodec_reg_data[RESET] = 0xFFFF;
	/* 2. Enable Vmid and VREF. */
	wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_50K );
              
}
Ejemplo n.º 3
0
void audiohw_set_MCLK(unsigned int bUsb)
{
	if (bUsb)
		wmcodec_write(CLOCKING, CLOCKING_SR_USB);
	else
		wmcodec_write(CLOCKING, 0);
}
Ejemplo n.º 4
0
/* Reset and power up the WM8751 */
void audiohw_preinit(void)
{
#ifdef MROBE_100
    /* controls headphone ouput */
    GPIOL_ENABLE     |= 0x10;
    GPIOL_OUTPUT_EN  |= 0x10;
    GPIOL_OUTPUT_VAL |= 0x10; /* disable */
#endif

    /*
     * 1. Switch on power supplies.
     *    By default the WM8751 is in Standby Mode, the DAC is
     *    digitally muted and the Audio Interface, Line outputs
     *    and Headphone outputs are all OFF (DACMU = 1 Power
     *    Management registers 1 and 2 are all zeros).
     */

    wmcodec_write(RESET, RESET_RESET);    /*Reset*/

     /* 2. Enable Vmid and VREF. */
    wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_5K);

#ifdef CODEC_SLAVE
    wmcodec_write(AINTFCE,AINTFCE_WL_16|AINTFCE_FORMAT_I2S);
#else
    /* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */
    /* IWL=00(16 bit) FORMAT=10(I2S format) */
    wmcodec_write(AINTFCE, AINTFCE_MS | AINTFCE_WL_16 |
                  AINTFCE_FORMAT_I2S);
#endif
    /* Set default samplerate */

    audiohw_set_frequency(HW_FREQ_DEFAULT);
}
Ejemplo n.º 5
0
void audiohw_set_master_vol(int vol_l, int vol_r)
{
    /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */
    /* 1111111 ==  +6dB                                    */
    /* 1111001 ==   0dB                                    */
    /* 0110000 == -73dB                                    */
    /* 0101111 == mute (0x2f)                              */

    wmcodec_write(LOUT1, LOUT1_BITS | LOUT1_LOUT1VOL(vol_l));
    wmcodec_write(ROUT1, ROUT1_BITS | ROUT1_ROUT1VOL(vol_r));
}
Ejemplo n.º 6
0
/* Nice shutdown of WM8751 codec */
void audiohw_close(void)
{
	/* 1. Set DACMU = 1 to soft-mute the audio DACs. */
	audiohw_mute(true);

	/* 2. Disable all output buffers. */
	wmcodec_write(PWRMGMT2, 0x0);

	/* 3. Switch off the power supplies. */
	wmcodec_write(PWRMGMT1, 0x0);
}
Ejemplo n.º 7
0
void audiohw_sel_input(int ain)
{
    switch(ain)
    {
    case 1:
        wmcodec_write(ADCLPATH, ADCLPATH_LINSEL_IN1);
        wmcodec_write(ADCRPATH, ADCRPATH_RINSEL_IN1);
        //wmcodec_write(ADCINMODE, ADCINMODE_RDCM_EN|ADCINMODE_LDCM_EN);
        break;
    case 2:
        wmcodec_write(ADCLPATH, ADCLPATH_LINSEL_IN2);
        wmcodec_write(ADCRPATH, ADCRPATH_RINSEL_IN2);
        //wmcodec_write(ADCLPATH, ADCLPATH_LINSEL_DS);
        //wmcodec_write(ADCRPATH, ADCRPATH_RINSEL_DS);
        //wmcodec_write(ADCINMODE, ADCINMODE_DS_IN2|ADCINMODE_RDCM_EN|ADCINMODE_LDCM_EN);
        break;
    case 3:
        wmcodec_write(ADCLPATH, ADCLPATH_LINSEL_IN3);
        wmcodec_write(ADCRPATH, ADCRPATH_RINSEL_IN3);
        break;
    default:
        wmcodec_write(ADCLPATH, ADCLPATH_LINSEL_IN1);
        wmcodec_write(ADCRPATH, ADCRPATH_RINSEL_IN1);
        break;
    }
    return;
}
Ejemplo n.º 8
0
int audiohw_set_master_vol(int vol_l, int vol_r)
{
	/* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */
	/* 1111111 ==  +6dB                                    */
	/* 1111001 ==   0dB                                    */
	/* 0110000 == -73dB                                    */
	/* 0101111 == mute (0x2f)                              */

	//wmcodec_write(LOUT1, LOUT1_BITS | LOUT1_LOUT1VOL(vol_l));
	//wmcodec_write(ROUT1, ROUT1_BITS | ROUT1_ROUT1VOL(vol_r));

	wmcodec_write(LEFTGAIN, LEFTGAIN_LDVU | LEFTGAIN_LDACVOL(vol_l));
	wmcodec_write(RIGHTGAIN, RIGHTGAIN_LDVU | RIGHTGAIN_LDACVOL(vol_r));
	return 0;
}
Ejemplo n.º 9
0
/* Reset and power up the WM8751 */
void audiohw_preinit()
{
	/*
	 * 1. Switch on power supplies.
	 *    By default the WM8751 is in Standby Mode, the DAC is
	 *    digitally muted and the Audio Interface, Line outputs
	 *    and Headphone outputs are all OFF (DACMU = 1 Power
	 *    Management registers 1 and 2 are all zeros).
	 */
	wmcodec_write(RESET, RESET_RESET);	/*Reset */

	/* 2. Enable Vmid and VREF. */
	wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_5K);

}
Ejemplo n.º 10
0
/* Nice shutdown of WM8751 codec */
void audiohw_close(void)
{
    /* 1. Set DACMU = 1 to soft-mute the audio DACs. */
    audiohw_mute(true);

    wmcodec_write(LADCVOL, 0);
    wmcodec_write(RADCVOL, 0);

    /* 2. Disable all output buffers. */
    wmcodec_write(PWRMGMT2, 0x0);

    /* 3. Switch off the power supplies. */
    wmcodec_write(PWRMGMT1, 0x0);

    memset(wmcodec_reg_data, 0 , sizeof(unsigned long)*48);
}
Ejemplo n.º 11
0
void audiohw_preinit(void)
{
    /* POWER UP SEQUENCE */
    /* 1) Switch on power supplies. By default the WM codec is in Standby Mode,
     *    the DAC is digitally muted and the Audio Interface and Outputs are
     *    all OFF. */
    wmcodec_write(RESET, RESET_RESET);

    /* 2) Set all required bits in the Power Down register (0Ch) to '0';
     *    EXCEPT the OUTPD bit, this should be set to '1' (Default). */
    wmc_clear(PDCTRL, PDCTRL_DACPD | PDCTRL_POWEROFF);

    /* 3) Set required values in all other registers except 12h (Active). */
    wmc_set(AINTFCE, 0); /* Set no bits - write init/shadow value */

    wmc_set(AAPCTRL, AAPCTRL_DACSEL);
    wmc_write(SAMPCTRL, WMC_USB24_44100HZ);

    /* 4) Set the 'Active' bit in register 12h. */
    codec_set_active(true);

    /* 5) The last write of the sequence should be setting OUTPD to '0'
     *    (active) in register 0Ch, enabling the DAC signal path, free
     *     of any significant power-up noise. */
    wmc_clear(PDCTRL, PDCTRL_OUTPD);
}
Ejemplo n.º 12
0
static void wm8975_write(int reg, unsigned val)
{
    if (WM8975_NUM_REGISTERS > reg) {
        wm8975_regs[reg] = val;
        wmcodec_write(reg, val);
    }
}
Ejemplo n.º 13
0
/* Note: Disable output before calling this function */
void audiohw_set_frequency(int fsel)
{
    MSG("audiohw_set_frequency=0x%08X\n",fsel);
    //fsel |= 0x0180;	// BCLK = MCLK/16
    //fsel |= 0x0080;
    //fsel &= 0xFFFFFFFE;
    wmcodec_write(CLOCKING, fsel);
}
Ejemplo n.º 14
0
static void wmc_write(int reg, unsigned val)
{
    if ((unsigned)reg >= WMC_NUM_REGS)
        return;

    wmc_regs[reg] = (unsigned char)val;
    wmcodec_write(reg, val);
}
Ejemplo n.º 15
0
void audiohw_set_bass(int value)
{
	wmcodec_write(BASSCTRL, BASSCTRL_BITS |
#ifdef USE_ADAPTIVE_BASS
		      BASSCTRL_BASS(adaptivebass2hw(value)));
#else
		      BASSCTRL_BASS(tone_tenthdb2hw(value)));
#endif
}
Ejemplo n.º 16
0
static void wmcodec_set_reg(unsigned int reg, unsigned int val)
{
    if (reg >= WM_NUM_REGS || (wmcodec_regs[reg] & 0x200))
        /* invalid register */
        return;

    wmcodec_regs[reg] = val & 0x1ff;
    wmcodec_write(reg, wmcodec_regs[reg]);
}
Ejemplo n.º 17
0
int audiohw_set_lineout_vol(int Aout, int vol_l, int vol_r)
{
    MSG("audiohw_set_lineout_vol\n");
    switch(Aout)
    {
    case 1:
        wmcodec_write(LOUT1, LOUT1_BITS | LOUT1_LOUT1VOL(vol_l));
        wmcodec_write(ROUT1, ROUT1_BITS | ROUT1_ROUT1VOL(vol_r));
        break;
    case 2:
        wmcodec_write(LOUT2, LOUT2_BITS | LOUT2_LOUT2VOL(vol_l));
        wmcodec_write(ROUT2, ROUT2_BITS | ROUT2_ROUT2VOL(vol_r));
        break;
    case 3:
        wmcodec_write(MONOOUT, MONOOUT_MOZC | MONOOUT_MONOOUTVOL(vol_l));
        break;
    }
    return 0;
}
Ejemplo n.º 18
0
static void wmc_write(unsigned int reg, unsigned int val)
{
    if (reg >= WMC_NUM_REGISTERS || (wmc_regs[reg] & 0x8000))
    {
        logf("wm8978 invalid register: %d", reg);
        return;
    }

    wmc_regs[reg] = val & ~0x8000;
    wmcodec_write(reg, val);
}
Ejemplo n.º 19
0
/* Enable DACs and audio output after a short delay */
void audiohw_postinit(int bSlave, int Aout)
{
	int i;
    /* From app notes: allow Vref to stabilize to reduce clicks */
    for(i = 0; i < 1000*HZ; i++);

     /* 3. Enable DACs as required. */
    wmcodec_write(PWRMGMT2, PWRMGMT2_DACL | PWRMGMT2_DACR);

     /* 4. Enable line and / or headphone output buffers as required. */
    wmcodec_write(PWRMGMT2, PWRMGMT2_DACL | PWRMGMT2_DACR |
                  PWRMGMT2_LOUT1 | PWRMGMT2_ROUT1 | PWRMGMT2_LOUT2 |
                 PWRMGMT2_ROUT2);

    wmcodec_write(ADDITIONAL1, ADDITIONAL1_TSDEN | ADDITIONAL1_TOEN |
                    ADDITIONAL1_DMONOMIX_LLRR | ADDITIONAL1_VSEL_DEFAULT);

	wmcodec_write(ADDITIONAL2, 0x08);


    wmcodec_write(LEFTMIX1, LEFTMIX1_LD2LO | LEFTMIX1_LI2LO_DEFAULT);
    wmcodec_write(RIGHTMIX2, RIGHTMIX2_RD2RO | RIGHTMIX2_RI2RO_DEFAULT);

	 /* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */
    /* IWL=00(16 bit) FORMAT=10(I2S format) */
	if(bSlave)
	{ 
		MSG("WM8751 slave.....\n");
		wmcodec_write(AINTFCE, AINTFCE_WL_16 | AINTFCE_FORMAT_I2S);
	}	
	else
	{
		MSG("WM8751 master.....\n");
  		/* AINTFCE_BCLKINV on or off depend on trying result */
    	wmcodec_write(AINTFCE, AINTFCE_MS | AINTFCE_WL_16 | AINTFCE_FORMAT_I2S);	
   	}


    audiohw_mute(false);
}
Ejemplo n.º 20
0
void audiohw_preinit(void)
{
    /* 1. Turn on external power supplies. Wait for supply voltage to settle. */

    /* Step 1 should be completed already. Reset and return all registers to
     * defaults */
    wmcodec_write(WMC_SOFTWARE_RESET, 0xff);
    sleep(HZ/10);

    /* 2. Mute all analogue outputs */
    wmc_set(WMC_LOUT1_HP_VOLUME_CTRL, WMC_MUTE);
    wmc_set(WMC_ROUT1_HP_VOLUME_CTRL, WMC_MUTE);
    wmc_set(WMC_LOUT2_SPK_VOLUME_CTRL, WMC_MUTE);
    wmc_set(WMC_ROUT2_SPK_VOLUME_CTRL, WMC_MUTE);
    wmc_set(WMC_OUT3_MIXER_CTRL, WMC_MUTE);
    wmc_set(WMC_OUT4_MONO_MIXER_CTRL, WMC_MUTE);

    /* 3. Set L/RMIXEN = 1 and DACENL/R = 1 in register R3. */
    wmc_write(WMC_POWER_MANAGEMENT3, WMC_RMIXEN | WMC_LMIXEN);

    /* EQ and 3D applied to DAC (Set before DAC enable!) */
    wmc_set(WMC_EQ1_LOW_SHELF, WMC_EQ3DMODE);

    wmc_set(WMC_POWER_MANAGEMENT3, WMC_DACENR | WMC_DACENL);

    /* 4. Set BUFIOEN = 1 and VMIDSEL[1:0] to required value in register
     *    R1. Wait for VMID supply to settle */
    wmc_write(WMC_POWER_MANAGEMENT1, WMC_BUFIOEN | WMC_VMIDSEL_300K);
    sleep(HZ/10);

    /* 5. Set BIASEN = 1 in register R1. */
    wmc_set(WMC_POWER_MANAGEMENT1, WMC_BIASEN);

    /* 6. Set L/ROUTEN = 1 in register R2. */
    wmc_write(WMC_POWER_MANAGEMENT2, WMC_LOUT1EN | WMC_ROUT1EN);
}
Ejemplo n.º 21
0
/* Enable DACs and audio output after a short delay */
void audiohw_postinit(int bSlave, int AIn, int AOut)
{
    int i;
    unsigned long data;

    if(wmcodec_reg_data[RESET]!=0xFFFF)
        return;

    /* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */
    /* IWL=00(16 bit) FORMAT=10(I2S format) */

    if(bSlave)
    {
        MSG("WM8750 slave.....\n");
        wmcodec_write(AINTFCE, AINTFCE_WL_16 | AINTFCE_FORMAT_I2S);
    }
    else
    {
        MSG("WM8750 master.....\n");
        /* AINTFCE_BCLKINV on or off depend on trying result */
        wmcodec_write(AINTFCE, AINTFCE_MS | AINTFCE_WL_16 | AINTFCE_FORMAT_I2S);
    }

    wmcodec_reg_data[RESET] = 0x5A5A;

    /* From app notes: allow Vref to stabilize to reduce clicks */
    for(i = 0; i < 1000*HZ; i++);

    data = wmcodec_reg_data[PWRMGMT1];

    if(AIn > 0)
        wmcodec_write(PWRMGMT1, data | PWRMGMT1_ADCL | PWRMGMT1_ADCR | PWRMGMT1_AINL | PWRMGMT1_AINR |PWRMGMT1_MICB);
    //wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_50K | PWRMGMT1_ADCL | PWRMGMT1_ADCR | PWRMGMT1_AINL | PWRMGMT1_AINR );

    /* 3. Enable DACs as required. */
    if(AOut > 0)
    {
        data = PWRMGMT2_DACL | PWRMGMT2_DACR;
        switch(AOut)
        {
        case 1:
            data |= PWRMGMT2_LOUT1 | PWRMGMT2_ROUT1;
            break;
        case 2:
            data |= PWRMGMT2_LOUT2 | PWRMGMT2_ROUT2;
            break;
        case 3:
            data |= PWRMGMT2_OUT3;
            break;
        default:
            break;
        }
        wmcodec_write(PWRMGMT2,   data);
    }
    else
    {
        wmcodec_write(PWRMGMT2, 0);
    }

    /* 4. Enable line and / or headphone output buffers as required. */
    wmcodec_write(ADDITIONAL1, ADDITIONAL1_TOEN | ADDITIONAL1_DMONOMIX_LLRR | ADDITIONAL1_VSEL_DEFAULT);

    if(AOut==2)
    {
        wmcodec_write(ADDITIONAL2, ADDITIONAL2_HPSWEN|ADDITIONAL2_HPSWPOL);
    }
    else
    {
        wmcodec_write(ADDITIONAL2, ADDITIONAL2_LRCM_ON);
    }

    wmcodec_write(ADDITIONAL3, ADDITIONAL3_ADCLRM(0));

    wmcodec_write(RIGHTMIX1, 0);
    wmcodec_write(LEFTMIX2, 0);
    if(AOut > 0)
    {
        wmcodec_write(LEFTMIX1, LEFTMIX1_LD2LO);
        wmcodec_write(RIGHTMIX2, RIGHTMIX2_RD2RO);
        wmcodec_write(LOUT1, 0x179);
        wmcodec_write(ROUT1, 0x179);
        wmcodec_write(LEFTGAIN, 0x1FF);
        wmcodec_write(RIGHTGAIN, 0x1FF);
    }
    else
    {
        wmcodec_write(LEFTMIX1, 0);
        wmcodec_write(RIGHTMIX2, 0);
        wmcodec_write(LOUT1, 0);
        wmcodec_write(ROUT1, 0);
    }
    wmcodec_write(MONOMIX1, 0);
    wmcodec_write(MONOMIX2, 0);
    wmcodec_write(ADCCTRL, ADCCTRL_ADCHPD);
    if(AIn>0)
    {
        //wmcodec_write(LINV, LINV_LINVOL(0x00)|LINV_LIVU);
        //wmcodec_write(RINV, RINV_RINVOL(0x00)|RINV_RIVU);
        //wmcodec_write(LINV, 0x117);
        //wmcodec_write(RINV, 0x117);
        wmcodec_write(LINV, 0x100);
        wmcodec_write(RINV, 0x100);

        wmcodec_write(ALC1, 0);
        wmcodec_write(NOISEGATE, 0x03);
        //wmcodec_write(ALC1, ALC1_ALCL(0x01)|ALC1_SET_MAXGAIN(0x1)|ALC1_ALCSTEREO);
        //wmcodec_write(NOISEGATE, NOISEGATE_SET_NGTH(0x1F)|NOISEGATE_SET_NGG(0x01)|NOISEGATE_NGAT_ENABLE);

        audiohw_sel_input(AIn);
    }
    else
    {
        wmcodec_write(LINV, LINV_LINMUTE);
        wmcodec_write(RINV, RINV_RINMUTE);
    }

    //wmcodec_write(LEFTGAIN, 0x1FF);
    //wmcodec_write(RIGHTGAIN, 0x1FF);
    if(AOut > 0)
        audiohw_mute(false);
    else
        audiohw_mute(true);
}
Ejemplo n.º 22
0
/* Note: Disable output before calling this function */
void audiohw_set_frequency(int fsel)
{
	wmcodec_write(CLOCKING, fsel);
}
Ejemplo n.º 23
0
void audiohw_mute(bool mute)
{
	/* Mute:   Set DACMU = 1 to soft-mute the audio DACs. */
	/* Unmute: Set DACMU = 0 to soft-un-mute the audio DACs. */
	wmcodec_write(DACCTRL, mute ? DACCTRL_DACMU : 0);
}
Ejemplo n.º 24
0
void audiohw_set_treble(int value)
{
	wmcodec_write(TREBCTRL, TREBCTRL_BITS |
		      TREBCTRL_TREB(tone_tenthdb2hw(value)));
}
Ejemplo n.º 25
0
int audiohw_set_lineout_vol(int vol_l, int vol_r)
{
	wmcodec_write(LOUT2, LOUT2_BITS | LOUT2_LOUT2VOL(vol_l));
	wmcodec_write(ROUT2, ROUT2_BITS | ROUT2_ROUT2VOL(vol_r));
	return 0;
}
Ejemplo n.º 26
0
void audiohw_loopback(int fsel)
{
    int i;
    memset(wmcodec_reg_data, 0 , sizeof(unsigned long)*48);

    wmcodec_write(RESET, 0x000);    /*Reset*/

    for(i = 0; i < 1000*HZ; i++);

    //wmcodec_write(ADDITIONAL2, 0x0010);
    //wmcodec_write(PWRMGMT1, 0x0FC );


    wmcodec_write(AINTFCE, AINTFCE_WL_16|AINTFCE_FORMAT_I2S|AINTFCE_MS);
    wmcodec_write(LINV, 0x117);
    wmcodec_write(RINV, 0x117);
    wmcodec_write(LOUT1, 0x179);
    wmcodec_write(ROUT1, 0x179);
    wmcodec_write(ADCCTRL, 0);
    wmcodec_write(CLOCKING, fsel);
    wmcodec_write(LEFTGAIN, 0x01FF);
    wmcodec_write(RIGHTGAIN, 0x01FF);
    wmcodec_write(PWRMGMT1, 0x0FC );
    wmcodec_write(PWRMGMT2, 0x1E0 );
    wmcodec_write(LEFTMIX1, 0x150 );
    wmcodec_write(RIGHTMIX2, 0x150 );
}
Ejemplo n.º 27
0
/* Enable DACs and audio output after a short delay */
void audiohw_postinit(void)
{
    /* From app notes: allow Vref to stabilize to reduce clicks */
    sleep(HZ);

     /* 3. Enable DACs as required. */
    wmcodec_write(PWRMGMT2, PWRMGMT2_DACL | PWRMGMT2_DACR);

     /* 4. Enable line and / or headphone output buffers as required. */
#if defined(MROBE_100) || defined(MPIO_HD200)
    wmcodec_write(PWRMGMT2, PWRMGMT2_DACL | PWRMGMT2_DACR |
                  PWRMGMT2_LOUT1 | PWRMGMT2_ROUT1);
#else
    wmcodec_write(PWRMGMT2, PWRMGMT2_DACL | PWRMGMT2_DACR |
                  PWRMGMT2_LOUT1 | PWRMGMT2_ROUT1 | PWRMGMT2_LOUT2 |
                  PWRMGMT2_ROUT2);
#endif

    wmcodec_write(ADDITIONAL1, ADDITIONAL1_TSDEN | ADDITIONAL1_TOEN |
                    ADDITIONAL1_DMONOMIX_LLRR | ADDITIONAL1_VSEL_DEFAULT);

    wmcodec_write(LEFTMIX1, LEFTMIX1_LD2LO | LEFTMIX1_LI2LO_DEFAULT);
    wmcodec_write(RIGHTMIX2, RIGHTMIX2_RD2RO | RIGHTMIX2_RI2RO_DEFAULT);

#ifdef TOSHIBA_GIGABEAT_F
#ifdef HAVE_HARDWARE_BEEP
    /* Single-ended mono input */
    wmcodec_write(MONOMIX1, 0);

    /* Route mono input to both outputs at 0dB */
    wmcodec_write(LEFTMIX2, LEFTMIX2_MI2LO | LEFTMIX2_MI2LOVOL(2));
    wmcodec_write(RIGHTMIX1, RIGHTMIX1_MI2RO | RIGHTMIX1_MI2ROVOL(2));
#endif
#endif

#ifdef MPIO_HD200
    /* Crude fix for high pitch noise at startup
     * I should find out what realy causes this
     */
    wmcodec_write(LOUT1, LOUT1_BITS|0x7f);
    wmcodec_write(ROUT1, ROUT1_BITS|0x7f);
    wmcodec_write(LOUT1, LOUT1_BITS);
    wmcodec_write(ROUT1, ROUT1_BITS);
#endif

    /* lower power consumption */
    wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_50K);

    audiohw_mute(false);

#ifdef MROBE_100
    /* enable headphone output */
    GPIOL_OUTPUT_VAL &= ~0x10;
    GPIOL_OUTPUT_EN  |=  0x10;
#endif
}
Ejemplo n.º 28
0
void audiohw_bypass(void)
{
    int i;
    memset(wmcodec_reg_data, 0 , sizeof(unsigned long)*48);
    wmcodec_write(RESET, 0x000);    /*Reset*/

    for(i = 0; i < 1000*HZ; i++);

    wmcodec_write(LINV, 0x117);
    wmcodec_write(RINV, 0x117);
    wmcodec_write(LOUT1, 0x179);
    wmcodec_write(ROUT1, 0x179);
    wmcodec_write(DACCTRL, 0);
    wmcodec_write(AINTFCE, 0x42);
    wmcodec_write(CLOCKING, 0x23);
    wmcodec_write(LEFTGAIN, 0x1FF);
    wmcodec_write(RIGHTGAIN, 0x1FF);
    wmcodec_write(PWRMGMT1, 0x0F0);
    wmcodec_write(PWRMGMT2, 0x060);
    wmcodec_write(LEFTMIX1, 0xA0 );
    wmcodec_write(RIGHTMIX2, 0xA0 );
}