Update ES8316 driver
This commit is contained in:
parent
19e6397809
commit
b8f8baae32
@ -145,16 +145,6 @@
|
|||||||
default-brightness-level = <200>;
|
default-brightness-level = <200>;
|
||||||
};
|
};
|
||||||
|
|
||||||
hdmi0_sound: hdmi0-sound {
|
|
||||||
status = "disabled";
|
|
||||||
compatible = "rockchip,hdmi";
|
|
||||||
rockchip,mclk-fs = <128>;
|
|
||||||
rockchip,card-name = "rockchip-hdmi0";
|
|
||||||
rockchip,cpu = <&i2s5_8ch>;
|
|
||||||
rockchip,codec = <&hdmi0>;
|
|
||||||
rockchip,jack-det;
|
|
||||||
};
|
|
||||||
|
|
||||||
fan: pwm-fan {
|
fan: pwm-fan {
|
||||||
compatible = "pwm-fan";
|
compatible = "pwm-fan";
|
||||||
cooling-min-state = <0>;
|
cooling-min-state = <0>;
|
||||||
@ -204,6 +194,17 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vendor_storage_rm: vendor-storage-rm@0 {
|
||||||
|
compatible = "rockchip,vendor-storage-rm";
|
||||||
|
reg = <0x0 0x0 0x0 0x0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
vendor_storage: vendor-storage {
|
||||||
|
compatible = "rockchip,ram-vendor-storage";
|
||||||
|
memory-region = <&vendor_storage_rm>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
vcc3v3_lcd: vcc3v3-lcd {
|
vcc3v3_lcd: vcc3v3-lcd {
|
||||||
compatible = "regulator-fixed";
|
compatible = "regulator-fixed";
|
||||||
regulator-name = "vcc3v3_lcd";
|
regulator-name = "vcc3v3_lcd";
|
||||||
@ -217,31 +218,38 @@
|
|||||||
|
|
||||||
es8316_sound: es8316-sound {
|
es8316_sound: es8316-sound {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
compatible = "simple-audio-card";
|
compatible = "rockchip,multicodecs-card";
|
||||||
simple-audio-card,format = "i2s";
|
rockchip,card-name = "rk3588-es8316";
|
||||||
simple-audio-card,mclk-fs = <256>;
|
hp-det-gpio = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>;
|
||||||
simple-audio-card,name = "rockchip,es8316-codec";
|
io-channels = <&saradc 3>;
|
||||||
simple-audio-card,dai-link@0 {
|
io-channel-names = "adc-detect";
|
||||||
format = "i2s";
|
keyup-threshold-microvolt = <1800000>;
|
||||||
cpu {
|
poll-interval = <100>;
|
||||||
sound-dai = <&i2s0_8ch>;
|
spk-con-gpio = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>;
|
||||||
};
|
rockchip,pre-power-on-delay-ms = <30>;
|
||||||
codec {
|
rockchip,post-power-down-delay-ms = <40>;
|
||||||
sound-dai = <&es8316>;
|
rockchip,format = "i2s";
|
||||||
};
|
rockchip,mclk-fs = <256>;
|
||||||
};
|
rockchip,cpu = <&i2s0_8ch>;
|
||||||
};
|
rockchip,codec = <&es8316>;
|
||||||
|
rockchip,audio-routing =
|
||||||
rk_headset: rk-headset {
|
"Headphone", "HPOL",
|
||||||
compatible = "rockchip_headset";
|
"Headphone", "HPOR",
|
||||||
headset_gpio = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>;
|
"Speaker", "HPOL",
|
||||||
|
"Speaker", "HPOR",
|
||||||
|
"MIC1", "Main Mic",
|
||||||
|
"MIC2", "Headset Mic";
|
||||||
pinctrl-names = "default";
|
pinctrl-names = "default";
|
||||||
pinctrl-0 = <&hp_det>;
|
pinctrl-0 = <&hp_det>;
|
||||||
io-channels = <&saradc 3>;
|
play-pause-key {
|
||||||
|
label = "playpause";
|
||||||
|
linux,code = <KEY_PLAYPAUSE>;
|
||||||
|
press-threshold-microvolt = <2000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
dp0_sound: dp0-sound {
|
dp0_sound: dp0-sound {
|
||||||
status = "disabled";
|
status = "okay";
|
||||||
compatible = "rockchip,hdmi";
|
compatible = "rockchip,hdmi";
|
||||||
rockchip,card-name= "rockchip,dp0";
|
rockchip,card-name= "rockchip,dp0";
|
||||||
rockchip,mclk-fs = <512>;
|
rockchip,mclk-fs = <512>;
|
||||||
@ -250,6 +258,16 @@
|
|||||||
rockchip,jack-det;
|
rockchip,jack-det;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hdmi0_sound: hdmi0-sound {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "rockchip,hdmi";
|
||||||
|
rockchip,mclk-fs = <128>;
|
||||||
|
rockchip,card-name = "rockchip-hdmi0";
|
||||||
|
rockchip,cpu = <&i2s5_8ch>;
|
||||||
|
rockchip,codec = <&hdmi0>;
|
||||||
|
rockchip,jack-det;
|
||||||
|
};
|
||||||
|
|
||||||
leds: leds {
|
leds: leds {
|
||||||
compatible = "gpio-leds";
|
compatible = "gpio-leds";
|
||||||
pinctrl-names = "default";
|
pinctrl-names = "default";
|
||||||
@ -421,8 +439,12 @@
|
|||||||
mem-supply = <&vdd_cpu_big1_mem_s0>;
|
mem-supply = <&vdd_cpu_big1_mem_s0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&dfi {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
&dmc {
|
&dmc {
|
||||||
auto-freq-en = <1>;
|
auto-freq-en = <0>;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -785,10 +807,6 @@
|
|||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
||||||
&hdmi0_sound {
|
|
||||||
status = "okay";
|
|
||||||
};
|
|
||||||
|
|
||||||
&route_hdmi0 {
|
&route_hdmi0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
logo,uboot = "logo.bmp";
|
logo,uboot = "logo.bmp";
|
||||||
@ -810,10 +828,6 @@
|
|||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
||||||
&dp0_sound{
|
|
||||||
status = "okay";
|
|
||||||
};
|
|
||||||
|
|
||||||
&edp1 {
|
&edp1 {
|
||||||
force-hpd;
|
force-hpd;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
@ -1112,8 +1126,7 @@
|
|||||||
|
|
||||||
&i2c7 {
|
&i2c7 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
pinctrl-names = "default";
|
|
||||||
pinctrl-0 = <&i2c7m0_xfer>;
|
|
||||||
es8316: es8316@10 {
|
es8316: es8316@10 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
#sound-dai-cells = <0>;
|
#sound-dai-cells = <0>;
|
||||||
@ -1121,17 +1134,16 @@
|
|||||||
reg = <0x10>;
|
reg = <0x10>;
|
||||||
clocks = <&mclkout_i2s0>;
|
clocks = <&mclkout_i2s0>;
|
||||||
clock-names = "mclk";
|
clock-names = "mclk";
|
||||||
spk-con-gpio = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>;
|
|
||||||
assigned-clocks = <&mclkout_i2s0>;
|
assigned-clocks = <&mclkout_i2s0>;
|
||||||
assigned-clock-rates = <12288000>;
|
assigned-clock-rates = <12288000>;
|
||||||
pinctrl-names = "default";
|
pinctrl-names = "default";
|
||||||
pinctrl-0 = <&i2s0_mclk>;
|
pinctrl-0 = <&i2s0_mclk>;
|
||||||
extcon = <&rk_headset>;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
&i2s0_8ch {
|
&i2s0_8ch {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
|
pinctrl-names = "default";
|
||||||
pinctrl-0 = <&i2s0_lrck
|
pinctrl-0 = <&i2s0_lrck
|
||||||
&i2s0_sclk
|
&i2s0_sclk
|
||||||
&i2s0_sdi0
|
&i2s0_sdi0
|
||||||
|
@ -360,6 +360,70 @@ static const struct snd_soc_dapm_route es8316_dapm_routes[] = {
|
|||||||
{"HPOR", NULL, "Headphone Out"},
|
{"HPOR", NULL, "Headphone Out"},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int es8316_init_regs(struct snd_soc_component *component)
|
||||||
|
{
|
||||||
|
snd_soc_component_write(component, ES8316_RESET, 0x3f);
|
||||||
|
usleep_range(5000, 5500);
|
||||||
|
snd_soc_component_write(component, ES8316_RESET, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_SYS_VMIDSEL, 0xFF);
|
||||||
|
msleep(30);
|
||||||
|
snd_soc_component_write(component, ES8316_CLKMGR_CLKSEL, 0x08);
|
||||||
|
snd_soc_component_write(component, ES8316_CLKMGR_ADCOSR, 0x20);
|
||||||
|
snd_soc_component_write(component, ES8316_CLKMGR_ADCDIV1, 0x11);
|
||||||
|
snd_soc_component_write(component, ES8316_CLKMGR_ADCDIV2, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_CLKMGR_DACDIV1, 0x11);
|
||||||
|
snd_soc_component_write(component, ES8316_CLKMGR_DACDIV2, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_CLKMGR_CPDIV, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_SERDATA1, 0x04);
|
||||||
|
snd_soc_component_write(component, ES8316_CLKMGR_CLKSW, 0x7F);
|
||||||
|
snd_soc_component_write(component, ES8316_CAL_TYPE, 0x0F);
|
||||||
|
snd_soc_component_write(component, ES8316_CAL_HPLIV, 0x90);
|
||||||
|
snd_soc_component_write(component, ES8316_CAL_HPRIV, 0x90);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_VOLUME, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_PDN_LINSEL, 0xC0);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_D2SEPGA, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_DMIC, 0x08);
|
||||||
|
snd_soc_component_write(component, ES8316_DAC_SET2, 0x20);
|
||||||
|
snd_soc_component_write(component, ES8316_DAC_SET3, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_DAC_VOLL, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_DAC_VOLR, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_SERDATA_ADC, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_SERDATA_DAC, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_SYS_VMIDLOW, 0x11);
|
||||||
|
snd_soc_component_write(component, ES8316_SYS_VSEL, 0xFC);
|
||||||
|
snd_soc_component_write(component, ES8316_SYS_REF, 0x28);
|
||||||
|
snd_soc_component_write(component, ES8316_SYS_LP1, 0x04);
|
||||||
|
snd_soc_component_write(component, ES8316_SYS_LP2, 0x0C);
|
||||||
|
snd_soc_component_write(component, ES8316_DAC_PDN, 0x11);
|
||||||
|
snd_soc_component_write(component, ES8316_HPMIX_SEL, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_HPMIX_SWITCH, 0x88);
|
||||||
|
snd_soc_component_write(component, ES8316_HPMIX_PDN, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_HPMIX_VOL, 0xBB);
|
||||||
|
snd_soc_component_write(component, ES8316_CPHP_PDN2, 0x10);
|
||||||
|
snd_soc_component_write(component, ES8316_CPHP_LDOCTL, 0x30);
|
||||||
|
snd_soc_component_write(component, ES8316_CPHP_PDN1, 0x02);
|
||||||
|
snd_soc_component_write(component, ES8316_CPHP_ICAL_VOL, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_GPIO_SEL, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_GPIO_DEBOUNCE, 0x02);
|
||||||
|
snd_soc_component_write(component, ES8316_TESTMODE, 0xA0);
|
||||||
|
snd_soc_component_write(component, ES8316_TEST1, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_TEST2, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_SYS_PDN, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_RESET, 0xC0);
|
||||||
|
msleep(50);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_PGAGAIN, 0xA0);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_D2SEPGA, 0x01);
|
||||||
|
/* adc ds mode, HPF enable */
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_DMIC, 0x08);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_ALC1, 0xcd);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_ALC2, 0x08);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_ALC3, 0xa0);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_ALC4, 0x05);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_ALC5, 0x06);
|
||||||
|
snd_soc_component_write(component, ES8316_ADC_ALC_NG, 0x61);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||||
int clk_id, unsigned int freq, int dir)
|
int clk_id, unsigned int freq, int dir)
|
||||||
{
|
{
|
||||||
@ -762,6 +826,21 @@ static int es8316_probe(struct snd_soc_component *component)
|
|||||||
*/
|
*/
|
||||||
snd_soc_component_write(component, ES8316_CLKMGR_ADCOSR, 0x32);
|
snd_soc_component_write(component, ES8316_CLKMGR_ADCOSR, 0x32);
|
||||||
|
|
||||||
|
es8316_init_regs(component);
|
||||||
|
/* es8316_set_bias_level(codec, SND_SOC_BIAS_OFF); */
|
||||||
|
snd_soc_component_write(component, ES8316_CPHP_OUTEN, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_DAC_PDN, 0x11);
|
||||||
|
snd_soc_component_write(component, ES8316_CPHP_LDOCTL, 0x03);
|
||||||
|
snd_soc_component_write(component, ES8316_CPHP_PDN2, 0x22);
|
||||||
|
snd_soc_component_write(component, ES8316_CPHP_PDN1, 0x06);
|
||||||
|
snd_soc_component_write(component, ES8316_HPMIX_SWITCH, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_HPMIX_PDN, 0x33);
|
||||||
|
snd_soc_component_write(component, ES8316_HPMIX_VOL, 0x00);
|
||||||
|
snd_soc_component_write(component, ES8316_SYS_LP1, 0xFF);
|
||||||
|
snd_soc_component_write(component, ES8316_SYS_LP2, 0xFF);
|
||||||
|
snd_soc_component_write(component, ES8316_CLKMGR_CLKSW, 0xF3);
|
||||||
|
snd_soc_component_write(component,ES8316_ADC_PDN_LINSEL, 0xC0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,4 +129,21 @@
|
|||||||
#define ES8316_GPIO_FLAG_GM_NOT_SHORTED 0x02
|
#define ES8316_GPIO_FLAG_GM_NOT_SHORTED 0x02
|
||||||
#define ES8316_GPIO_FLAG_HP_NOT_INSERTED 0x04
|
#define ES8316_GPIO_FLAG_HP_NOT_INSERTED 0x04
|
||||||
|
|
||||||
|
/* REGISTER 0X01 CLOCK MANAGER */
|
||||||
|
#define ES8316_CLKMGR_MCLK_DIV_MASK (0X1<<7)
|
||||||
|
#define ES8316_CLKMGR_MCLK_DIV_NML (0X0<<7)
|
||||||
|
#define ES8316_CLKMGR_MCLK_DIV_1 (0X1<<7)
|
||||||
|
#define ES8316_CLKMGR_ADC_MCLK_MASK (0X1<<3)
|
||||||
|
#define ES8316_CLKMGR_ADC_MCLK_EN (0X1<<3)
|
||||||
|
#define ES8316_CLKMGR_ADC_MCLK_DIS (0X0<<3)
|
||||||
|
#define ES8316_CLKMGR_DAC_MCLK_MASK (0X1<<2)
|
||||||
|
#define ES8316_CLKMGR_DAC_MCLK_EN (0X1<<2)
|
||||||
|
#define ES8316_CLKMGR_DAC_MCLK_DIS (0X0<<2)
|
||||||
|
#define ES8316_CLKMGR_ADC_ANALOG_MASK (0X1<<1)
|
||||||
|
#define ES8316_CLKMGR_ADC_ANALOG_EN (0X1<<1)
|
||||||
|
#define ES8316_CLKMGR_ADC_ANALOG_DIS (0X0<<1)
|
||||||
|
#define ES8316_CLKMGR_DAC_ANALOG_MASK (0X1<<0)
|
||||||
|
#define ES8316_CLKMGR_DAC_ANALOG_EN (0X1<<0)
|
||||||
|
#define ES8316_CLKMGR_DAC_ANALOG_DIS (0X0<<0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user