erosqnative: use hwvol at runtime on es9018k2m

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit df85814e74541df1c8434d375384638aa4475933
Author: Skye <[email protected]>
Date:   Fri Aug 14 22:39:35 2026 +0900

    erosqnative: use hwvol at runtime on es9018k2m
    
    Change-Id: I0ea89ff44a7d7c7c4aeb65ec2b56287324533bcc

diff --git a/firmware/export/pcm_sink.h b/firmware/export/pcm_sink.h
index 54eb261014..c78d4af617 100644
--- a/firmware/export/pcm_sink.h
+++ b/firmware/export/pcm_sink.h
@@ -47,7 +47,7 @@ struct pcm_sink_ops {
 
 struct pcm_sink {
     /* characteristics */
-    const struct pcm_sink_caps caps;
+    struct pcm_sink_caps caps;
 
     /* operations */
     const struct pcm_sink_ops ops;
diff --git a/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c b/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c
index 8bab20abfa..db3e2a305f 100644
--- a/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c
+++ b/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c
@@ -20,6 +20,7 @@
 
 #include "system.h"
 #include "audiohw.h"
+#include "pcm_sink.h"
 #include "pcm_sw_volume.h"
 #include "pcm_sampr.h"
 #include "i2c-target.h"
@@ -102,11 +103,12 @@ void audiohw_init(void)
         }
 #endif
         es9018k2m_present_flag = true;
+        builtin_pcm_sink.caps.volume_type = PCM_SINK_HWVOL;
 
        /* Default is 32-bit data, and it works ok. Enabling the following
         * causes issue. Which is weird, I definitely thought AIC was configured
-        * for 24-bit data... */
-        // es9018k2m_write_reg(ES9018K2M_REG1_INPUT_CONFIG, 0b01001100); // 24-bit data
+        * for 16-bit data... */
+        // es9018k2m_write_reg(ES9018K2M_REG1_INPUT_CONFIG, 0b00001100); // 16-bit data
 
        /* Datasheet: Sets the number os FSR edges that must occur before    *
         * the DPLL and ASRC can lock on to the the incoming Signal.         *
@@ -192,9 +194,6 @@ void audiohw_set_volume(int vol_l, int vol_r)
         l = l <= PCM5102A_VOLUME_MIN ? PCM_MUTE_LEVEL : l;
         r = r <= PCM5102A_VOLUME_MIN ? PCM_MUTE_LEVEL : r;
 
-        /* set software volume just below unity due to
-         * DAC offset. We don't want to overflow the PCM system. */
-        pcm_set_master_volume(-1, -1);
         es9018k2m_set_volume_async(l, r);
     }
     else /* PCM5102A */
diff --git a/firmware/target/mips/ingenic_x1000/pcm-x1000.c b/firmware/target/mips/ingenic_x1000/pcm-x1000.c
index 05baa3cf44..3fb616c7e9 100644
--- a/firmware/target/mips/ingenic_x1000/pcm-x1000.c
+++ b/firmware/target/mips/ingenic_x1000/pcm-x1000.c
@@ -70,16 +70,21 @@ static void sink_dma_init(void)
     audiohw_init();
 
 #if (PCM_NATIVE_BITDEPTH > 16)
-    /* Program audio format (stereo, 24 bit samples) */
-    jz_writef(AIC_CCR, PACK16(0), CHANNEL_V(STEREO),
-              OSS_V(24BIT), ISS_V(24BIT), M2S(0));
-    jz_writef(AIC_I2SCR, SWLH(0));
-#else
-    /* Program audio format (stereo, packed 16 bit samples) */
-    jz_writef(AIC_CCR, PACK16(1), CHANNEL_V(STEREO),
-              OSS_V(16BIT), ISS_V(16BIT), M2S(0));
-    jz_writef(AIC_I2SCR, SWLH(0));
+    if (builtin_pcm_sink.caps.volume_type != PCM_SINK_HWVOL)
+    {
+        /* Program audio format (stereo, 24 bit samples) */
+        jz_writef(AIC_CCR, PACK16(0), CHANNEL_V(STEREO),
+                OSS_V(24BIT), ISS_V(24BIT), M2S(0));
+        jz_writef(AIC_I2SCR, SWLH(0));
+    }
+    else
 #endif
+    {
+        /* Program audio format (stereo, packed 16 bit samples) */
+        jz_writef(AIC_CCR, PACK16(1), CHANNEL_V(STEREO),
+                OSS_V(16BIT), ISS_V(16BIT), M2S(0));
+        jz_writef(AIC_I2SCR, SWLH(0));
+    }
 
     /* Set DMA settings */
     jz_writef(AIC_CFG, TFTH(16), RFTH(15));
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.