summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorShreshtha Sahu <ssahu@nvidia.com>2014-03-10 16:36:36 +0530
committerLaxman Dewangan <ldewangan@nvidia.com>2014-03-20 05:17:14 -0700
commit88e46dc200bfc0a0f6577d3153a7d800ae40b0aa (patch)
tree84660cb7393046aadf833b6319f973037611c1e2 /sound
parent924ae1e4fc8afb1b5d8c071012e86ba28f1c312c (diff)
soc: codecs: max98090: Add DT support
Add DT supports for MAX98090. Bug 1377308 Change-Id: I316e4df7b12b20b7f546ef949acde2ae4ee36ae3 Signed-off-by: Shreshtha Sahu <ssahu@nvidia.com> Reviewed-on: http://git-master/r/362682 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/max98090.c42
1 files changed, 37 insertions, 5 deletions
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index db65db932c4e..6cb4102c41c0 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -17,6 +17,7 @@
#include <sound/soc.h>
#include <sound/tlv.h>
#include <sound/max98090.h>
+#include <linux/gpio.h>
#include "max98090.h"
#include <linux/version.h>
@@ -3614,8 +3615,30 @@ static void max98090_handle_pdata(struct snd_soc_codec *codec)
struct max98090_pdata *pdata = max98090->pdata;
if (!pdata) {
- dev_dbg(codec->dev, "No platform data\n");
- return;
+ struct device_node *np = codec->dev->of_node;
+ int digmic_left_mode = 0;
+ int digmic_right_mode = 0;
+
+ pdata = max98090->pdata = devm_kzalloc(codec->dev,
+ sizeof(struct max98090_pdata), GFP_KERNEL);
+ if (!max98090->pdata) {
+ dev_err(codec->dev, "no mmemory for platform data\n");
+ return;
+ }
+
+ pdata->eq_cfg = devm_kzalloc(codec->dev,
+ sizeof(struct max98090_eq_cfg), GFP_KERNEL);
+ if (!pdata->eq_cfg) {
+ dev_err(codec->dev, "no mmemory for platform data\n");
+ return;
+ }
+
+ of_property_read_u32(np, "maxim,digmic-left-mode",
+ &digmic_left_mode);
+ of_property_read_u32(np, "maxim,digmic-right-mode",
+ &digmic_right_mode);
+ pdata->digmic_left_mode = digmic_left_mode;
+ pdata->digmic_right_mode = digmic_right_mode;
}
max98090_dmic_switch(codec, 1);
@@ -3666,10 +3689,19 @@ static int max98090_probe(struct snd_soc_codec *codec)
struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
struct max98090_pdata *pdata = max98090->pdata;
struct max98090_cdata *cdata;
+ struct device_node *np = NULL;
+ int audio_int = 0;
int ret = 0;
dev_info(codec->dev, "max98090_probe\n");
+ if (pdata && pdata->irq)
+ audio_int = pdata->irq;
+ else {
+ np = codec->dev->of_node;
+ of_property_read_u32(np, "maxim,audio-int", &audio_int);
+ }
+
max98090->codec = codec;
codec->dapm.idle_bias_off = 1;
@@ -3728,8 +3760,10 @@ static int max98090_probe(struct snd_soc_codec *codec)
snd_soc_write(codec, M98090_REG_3D_CFG_JACK,
M98090_JDETEN_MASK | M98090_JDEB_25MS);
+ max98090_handle_pdata(codec);
+
/* Register for interrupts */
- if ((request_threaded_irq(pdata->irq, NULL,
+ if ((request_threaded_irq(audio_int, NULL,
max98090_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"max98090_interrupt", codec)) < 0) {
dev_info(codec->dev, "request_irq failed\n");
@@ -3763,8 +3797,6 @@ static int max98090_probe(struct snd_soc_codec *codec)
snd_soc_write(codec, M98090_REG_42_BIAS_CNTL,
M98090_VCM_MODE_MASK);
- max98090_handle_pdata(codec);
-
max98090_add_widgets(codec);
err_access: