mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 02:21:16 +00:00
ASoC: fsi: remove platform depended .set_rate() callback support
ab6f6d8521
(ASoC: fsi: add master clock control functions)
added driver level clock control functions.
And now, platform depended .set_rate() is no longer needed.
This patch removed unnecessary .set_rate() platform callback support.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
a49f0d1ea3
commit
6cbdbffba1
2 changed files with 12 additions and 152 deletions
|
@ -50,43 +50,10 @@
|
|||
#define SH_FSI_CLK_EXTERNAL (0 << 12)
|
||||
#define SH_FSI_CLK_CPG (1 << 12) /* FSIxCK + FSI-DIV */
|
||||
|
||||
/*
|
||||
* set_rate return value
|
||||
*
|
||||
* see ACKMD/BPFMD on
|
||||
* ACK_MD (FSI2)
|
||||
* CKG1 (FSI)
|
||||
*
|
||||
* err : return value < 0
|
||||
* no change : return value == 0
|
||||
* change xMD : return value > 0
|
||||
*
|
||||
* 0x-00000AB
|
||||
*
|
||||
* A: ACKMD value
|
||||
* B: BPFMD value
|
||||
*/
|
||||
|
||||
#define SH_FSI_ACKMD_MASK (0xF << 0)
|
||||
#define SH_FSI_ACKMD_512 (1 << 0)
|
||||
#define SH_FSI_ACKMD_256 (2 << 0)
|
||||
#define SH_FSI_ACKMD_128 (3 << 0)
|
||||
#define SH_FSI_ACKMD_64 (4 << 0)
|
||||
#define SH_FSI_ACKMD_32 (5 << 0)
|
||||
|
||||
#define SH_FSI_BPFMD_MASK (0xF << 4)
|
||||
#define SH_FSI_BPFMD_512 (1 << 4)
|
||||
#define SH_FSI_BPFMD_256 (2 << 4)
|
||||
#define SH_FSI_BPFMD_128 (3 << 4)
|
||||
#define SH_FSI_BPFMD_64 (4 << 4)
|
||||
#define SH_FSI_BPFMD_32 (5 << 4)
|
||||
#define SH_FSI_BPFMD_16 (6 << 4)
|
||||
|
||||
struct sh_fsi_port_info {
|
||||
unsigned long flags;
|
||||
int tx_id;
|
||||
int rx_id;
|
||||
int (*set_rate)(struct device *dev, int rate, int enable);
|
||||
};
|
||||
|
||||
struct sh_fsi_platform_info {
|
||||
|
|
|
@ -131,8 +131,6 @@
|
|||
|
||||
#define FSI_FMTS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE)
|
||||
|
||||
typedef int (*set_rate_func)(struct device *dev, int rate, int enable);
|
||||
|
||||
/*
|
||||
* bus options
|
||||
*
|
||||
|
@ -244,8 +242,7 @@ struct fsi_clk {
|
|||
struct clk *ick;
|
||||
struct clk *div;
|
||||
int (*set_rate)(struct device *dev,
|
||||
struct fsi_priv *fsi,
|
||||
unsigned long rate);
|
||||
struct fsi_priv *fsi);
|
||||
|
||||
unsigned long rate;
|
||||
unsigned int count;
|
||||
|
@ -270,8 +267,6 @@ struct fsi_priv {
|
|||
int enable_stream:1;
|
||||
int bit_clk_inv:1;
|
||||
int lr_clk_inv:1;
|
||||
|
||||
long rate;
|
||||
};
|
||||
|
||||
struct fsi_stream_handler {
|
||||
|
@ -431,14 +426,6 @@ static struct fsi_priv *fsi_get_priv(struct snd_pcm_substream *substream)
|
|||
return fsi_get_priv_frm_dai(fsi_get_dai(substream));
|
||||
}
|
||||
|
||||
static set_rate_func fsi_get_info_set_rate(struct fsi_priv *fsi)
|
||||
{
|
||||
if (!fsi->info)
|
||||
return NULL;
|
||||
|
||||
return fsi->info->set_rate;
|
||||
}
|
||||
|
||||
static u32 fsi_get_info_flags(struct fsi_priv *fsi)
|
||||
{
|
||||
if (!fsi->info)
|
||||
|
@ -757,8 +744,7 @@ static int fsi_clk_init(struct device *dev,
|
|||
int ick,
|
||||
int div,
|
||||
int (*set_rate)(struct device *dev,
|
||||
struct fsi_priv *fsi,
|
||||
unsigned long rate))
|
||||
struct fsi_priv *fsi))
|
||||
{
|
||||
struct fsi_clk *clock = &fsi->clock;
|
||||
int is_porta = fsi_is_port_a(fsi);
|
||||
|
@ -829,8 +815,7 @@ static int fsi_clk_is_valid(struct fsi_priv *fsi)
|
|||
}
|
||||
|
||||
static int fsi_clk_enable(struct device *dev,
|
||||
struct fsi_priv *fsi,
|
||||
unsigned long rate)
|
||||
struct fsi_priv *fsi)
|
||||
{
|
||||
struct fsi_clk *clock = &fsi->clock;
|
||||
int ret = -EINVAL;
|
||||
|
@ -839,7 +824,7 @@ static int fsi_clk_enable(struct device *dev,
|
|||
return ret;
|
||||
|
||||
if (0 == clock->count) {
|
||||
ret = clock->set_rate(dev, fsi, rate);
|
||||
ret = clock->set_rate(dev, fsi);
|
||||
if (ret < 0) {
|
||||
fsi_clk_invalid(fsi);
|
||||
return ret;
|
||||
|
@ -946,11 +931,11 @@ static int fsi_clk_set_ackbpf(struct device *dev,
|
|||
}
|
||||
|
||||
static int fsi_clk_set_rate_external(struct device *dev,
|
||||
struct fsi_priv *fsi,
|
||||
unsigned long rate)
|
||||
struct fsi_priv *fsi)
|
||||
{
|
||||
struct clk *xck = fsi->clock.xck;
|
||||
struct clk *ick = fsi->clock.ick;
|
||||
unsigned long rate = fsi->clock.rate;
|
||||
unsigned long xrate;
|
||||
int ackmd, bpfmd;
|
||||
int ret = 0;
|
||||
|
@ -978,11 +963,11 @@ static int fsi_clk_set_rate_external(struct device *dev,
|
|||
}
|
||||
|
||||
static int fsi_clk_set_rate_cpg(struct device *dev,
|
||||
struct fsi_priv *fsi,
|
||||
unsigned long rate)
|
||||
struct fsi_priv *fsi)
|
||||
{
|
||||
struct clk *ick = fsi->clock.ick;
|
||||
struct clk *div = fsi->clock.div;
|
||||
unsigned long rate = fsi->clock.rate;
|
||||
unsigned long target = 0; /* 12288000 or 11289600 */
|
||||
unsigned long actual, cout;
|
||||
unsigned long diff, min;
|
||||
|
@ -1063,85 +1048,6 @@ static int fsi_clk_set_rate_cpg(struct device *dev,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int fsi_set_master_clk(struct device *dev, struct fsi_priv *fsi,
|
||||
long rate, int enable)
|
||||
{
|
||||
set_rate_func set_rate = fsi_get_info_set_rate(fsi);
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* CAUTION
|
||||
*
|
||||
* set_rate will be deleted
|
||||
*/
|
||||
if (!set_rate) {
|
||||
if (enable)
|
||||
return fsi_clk_enable(dev, fsi, rate);
|
||||
else
|
||||
return fsi_clk_disable(dev, fsi);
|
||||
}
|
||||
|
||||
ret = set_rate(dev, rate, enable);
|
||||
if (ret < 0) /* error */
|
||||
return ret;
|
||||
|
||||
if (!enable)
|
||||
return 0;
|
||||
|
||||
if (ret > 0) {
|
||||
u32 data = 0;
|
||||
|
||||
switch (ret & SH_FSI_ACKMD_MASK) {
|
||||
default:
|
||||
/* FALL THROUGH */
|
||||
case SH_FSI_ACKMD_512:
|
||||
data |= (0x0 << 12);
|
||||
break;
|
||||
case SH_FSI_ACKMD_256:
|
||||
data |= (0x1 << 12);
|
||||
break;
|
||||
case SH_FSI_ACKMD_128:
|
||||
data |= (0x2 << 12);
|
||||
break;
|
||||
case SH_FSI_ACKMD_64:
|
||||
data |= (0x3 << 12);
|
||||
break;
|
||||
case SH_FSI_ACKMD_32:
|
||||
data |= (0x4 << 12);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (ret & SH_FSI_BPFMD_MASK) {
|
||||
default:
|
||||
/* FALL THROUGH */
|
||||
case SH_FSI_BPFMD_32:
|
||||
data |= (0x0 << 8);
|
||||
break;
|
||||
case SH_FSI_BPFMD_64:
|
||||
data |= (0x1 << 8);
|
||||
break;
|
||||
case SH_FSI_BPFMD_128:
|
||||
data |= (0x2 << 8);
|
||||
break;
|
||||
case SH_FSI_BPFMD_256:
|
||||
data |= (0x3 << 8);
|
||||
break;
|
||||
case SH_FSI_BPFMD_512:
|
||||
data |= (0x4 << 8);
|
||||
break;
|
||||
case SH_FSI_BPFMD_16:
|
||||
data |= (0x7 << 8);
|
||||
break;
|
||||
}
|
||||
|
||||
fsi_reg_mask_set(fsi, CKG1, (ACKMD_MASK | BPFMD_MASK) , data);
|
||||
udelay(10);
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* pio data transfer handler
|
||||
*/
|
||||
|
@ -1698,7 +1604,7 @@ static int fsi_hw_startup(struct fsi_priv *fsi,
|
|||
|
||||
/* start master clock */
|
||||
if (fsi_is_clk_master(fsi))
|
||||
return fsi_set_master_clk(dev, fsi, fsi->rate, 1);
|
||||
return fsi_clk_enable(dev, fsi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1708,7 +1614,7 @@ static int fsi_hw_shutdown(struct fsi_priv *fsi,
|
|||
{
|
||||
/* stop master clock */
|
||||
if (fsi_is_clk_master(fsi))
|
||||
return fsi_set_master_clk(dev, fsi, fsi->rate, 0);
|
||||
return fsi_clk_disable(dev, fsi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1719,7 +1625,6 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
|
|||
struct fsi_priv *fsi = fsi_get_priv(substream);
|
||||
|
||||
fsi_clk_invalid(fsi);
|
||||
fsi->rate = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1730,7 +1635,6 @@ static void fsi_dai_shutdown(struct snd_pcm_substream *substream,
|
|||
struct fsi_priv *fsi = fsi_get_priv(substream);
|
||||
|
||||
fsi_clk_invalid(fsi);
|
||||
fsi->rate = 0;
|
||||
}
|
||||
|
||||
static int fsi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
|
||||
|
@ -1795,7 +1699,6 @@ static int fsi_set_fmt_spdif(struct fsi_priv *fsi)
|
|||
static int fsi_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
{
|
||||
struct fsi_priv *fsi = fsi_get_priv_frm_dai(dai);
|
||||
set_rate_func set_rate = fsi_get_info_set_rate(fsi);
|
||||
int ret;
|
||||
|
||||
/* set master/slave audio interface */
|
||||
|
@ -1831,14 +1734,6 @@ static int fsi_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
|||
}
|
||||
|
||||
if (fsi_is_clk_master(fsi)) {
|
||||
/*
|
||||
* CAUTION
|
||||
*
|
||||
* set_rate will be deleted
|
||||
*/
|
||||
if (set_rate)
|
||||
dev_warn(dai->dev, "set_rate will be removed soon\n");
|
||||
|
||||
if (fsi->clk_cpg)
|
||||
fsi_clk_init(dai->dev, fsi, 0, 1, 1,
|
||||
fsi_clk_set_rate_cpg);
|
||||
|
@ -1862,10 +1757,8 @@ static int fsi_dai_hw_params(struct snd_pcm_substream *substream,
|
|||
{
|
||||
struct fsi_priv *fsi = fsi_get_priv(substream);
|
||||
|
||||
if (fsi_is_clk_master(fsi)) {
|
||||
fsi->rate = params_rate(params);
|
||||
fsi_clk_valid(fsi, fsi->rate);
|
||||
}
|
||||
if (fsi_is_clk_master(fsi))
|
||||
fsi_clk_valid(fsi, params_rate(params));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue