summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/imx233')
-rw-r--r--firmware/target/arm/imx233/audioout-imx233.c6
-rw-r--r--firmware/target/arm/imx233/audioout-imx233.h3
-rw-r--r--firmware/target/arm/imx233/debug-imx233.c31
3 files changed, 25 insertions, 15 deletions
diff --git a/firmware/target/arm/imx233/audioout-imx233.c b/firmware/target/arm/imx233/audioout-imx233.c
index 66664acdf7..0ad78d224a 100644
--- a/firmware/target/arm/imx233/audioout-imx233.c
+++ b/firmware/target/arm/imx233/audioout-imx233.c
@@ -251,14 +251,14 @@ struct imx233_audioout_info_t imx233_audioout_get_info(void)
251 /* 6*10^6*basemult/(src_frac*8*(src_hold+1)) in Hz */ 251 /* 6*10^6*basemult/(src_frac*8*(src_hold+1)) in Hz */
252 info.freq = 60000000 * BF_RD(AUDIOOUT_DACSRR, BASEMULT) / 8 / 252 info.freq = 60000000 * BF_RD(AUDIOOUT_DACSRR, BASEMULT) / 8 /
253 BF_RD(AUDIOOUT_DACSRR, SRC_FRAC) / (1 + BF_RD(AUDIOOUT_DACSRR, SRC_HOLD)); 253 BF_RD(AUDIOOUT_DACSRR, SRC_FRAC) / (1 + BF_RD(AUDIOOUT_DACSRR, SRC_HOLD));
254 info.hp_line1 = BF_RD(AUDIOOUT_HPVOL, SELECT); 254 info.hpselect = BF_RD(AUDIOOUT_HPVOL, SELECT);
255 /* convert half-dB to tenth-dB */ 255 /* convert half-dB to tenth-dB */
256 info.dacvol[0] = MAX((int)BF_RD(AUDIOOUT_DACVOLUME, VOLUME_LEFT) - 0xff, -100) * 5; 256 info.dacvol[0] = MAX((int)BF_RD(AUDIOOUT_DACVOLUME, VOLUME_LEFT) - 0xff, -100) * 5;
257 info.dacvol[1] = MAX((int)BF_RD(AUDIOOUT_DACVOLUME, VOLUME_RIGHT) - 0xff, -100) * 5; 257 info.dacvol[1] = MAX((int)BF_RD(AUDIOOUT_DACVOLUME, VOLUME_RIGHT) - 0xff, -100) * 5;
258 info.dacmute[0] = BF_RD(AUDIOOUT_DACVOLUME, MUTE_LEFT); 258 info.dacmute[0] = BF_RD(AUDIOOUT_DACVOLUME, MUTE_LEFT);
259 info.dacmute[1] = BF_RD(AUDIOOUT_DACVOLUME, MUTE_RIGHT); 259 info.dacmute[1] = BF_RD(AUDIOOUT_DACVOLUME, MUTE_RIGHT);
260 info.hpvol[0] = (info.hp_line1 ? 120 : 60) - 5 * BF_RD(AUDIOOUT_HPVOL, VOL_LEFT); 260 info.hpvol[0] = (info.hpselect ? 120 : 60) - 5 * BF_RD(AUDIOOUT_HPVOL, VOL_LEFT);
261 info.hpvol[1] = (info.hp_line1 ? 120 : 60) - 5 * BF_RD(AUDIOOUT_HPVOL, VOL_RIGHT); 261 info.hpvol[1] = (info.hpselect ? 120 : 60) - 5 * BF_RD(AUDIOOUT_HPVOL, VOL_RIGHT);
262 info.hpmute[0] = info.hpmute[1] = BF_RD(AUDIOOUT_HPVOL, MUTE); 262 info.hpmute[0] = info.hpmute[1] = BF_RD(AUDIOOUT_HPVOL, MUTE);
263 info.spkrvol[0] = info.spkrvol[1] = 155; 263 info.spkrvol[0] = info.spkrvol[1] = 155;
264 info.spkrmute[0] = info.spkrmute[1] = BF_RD(AUDIOOUT_SPEAKERCTRL, MUTE); 264 info.spkrmute[0] = info.spkrmute[1] = BF_RD(AUDIOOUT_SPEAKERCTRL, MUTE);
diff --git a/firmware/target/arm/imx233/audioout-imx233.h b/firmware/target/arm/imx233/audioout-imx233.h
index c7fcf647a4..b5c16767c6 100644
--- a/firmware/target/arm/imx233/audioout-imx233.h
+++ b/firmware/target/arm/imx233/audioout-imx233.h
@@ -29,8 +29,9 @@
29 29
30struct imx233_audioout_info_t 30struct imx233_audioout_info_t
31{ 31{
32 // NOTE there is a convention here: dac -> dacvol -> dacmute
32 int freq; // in mHz 33 int freq; // in mHz
33 bool hp_line1; 34 bool hpselect;
34 bool dac; 35 bool dac;
35 int dacvol[2]; // in tenth-dB, l/r 36 int dacvol[2]; // in tenth-dB, l/r
36 bool dacmute[2]; // l/r 37 bool dacmute[2]; // l/r
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c
index ebef023c74..58d3082622 100644
--- a/firmware/target/arm/imx233/debug-imx233.c
+++ b/firmware/target/arm/imx233/debug-imx233.c
@@ -34,6 +34,7 @@
34#include "ocotp-imx233.h" 34#include "ocotp-imx233.h"
35#include "pwm-imx233.h" 35#include "pwm-imx233.h"
36#include "emi-imx233.h" 36#include "emi-imx233.h"
37#include "audioin-imx233.h"
37#include "audioout-imx233.h" 38#include "audioout-imx233.h"
38#include "string.h" 39#include "string.h"
39#include "stdio.h" 40#include "stdio.h"
@@ -799,8 +800,10 @@ bool dbg_hw_info_emi(void)
799 } 800 }
800} 801}
801 802
802bool dbg_hw_info_audioout(void) 803bool dbg_hw_info_audio(void)
803{ 804{
805 static const char *hp_sel[2] = {"DAC", "Line1"};
806 static const char *mux_sel[4] = {"Mic", "Line1", "HP", "Line2"};
804 lcd_setfont(FONT_SYSFIXED); 807 lcd_setfont(FONT_SYSFIXED);
805 808
806 while(1) 809 while(1)
@@ -819,21 +822,22 @@ bool dbg_hw_info_audioout(void)
819 } 822 }
820 823
821 lcd_clear_display(); 824 lcd_clear_display();
822 struct imx233_audioout_info_t info = imx233_audioout_get_info(); 825 struct imx233_audioout_info_t out = imx233_audioout_get_info();
826 struct imx233_audioin_info_t in = imx233_audioin_get_info();
823 int line = 0; 827 int line = 0;
824#define display_sys(sys, name) \ 828#define display_sys(st, sys, name) \
825 if(info.sys) \ 829 if(st.sys) \
826 { \ 830 { \
827 char buffer[64]; \ 831 char buffer[64]; \
828 snprintf(buffer, 64, "%s: ", name); \ 832 snprintf(buffer, 64, "%s: ", name); \
829 for(int i = 0; i < 2; i++) \ 833 for(int i = 0; i < 2; i++) \
830 { \ 834 { \
831 if(info.sys##mute[i]) \ 835 if(st.sys##mute[i]) \
832 strcat(buffer, "mute"); \ 836 strcat(buffer, "mute"); \
833 else \ 837 else \
834 snprintf(buffer + strlen(buffer), 64, "%d.%d", \ 838 snprintf(buffer + strlen(buffer), 64, "%d.%d", \
835 /* properly handle negative values ! */ \ 839 /* properly handle negative values ! */ \
836 info.sys##vol[i] / 10, (10 + (info.sys##vol[i]) % 10) % 10); \ 840 st.sys##vol[i] / 10, (10 + (st.sys##vol[i]) % 10) % 10); \
837 if(i == 0) \ 841 if(i == 0) \
838 strcat(buffer, " / "); \ 842 strcat(buffer, " / "); \
839 else \ 843 else \
@@ -843,11 +847,16 @@ bool dbg_hw_info_audioout(void)
843 } \ 847 } \
844 else \ 848 else \
845 lcd_putsf(0, line++, "%s: powered down", name); 849 lcd_putsf(0, line++, "%s: powered down", name);
846 display_sys(dac, "DAC"); 850 display_sys(out, dac, "DAC");
847 display_sys(hp, "HP"); 851 display_sys(out, hp, "HP");
848 display_sys(spkr, "SPKR"); 852 display_sys(out, spkr, "SPKR");
853 display_sys(in, adc, "ADC");
854 display_sys(in, mux, "MUX");
855 display_sys(in, mic, "MIC");
849#undef display_sys 856#undef display_sys
850 lcd_putsf(0, line++, "capless: %d", info.capless); 857 lcd_putsf(0, line++, "capless: %d", out.capless);
858 lcd_putsf(0, line++, "HP select: %s", hp_sel[out.hpselect]);
859 lcd_putsf(0, line++, "MUX select: %s / %s", mux_sel[in.muxselect[0]], mux_sel[in.muxselect[1]]);
851 860
852 lcd_update(); 861 lcd_update();
853 yield(); 862 yield();
@@ -873,7 +882,7 @@ static struct
873 {"pwm", dbg_hw_info_pwm}, 882 {"pwm", dbg_hw_info_pwm},
874 {"usb", dbg_hw_info_usb}, 883 {"usb", dbg_hw_info_usb},
875 {"emi", dbg_hw_info_emi}, 884 {"emi", dbg_hw_info_emi},
876 {"audioout", dbg_hw_info_audioout}, 885 {"audio", dbg_hw_info_audio},
877 {"target", dbg_hw_target_info}, 886 {"target", dbg_hw_target_info},
878}; 887};
879 888