339 lines
8.8 KiB
Diff
339 lines
8.8 KiB
Diff
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
|
|
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
|
|
@@ -21,6 +21,10 @@
|
|
stdout-path = "serial2:1500000n8";
|
|
};
|
|
|
|
+ aliases {
|
|
+ uart0 = &uart0;
|
|
+ };
|
|
+
|
|
clkin_gmac: external-gmac-clock {
|
|
compatible = "fixed-clock";
|
|
clock-frequency = <125000000>;
|
|
@@ -133,6 +137,46 @@
|
|
pinctrl-names = "default";
|
|
pinctrl-0 = <&wifi_reg_on_h>;
|
|
reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
|
|
+ };
|
|
+
|
|
+ rt5651-sound {
|
|
+ compatible = "simple-audio-card";
|
|
+ simple-audio-card,name = "realtek,rt5651-codec";
|
|
+ simple-audio-card,format = "i2s";
|
|
+ simple-audio-card,mclk-fs = <256>;
|
|
+ simple-audio-card,hp-det-gpio = <&gpio4 28 GPIO_ACTIVE_HIGH>;
|
|
+ simple-audio-card,widgets =
|
|
+ "Microphone", "Mic Jack",
|
|
+ "Headphone", "Headphone Jack";
|
|
+ simple-audio-card,routing =
|
|
+ "Mic Jack", "micbias1",
|
|
+ "IN1P", "Mic Jack",
|
|
+ "Headphone Jack", "HPOL",
|
|
+ "Headphone Jack", "HPOR";
|
|
+ simple-audio-card,cpu {
|
|
+ sound-dai = <&i2s0>;
|
|
+ };
|
|
+ simple-audio-card,codec {
|
|
+ sound-dai = <&rt5651>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ spdif-sound {
|
|
+ status = "okay";
|
|
+ compatible = "simple-audio-card";
|
|
+ simple-audio-card,name = "ROCKCHIP,SPDIF";
|
|
+ simple-audio-card,cpu {
|
|
+ sound-dai = <&spdif>;
|
|
+ };
|
|
+ simple-audio-card,codec {
|
|
+ sound-dai = <&spdif_out>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ spdif_out: spdif-out {
|
|
+ compatible = "linux,spdif-dit";
|
|
+ #sound-dai-cells = <0>;
|
|
+ status = "okay";
|
|
};
|
|
};
|
|
|
|
@@ -190,6 +234,31 @@
|
|
reset-deassert-us = <30000>;
|
|
reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
|
|
};
|
|
+ };
|
|
+
|
|
+ wireless-wlan {
|
|
+ compatible = "wlan-platdata";
|
|
+ rockchip,grf = <&grf>;
|
|
+ wifi_chip_type = "ap6359sa";
|
|
+ sdio_vref = <1800>;
|
|
+ WIFI,host_wake_irq = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>;
|
|
+ status = "okay";
|
|
+ };
|
|
+
|
|
+ wireless-bluetooth {
|
|
+ compatible = "bluetooth-platdata";
|
|
+ clocks = <&rk808 1>;
|
|
+ clock-names = "ext_clock";
|
|
+ uart_rts_gpios = <&gpio2 RK_PC3 GPIO_ACTIVE_LOW>;
|
|
+ pinctrl-names = "default", "rts_gpio";
|
|
+ pinctrl-0 = <&uart0_rts>;
|
|
+ pinctrl-1 = <&uart0_gpios>;
|
|
+ // wifi-bt-power-toggle;
|
|
+ // BT,power_gpio = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
|
|
+ BT,reset_gpio = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
|
|
+ BT,wake_gpio = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
|
|
+ BT,wake_host_irq = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
|
|
+ status = "okay";
|
|
};
|
|
};
|
|
|
|
@@ -453,10 +522,19 @@
|
|
};
|
|
|
|
&i2c1 {
|
|
- clock-frequency = <200000>;
|
|
i2c-scl-rising-time-ns = <150>;
|
|
i2c-scl-falling-time-ns = <30>;
|
|
status = "okay";
|
|
+
|
|
+ rt5651: rt5651@1a {
|
|
+ #sound-dai-cells = <0>;
|
|
+ compatible = "realtek,rt5651";
|
|
+ reg = <0x1a>;
|
|
+ clocks = <&cru SCLK_I2S_8CH_OUT>;
|
|
+ clock-names = "mclk";
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&i2s_8ch_mclk>;
|
|
+ };
|
|
};
|
|
|
|
&i2c2 {
|
|
@@ -484,7 +562,23 @@
|
|
status = "okay";
|
|
};
|
|
|
|
+&i2s0{
|
|
+ assigned-clocks = <&cru SCLK_I2SOUT_SRC>;
|
|
+// assigned-clock-parents = <&cru SCLK_I2S0_8CH>;
|
|
+ rockchip,i2s-broken-burst-len;
|
|
+ rockchip,playback-channels = <2>;
|
|
+ rockchip,capture-channels = <2>;
|
|
+ #sound-dai-cells = <0>;
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&i2s1 {
|
|
+ assigned-clocks = <&cru SCLK_I2SOUT_SRC>;
|
|
+ assigned-clock-parents = <&cru SCLK_I2S1_8CH>;
|
|
+};
|
|
+
|
|
&i2s2 {
|
|
+ #sound-dai-cells = <0>;
|
|
status = "okay";
|
|
};
|
|
|
|
@@ -496,6 +590,11 @@
|
|
status = "okay";
|
|
};
|
|
|
|
+&pmu_io_domains {
|
|
+ status = "okay";
|
|
+ pmu1830-supply = <&vcc_3v0>;
|
|
+};
|
|
+
|
|
&pcie_phy {
|
|
assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>;
|
|
assigned-clock-rates = <100000000>;
|
|
@@ -535,6 +634,39 @@
|
|
};
|
|
};
|
|
|
|
+ i2s0 {
|
|
+ i2s0_2ch_bus: i2s0-2ch-bus {
|
|
+ rockchip,pins =
|
|
+ <3 RK_PD0 1 &pcfg_pull_none>,
|
|
+ <3 RK_PD1 1 &pcfg_pull_none>,
|
|
+ <3 RK_PD2 1 &pcfg_pull_none>,
|
|
+ <3 RK_PD3 1 &pcfg_pull_none>,
|
|
+ <3 RK_PD7 1 &pcfg_pull_none>;
|
|
+ };
|
|
+
|
|
+ i2s0_8ch_bus: i2s0-8ch-bus {
|
|
+ rockchip,pins =
|
|
+ <3 RK_PD0 1 &pcfg_pull_none>,
|
|
+ <3 RK_PD1 1 &pcfg_pull_none>,
|
|
+ <3 RK_PD2 1 &pcfg_pull_none>,
|
|
+ <3 RK_PD3 1 &pcfg_pull_none>,
|
|
+ <3 RK_PD4 1 &pcfg_pull_none>,
|
|
+ <3 RK_PD5 1 &pcfg_pull_none>,
|
|
+ <3 RK_PD6 1 &pcfg_pull_none>,
|
|
+ <3 RK_PD7 1 &pcfg_pull_none>;
|
|
+ };
|
|
+
|
|
+ i2s_8ch_mclk: i2s-8ch-mclk {
|
|
+ rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ headphone {
|
|
+ hp_det: hp-det {
|
|
+ rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_none>;
|
|
+ };
|
|
+ };
|
|
+
|
|
pmic {
|
|
cpu_b_sleep: cpu-b-sleep {
|
|
rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
|
|
@@ -581,6 +713,19 @@
|
|
|
|
sdmmc0_pwr_h: sdmmc0-pwr-h {
|
|
rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ wireless-wlan {
|
|
+ wifi_pwr: wifi-pwr {
|
|
+ rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ wireless-bluetooth {
|
|
+ uart0_gpios: uart0-gpios {
|
|
+ rockchip,pins =
|
|
+ <2 RK_PC3 1 &pcfg_pull_up>;
|
|
};
|
|
};
|
|
};
|
|
@@ -747,11 +892,3 @@
|
|
&vopb_mmu {
|
|
status = "okay";
|
|
};
|
|
-
|
|
-&vopl {
|
|
- status = "okay";
|
|
-};
|
|
-
|
|
-&vopl_mmu {
|
|
- status = "okay";
|
|
-};
|
|
|
|
--- a/sound/soc/rockchip/Kconfig
|
|
+++ b/sound/soc/rockchip/Kconfig
|
|
@@ -54,6 +54,15 @@
|
|
Say Y or M here if you want to add support for SoC audio on Rockchip
|
|
boards using the RT5645/RT5650 codec, such as Veyron.
|
|
|
|
+config SND_SOC_ROCKCHIP_RT5651
|
|
+ tristate "ASoC support for Rockchip boards using a RT5651 codec"
|
|
+ depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && CLKDEV_LOOKUP
|
|
+ select SND_SOC_ROCKCHIP_I2S
|
|
+ select SND_SOC_RT5651
|
|
+ help
|
|
+ Say Y or M here if you want to add support for SoC audio on Rockchip
|
|
+ boards using the RT5651 codec, such as FriendlyARM's Nano{Pi,PC} family.
|
|
+
|
|
config SND_SOC_RK3288_HDMI_ANALOG
|
|
tristate "ASoC support multiple codecs for Rockchip RK3288 boards"
|
|
depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && CLKDEV_LOOKUP
|
|
|
|
diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c
|
|
index ce1d2446f..38447441b 100644
|
|
--- a/drivers/clk/rockchip/clk-rk3399.c
|
|
+++ b/drivers/clk/rockchip/clk-rk3399.c
|
|
@@ -620,7 +620,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {
|
|
GATE(SCLK_I2S2_8CH, "clk_i2s2", "clk_i2s2_mux", CLK_SET_RATE_PARENT,
|
|
RK3399_CLKGATE_CON(8), 11, GFLAGS),
|
|
|
|
- MUX(0, "clk_i2sout_src", mux_i2sch_p, CLK_SET_RATE_PARENT,
|
|
+ MUX(SCLK_I2SOUT_SRC, "clk_i2sout_src", mux_i2sch_p, CLK_SET_RATE_PARENT,
|
|
RK3399_CLKSEL_CON(31), 0, 2, MFLAGS),
|
|
COMPOSITE_NODIV(SCLK_I2S_8CH_OUT, "clk_i2sout", mux_i2sout_p, CLK_SET_RATE_PARENT,
|
|
RK3399_CLKSEL_CON(31), 2, 1, MFLAGS,
|
|
diff --git a/include/dt-bindings/clock/rk3399-cru.h b/include/dt-bindings/clock/rk3399-cru.h
|
|
index 44e0a319f..b7b07dfda 100644
|
|
--- a/include/dt-bindings/clock/rk3399-cru.h
|
|
+++ b/include/dt-bindings/clock/rk3399-cru.h
|
|
@@ -19,6 +19,7 @@
|
|
#define ARMCLKB 9
|
|
|
|
/* sclk gates (special clocks) */
|
|
+#define SCLK_I2SOUT_SRC 64
|
|
#define SCLK_I2C1 65
|
|
#define SCLK_I2C2 66
|
|
#define SCLK_I2C3 67
|
|
|
|
diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c
|
|
index c506c9305..41a08b320 100644
|
|
--- a/sound/soc/codecs/rt5651.c
|
|
+++ b/sound/soc/codecs/rt5651.c
|
|
@@ -24,6 +24,7 @@
|
|
#include <sound/initval.h>
|
|
#include <sound/tlv.h>
|
|
#include <sound/jack.h>
|
|
+#include <linux/clk.h>
|
|
|
|
#include "rl6231.h"
|
|
#include "rt5651.h"
|
|
@@ -1511,6 +1512,7 @@ static int rt5651_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
|
|
static int rt5651_set_bias_level(struct snd_soc_component *component,
|
|
enum snd_soc_bias_level level)
|
|
{
|
|
+ struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
|
|
switch (level) {
|
|
case SND_SOC_BIAS_PREPARE:
|
|
if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) {
|
|
@@ -1518,6 +1520,13 @@ static int rt5651_set_bias_level(struct snd_soc_component *component,
|
|
snd_soc_component_update_bits(component, RT5651_D_MISC,
|
|
0xc00, 0xc00);
|
|
}
|
|
+ if (!IS_ERR(rt5651->mclk)){
|
|
+ if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) {
|
|
+ clk_disable_unprepare(rt5651->mclk);
|
|
+ } else {
|
|
+ clk_prepare_enable(rt5651->mclk);
|
|
+ }
|
|
+ }
|
|
break;
|
|
case SND_SOC_BIAS_STANDBY:
|
|
if (SND_SOC_BIAS_OFF == snd_soc_component_get_bias_level(component)) {
|
|
@@ -2059,6 +2068,13 @@ static int rt5651_probe(struct snd_soc_component *component)
|
|
{
|
|
struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
|
|
|
|
+ /* Check if MCLK provided */
|
|
+ rt5651->mclk = devm_clk_get(component->dev, "mclk");
|
|
+ if (PTR_ERR(rt5651->mclk) == -EPROBE_DEFER){
|
|
+ dev_err(component->dev, "unable to get mclk\n");
|
|
+ return -EPROBE_DEFER;
|
|
+ }
|
|
+
|
|
rt5651->component = component;
|
|
|
|
snd_soc_component_update_bits(component, RT5651_PWR_ANLG1,
|
|
diff --git a/sound/soc/codecs/rt5651.h b/sound/soc/codecs/rt5651.h
|
|
index 20c33a3ec..17524fa9f 100644
|
|
--- a/sound/soc/codecs/rt5651.h
|
|
+++ b/sound/soc/codecs/rt5651.h
|
|
@@ -2097,6 +2097,7 @@ struct rt5651_priv {
|
|
|
|
int dmic_en;
|
|
bool hp_mute;
|
|
+ struct clk *mclk;
|
|
};
|
|
|
|
#endif /* __RT5651_H__ */
|
|
|
|
--- a/sound/soc/codecs/Kconfig
|
|
+++ b/sound/soc/codecs/Kconfig
|
|
@@ -13,7 +13,6 @@
|
|
|
|
config SND_SOC_ALL_CODECS
|
|
tristate "Build all ASoC CODEC drivers"
|
|
- depends on COMPILE_TEST
|
|
imply SND_SOC_88PM860X
|
|
imply SND_SOC_L3
|
|
imply SND_SOC_AB8500_CODEC
|