mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-12-19 15:34:59 +02:00
72 lines
1.7 KiB
Diff
72 lines
1.7 KiB
Diff
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/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c 2012-03-29 15:58:14.440242001 +0800
|
|
@@ -316,6 +316,7 @@
|
|
unsigned int chan, int mono)
|
|
{
|
|
unsigned int *val = (unsigned int *)buf;
|
|
+ int mic_boost;
|
|
int codec;
|
|
int left, right;
|
|
|
|
@@ -328,12 +329,14 @@
|
|
return RTEMS_SUCCESSFUL;
|
|
}
|
|
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 = (left*32)/100 - 1;
|
|
- if(left < 0)
|
|
+ if (left < 0)
|
|
left = 0;
|
|
|
|
- if (mono)
|
|
+ if (mono) {
|
|
+ mic_boost = *val >> 8;
|
|
right = 31;
|
|
- else {
|
|
+ } else {
|
|
right = (*val >> 8) & 0xff;
|
|
right = (right*32)/100 - 1;
|
|
- if(right < 0)
|
|
+ if (right < 0)
|
|
right = 0;
|
|
}
|
|
|
|
@@ -365,6 +370,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
|