summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/xduoolinux_codec.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-12 11:09:55 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-12 15:33:32 +0000
commit078c34e951049741cd6681e0219561eec67e071b (patch)
tree734edf13fae68177e832d9869061777eb424d481 /firmware/drivers/audio/xduoolinux_codec.c
parent01dc81cd943719dc0ba380774b332f6c2ee0d67e (diff)
downloadrockbox-078c34e951049741cd6681e0219561eec67e071b.tar.gz
rockbox-078c34e951049741cd6681e0219561eec67e071b.zip
hosted: More PCM muting work
* Track mute state, only call hw if actual change is needed * Don't unmute in audiohw_postinit() * sample rate tracking fixes * erosq: Don't start up muted Change-Id: I004f787a4b7ea73c16b6ec9818ec29a12c89f46b
Diffstat (limited to 'firmware/drivers/audio/xduoolinux_codec.c')
-rw-r--r--firmware/drivers/audio/xduoolinux_codec.c13
1 files changed, 7 insertions, 6 deletions
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)