summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/fiiolinux_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/audio/fiiolinux_codec.c')
-rw-r--r--firmware/drivers/audio/fiiolinux_codec.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/firmware/drivers/audio/fiiolinux_codec.c b/firmware/drivers/audio/fiiolinux_codec.c
index 31731fd6ed..99cff3f5e4 100644
--- a/firmware/drivers/audio/fiiolinux_codec.c
+++ b/firmware/drivers/audio/fiiolinux_codec.c
@@ -32,7 +32,6 @@
32#include "pcm-alsa.h" 32#include "pcm-alsa.h"
33#include <sys/ioctl.h> 33#include <sys/ioctl.h>
34 34
35static int fd_hw = -1;
36static int ak_hw = -1; 35static int ak_hw = -1;
37 36
38static int vol_sw[2] = {0}; 37static int vol_sw[2] = {0};
@@ -40,10 +39,6 @@ static long int vol_hw[2] = {0};
40 39
41static void hw_open(void) 40static void hw_open(void)
42{ 41{
43 fd_hw = open("/dev/snd/controlC0", O_RDWR);
44 if(fd_hw < 0)
45 panicf("Cannot open '/dev/snd/controlC0'");
46
47 ak_hw = open("/dev/ak4376", O_RDWR); 42 ak_hw = open("/dev/ak4376", O_RDWR);
48 if(ak_hw < 0) 43 if(ak_hw < 0)
49 panicf("Cannot open '/dev/ak4376'"); 44 panicf("Cannot open '/dev/ak4376'");
@@ -61,8 +56,7 @@ static void hw_close(void)
61 panicf("Call cmd AK4376_POWER_OFF fail"); 56 panicf("Call cmd AK4376_POWER_OFF fail");
62 } 57 }
63 close(ak_hw); 58 close(ak_hw);
64 close(fd_hw); 59 ak_hw = -1;
65 ak_hw = fd_hw = -1;
66} 60}
67 61
68void audiohw_preinit(void) 62void audiohw_preinit(void)
@@ -98,7 +92,7 @@ void audiohw_set_volume(int vol_l, int vol_r)
98{ 92{
99 int vol[2]; 93 int vol[2];
100 94
101 if (fd_hw < 0) 95 if (ak_hw < 0)
102 return; 96 return;
103 97
104 vol[0] = vol_l / 20; 98 vol[0] = vol_l / 20;
@@ -138,7 +132,7 @@ void audiohw_mute(int mute)
138{ 132{
139 long int vol0 = 0; 133 long int vol0 = 0;
140 134
141 if (fd_hw < 0 || muted == mute) 135 if (ak_hw < 0 || muted == mute)
142 return; 136 return;
143 137
144 muted = mute; 138 muted = mute;
@@ -159,14 +153,14 @@ void audiohw_mute(int mute)
159 153
160void audiohw_set_filter_roll_off(int value) 154void audiohw_set_filter_roll_off(int value)
161{ 155{
162 if (fd_hw < 0) 156#if 0 // defined(FIIO_M3K_LINUX)
157 if (ak_hw < 0)
163 return; 158 return;
164 159
165 /* 0 = Sharp; 160 /* 0 = Sharp;
166 1 = Slow; 161 1 = Slow;
167 2 = Short Sharp 162 2 = Short Sharp
168 3 = Short Slow */ 163 3 = Short Slow */
169#if 0 // defined(FIIO_M3K_LINUX)
170 // AK4376 supports this but the control isn't wired into ALSA! 164 // AK4376 supports this but the control isn't wired into ALSA!
171 long int value_hw = value; 165 long int value_hw = value;
172 alsa_controls_set_ints("AK4376 Digital Filter", 1, &value_hw); 166 alsa_controls_set_ints("AK4376 Digital Filter", 1, &value_hw);