Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
resources:tools-software:linux-drivers:sound:ssm2602 [22 Aug 2011 16:41] – fix previous changeset Lars-Peter Clausenresources:tools-software:linux-drivers:sound:ssm2602 [19 Jan 2021 08:46] (current) – [Testing Audio] Michael Hennerich
Line 1: Line 1:
-====== SSM2602 driver ======+====== SSM2602 Sound CODEC Linux Driver ======
  
 ===== Supported Devices ===== ===== Supported Devices =====
  
-This driver supports the +  * [[adi>SSM2602]] 
-[[adi>SSM2602]] +  [[adi>SSM2603]] 
-[[adi>SSM2603]] +  [[adi>SSM2604]] 
-[[adi>SSM2604]]+ 
 +===== Evaluation Boards ===== 
 + 
 +  * [[adi>SSM2603-EVALZ]] 
 +  * [[adi>SSM2604-EVALZ]] 
 + 
 +===== Reference Circuits ===== 
 + 
 +  * [[adi>CN0282]] 
 + 
 +====== Source Code ====== 
 + 
 +==== Status ==== 
 + 
 +^ Source ^ Mainlined? ^ 
 +| [[git.linux.org>sound/soc/codecs/ssm2602.c|git]] | [[git.linux.org>sound/soc/codecs/ssm2602.c|Yes]] | 
 + 
 +==== Files ==== 
 + 
 +^ Function ^ File ^ 
 +| driver  | [[git.linux.org>sound/soc/codecs/ssm2602.c]] | 
 +| include | [[git.linux.org>sound/soc/codecs/ssm2602.h]] | 
 +====== Example device initialization ====== 
 + 
 +{{page>software/linux/docs/platform_and_bus_model#Platform Data&noheader&firstseconly&noeditbtn}} 
 + 
 +==== SPI ==== 
 + 
 +SPI can be used for the SSM2602 if in SPI mode (MODE pin set to 1). 
 + 
 +{{page>software/linux/docs/platform_and_bus_model#Declaring SPI slave devices&firstseconly&noeditbtn}} 
 + 
 +<code c> 
 +static struct spi_board_info board_spi_board_info[] __initdata = { 
 + [--snip--] 
 +
 + .modalias = "ssm2602", 
 + .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */ 
 + .bus_num = 0, 
 + .chip_select = GPIO_PF10 + MAX_CTRL_CS, /* CS, change it for your board */ 
 + .mode = SPI_MODE_3, 
 + }, 
 + [--snip--] 
 +}; 
 +</code> 
 + 
 +<code c> 
 +static int __init board_init(void) 
 +
 + [--snip--] 
 + 
 + spi_register_board_info(board_spi_board_info, ARRAY_SIZE(board_spi_board_info)); 
 + 
 + [--snip--] 
 + 
 + return 0; 
 +
 +arch_initcall(board_init); 
 +</code> 
 + 
 +==== I2C ==== 
 + 
 +I2C can be used for the SSM2602, SSM2603, SSM2604. For the SSM2602 make sure that it is in I2C mode (MODE pin set to 0). 
 + 
 +{{page>software/linux/docs/platform_and_bus_model#Declaring I2C devices&firstseconly&noeditbtn}} 
 + 
 +<code c> 
 +static struct i2c_board_info __initdata bfin_i2c_board_info[] = { 
 + 
 + [--snip--] 
 +
 + I2C_BOARD_INFO("ssm2604", 0x1b), 
 + }, 
 + [--snip--] 
 +
 + 
 +</code> 
 + 
 +<code c> 
 +static int __init stamp_init(void) 
 +
 + [--snip--] 
 + i2c_register_board_info(0, bfin_i2c_board_info, 
 + ARRAY_SIZE(bfin_i2c_board_info)); 
 + [--snip--] 
 + 
 + return 0; 
 +
 +arch_initcall(board_init); 
 +</code> 
 + 
 +===== ASoC DAPM Widgets ===== 
 + 
 +^ Name ^ Description ^ Model ^ 
 +| LOUT | Line Output for Left Channel | SSM2602, SSM2603, SSM2604 | 
 +| ROUT | Line Output for Right Channel | SSM2602, SSM2603, SSM2604 | 
 +| LLINEIN | Line Input for Left Channel | SSM2602, SSM2603, SSM2604 | 
 +| RLINEIN | Line Input for Right Channel | SSM2602, SSM2603, SSM2604 | 
 +| LHPOUT | Headphone Output for Left Channel | SSM2602, SSM2603 | 
 +| RHPOUT | Headphone Output for Right Channel | SSM2602, SSM2603 | 
 +| MICIN | Microphone Input Signal | SSM2602, SSM2603 | 
 + 
 +===== ALSA Controls ===== 
 + 
 +^ Name ^ Description ^ Model ^ 
 +| Capture Volume | Line Input PGA Volume | SSM2602, SSM2603, SSM2604 | 
 +| Capture Switch | Mute/Unmute Line Input signal | SSM2602, SSM2603, SSM2604 | 
 +| ADC High Pass Filter Switch | Enable/Disable ADC high-pass filter | SSM2602, SSM2603, SSM2604 | 
 +| Store DC Offset Switch | Store dc offset when high-pass filter is disabled | SSM2602, SSM2603, SSM2604 | 
 +| Playback De-emphasis | Select playback de-emphasis. Possible values: "None", "32Khz", "44.1Khz", "48Khz" | SSM2602, SSM2603, SSM2604 | 
 +| Master Playback Volume | Headphone volume | SSM2602, SSM2603 | 
 +| Master Playback ZC Switch | Enable/Disable zero cross detection for the playback volume | SSM2602, SSM2603 | 
 +| Sidetone Playback Volume | Microphone sidetone gain control | SSM2602, SSM2603 | 
 +| Mic Boost (+20dB) | Primary microphone amplifier gain booster control. | SSM2602, SSM2603 | 
 +| Mic Boost2 (+20dB) | Additional microphone amplifier gain booster control. | SSM2602, SSM2603 | 
 +| Mic Switch | Mute/Unmute the Microphone signal | SSM2602, SSM2603 | 
 +| Output Mixer Line Bypass Switch | Mix Line Input signal into the output signal | SSM2602, SSM2603, SSM2604 | 
 +| Output Mixer HiFi Playback Switch | Mix DAC signal into the output signal | SSM2602, SSM2603, SSM2604 | 
 +| Output Mixer Mic Sidetone Switch | Mix Microphone signal into the output signal | SSM2602, SSM2603 | 
 +| Input Select | Select the ADC input signal. Possible values: "Line", "Mic" | SSM2602, SSM2603 | 
 + 
 + 
 +===== DAI configuration ===== 
 + 
 +The codec driver registers one DAI named **"ssm2602-hifi"**. 
 + 
 +==== Supported DAI formats ==== 
 + 
 +^ Name ^ Supported by driver ^ Description ^ 
 +| SND_SOC_DAIFMT_I2S     | yes | I2S mode | 
 +| SND_SOC_DAIFMT_RIGHT_J | yes | Right Justified mode | 
 +| SND_SOC_DAIFMT_LEFT_J  | yes | Left Justified mode  | 
 +| SND_SOC_DAIFMT_DSP_A   | yes | data MSB after FRM LRC | 
 +| SND_SOC_DAIFMT_DSP_B   | yes | data MSB during FRM LRC  | 
 +| SND_SOC_DAIFMT_AC97    | no  | AC97 mode | 
 +| SND_SOC_DAIFMT_PDM     | no  | Pulse density modulation | 
 +| | | 
 +| SND_SOC_DAIFMT_NB_NF | yes  | Normal bit- and frameclock | 
 +| SND_SOC_DAIFMT_NB_IF | yes | Normal bitclock, inverted frameclock | 
 +| SND_SOC_DAIFMT_IB_NF | yes | Inverted frameclock, normal bitclock | 
 +| SND_SOC_DAIFMT_IB_IF | yes | Inverted bit- and frameclock | 
 +| | | 
 +| SND_SOC_DAIFMT_CBM_CFM | yes | Codec bit- and frameclock master | 
 +| SND_SOC_DAIFMT_CBS_CFM | no  | Codec bitclock slave, frameclock master | 
 +| SND_SOC_DAIFMT_CBM_CFS | no  | Codec bitclock master, frameclock slave | 
 +| SND_SOC_DAIFMT_CBS_CFS | yes | Codec bit- and frameclock slave | 
 + 
 +==== Supported SYSCLK rates ==== 
 + 
 +The codecs system clock can be configured for various input rates. When configuring the codec system clock use SSM2602_SYSCLK for the clock id. 
 + 
 +The following list contains the supported system clock rates and their resulting sample-rates. 
 +^ SYSCLK ^ Supported sample-rates ^ 
 +| 11289600 | 8kHz, 44.1kHz 88.2kHz | 
 +| 12000000 | 8kHz, 32kHz, 44.1kHz 48kHz, 88.2kHz, 96kHz | 
 +| 12288000 | 8kHz, 32kHz, 48kHz, 96kHz | 
 +| 16934400 | 8kHz, 44.1kHz, 88.2kHz | 
 +| 18432000 | 8kHz, 32kHz, 48kHz, 96kHz | 
 + 
 +==== Example DAI configuration ==== 
 + 
 +<code c> 
 +static struct snd_soc_card bf5xx_ssm2602; 
 + 
 +static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream, 
 + struct snd_pcm_hw_params *params) 
 +
 + struct snd_soc_pcm_runtime *rtd = substream->private_data; 
 + struct snd_soc_dai *codec_dai = rtd->codec_dai; 
 + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 
 + int ret; 
 + 
 + ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | 
 + SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); 
 + if (ret < 0) 
 + return ret; 
 + 
 + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | 
 + SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); 
 + if (ret < 0) 
 + return ret; 
 + 
 + ret = snd_soc_dai_set_sysclk(codec_dai, SSM2602_SYSCLK, 12000000, 
 + SND_SOC_CLOCK_IN); 
 + if (ret < 0) 
 + return ret; 
 + 
 + return 0; 
 +
 + 
 +static struct snd_soc_ops bf5xx_ssm2602_ops = { 
 + .hw_params = bf5xx_ssm2602_hw_params, 
 +}; 
 + 
 +static struct snd_soc_dai_link bf5xx_ssm2602_dai_link[] = { 
 +
 + .name = "ssm2602", 
 + .stream_name = "SSM2602", 
 + .cpu_dai_name = "bfin-i2s.0", 
 + .codec_dai_name = "ssm2602-hifi", 
 + .platform_name = "bfin-i2s-pcm-audio", 
 + .codec_name = "ssm2602.0-001b", 
 + .ops = &bf5xx_ssm2602_ops, 
 + }, 
 +}; 
 +</code> 
 + 
 +====== SSM2604 evaluation board driver ======
  
 ===== Source ===== ===== Source =====
Line 12: Line 219:
 ==== Status ==== ==== Status ====
  
- Source   Mainlined?  +^ Source ^ Mainlined? ^ 
-| [[bfgit>linux-kernel?sound/soc/codecs/ssm2602.c|git]] |  [[git.linux.org>sound/soc/codecs/ssm2602.c|git]] |+| [[bfgit>linux-kernel?sound/soc/blackfin/bf5xx-ssm2602.c|git]] | [[git.linux.org>sound/soc/blackfin/bf5xx-ssm2602.c|Yes]] |
  
-==== As a Module ====+===== As a Module =====
  
-To add support for the built-in codec SSM2602 of BF52xC to the kernel build system, a few things must be enabled properly for things to work.The structure of the driver has been changed after 2008R1.5, so things are a bit different from then on.The configuration is as following:     +To add support for the built-in codec SSM2602 of BF52xC to the kernel build system, a few things must be enabled properly for things to work. The configuration is as following:     
  
 <code> <code>
 Linux Kernel Configuration Linux Kernel Configuration
   Device Drivers  --->    Device Drivers  ---> 
-    Sound  --->  +      <M> Sound card support ---> 
-      <M> Sound card support +        <M> Advanced Linux Sound Architecture  --->
-        Advanced Linux Sound Architecture  ---> +
-          <M> Advanced Linux Sound Architecture+
           < > Sequencer support           < > Sequencer support
           <M> OSS Mixer API            <M> OSS Mixer API 
           <M> OSS PCM (digital audio) API           <M> OSS PCM (digital audio) API
- +          <M> ALSA for SoC audio support  --->
-          Codec configuration for releases 2008R1/1.5: +
-          System on Chip audio support  ---> +
-            <M> ALSA for SoC audio support +
-            <M> SoC Audio for ADI BF5xx chip  +
-            [*] Enable MMAP Support +
-            <M> SoC SSM2602 Audio support for BF52x ezkit +
-            < > SoC AC97 Audio support for BF5xx  +
-            (0) Set a SPORT for Sound chip +
- +
-          Codec configuration for releases after 2008R1.5: +
-          System on Chip audio support  ---> +
-            <M> ALSA for SoC audio support+
             <M> SoC I2S Audio for the ADI BF5xx chip              <M> SoC I2S Audio for the ADI BF5xx chip 
-            <M> SoC SSM2602 Audio support for BF52x ezkit +              <M> SoC SSM2602 Audio support for BF52x ezkit
             < > SoC AC97 Audio support for BF5xx              < > SoC AC97 Audio support for BF5xx 
-            (0x1b) I2c address to SSM2602 on a BF527 
             (0) Set a SPORT for Sound chip             (0) Set a SPORT for Sound chip
 </code> </code>
  
-<note important>+<WRAP important>
 I2C bus is used to configure the codec.  So, if the audio driver is built into kernel, the I2c driver is also built into kernel automatically.  But if the audio driver is built as module, then make sure that the I2C driver is loaded before the audio module.   I2C bus is used to configure the codec.  So, if the audio driver is built into kernel, the I2c driver is also built into kernel automatically.  But if the audio driver is built as module, then make sure that the I2C driver is loaded before the audio module.  
-</note>+</WRAP>
  
 <code> <code>
Line 65: Line 257:
  
  
-==== Testing the built in kernel driver ====+===== Testing the built in kernel driver =====
  
 If audio is configured as modules, skip this section. If audio is built into kernel and you have booted the kernel, there are a few things to check to ensure audio is working: If audio is configured as modules, skip this section. If audio is built into kernel and you have booted the kernel, there are a few things to check to ensure audio is working:
Line 79: Line 271:
 </code> </code>
  
-==== Testing the audio module ====+===== Testing the audio module =====
  
 <xterm>root:~> **modprobe snd-ssm2602** <xterm>root:~> **modprobe snd-ssm2602**
Line 101: Line 293:
 TONE: generating sine wave at 1000 Hz... TONE: generating sine wave at 1000 Hz...
 </xterm> </xterm>
- 
  
 ===== Testing Audio ===== ===== Testing Audio =====
Line 114: Line 305:
   Item0: 'Mic'</xterm> Also you can run "alsamixer" to get graphic configuration interface, OSS-based "mixer" can work too.   Item0: 'Mic'</xterm> Also you can run "alsamixer" to get graphic configuration interface, OSS-based "mixer" can work too.
   - Check to make sure mp3s work (assuming you have built mp3play),   - Check to make sure mp3s work (assuming you have built mp3play),
-    - The first step is to download a mp3 file onto the platform. The ''wget'' command assumes that networking is properly configured (you have an IP number, the default gateway is set, and DNS servers can be accessed), and working. See the [[:setting_up_the_network|network setup page]] for more info. <xterm>root:/> **cd /var**+    - The first step is to download a mp3 file onto the platform. The ''wget'' command assumes that networking is properly configured (you have an IP number, the default gateway is set, and DNS servers can be accessed), and working. <xterm>root:/> **cd /var**
 root:/var> **wget http://www.radiocrazy.com/shows/A/AbbottCostello/ABCOWhosOnFirstclip.mp3** root:/var> **wget http://www.radiocrazy.com/shows/A/AbbottCostello/ABCOWhosOnFirstclip.mp3**
 </xterm> </xterm>
Line 133: Line 324:
  
  
-==== Debugging ==== 
-Most of the time, and issues we have seen have been tracked down to proper switch settings, which are detailed on [[hw:boards:bf527-ezkit]] getting started. 
  
-==== ASoC DAPM Widgets ===== 
- 
-^ Name ^  Description ^ Model ^ 
-| LOUT | Line Output for Left Channel | SSM2602, SSM2603, SSM2604 | 
-| ROUT | Line Output for Right Channel | SSM2602, SSM2603, SSM2604 | 
-| LLINEIN | Line Input for Left Channel | SSM2602, SSM2603, SSM2604 | 
-| RLINEIN | Line Input for Right Channel | SSM2602, SSM2603, SSM2604 | 
-| LHPOUT | Headphone Output for Left Channel | SSM2602, SSM2603 | 
-| RHPOUT | Headphone Output for Right Channel | SSM2602, SSM2603 | 
-| MICIN | Microphone Input Signal | SSM2602, SSM2603 | 
- 
-==== ALSA Controls ==== 
-^ Name ^  Description ^ Model ^ 
-| Capture Volume | Line Input PGA Volume | SSM2602, SSM2603, SSM2604 | 
-| Capture Switch | Mute/Unmute Line Input signal | SSM2602, SSM2603, SSM2604 | 
-| ADC High Pass Filter Switch | Enable/Disable ADC high-pass filter | SSM2602, SSM2603, SSM2604 | 
-| Store DC Offset Switch | Store dc offset when high-pass filter is disabled | SSM2602, SSM2603, SSM2604 | 
-| Playback De-emphasis | Select playback de-emphasis. Possible values: "None", "32Khz", "44.1Khz", "48Khz" | SSM2602, SSM2603, SSM2604 | 
-| Master Playback Volume | Headphone volume | SSM2602, SSM2603 | 
-| Master Playback ZC Switch | Enable/Disable zero cross detection for the playback volume | SSM2602, SSM2603 | 
-| Sidetone Playback Volume | Microphone sidetone gain control | SSM2602, SSM2603 | 
-| Mic Boost (+20dB) | Primary microphone amplifier gain booster control. | SSM2602, SSM2603 | 
-| Mic Boost2 (+20dB) | Additional microphone amplifier gain booster control. | SSM2602, SSM2603 | 
-| Mic Switch | Mute/Unmute the Microphone signal | SSM2602, SSM2603 | 
-| Output Mixer Line Bypass Switch | Mix Line Input signal into the output signal | SSM2602, SSM2603, SSM2604 | 
-| Output Mixer HiFi Playback Switch | Mix DAC signal into the output signal | SSM2602, SSM2603, SSM2604 | 
-| Output Mixer Mic Sidetone Switch | Mix Microphone signal into the output signal | SSM2602, SSM2603 | 
-| Input Select | Select the ADC input signal. Possible values: "Line", "Mic" | SSM2602, SSM2603 | 
resources/tools-software/linux-drivers/sound/ssm2602.1314024118.txt.gz · Last modified: 22 Aug 2011 16:41 by Lars-Peter Clausen