/*
* alc5632.c -- ALC5632 ALSA SoC Audio Codec
*
* Copyright (C) 2011 The AC100 Kernel Team <ac100@lists.lauchpad.net>
*
* Authors: Leon Romanovsky <leon@leon.nu>
* Andrey Danin <danindrey@mail.ru>
* Ilya Petrov <ilya.muromec@gmail.com>
* Marc Dietrich <marvin24@gmx.de>
*
* Based on alc5623.c by Arnaud Patard
*
* 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.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include "alc5632.h"
/*
* ALC5632 register cache
*/
static const u16 alc5632_reg_defaults[] = {
0x59B4, 0x0000, 0x8080, 0x0000, /* 0 */
0x8080, 0x0000, 0x8080, 0x0000, /* 4 */
0xC800, 0x0000, 0xE808, 0x0000, /* 8 */
0x1010, 0x0000, 0x0808, 0x0000, /* 12 */
0xEE0F, 0x0000, 0xCBCB, 0x0000, /* 16 */
0x7F7F, 0x0000, 0x0000, 0x0000, /* 20 */
0xE010, 0x0000, 0x0000, 0x0000, /* 24 */
0x8008, 0x0000, 0x0000, 0x0000, /* 28 */
0x0000, 0x0000, 0x0000, 0x0000, /* 32 */
0x00C0, 0x0000, 0xEF00, 0x0000, /* 36 */
0x0000, 0x0000, 0x0000, 0x0000, /* 40 */
0x0000, 0x0000, 0x0000, 0x0000, /* 44 */
0x0000, 0x0000, 0x0000, 0x0000, /* 48 */
0x8000, 0x0000, 0x0000, 0x0000, /* 52 */
0x0000, 0x0000, 0x0000, 0x0000, /* 56 */
0x0000, 0x0000, 0x8000, 0x0000, /* 60 */
0x0C0A, 0x0000, 0x0000, 0x0000, /* 64 */
0x0000, 0x0000, 0x0000, 0x0000, /* 68 */
0x0000, 0x0000, 0x0000, 0x0000, /* 72 */
0xBE3E, 0x0000, 0xBE3E, 0x0000, /* 76 */
0x0000, 0x0000, 0x0000, 0x0000, /* 80 */
0x803A, 0x0000, 0x0000, 0x0000, /* 84 */
0x0000, 0x0000, 0x0009, 0x0000, /* 88 */
0x0000, 0x0000, 0x3000, 0x0000, /* 92 */
0x3075, 0x0000, 0x1010, 0x0000, /* 96 */
0x3110, 0x0000, 0x0000, 0x0000, /* 100 */
0x0553, 0x0000, 0x0000, 0x0000, /* 104 */
0x0000, 0x0000, 0x0000, 0x0000, /* 108 */
};
/* codec private data */
struct alc5632_priv {
enum snd_soc_control_type control_type;
void *control_data;
struct mutex mutex;
u8 id;
unsigned int sysclk;
};
static int alc5632_volatile_register(struct snd_soc_codec *codec,
unsigned int reg)
{
switch (reg) {
case ALC5632_RESET:
case ALC5632_PWR_DOWN_CTRL_STATUS:
case ALC5632_GPIO_PIN_STATUS:
case ALC5632_OVER_CURR_STATUS:
case ALC5632_HID_CTRL_DATA:
case ALC5632_EQ_CTRL:
return 1;
default:
break;
}
return 0;
}
static inline int alc5632_reset(struct snd_soc_codec *codec)
{
snd_soc_write(codec, ALC5632_RESET, 0);
return snd_soc_read(codec,<