mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
ASoC: rockchip: multi_dais: add support for rk3308 i2s-16ch
Change-Id: I63ee1e32ebd70348274ca7da153983071f7906c1 Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
This commit is contained in:
@@ -2,6 +2,7 @@ ROCKCHIP multi dais driver
|
||||
|
||||
Required properties:
|
||||
- compatible: "rockchip,multi-dais"
|
||||
- "rockchip,rk3308-multi-dais"
|
||||
- dais: The phandle of sub dais, such i2s, pdm etc.
|
||||
- capture,channel-mapping: map channels, one for each in dais,
|
||||
capture,channel-mapping = <2 6> means:
|
||||
@@ -10,6 +11,15 @@ Required properties:
|
||||
playback,channel-mapping = <4 4> means:
|
||||
i2s 4ch + pdm 4ch --> total 8ch playback.
|
||||
|
||||
Required properties for i2s 16ch:
|
||||
- rockchip,grf: the phandle of the syscon node for GRF register.
|
||||
|
||||
Optional properties:
|
||||
- frame-master: bool properties, frame master, one for each in dais.
|
||||
- bitclock-master: bool properties, bit clock master, one for each in dais.
|
||||
- bitclock-inversion: bool properties, bit clock inversion, one for each in dais.
|
||||
- frame-inversion: bool properties, frame clock inversion, one for each in dais.
|
||||
|
||||
Example:
|
||||
|
||||
multi_dais: multi-dais {
|
||||
@@ -18,6 +28,11 @@ multi_dais: multi-dais {
|
||||
dais = <&i2s_8ch_2>, <&pdm_8ch>;
|
||||
capture,channel-mapping = <2 6>;
|
||||
playback,channel-mapping = <4 4>;
|
||||
bitclock-master = <1 0>;
|
||||
frame-master = <1 0>;
|
||||
bitclock-inversion = <0 0>;
|
||||
frame-inversion = <0 0>;
|
||||
rockchip,grf = <&grf>;
|
||||
};
|
||||
|
||||
&i2s_8ch_2 {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <sound/pcm_params.h>
|
||||
@@ -20,6 +21,7 @@
|
||||
#define BITCLOCK_MASTER_STR "bitclock-master"
|
||||
#define FRAME_MASTER_STR "frame-master"
|
||||
#define DAIS_DRV_NAME "rockchip-mdais"
|
||||
#define RK3308_GRF_SOC_CON2 0x308
|
||||
|
||||
static inline struct rk_mdais_dev *to_info(struct snd_soc_dai *dai)
|
||||
{
|
||||
@@ -169,6 +171,7 @@ static const struct snd_soc_component_driver rockchip_mdais_component = {
|
||||
|
||||
static const struct of_device_id rockchip_mdais_match[] = {
|
||||
{ .compatible = "rockchip,multi-dais", },
|
||||
{ .compatible = "rockchip,rk3308-multi-dais", },
|
||||
{},
|
||||
};
|
||||
|
||||
@@ -418,6 +421,36 @@ static int rockchip_mdais_probe(struct platform_device *pdev)
|
||||
mdais_parse_daifmt(np, dais, count);
|
||||
mdais_fixup_dai(soc_dai, mdais);
|
||||
|
||||
if (of_device_is_compatible(np, "rockchip,rk3308-multi-dais")) {
|
||||
struct regmap *grf;
|
||||
const char *name;
|
||||
unsigned int i2s0_fmt = 0, i2s1_fmt = 0;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
name = dev_name(dais[i].dev);
|
||||
if (strstr(name, "ff300000"))
|
||||
i2s0_fmt = dais[i].fmt;
|
||||
else if (strstr(name, "ff310000"))
|
||||
i2s1_fmt = dais[i].fmt;
|
||||
}
|
||||
i2s0_fmt &= SND_SOC_DAIFMT_MASTER_MASK;
|
||||
i2s1_fmt &= SND_SOC_DAIFMT_MASTER_MASK;
|
||||
|
||||
if ((i2s0_fmt == SND_SOC_DAIFMT_CBS_CFS &&
|
||||
i2s1_fmt == SND_SOC_DAIFMT_CBM_CFM) ||
|
||||
(i2s0_fmt == SND_SOC_DAIFMT_CBM_CFM &&
|
||||
i2s1_fmt == SND_SOC_DAIFMT_CBS_CFS)) {
|
||||
grf = syscon_regmap_lookup_by_phandle(np,
|
||||
"rockchip,grf");
|
||||
if (IS_ERR(grf))
|
||||
return PTR_ERR(grf);
|
||||
|
||||
dev_info(&pdev->dev, "enable i2s 16ch ctrl en\n");
|
||||
regmap_write(grf, RK3308_GRF_SOC_CON2,
|
||||
BIT(14) << 16 | BIT(14));
|
||||
}
|
||||
}
|
||||
|
||||
mdais->dais = dais;
|
||||
mdais->dev = &pdev->dev;
|
||||
dev_set_drvdata(&pdev->dev, mdais);
|
||||
|
||||
Reference in New Issue
Block a user