mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-15 08:19:41 +02:00
m1/patches/rtems: milkymist-audio-add-support-mic-boost.patch remove the mic boost ioctl
This commit is contained in:
parent
56adfdeb4d
commit
9aeb2f976f
@ -1,16 +1,40 @@
|
|||||||
Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
|
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-27 14:03:04.065264002 +0800
|
--- 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
|
+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c 2012-03-29 15:58:14.440242001 +0800
|
||||||
@@ -47,6 +47,7 @@
|
@@ -316,6 +316,7 @@
|
||||||
static int play_produce;
|
unsigned int chan, int mono)
|
||||||
static int play_consume;
|
{
|
||||||
static int play_level;
|
unsigned int *val = (unsigned int *)buf;
|
||||||
+static int mic_boost;
|
+ int mic_boost;
|
||||||
|
int codec;
|
||||||
|
int left, right;
|
||||||
|
|
||||||
/* buffers played, for application to collect */
|
@@ -328,12 +329,14 @@
|
||||||
static rtems_id play_q_done;
|
return RTEMS_SUCCESSFUL;
|
||||||
@@ -347,7 +348,7 @@
|
}
|
||||||
|
if (mono) {
|
||||||
|
- right = left = 100-(((codec & 0x1f) + 1)*100)/32;
|
||||||
|
+ left = 100-(((codec & 0x1f) + 1)*100)/32;
|
||||||
|
+ mic_boost = (codec & (1 << 6)) >> 6;
|
||||||
|
+ *val = left | mic_boost << 8;
|
||||||
|
} else {
|
||||||
|
right = 100-(((codec & 0x1f) + 1)*100)/32;
|
||||||
|
left = 100-((((codec & 0x1f00) >> 8) + 1)*100)/32;
|
||||||
|
+ *val = left | (right << 8);
|
||||||
|
}
|
||||||
|
- *val = left | (right << 8);
|
||||||
|
return RTEMS_SUCCESSFUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -341,21 +344,23 @@
|
||||||
|
unsigned int chan, int mono)
|
||||||
|
{
|
||||||
|
unsigned int *val = (unsigned int *)buf;
|
||||||
|
+ int mic_boost;
|
||||||
|
int left, right;
|
||||||
|
int codec;
|
||||||
|
rtems_status_code sc;
|
||||||
|
|
||||||
left = *val & 0xff;
|
left = *val & 0xff;
|
||||||
left = (left*32)/100 - 1;
|
left = (left*32)/100 - 1;
|
||||||
@ -18,9 +42,12 @@ Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
|
|||||||
+ if (left < 0)
|
+ if (left < 0)
|
||||||
left = 0;
|
left = 0;
|
||||||
|
|
||||||
if (mono)
|
- if (mono)
|
||||||
@@ -355,7 +356,7 @@
|
+ if (mono) {
|
||||||
else {
|
+ mic_boost = *val >> 8;
|
||||||
|
right = 31;
|
||||||
|
- else {
|
||||||
|
+ } else {
|
||||||
right = (*val >> 8) & 0xff;
|
right = (*val >> 8) & 0xff;
|
||||||
right = (right*32)/100 - 1;
|
right = (right*32)/100 - 1;
|
||||||
- if(right < 0)
|
- if(right < 0)
|
||||||
@ -28,7 +55,7 @@ Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
|
|||||||
right = 0;
|
right = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,6 +366,13 @@
|
@@ -365,6 +370,13 @@
|
||||||
else
|
else
|
||||||
codec = (31-left) | ((31-right) << 8);
|
codec = (31-left) | ((31-right) << 8);
|
||||||
|
|
||||||
@ -42,74 +69,3 @@ Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
|
|||||||
if (!write_cr(chan, codec))
|
if (!write_cr(chan, codec))
|
||||||
sc = RTEMS_UNSATISFIED;
|
sc = RTEMS_UNSATISFIED;
|
||||||
else
|
else
|
||||||
@@ -372,6 +380,41 @@
|
|
||||||
return sc;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static rtems_status_code ioctl_read_mic_boost(void *buf, unsigned int chan)
|
|
||||||
+{
|
|
||||||
+ unsigned int *val = (unsigned int *)buf;
|
|
||||||
+ int codec;
|
|
||||||
+
|
|
||||||
+ codec = read_cr(chan);
|
|
||||||
+ if (codec < 0)
|
|
||||||
+ return RTEMS_UNSATISFIED;
|
|
||||||
+
|
|
||||||
+ *val = (codec & (1 << 6)) >> 6;
|
|
||||||
+ return RTEMS_SUCCESSFUL;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static rtems_status_code ioctl_write_mic_boost(void *buf, unsigned int chan)
|
|
||||||
+{
|
|
||||||
+ unsigned int *val = (unsigned int *)buf;
|
|
||||||
+ int codec;
|
|
||||||
+
|
|
||||||
+ codec = read_cr(chan);
|
|
||||||
+ if (codec < 0)
|
|
||||||
+ return RTEMS_UNSATISFIED;
|
|
||||||
+
|
|
||||||
+ if (*val)
|
|
||||||
+ codec |= (1 << 6);
|
|
||||||
+ else
|
|
||||||
+ codec &= ~(1 << 6);
|
|
||||||
+
|
|
||||||
+ 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 +462,16 @@
|
|
||||||
if(sc == RTEMS_SUCCESSFUL)
|
|
||||||
args->ioctl_return = 0;
|
|
||||||
return sc;
|
|
||||||
+ case SOUND_MIXER_READ(SOUND_MIXER_MIC_BOOST):
|
|
||||||
+ sc = ioctl_read_mic_boost(args->buffer, 0x0e);
|
|
||||||
+ if(sc == RTEMS_SUCCESSFUL)
|
|
||||||
+ args->ioctl_return = 0;
|
|
||||||
+ return sc;
|
|
||||||
+ case SOUND_MIXER_WRITE(SOUND_MIXER_MIC_BOOST):
|
|
||||||
+ sc = ioctl_write_mic_boost(args->buffer, 0x0e);
|
|
||||||
+ if(sc == RTEMS_SUCCESSFUL)
|
|
||||||
+ args->ioctl_return = 0;
|
|
||||||
+ return sc;
|
|
||||||
default:
|
|
||||||
return RTEMS_UNSATISFIED;
|
|
||||||
}
|
|
||||||
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-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
|
|
||||||
#define SOUND_MIXER_LINE 0x1
|
|
||||||
+#define SOUND_MIXER_MIC_BOOST 0x2
|
|
||||||
#define SOUND_MIXER_READ(x) (0x4100+x)
|
|
||||||
#define SOUND_MIXER_WRITE(x) (0x4110+x)
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user