/*
* rt274.c -- RT274 ALSA SoC audio codec driver
*
* Copyright 2017 Realtek Semiconductor Corp.
* Author: Bard Liao <bardliao@realtek.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/i2c.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/dmi.h>
#include <linux/acpi.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 <sound/jack.h>
#include <linux/workqueue.h>
#include "rl6347a.h"
#include "rt274.h"
#define RT274_VENDOR_ID 0x10ec0274
struct rt274_priv {
struct reg_default *index_cache;
int index_cache_size;
struct regmap *regmap;
struct snd_soc_component *component;
struct i2c_client *i2c;
struct snd_soc_jack *jack;
struct delayed_work jack_detect_work;
int sys_clk;
int clk_id;
int fs;
bool master;
};
static const struct reg_default rt274_index_def[] = {
{ 0x00, 0x1004 },
{ 0x01, 0xaaaa },
{ 0x02, 0x88aa },
{ 0x03, 0x0002 },
{ 0x04, 0xaa09 },
{ 0x05, 0x0700 },
{ 0x06, 0x6110 },
{ 0x07, 0x0200 },
{ 0x08, 0xa807 },
{ 0x09, 0x0021 },
{ 0x0a, 0x7770 },
{ 0x0b, 0x7770 },
{ 0x0c, 0x002b },
{ 0x0d, 0x2420 },
{ 0x0e, 0x65c0 },
{ 0x0f, 0x7770 },
{ 0x10, 0x0420 },
{ 0x11, 0x7418 },
{ 0x12, 0x6bd0 },
{ 0x13, 0x645f },
{ 0x14, 0x0400 },
{ 0x15, 0x8ccc },
{ 0x16, 0x4c50 },
{ 0x17, 0xff00 },
{ 0x18, 0x0003 },
{ 0x19, 0x2c11 },
{ 0x1a, 0x830b },
{ 0x1b, 0x4e4b },
{ 0x1c, 0x0000 },
{ 0x1d, 0x0000 },
{ 0x1e, 0x0000 },
{ 0x1f, 0x0000 },
{ 0x20, 0x51ff },
{ 0x21, 0x8000 },
{ 0x22, 0x8f00 },
{ 0x23, 0x88f4 },
{ 0x24, 0x0000 },
{ 0x25, 0x0000 },
{ 0x26, 0x0000 },
{ 0x27, 0x0000 <