Date:2012-03-29 10:22:22 (7 years 3 months ago)
Author:Xiangfu
Commit:9aeb2f976ff0ec5692b62af07a3297bea3ff58f9
Message:m1/patches/rtems: milkymist-audio-add-support-mic-boost.patch remove the mic boost ioctl

Files: m1/patches/rtems/milkymist-audio-add-support-mic-boost.patch (4 diffs)

Change Details

m1/patches/rtems/milkymist-audio-add-support-mic-boost.patch
11Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
22===================================================================
33--- 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-27 19:24:29.329264002 +0800
5@@ -47,6 +47,7 @@
6 static int play_produce;
7 static int play_consume;
8 static int play_level;
9+static int mic_boost;
4@@ -316,6 +316,7 @@
5   unsigned int chan, int mono)
6 {
7   unsigned int *val = (unsigned int *)buf;
8+ int mic_boost;
9   int codec;
10   int left, right;
1011
11 /* buffers played, for application to collect */
12 static rtems_id play_q_done;
13@@ -347,7 +348,7 @@
12@@ -328,12 +329,14 @@
13     return RTEMS_SUCCESSFUL;
14   }
15   if (mono) {
16- right = left = 100-(((codec & 0x1f) + 1)*100)/32;
17+ left = 100-(((codec & 0x1f) + 1)*100)/32;
18+ mic_boost = (codec & (1 << 6)) >> 6;
19+ *val = left | mic_boost << 8;
20   } else {
21     right = 100-(((codec & 0x1f) + 1)*100)/32;
22     left = 100-((((codec & 0x1f00) >> 8) + 1)*100)/32;
23+ *val = left | (right << 8);
24   }
25- *val = left | (right << 8);
26   return RTEMS_SUCCESSFUL;
27 }
28
29@@ -341,21 +344,23 @@
30   unsigned int chan, int mono)
31 {
32   unsigned int *val = (unsigned int *)buf;
33+ int mic_boost;
34   int left, right;
35   int codec;
36   rtems_status_code sc;
1437
1538   left = *val & 0xff;
1639   left = (left*32)/100 - 1;
...... 
1842+ if (left < 0)
1943     left = 0;
2044
21   if (mono)
22@@ -355,7 +356,7 @@
23   else {
45- if (mono)
46+ if (mono) {
47+ mic_boost = *val >> 8;
48     right = 31;
49- else {
50+ } else {
2451     right = (*val >> 8) & 0xff;
2552     right = (right*32)/100 - 1;
2653- if(right < 0)
...... 
2855       right = 0;
2956   }
3057
31@@ -365,6 +366,13 @@
58@@ -365,6 +370,13 @@
3259   else
3360     codec = (31-left) | ((31-right) << 8);
3461
...... 
4269   if (!write_cr(chan, codec))
4370     sc = RTEMS_UNSATISFIED;
4471   else
45@@ -372,6 +380,41 @@
46   return sc;
47 }
48
49+static rtems_status_code ioctl_read_mic_boost(void *buf, unsigned int chan)
50+{
51+ unsigned int *val = (unsigned int *)buf;
52+ int codec;
53+
54+ codec = read_cr(chan);
55+ if (codec < 0)
56+ return RTEMS_UNSATISFIED;
57+
58+ *val = (codec & (1 << 6)) >> 6;
59+ return RTEMS_SUCCESSFUL;
60+}
61+
62+static rtems_status_code ioctl_write_mic_boost(void *buf, unsigned int chan)
63+{
64+ unsigned int *val = (unsigned int *)buf;
65+ int codec;
66+
67+ codec = read_cr(chan);
68+ if (codec < 0)
69+ return RTEMS_UNSATISFIED;
70+
71+ if (*val)
72+ codec |= (1 << 6);
73+ else
74+ codec &= ~(1 << 6);
75+
76+ if (!write_cr(chan, codec))
77+ return RTEMS_UNSATISFIED;
78+
79+ mic_boost = codec;
80+
81+ return RTEMS_SUCCESSFUL;
82+}
83+
84 rtems_device_driver ac97_control(
85   rtems_device_major_number major,
86   rtems_device_minor_number minor,
87@@ -419,6 +462,16 @@
88         if(sc == RTEMS_SUCCESSFUL)
89           args->ioctl_return = 0;
90         return sc;
91+ case SOUND_MIXER_READ(SOUND_MIXER_MIC_BOOST):
92+ sc = ioctl_read_mic_boost(args->buffer, 0x0e);
93+ if(sc == RTEMS_SUCCESSFUL)
94+ args->ioctl_return = 0;
95+ return sc;
96+ case SOUND_MIXER_WRITE(SOUND_MIXER_MIC_BOOST):
97+ sc = ioctl_write_mic_boost(args->buffer, 0x0e);
98+ if(sc == RTEMS_SUCCESSFUL)
99+ args->ioctl_return = 0;
100+ return sc;
101       default:
102         return RTEMS_UNSATISFIED;
103     }
104Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/milkymist_ac97.h
105===================================================================
106+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_ac97/milkymist_ac97.h 2012-03-27 14:03:21.753264002 +0800
107@@ -21,6 +21,7 @@
108 /* Ioctls. 0x41 is 'A' */
109 #define SOUND_MIXER_MIC 0x0
110 #define SOUND_MIXER_LINE 0x1
111+#define SOUND_MIXER_MIC_BOOST 0x2
112 #define SOUND_MIXER_READ(x) (0x4100+x)
113 #define SOUND_MIXER_WRITE(x) (0x4110+x)
114

Archive Download the corresponding diff file

Branches:
master



interactive