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

Source at commit 9aeb2f976ff0ec5692b62af07a3297bea3ff58f9 created 7 years 4 months ago.
By Xiangfu, m1/patches/rtems: milkymist-audio-add-support-mic-boost.patch remove the mic boost ioctl
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-03-27 14:03:04.065264002 +0800
4+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c 2012-03-29 15:58:14.440242001 +0800
5@@ -316,6 +316,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@@ -328,12 +329,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@@ -341,21 +344,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@@ -365,6 +370,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