summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/audio/erosqlinux_codec.c13
-rw-r--r--firmware/drivers/audio/rocker_codec.c12
-rw-r--r--firmware/drivers/audio/xduoolinux_codec.c13
3 files changed, 23 insertions, 15 deletions
diff --git a/firmware/drivers/audio/erosqlinux_codec.c b/firmware/drivers/audio/erosqlinux_codec.c
index 9336083d58..d56e32c6ff 100644
--- a/firmware/drivers/audio/erosqlinux_codec.c
+++ b/firmware/drivers/audio/erosqlinux_codec.c
@@ -42,7 +42,7 @@ static int inited = 0;
42 42
43static long int vol_l_hw = 255; 43static long int vol_l_hw = 255;
44static long int vol_r_hw = 255; 44static long int vol_r_hw = 255;
45static long int last_ps = 0; 45static long int last_ps = -1;
46 46
47static void hw_open(void) 47static void hw_open(void)
48{ 48{
@@ -62,6 +62,11 @@ void audiohw_mute(int mute)
62{ 62{
63 logf("mute %d", mute); 63 logf("mute %d", mute);
64 64
65 if (muted == mute)
66 return;
67
68 muted = mute;
69
65 if(mute) 70 if(mute)
66 { 71 {
67 long int ps0 = 0; 72 long int ps0 = 0;
@@ -69,10 +74,8 @@ void audiohw_mute(int mute)
69 } 74 }
70 else 75 else
71 { 76 {
72 last_ps = 0;
73 erosq_get_outputs(); 77 erosq_get_outputs();
74 } 78 }
75 muted = mute;
76} 79}
77 80
78int erosq_get_outputs(void) { 81int erosq_get_outputs(void) {
@@ -115,14 +118,14 @@ void audiohw_preinit(void)
115 logf("hw preinit"); 118 logf("hw preinit");
116 alsa_controls_init(); 119 alsa_controls_init();
117 hw_open(); 120 hw_open();
118 audiohw_mute(true); /* Start muted to avoid the POP */ 121// audiohw_mute(true); /* Start muted to avoid the POP */
122 audiohw_mute(false);
119 inited = 1; 123 inited = 1;
120} 124}
121 125
122void audiohw_postinit(void) 126void audiohw_postinit(void)
123{ 127{
124 logf("hw postinit"); 128 logf("hw postinit");
125 erosq_get_outputs(); // Unmutes
126} 129}
127 130
128void audiohw_close(void) 131void audiohw_close(void)
diff --git a/firmware/drivers/audio/rocker_codec.c b/firmware/drivers/audio/rocker_codec.c
index e5573df843..e34cb87e9b 100644
--- a/firmware/drivers/audio/rocker_codec.c
+++ b/firmware/drivers/audio/rocker_codec.c
@@ -32,6 +32,8 @@ static int fd_hw;
32static long int vol_l_hw = 255; 32static long int vol_l_hw = 255;
33static long int vol_r_hw = 255; 33static long int vol_r_hw = 255;
34 34
35static int muted = -1;
36
35static void hw_open(void) 37static void hw_open(void)
36{ 38{
37 fd_hw = open("/dev/snd/controlC0", O_RDWR); 39 fd_hw = open("/dev/snd/controlC0", O_RDWR);
@@ -46,6 +48,11 @@ static void hw_close(void)
46 48
47void audiohw_mute(int mute) 49void audiohw_mute(int mute)
48{ 50{
51 if (muted == mute)
52 return;
53
54 muted = mute;
55
49 if(mute) 56 if(mute)
50 { 57 {
51 long int ps0 = 0; 58 long int ps0 = 0;
@@ -67,10 +74,7 @@ void audiohw_preinit(void)
67 74
68void audiohw_postinit(void) 75void audiohw_postinit(void)
69{ 76{
70 long int hp = 2; 77 logf("hw postinit");
71
72 /* Output port switch set to Headphones */
73 //alsa_controls_set_ints("Output Port Switch", 1, &hp); // Unmute happens on PCM start
74} 78}
75 79
76void audiohw_close(void) 80void audiohw_close(void)
diff --git a/firmware/drivers/audio/xduoolinux_codec.c b/firmware/drivers/audio/xduoolinux_codec.c
index 59ef562d0a..f9642812d3 100644
--- a/firmware/drivers/audio/xduoolinux_codec.c
+++ b/firmware/drivers/audio/xduoolinux_codec.c
@@ -41,7 +41,7 @@ static int inited = 0;
41 41
42static long int vol_l_hw = 255; 42static long int vol_l_hw = 255;
43static long int vol_r_hw = 255; 43static long int vol_r_hw = 255;
44static long int last_ps = 0; 44static long int last_ps = -1;
45 45
46static void hw_open(void) 46static void hw_open(void)
47{ 47{
@@ -61,6 +61,11 @@ void audiohw_mute(int mute)
61{ 61{
62 logf("mute %d", mute); 62 logf("mute %d", mute);
63 63
64 if (muted == mute)
65 return;
66
67 muted = mute;
68
64 if(mute) 69 if(mute)
65 { 70 {
66 long int ps0 = 0; 71 long int ps0 = 0;
@@ -68,10 +73,8 @@ void audiohw_mute(int mute)
68 } 73 }
69 else 74 else
70 { 75 {
71 last_ps = 0;
72 xduoo_get_outputs(); 76 xduoo_get_outputs();
73 } 77 }
74 muted = mute;
75} 78}
76 79
77int xduoo_get_outputs(void){ 80int xduoo_get_outputs(void){
@@ -124,14 +127,12 @@ void audiohw_preinit(void)
124 hw_open(); 127 hw_open();
125 audiohw_mute(true); /* Start muted to avoid the POP */ 128 audiohw_mute(true); /* Start muted to avoid the POP */
126 inited = 1; 129 inited = 1;
130// const char * const codec_pmdown = "/sys/devices/platform/ingenic-x3ii.0/x3ii-ak4490-i2s/pmdown_time"; // in ms, defaults 5000
127} 131}
128 132
129void audiohw_postinit(void) 133void audiohw_postinit(void)
130{ 134{
131// const char * const codec_pmdown = "/sys/devices/platform/ingenic-x3ii.0/x3ii-ak4490-i2s/pmdown_time"; // in ms, defaults 5000
132
133 logf("hw postinit"); 135 logf("hw postinit");
134 // xduoo_get_outputs(); // Unmute happens upon playback.
135} 136}
136 137
137void audiohw_close(void) 138void audiohw_close(void)