ASoC: rsnd: add null CLOCKIN support
Some Renesas SoC doesn't have full CLOCKIN. This patch add null_clk, and accepts it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87tumsoe2p.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
cf9d5c6619
commit
d6956a7dde
@ -3,8 +3,8 @@
|
||||
// Helper routines for R-Car sound ADG.
|
||||
//
|
||||
// Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include "rsnd.h"
|
||||
|
||||
#define CLKA 0
|
||||
@ -389,6 +389,30 @@ void rsnd_adg_clk_control(struct rsnd_priv *priv, int enable)
|
||||
}
|
||||
}
|
||||
|
||||
#define NULL_CLK "rsnd_adg_null"
|
||||
static struct clk *rsnd_adg_null_clk_get(struct rsnd_priv *priv)
|
||||
{
|
||||
static struct clk_hw *hw;
|
||||
struct device *dev = rsnd_priv_to_dev(priv);
|
||||
|
||||
if (!hw) {
|
||||
struct clk_hw *_hw;
|
||||
int ret;
|
||||
|
||||
_hw = clk_hw_register_fixed_rate_with_accuracy(dev, NULL_CLK, NULL, 0, 0, 0);
|
||||
if (IS_ERR(_hw))
|
||||
return NULL;
|
||||
|
||||
ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_simple_get, _hw);
|
||||
if (ret < 0)
|
||||
clk_hw_unregister_fixed_rate(_hw);
|
||||
|
||||
hw = _hw;
|
||||
}
|
||||
|
||||
return clk_hw_get_clk(hw, NULL_CLK);
|
||||
}
|
||||
|
||||
static void rsnd_adg_get_clkin(struct rsnd_priv *priv,
|
||||
struct rsnd_adg *adg)
|
||||
{
|
||||
@ -398,7 +422,12 @@ static void rsnd_adg_get_clkin(struct rsnd_priv *priv,
|
||||
for (i = 0; i < CLKMAX; i++) {
|
||||
struct clk *clk = devm_clk_get(dev, clk_name[i]);
|
||||
|
||||
adg->clk[i] = IS_ERR(clk) ? NULL : clk;
|
||||
if (IS_ERR(clk))
|
||||
clk = rsnd_adg_null_clk_get(priv);
|
||||
if (IS_ERR(clk))
|
||||
dev_err(dev, "no adg clock (%s)\n", clk_name[i]);
|
||||
|
||||
adg->clk[i] = clk;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user