/*
* cs35l33.c -- CS35L33 ALSA SoC audio driver
*
* Copyright 2016 Cirrus Logic, Inc.
*
* Author: Paul Handrigan <paul.handrigan@cirrus.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/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/platform_device.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <sound/cs35l33.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/machine.h>
#include <linux/of_gpio.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_irq.h>
#include "cs35l33.h"
#define CS35L33_BOOT_DELAY 50
struct cs35l33_private {
struct snd_soc_component *component;
struct cs35l33_pdata pdata;
struct regmap *regmap;
struct gpio_desc *reset_gpio;
bool amp_cal;
int mclk_int;
struct regulator_bulk_data core_supplies[2];
int num_core_supplies;
bool is_tdm_mode;
bool enable_soft_ramp;
};
static const struct reg_default cs35l33_reg[] = {
{CS35L33_PWRCTL1, 0x85},
{CS35L33_PWRCTL2, 0xFE},
{CS35L33_CLK_CTL, 0x0C},
{CS35L33_BST_PEAK_CTL, 0x90},
{CS35L33_PROTECT_CTL, 0x55},
{CS35L33_BST_CTL1, 0x00},
{CS35L33_BST_CTL2, 0x01},
{CS35L33_ADSP_CTL, 0x00},
{CS35L33_ADC_CTL, 0xC8},
{CS35L33_DAC_CTL, 0x14},
{CS35L33_DIG_VOL_CTL, 0x00},
{CS35L33_CLASSD_CTL, 0x04},
{CS35L33_AMP_CTL, 0x90},
{CS35L33_INT_MASK_1, 0xFF},
{CS35L33_INT_MASK_2, 0xFF},
{CS35L33_DIAG_LOCK, 0x00},
{CS35L33_DIAG_CTRL_1, 0x40},
{CS35L33_DIAG_CTRL_2, 0x00},
{CS35L33_HG_MEMLDO_CTL, 0x62},
{CS35L33_HG_REL_RATE, 0x03},
{CS35L33_LDO_DEL, 0x12},
{CS35L33_HG_HEAD, 0x0A},
{CS35L33_HG_EN, 0x05},
{CS35L33_TX_VMON, 0x00},
{CS35L33_TX_IMON, 0x03},
{CS35L33_TX_VPMON, 0x02},
{CS35L33_TX_VBSTMON, 0x05},
{CS35L33_TX_FLAG, 0x06},
{CS35L33_TX_EN1, 0x00},
{CS35L33_TX_EN2, 0x00},
{CS35L33_TX_EN3, 0x00},
{CS35L33_TX_EN4, 0x00},
{