2010-03-12 09:39:35 SSM2602/3 Driver Question
Tom Hoover (UNITED STATES)
Message: 87139
Greetings All,
I'm trying to find the appropriate IOCTL calls ( or other method ) to directly write values to the control registers in the codec. I'm trying to control gains, sidetone enable - things like that and have had zero success in figuring out how to use the mixer to do such things.
Can anybody point me at the code or docs for this? I'm using alsa as the high level interface and that seems to be working fine - just can't control the basics.
Thanks,
Tom Hoover
QuoteReplyEditDelete
2010-03-12 09:48:28 SSM2602/3 Driver Question
Michael Hennerich (GERMANY)
Message: 87140 Have you tried amixer?
QuoteReplyEditDelete
2010-03-12 10:06:20 Re: SSM2602/3 Driver Question
Tom Hoover (UNITED STATES)
Message: 87141
Yes. Worked with it for a couple of days and no success. Can you suggest commands lines to make it work?
QuoteReplyEditDelete
2010-03-12 10:40:22 Re: SSM2602/3 Driver Question
Michael Hennerich (GERMANY)
Message: 87142 Please read the amixer documentation -
You can also find amixer examples on the ssm2602 wiki page:
On the SSM2602/3 following controls exist:
root:/> amixer
Simple mixer control 'Master',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 121 [95%]
Front Right: Playback 121 [95%]
Simple mixer control 'Master Playback ZC',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [off]
Front Right: Playback [off]
Simple mixer control 'Sidetone',0
Capabilities: pvolume pvolume-joined
Playback channels: Mono
Limits: Playback 0 - 3
Mono: Playback 3 [100%]
Simple mixer control 'Line',0
Capabilities: cswitch cswitch-joined cswitch-exclusive
Capture exclusive group: 0
Capture channels: Mono
Mono: Capture [on]
Simple mixer control 'Mic',0
Capabilities: cswitch cswitch-joined cswitch-exclusive
Capture exclusive group: 0
Capture channels: Mono
Mono: Capture [off]
Simple mixer control 'Mic Boost (+20dB)',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'Mic Boost2 (+20dB)',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Playback De-emphasis',0
Capabilities: enum
Items: 'None' '32Khz' '44.1Khz' '48Khz'
Item0: 'None'
Simple mixer control 'Capture',0
Capabilities: cvolume cswitch
Capture channels: Front Left - Front Right
Limits: Capture 0 - 31
Front Left: Capture 23 [74%] [on]
Front Right: Capture 23 [74%] [on]
Simple mixer control 'ADC High Pass Filter',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'Input Mux',0
Capabilities: enum
Items: 'Line' 'Mic'
Item0: 'Line'
Simple mixer control 'Output Mixer HiFi',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'Output Mixer Line Bypass',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Output Mixer Mic Sidetone',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Store DC Offset',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
root:/>
This enables/disables Sidetone
root:/> amixer sset 'Sidetone' 1
Simple mixer control 'Sidetone',0
Capabilities: pvolume pvolume-joined
Playback channels: Mono
Limits: Playback 0 - 3
Mono: Playback 1 [33%]
root:/> amixer sset 'Sidetone' 0
Simple mixer control 'Sidetone',0
Capabilities: pvolume pvolume-joined
Playback channels: Mono
Limits: Playback 0 - 3
Mono: Playback 0 [0%]
root:/>
-Michael
QuoteReplyEditDelete
2010-03-12 11:10:50 Re: SSM2602/3 Driver Question
Tom Hoover (UNITED STATES)
Message: 87143
I've read the wiki page and the ALSA docs. Thus I'm looking to control the registers directly because I haven't been able to get amixer to do anything. I'm probably not using it correctly. For example I think the following command should set the playback volume to 0.
amixer sset 'Master' 0
It doesn't. But after the command I get this back:
root:/tmp> amixer sset 'Master' 0
Simple mixer control 'Master',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 0 [0%]
Front Right: Playback 0 [0%]
root:/tmp>
Which I would think means there should a least be a reduction in volume.
Tom
QuoteReplyEditDelete
2010-03-14 23:51:17 Re: SSM2602/3 Driver Question
Yi Li (CHINA)
Message: 87192
Tom,
What exactly are you going to set?
"amixer sset Master 0" would set volume to "0", "amixer sset Master 50%" would set volume to 50% of peak volume...
So it looks correct to me.
-Yi
QuoteReplyEditDelete
2010-03-15 12:28:30 Re: SSM2602/3 Driver Question
Tom Hoover (UNITED STATES)
Message: 87209
Yi -
At this point I would be happy controlling audio input and output gain.
I'm testing right now with .wav files generated using audacity, playing them with aplay.
I have two files both mono, both 1KHz. one is at 44100 sample rate the other at 8000.
Both files play just fine so I know I can change the sample rate of the 2603. Thus I'm talking to it over i2c.
To change the volume I use the command "amixer sset 'Master' xx% where xx = 0-100
Amixer reports the change, but there is no change in volume.
I added some pr_info calls in the ssm2602 driver in the ssm2602_write routine to catch what was being sent into the i2c subsystem.
Below is the dump of setting the Master channel to 10% volume, and playing one of my files. The playback volume was still full scale.
Thanks,
Tom
------------------------ CAPTURE BELOW --------------------------------
root:/tmp> amixer sset 'Master' 10%
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0002, value:010D
ssm2602_write, reg: 0002, value: 010D
ssm2602_write, reg << 1: 0004
ssm2602_write, value >> 8: 0001
ssm2602_write, data: 05, 0D
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0003, value:010D
ssm2602_write, reg: 0003, value: 010D
ssm2602_write, reg << 1: 0006
ssm2602_write, value >> 8: 0001
ssm2602_write, data: 07, 0D
Simple mixer control 'Master',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 13 [10%]
Front Right: Playback 13 [10%]
root:/tmp> aplay 1k-8000-5sec.wav
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0007, value:0042
ssm2602_write, reg: 0007, value: 0042
ssm2602_write, reg << 1: 000E
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 0E, 42
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0009, value:0000
ssm2602_write, reg: 0009, value: 0000
ssm2602_write, reg << 1: 0012
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 12, 00
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0008, value:0001
ssm2602_write, reg: 0008, value: 0001
ssm2602_write, reg << 1: 0010
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 10, 01
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0007, value:004E
ssm2602_write, reg: 0007, value: 004E
ssm2602_write, reg << 1: 000E
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 0E, 4E
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0009, value:0001
ssm2602_write, reg: 0009, value: 0001
ssm2602_write, reg << 1: 0012
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 12, 01
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0009, value:0001
ssm2602_write, reg: 0009, value: 0001
ssm2602_write, reg << 1: 0012
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 12, 01
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0006, value:0050
ssm2602_write, reg: 0006, value: 0050
ssm2602_write, reg << 1: 000C
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 0C, 50
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0006, value:0040
ssm2602_write, reg: 0006, value: 0040
ssm2602_write, reg << 1: 000C
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 0C, 40
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0006, value:0040
ssm2602_write, reg: 0006, value: 0040
ssm2602_write, reg << 1: 000C
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 0C, 40
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0005, value:0000
ssm2602_write, reg: 0005, value: 0000
ssm2602_write, reg << 1: 000A
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 0A, 00
Playing WAVE '1k-8000-5sec.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0005, value:0008
ssm2602_write, reg: 0005, value: 0008
ssm2602_write, reg << 1: 000A
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 0A, 08
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0009, value:0000
ssm2602_write, reg: 0009, value: 0000
ssm2602_write, reg << 1: 0012
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 12, 00
root:/tmp>
root:/tmp> ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0006, value:0050
ssm2602_write, reg: 0006, value: 0050
ssm2602_write, reg << 1: 000C
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 0C, 50
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0006, value:0058
ssm2602_write, reg: 0006, value: 0058
ssm2602_write, reg << 1: 000C
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 0C, 58
ssm2602_write()
ssm2602 - write_reg_cache()
reg: 0006, value:0058
ssm2602_write, reg: 0006, value: 0058
ssm2602_write, reg << 1: 000C
ssm2602_write, value >> 8: 0000
ssm2602_write, data: 0C, 58
QuoteReplyEditDelete
2010-03-15 16:44:34 Re: SSM2602/3 Driver Question
Tom Hoover (UNITED STATES)
Message: 87216
Yi -
Also, the capture gain is working. If I use the command line "amixer sset 'Capture' xx% it does change the gain.
Looking at the datasheet more, we really want control of all the registers in the chip. We need to be able to specify positive or negative gains. Would like to be able to control the AGC, Noice gate.
Another item, we are using the channels independently. Only the right channel is active at this time. The left channel in for later expansion.
Tom
QuoteReplyEditDelete
2010-03-16 01:20:38 Re: SSM2602/3 Driver Question
Cliff Cai (CHINA)
Message: 87226
Hi Tom,
Which chip do you use?I just tested the driver with ssm2603,it worked fine with playback volume controlling.
also it's easy to control every register if we expose it to user space by amixer control item like 'Master' 'Capture'...
see "ssm2602_snd_controls" in ssm2602.c
Cliff
QuoteReplyEditDelete
2010-03-16 09:31:42 Re: SSM2602/3 Driver Question
Tom Hoover (UNITED STATES)
Message: 87257
Cliff,
I'm using the ssm2603. I'll look at the driver. Is there an amixer command to enable the master volume control that I am missing? It's puzzles me that other controls seem to be working fine.
Also, I'm running the 2009 r1.1, rc4 release. I've got a svn copy of trunk as well, but am not activly using it. Could there be fixes I'm missing?
Tom
QuoteReplyEditDelete
2010-03-16 22:56:19 Re: SSM2602/3 Driver Question
Cliff Cai (CHINA)
Message: 87297
Tom,
I just used the same command as yours'.
I guess I need to clarify someting about the volume control register of playback.
According to the datasheet,when the volume value of 0x02/0x03 is less than 48(0011 0000) the playback is muted.
that means when 'Master ' is set a value less than 48/127*100%(around 38%) the playback is muted.
also the value is dB linear,So, IMO,it's not a good way to set/show it as a xx% way.
Cliff