bpi-m4berry support waveshare wm8960 hat and nxez pcm5122 hat
This commit is contained in:
parent
ed333992e8
commit
dc09fa0020
@ -1,5 +1,10 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
|
dtbo-$(CONFIG_ARCH_SUNXI) += \
|
||||||
|
bpi-m4berry-i2c4.dtbo \
|
||||||
|
bpi-m4berry-nxez-pcm512x-hifi.dtbo \
|
||||||
|
bpi-m4berry-waveshare-wm8960-hifi.dtbo
|
||||||
|
|
||||||
targets += $(dtbo-y) $(scr-y) $(dtbotxt-y)
|
targets += $(dtbo-y) $(scr-y) $(dtbotxt-y)
|
||||||
|
|
||||||
always := $(dtbo-y) $(scr-y) $(dtbotxt-y)
|
always := $(dtbo-y) $(scr-y) $(dtbotxt-y)
|
||||||
|
|||||||
37
arch/arm64/boot/dts/sunxi/overlay/bpi-m4berry-nxez-pcm512x-hifi.dts
Executable file
37
arch/arm64/boot/dts/sunxi/overlay/bpi-m4berry-nxez-pcm512x-hifi.dts
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
/dts-v1/;
|
||||||
|
/plugin/;
|
||||||
|
|
||||||
|
/ {
|
||||||
|
fragment@0 {
|
||||||
|
target = <&twi4>;
|
||||||
|
__overlay__ {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
pcm5122: pcm5122@4d {
|
||||||
|
compatible = "ti,pcm5122";
|
||||||
|
reg = <0x4d>;
|
||||||
|
#sound-dai-cells = <0>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment@1 {
|
||||||
|
target = <&ahub2_plat>;
|
||||||
|
__overlay__ {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment@2 {
|
||||||
|
target = <&ahub2_mach>;
|
||||||
|
__overlay__ {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
soundcard-mach,playback-only;
|
||||||
|
soundcard-mach,codec {
|
||||||
|
sound-dai = <&pcm5122>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
66
arch/arm64/boot/dts/sunxi/overlay/bpi-m4berry-waveshare-wm8960-hifi.dts
Executable file
66
arch/arm64/boot/dts/sunxi/overlay/bpi-m4berry-waveshare-wm8960-hifi.dts
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
/dts-v1/;
|
||||||
|
/plugin/;
|
||||||
|
|
||||||
|
/ {
|
||||||
|
fragment@0 {
|
||||||
|
target-path = "/";
|
||||||
|
|
||||||
|
__overlay__ {
|
||||||
|
wm8960_mclk: wm8960_mclk {
|
||||||
|
compatible = "fixed-clock";
|
||||||
|
status = "okay";
|
||||||
|
#clock-cells = <0x0>;
|
||||||
|
clock-frequency = <0xbb8000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment@1 {
|
||||||
|
target = <&twi4>;
|
||||||
|
__overlay__ {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
wm8960: wm8960@1a {
|
||||||
|
#sound-dai-cells = <0>;
|
||||||
|
compatible = "wlf,wm8960";
|
||||||
|
reg = <0x1a>;
|
||||||
|
status = "okay";
|
||||||
|
clocks = <&wm8960_mclk>;
|
||||||
|
clock-names = "mclk";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment@2 {
|
||||||
|
target = <&ahub2_plat>;
|
||||||
|
__overlay__ {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment@3 {
|
||||||
|
target = <&ahub2_mach>;
|
||||||
|
__overlay__ {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
soundcard-mach,widgets =
|
||||||
|
"Microphone", "Mic Jack",
|
||||||
|
"Line", "Line In",
|
||||||
|
"Line", "Line Out",
|
||||||
|
"Speaker", "Speaker",
|
||||||
|
"Headphone", "Headphone Jack";
|
||||||
|
soundcard-mach,routing =
|
||||||
|
"Headphone Jack", "HP_L",
|
||||||
|
"Headphone Jack", "HP_R",
|
||||||
|
"Speaker", "SPK_LP",
|
||||||
|
"Speaker", "SPK_LN",
|
||||||
|
"LINPUT1", "Mic Jack",
|
||||||
|
"LINPUT3", "Mic Jack",
|
||||||
|
"RINPUT1", "Mic Jack",
|
||||||
|
"RINPUT2", "Mic Jack";
|
||||||
|
soundcard-mach,codec {
|
||||||
|
sound-dai = <&wm8960>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
@ -2888,14 +2888,6 @@
|
|||||||
pinctrl-1 = <0x77>;
|
pinctrl-1 = <0x77>;
|
||||||
};
|
};
|
||||||
|
|
||||||
wm8960_mclk {
|
|
||||||
compatible = "fixed-clock";
|
|
||||||
status = "disabled";
|
|
||||||
#clock-cells = <0x0>;
|
|
||||||
clock-frequency = <0xbb8000>;
|
|
||||||
phandle = <0x78>;
|
|
||||||
};
|
|
||||||
|
|
||||||
__symbols__ {
|
__symbols__ {
|
||||||
cpu0 = "/cpus/cpu@0";
|
cpu0 = "/cpus/cpu@0";
|
||||||
CPU_SLEEP = "/cpus/idle-states/cpu-sleep";
|
CPU_SLEEP = "/cpus/idle-states/cpu-sleep";
|
||||||
@ -3110,6 +3102,5 @@
|
|||||||
cpu_threshold = "/thermal-zones/cpu_thermal_zone/trips/trip-point@0";
|
cpu_threshold = "/thermal-zones/cpu_thermal_zone/trips/trip-point@0";
|
||||||
cpu_target = "/thermal-zones/cpu_thermal_zone/trips/trip-point@1";
|
cpu_target = "/thermal-zones/cpu_thermal_zone/trips/trip-point@1";
|
||||||
cpu_crit = "/thermal-zones/cpu_thermal_zone/trips/cpu_crit@0";
|
cpu_crit = "/thermal-zones/cpu_thermal_zone/trips/cpu_crit@0";
|
||||||
wm8960_mclk = "/wm8960_mclk";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4347,7 +4347,8 @@ CONFIG_SND_SOC_I2C_AND_SPI=y
|
|||||||
# CONFIG_SND_SOC_PCM3060_SPI is not set
|
# CONFIG_SND_SOC_PCM3060_SPI is not set
|
||||||
# CONFIG_SND_SOC_PCM3168A_I2C is not set
|
# CONFIG_SND_SOC_PCM3168A_I2C is not set
|
||||||
# CONFIG_SND_SOC_PCM3168A_SPI is not set
|
# CONFIG_SND_SOC_PCM3168A_SPI is not set
|
||||||
# CONFIG_SND_SOC_PCM512x_I2C is not set
|
CONFIG_SND_SOC_PCM512x=m
|
||||||
|
CONFIG_SND_SOC_PCM512x_I2C=m
|
||||||
# CONFIG_SND_SOC_PCM512x_SPI is not set
|
# CONFIG_SND_SOC_PCM512x_SPI is not set
|
||||||
# CONFIG_SND_SOC_RK3328 is not set
|
# CONFIG_SND_SOC_RK3328 is not set
|
||||||
# CONFIG_SND_SOC_RT5616 is not set
|
# CONFIG_SND_SOC_RT5616 is not set
|
||||||
@ -4398,7 +4399,7 @@ CONFIG_SND_SOC_I2C_AND_SPI=y
|
|||||||
# CONFIG_SND_SOC_WM8804_SPI is not set
|
# CONFIG_SND_SOC_WM8804_SPI is not set
|
||||||
# CONFIG_SND_SOC_WM8903 is not set
|
# CONFIG_SND_SOC_WM8903 is not set
|
||||||
# CONFIG_SND_SOC_WM8904 is not set
|
# CONFIG_SND_SOC_WM8904 is not set
|
||||||
# CONFIG_SND_SOC_WM8960 is not set
|
CONFIG_SND_SOC_WM8960=m
|
||||||
# CONFIG_SND_SOC_WM8962 is not set
|
# CONFIG_SND_SOC_WM8962 is not set
|
||||||
# CONFIG_SND_SOC_WM8974 is not set
|
# CONFIG_SND_SOC_WM8974 is not set
|
||||||
# CONFIG_SND_SOC_WM8978 is not set
|
# CONFIG_SND_SOC_WM8978 is not set
|
||||||
|
|||||||
@ -1403,6 +1403,7 @@ static int wm8960_i2c_probe(struct i2c_client *i2c,
|
|||||||
struct wm8960_data *pdata = dev_get_platdata(&i2c->dev);
|
struct wm8960_data *pdata = dev_get_platdata(&i2c->dev);
|
||||||
struct wm8960_priv *wm8960;
|
struct wm8960_priv *wm8960;
|
||||||
int ret;
|
int ret;
|
||||||
|
u8 val;
|
||||||
|
|
||||||
wm8960 = devm_kzalloc(&i2c->dev, sizeof(struct wm8960_priv),
|
wm8960 = devm_kzalloc(&i2c->dev, sizeof(struct wm8960_priv),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
@ -1413,6 +1414,14 @@ static int wm8960_i2c_probe(struct i2c_client *i2c,
|
|||||||
if (IS_ERR(wm8960->mclk)) {
|
if (IS_ERR(wm8960->mclk)) {
|
||||||
if (PTR_ERR(wm8960->mclk) == -EPROBE_DEFER)
|
if (PTR_ERR(wm8960->mclk) == -EPROBE_DEFER)
|
||||||
return -EPROBE_DEFER;
|
return -EPROBE_DEFER;
|
||||||
|
} else {
|
||||||
|
ret = clk_get_rate(wm8960->mclk);
|
||||||
|
if (ret >= 0) {
|
||||||
|
wm8960->freq_in = ret;
|
||||||
|
} else {
|
||||||
|
dev_err(&i2c->dev, "Failed to read MCLK rate: %d\n",
|
||||||
|
ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wm8960->regmap = devm_regmap_init_i2c(i2c, &wm8960_regmap);
|
wm8960->regmap = devm_regmap_init_i2c(i2c, &wm8960_regmap);
|
||||||
@ -1424,6 +1433,12 @@ static int wm8960_i2c_probe(struct i2c_client *i2c,
|
|||||||
else if (i2c->dev.of_node)
|
else if (i2c->dev.of_node)
|
||||||
wm8960_set_pdata_from_of(i2c, &wm8960->pdata);
|
wm8960_set_pdata_from_of(i2c, &wm8960->pdata);
|
||||||
|
|
||||||
|
ret = i2c_master_recv(i2c, &val, sizeof(val));
|
||||||
|
if (ret >= 0) {
|
||||||
|
dev_err(&i2c->dev, "Not wm8960, wm8960 reg can not read by i2c\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
ret = wm8960_reset(wm8960->regmap);
|
ret = wm8960_reset(wm8960->regmap);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
dev_err(&i2c->dev, "Failed to issue reset\n");
|
dev_err(&i2c->dev, "Failed to issue reset\n");
|
||||||
@ -1471,11 +1486,13 @@ static const struct i2c_device_id wm8960_i2c_id[] = {
|
|||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(i2c, wm8960_i2c_id);
|
MODULE_DEVICE_TABLE(i2c, wm8960_i2c_id);
|
||||||
|
|
||||||
|
#if defined(CONFIG_OF)
|
||||||
static const struct of_device_id wm8960_of_match[] = {
|
static const struct of_device_id wm8960_of_match[] = {
|
||||||
{ .compatible = "wlf,wm8960", },
|
{ .compatible = "wlf,wm8960", },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, wm8960_of_match);
|
MODULE_DEVICE_TABLE(of, wm8960_of_match);
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct i2c_driver wm8960_i2c_driver = {
|
static struct i2c_driver wm8960_i2c_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user