RK3368-android8.1-es8323-音量增大

\sdk\kernel\sound\soc\codecs\es8323.c

#define es8323_DEF_VOL	0x20


static int es8323_resume(struct snd_soc_codec *codec)
{
	snd_soc_write(codec, 0x2b, 0x80);
	snd_soc_write(codec, 0x01, 0x50);
	snd_soc_write(codec, 0x00, 0x32);
	snd_soc_write(codec, ES8323_CHIPPOWER, 0x00);
	snd_soc_write(codec, ES8323_DACPOWER, 0x0c);
	snd_soc_write(codec, ES8323_ADCPOWER, 0x59);
	snd_soc_write(codec, 0x31, es8323_DEF_VOL);
	snd_soc_write(codec, 0x30, es8323_DEF_VOL);
	snd_soc_write(codec, 0x19, 0x02);
	return 0;
}

static int es8323_probe(struct snd_soc_codec *codec)
{
	struct es8323_priv *es8323 = snd_soc_codec_get_drvdata(codec);
	int ret = 0;

	if (codec == NULL) {
		dev_err(codec->dev, "Codec device not registered\n");
		return -ENODEV;
	}

	es8323->mclk = devm_clk_get(codec->dev, "mclk");
	if (IS_ERR(es8323->mclk)) {
		dev_err(codec->dev, "%s mclk is missing or invalid\n", __func__);
		return PTR_ERR(es8323->mclk);
	}
	ret = clk_prepare_enable(es8323->mclk);
	if (ret)
		return ret;

	codec->hw_write = (hw_write_t) i2c_master_send;
	codec->control_data = container_of(codec->dev, struct i2c_client, dev);

	es8323_codec = codec;
	ret = es8323_reset(codec);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to issue reset\n");
		return ret;
	}
	usleep_range(18000, 20000);
	snd_soc_write(codec, 0x02, 0xf3);
	snd_soc_write(codec, 0x2B, 0x80);
	snd_soc_write(codec, 0x08, 0x00);	/* ES8388 salve */
	snd_soc_write(codec, 0x00, 0x35);
	snd_soc_write(codec, 0x01, 0x50);	/* PLAYBACK & RECORD Mode,EnRefr=1 */
	snd_soc_write(codec, 0x03, 0x59);	/* pdn_ana=0,ibiasgen_pdn=0 */
	snd_soc_write(codec, 0x05, 0x00);	/* pdn_ana=0,ibiasgen_pdn=0 */
	snd_soc_write(codec, 0x06, 0x00);	/* pdn_ana=0,ibiasgen_pdn=0 */
	snd_soc_write(codec, 0x07, 0x7c);
	snd_soc_write(codec, 0x09, 0x66);	/* ADC L/R PGA =  +18dB */	/* snd_soc_write(codec, 0x09, 0x88);	ADC L/R PGA =  +24dB */
	snd_soc_write(codec, 0x0a, 0xf0);	/* ADC INPUT=LIN2/RIN2 */
	snd_soc_write(codec, 0x0b, 0x02);	/* ADC INPUT=LIN2/RIN2 */
	snd_soc_write(codec, 0x0C, 0x4c);	/* I2S-24BIT */
	snd_soc_write(codec, 0x0d, 0x02);	/* MCLK/LRCK=256 */
	snd_soc_write(codec, 0x10, 0x00);	/* ADC Left Volume=0db */
	snd_soc_write(codec, 0x11, 0x00);	/* ADC Right Volume=0db */
	snd_soc_write(codec, 0x12, 0xea);	/* ALC stereo MAXGAIN: 35.5dB,  MINGAIN: +6dB (Record Volume increased!) */
	snd_soc_write(codec, 0x13, 0xc0);
	snd_soc_write(codec, 0x14, 0x05);
	snd_soc_write(codec, 0x15, 0x06);
	snd_soc_write(codec, 0x16, 0x53);
	snd_soc_write(codec, 0x17, 0x18);	/* I2S-16BIT */
	snd_soc_write(codec, 0x18, 0x02);
	snd_soc_write(codec, 0x1A, 0x00);	/* DAC VOLUME=0DB */
	snd_soc_write(codec, 0x1B, 0x00);
	snd_soc_write(codec, 0x26, 0x12);	/* Left DAC TO Left IXER */
	snd_soc_write(codec, 0x27, 0xb8);	/* Left DAC TO Left MIXER */
	snd_soc_write(codec, 0x28, 0x38);
	snd_soc_write(codec, 0x29, 0x38);
	snd_soc_write(codec, 0x2A, 0xb8);
	snd_soc_write(codec, 0x02, 0x00);	/* START DLL and state-machine,START DSM */
	snd_soc_write(codec, 0x19, 0x02);	/* SOFT RAMP RATE=32LRCKS/STEP,Enable ZERO-CROSS CHECK,DAC MUTE */
	snd_soc_write(codec, 0x04, 0x0c);	/* pdn_ana=0,ibiasgen_pdn=0 */
	usleep_range(18000, 20000);
	snd_soc_write(codec, 0x2e, 0x00);
	snd_soc_write(codec, 0x2f, 0x00);
	snd_soc_write(codec, 0x30, 0x08);
	snd_soc_write(codec, 0x31, 0x08);
	usleep_range(18000, 20000);
	snd_soc_write(codec, 0x30, 0x0f);
	snd_soc_write(codec, 0x31, 0x0f);
	usleep_range(18000, 20000);
	snd_soc_write(codec, 0x30, 0x18);
	snd_soc_write(codec, 0x31, 0x18);
	usleep_range(18000, 20000);
	snd_soc_write(codec, 0x04, 0x2c);	/* pdn_ana=0,ibiasgen_pdn=0 */
	es8323_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
	return 0;
}

寄存器的设置可以参考

ES8323 Datasheet, PDF - Alldatasheeticon-default.png?t=M5H6https://www.alldatasheet.com/view.jsp?Searchword=ES8323从规格书上参考可以增大音量

其中有修改

	snd_soc_write(codec, 0x1A, 0x00);	/* DAC VOLUME=0DB */
	snd_soc_write(codec, 0x1B, 0x00);
	snd_soc_write(codec, 0x30, 0x20);
	snd_soc_write(codec, 0x31, 0x20);

 

仅供参考,亲测有效!!! 

ADB:cat sys/kernel/debug/asoc/rockchip,es8323-codec/codec\:XXXX/codec_reg

例:cat sys/kernel/debug/asoc/rockchip,es8323-codec/codec\:ES8323.1-0010/codec_reg

127|rk3368:/ # cat sys/kernel/debug/asoc/rockchip,es8323-codec/codec\:ES8323.1-0010/codec_reg
00: 0032
01: 0050
02: 0000
03: 0059
04: 002c
05: 0000
06: 0000
07: 007c
08: 0000
09: 0066
0a: 00f0
0b: 0002
0c: 004c
0d: 0002
0e: 0030
0f: 0030
10: 0000
11: 0000
12: 00ea
13: 00c0
14: 0005
15: 0006
16: 0053
17: 0018
18: 0002
19: 0006
1a: 0000
1b: 0000
1c: 0008
1d: 0006
1e: 001f
1f: 00f7
20: 00fd
21: 00ff
22: 001f
23: 00f7
24: 00fd
25: 00ff
26: 0012
27: 00b8
28: 0038
29: 0038
2a: 00b8
2b: 0080
2c: 0038
2d: 0000
2e: 0000
2f: 0000
30: 0020
31: 0020
32: 0000
33: 0000
34: 0000
35: 0000
36: 0000
37: 0000

可以查看你的参数,一步一个脚印!

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

旋风旋风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值