Author Topic: 600D Audio Controls?  (Read 149131 times)

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #25 on: July 08, 2012, 08:00:45 PM »
That seems like just as much work :)

Here is play mode.

Code: [Select]
00 08
01 08
02 96
03 96
04 00
05 00
06 00
07 00
08 03
09 03
0a 05
0b 05
0c 0f
0d 0f
0e 04
0f 04
10 00
11 00
12 00
13 00
14 00
15 00
16 00
17 00
18 00
19 00
1a 00
1b 00
1c 00
1d 00
1e 00
1f 00
20 06
21 06
22 02
23 02
24 00
25 00
26 00
27 00
28 00
29 00
2a 00
2b 00
2c 00
2d 00
2e 00
2f 00
30 00
31 00
32 10
33 10
34 00
35 00
36 00
37 00
38 00
39 00
3a 1b
3b 1b
3c 00
3d 00
3e 33
3f 33
40 00
41 00
42 00
43 00
44 00
45 00
46 00
47 00
48 01
49 01
4a 00
4b 00
4c 00
4d 00
4e 00
4f 00
50 00
51 00
52 00
53 00
54 07
55 07
56 00
57 00
58 00
59 00
5a 00
5b 00
5c 00
5d 00
5e 00
5f 00
60 0b
61 0b
62 0b
63 0b
64 00
65 00
66 3f
67 3f
68 2e
69 2e
6a 10
6b 10
6c ff
6d ff
6e 88
6f 88
70 ff
71 ff
72 00
73 00
74 d5
75 d5
76 f4
77 f4
78 f1
79 f1
7a f0
7b f0
7c 00
7d 00
7e 00
7f 00
80 75
81 75
82 2a
83 2a
84 a1
85 a1
86 95
87 95
88 6d
89 6d
8a 08
8b 08
8c 16
8d 16
8e bd
8f bd
90 46
91 46
92 ea
93 ea
94 9c
95 9c
96 24
97 24
98 6d
99 6d
9a 08
9b 08
9c ca
9d ca
9e db
9f db
a0 00
a1 00
a2 00
a3 00
a4 00
a5 00
a6 00
a7 00
a8 5a
a9 5a
aa 00
ab 00
ac bd
ad bd
ae 00
af 00
b0 01
b1 01
b2 08
b3 08
b4 08
b5 08
b6 00
b7 00
b8 0b
b9 0b
ba 70
bb 70
bc 00
bd 00
be 01
bf 01
c0 04
c1 04
c2 05
c3 05
c4 0d
c5 0d
c6 70
c7 70
c8 10
c9 10
ca 00
cb 00
cc 00
cd 00
ce 00
cf 00
d0 00
d1 00
d2 00
d3 00
d4 00
d5 00
d6 00
d7 00
d8 00
d9 00
da 00
db 00
dc 00
dd 00
de 00
df 00
e0 02
e1 02
e2 00
e3 00
e4 07
e5 07
e6 01
e7 01
e8 01
e9 01
ea 00
eb 00
ec 00
ed 00
ee 00
ef 00
f0 00
f1 00
f2 00
f3 00
f4 00
f5 00
f6 00
f7 00
f8 00
f9 00
fa 00
fb 00
fc 00
fd 00
fe 00
ff 00

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #26 on: July 08, 2012, 11:32:23 PM »
0x3900 is Mic boost for sure... when I turn it down external mic gets underpowered and internal mic is quieter.

0x3300 is input volume... I threw it on the first volume slider and it *somewhat* works.. mic gets quieter/louder but I never set up what it was putting in the register so its hit or miss.

0x3F00 is AV volume
0x3B00 is speaker amp volume its set to 1b for some reason...


I think I'll have to figure out the PTP.. .this is getting tedious. Canon functions always reset the registers so getting any setting to stay is pure luck.

The stuff from the 7k0r PDF pg107 on is helping, its mostly the same. There appear to be order/timing specific things to get the IC to do what you want and canon FW is screwing that up most of the time.

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: 600D Audio Controls?
« Reply #27 on: July 08, 2012, 11:37:08 PM »
I've installed this: http://magiclantern.wikia.com/wiki/Remote_control_with_PTP_and_Python not sure if can help but then trying it I've run out of battery.
If you can use it please post some reports to how to replicate and I'll try to help for what I can but I think that a part from testing I can't go long...
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #28 on: July 08, 2012, 11:51:00 PM »
If I can call audio writes and reads from PTP I can try some things in the doc/canon + functions and then see what it does... Also it will be easier reading specific registers without having to dump all of them, turn off the camera, etc.

 Wish it was like javascript console.. you just call functions and they run.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: 600D Audio Controls?
« Reply #29 on: July 09, 2012, 12:15:33 AM »
Sounds very promising - so most important registers are almost known.

When does Canon overwrite the settings? When you change mode (like, press REC, go to play mode), or continuously?

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #30 on: July 09, 2012, 01:27:03 AM »
Seems continuously and whenever an action is performed. I.e I unmute headphone and its muted right away. When I set msleep to 4000 I can't get headphone to work, when its  2000 I could catch it and one file would play through headphones. As soon as you pause / play it goes through the speaker.

It only sets what it knows to set though since you still hear click when you press rec. 

PTP will kinda prevent using the headphones... guess I'll have to figure out how to send audio to the speaker instead. Will get a little more clear when you can read/write to the IC without having to turn the camera off/on/recompile, etc.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: 600D Audio Controls?
« Reply #31 on: July 09, 2012, 11:02:55 AM »
So, this means we should block Canon audio task somehow. With ak4646 cameras, this is done by overriding sounddev_task with a custom one.

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: 600D Audio Controls?
« Reply #32 on: July 09, 2012, 02:35:09 PM »
When not recording I can only get the meters to come on for a second when first enabling audio and then they fall. Maybe one of the other settings is set? Or do you need headphone to be on too for output volume?
So, this means we should block Canon audio task somehow. With ak4646 cameras, this is done by overriding sounddev_task with a custom one.

This maybe is why when I tested the audio trigger feat. to have it working was need to remove this block for 600D in audio.c:1518

#ifndef CONFIG_600D
TASK_OVERRIDE( sounddev_task, my_sounddev_task );
#endif

It worked only before enter video mode. All my last test were done without headphone connected.
I'll try 1% functions and report back.

added audio test menu from Tragic Lantern, now I don't know how to go on, will try to restore ML menu in play mode to start the function when playing back a video...

first tests:
So far enabling filter 1 or 2 will lower rec volume seems, not tested headphone yet.
Disable audio Ic will stop it also for canon menu...
and it will not record audio or play it back anymore till restart.
more test going on...
NOTE: I've removed the comment to TASK_OVERRIDE...

During recording if I press mute AV meter will go down and audio will be not recorded anymore till the next record, then audio comes back like usual.
pressin unmute AV will not bring it back during record or after.
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: 600D Audio Controls?
« Reply #33 on: July 09, 2012, 06:17:39 PM »
I have the impression that on start the chip is monitoring audio even in photo mode, just with TASK_OVERRIDE active. I've not tried yet.
filter will stay set till a rec is started, then they will turn back to normal and can be reset during rec.
I have no clue if there is something else that is changing them or if TASK_OVERRIDE is not fully working...
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #34 on: July 09, 2012, 06:35:11 PM »
I set the 2 first volumes up... there is just no latitude. Values being placed in those addresses aren't right. That is why I enabled the sound override task. I can try to disable it... maybe it will be more interesting.

When you mute av it does:     audio_ic_write( 0x693e );

None of the other commands write to 0x69 which I think is volume control enable/disable or something along those lines.

I have to put in a few more today like the mic power/unpower, reboot ic, enable IC, etc. Also was going to put delays to get to play mode... but I can just enable ML menu to show up? That would be sweet. After that I'll try some functions from the 7k0r sheet.

I can get the ext speaker to pop (like headphone) but I think only when something gets crashed/changed. It did it in record and stop but its hard to reproduce.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #35 on: July 09, 2012, 08:11:58 PM »
I think reboot doesn't work but you can power mic amp whenever now and get left working at least. How do I enable ML menu in play mode?

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: 600D Audio Controls?
« Reply #36 on: July 09, 2012, 08:56:18 PM »
I think reboot doesn't work but you can power mic amp whenever now and get left working at least. How do I enable ML menu in play mode?
Here what is missing in menu.c:

Code: [Select]
// this should work on most cameras
int handle_ml_menu_erase(struct event * event)
{
    if (dofpreview) return 1; // don't open menu when DOF preview is locked
   
    if (event->param == BGMT_TRASH)
    {
        if (gui_menu_shown() || gui_state == GUISTATE_IDLE)
        {
            give_semaphore( gui_sem );
            return 0;
        }
        //~ else bmp_printf(FONT_LARGE, 100, 100, "%d ", gui_state);
    }

#ifndef CONFIG_5D2
    if (event->param == BGMT_MENU && PLAY_MODE)
    {
        give_semaphore( gui_sem );
        return 0;
    }
#endif
   
    return 1;
}
but basically it will change to menu mode, so it's not so usable.
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: 600D Audio Controls?
« Reply #37 on: July 09, 2012, 09:00:50 PM »
You can disable piggyback_canon_menu and close_canon_menu (simply comment out their contents), then alter the button handler to accept the delete key in play mode too.

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: 600D Audio Controls?
« Reply #38 on: July 09, 2012, 09:39:39 PM »
done, testing again.

Filter 1 is increasing volume of the speaker audio in play
Filter 2 is decreasing volume of the speaker audio in play
Unpower Speaker will shut down audio when playing
power speaker then can bring back audio on speaker but at a lower volume, then filter 1 will increase it a bit.
Not yet added last 1% functions...
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #39 on: July 09, 2012, 09:56:27 PM »
I have to set the play mode up but I think i can find mic select. When I just start the amp up its only on 1 channel. after record it is on both.

*

The play filters mostly ser eq's and volumes.  The HPF from the 7k0r menus seem to work. Also rec/play toggles affect things.


scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: 600D Audio Controls?
« Reply #40 on: July 09, 2012, 11:06:26 PM »
I've enabled the TASK_OVERRIDE from your source and I can see the meter at start up., now looking in the 7k0r menu. but first will add the menu in play.

here my diff:
Code: [Select]
diff -r 853866588ab9 Makefile.inc
--- a/Makefile.inc Mon Jul 09 14:28:44 2012 -0500
+++ b/Makefile.inc Mon Jul 09 23:13:35 2012 +0200
@@ -172,6 +172,7 @@
  -D__ARM__ \
  -I$(PLATFORM_INC) \
  -I$(SRC_DIR) \
+ -mlong-calls \
 
 ifeq ($(CONFIG_PYMITE),y)
 CFLAGS += $(PYMITE_CFLAGS)
diff -r 853866588ab9 src/audio.c
--- a/src/audio.c Mon Jul 09 14:28:44 2012 -0500
+++ b/src/audio.c Mon Jul 09 23:13:35 2012 +0200
@@ -1518,11 +1518,11 @@
         }
 }
 
-#ifndef CONFIG_600D
+//#ifndef CONFIG_600D
 //#ifndef CONFIG_500D
 
-//TASK_OVERRIDE( sounddev_task, my_sounddev_task );
-#endif
+TASK_OVERRIDE( sounddev_task, my_sounddev_task );
+//#endif
 
 #if 0
 /** Replace the audio level task with our own.
diff -r 853866588ab9 src/menu.c
--- a/src/menu.c Mon Jul 09 14:28:44 2012 -0500
+++ b/src/menu.c Mon Jul 09 23:13:35 2012 +0200
@@ -2121,7 +2121,7 @@
 
 void piggyback_canon_menu()
 {
-#ifdef GUIMODE_ML_MENU
+/*#ifdef GUIMODE_ML_MENU
     #ifdef CONFIG_500D
     if (is_movie_mode()) return; // doesn'tworkstation
     #endif
@@ -2132,12 +2132,12 @@
     int new_gui_mode = GUIMODE_ML_MENU;
     if (new_gui_mode) task_create("menu_redraw_flood", 0x1c, 0, menu_redraw_flood, 0);
     if (new_gui_mode != CURRENT_DIALOG_MAYBE) { SetGUIRequestMode(new_gui_mode); msleep(200); }
-#endif
+#endif*/
 }
 
 void close_canon_menu()
 {
-#ifdef GUIMODE_ML_MENU
+/*#ifdef GUIMODE_ML_MENU
     #ifdef CONFIG_500D
     if (is_movie_mode()) return; // doesn'tworkstation
     #endif
@@ -2146,7 +2146,7 @@
     if (gui_state == GUISTATE_MENUDISP) return;
     SetGUIRequestMode(0);
     msleep(100);
-#endif
+#endif*/
 }
 
 static void menu_open()
@@ -2486,6 +2486,14 @@
         //~ else bmp_printf(FONT_LARGE, 100, 100, "%d ", gui_state);
     }
 
+#ifndef CONFIG_5D2
+    if (event->param == BGMT_MENU && PLAY_MODE)
+    {
+        give_semaphore( gui_sem );
+        return 0;
+    }
+#endif
+   
     return 1;
 }
 

Now during play a video:
Audio test... menu
Reboot Audio IC : during play audio goes away
Unmute AV, Unmute AV2 : not working
Disable / Enable Audio IC : works
Power/Unpower speaker: works
Play Filters 1 and 2 : works
Unset play filter: not working

7k0r menu:
Rec Start/Stop Block on/off : works in rec
RecVolSet: will droop volume too low, rec start will recover.
Play Vol Set also wil drop down volume when in play but no so much as in rec.

in audio menu
Analog gain seem to work only from 23 to 32 dB
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #41 on: July 10, 2012, 12:12:40 AM »
Analog gain is mic input gain. L-gain is mic boost. Values are wrong.. I dunno what it was being set to originally. The db's don't correspond to anything.

I want to make a big chart of all of these regs from 7k0r and what values I find from canon. Some of  the registers are actually binary so depending on what bit is flipped some shit happens.

Once we have a full list it will make more sense what has to be done to control things. I'll mess with the play mode, I think you can get headphone to work if you unmute it right before you press play. If you do it while playing it will do nothing or just shut the speaker off. I found this out when I was originally doing msleep and unmute from the don't click me menu. The timing has to be right so canon doesn't change it back. With power up mic, audio remote shot can probably happen already.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #42 on: July 10, 2012, 01:37:56 AM »
Docs for very similar lapis chip... may shed some light


http://us.generation-nt.com/patch-v3-sound-soc-codecs-add-lapis-semiconductor-ml26124-help-205578541.html



http://git.alsa-project.org/?p=alsa-kernel.git;a=blob;f=sound/soc/codecs/ml26124.c;h=22cb5bf59273dcbfde850dd6243a138cbdce003f;hb=HEAD

Registers are very similar as you can see:

http://git.alsa-project.org/?p=alsa-kernel.git;a=blob_plain;f=sound/soc/codecs/ml26124.h;hb=HEAD

The C file will show how to do stuff.


*It uses the other set of registers... ie. this ic is

#define ML26124_PW_MIC_IN_VOL      0x32
#define ML26124_PW_MIC_BOST_VOL      0x38

We use 33 and 39... but I think either address works for setting. Will have to test.... does this mean audio is done for us?

The odd registers are used. Making a list with values I've seen. I stink at bit operations so its a little hard.

i.e. SOC_ENUM_SINGLE(ML26124_SAI_TRANS_CTL, 6, 3, ml26124_companding);

That is put companding in CTL with offset of 6 and bitmask of 3 but what is a bitmask of 3?, and how can it be at offset of 6?
Code: [Select]
0000xxx ?
000xxx0 ?

Also shit like this:

snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 0);

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: 600D Audio Controls?
« Reply #43 on: July 10, 2012, 07:03:12 PM »
I can just confirm that actually just enabling TASK_OVERRIDE in audio.c also for 600D on unified will make audio meter work at first start before recording. And so also audio trigger can work but probably only if movie mode isn't used.
maybe restarting the chip when this function is activated could help in having it always usable...
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #44 on: July 10, 2012, 07:48:31 PM »
I'm going to keep trying, going to put register names in the functions. Here is a list, not 100% complete but getting much much closer. Some registers control more than 1 "thing", depending on which bits you flip.

Going in audio.h
Code: [Select]
/* Clock Control Register */
#define ML_SMPLING_RATE 0x0100 /* Sampling Rate */
#define ML_PLLNL 0x0300 /* PLL NL */
#define ML_PLLNH 0x0500 /* PLL NH */
#define ML_PLLML 0x0700 /* PLL ML */
#define ML_PLLMH 0x0900 /* MLL MH */
#define ML_PLLDIV 0x0b00 /* PLL DIV */
#define ML_CLK_EN 0x0d00 /*MCLKEN + PLLEN +PLLOE */ /* Clock Enable */
#define ML_CLK_CTL 0x0f00 /* CLK Input/Output Control */

/* System Control Register */
#define ML_SW_RST 0x1100 /* Software RESET */
#define ML_REC_PLYBAK_RUN 0x1300 /* Record/Playback Run */
#define ML_MIC_TIM 0x1500 /* Mic Input/Output control */

/* Power Mnagement Register */
#define ML_PW_REF_PW_MNG 0x2100 /* MICBIAS */ /* Reference Power Management */
#define ML_PW_IN_PW_MNG 0x2300 /* ADC "Capture" + PGA */ /* Input Power Management */
#define ML_PW_DAC_PW_MNG 0x2500 /*DAC Power Switch? Playback */ /* DAC Power Management */
#define ML_PW_SPAMP_PW_MNG 0x2700 /* SP-AMP Power Management */
#define ML_PW_LOUT_PW_MNG 0x2900 /* Line Control Switch? */ /* LINEOUT Power Management */
#define ML_PW_ZCCMP_PW_MNG 0x2f00 /* ZC Switch */ /* AC-CMP Power Management */


/* Analog Reference Control Register */
#define ML_PW_MICBIAS_VOL 0x3100 /* MICBIAS Voltage Control */

/* Input/Output Amplifier Control Register */
#define ML_PW_MIC_IN_VOL 0x3300 /* MIC Input Volume */
#define ML_PW_MIC_BOST_VOL 0x3900 /* Mic Boost Volume */
#define ML_PW_SPK_AMP_VOL 0x3b00 /* Speaker AMP Volume */
#define ML_PW_AMP_VOL_FUNC 0x4900 /* AMP Volume Control Function Enable */
#define ML_PW_AMP_VOL_FADE 0x4b00 /* Amplifier Volume Fader Control */


/* Analog Path Control Register */
#define ML_SPK_AMP_OUT 0x5500 /* DAC Switch + Line in loopback Switch + PGA Switch */ /* Speaker AMP Output Control */
#define ML_MIC_IF_CTL 0x5b00 /* Mic IF Control */
#define ML_MIC_SELECT 0xe900 /* Mic IF Control */

/* Audio Interface Control Register */
#define ML_SAI_TRANS_CTL 0x6100 /* SAI-Trans Control */
#define ML_SAI_RCV_CTL 0x6300 /* SAI-Receive Control */
#define ML_SAI_MODE_SEL 0x6500 /* SAI Mode select */

/* DSP Control Register */
#define ML_FILTER_EN 0x6700 /* Filter Func Enable */ /*DC High Pass Filter Switch+ Noise High Pass Filter Switch + EQ Band0/1/2/3/4 Switch  V: '01' '00' */
#define ML_DVOL_CTL 0x6900 /* Volume Control Func Enable */ /* Play Limiter + Capture Limiter + Digital Volume Fade Switch +Digital Switch */
#define ML_MIXER_VOL_CTL 0x6b00 /* Mixer & Volume Control*/
#define ML_RECORD_DIG_VOL 0x6d00 /* Capture/Record Digital Volume */
#define ML_PLBAK_DIG_VOL 0x7100 /* Playback Digital Volume */
#define ML_DIGI_BOOST_VOL 0x7300 /* Digital Boost Volume */
#define ML_EQ_GAIN_BRAND0 0x7500 /* EQ Band0 Volume */
#define ML_EQ_GAIN_BRAND1 0x7700 /* EQ Band1 Volume */
#define ML_EQ_GAIN_BRAND2 0x7900 /* EQ Band2 Volume */
#define ML_EQ_GAIN_BRAND3 0x7b00 /* EQ Band3 Volume */
#define ML_EQ_GAIN_BRAND4 0x7d00 /* EQ Band4 Volume */
#define ML_HPF2_CUTOFF         0x7f00 /* HPF2 CutOff*/
#define ML_EQBRAND0_F0L 0x8100 /* EQ Band0 Coef0L */
#define ML_EQBRAND0_F0H 0x8300
#define ML_EQBRAND0_F1L 0x8500
#define ML_EQBRAND0_F1H 0x8700
#define ML_EQBRAND1_F0L 0x8900
#define ML_EQBRAND1_F0H 0x8b00
#define ML_EQBRAND1_F1L 0x8d00
#define ML_EQBRAND1_F1H 0x8f00
#define ML_EQBRAND2_F0L 0x9100
#define ML_EQBRAND2_F0H 0x9300
#define ML_EQBRAND2_F1L 0x9500
#define ML_EQBRAND2_F1H 0x9700
#define ML_EQBRAND3_F0L 0x9900
#define ML_EQBRAND3_F0H 0x9b00
#define ML_EQBRAND3_F1L 0x9d00
#define ML_EQBRAND3_F1H 0x9f00
#define ML_EQBRAND4_F0L 0xa100
#define ML_EQBRAND4_F0H 0xa300
#define ML_EQBRAND4_F1L 0xa500
#define ML_EQBRAND4_F1H 0xa700

/* ALC Control Register */
#define ML_ALC_MODE 0xb100 /* ALC Mode */
#define ML_ALC_ATTACK_TIM 0xb300 /* ALC Attack Time */
#define ML_ALC_DECAY_TIM 0xb500 /* ALC Decay Time */
#define ML_ALC_HOLD_TIM 0xb700 /* ALC Hold Time */
#define ML_ALC_TARGET_LEV 0xb900 /* ALC Target Level */
#define ML_ALC_MAXMIN_GAIN 0xbb00 /* ALC Min/Max Input Volume/Gain 2 sets of bits */
#define ML_NOIS_GATE_THRSH 0xbd00 /* Noise Gate Threshold */
#define ML_ALC_ZERO_TIMOUT 0xbf00 /* ALC ZeroCross TimeOut */

/* Playback Limiter Control Register */
#define ML_PL_ATTACKTIME 0xc100 /* PL Attack Time */
#define ML_PL_DECAYTIME 0xc300 /* PL Decay Time */
#define ML_PL_TARGETTIME 0xc500 /* PL Target Level */
#define ML_PL_MAXMIN_GAIN 0xc700 /* Playback Limiter Min/max Input Volume/Gain 2 sets */
#define ML_PLYBAK_BOST_VOL 0xc900 /* Playback Boost Volume */
#define ML_PL_0CROSS_TIMOUT 0xcb00 /* PL ZeroCross TimeOut */


/* Undocumented Canon Registers */
#define ML_NODOC_E5  0xe500 /* While playing? Val:'06' '07' */


Task override may be flipping things because while all of the magic lantern registers are wrong they still modify the real ones. I can disable the override and still power up the mic amp and get audio. Only on 1 channel until I start recording. Want to get the old registers out asap. This audio IC works fairly differently than the other one(s). Much of audio.c has to be different.. I see why this was a huge problem having no camera to test on.

With ML menu in play mode... I can unmute AV and listen through headphones at will.. wheel even adjust volume but there is not much latitude.

*http://fossies.org/dox/alsa-driver-1.0.25/soc_8h.html#a0d99352bf179ad390d7b697377b36e9a

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #45 on: July 11, 2012, 03:18:25 AM »
Ok, trying to figure out the volume scales.... maybe someone knows math :)

Code: [Select]
DECLARE_TLV_DB_SCALE(name, min, step, mute) \

#define SOC_SINGLE_TLV (   xname,
  reg,
  shift,
  max,
  invert,
  tlv_array
)

static const DECLARE_TLV_DB_SCALE(digital_tlv, -7150, 50, 0);
SOC_SINGLE_TLV("Capture Digital Volume", ML26124_RECORD_DIG_VOL, 0,
0xff, 1, digital_tlv),
SOC_SINGLE_TLV("Playback Digital Volume", ML26124_PLBAK_DIG_VOL, 0,
0xff, 1, digital_tlv),


How do I do gain to db?  I can't figure out how DECLARE_TLV_DB_SCALE arrives at db value. Can't find it in the alsa sources.



a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: 600D Audio Controls?
« Reply #46 on: July 11, 2012, 09:28:32 AM »
ML has built-in functions for this... audio_level_to_db ;)

funkysound

  • Freshman
  • **
  • Posts: 74
Re: 600D Audio Controls?
« Reply #47 on: July 11, 2012, 04:20:53 PM »
I donĀ“t understand a word ... but it sounds to me that you are on the right way to realize audio on the 600d.  :)
EOS 600d, Tamron 17-50mm 2,8 with stab., Tamron 70-300mm, Canon 50mm 1:1,8, Sigma 10-20mm 4-5,6, Sigma 30mm 1,4,  EOS M with 18-55mm, 22mm and EF adapter, tons of more glases incl. FD/FL, EOS 70D, Canon 18-135mm STM

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio Controls?
« Reply #48 on: July 11, 2012, 05:09:37 PM »
Everything has its own scale...

static const DECLARE_TLV_DB_SCALE(alclvl, -2250, 150, 0);
static const DECLARE_TLV_DB_SCALE(mingain, -1200, 600, 0);
static const DECLARE_TLV_DB_SCALE(maxgain, -675, 600, 0);
static const DECLARE_TLV_DB_SCALE(boost_vol, -1200, 75, 0);
static const DECLARE_TLV_DB_SCALE(ngth, -7650, 150, 0);

Input switching is somewhat working too... I can isolate the internal mic but for some reason not the external.


Audio for 600D already "works", just what ML does is different than what this chip needs. All old register addresses are wrong.  We can also set sampling rate and other stuff like that. May be possible to record higher bit rate with crappier audio, etc. The IC is basically fully controllable.

I think task override is not 100%. I think the 2 tasks are fighting still.   Wanted to look for it in the firmware: I tried to dump rom0 but the function keeps saying its undeclared no matter what I do. 

Also I wonder if monitoring is possible because this IC has 2 modes... play and rec. Hopefully it will  set output to both record and feed headphone/speaker. I think they turn on OK just no signal is being fed to them. Hopefully canon didn't cheap out with this IC but there is no real spec so I can't tell.  Maybe I should talk with the alsa guy who wrote the driver.


Micah McDowell

  • Just arrived
  • *
  • Posts: 1
Re: 600D Audio Controls?
« Reply #49 on: July 11, 2012, 11:30:33 PM »
Good to see that you smart guys are working on this....

I just purchased a T3i today, unfortunately not knowing that headphone audio monitoring was not yet available. I use it all the time on the T2i and it always works flawlessly. I'm greatly looking forward to it being enabled on the T3i.

Donated to the project; keep up the good work!