linux: add some RPi fixes

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2012-06-22 20:55:27 +02:00
parent b867b16181
commit 1ca93cf38a
5 changed files with 219 additions and 0 deletions

View File

@ -0,0 +1,63 @@
From d0735c7d129d35bd91ba1c2c5b5a5201ed4a6c37 Mon Sep 17 00:00:00 2001
From: Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
Date: Wed, 6 Jun 2012 08:02:10 +0200
Subject: [PATCH] bcm2835-ctl: fix alsamixer control.
alsamixer read the volume for the screen controller so we had to
scale the chipvol back to db for reading.
---
sound/arm/bcm2835-ctl.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c
index c0546e35..828a820 100755
--- a/sound/arm/bcm2835-ctl.c
+++ b/sound/arm/bcm2835-ctl.c
@@ -33,6 +33,19 @@
#include "bcm2835.h"
+
+/* functions to convert alsa to chip volume and back. */
+int alsa2chip(int vol)
+{
+ return -((vol << 8) / 100);
+}
+
+int chip2alsa(int vol)
+{
+ return -((vol * 100) >> 8);
+}
+
+
static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
@@ -64,7 +77,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol,
BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
if (kcontrol->private_value == PCM_PLAYBACK_VOLUME)
- ucontrol->value.integer.value[0] = chip->volume;
+ ucontrol->value.integer.value[0] = chip2alsa(chip->volume);
else if (kcontrol->private_value == PCM_PLAYBACK_MUTE)
ucontrol->value.integer.value[0] = chip->mute;
else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE)
@@ -85,13 +98,10 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,
changed = 1;
}
if (changed
- || (ucontrol->value.integer.value[0] != chip->volume)) {
- int atten;
+ || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) {
- chip->volume = ucontrol->value.integer.value[0];
+ chip->volume = alsa2chip(ucontrol->value.integer.value[0]);
changed = 1;
- atten = -((chip->volume << 8) / 100);
- chip->volume = atten;
}
} else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) {
--
1.7.10

View File

@ -0,0 +1,26 @@
From 829da61c0229c0734a109339f5de308bf8205bf6 Mon Sep 17 00:00:00 2001
From: Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
Date: Wed, 6 Jun 2012 08:06:15 +0200
Subject: [PATCH] bcm2835-ctl: limit maximal volume to 4db.
it makes no sense to set 23.04db as maximum volume since around 3db it start to cliping. So with 4db the alsamixer is much better to control. (86% is 0db)
---
sound/arm/bcm2835-ctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c
index 828a820..f901ddd 100755
--- a/sound/arm/bcm2835-ctl.c
+++ b/sound/arm/bcm2835-ctl.c
@@ -53,7 +53,7 @@ static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol,
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1;
uinfo->value.integer.min = -10240;
- uinfo->value.integer.max = 2303;
+ uinfo->value.integer.max = 400; /* 2303 */
} else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) {
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1;
--
1.7.10

View File

@ -0,0 +1,26 @@
From 3fc65f9f291fb19cad434968a4a0f66ab749e637 Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Sun, 17 Jun 2012 00:14:54 +0100
Subject: [PATCH] Explicitly set usb host channels to 8, as in the spec
---
drivers/usb/host/dwc_otg/dwc_otg_core_if.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_core_if.h b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h
index 4a78b03..25aae5e 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_core_if.h
+++ b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h
@@ -267,7 +267,8 @@ extern int dwc_otg_set_param_max_packet_count(dwc_otg_core_if_t * core_if,
extern int dwc_otg_set_param_host_channels(dwc_otg_core_if_t * core_if,
int32_t val);
extern int32_t dwc_otg_get_param_host_channels(dwc_otg_core_if_t * core_if);
-#define dwc_param_host_channels_default 12
+//#define dwc_param_host_channels_default 12
+#define dwc_param_host_channels_default 8// Broadcom BCM2708
/** The number of endpoints in addition to EP0 available for device
* mode operations.
--
1.7.10

View File

@ -0,0 +1,77 @@
From d2743760a691469cebfa3bc23cedb62c38388380 Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Thu, 21 Jun 2012 01:31:08 +0100
Subject: [PATCH] Remove silence method, and use atomic flags for kmalloc
---
sound/arm/bcm2835-pcm.c | 24 ------------------------
sound/arm/bcm2835-vchiq.c | 4 ++--
2 files changed, 2 insertions(+), 26 deletions(-)
diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c
index 40a9fb5..ff3eb4e 100755
--- a/sound/arm/bcm2835-pcm.c
+++ b/sound/arm/bcm2835-pcm.c
@@ -345,29 +345,6 @@ static int snd_bcm2835_pcm_copy(struct snd_pcm_substream *substream,
return ret;
}
-static int snd_bcm2835_pcm_silence(struct snd_pcm_substream *substream,
- int channel, snd_pcm_uframes_t post,
- snd_pcm_uframes_t count)
-{
- int ret;
- struct snd_pcm_runtime *runtime = substream->runtime;
- bcm2835_alsa_stream_t *alsa_stream = runtime->private_data;
-
- audio_info(" .. IN\n");
- audio_debug("silence....... (%d) hwptr=%d appl=%d pos=%d\n",
- frames_to_bytes(runtime, count), frames_to_bytes(runtime,
- runtime->
- status->
- hw_ptr),
- frames_to_bytes(runtime, runtime->control->appl_ptr),
- alsa_stream->pos);
- ret =
- bcm2835_audio_write(alsa_stream, frames_to_bytes(runtime, count),
- NULL);
- audio_info(" .. OUT\n");
- return ret;
-}
-
static int snd_bcm2835_pcm_lib_ioctl(struct snd_pcm_substream *substream,
unsigned int cmd, void *arg)
{
@@ -388,7 +365,6 @@ static int snd_bcm2835_pcm_lib_ioctl(struct snd_pcm_substream *substream,
.trigger = snd_bcm2835_pcm_trigger,
.pointer = snd_bcm2835_pcm_pointer,
.copy = snd_bcm2835_pcm_copy,
- .silence = snd_bcm2835_pcm_silence,
};
/* create a pcm device */
diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c
index 820063a..23c0aa3 100755
--- a/sound/arm/bcm2835-vchiq.c
+++ b/sound/arm/bcm2835-vchiq.c
@@ -102,7 +102,7 @@ int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream)
int ret = -1;
LOG_DBG(" .. IN\n");
if (alsa_stream->my_wq) {
- my_work_t *work = kmalloc(sizeof(my_work_t), GFP_KERNEL);
+ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC);
/* Queue some work (item 1) */
if (work) {
INIT_WORK((struct work_struct *)work, my_wq_function);
@@ -123,7 +123,7 @@ int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream)
int ret = -1;
LOG_DBG(" .. IN\n");
if (alsa_stream->my_wq) {
- my_work_t *work = kmalloc(sizeof(my_work_t), GFP_KERNEL);
+ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC);
/* Queue some work (item 1) */
if (work) {
INIT_WORK((struct work_struct *)work, my_wq_function);
--
1.7.10

View File

@ -0,0 +1,27 @@
From 4cf265f1432ae31c8c2ceb95c6a41321c3ee2604 Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Fri, 22 Jun 2012 12:55:39 +0100
Subject: [PATCH] Fix unintended line swap that cause cause memory leak in USB
driver
---
drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
index 2a3b689..970b065 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
@@ -764,8 +764,8 @@ static int urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
if(urb->hcpriv != NULL) {
dwc_otg_hcd_urb_dequeue(dwc_otg_hcd, (dwc_otg_hcd_urb_t *)urb->hcpriv);
- urb->hcpriv = NULL;
dwc_free(urb->hcpriv);
+ urb->hcpriv = NULL;
}
/* Higher layer software sets URB status. */
--
1.7.10