/*
* wm8997.c -- WM8997 ALSA SoC Audio driver
*
* Copyright 2012 Wolfson Microelectronics plc
*
* Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
*
* 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/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <linux/mfd/arizona/core.h>
#include <linux/mfd/arizona/registers.h>
#include "arizona.h"
#include "wm8997.h"
struct wm8997_priv {
struct arizona_priv core;
struct arizona_fll fll[2];
};
static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0);
static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
static const struct reg_default wm8997_sysclk_reva_patch[] = {
{ 0x301D, 0x7B15 },
{ 0x301B, 0x0050 },
{ 0x305D, 0x7B17 },
{ 0x305B, 0x0050 },
{ 0x3001, 0x08FE },
{ 0x3003, 0x00F4 },
{ 0x3041, 0x08FF },
{ 0x3043, 0x0005 },
{ 0x3020, 0x0225 },
{ 0x3021, 0x0A00 },
{ 0x3022, 0xE24D },
{ 0x3023, 0x0800 },
{ 0x3024, 0xE24D },
{ 0x3025, 0xF000 },
{ 0x3060, 0x0226 },
{ 0x3061, 0x0A00 },
{ 0x3062, 0xE252 },
{ 0x3063, 0x0800 },
{ 0x3064, 0xE252 },
{ 0x3065, 0xF000 },
{ 0x3116, 0x022B },
{ 0x3117, 0xFA00 },
{ 0x3110, 0x246C },
{ 0x3111, 0x0A03 },
{ 0x3112, 0x246E },
{ 0x3113, 0x0A03 },
{ 0x3114, 0x2470 },
{ 0x3115, 0x0A03 },
{ 0x3126, 0x246C },
{ 0x3127, 0x0A02 },
{ 0x3128, 0x246E },
{ 0x3129, 0x0A02 },
{ 0x312A, 0x2470 },
{ 0x312B, 0xFA02 },
{ 0x3125, 0x0800 },
};
static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_codec *codec = w->codec;
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
struct regmap *regmap = arizona->regmap;
const struct reg_default *patch = NULL;
int i, patch_size;
switch (arizona->rev)