Skip to content

Commit

Permalink
general-rt5651-add-mclk(:1)
Browse files Browse the repository at this point in the history
Original-Subject: [ARCHEOLOGY] Fixed sound from rt5651 on OrangePi 4 (#1870)
> X-Git-Archeology: - Revision e14a61c229db1216fedc397e351c4bed15df820e: armbian/build@e14a61c
> X-Git-Archeology:   Date: Sun, 05 Apr 2020 18:15:06 +0200
> X-Git-Archeology:   From: Piotr Szczepanik <piter75@gmail.com>
> X-Git-Archeology:   Subject: Fixed sound from rt5651 on OrangePi 4 (#1870)
> X-Git-Archeology: 
> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: armbian/build@0cdffb2
> X-Git-Archeology:   Date: Wed, 24 Mar 2021 19:01:53 +0100
> X-Git-Archeology:   From: Igor Pecovnik <igorpecovnik@users.noreply.github.com>
> X-Git-Archeology:   Subject: Renaming DEV branch to EDGE (#2704)
> X-Git-Archeology: 
> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: armbian/build@34ae84f
> X-Git-Archeology:   Date: Fri, 05 May 2023 14:22:00 +0200
> X-Git-Archeology:   From: amazingfate <liujianfeng1994@gmail.com>
> X-Git-Archeology:   Subject: bump rockchip64 edge to v6.3
> X-Git-Archeology: 
X-Armbian: Patch-File: general-rt5651-add-mclk
X-Armbian: Patch-File-Counter: 1
X-Armbian: Patch-Rel-Directory: patch/kernel/archive/rockchip64-6.3
X-Armbian: Patch-Type: kernel
X-Armbian: Patch-Root-Type: core
X-Armbian: Patch-Sub-Type: common
X-Armbian: Original-Subject: [ARCHEOLOGY] Fixed sound from rt5651 on OrangePi 4 (#1870)
  • Loading branch information
piter75 authored and Armbian AutoPatcher committed Apr 5, 2020
1 parent 6c3dc90 commit 755ee21
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions sound/soc/codecs/rt5651.c
Expand Up @@ -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"
Expand Down Expand Up @@ -1511,13 +1512,21 @@ 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)) {
if (snd_soc_component_read(component, RT5651_PLL_MODE_1) & 0x9200)
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)) {
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions sound/soc/codecs/rt5651.h
Expand Up @@ -2097,6 +2097,7 @@ struct rt5651_priv {

int dmic_en;
bool hp_mute;
struct clk *mclk;
};

#endif /* __RT5651_H__ */

0 comments on commit 755ee21

Please sign in to comment.