linux-4.4.1/dapm_connect_mux()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#h9baa721]
#backlinks
*説明 [#s2502939]
-パス: [[linux-4.4.1/sound/soc/soc-dapm.c]]
-FIXME: これは何?
--説明
**引数 [#l3c1acbf]
-struct snd_soc_dapm_context *dapm
--
--[[linux-4.4.1/snd_soc_dapm_context]]
-struct snd_soc_dapm_path *path
--
--[[linux-4.4.1/snd_soc_dapm_path]]
-const char *control_name
--
-struct snd_soc_dapm_widget *w
--
--[[linux-4.4.1/snd_soc_dapm_widget]]
**返り値 [#n93dac78]
-int
--
**参考 [#e1c3c59b]
*実装 [#o1af2fba]
/* connect mux widget to its interconnecting audio paths...
static int dapm_connect_mux(struct snd_soc_dapm_context ...
struct snd_soc_dapm_path *path, const char *control_name,
struct snd_soc_dapm_widget *w)
{
const struct snd_kcontrol_new *kcontrol = &w->kcontrol_...
struct soc_enum *e = (struct soc_enum *)kcontrol->priva...
unsigned int val, item;
int i;
-
--[[linux-4.4.1/snd_kcontrol_new]]
--[[linux-4.4.1/soc_enum]]
if (e->reg != SND_SOC_NOPM) {
soc_dapm_read(dapm, e->reg, &val);
val = (val >> e->shift_l) & e->mask;
item = snd_soc_enum_val_to_item(e, val);
} else {
/* since a virtual mux has no backing registers to
* decide which path to connect, it will try to match
* with the first enumeration. This is to ensure
* that the default mux choice (the first) will be
* correctly powered up during initialization.
*/
item = 0;
}
-
--[[linux-4.4.1/soc_dapm_read()]]
--[[linux-4.4.1/snd_soc_enum_val_to_item()]]
for (i = 0; i < e->items; i++) {
if (!(strcmp(control_name, e->texts[i]))) {
path->name = e->texts[i];
-コントロール名と、列挙値の名前が一致していたら、パス名を...
--具体例を書くと、
static const char *sinkaaa_srcsel_text[] = {
"ValueA", "ValueB", "ValueC", //e->texts[i]
};
static SOC_ENUM_SINGLE_DECL(sinkaaa_srcsel_enum,
REG_ADDR, REG_SHIFT,
sinkaaa_srcsel_text);
static const struct snd_kcontrol_new sinkaaa_mux[] = {
SOC_DAPM_ENUM("SinkAAA Source", sinkaaa_srcsel_enum),
};
static const struct snd_soc_dapm_route foo_routes[] = {
// sink control source
// = control_name
{ "SinkAAA", "ValueA", "SourceA" },
{ "SinkAAA", "ValueB", "SourceB" },
{ "SinkAAA", "ValueC", "SourceC" },
//...
};
--snd_soc_dapm_route の control が、この関数の control_na...
if (i == item)
path->connect = 1;
else
path->connect = 0;
return 0;
}
}
return -ENODEV;
}
*コメント [#ca3190d6]
終了行:
*参照元 [#h9baa721]
#backlinks
*説明 [#s2502939]
-パス: [[linux-4.4.1/sound/soc/soc-dapm.c]]
-FIXME: これは何?
--説明
**引数 [#l3c1acbf]
-struct snd_soc_dapm_context *dapm
--
--[[linux-4.4.1/snd_soc_dapm_context]]
-struct snd_soc_dapm_path *path
--
--[[linux-4.4.1/snd_soc_dapm_path]]
-const char *control_name
--
-struct snd_soc_dapm_widget *w
--
--[[linux-4.4.1/snd_soc_dapm_widget]]
**返り値 [#n93dac78]
-int
--
**参考 [#e1c3c59b]
*実装 [#o1af2fba]
/* connect mux widget to its interconnecting audio paths...
static int dapm_connect_mux(struct snd_soc_dapm_context ...
struct snd_soc_dapm_path *path, const char *control_name,
struct snd_soc_dapm_widget *w)
{
const struct snd_kcontrol_new *kcontrol = &w->kcontrol_...
struct soc_enum *e = (struct soc_enum *)kcontrol->priva...
unsigned int val, item;
int i;
-
--[[linux-4.4.1/snd_kcontrol_new]]
--[[linux-4.4.1/soc_enum]]
if (e->reg != SND_SOC_NOPM) {
soc_dapm_read(dapm, e->reg, &val);
val = (val >> e->shift_l) & e->mask;
item = snd_soc_enum_val_to_item(e, val);
} else {
/* since a virtual mux has no backing registers to
* decide which path to connect, it will try to match
* with the first enumeration. This is to ensure
* that the default mux choice (the first) will be
* correctly powered up during initialization.
*/
item = 0;
}
-
--[[linux-4.4.1/soc_dapm_read()]]
--[[linux-4.4.1/snd_soc_enum_val_to_item()]]
for (i = 0; i < e->items; i++) {
if (!(strcmp(control_name, e->texts[i]))) {
path->name = e->texts[i];
-コントロール名と、列挙値の名前が一致していたら、パス名を...
--具体例を書くと、
static const char *sinkaaa_srcsel_text[] = {
"ValueA", "ValueB", "ValueC", //e->texts[i]
};
static SOC_ENUM_SINGLE_DECL(sinkaaa_srcsel_enum,
REG_ADDR, REG_SHIFT,
sinkaaa_srcsel_text);
static const struct snd_kcontrol_new sinkaaa_mux[] = {
SOC_DAPM_ENUM("SinkAAA Source", sinkaaa_srcsel_enum),
};
static const struct snd_soc_dapm_route foo_routes[] = {
// sink control source
// = control_name
{ "SinkAAA", "ValueA", "SourceA" },
{ "SinkAAA", "ValueB", "SourceB" },
{ "SinkAAA", "ValueC", "SourceC" },
//...
};
--snd_soc_dapm_route の control が、この関数の control_na...
if (i == item)
path->connect = 1;
else
path->connect = 0;
return 0;
}
}
return -ENODEV;
}
*コメント [#ca3190d6]
ページ名: