2018-02-10 04:10:17 +01:00
|
|
|
/*
|
2018-03-23 03:33:28 +01:00
|
|
|
* ac10x.h
|
|
|
|
*
|
|
|
|
* (C) Copyright 2017-2018
|
|
|
|
* Seeed Technology Co., Ltd. <www.seeedstudio.com>
|
|
|
|
*
|
|
|
|
* PeterYang <linsheng.yang@seeed.cc>
|
|
|
|
*
|
|
|
|
* (C) Copyright 2010-2017
|
2018-02-10 04:10:17 +01:00
|
|
|
* Reuuimlla Technology Co., Ltd. <www.reuuimllatech.com>
|
|
|
|
* huangxin <huangxin@reuuimllatech.com>
|
|
|
|
*
|
|
|
|
* some simple description for this code
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef __AC10X_H__
|
|
|
|
#define __AC10X_H__
|
|
|
|
|
|
|
|
#define AC101_I2C_ID 4
|
2018-02-10 08:16:01 +01:00
|
|
|
#define _MASTER_AC108 0
|
|
|
|
#define _MASTER_AC101 1
|
2018-03-23 03:33:28 +01:00
|
|
|
#define _MASTER_MULTI_CODEC _MASTER_AC101
|
2018-02-10 04:10:17 +01:00
|
|
|
|
|
|
|
#ifdef AC101_DEBG
|
|
|
|
#define AC101_DBG(format,args...) printk("[AC101] "format,##args)
|
|
|
|
#else
|
|
|
|
#define AC101_DBG(...)
|
|
|
|
#endif
|
|
|
|
|
2018-02-10 08:16:01 +01:00
|
|
|
|
2018-02-10 04:10:17 +01:00
|
|
|
struct ac10x_priv {
|
|
|
|
struct i2c_client *i2c[4];
|
2018-02-27 10:05:55 +01:00
|
|
|
struct regmap* i2cmap[4];
|
|
|
|
int codec_cnt;
|
2018-02-10 04:10:17 +01:00
|
|
|
unsigned sysclk;
|
2018-03-13 09:30:43 +01:00
|
|
|
#define _FREQ_24_576K 24576000
|
|
|
|
#define _FREQ_22_579K 22579200
|
2018-02-10 04:10:17 +01:00
|
|
|
unsigned mclk; /* master clock or aif_clock/aclk */
|
|
|
|
int clk_id;
|
|
|
|
unsigned char i2s_mode;
|
|
|
|
unsigned char data_protocol;
|
|
|
|
struct delayed_work dlywork;
|
|
|
|
int tdm_chips_cnt;
|
|
|
|
|
2018-03-24 11:01:33 +01:00
|
|
|
/* member for ac101 .begin */
|
2018-02-10 04:10:17 +01:00
|
|
|
struct snd_soc_codec *codec;
|
|
|
|
struct i2c_client *i2c101;
|
|
|
|
struct regmap* regmap101;
|
|
|
|
|
|
|
|
struct mutex dac_mutex;
|
|
|
|
u8 dac_enable;
|
2018-03-24 11:01:33 +01:00
|
|
|
spinlock_t lock;
|
2018-02-10 04:10:17 +01:00
|
|
|
u8 aif1_clken;
|
|
|
|
|
|
|
|
struct work_struct codec_resume;
|
|
|
|
struct gpio_desc* gpiod_spk_amp_gate;
|
2018-03-13 09:30:43 +01:00
|
|
|
/* member for ac101 .end */
|
2018-02-10 04:10:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* AC101 DAI operations */
|
|
|
|
int ac101_audio_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *codec_dai);
|
|
|
|
void ac101_aif_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *codec_dai);
|
|
|
|
int ac101_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt);
|
|
|
|
int ac101_hw_params(struct snd_pcm_substream *substream,
|
|
|
|
struct snd_pcm_hw_params *params,
|
|
|
|
struct snd_soc_dai *codec_dai);
|
2018-03-24 11:01:33 +01:00
|
|
|
int ac101_trigger(struct snd_pcm_substream *substream, int cmd,
|
|
|
|
struct snd_soc_dai *dai);
|
2018-02-10 04:10:17 +01:00
|
|
|
int ac101_aif_mute(struct snd_soc_dai *codec_dai, int mute);
|
|
|
|
|
|
|
|
/* codec driver specific */
|
|
|
|
int ac101_codec_probe(struct snd_soc_codec *codec);
|
|
|
|
int ac101_codec_remove(struct snd_soc_codec *codec);
|
|
|
|
int ac101_codec_suspend(struct snd_soc_codec *codec);
|
|
|
|
int ac101_codec_resume(struct snd_soc_codec *codec);
|
|
|
|
int ac101_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level);
|
|
|
|
|
|
|
|
/* i2c device specific */
|
|
|
|
int ac101_probe(struct i2c_client *i2c, const struct i2c_device_id *id);
|
|
|
|
void ac101_shutdown(struct i2c_client *i2c);
|
|
|
|
int ac101_remove(struct i2c_client *i2c);
|
|
|
|
|
2018-02-10 08:16:01 +01:00
|
|
|
/* simple card export */
|
|
|
|
int asoc_simple_card_register_set_clock(int (*set_clock)(int));
|
|
|
|
|
2018-02-10 04:10:17 +01:00
|
|
|
#endif//__AC10X_H__
|