All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND 0/2] Enable TDM slot and fix SSP params for kabylake machine driver
@ 2017-10-26 18:44 Harsha Priya
  2017-10-26 18:44 ` [PATCH RESEND 1/2] ASoC: Intel: Enable tdm slots for max98927 Harsha Priya
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Harsha Priya @ 2017-10-26 18:44 UTC (permalink / raw)
  To: tiwai, vinod.koul, broonie, alsa-devel; +Cc: Harsha Priya

Hi Mark,

These are resend of an already acked patch series.
I posted it a few weeks ago but there has been update on the base branch. 
I want to resend these. Kindly review and merge.

This patch series includes 2 patches for kabylake machine driver using
max98927 and rt5663 codecs. The changes are:

1. Enable 4 tdm slots for IV feedback and 2 tdm slots for playback on max98927

2. Fix setting of SSP parameters to be based on FE and BE dai links.


Harsha Priya (2):
  ASoC: Intel: Enable tdm slots for max98927
  ASoC: Intel: Fix setting of SSP parameters in Kabylake machine driver

 sound/soc/intel/boards/kbl_rt5663_max98927.c | 67 +++++++++++++++++++++++++---
 1 file changed, 60 insertions(+), 7 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH RESEND 1/2] ASoC: Intel: Enable tdm slots for max98927
  2017-10-26 18:44 [PATCH RESEND 0/2] Enable TDM slot and fix SSP params for kabylake machine driver Harsha Priya
@ 2017-10-26 18:44 ` Harsha Priya
  2017-10-26 18:44 ` [PATCH RESEND 2/2] ASoC: Intel: Fix setting of SSP parameters in Kabylake machine driver Harsha Priya
  2017-10-27  4:13 ` [PATCH RESEND 0/2] Enable TDM slot and fix SSP params for kabylake " Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Harsha Priya @ 2017-10-26 18:44 UTC (permalink / raw)
  To: tiwai, vinod.koul, broonie, alsa-devel; +Cc: Harsha Priya, Naveen M

In this patch the SSP0 BE's mode is changed from I2S mode to DSP_B
with 8 slots of 16 bits. It enables 4 slot for IV feedback and 2 slots for
playback on max98927 for kabylake machine driver

The layout of SSP0 Tx and Rx slots is as follows;
1. Playback uses Tx slots 0 and 1
2. Capture uses Rx slots 4,5,6,7.

Slots 0 through 3 of Rx are used by DMIC codec RT5514 in another flavor
of Kabylake platform. We are using the same slots 4 through 7 on all
Kabylake platforms for max98927 in order to reuse same NHLT configuration.

Signed-off-by: Naveen M <naveen.m@intel.com>
Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
---
 sound/soc/intel/boards/kbl_rt5663_max98927.c | 40 +++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/boards/kbl_rt5663_max98927.c b/sound/soc/intel/boards/kbl_rt5663_max98927.c
index e45b6fe..5a4ee5b 100644
--- a/sound/soc/intel/boards/kbl_rt5663_max98927.c
+++ b/sound/soc/intel/boards/kbl_rt5663_max98927.c
@@ -399,6 +399,43 @@ static int kabylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
 	return 0;
 }
 
+static int kabylake_ssp0_hw_params(struct snd_pcm_substream *substream,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	int ret = 0, j;
+
+	for (j = 0; j < rtd->num_codecs; j++) {
+		struct snd_soc_dai *codec_dai = rtd->codec_dais[j];
+
+		if (!strcmp(codec_dai->component->name, MAXIM_DEV0_NAME)) {
+			/*
+			 * Use channel 4 and 5 for the first amp
+			 */
+			ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x30, 3, 8, 16);
+			if (ret < 0) {
+				dev_err(rtd->dev, "set TDM slot err:%d\n", ret);
+				return ret;
+			}
+		}
+		if (!strcmp(codec_dai->component->name, MAXIM_DEV1_NAME)) {
+			/*
+			 * Use channel 6 and 7 for the second amp
+			 */
+			ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xC0, 3, 8, 16);
+			if (ret < 0) {
+				dev_err(rtd->dev, "set TDM slot err:%d\n", ret);
+				return ret;
+			}
+		}
+	}
+	return ret;
+}
+
+static struct snd_soc_ops kabylake_ssp0_ops = {
+	.hw_params = kabylake_ssp0_hw_params,
+};
+
 static unsigned int channels_dmic[] = {
 	2, 4,
 };
@@ -602,12 +639,13 @@ static int kabylake_refcap_startup(struct snd_pcm_substream *substream)
 		.no_pcm = 1,
 		.codecs = max98927_codec_components,
 		.num_codecs = ARRAY_SIZE(max98927_codec_components),
-		.dai_fmt = SND_SOC_DAIFMT_I2S |
+		.dai_fmt = SND_SOC_DAIFMT_DSP_B |
 			SND_SOC_DAIFMT_NB_NF |
 			SND_SOC_DAIFMT_CBS_CFS,
 		.ignore_pmdown_time = 1,
 		.be_hw_params_fixup = kabylake_ssp_fixup,
 		.dpcm_playback = 1,
+		.ops = &kabylake_ssp0_ops,
 	},
 	{
 		/* SSP1 - Codec */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH RESEND 2/2] ASoC: Intel: Fix setting of SSP parameters in Kabylake machine driver
  2017-10-26 18:44 [PATCH RESEND 0/2] Enable TDM slot and fix SSP params for kabylake machine driver Harsha Priya
  2017-10-26 18:44 ` [PATCH RESEND 1/2] ASoC: Intel: Enable tdm slots for max98927 Harsha Priya
@ 2017-10-26 18:44 ` Harsha Priya
  2017-10-27  4:13 ` [PATCH RESEND 0/2] Enable TDM slot and fix SSP params for kabylake " Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Harsha Priya @ 2017-10-26 18:44 UTC (permalink / raw)
  To: tiwai, vinod.koul, broonie, alsa-devel; +Cc: Harsha Priya, Naveen M

This patch sets the SSP params based on FE and BE dai links
for kabylake machine driver that uses rt5663 and max98927 codecs

Signed-off-by: Naveen M <naveen.m@intel.com>
Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
---
 sound/soc/intel/boards/kbl_rt5663_max98927.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/sound/soc/intel/boards/kbl_rt5663_max98927.c b/sound/soc/intel/boards/kbl_rt5663_max98927.c
index 5a4ee5b..6f9a8bc 100644
--- a/sound/soc/intel/boards/kbl_rt5663_max98927.c
+++ b/sound/soc/intel/boards/kbl_rt5663_max98927.c
@@ -350,13 +350,28 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
 	struct snd_interval *channels = hw_param_interval(params,
 			SNDRV_PCM_HW_PARAM_CHANNELS);
 	struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
+	struct snd_soc_dpcm *dpcm = container_of(
+			params, struct snd_soc_dpcm, hw_params);
+	struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link;
+	struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link;
 
-	/* The ADSP will convert the FE rate to 48k, stereo */
-	rate->min = rate->max = 48000;
-	channels->min = channels->max = 2;
-	/* set SSP1 to 24 bit */
-	snd_mask_none(fmt);
-	snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
+	/*
+	 * The ADSP will convert the FE rate to 48k, stereo, 24 bit
+	 */
+	if (!strcmp(fe_dai_link->name, "Kbl Audio Port") ||
+	    !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") ||
+	    !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) {
+		rate->min = rate->max = 48000;
+		channels->min = channels->max = 2;
+		snd_mask_none(fmt);
+		snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
+	}
+	/*
+	 * The speaker on the SSP0 supports S16_LE and not S24_LE.
+	 * thus changing the mask here
+	 */
+	if (!strcmp(be_dai_link->name, "SSP0-Codec"))
+		snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE);
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND 0/2] Enable TDM slot and fix SSP params for kabylake machine driver
  2017-10-26 18:44 [PATCH RESEND 0/2] Enable TDM slot and fix SSP params for kabylake machine driver Harsha Priya
  2017-10-26 18:44 ` [PATCH RESEND 1/2] ASoC: Intel: Enable tdm slots for max98927 Harsha Priya
  2017-10-26 18:44 ` [PATCH RESEND 2/2] ASoC: Intel: Fix setting of SSP parameters in Kabylake machine driver Harsha Priya
@ 2017-10-27  4:13 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2017-10-27  4:13 UTC (permalink / raw)
  To: Harsha Priya; +Cc: tiwai, alsa-devel, broonie

On Thu, Oct 26, 2017 at 11:44:01AM -0700, Harsha Priya wrote:
> Hi Mark,
> 
> These are resend of an already acked patch series.
> I posted it a few weeks ago but there has been update on the base branch. 
> I want to resend these. Kindly review and merge.
> 
> This patch series includes 2 patches for kabylake machine driver using
> max98927 and rt5663 codecs. The changes are:
> 
> 1. Enable 4 tdm slots for IV feedback and 2 tdm slots for playback on max98927
> 
> 2. Fix setting of SSP parameters to be based on FE and BE dai links.

Acked-By: Vinod Koul <vinod.koul@intel.com>

> Harsha Priya (2):
>   ASoC: Intel: Enable tdm slots for max98927
>   ASoC: Intel: Fix setting of SSP parameters in Kabylake machine driver
> 
>  sound/soc/intel/boards/kbl_rt5663_max98927.c | 67 +++++++++++++++++++++++++---
>  1 file changed, 60 insertions(+), 7 deletions(-)
> 
> -- 
> 1.9.1
> 

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-27  4:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-26 18:44 [PATCH RESEND 0/2] Enable TDM slot and fix SSP params for kabylake machine driver Harsha Priya
2017-10-26 18:44 ` [PATCH RESEND 1/2] ASoC: Intel: Enable tdm slots for max98927 Harsha Priya
2017-10-26 18:44 ` [PATCH RESEND 2/2] ASoC: Intel: Fix setting of SSP parameters in Kabylake machine driver Harsha Priya
2017-10-27  4:13 ` [PATCH RESEND 0/2] Enable TDM slot and fix SSP params for kabylake " Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.