stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Russell King <rmk+kernel@armlinux.org.uk>,
	Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.19 02/53] ASoC: hdmi-codec: fix S/PDIF DAI
Date: Fri, 26 Apr 2019 21:39:59 -0400	[thread overview]
Message-ID: <20190427014051.7522-2-sashal@kernel.org> (raw)
In-Reply-To: <20190427014051.7522-1-sashal@kernel.org>

From: Russell King <rmk+kernel@armlinux.org.uk>

[ Upstream commit 2e95f984aae4cf0608d0ba2189c756f2bd50b44a ]

When using the S/PDIF DAI, there is no requirement to call
snd_soc_dai_set_fmt() as there is no DAI format definition that defines
S/PDIF.  In any case, S/PDIF does not have separate clocks, this is
embedded into the data stream.

Consequently, when attempting to use TDA998x in S/PDIF mode, the attempt
to configure TDA998x via the hw_params callback fails as the
hdmi_codec_daifmt is left initialised to zero.

Since the S/PDIF DAI will only be used by S/PDIF, prepare the
hdmi_codec_daifmt structure for this format.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/hdmi-codec.c | 118 +++++++++++++++++-----------------
 1 file changed, 59 insertions(+), 59 deletions(-)

diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index e5b6769b9797..d5f73c837281 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -529,73 +529,71 @@ static int hdmi_codec_set_fmt(struct snd_soc_dai *dai,
 {
 	struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
 	struct hdmi_codec_daifmt cf = { 0 };
-	int ret = 0;
 
 	dev_dbg(dai->dev, "%s()\n", __func__);
 
-	if (dai->id == DAI_ID_SPDIF) {
-		cf.fmt = HDMI_SPDIF;
-	} else {
-		switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
-		case SND_SOC_DAIFMT_CBM_CFM:
-			cf.bit_clk_master = 1;
-			cf.frame_clk_master = 1;
-			break;
-		case SND_SOC_DAIFMT_CBS_CFM:
-			cf.frame_clk_master = 1;
-			break;
-		case SND_SOC_DAIFMT_CBM_CFS:
-			cf.bit_clk_master = 1;
-			break;
-		case SND_SOC_DAIFMT_CBS_CFS:
-			break;
-		default:
-			return -EINVAL;
-		}
+	if (dai->id == DAI_ID_SPDIF)
+		return 0;
+
+	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+	case SND_SOC_DAIFMT_CBM_CFM:
+		cf.bit_clk_master = 1;
+		cf.frame_clk_master = 1;
+		break;
+	case SND_SOC_DAIFMT_CBS_CFM:
+		cf.frame_clk_master = 1;
+		break;
+	case SND_SOC_DAIFMT_CBM_CFS:
+		cf.bit_clk_master = 1;
+		break;
+	case SND_SOC_DAIFMT_CBS_CFS:
+		break;
+	default:
+		return -EINVAL;
+	}
 
-		switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
-		case SND_SOC_DAIFMT_NB_NF:
-			break;
-		case SND_SOC_DAIFMT_NB_IF:
-			cf.frame_clk_inv = 1;
-			break;
-		case SND_SOC_DAIFMT_IB_NF:
-			cf.bit_clk_inv = 1;
-			break;
-		case SND_SOC_DAIFMT_IB_IF:
-			cf.frame_clk_inv = 1;
-			cf.bit_clk_inv = 1;
-			break;
-		}
+	switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+	case SND_SOC_DAIFMT_NB_NF:
+		break;
+	case SND_SOC_DAIFMT_NB_IF:
+		cf.frame_clk_inv = 1;
+		break;
+	case SND_SOC_DAIFMT_IB_NF:
+		cf.bit_clk_inv = 1;
+		break;
+	case SND_SOC_DAIFMT_IB_IF:
+		cf.frame_clk_inv = 1;
+		cf.bit_clk_inv = 1;
+		break;
+	}
 
-		switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
-		case SND_SOC_DAIFMT_I2S:
-			cf.fmt = HDMI_I2S;
-			break;
-		case SND_SOC_DAIFMT_DSP_A:
-			cf.fmt = HDMI_DSP_A;
-			break;
-		case SND_SOC_DAIFMT_DSP_B:
-			cf.fmt = HDMI_DSP_B;
-			break;
-		case SND_SOC_DAIFMT_RIGHT_J:
-			cf.fmt = HDMI_RIGHT_J;
-			break;
-		case SND_SOC_DAIFMT_LEFT_J:
-			cf.fmt = HDMI_LEFT_J;
-			break;
-		case SND_SOC_DAIFMT_AC97:
-			cf.fmt = HDMI_AC97;
-			break;
-		default:
-			dev_err(dai->dev, "Invalid DAI interface format\n");
-			return -EINVAL;
-		}
+	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+	case SND_SOC_DAIFMT_I2S:
+		cf.fmt = HDMI_I2S;
+		break;
+	case SND_SOC_DAIFMT_DSP_A:
+		cf.fmt = HDMI_DSP_A;
+		break;
+	case SND_SOC_DAIFMT_DSP_B:
+		cf.fmt = HDMI_DSP_B;
+		break;
+	case SND_SOC_DAIFMT_RIGHT_J:
+		cf.fmt = HDMI_RIGHT_J;
+		break;
+	case SND_SOC_DAIFMT_LEFT_J:
+		cf.fmt = HDMI_LEFT_J;
+		break;
+	case SND_SOC_DAIFMT_AC97:
+		cf.fmt = HDMI_AC97;
+		break;
+	default:
+		dev_err(dai->dev, "Invalid DAI interface format\n");
+		return -EINVAL;
 	}
 
 	hcp->daifmt[dai->id] = cf;
 
-	return ret;
+	return 0;
 }
 
 static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute)
@@ -792,8 +790,10 @@ static int hdmi_codec_probe(struct platform_device *pdev)
 		i++;
 	}
 
-	if (hcd->spdif)
+	if (hcd->spdif) {
 		hcp->daidrv[i] = hdmi_spdif_dai;
+		hcp->daifmt[DAI_ID_SPDIF].fmt = HDMI_SPDIF;
+	}
 
 	dev_set_drvdata(dev, hcp);
 
-- 
2.19.1


  reply	other threads:[~2019-04-27  1:52 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-27  1:39 [PATCH AUTOSEL 4.19 01/53] ASoC: tlv320aic3x: fix reset gpio reference counting Sasha Levin
2019-04-27  1:39 ` Sasha Levin [this message]
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 03/53] ASoC: ab8500: Mark expected switch fall-through Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 04/53] ASoC: stm32: sai: fix iec958 controls indexation Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 05/53] ASoC: stm32: sai: fix exposed capabilities in spdif mode Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 06/53] ASoC:soc-pcm:fix a codec fixup issue in TDM case Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 07/53] ASoC:intel:skl:fix a simultaneous playback & capture issue on hda platform Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 08/53] ASoC: nau8824: fix the issue of the widget with prefix name Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 09/53] ASoC: nau8810: fix the issue of widget with prefixed name Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 10/53] ASoC: samsung: odroid: Fix clock configuration for 44100 sample rate Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 11/53] ASoC: rt5682: recording has no sound after booting Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 12/53] ASoC: wm_adsp: Add locking to wm_adsp2_bus_error Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 13/53] clk: meson-gxbb: round the vdec dividers to closest Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 14/53] ASoC: stm32: dfsdm: manage multiple prepare Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 15/53] ASoC: stm32: dfsdm: fix debugfs warnings on entry creation Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 16/53] ASoC: cs4270: Set auto-increment bit for register writes Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 17/53] ASoC: dapm: Fix NULL pointer dereference in snd_soc_dapm_free_kcontrol Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 18/53] drm/omap: hdmi4_cec: Fix CEC clock handling for PM Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 19/53] IB/hfi1: Eliminate opcode tests on mr deref Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 20/53] IB/hfi1: Fix the allocation of RSM table Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 21/53] MIPS: KGDB: fix kgdb support for SMP platforms Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 22/53] ASoC: tlv320aic32x4: Fix Common Pins Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 23/53] drm/mediatek: Fix an error code in mtk_hdmi_dt_parse_pdata() Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 24/53] perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 25/53] perf/x86/intel: Initialize TFA MSR Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 26/53] linux/kernel.h: Use parentheses around argument in u64_to_user_ptr() Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 27/53] xtensa: fix initialization of pt_regs::syscall in start_thread Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 28/53] ASoC: rockchip: pdm: fix regmap_ops hang issue Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 29/53] drm/amdkfd: Add picasso pci id Sasha Levin
     [not found]   ` <BN6PR12MB18098B1A85760FCFFFDD3C37F73F0@BN6PR12MB1809.namprd12.prod.outlook.com>
2019-05-08 17:35     ` Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 30/53] drm/amd/display: fix cursor black issue Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 31/53] ASoC: cs35l35: Disable regulators on driver removal Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 32/53] objtool: Add rewind_stack_do_exit() to the noreturn list Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 33/53] powerpc/vdso32: fix CLOCK_MONOTONIC on PPC64 Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 34/53] slab: fix a crash by reading /proc/slab_allocators Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 35/53] ASoC: stm32: fix sai driver name initialisation Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 36/53] drm/sun4i: tcon top: Fix NULL/invalid pointer dereference in sun8i_tcon_top_un/bind Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 37/53] virtio_pci: fix a NULL pointer reference in vp_del_vqs Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 38/53] RDMA/vmw_pvrdma: Fix memory leak on pvrdma_pci_remove Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 39/53] RDMA/hns: Fix bug that caused srq creation to fail Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 40/53] scsi: csiostor: fix missing data copy in csio_scsi_err_handler() Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 41/53] drm/mediatek: fix possible object reference leak Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 42/53] Bluetooth: btusb: request wake pin with NOAUTOEN Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 43/53] ASoC: Intel: kbl: fix wrong number of channels Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 44/53] virtio-blk: limit number of hw queues by nr_cpu_ids Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 45/53] clk: x86: Add system specific quirk to mark clocks as critical Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 46/53] nvme-fc: correct csn initialization and increments on error Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 47/53] platform/x86: pmc_atom: Drop __initconst on dmi table Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 48/53] NFS: Forbid setting AF_INET6 to "struct sockaddr_in"->sin_family Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 49/53] perf/core: Fix perf_event_disable_inatomic() race Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 50/53] iommu/amd: Set exclusion range correctly Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 51/53] mm: make page ref count overflow check tighter and more explicit Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 52/53] mm: add 'try_get_page()' helper function Sasha Levin
2019-04-27  1:40 ` [PATCH AUTOSEL 4.19 53/53] fs: prevent page refcount overflow in pipe_buf_get Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190427014051.7522-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).