aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-4.19/950-0398-staging-bcm2835-audio-Simplify-PCM-creation-helpers.patch
diff options
context:
space:
mode:
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-02-08 21:58:55 +0100
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-02-14 14:10:51 +0100
commit7d7aa2fd924c27829ec25f825481554dd81bce97 (patch)
tree658b87b89331670266163e522ea5fb52535633cb /target/linux/bcm27xx/patches-4.19/950-0398-staging-bcm2835-audio-Simplify-PCM-creation-helpers.patch
parente7bfda2c243e66a75ff966ba04c28b1590b5d24c (diff)
downloadupstream-7d7aa2fd924c27829ec25f825481554dd81bce97.tar.gz
upstream-7d7aa2fd924c27829ec25f825481554dd81bce97.tar.bz2
upstream-7d7aa2fd924c27829ec25f825481554dd81bce97.zip
brcm2708: rename target to bcm27xx
This change makes the names of Broadcom targets consistent by using the common notation based on SoC/CPU ID (which is used internally anyway), bcmXXXX instead of brcmXXXX. This is even used for target TITLE in make menuconfig already, only the short target name used brcm so far. Despite, since subtargets range from bcm2708 to bcm2711, it seems appropriate to use bcm27xx instead of bcm2708 (again, as already done for BOARDNAME). This also renames the packages brcm2708-userland and brcm2708-gpu-fw. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-4.19/950-0398-staging-bcm2835-audio-Simplify-PCM-creation-helpers.patch')
-rw-r--r--target/linux/bcm27xx/patches-4.19/950-0398-staging-bcm2835-audio-Simplify-PCM-creation-helpers.patch196
1 files changed, 196 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-4.19/950-0398-staging-bcm2835-audio-Simplify-PCM-creation-helpers.patch b/target/linux/bcm27xx/patches-4.19/950-0398-staging-bcm2835-audio-Simplify-PCM-creation-helpers.patch
new file mode 100644
index 0000000000..6ead1b4ccf
--- /dev/null
+++ b/target/linux/bcm27xx/patches-4.19/950-0398-staging-bcm2835-audio-Simplify-PCM-creation-helpers.patch
@@ -0,0 +1,196 @@
+From 706f9b2b95a2fff44f92deada99545036c249658 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 4 Sep 2018 17:58:56 +0200
+Subject: [PATCH] staging: bcm2835-audio: Simplify PCM creation helpers
+
+commit 74470ffeb9aed5548654cfca881bf1d7469fe9c4 upstream.
+
+All three functions to create PCM objects are fairly resemble, and can
+be unified to a single common helper.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ .../vc04_services/bcm2835-audio/bcm2835-pcm.c | 87 ++++---------------
+ .../vc04_services/bcm2835-audio/bcm2835.c | 17 +++-
+ .../vc04_services/bcm2835-audio/bcm2835.h | 9 +-
+ 3 files changed, 32 insertions(+), 81 deletions(-)
+
+--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
++++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
+@@ -324,91 +324,36 @@ static const struct snd_pcm_ops snd_bcm2
+ };
+
+ /* create a pcm device */
+-int snd_bcm2835_new_pcm(struct bcm2835_chip *chip, u32 numchannels)
++int snd_bcm2835_new_pcm(struct bcm2835_chip *chip, const char *name,
++ int idx, enum snd_bcm2835_route route,
++ u32 numchannels, bool spdif)
+ {
+ struct snd_pcm *pcm;
+ int err;
+
+- err = snd_pcm_new(chip->card, "bcm2835 ALSA", 0, numchannels, 0, &pcm);
+- if (err < 0)
+- return err;
+- pcm->private_data = chip;
+- pcm->nonatomic = true;
+- strcpy(pcm->name, "bcm2835 ALSA");
+- chip->pcm = pcm;
+- chip->dest = AUDIO_DEST_AUTO;
+- chip->volume = 0;
+- chip->mute = CTRL_VOL_UNMUTE; /*disable mute on startup */
+- /* set operators */
+- snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
+- &snd_bcm2835_playback_ops);
+-
+- /* pre-allocation of buffers */
+- /* NOTE: this may fail */
+- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
+- chip->card->dev->parent,
+- snd_bcm2835_playback_hw.buffer_bytes_max,
+- snd_bcm2835_playback_hw.buffer_bytes_max);
+-
+- return 0;
+-}
+-
+-int snd_bcm2835_new_spdif_pcm(struct bcm2835_chip *chip)
+-{
+- struct snd_pcm *pcm;
+- int err;
+-
+- err = snd_pcm_new(chip->card, "bcm2835 ALSA", 1, 1, 0, &pcm);
+- if (err < 0)
+- return err;
+-
+- pcm->private_data = chip;
+- pcm->nonatomic = true;
+- strcpy(pcm->name, "bcm2835 IEC958/HDMI");
+- chip->pcm_spdif = pcm;
+- snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
+- &snd_bcm2835_playback_spdif_ops);
+-
+- /* pre-allocation of buffers */
+- /* NOTE: this may fail */
+- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
+- chip->card->dev->parent,
+- snd_bcm2835_playback_spdif_hw.buffer_bytes_max, snd_bcm2835_playback_spdif_hw.buffer_bytes_max);
+-
+- return 0;
+-}
+-
+-int snd_bcm2835_new_simple_pcm(struct bcm2835_chip *chip,
+- const char *name,
+- enum snd_bcm2835_route route,
+- u32 numchannels)
+-{
+- struct snd_pcm *pcm;
+- int err;
+-
+- err = snd_pcm_new(chip->card, name, 0, numchannels,
+- 0, &pcm);
++ err = snd_pcm_new(chip->card, name, idx, numchannels, 0, &pcm);
+ if (err)
+ return err;
+
+ pcm->private_data = chip;
+ pcm->nonatomic = true;
+ strcpy(pcm->name, name);
+- chip->pcm = pcm;
+- chip->dest = route;
+- chip->volume = 0;
+- chip->mute = CTRL_VOL_UNMUTE;
++ if (!spdif) {
++ chip->dest = route;
++ chip->volume = 0;
++ chip->mute = CTRL_VOL_UNMUTE;
++ }
+
+ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
++ spdif ? &snd_bcm2835_playback_spdif_ops :
+ &snd_bcm2835_playback_ops);
+
+- snd_pcm_lib_preallocate_pages_for_all(
+- pcm,
+- SNDRV_DMA_TYPE_DEV,
+- chip->card->dev->parent,
+- snd_bcm2835_playback_hw.buffer_bytes_max,
+- snd_bcm2835_playback_hw.buffer_bytes_max);
++ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
++ chip->card->dev->parent, 128 * 1024, 128 * 1024);
+
++ if (spdif)
++ chip->pcm_spdif = pcm;
++ else
++ chip->pcm = pcm;
+ return 0;
+ }
+-
+--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
++++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
+@@ -138,17 +138,26 @@ static int bcm2835_audio_alsa_newpcm(str
+ {
+ int err;
+
+- err = snd_bcm2835_new_pcm(chip, numchannels - 1);
++ err = snd_bcm2835_new_pcm(chip, "bcm2835 ALSA", 0, AUDIO_DEST_AUTO,
++ numchannels - 1, false);
+ if (err)
+ return err;
+
+- err = snd_bcm2835_new_spdif_pcm(chip);
++ err = snd_bcm2835_new_pcm(chip, "bcm2835 IEC958/HDMI", 1, 0, 1, true);
+ if (err)
+ return err;
+
+ return 0;
+ }
+
++static int bcm2835_audio_simple_newpcm(struct bcm2835_chip *chip,
++ const char *name,
++ enum snd_bcm2835_route route,
++ u32 numchannels)
++{
++ return snd_bcm2835_new_pcm(chip, name, 0, route, numchannels, false);
++}
++
+ static struct bcm2835_audio_driver bcm2835_audio_alsa = {
+ .driver = {
+ .name = "bcm2835_alsa",
+@@ -169,7 +178,7 @@ static struct bcm2835_audio_driver bcm28
+ .shortname = "bcm2835 HDMI",
+ .longname = "bcm2835 HDMI",
+ .minchannels = 1,
+- .newpcm = snd_bcm2835_new_simple_pcm,
++ .newpcm = bcm2835_audio_simple_newpcm,
+ .newctl = snd_bcm2835_new_hdmi_ctl,
+ .route = AUDIO_DEST_HDMI
+ };
+@@ -182,7 +191,7 @@ static struct bcm2835_audio_driver bcm28
+ .shortname = "bcm2835 Headphones",
+ .longname = "bcm2835 Headphones",
+ .minchannels = 1,
+- .newpcm = snd_bcm2835_new_simple_pcm,
++ .newpcm = bcm2835_audio_simple_newpcm,
+ .newctl = snd_bcm2835_new_headphones_ctl,
+ .route = AUDIO_DEST_HEADPHONES
+ };
+--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
++++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
+@@ -84,12 +84,9 @@ struct bcm2835_alsa_stream {
+ };
+
+ int snd_bcm2835_new_ctl(struct bcm2835_chip *chip);
+-int snd_bcm2835_new_pcm(struct bcm2835_chip *chip, u32 numchannels);
+-int snd_bcm2835_new_spdif_pcm(struct bcm2835_chip *chip);
+-int snd_bcm2835_new_simple_pcm(struct bcm2835_chip *chip,
+- const char *name,
+- enum snd_bcm2835_route route,
+- u32 numchannels);
++int snd_bcm2835_new_pcm(struct bcm2835_chip *chip, const char *name,
++ int idx, enum snd_bcm2835_route route,
++ u32 numchannels, bool spdif);
+
+ int snd_bcm2835_new_hdmi_ctl(struct bcm2835_chip *chip);
+ int snd_bcm2835_new_headphones_ctl(struct bcm2835_chip *chip);