Source
x
/*
* Driver for AT73C213 16-bit stereo DAC connected to Atmel SSC
*
* Copyright (C) 2006-2007 Atmel Norway
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
/*#define DEBUG*/
/* Hardware limit? */
/* Hardware limit. */
/* Initial (hardware reset) AT73C213 register values. */
static u8 snd_at73c213_original_image[18] =
{
0x00, /* 00 - CTRL */
0x05, /* 01 - LLIG */
0x05, /* 02 - RLIG */
0x08, /* 03 - LPMG */
0x08, /* 04 - RPMG */
0x00, /* 05 - LLOG */
0x00, /* 06 - RLOG */
0x22, /* 07 - OLC */
0x09, /* 08 - MC */
0x00, /* 09 - CSFC */
0x00, /* 0A - MISC */
0x00, /* 0B - */
0x00, /* 0C - PRECH */
0x05, /* 0D - AUXG */
0x00, /* 0E - */
0x00, /* 0F - */
0x00, /* 10 - RST */
0x00, /* 11 - PA_CTRL */
};
struct snd_at73c213 {
struct snd_card *card;
struct snd_pcm *pcm;
struct snd_pcm_substream *substream;
struct at73c213_board_info *board;
int irq;
int period;
unsigned long bitrate;
struct ssc_device *ssc;
struct spi_device *spi;
u8 spi_wbuffer[2];
u8 spi_rbuffer[2];
/* Image of the SPI registers in AT73C213. */
u8 reg_image[18];
/* Protect SSC registers against concurrent access. */
spinlock_t lock;
/* Protect mixer registers against concurrent access. */
struct mutex mixer_lock;
};
static int
snd_at73c213_write_reg(struct snd_at73c213 *chip, u8 reg, u8 val)
{
struct spi_message msg;
struct spi_transfer msg_xfer = {
.len = 2,
.cs_change = 0,