alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH for-5.6 0/4] staging: ALSA PCM API updates
@ 2019-12-10 14:13 Takashi Iwai
  2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 1/4] staging: most: Use managed buffer allocation Takashi Iwai
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Takashi Iwai @ 2019-12-10 14:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, alsa-devel, Florian Fainelli, Scott Branden, Ray Jui,
	linux-kernel, bcm-kernel-feedback-list, Nicolas Saenz Julienne

Hi,

this is a patch set to adapt the latest ALSA PCM API to staging
drivers.  Basically these are merely cleanups, as shown in diffstat,
and there should be no functional changes.

As the corresponding ALSA PCM API change is found in 5.5-rc1, please
apply these on 5.5-rc1 or later.  Or if you prefer, I can merge them
through sound tree, too.  Let me know.


thanks,

Takashi

===

Takashi Iwai (4):
  staging: most: Use managed buffer allocation
  staging: bcm2835-audio: Use managed buffer allocation
  staging: most: Drop superfluous ioctl PCM ops
  staging: bcm2835-audio: Drop superfluous ioctl PCM ops

 drivers/staging/most/sound/sound.c                 | 45 +---------------------
 .../vc04_services/bcm2835-audio/bcm2835-pcm.c      | 19 +--------
 2 files changed, 2 insertions(+), 62 deletions(-)

-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH for-5.6 1/4] staging: most: Use managed buffer allocation
  2019-12-10 14:13 [alsa-devel] [PATCH for-5.6 0/4] staging: ALSA PCM API updates Takashi Iwai
@ 2019-12-10 14:13 ` Takashi Iwai
  2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 2/4] staging: bcm2835-audio: " Takashi Iwai
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2019-12-10 14:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, alsa-devel, Florian Fainelli, Scott Branden, Ray Jui,
	linux-kernel, bcm-kernel-feedback-list, Nicolas Saenz Julienne

Clean up the driver with the new managed buffer allocation API.
Also remove the unnecessary checks of channels in hw_params callback
as this is guaranteed by the hw constraints in anyway.
After these cleanups, the hw_params and hw_free callbacks became
empty, hence dropped.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/staging/most/sound/sound.c | 44 +-------------------------------------
 1 file changed, 1 insertion(+), 43 deletions(-)

diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c
index 723d0bd1cc21..7c212c0db980 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -322,45 +322,6 @@ static int pcm_close(struct snd_pcm_substream *substream)
 	return 0;
 }
 
-/**
- * pcm_hw_params - implements hw_params callback function for PCM middle layer
- * @substream: sub-stream pointer
- * @hw_params: contains the hardware parameters set by the application
- *
- * This is called when the hardware parameters is set by the application, that
- * is, once when the buffer size, the period size, the format, etc. are defined
- * for the PCM substream. Many hardware setups should be done is this callback,
- * including the allocation of buffers.
- *
- * Returns 0 on success or error code otherwise.
- */
-static int pcm_hw_params(struct snd_pcm_substream *substream,
-			 struct snd_pcm_hw_params *hw_params)
-{
-	struct channel *channel = substream->private_data;
-
-	if ((params_channels(hw_params) > channel->pcm_hardware.channels_max) ||
-	    (params_channels(hw_params) < channel->pcm_hardware.channels_min)) {
-		pr_err("Requested number of channels not supported.\n");
-		return -EINVAL;
-	}
-	return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
-}
-
-/**
- * pcm_hw_free - implements hw_free callback function for PCM middle layer
- * @substream: substream pointer
- *
- * This is called to release the resources allocated via hw_params.
- * This function will be always called before the close callback is called.
- *
- * Returns 0 on success or error code otherwise.
- */
-static int pcm_hw_free(struct snd_pcm_substream *substream)
-{
-	return snd_pcm_lib_free_pages(substream);
-}
-
 /**
  * pcm_prepare - implements prepare callback function for PCM middle layer
  * @substream: substream pointer
@@ -463,8 +424,6 @@ static const struct snd_pcm_ops pcm_ops = {
 	.open       = pcm_open,
 	.close      = pcm_close,
 	.ioctl      = snd_pcm_lib_ioctl,
-	.hw_params  = pcm_hw_params,
-	.hw_free    = pcm_hw_free,
 	.prepare    = pcm_prepare,
 	.trigger    = pcm_trigger,
 	.pointer    = pcm_pointer,
@@ -661,8 +620,7 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id,
 	pcm->private_data = channel;
 	strscpy(pcm->name, device_name, sizeof(pcm->name));
 	snd_pcm_set_ops(pcm, direction, &pcm_ops);
-	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
-					      NULL, 0, 0);
+	snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0);
 
 	return 0;
 
-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH for-5.6 2/4] staging: bcm2835-audio: Use managed buffer allocation
  2019-12-10 14:13 [alsa-devel] [PATCH for-5.6 0/4] staging: ALSA PCM API updates Takashi Iwai
  2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 1/4] staging: most: Use managed buffer allocation Takashi Iwai
@ 2019-12-10 14:13 ` Takashi Iwai
  2019-12-12 10:57   ` Nicolas Saenz Julienne
  2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 3/4] staging: most: Drop superfluous ioctl PCM ops Takashi Iwai
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Takashi Iwai @ 2019-12-10 14:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, alsa-devel, Florian Fainelli, Scott Branden, Ray Jui,
	linux-kernel, bcm-kernel-feedback-list, Nicolas Saenz Julienne

Clean up the driver with the new managed buffer allocation API.
The hw_params and hw_free callbacks became superfluous and dropped.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 .../staging/vc04_services/bcm2835-audio/bcm2835-pcm.c   | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
index 826016c3431a..97726b190bc5 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
@@ -193,17 +193,6 @@ static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream)
 	return 0;
 }
 
-static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream,
-	struct snd_pcm_hw_params *params)
-{
-	return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
-}
-
-static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream)
-{
-	return snd_pcm_lib_free_pages(substream);
-}
-
 static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream)
 {
 	struct bcm2835_chip *chip = snd_pcm_substream_chip(substream);
@@ -317,8 +306,6 @@ static const struct snd_pcm_ops snd_bcm2835_playback_ops = {
 	.open = snd_bcm2835_playback_open,
 	.close = snd_bcm2835_playback_close,
 	.ioctl = snd_pcm_lib_ioctl,
-	.hw_params = snd_bcm2835_pcm_hw_params,
-	.hw_free = snd_bcm2835_pcm_hw_free,
 	.prepare = snd_bcm2835_pcm_prepare,
 	.trigger = snd_bcm2835_pcm_trigger,
 	.pointer = snd_bcm2835_pcm_pointer,
@@ -329,8 +316,6 @@ static const struct snd_pcm_ops snd_bcm2835_playback_spdif_ops = {
 	.open = snd_bcm2835_playback_spdif_open,
 	.close = snd_bcm2835_playback_close,
 	.ioctl = snd_pcm_lib_ioctl,
-	.hw_params = snd_bcm2835_pcm_hw_params,
-	.hw_free = snd_bcm2835_pcm_hw_free,
 	.prepare = snd_bcm2835_pcm_prepare,
 	.trigger = snd_bcm2835_pcm_trigger,
 	.pointer = snd_bcm2835_pcm_pointer,
@@ -362,7 +347,7 @@ int snd_bcm2835_new_pcm(struct bcm2835_chip *chip, const char *name,
 			spdif ? &snd_bcm2835_playback_spdif_ops :
 			&snd_bcm2835_playback_ops);
 
-	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
+	snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
 		chip->card->dev, 128 * 1024, 128 * 1024);
 
 	if (spdif)
-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH for-5.6 3/4] staging: most: Drop superfluous ioctl PCM ops
  2019-12-10 14:13 [alsa-devel] [PATCH for-5.6 0/4] staging: ALSA PCM API updates Takashi Iwai
  2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 1/4] staging: most: Use managed buffer allocation Takashi Iwai
  2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 2/4] staging: bcm2835-audio: " Takashi Iwai
@ 2019-12-10 14:13 ` Takashi Iwai
  2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 4/4] staging: bcm2835-audio: " Takashi Iwai
  2019-12-10 14:42 ` [alsa-devel] [PATCH for-5.6 0/4] staging: ALSA PCM API updates Greg Kroah-Hartman
  4 siblings, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2019-12-10 14:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, alsa-devel, Florian Fainelli, Scott Branden, Ray Jui,
	linux-kernel, bcm-kernel-feedback-list, Nicolas Saenz Julienne

PCM core deals the empty ioctl field now as default.
Let's kill the redundant lines.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/staging/most/sound/sound.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c
index 7c212c0db980..1ccfcb8f78b9 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -423,7 +423,6 @@ static snd_pcm_uframes_t pcm_pointer(struct snd_pcm_substream *substream)
 static const struct snd_pcm_ops pcm_ops = {
 	.open       = pcm_open,
 	.close      = pcm_close,
-	.ioctl      = snd_pcm_lib_ioctl,
 	.prepare    = pcm_prepare,
 	.trigger    = pcm_trigger,
 	.pointer    = pcm_pointer,
-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH for-5.6 4/4] staging: bcm2835-audio: Drop superfluous ioctl PCM ops
  2019-12-10 14:13 [alsa-devel] [PATCH for-5.6 0/4] staging: ALSA PCM API updates Takashi Iwai
                   ` (2 preceding siblings ...)
  2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 3/4] staging: most: Drop superfluous ioctl PCM ops Takashi Iwai
@ 2019-12-10 14:13 ` Takashi Iwai
  2019-12-12 10:57   ` Nicolas Saenz Julienne
  2019-12-10 14:42 ` [alsa-devel] [PATCH for-5.6 0/4] staging: ALSA PCM API updates Greg Kroah-Hartman
  4 siblings, 1 reply; 8+ messages in thread
From: Takashi Iwai @ 2019-12-10 14:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, alsa-devel, Florian Fainelli, Scott Branden, Ray Jui,
	linux-kernel, bcm-kernel-feedback-list, Nicolas Saenz Julienne

PCM core deals the empty ioctl field now as default.
Let's kill the redundant lines.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
index 97726b190bc5..33485184a98a 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
@@ -305,7 +305,6 @@ snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream)
 static const struct snd_pcm_ops snd_bcm2835_playback_ops = {
 	.open = snd_bcm2835_playback_open,
 	.close = snd_bcm2835_playback_close,
-	.ioctl = snd_pcm_lib_ioctl,
 	.prepare = snd_bcm2835_pcm_prepare,
 	.trigger = snd_bcm2835_pcm_trigger,
 	.pointer = snd_bcm2835_pcm_pointer,
@@ -315,7 +314,6 @@ static const struct snd_pcm_ops snd_bcm2835_playback_ops = {
 static const struct snd_pcm_ops snd_bcm2835_playback_spdif_ops = {
 	.open = snd_bcm2835_playback_spdif_open,
 	.close = snd_bcm2835_playback_close,
-	.ioctl = snd_pcm_lib_ioctl,
 	.prepare = snd_bcm2835_pcm_prepare,
 	.trigger = snd_bcm2835_pcm_trigger,
 	.pointer = snd_bcm2835_pcm_pointer,
-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH for-5.6 0/4] staging: ALSA PCM API updates
  2019-12-10 14:13 [alsa-devel] [PATCH for-5.6 0/4] staging: ALSA PCM API updates Takashi Iwai
                   ` (3 preceding siblings ...)
  2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 4/4] staging: bcm2835-audio: " Takashi Iwai
@ 2019-12-10 14:42 ` Greg Kroah-Hartman
  4 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-10 14:42 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: devel, alsa-devel, Florian Fainelli, Scott Branden, Ray Jui,
	linux-kernel, bcm-kernel-feedback-list

On Tue, Dec 10, 2019 at 03:13:52PM +0100, Takashi Iwai wrote:
> Hi,
> 
> this is a patch set to adapt the latest ALSA PCM API to staging
> drivers.  Basically these are merely cleanups, as shown in diffstat,
> and there should be no functional changes.
> 
> As the corresponding ALSA PCM API change is found in 5.5-rc1, please
> apply these on 5.5-rc1 or later.  Or if you prefer, I can merge them
> through sound tree, too.  Let me know.

Because of some future most driver changes that will be happening
(hopefully soon), I'll just take all of these in the staging tree now,
thanks!

greg k-h
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH for-5.6 2/4] staging: bcm2835-audio: Use managed buffer allocation
  2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 2/4] staging: bcm2835-audio: " Takashi Iwai
@ 2019-12-12 10:57   ` Nicolas Saenz Julienne
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Saenz Julienne @ 2019-12-12 10:57 UTC (permalink / raw)
  To: Takashi Iwai, Greg Kroah-Hartman
  Cc: devel, alsa-devel, Florian Fainelli, Scott Branden, Ray Jui,
	linux-kernel, bcm-kernel-feedback-list


[-- Attachment #1.1: Type: text/plain, Size: 322 bytes --]

On Tue, 2019-12-10 at 15:13 +0100, Takashi Iwai wrote:
> Clean up the driver with the new managed buffer allocation API.
> The hw_params and hw_free callbacks became superfluous and dropped.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Thanks!


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH for-5.6 4/4] staging: bcm2835-audio: Drop superfluous ioctl PCM ops
  2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 4/4] staging: bcm2835-audio: " Takashi Iwai
@ 2019-12-12 10:57   ` Nicolas Saenz Julienne
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Saenz Julienne @ 2019-12-12 10:57 UTC (permalink / raw)
  To: Takashi Iwai, Greg Kroah-Hartman
  Cc: devel, alsa-devel, Florian Fainelli, Scott Branden, Ray Jui,
	linux-kernel, bcm-kernel-feedback-list


[-- Attachment #1.1: Type: text/plain, Size: 275 bytes --]

On Tue, 2019-12-10 at 15:13 +0100, Takashi Iwai wrote:
> PCM core deals the empty ioctl field now as default.
> Let's kill the redundant lines.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Thanks!


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

end of thread, other threads:[~2019-12-12 14:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10 14:13 [alsa-devel] [PATCH for-5.6 0/4] staging: ALSA PCM API updates Takashi Iwai
2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 1/4] staging: most: Use managed buffer allocation Takashi Iwai
2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 2/4] staging: bcm2835-audio: " Takashi Iwai
2019-12-12 10:57   ` Nicolas Saenz Julienne
2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 3/4] staging: most: Drop superfluous ioctl PCM ops Takashi Iwai
2019-12-10 14:13 ` [alsa-devel] [PATCH for-5.6 4/4] staging: bcm2835-audio: " Takashi Iwai
2019-12-12 10:57   ` Nicolas Saenz Julienne
2019-12-10 14:42 ` [alsa-devel] [PATCH for-5.6 0/4] staging: ALSA PCM API updates Greg Kroah-Hartman

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