1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 05:46:15 +02:00

m1/patches/rtems: milkymist-audio-add-support-mic-boost.patch preserve the mic boost setting

This commit is contained in:
Xiangfu 2012-03-28 11:23:53 +08:00
parent af07d13f2b
commit 56adfdeb4d

View File

@ -1,8 +1,48 @@
Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
===================================================================
--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c 2012-03-20 17:11:20.087160002 +0800
+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c 2012-03-20 17:12:23.731160001 +0800
@@ -372,6 +372,39 @@
--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c 2012-03-27 14:03:04.065264002 +0800
+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c 2012-03-27 19:24:29.329264002 +0800
@@ -47,6 +47,7 @@
static int play_produce;
static int play_consume;
static int play_level;
+static int mic_boost;
/* buffers played, for application to collect */
static rtems_id play_q_done;
@@ -347,7 +348,7 @@
left = *val & 0xff;
left = (left*32)/100 - 1;
- if(left < 0)
+ if (left < 0)
left = 0;
if (mono)
@@ -355,7 +356,7 @@
else {
right = (*val >> 8) & 0xff;
right = (right*32)/100 - 1;
- if(right < 0)
+ if (right < 0)
right = 0;
}
@@ -365,6 +366,13 @@
else
codec = (31-left) | ((31-right) << 8);
+ if (mono) {
+ if (mic_boost)
+ codec |= (1 << 6);
+ else
+ codec &= ~(1 << 6);
+ }
+
if (!write_cr(chan, codec))
sc = RTEMS_UNSATISFIED;
else
@@ -372,6 +380,41 @@
return sc;
}
@ -36,13 +76,15 @@ Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
+ if (!write_cr(chan, codec))
+ return RTEMS_UNSATISFIED;
+
+ mic_boost = codec;
+
+ return RTEMS_SUCCESSFUL;
+}
+
rtems_device_driver ac97_control(
rtems_device_major_number major,
rtems_device_minor_number minor,
@@ -419,6 +452,16 @@
@@ -419,6 +462,16 @@
if(sc == RTEMS_SUCCESSFUL)
args->ioctl_return = 0;
return sc;
@ -61,8 +103,8 @@ Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
}
Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/milkymist_ac97.h
===================================================================
--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_ac97/milkymist_ac97.h 2012-03-20 17:11:23.791160002 +0800
+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/milkymist_ac97.h 2012-03-20 17:12:23.731160001 +0800
--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_ac97/milkymist_ac97.h 2012-03-27 14:03:04.085264002 +0800
+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/milkymist_ac97.h 2012-03-27 14:03:21.753264002 +0800
@@ -21,6 +21,7 @@
/* Ioctls. 0x41 is 'A' */
#define SOUND_MIXER_MIC 0x0