Chinaunix首页 | 论坛 | 博客
  • 博客访问: 478708
  • 博文数量: 285
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 629
  • 用 户 组: 普通用户
  • 注册时间: 2013-10-14 17:53
个人简介

相信自己,快乐每一天

文章分类

全部博文(285)

分类: LINUX

2013-10-18 14:47:16

ASoC jack detection
ASoC插口探测
===================

ALSA has a standard API for representing physical jacks to user space,
the kernel side of which can be seen in include/sound/jack.h.  ASoC
provides a version of this API adding two additional features:
ALSA对标准的API用以向用户空间提供物理插口,内核层面上的API可见于include/sound/jack.h.ASoC提供的这种API的一个版本增加了两个特性

- It allows more than one jack detection method to work together on one
   user visible jack.  In embedded systems it is common for multiple
   to be present on a single jack but handled by separate bits of
   hardware.
-它可以允许在一个用户可见插口上有多于一个插口探测方法共同工作。在嵌入式系统中,不同硬件的复用表示为一个单独的插口是很常见的。

- Integration with DAPM, allowing DAPM endpoints to be updated
   automatically based on the detected jack status (eg, turning off the
   headphone outputs if no headphones are present).
-与DAPM集成,允许DAPM端点根据检测到的插口状态自动升级(如:关闭耳机输出则不显示耳机)。

This is done by splitting the jacks up into three things working
together: the jack itself represented by a struct snd_soc_jack, sets of
snd_soc_jack_pins representing DAPM endpoints to update and blocks of
code providing jack reporting mechanisms.
我们通过把插口分为三个协同工作的部分而完成这一工作:插口本身表示为一个snd_soc_jack结构,几组snd_soc_jack_pins表示SAPM端点来更新而且有一大堆代码提供插口报告机制。

For example, a system may have a stereo headset jack with two reporting
mechanisms, one for the headphone and one for the microphone.  Some
systems won't be able to use their speaker output while a headphone is
connected and so will want to make sure to update both speaker and
headphone when the headphone jack status changes.
例如,一个系统可以有一个立体声耳麦插口,代有两个报告机制。耳机一个,麦克一个。有些系统在耳机连着的时候不允许扬声器发声,所以要保证当耳机插口状态改变时扬声器和耳机都要更新。

The jack - struct snd_soc_jack
插口-snd_soc_jack结构体
==============================

This represents a physical jack on the system and is what is visible to
user space.  The jack itself is completely passive, it is set up by the
machine driver and updated by jack detection methods.
这表示系统的一个物理插口,而且对用户空间可见。插口本身是完全被动的,它由机器驱动启动,由插口探测方法更新。


Jacks are created by the machine driver calling snd_soc_jack_new().
机器驱动调用snd_soc_jack_new()时插口建立。

snd_soc_jack_pin
snd_soc_jack_pin结构体
================

These represent a DAPM pin to update depending on some of the status
bits supported by the jack.  Each snd_soc_jack has zero or more of these
which are updated automatically.  They are created by the machine driver
and associated with the jack using snd_soc_jack_add_pins().  The status
of the endpoint may configured to be the opposite of the jack status if
required (eg, enabling a built in microphone if a microphone is not
connected via a jack).
这代表DAPM引脚根据插口支持的一些状态位进行更新。每个snd_soc_jack有0个或更多的snd_soc_jack_pin可以自动更新。 它们由机器驱动创建并且通过snd_soc_jack_add_pins()函数与插口相联系。需要的话,端点状态位可以设置为与插口状态相反(如:当没有插入耳机时使能一个内嵌的耳机)。


Jack detection methods
插口探测方法
======================

Actual jack detection is done by code which is able to monitor some
input to the system and update a jack by calling snd_soc_jack_report(),
specifying a subset of bits to update.  The jack detection code should
be set up by the machine driver, taking configuration for the jack to
update and the set of things to report when the jack is connected.
实际上的插口探测是由代码完成的。这些代码可以指示一些系统输入而且通过调过snd_soc_jack_report()来更新插口,使一些位的子集更新状态。插口探测代码应由机器驱动设定,配置插口更新和插口连接时报告一系列的事情。

Often this is done based on the status of a GPIO - a handler for this is
provided by the snd_soc_jack_add_gpio() function.  Other methods are
also available, for example integrated into CODECs.  One example of
CODEC integrated jack detection can be see in the WM8350 driver.
通常,这些的完成要基于一个GPIO的状态-它的句柄是有snd_soc_jack_add_gpio()函数提供的。还有一些别的方法可用,如集成在解码器里的。解码器集成的插口探测的一个例子可以在wm8350驱动中见到。

Each jack may have multiple reporting mechanisms, though it will need at
least one to be useful.
每个插口可以有多个报告机制,其中至少要有一个是有用的。

Machine drivers
机器驱动
===============

These are all hooked together by the machine driver depending on the
system hardware.  The machine driver will set up the snd_soc_jack and
the list of pins to update then set up one or more jack detection
mechanisms to update that jack based on their current status.
这一切都由机器驱动根据系统硬件挂在一起。机器驱动会设置snd_soc_jack和要更新的引脚列表,然后启动一个或多个插口探测机制更新,这些插口是依赖于它们当前的状态的。

君子注:
您现在所阅读的,是君子阅读Linux音频SoC驱动时,写下的文档译文。
君子写些译文,一方面是作为自己的笔记,帮助记忆,另一方面也希望能对他人有所帮助。
如果您能于君子的译文中有所收获,则吾心甚慰。
所有这几个文档原文,是见于linux-2.6.30/Documentation/sound/alsa/soc目录下的全部内容。
由于君子对音频方面的内容了解也不多,很多地方我自己也不理解,只是照着原文生硬的译出来。
其中错误愿来来访者之宾不吝指正。
张君再拜.
下面是所有九篇译文的详细网址,希望能对大家有用:

  1. linux音频alsa-uda134x驱动文档阅读之一(over-view)

  2. linux音频alsa-uda134x驱动文档阅读之二(时钟)

  3. linux音频alsa-uda134x驱动文档阅读之三(解码器)

  4. linux音频alsa-uda134x驱动文档阅读之四(数字音频接口)

  5. linux音频alsa-uda134x驱动文档阅读之五(动态音频电源管理)

  6. linux音频alsa-uda134x驱动文档阅读之六(插口)

  7. linux音频alsa-uda134x驱动文档阅读之七(机器驱动)

  8. linux音频alsa-uda134x驱动文档阅读之八(平台驱动)

  9. linux音频alsa-uda134x驱动文档阅读之九(咔咔声)

阅读(178) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~