175 lines
3.9 KiB
C
175 lines
3.9 KiB
C
/*
|
|
* ALSA SoC ES7210 adc driver
|
|
*
|
|
* 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.^M
|
|
*
|
|
* Notes:
|
|
* ES7210 is a 4-ch ADC of Everest
|
|
* This is user configuration document.
|
|
* You can update this file according to your application
|
|
*/
|
|
#include "es7210_config.h"
|
|
|
|
struct i2c_client *i2c_clt1[ADC_DEV_MAXNUM];
|
|
struct snd_soc_component *tron_codec1[ADC_DEV_MAXNUM];
|
|
|
|
int es7210_init_reg = 0;
|
|
static int es7210_codec_num = 0;
|
|
struct es7210_reg_config {
|
|
unsigned char reg_addr;
|
|
unsigned char reg_v;
|
|
};
|
|
static const struct es7210_reg_config es7210_tdm_reg_common_cfg1[] = {
|
|
{0x00, 0xFF},
|
|
{0x00, 0x32},
|
|
{0x09, 0x30},
|
|
{0x0A, 0x30},
|
|
{0x23, 0x2a},
|
|
{0x22, 0x0a},
|
|
{0x21, 0x2a},
|
|
{0x20, 0x0a},
|
|
};
|
|
|
|
static const struct es7210_reg_config es7210_tdm_reg_fmt_cfg[] = {
|
|
{0x11, 0x63},
|
|
{0x12, 0x01},
|
|
};
|
|
|
|
static const struct es7210_reg_config es7210_tdm_reg_common_cfg2[] = {
|
|
{0x40, 0xC7},
|
|
{0x41, 0x70},
|
|
{0x42, 0x70},
|
|
{0x43, 0x10},
|
|
{0x44, 0x10},
|
|
{0x45, 0x10},
|
|
{0x46, 0x10},
|
|
{0x47, 0x08},
|
|
{0x48, 0x08},
|
|
{0x49, 0x08},
|
|
{0x4A, 0x08},
|
|
{0x07, 0x20},
|
|
};
|
|
|
|
static const struct es7210_reg_config es7210_tdm_reg_mclk_cfg[] = {
|
|
{0x02, 0xC1},
|
|
};
|
|
|
|
static const struct es7210_reg_config es7210_tdm_reg_common_cfg3[] = {
|
|
{0x06, 0x00},
|
|
{0x4B, 0x0F},
|
|
{0x4C, 0x0F},
|
|
{0x00, 0x71},
|
|
{0x00, 0x41},
|
|
};
|
|
|
|
struct es7210_mclklrck_ratio_config {
|
|
int ratio;
|
|
unsigned char nfs;
|
|
unsigned char channels;
|
|
unsigned char reg02_v;
|
|
unsigned char reg06_v;
|
|
};
|
|
|
|
static const struct es7210_mclklrck_ratio_config es7210_1fs_ratio_cfg[] = {
|
|
//ratio, nfs, channels, reg02_v, reg06_v
|
|
{64, 0, 0, 0x41, 0x00},
|
|
{128, 0, 0, 0x01, 0x00},
|
|
{192, 0, 0, 0x43, 0x00},
|
|
{256, 0, 0, 0xc1, 0x04},
|
|
{384, 0, 0, 0x03, 0x00},
|
|
{512, 0, 0, 0x81, 0x04},
|
|
{768, 0, 0, 0xc3, 0x04},
|
|
{896, 0, 0, 0x07, 0x00},
|
|
{1024, 0, 0, 0x82, 0x04},
|
|
{1152, 0, 0, 0x09, 0x00},
|
|
{1280, 0, 0, 0x0a, 0x00},
|
|
{1408, 0, 0, 0x0b, 0x00},
|
|
{1536, 0, 0, 0xc6, 0x04},
|
|
{1664, 0, 0, 0x0d, 0x00},
|
|
{1792, 0, 0, 0xc7, 0x04},
|
|
{1920, 0, 0, 0x0f, 0x00},
|
|
{2048, 0, 0, 0x84, 0x04},
|
|
{3072, 0, 0, 0x86, 0x04},
|
|
{4096, 0, 0, 0x88, 0x04},
|
|
};
|
|
|
|
static const struct es7210_mclklrck_ratio_config es7210_nfs_ratio_cfg[] = {
|
|
//ratio, nfs, channels, reg02_v, reg06_v
|
|
{32, 1, 4, 0x41, 0x00},
|
|
{32, 1, 8, 0x01, 0x00},
|
|
{32, 1, 12, 0x43, 0x00},
|
|
{32, 1, 16, 0xC1, 0x04},
|
|
|
|
{64, 1, 4, 0x01, 0x00},
|
|
{64, 1, 6, 0x43, 0x00},
|
|
{64, 1, 8, 0xC1, 0x04},
|
|
{64, 1, 10, 0x45, 0x00},
|
|
{64, 1, 12, 0x03, 0x00},
|
|
{64, 1, 14, 0x47, 0x00},
|
|
{64, 1, 16, 0x81, 0x04},
|
|
|
|
{96, 1, 4, 0x43, 0x00},
|
|
{96, 1, 8, 0x03, 0x00},
|
|
{96, 1, 12, 0x49, 0x00},
|
|
{96, 1, 16, 0xc3, 0x04},
|
|
|
|
{128, 1, 4, 0xc1, 0x04},
|
|
{128, 1, 6, 0x03, 0x00},
|
|
{128, 1, 8, 0x81, 0x04},
|
|
{128, 1, 10, 0x05, 0x00},
|
|
{128, 1, 12, 0xc3, 0x04},
|
|
{128, 1, 14, 0x07, 0x00},
|
|
{128, 1, 16, 0x82, 0x04},
|
|
|
|
{192, 1, 4, 0x03, 0x00},
|
|
{192, 1, 6, 0x49, 0x00},
|
|
{192, 1, 8, 0xc3, 0x04},
|
|
{192, 1, 10, 0x4f, 0x00},
|
|
{192, 1, 12, 0x09, 0x00},
|
|
{192, 1, 14, 0x55, 0x00},
|
|
{192, 1, 16, 0x83, 0x04},
|
|
|
|
{256, 1, 4, 0x81, 0x04},
|
|
{256, 1, 6, 0xc3, 0x04},
|
|
{256, 1, 8, 0x82, 0x04},
|
|
{256, 1, 10, 0xc5, 0x04},
|
|
{256, 1, 12, 0x83, 0x04},
|
|
{256, 1, 14, 0xc7, 0x04},
|
|
{256, 1, 16, 0x84, 0x04},
|
|
|
|
{384, 1, 4, 0xc3, 0x04},
|
|
{384, 1, 6, 0x09, 0x00},
|
|
{384, 1, 8, 0x83, 0x04},
|
|
{384, 1, 10, 0x0f, 0x00},
|
|
{384, 1, 12, 0xc9, 0x04},
|
|
{384, 1, 14, 0x15, 0x00},
|
|
{384, 1, 16, 0x86, 0x04},
|
|
|
|
{512, 1, 4, 0x82, 0x04},
|
|
{512, 1, 6, 0x83, 0x04},
|
|
{512, 1, 8, 0x84, 0x04},
|
|
{512, 1, 10, 0x85, 0x04},
|
|
{512, 1, 12, 0x86, 0x04},
|
|
{512, 1, 14, 0x87, 0x04},
|
|
{512, 1, 16, 0x88, 0x04},
|
|
|
|
{768, 1, 4, 0x83, 0x04},
|
|
{768, 1, 6, 0xC9, 0x04},
|
|
{768, 1, 8, 0x86, 0x04},
|
|
{768, 1, 10, 0xCf, 0x04},
|
|
{768, 1, 12, 0x89, 0x04},
|
|
{768, 1, 14, 0xD5, 0x04},
|
|
{768, 1, 16, 0x8C, 0x04},
|
|
|
|
{1024, 1, 4, 0x84, 0x04},
|
|
{1024, 1, 6, 0x86, 0x04},
|
|
{1024, 1, 8, 0x88, 0x04},
|
|
{1024, 1, 10, 0x8a, 0x04},
|
|
{1024, 1, 12, 0x8c, 0x04},
|
|
{1024, 1, 14, 0x8e, 0x04},
|
|
{1024, 1, 16, 0x90, 0x04},
|
|
|
|
};
|