Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99136
b: refs/heads/master
c: e2be2cc
h: refs/heads/master
v: v3
  • Loading branch information
Jarkko Nikula authored and Jaroslav Kysela committed Jun 26, 2008
1 parent 95dbf9c commit 8f5d154
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a5c95e90c1baa9c1114875264bbd283526eb8377
refs/heads/master: e2be2ccf9416bb4e0eb5f851967e79261f41d7e5
14 changes: 14 additions & 0 deletions trunk/include/sound/soc-dapm.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@
{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \
.shift = wshift, .invert = winvert}

/* generic register modifier widget */
#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \
{ .id = wid, .name = wname, .kcontrols = NULL, .num_kcontrols = 0, \
.reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \
.on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \
.event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD}

/* dapm kcontrol types */
#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
Expand Down Expand Up @@ -227,6 +234,10 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev,
/* dapm sys fs - used by the core */
int snd_soc_dapm_sys_add(struct device *dev);

/* event handler for register modifier widget - used by the soc-dapm */
int dapm_reg_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event);

/* dapm audio endpoint control */
int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec,
char *pin, int status);
Expand Down Expand Up @@ -298,6 +309,9 @@ struct snd_soc_dapm_widget {
unsigned char shift; /* bits to shift */
unsigned int saved_value; /* widget saved value */
unsigned int value; /* widget current value */
unsigned int mask; /* non-shifted mask */
unsigned int on_val; /* on state value */
unsigned int off_val; /* off state value */
unsigned char power:1; /* block power status */
unsigned char invert:1; /* invert the power bit */
unsigned char active:1; /* active stream on DAC, ADC's */
Expand Down
19 changes: 19 additions & 0 deletions trunk/sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,25 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget)
return con;
}

/*
* Handler for generic register modifier widget.
*/
int dapm_reg_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
unsigned int val;

if (SND_SOC_DAPM_EVENT_ON(event))
val = w->on_val;
else
val = w->off_val;

snd_soc_update_bits(w->codec, -(w->reg + 1),
w->mask << w->shift, val << w->shift);

return 0;
}

/*
* Scan each dapm widget for complete audio path.
* A complete path is a route that has valid endpoints i.e.:-
Expand Down

0 comments on commit 8f5d154

Please sign in to comment.