linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoc: fix ASoC driver to support ops to register get_time_info
@ 2021-08-20 13:02 Chien-Yu Lin
  2021-10-04 11:38 ` Chien-Yu Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Chien-Yu Lin @ 2021-08-20 13:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Matthias Brugger, alsa-devel, linux-arm-kernel, linux-mediatek,
	yichin.huang, hungjung.hsu, allen-hw.hsu, chien-yu.lin

From: "chien-yu.lin" <chien-yu.lin@mediatek.com>

Because ASoC soc_new_pcm() function didn't register
.get_time_info() ops and cause snd_pcm_update_hw_ptr0() can not find
substream->ops->get_time_info, it will not be called due to ASoC
driver which register in HW device driver.

Add .get_time_info() ops in ASoC soc_new_pcm() and
register by snd_pcm_set_ops() function.
If HW device driver want to implment timestamp by itself,
ASoC should register .get_time_info function.

Signed-off-by: chien-yu.lin <chien-yu.lin@mediatek.com>
---
 include/sound/soc-component.h |  4 ++++
 sound/soc/soc-component.c     | 21 +++++++++++++++++++++
 sound/soc/soc-pcm.c           |  2 ++
 3 files changed, 27 insertions(+)

diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 8c4d6830597f..52b5228b7a8d 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -484,6 +484,10 @@ int snd_soc_pcm_component_sync_stop(struct snd_pcm_substream *substream);
 int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream,
 				    int channel, unsigned long pos,
 				    void __user *buf, unsigned long bytes);
+int snd_soc_pcm_component_get_time_info(struct snd_pcm_substream *substream,
+					struct timespec64 *system_ts, struct timespec64 *audio_ts,
+					struct snd_pcm_audio_tstamp_config *audio_tstamp_config,
+					struct snd_pcm_audio_tstamp_report *audio_tstamp_report);
 struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
 					unsigned long offset);
 int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 3a5e84e16a87..56caec7ec00b 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -1000,6 +1000,27 @@ int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream,
 	return -EINVAL;
 }
 
+int snd_soc_pcm_component_get_time_info(struct snd_pcm_substream *substream,
+					struct timespec64 *system_ts, struct timespec64 *audio_ts,
+					struct snd_pcm_audio_tstamp_config *audio_tstamp_config,
+					struct snd_pcm_audio_tstamp_report *audio_tstamp_report)
+{
+	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
+	struct snd_soc_component *component;
+	int i;
+
+	/* FIXME. it returns 1st get_time_info now */
+	for_each_rtd_components(rtd, i, component) {
+		if (component->driver->get_time_info)
+			return soc_component_ret(component,
+				component->driver->get_time_info(component,
+				substream, system_ts, audio_ts,
+				audio_tstamp_config, audio_tstamp_report));
+	}
+
+	return -EINVAL;
+}
+
 struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
 					unsigned long offset)
 {
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index d1c570ca21ea..cff7025027a6 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2786,6 +2786,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
 			rtd->ops.mmap		= snd_soc_pcm_component_mmap;
 		if (drv->ack)
 			rtd->ops.ack            = snd_soc_pcm_component_ack;
+		if (drv->get_time_info)
+			rtd->ops.get_time_info	= snd_soc_pcm_component_get_time_info;
 	}
 
 	if (playback)
-- 
2.18.0


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

* Re: [PATCH] ASoc: fix ASoC driver to support ops to register get_time_info
  2021-08-20 13:02 [PATCH] ASoc: fix ASoC driver to support ops to register get_time_info Chien-Yu Lin
@ 2021-10-04 11:38 ` Chien-Yu Lin
  2021-10-04 12:50   ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Chien-Yu Lin @ 2021-10-04 11:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Matthias Brugger, alsa-devel, linux-arm-kernel, linux-mediatek,
	yichin.huang, hungjung.hsu, allen-hw.hsu

Dear Sir,

Sorry for bothering you.

Does it have any status updated, please?

Thank you.

Best Regards,
Chien-Yu.Lin

On Fri, 2021-08-20 at 21:02 +0800, Chien-Yu Lin wrote:
> From: "chien-yu.lin" <chien-yu.lin@mediatek.com>
> 
> Because ASoC soc_new_pcm() function didn't register
> .get_time_info() ops and cause snd_pcm_update_hw_ptr0() can not find
> substream->ops->get_time_info, it will not be called due to ASoC
> driver which register in HW device driver.
> 
> Add .get_time_info() ops in ASoC soc_new_pcm() and
> register by snd_pcm_set_ops() function.
> If HW device driver want to implment timestamp by itself,
> ASoC should register .get_time_info function.
> 
> Signed-off-by: chien-yu.lin <chien-yu.lin@mediatek.com>
> ---
>  include/sound/soc-component.h |  4 ++++
>  sound/soc/soc-component.c     | 21 +++++++++++++++++++++
>  sound/soc/soc-pcm.c           |  2 ++
>  3 files changed, 27 insertions(+)
> 
> diff --git a/include/sound/soc-component.h b/include/sound/soc-
> component.h
> index 8c4d6830597f..52b5228b7a8d 100644
> --- a/include/sound/soc-component.h
> +++ b/include/sound/soc-component.h
> @@ -484,6 +484,10 @@ int snd_soc_pcm_component_sync_stop(struct
> snd_pcm_substream *substream);
>  int snd_soc_pcm_component_copy_user(struct snd_pcm_substream
> *substream,
>  				    int channel, unsigned long pos,
>  				    void __user *buf, unsigned long
> bytes);
> +int snd_soc_pcm_component_get_time_info(struct snd_pcm_substream
> *substream,
> +					struct timespec64 *system_ts,
> struct timespec64 *audio_ts,
> +					struct
> snd_pcm_audio_tstamp_config *audio_tstamp_config,
> +					struct
> snd_pcm_audio_tstamp_report *audio_tstamp_report);
>  struct page *snd_soc_pcm_component_page(struct snd_pcm_substream
> *substream,
>  					unsigned long offset);
>  int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
> diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
> index 3a5e84e16a87..56caec7ec00b 100644
> --- a/sound/soc/soc-component.c
> +++ b/sound/soc/soc-component.c
> @@ -1000,6 +1000,27 @@ int snd_soc_pcm_component_copy_user(struct
> snd_pcm_substream *substream,
>  	return -EINVAL;
>  }
>  
> +int snd_soc_pcm_component_get_time_info(struct snd_pcm_substream
> *substream,
> +					struct timespec64 *system_ts,
> struct timespec64 *audio_ts,
> +					struct
> snd_pcm_audio_tstamp_config *audio_tstamp_config,
> +					struct
> snd_pcm_audio_tstamp_report *audio_tstamp_report)
> +{
> +	struct snd_soc_pcm_runtime *rtd =
> asoc_substream_to_rtd(substream);
> +	struct snd_soc_component *component;
> +	int i;
> +
> +	/* FIXME. it returns 1st get_time_info now */
> +	for_each_rtd_components(rtd, i, component) {
> +		if (component->driver->get_time_info)
> +			return soc_component_ret(component,
> +				component->driver-
> >get_time_info(component,
> +				substream, system_ts, audio_ts,
> +				audio_tstamp_config,
> audio_tstamp_report));
> +	}
> +
> +	return -EINVAL;
> +}
> +
>  struct page *snd_soc_pcm_component_page(struct snd_pcm_substream
> *substream,
>  					unsigned long offset)
>  {
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index d1c570ca21ea..cff7025027a6 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -2786,6 +2786,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime
> *rtd, int num)
>  			rtd->ops.mmap		=
> snd_soc_pcm_component_mmap;
>  		if (drv->ack)
>  			rtd->ops.ack            =
> snd_soc_pcm_component_ack;
> +		if (drv->get_time_info)
> +			rtd->ops.get_time_info	=
> snd_soc_pcm_component_get_time_info;
>  	}
>  
>  	if (playback)


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

* Re: [PATCH] ASoc: fix ASoC driver to support ops to register get_time_info
  2021-10-04 11:38 ` Chien-Yu Lin
@ 2021-10-04 12:50   ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-10-04 12:50 UTC (permalink / raw)
  To: Chien-Yu Lin
  Cc: linux-kernel, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Matthias Brugger, alsa-devel, linux-arm-kernel, linux-mediatek,
	yichin.huang, hungjung.hsu, allen-hw.hsu

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

On Mon, Oct 04, 2021 at 07:38:22PM +0800, Chien-Yu Lin wrote:
> Dear Sir,
> 
> Sorry for bothering you.
> 
> Does it have any status updated, please?

Please don't send content free pings and please allow a reasonable time
for review.  People get busy, go on holiday, attend conferences and so 
on so unless there is some reason for urgency (like critical bug fixes)
please allow at least a couple of weeks for review.  If there have been
review comments then people may be waiting for those to be addressed.

Sending content free pings adds to the mail volume (if they are seen at
all) which is often the problem and since they can't be reviewed
directly if something has gone wrong you'll have to resend the patches
anyway, so sending again is generally a better approach though there are
some other maintainers who like them - if in doubt look at how patches
for the subsystem are normally handled.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2021-10-04 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20 13:02 [PATCH] ASoc: fix ASoC driver to support ops to register get_time_info Chien-Yu Lin
2021-10-04 11:38 ` Chien-Yu Lin
2021-10-04 12:50   ` Mark Brown

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).