summaryrefslogtreecommitdiff
path: root/sound/soc/sti/uniperif_player.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-10-05 12:13:14 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-05 12:13:14 -0700
commit5691f0e9a3e7855832d5fd094801bf600347c2d0 (patch)
tree4cd4538de2bde556be944e984a3882a64b25dfcb /sound/soc/sti/uniperif_player.c
parent878fb5dc96b9dfae1de45be1b85aba40aca3356e (diff)
parenteeea8b40cd2866ca24f25e5ef09225edb076ae45 (diff)
Merge tag 'sound-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai: "Again the diffstat shows a widely distributed pattern at this cycle, as there've been many code cleanups and refactoring allover the places. Other than that, the development was relatively calm, and no big surprise shouldn't be expected. Here are some highlights: Core: - Sequencer code refactoring / documentation updates - TLV code moved to uapi, following some relevant cleanups USB-Audio: - Lots of LINE6 driver fixes / updates - DragonFly and TEAC device quirk updates HD-audio: - Usual fixupes for Dell, Lenovo and HP machines - Link-audio time reporting capability ASoC: - Large refactoring of simple-card code to be shared with rcar driver - Removal of some duplicated ops over lots of CODEC drivers - Again quite a few Intel SKL driver updates - New drivers for Nuvoton NAU88C10, Realtek RT5660 and RT5663" * tag 'sound-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (465 commits) ASoC: fsl: Fix lockups with recent cache changes ASoC: Intel: Skylake: fix memory leak of module on error exit path ASoC: rsnd: add SNDRV_PCM_TRIGGER_SUSPEND/RESUME ASoC: wm8960: remove usage of obsoleted TLV-related macro ASoC: rt5616: remove usage of obsoleted TLV-related macro ASoC: max9867: remove usage of obsoleted TLV-related macro ASoC: trivial: system spelling fix ASoC: da7219: fix inappropriate condition statement ASoC: tlv320aic31xx: do not declare support for mono DAI ASoC: stac9766: fix wrong usage of DECLARE_TLV_DB_LINEAR() ASoC: wm8991: remove unused variable ASoC: wm8991: fix wrong usage of DECLARE_TLV_DB_LINEAR() ASOC: tpa6130a2: add static qualifier for file local symbols ASoC: sst-bxt-rt298: fix obsoleted initializers for array ASoC: sst-bxt-da7219_max98357a: fix obsoleted initializers for array ASoC: rt5616: add static qualifier for file local symbols ASoC: arizona: Add output power up/down delays for speaker path ASoC: arizona: Add debug prints for output power up/down times ALSA: hda - Add the top speaker pin config for HP Spectre x360 ASoC: Intel: Add DMIC channel constraint for bxt machine ...
Diffstat (limited to 'sound/soc/sti/uniperif_player.c')
-rw-r--r--sound/soc/sti/uniperif_player.c83
1 files changed, 18 insertions, 65 deletions
diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c
index 1ac2db205a0d..1bc8ebc2528e 100644
--- a/sound/soc/sti/uniperif_player.c
+++ b/sound/soc/sti/uniperif_player.c
@@ -100,7 +100,7 @@ static irqreturn_t uni_player_irq_handler(int irq, void *dev_id)
dev_err(player->dev, "FIFO underflow error detected");
/* Interrupt is just for information when underflow recovery */
- if (player->info->underflow_enabled) {
+ if (player->underflow_enabled) {
/* Update state to underflow */
player->state = UNIPERIF_STATE_UNDERFLOW;
@@ -134,7 +134,7 @@ static irqreturn_t uni_player_irq_handler(int irq, void *dev_id)
/* Check for underflow recovery done */
if (unlikely(status & UNIPERIF_ITM_UNDERFLOW_REC_DONE_MASK(player))) {
- if (!player->info->underflow_enabled) {
+ if (!player->underflow_enabled) {
dev_err(player->dev, "unexpected Underflow recovering");
return -EPERM;
}
@@ -764,7 +764,7 @@ static int uni_player_prepare(struct snd_pcm_substream *substream,
}
/* Calculate transfer size (in fifo cells and bytes) for frame count */
- if (player->info->type == SND_ST_UNIPERIF_TYPE_TDM) {
+ if (player->type == SND_ST_UNIPERIF_TYPE_TDM) {
/* transfer size = user frame size (in 32 bits FIFO cell) */
transfer_size =
sti_uniperiph_get_user_frame_size(runtime) / 4;
@@ -794,7 +794,7 @@ static int uni_player_prepare(struct snd_pcm_substream *substream,
SET_UNIPERIF_CONFIG_DMA_TRIG_LIMIT(player, trigger_limit);
/* Uniperipheral setup depends on player type */
- switch (player->info->type) {
+ switch (player->type) {
case SND_ST_UNIPERIF_TYPE_HDMI:
ret = uni_player_prepare_iec958(player, runtime);
break;
@@ -884,7 +884,7 @@ static int uni_player_start(struct uniperif *player)
SET_UNIPERIF_ITM_BSET_FIFO_ERROR(player);
/* Enable underflow recovery interrupts */
- if (player->info->underflow_enabled) {
+ if (player->underflow_enabled) {
SET_UNIPERIF_ITM_BSET_UNDERFLOW_REC_DONE(player);
SET_UNIPERIF_ITM_BSET_UNDERFLOW_REC_FAILED(player);
}
@@ -893,8 +893,10 @@ static int uni_player_start(struct uniperif *player)
SET_UNIPERIF_SOFT_RST_SOFT_RST(player);
ret = reset_player(player);
- if (ret < 0)
+ if (ret < 0) {
+ clk_disable_unprepare(player->clk);
return ret;
+ }
/*
* Does not use IEC61937 features of the uniperipheral hardware.
@@ -1021,8 +1023,8 @@ static int uni_player_parse_dt_audio_glue(struct platform_device *pdev,
struct reg_field regfield[2] = {
/* PCM_CLK_SEL */
REG_FIELD(SYS_CFG_AUDIO_GLUE,
- 8 + player->info->id,
- 8 + player->info->id),
+ 8 + player->id,
+ 8 + player->id),
/* PCMP_VALID_SEL */
REG_FIELD(SYS_CFG_AUDIO_GLUE, 0, 1)
};
@@ -1040,60 +1042,6 @@ static int uni_player_parse_dt_audio_glue(struct platform_device *pdev,
return 0;
}
-static int uni_player_parse_dt(struct platform_device *pdev,
- struct uniperif *player)
-{
- struct uniperif_info *info;
- struct device *dev = &pdev->dev;
- struct device_node *pnode = pdev->dev.of_node;
- const char *mode;
-
- /* Allocate memory for the info structure */
- info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
- if (!info)
- return -ENOMEM;
-
- if (of_property_read_u32(pnode, "st,version", &player->ver) ||
- player->ver == SND_ST_UNIPERIF_VERSION_UNKNOWN) {
- dev_err(dev, "Unknown uniperipheral version ");
- return -EINVAL;
- }
- /* Underflow recovery is only supported on later ip revisions */
- if (player->ver >= SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0)
- info->underflow_enabled = 1;
-
- if (of_property_read_u32(pnode, "st,uniperiph-id", &info->id)) {
- dev_err(dev, "uniperipheral id not defined");
- return -EINVAL;
- }
-
- /* Read the device mode property */
- if (of_property_read_string(pnode, "st,mode", &mode)) {
- dev_err(dev, "uniperipheral mode not defined");
- return -EINVAL;
- }
-
- if (strcasecmp(mode, "hdmi") == 0)
- info->type = SND_ST_UNIPERIF_TYPE_HDMI;
- else if (strcasecmp(mode, "pcm") == 0)
- info->type = SND_ST_UNIPERIF_TYPE_PCM;
- else if (strcasecmp(mode, "spdif") == 0)
- info->type = SND_ST_UNIPERIF_TYPE_SPDIF;
- else if (strcasecmp(mode, "tdm") == 0)
- info->type = SND_ST_UNIPERIF_TYPE_TDM;
- else
- info->type = SND_ST_UNIPERIF_TYPE_NONE;
-
- /* Save the info structure */
- player->info = info;
-
- /* Get PCM_CLK_SEL & PCMP_VALID_SEL from audio-glue-ctrl SoC reg */
- if (uni_player_parse_dt_audio_glue(pdev, player))
- return -EINVAL;
-
- return 0;
-}
-
static const struct snd_soc_dai_ops uni_player_dai_ops = {
.startup = uni_player_startup,
.shutdown = uni_player_shutdown,
@@ -1114,13 +1062,18 @@ int uni_player_init(struct platform_device *pdev,
player->state = UNIPERIF_STATE_STOPPED;
player->dai_ops = &uni_player_dai_ops;
- ret = uni_player_parse_dt(pdev, player);
+ /* Get PCM_CLK_SEL & PCMP_VALID_SEL from audio-glue-ctrl SoC reg */
+ ret = uni_player_parse_dt_audio_glue(pdev, player);
if (ret < 0) {
dev_err(player->dev, "Failed to parse DeviceTree");
return ret;
}
+ /* Underflow recovery is only supported on later ip revisions */
+ if (player->ver >= SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0)
+ player->underflow_enabled = 1;
+
if (UNIPERIF_TYPE_IS_TDM(player))
player->hw = &uni_tdm_hw;
else
@@ -1144,8 +1097,8 @@ 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);
+ (player->id == UNIPERIF_PLAYER_I2S_OUT)) {
+ ret = regmap_field_write(player->valid_sel, player->id);
if (ret) {
dev_err(player->dev,
"%s: unable to connect to tdm bus", __func__);