Commit 3ee15cac authored by Moise Gergaud's avatar Moise Gergaud Committed by Mark Brown

ASoC: sti: select player for I2S/TDM TX bus

By default, player#0 is connected to I2S/TDM TX bus.
This patch connects player#1 to I2S/TDM TX bus.
Signed-off-by: default avatarMoise Gergaud <moise.gergaud@st.com>
Acked-by: default avatarArnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 82d4eb91
...@@ -1302,6 +1302,7 @@ struct uniperif { ...@@ -1302,6 +1302,7 @@ struct uniperif {
struct device *dev; struct device *dev;
int ver; /* IP version, used by register access macros */ int ver; /* IP version, used by register access macros */
struct regmap_field *clk_sel; struct regmap_field *clk_sel;
struct regmap_field *valid_sel;
/* capabilities */ /* capabilities */
const struct snd_pcm_hardware *hw; const struct snd_pcm_hardware *hw;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
/* sys config registers definitions */ /* sys config registers definitions */
#define SYS_CFG_AUDIO_GLUE 0xA4 #define SYS_CFG_AUDIO_GLUE 0xA4
#define SYS_CFG_AUDI0_GLUE_PCM_CLKX 8
/* /*
* Driver specific types. * Driver specific types.
...@@ -29,6 +28,7 @@ ...@@ -29,6 +28,7 @@
#define UNIPERIF_PLAYER_CLK_ADJ_MIN -999999 #define UNIPERIF_PLAYER_CLK_ADJ_MIN -999999
#define UNIPERIF_PLAYER_CLK_ADJ_MAX 1000000 #define UNIPERIF_PLAYER_CLK_ADJ_MAX 1000000
#define UNIPERIF_PLAYER_I2S_OUT 1 /* player id connected to I2S/TDM TX bus */
/* /*
* Note: snd_pcm_hardware is linked to DMA controller but is declared here to * Note: snd_pcm_hardware is linked to DMA controller but is declared here to
...@@ -1013,27 +1013,30 @@ static void uni_player_shutdown(struct snd_pcm_substream *substream, ...@@ -1013,27 +1013,30 @@ static void uni_player_shutdown(struct snd_pcm_substream *substream,
player->substream = NULL; player->substream = NULL;
} }
static int uni_player_parse_dt_clk_glue(struct platform_device *pdev, static int uni_player_parse_dt_audio_glue(struct platform_device *pdev,
struct uniperif *player) struct uniperif *player)
{ {
int bit_offset;
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct regmap *regmap; struct regmap *regmap;
struct reg_field regfield[2] = {
bit_offset = SYS_CFG_AUDI0_GLUE_PCM_CLKX + player->info->id; /* PCM_CLK_SEL */
REG_FIELD(SYS_CFG_AUDIO_GLUE,
8 + player->info->id,
8 + player->info->id),
/* PCMP_VALID_SEL */
REG_FIELD(SYS_CFG_AUDIO_GLUE, 0, 1)
};
regmap = syscon_regmap_lookup_by_phandle(node, "st,syscfg"); regmap = syscon_regmap_lookup_by_phandle(node, "st,syscfg");
if (regmap) { if (!regmap) {
struct reg_field regfield =
REG_FIELD(SYS_CFG_AUDIO_GLUE, bit_offset, bit_offset);
player->clk_sel = regmap_field_alloc(regmap, regfield);
} else {
dev_err(&pdev->dev, "sti-audio-clk-glue syscf not found\n"); dev_err(&pdev->dev, "sti-audio-clk-glue syscf not found\n");
return -EINVAL; return -EINVAL;
} }
player->clk_sel = regmap_field_alloc(regmap, regfield[0]);
player->valid_sel = regmap_field_alloc(regmap, regfield[1]);
return 0; return 0;
} }
...@@ -1084,8 +1087,8 @@ static int uni_player_parse_dt(struct platform_device *pdev, ...@@ -1084,8 +1087,8 @@ static int uni_player_parse_dt(struct platform_device *pdev,
/* Save the info structure */ /* Save the info structure */
player->info = info; player->info = info;
/* Get the PCM_CLK_SEL bit from audio-glue-ctrl SoC register */ /* Get PCM_CLK_SEL & PCMP_VALID_SEL from audio-glue-ctrl SoC reg */
if (uni_player_parse_dt_clk_glue(pdev, player)) if (uni_player_parse_dt_audio_glue(pdev, player))
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -1139,6 +1142,17 @@ int uni_player_init(struct platform_device *pdev, ...@@ -1139,6 +1142,17 @@ int uni_player_init(struct platform_device *pdev,
} }
} }
/* connect to I2S/TDM TX bus */
if (player->valid_sel &&
(player->info->id == UNIPERIF_PLAYER_I2S_OUT)) {
ret = regmap_field_write(player->valid_sel, player->info->id);
if (ret) {
dev_err(player->dev,
"%s: unable to connect to tdm bus", __func__);
return ret;
}
}
ret = devm_request_irq(&pdev->dev, player->irq, ret = devm_request_irq(&pdev->dev, player->irq,
uni_player_irq_handler, IRQF_SHARED, uni_player_irq_handler, IRQF_SHARED,
dev_name(&pdev->dev), player); dev_name(&pdev->dev), player);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment