Skip to content

Commit

Permalink
ASoC: wm5102: Implement haptics support
Browse files Browse the repository at this point in the history
Provide a haptics widget for use by the haptics driver and expose the DAPM
context for it.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Nov 28, 2012
1 parent 9dd555e commit 3f41e3d
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion sound/soc/codecs/wm5102.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0),

SND_SOC_DAPM_SIGGEN("TONE"),
SND_SOC_DAPM_SIGGEN("NOISE"),
SND_SOC_DAPM_SIGGEN("HAPTICS"),

SND_SOC_DAPM_INPUT("IN1L"),
SND_SOC_DAPM_INPUT("IN1R"),
Expand Down Expand Up @@ -1094,6 +1095,7 @@ SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
{ name, "Noise Generator", "Noise Generator" }, \
{ name, "Tone Generator 1", "Tone Generator 1" }, \
{ name, "Tone Generator 2", "Tone Generator 2" }, \
{ name, "Haptics", "HAPTICS" }, \
{ name, "AEC", "AEC Loopback" }, \
{ name, "IN1L", "IN1L PGA" }, \
{ name, "IN1R", "IN1R PGA" }, \
Expand Down Expand Up @@ -1390,9 +1392,28 @@ static struct snd_soc_dai_driver wm5102_dai[] = {
static int wm5102_codec_probe(struct snd_soc_codec *codec)
{
struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
int ret;

codec->control_data = priv->core.arizona->regmap;
return snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP);

ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP);
if (ret != 0)
return ret;

snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");

priv->core.arizona->dapm = &codec->dapm;

return 0;
}

static int wm5102_codec_remove(struct snd_soc_codec *codec)
{
struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);

priv->core.arizona->dapm = NULL;

return 0;
}

#define WM5102_DIG_VU 0x0200
Expand All @@ -1419,6 +1440,7 @@ static unsigned int wm5102_digital_vu[] = {

static struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
.probe = wm5102_codec_probe,
.remove = wm5102_codec_remove,

.idle_bias_off = true,

Expand Down

0 comments on commit 3f41e3d

Please sign in to comment.