You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

61 lines
1.1 KiB

#include <string.h>
#include "platform_dsk.h"
#include "spi.h"
/*
* McBSP1/2 spi/i2s mode to configure AIC23 codec
*/
void __dsk_aic23_i2s_default(MCBSP_Config *mbconf)
{
mbconf->spcr = 0x00C50003;
mbconf->rcr = 0x00000140;
mbconf->xcr = 0x00000140;
mbconf->srgr = 0x20000001;
mbconf->mcr = 0;
mbconf->pcr = 0x00000003;
}
int mcbsp_aic23_init()
{
return i2s_slave_open(MCBSP_DEV2, 16);
}
void aic23_init()
{
Uint16 aic23[] = {
0x0017, /* reg 0 */
0x0017, /* reg 1 */
0x00fb, /* reg 2 <1f9> */
0x00fb, /* reg 3 <1f9> */
0x0133, /* reg 4 <11> */
0x0006, /* reg 5 <0> */
0x0000, /* reg 6 */
0x0052, /* reg 7 <43> */
0x0001, /* reg 8 */
0x0001, /* reg 9 */
};
Uint16 i, data;
if (spi_open(MCBSP_DEV1, SPI_MODE_3, 2000000, 16)) {
return;
}
for (i = 0; i < ARRAY_SIZE(aic23); i++) {
data = (i << 9) | aic23[i];
spi_write(MCBSP_DEV1, &data, sizeof data);
}
/* mcbsp_aic23_init(); */
/* spi_close(spi_dev); */
}
void mcbsp_aic23_close()
{
spi_close(MCBSP_DEV2);
}
int mcbsp_aic23_write(const Int16 *buf, int len)
{
return spi_write(MCBSP_DEV2, buf, len * 2);
}