Root/m1/patches/rtems/milkymist-audio-add-support-mic-boost.patch

1Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
2===================================================================
3--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c 2012-05-14 12:34:47.143554000 +0800
4+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c 2012-05-14 12:35:23.753240001 +0800
5@@ -314,6 +314,7 @@
6   unsigned int chan, int mono)
7 {
8   unsigned int *val = (unsigned int *)buf;
9+ int mic_boost;
10   int codec;
11   int left, right;
12 
13@@ -326,12 +327,14 @@
14     return RTEMS_SUCCESSFUL;
15   }
16   if (mono) {
17- right = left = 100-(((codec & 0x1f) + 1)*100)/32;
18+ left = 100-(((codec & 0x1f) + 1)*100)/32;
19+ mic_boost = (codec & (1 << 6)) >> 6;
20+ *val = left | mic_boost << 8;
21   } else {
22     right = 100-(((codec & 0x1f) + 1)*100)/32;
23     left = 100-((((codec & 0x1f00) >> 8) + 1)*100)/32;
24+ *val = left | (right << 8);
25   }
26- *val = left | (right << 8);
27   return RTEMS_SUCCESSFUL;
28 }
29 
30@@ -339,21 +342,23 @@
31   unsigned int chan, int mono)
32 {
33   unsigned int *val = (unsigned int *)buf;
34+ int mic_boost;
35   int left, right;
36   int codec;
37   rtems_status_code sc;
38 
39   left = *val & 0xff;
40   left = (left*32)/100 - 1;
41- if(left < 0)
42+ if (left < 0)
43     left = 0;
44 
45- if (mono)
46+ if (mono) {
47+ mic_boost = *val >> 8;
48     right = 31;
49- else {
50+ } else {
51     right = (*val >> 8) & 0xff;
52     right = (right*32)/100 - 1;
53- if(right < 0)
54+ if (right < 0)
55       right = 0;
56   }
57 
58@@ -363,6 +368,13 @@
59   else
60     codec = (31-left) | ((31-right) << 8);
61 
62+ if (mono) {
63+ if (mic_boost)
64+ codec |= (1 << 6);
65+ else
66+ codec &= ~(1 << 6);
67+ }
68+
69   if (!write_cr(chan, codec))
70     sc = RTEMS_UNSATISFIED;
71   else
72

Archive Download this file

Branches:
master



interactive