Skip to content

Commit

Permalink
ASoC: Add Rockchip rk817 audio CODEC support
Browse files Browse the repository at this point in the history
Add support for the Rockchip rk817 audio codec integrated into the
rk817 PMIC. This is based on the sources provided by Rockchip from
their BSP kernel. Would someone advise what they think the best way
to get the widgets set up properly would be? I'm still new to this
and I don't fully understand all the macros (the alsa-project.org
documentation only gets me so far).

Changes from v2: Switched to DAPM macros to set audio path.
Eliminated unnecessary register value sets.
Removed devicetree binding since device is present for every rk817 PMIC.
Updated binding documentation to yaml format.
Separated mfd changes to separate commit.

Notes: headphone detect works now, however speaker path does not
disable automatically when headphones are used.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
  • Loading branch information
macromorgan authored and intel-lab-lkp committed Mar 16, 2021
1 parent e7fc248 commit 40537fd
Show file tree
Hide file tree
Showing 5 changed files with 834 additions and 0 deletions.
60 changes: 60 additions & 0 deletions Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml
@@ -0,0 +1,60 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/rockchip-rk817.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Rockchip rk817 audio codec

description:
The rk817 codec is an I2C codec integrated with every Rockchip
rk817 PMIC MFD.

properties:
compatible:
enum:
- rockchip,rk817-codec

clocks:
maxItems: 1

clock-names:
const: "mclk"

mic-in-differential:
description: the microphone is in differential mode.
$ref: /schemas/types.yaml#/definitions/flag

required:
- compatible
- clocks
- clock-names

additionalProperties: false

examples:
- |
rk817: pmic@20 {
compatible = "rockchip,rk817";
reg = <0x20>;
interrupt-parent = <&gpio0>;
interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&pmic_int>;

........

rk817_codec: codec {
#sound-dai-cells = <0>;
compatible = "rockchip,rk817-codec";
clocks = <&cru SCLK_I2S_8CH_OUT>;
clock-names = "mclk";
pinctrl-names = "default";
pinctrl-0 = <&i2s_8ch_mclk>;
mic-in-differential;
status = "okay";
};

........

};
6 changes: 6 additions & 0 deletions sound/soc/codecs/Kconfig
Expand Up @@ -155,6 +155,7 @@ config SND_SOC_ALL_CODECS
imply SND_SOC_PCM512x_I2C
imply SND_SOC_PCM512x_SPI
imply SND_SOC_RK3328
imply SND_SOC_RK817
imply SND_SOC_RT274
imply SND_SOC_RT286
imply SND_SOC_RT298
Expand Down Expand Up @@ -1061,6 +1062,11 @@ config SND_SOC_RK3328
tristate "Rockchip RK3328 audio CODEC"
select REGMAP_MMIO

config SND_SOC_RK817
tristate "Rockchip RK817 audio CODEC"
depends on MFD_RK808
select REGMAP_I2C

config SND_SOC_RL6231
tristate
default y if SND_SOC_RT5514=y
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/codecs/Makefile
Expand Up @@ -165,6 +165,7 @@ snd-soc-pcm512x-objs := pcm512x.o
snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o
snd-soc-pcm512x-spi-objs := pcm512x-spi.o
snd-soc-rk3328-objs := rk3328_codec.o
snd-soc-rk817-objs := rk817_codec.o
snd-soc-rl6231-objs := rl6231.o
snd-soc-rl6347a-objs := rl6347a.o
snd-soc-rt1011-objs := rt1011.o
Expand Down Expand Up @@ -482,6 +483,7 @@ obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o
obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o
obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o
obj-$(CONFIG_SND_SOC_RK3328) += snd-soc-rk3328.o
obj-$(CONFIG_SND_SOC_RK817) += snd-soc-rk817.o
obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o
obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o
obj-$(CONFIG_SND_SOC_RT1011) += snd-soc-rt1011.o
Expand Down

0 comments on commit 40537fd

Please sign in to comment.