[PATCH] regmap: rbtree: When adding a reg do a bsearch for target node

2015-10-21 Thread Nikesh Oswal
From: Nikesh Oswal 

A binary search is much more efficient rather than iterating
over the rbtree in ascending order which the current code is
doing.

During initialisation the reg defaults are written to the
cache in a large chunk and these are always sorted in the
ascending order so for this situation ideally we should have
iterated the rbtree in descending order.

But at runtime the drivers may write into the cache in any
random order so this patch selects to use a bsearch to give
an optimal runtime performance and also at initialisation
time when reg defaults are written the performance of binary
search would be much better than iterating in ascending order
which the current code was doing.
  
Signed-off-by: Nikesh Oswal 
---
 drivers/base/regmap/regcache-rbtree.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/regcache-rbtree.c 
b/drivers/base/regmap/regcache-rbtree.c
index 56486d9..353f602 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -413,8 +413,8 @@ static int regcache_rbtree_write(struct regmap *map, 
unsigned int reg,
max = reg + max_dist;
 
/* look for an adjacent register to the one we are about to add 
*/
-   for (node = rb_first(_ctx->root); node;
-node = rb_next(node)) {
+   node = rbtree_ctx->root.rb_node;
+   while (node) {
rbnode_tmp = rb_entry(node, struct regcache_rbtree_node,
  node);
 
@@ -425,6 +425,11 @@ static int regcache_rbtree_write(struct regmap *map, 
unsigned int reg,
new_base_reg = min(reg, base_reg);
new_top_reg = max(reg, top_reg);
} else {
+   if (max < base_reg)
+   node = node->rb_left;
+   else
+   node = node->rb_right;
+
continue;
}
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] regmap: rbtree: When adding a reg do a bsearch for target node

2015-10-21 Thread Nikesh Oswal
From: Nikesh Oswal <nikesh.os...@wolfsonmicro.com>

A binary search is much more efficient rather than iterating
over the rbtree in ascending order which the current code is
doing.

During initialisation the reg defaults are written to the
cache in a large chunk and these are always sorted in the
ascending order so for this situation ideally we should have
iterated the rbtree in descending order.

But at runtime the drivers may write into the cache in any
random order so this patch selects to use a bsearch to give
an optimal runtime performance and also at initialisation
time when reg defaults are written the performance of binary
search would be much better than iterating in ascending order
which the current code was doing.
  
Signed-off-by: Nikesh Oswal <nikesh.os...@wolfsonmicro.com>
---
 drivers/base/regmap/regcache-rbtree.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/regcache-rbtree.c 
b/drivers/base/regmap/regcache-rbtree.c
index 56486d9..353f602 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -413,8 +413,8 @@ static int regcache_rbtree_write(struct regmap *map, 
unsigned int reg,
max = reg + max_dist;
 
/* look for an adjacent register to the one we are about to add 
*/
-   for (node = rb_first(_ctx->root); node;
-node = rb_next(node)) {
+   node = rbtree_ctx->root.rb_node;
+   while (node) {
rbnode_tmp = rb_entry(node, struct regcache_rbtree_node,
  node);
 
@@ -425,6 +425,11 @@ static int regcache_rbtree_write(struct regmap *map, 
unsigned int reg,
new_base_reg = min(reg, base_reg);
new_top_reg = max(reg, top_reg);
} else {
+   if (max < base_reg)
+   node = node->rb_left;
+   else
+   node = node->rb_right;
+
continue;
}
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ASoC: dapm: add kcontrol to switch regulator to regulated/bypass state

2015-09-08 Thread Nikesh Oswal
When regulator is defined with SND_SOC_DAPM_REGULATOR_CONTROL_BYPASS
flag, then a kcontrol will be created which can be used to switch
regulator to regulated/bypass state. This will help to control the
behaviour of the regulator based on a usecase. For example voice call
may need a regulated voltage to acheive higher quality whereas voice
trigger may need bypass voltage so as to save on power.

Signed-off-by: Nikesh Oswal 
---
 include/sound/soc-dapm.h |7 +-
 sound/soc/soc-dapm.c |  177 ++
 2 files changed, 183 insertions(+), 1 deletion(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 15717b4..778b847 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -343,7 +343,12 @@ struct device;
(e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD))
 
 /* regulator widget flags */
-#define SND_SOC_DAPM_REGULATOR_BYPASS 0x1 /* bypass when disabled */
+/* bypass when disabled and regulated when enabled */
+#define SND_SOC_DAPM_REGULATOR_BYPASS  0x1
+/* bypass when disabled and regulated when enable by default and a
+   kcontrol is created to explicitly switch between bypass/regulated */
+#define SND_SOC_DAPM_REGULATOR_CONTROL_BYPASS \
+   (SND_SOC_DAPM_REGULATOR_BYPASS | 0x2)
 
 struct snd_soc_dapm_widget;
 enum snd_soc_dapm_type;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 36ab9cb..2d77eb9 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -965,6 +965,180 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+static int snd_soc_dapm_regulator_put(struct snd_kcontrol *kcontrol,
+   struct snd_ctl_elem_value *ucontrol)
+{
+   struct snd_soc_dapm_widget_list *wlist =
+   dapm_kcontrol_get_wlist(kcontrol);
+   struct snd_soc_dapm_widget *widget = wlist->widgets[0];
+   struct snd_soc_card *card = widget->dapm->card;
+   struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
+   unsigned int *item = ucontrol->value.enumerated.item;
+   unsigned int new_val, val;
+   int ret;
+   bool bypass;
+
+   if (item[0] >= e->items)
+   return -EINVAL;
+
+   val = dapm_kcontrol_get_value(kcontrol);
+   new_val = item[0] == 0 ? SND_SOC_DAPM_REGULATOR_BYPASS : 0;
+   bypass = new_val == SND_SOC_DAPM_REGULATOR_BYPASS ? false : true;
+
+   if (new_val != val) {
+   mutex_lock_nested(>dapm_mutex,
+ SND_SOC_DAPM_CLASS_RUNTIME);
+   if (regulator_is_enabled(widget->regulator)) {
+   ret = regulator_allow_bypass(widget->regulator, bypass);
+   if (ret != 0)
+   dev_warn(widget->dapm->dev,
+   "ASoC: Failed to change bypass %s: 
%d\n",
+   widget->name, ret);
+   }
+   dapm_kcontrol_set_value(kcontrol, new_val);
+   widget->on_val = new_val;
+   mutex_unlock(>dapm_mutex);
+   }
+
+   return 0;
+}
+
+static int snd_soc_dapm_regulator_get(struct snd_kcontrol *kcontrol,
+   struct snd_ctl_elem_value *ucontrol)
+{
+   unsigned int val;
+
+   val = dapm_kcontrol_get_value(kcontrol);
+
+   if (val == SND_SOC_DAPM_REGULATOR_BYPASS)
+   ucontrol->value.enumerated.item[0] = 0;
+   else
+   ucontrol->value.enumerated.item[0] = 1;
+
+   return 0;
+}
+
+static const char * const dapm_regulator_texts[] = {
+   "Regulated",
+   "Bypass",
+};
+
+/* create new dapm regulator control */
+static int dapm_new_regulator(struct snd_soc_dapm_widget *w)
+{
+   int ret = 0;
+   struct snd_soc_card *card = w->dapm->card;
+   unsigned long private_value;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_path *path;
+   struct soc_enum regulator_enum[] = {
+   SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(dapm_regulator_texts),
+   dapm_regulator_texts),
+   };
+   struct snd_kcontrol_new kcontrol_regulator[] = {
+   SOC_ENUM_EXT(NULL, regulator_enum[0],
+   snd_soc_dapm_regulator_get,
+   snd_soc_dapm_regulator_put),
+   };
+
+
+   /* kcontrol creation is done only if client requests it */
+   if (w->on_val != SND_SOC_DAPM_REGULATOR_CONTROL_BYPASS)
+   return 0;
+
+
+   /* create a kcontrol only if somebody is sourcing
+  from this regulator widget */
+   if (list_empty(>edges[SND_SOC_DAPM_DIR_IN])) {
+   dev_err(w->dapm->dev, "ASoC: %s has no sinks\n", w->name);
+   return -EINVAL;
+   }
+
+   w->num_kcontrols = 1;
+
+   private_value = (unsigned long) devm_kmemdup(card->dev,
+   

[PATCH] ASoC: make dapm cache search depth configurable

2015-09-08 Thread Nikesh Oswal
cache search depth will have a default value of 2 and can
be modified by the respective component probe function

Signed-off-by: Nikesh Oswal 
---
 include/sound/soc-dapm.h |1 +
 sound/soc/soc-core.c |2 ++
 sound/soc/soc-dapm.c |5 +++--
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 5abba03..15717b4 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -629,6 +629,7 @@ struct snd_soc_dapm_context {
 
struct snd_soc_dapm_wcache path_sink_cache;
struct snd_soc_dapm_wcache path_source_cache;
+   unsigned int cache_search_depth;
 
 #ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_dapm;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 6173d15..1802883 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1595,6 +1595,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card 
*card)
card->dapm.bias_level = SND_SOC_BIAS_OFF;
card->dapm.dev = card->dev;
card->dapm.card = card;
+   card->dapm.cache_search_depth = 2;
list_add(>dapm.list, >dapm_list);
 
 #ifdef CONFIG_DEBUG_FS
@@ -2665,6 +2666,7 @@ static int snd_soc_component_initialize(struct 
snd_soc_component *component,
component->remove = component->driver->remove;
 
dapm = >dapm;
+   dapm->cache_search_depth = 2;
dapm->dev = dev;
dapm->component = component;
dapm->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index f4bf21a..36ab9cb 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -580,11 +580,12 @@ dapm_wcache_lookup(struct snd_soc_dapm_wcache *wcache, 
const char *name)
 {
struct snd_soc_dapm_widget *w = wcache->widget;
struct list_head *wlist;
-   const int depth = 2;
+   int depth;
int i = 0;
 
-   if (w) {
+   if (w && w->dapm->cache_search_depth) {
wlist = >dapm->card->widgets;
+   depth = w->dapm->cache_search_depth;
 
list_for_each_entry_from(w, wlist, list) {
if (!strcmp(name, w->name))
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ASoC: dapm: add kcontrol to switch regulator to regulated/bypass state

2015-09-08 Thread Nikesh Oswal
When regulator is defined with SND_SOC_DAPM_REGULATOR_CONTROL_BYPASS
flag, then a kcontrol will be created which can be used to switch
regulator to regulated/bypass state. This will help to control the
behaviour of the regulator based on a usecase. For example voice call
may need a regulated voltage to acheive higher quality whereas voice
trigger may need bypass voltage so as to save on power.

Signed-off-by: Nikesh Oswal <nik...@opensource.wolfsonmicro.com>
---
 include/sound/soc-dapm.h |7 +-
 sound/soc/soc-dapm.c |  177 ++
 2 files changed, 183 insertions(+), 1 deletion(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 15717b4..778b847 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -343,7 +343,12 @@ struct device;
(e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD))
 
 /* regulator widget flags */
-#define SND_SOC_DAPM_REGULATOR_BYPASS 0x1 /* bypass when disabled */
+/* bypass when disabled and regulated when enabled */
+#define SND_SOC_DAPM_REGULATOR_BYPASS  0x1
+/* bypass when disabled and regulated when enable by default and a
+   kcontrol is created to explicitly switch between bypass/regulated */
+#define SND_SOC_DAPM_REGULATOR_CONTROL_BYPASS \
+   (SND_SOC_DAPM_REGULATOR_BYPASS | 0x2)
 
 struct snd_soc_dapm_widget;
 enum snd_soc_dapm_type;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 36ab9cb..2d77eb9 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -965,6 +965,180 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+static int snd_soc_dapm_regulator_put(struct snd_kcontrol *kcontrol,
+   struct snd_ctl_elem_value *ucontrol)
+{
+   struct snd_soc_dapm_widget_list *wlist =
+   dapm_kcontrol_get_wlist(kcontrol);
+   struct snd_soc_dapm_widget *widget = wlist->widgets[0];
+   struct snd_soc_card *card = widget->dapm->card;
+   struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
+   unsigned int *item = ucontrol->value.enumerated.item;
+   unsigned int new_val, val;
+   int ret;
+   bool bypass;
+
+   if (item[0] >= e->items)
+   return -EINVAL;
+
+   val = dapm_kcontrol_get_value(kcontrol);
+   new_val = item[0] == 0 ? SND_SOC_DAPM_REGULATOR_BYPASS : 0;
+   bypass = new_val == SND_SOC_DAPM_REGULATOR_BYPASS ? false : true;
+
+   if (new_val != val) {
+   mutex_lock_nested(>dapm_mutex,
+ SND_SOC_DAPM_CLASS_RUNTIME);
+   if (regulator_is_enabled(widget->regulator)) {
+   ret = regulator_allow_bypass(widget->regulator, bypass);
+   if (ret != 0)
+   dev_warn(widget->dapm->dev,
+   "ASoC: Failed to change bypass %s: 
%d\n",
+   widget->name, ret);
+   }
+   dapm_kcontrol_set_value(kcontrol, new_val);
+   widget->on_val = new_val;
+   mutex_unlock(>dapm_mutex);
+   }
+
+   return 0;
+}
+
+static int snd_soc_dapm_regulator_get(struct snd_kcontrol *kcontrol,
+   struct snd_ctl_elem_value *ucontrol)
+{
+   unsigned int val;
+
+   val = dapm_kcontrol_get_value(kcontrol);
+
+   if (val == SND_SOC_DAPM_REGULATOR_BYPASS)
+   ucontrol->value.enumerated.item[0] = 0;
+   else
+   ucontrol->value.enumerated.item[0] = 1;
+
+   return 0;
+}
+
+static const char * const dapm_regulator_texts[] = {
+   "Regulated",
+   "Bypass",
+};
+
+/* create new dapm regulator control */
+static int dapm_new_regulator(struct snd_soc_dapm_widget *w)
+{
+   int ret = 0;
+   struct snd_soc_card *card = w->dapm->card;
+   unsigned long private_value;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_path *path;
+   struct soc_enum regulator_enum[] = {
+   SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(dapm_regulator_texts),
+   dapm_regulator_texts),
+   };
+   struct snd_kcontrol_new kcontrol_regulator[] = {
+   SOC_ENUM_EXT(NULL, regulator_enum[0],
+   snd_soc_dapm_regulator_get,
+   snd_soc_dapm_regulator_put),
+   };
+
+
+   /* kcontrol creation is done only if client requests it */
+   if (w->on_val != SND_SOC_DAPM_REGULATOR_CONTROL_BYPASS)
+   return 0;
+
+
+   /* create a kcontrol only if somebody is sourcing
+  from this regulator widget */
+   if (list_empty(>edges[SND_SOC_DAPM_DIR_IN])) {
+   dev_err(w->dapm->dev, "ASoC: %s has no sinks\n", w->name);
+   return -EINVAL;
+   }
+
+   w->num_kcontrols = 1;
+
+   private_value = (unsigned long) 

[PATCH] ASoC: make dapm cache search depth configurable

2015-09-08 Thread Nikesh Oswal
cache search depth will have a default value of 2 and can
be modified by the respective component probe function

Signed-off-by: Nikesh Oswal <nik...@opensource.wolfsonmicro.com>
---
 include/sound/soc-dapm.h |1 +
 sound/soc/soc-core.c |2 ++
 sound/soc/soc-dapm.c |5 +++--
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 5abba03..15717b4 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -629,6 +629,7 @@ struct snd_soc_dapm_context {
 
struct snd_soc_dapm_wcache path_sink_cache;
struct snd_soc_dapm_wcache path_source_cache;
+   unsigned int cache_search_depth;
 
 #ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_dapm;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 6173d15..1802883 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1595,6 +1595,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card 
*card)
card->dapm.bias_level = SND_SOC_BIAS_OFF;
card->dapm.dev = card->dev;
card->dapm.card = card;
+   card->dapm.cache_search_depth = 2;
list_add(>dapm.list, >dapm_list);
 
 #ifdef CONFIG_DEBUG_FS
@@ -2665,6 +2666,7 @@ static int snd_soc_component_initialize(struct 
snd_soc_component *component,
component->remove = component->driver->remove;
 
dapm = >dapm;
+   dapm->cache_search_depth = 2;
dapm->dev = dev;
dapm->component = component;
dapm->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index f4bf21a..36ab9cb 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -580,11 +580,12 @@ dapm_wcache_lookup(struct snd_soc_dapm_wcache *wcache, 
const char *name)
 {
struct snd_soc_dapm_widget *w = wcache->widget;
struct list_head *wlist;
-   const int depth = 2;
+   int depth;
int i = 0;
 
-   if (w) {
+   if (w && w->dapm->cache_search_depth) {
wlist = >dapm->card->widgets;
+   depth = w->dapm->cache_search_depth;
 
list_for_each_entry_from(w, wlist, list) {
if (!strcmp(name, w->name))
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v9] ASoC: dapm: add code to configure dai link parameters

2015-02-02 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal 
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  164 --
 4 files changed, 166 insertions(+), 8 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 5c0a798..a2098e4 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0d1ade1..4636a05 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -941,6 +941,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ededb97..893a6e5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1230,7 +1230,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
@@ -1242,7 +1243,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index bc2d7a0..b0c5951 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -853,6 +853,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w->dapm;
+   struct snd_card *card = dapm->card->snd_card;
+
+   /* create control for links with > 1 config */
+   if (w->num_params <= 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i < w->num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(>kcontrol_news[i], w,
+   w->name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret < 0) {
+   dev_err(dapm->dev,
+   "ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n",
+   w->name, w->kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol->private_data = w;
+   w->kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* We implement power down on suspend by checking the power state of
  * the ALSA card - when we are sus

[PATCH v9] ASoC: dapm: add code to configure dai link parameters

2015-02-02 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  164 --
 4 files changed, 166 insertions(+), 8 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 5c0a798..a2098e4 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0d1ade1..4636a05 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -941,6 +941,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ededb97..893a6e5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1230,7 +1230,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
@@ -1242,7 +1243,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index bc2d7a0..b0c5951 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -853,6 +853,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w-dapm;
+   struct snd_card *card = dapm-card-snd_card;
+
+   /* create control for links with  1 config */
+   if (w-num_params = 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i  w-num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(w-kcontrol_news[i], w,
+   w-name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret  0) {
+   dev_err(dapm-dev,
+   ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n,
+   w-name, w-kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol-private_data = w;
+   w-kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* We implement power down on suspend by checking the power state of
  * the ALSA card - when we are suspending the ALSA state for the card
  * is set to D3.
@@ -2724,6 +2754,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card

[PATCH v8] ASoC: dapm: add code to configure dai link parameters

2015-01-15 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal 
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  155 --
 4 files changed, 157 insertions(+), 8 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 5c0a798..a2098e4 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index edd4a0a..7556885 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -940,6 +940,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ededb97..893a6e5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1230,7 +1230,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
@@ -1242,7 +1243,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index bc2d7a0..286413b 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -853,6 +853,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w->dapm;
+   struct snd_card *card = dapm->card->snd_card;
+
+   /* create control for links with > 1 config */
+   if (w->num_params <= 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i < w->num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(>kcontrol_news[i], w,
+   w->name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret < 0) {
+   dev_err(dapm->dev,
+   "ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n",
+   w->name, w->kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol->private_data = w;
+   w->kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* We implement power down on suspend by checking the power state of
  * the ALSA card - when we are sus

[PATCH v8] ASoC: dapm: add code to configure dai link parameters

2015-01-15 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  155 --
 4 files changed, 157 insertions(+), 8 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 5c0a798..a2098e4 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index edd4a0a..7556885 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -940,6 +940,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ededb97..893a6e5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1230,7 +1230,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
@@ -1242,7 +1243,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index bc2d7a0..286413b 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -853,6 +853,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w-dapm;
+   struct snd_card *card = dapm-card-snd_card;
+
+   /* create control for links with  1 config */
+   if (w-num_params = 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i  w-num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(w-kcontrol_news[i], w,
+   w-name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret  0) {
+   dev_err(dapm-dev,
+   ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n,
+   w-name, w-kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol-private_data = w;
+   w-kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* We implement power down on suspend by checking the power state of
  * the ALSA card - when we are suspending the ALSA state for the card
  * is set to D3.
@@ -2724,6 +2754,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card

[PATCH v7] ASoC: dapm: add code to configure dai link parameters

2014-11-28 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal 
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  154 --
 4 files changed, 157 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 3a4d7da..9b62457 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -533,6 +534,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 7ba7130..db60701 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -942,6 +942,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b60ff56..f4956e3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1292,7 +1292,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
@@ -1304,7 +1305,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index c61cb9c..7e961ca 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -754,6 +754,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w->dapm;
+   struct snd_card *card = dapm->card->snd_card;
+
+   /* skip control creation for links with 1 config */
+   if (w->num_params == 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i < w->num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(>kcontrol_news[i], w,
+   w->name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret < 0) {
+   dev_err(dapm->dev,
+   "ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n",
+   w->name, w->kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol->private_data = w;
+   w->kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   

[PATCH v7] ASoC: dapm: add code to configure dai link parameters

2014-11-28 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  154 --
 4 files changed, 157 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 3a4d7da..9b62457 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -533,6 +534,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 7ba7130..db60701 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -942,6 +942,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b60ff56..f4956e3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1292,7 +1292,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
@@ -1304,7 +1305,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index c61cb9c..7e961ca 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -754,6 +754,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w-dapm;
+   struct snd_card *card = dapm-card-snd_card;
+
+   /* skip control creation for links with 1 config */
+   if (w-num_params == 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i  w-num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(w-kcontrol_news[i], w,
+   w-name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret  0) {
+   dev_err(dapm-dev,
+   ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n,
+   w-name, w-kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol-private_data = w;
+   w-kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   struct list_head *sink)
@@ -2721,6 +2751,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card

Re: [PATCH v6] ASoC: dapm: add code to configure dai link parameters

2014-10-14 Thread Nikesh Oswal
On Fri, Oct 10, 2014 at 05:49:59PM +0100, Mark Brown wrote:
> On Fri, Oct 10, 2014 at 05:17:15PM +0100, Nikesh Oswal wrote:
> > dai-link params for codec-codec links were fixed. The fixed
> > link between codec and another chip which may be another codec,
> > baseband, bluetooth codec etc may require run time configuaration
> > changes. This change provides an optional alsa control to select
> > one of the params from a list of params.
> 
> Has anything changed since the previous version?  I've postponed
> reviewing that until after the merge window given the way you were
> ignoring feedback and the approach of the merge window, is this a new
> version or just a reposting.

>>> Since it was not merged or reviewed since long, I just did a  reposting 
of previous version of the patch
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6] ASoC: dapm: add code to configure dai link parameters

2014-10-14 Thread Nikesh Oswal
On Fri, Oct 10, 2014 at 05:49:59PM +0100, Mark Brown wrote:
 On Fri, Oct 10, 2014 at 05:17:15PM +0100, Nikesh Oswal wrote:
  dai-link params for codec-codec links were fixed. The fixed
  link between codec and another chip which may be another codec,
  baseband, bluetooth codec etc may require run time configuaration
  changes. This change provides an optional alsa control to select
  one of the params from a list of params.
 
 Has anything changed since the previous version?  I've postponed
 reviewing that until after the merge window given the way you were
 ignoring feedback and the approach of the merge window, is this a new
 version or just a reposting.

 Since it was not merged or reviewed since long, I just did a  reposting 
of previous version of the patch
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6] ASoC: dapm: add code to configure dai link parameters

2014-10-10 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal 
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  143 --
 4 files changed, 146 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index aac04ff..20863f2 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -532,6 +533,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index c83a334..a97848f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -926,6 +926,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d074aa9..93850be 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1436,7 +1436,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
@@ -1448,7 +1449,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 177bd86..5f7a342 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -750,6 +750,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w->dapm;
+   struct snd_card *card = dapm->card->snd_card;
+
+   /* skip control creation for links with 1 config */
+   if (w->num_params == 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i < w->num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(>kcontrol_news[i], w,
+   w->name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret < 0) {
+   dev_err(dapm->dev,
+   "ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n",
+   w->name, w->kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol->private_data = w;
+   w->kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   

[PATCH v6] ASoC: dapm: add code to configure dai link parameters

2014-10-10 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  143 --
 4 files changed, 146 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index aac04ff..20863f2 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -532,6 +533,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index c83a334..a97848f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -926,6 +926,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d074aa9..93850be 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1436,7 +1436,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
@@ -1448,7 +1449,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 177bd86..5f7a342 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -750,6 +750,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w-dapm;
+   struct snd_card *card = dapm-card-snd_card;
+
+   /* skip control creation for links with 1 config */
+   if (w-num_params == 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i  w-num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(w-kcontrol_news[i], w,
+   w-name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret  0) {
+   dev_err(dapm-dev,
+   ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n,
+   w-name, w-kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol-private_data = w;
+   w-kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   struct list_head *sink)
@@ -2701,6 +2731,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card

[PATCH v6] ASoC: dapm: add code to configure dai link parameters

2014-09-12 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal 
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  143 --
 4 files changed, 146 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 6b59471..3ee031e 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index ed9e2d7..51c6c4f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -906,6 +906,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b87d7d8..1db2168 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1461,7 +1461,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
@@ -1473,7 +1474,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index cdc837e..68f6057 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -729,6 +729,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w->dapm;
+   struct snd_card *card = dapm->card->snd_card;
+
+   /* skip control creation for links with 1 config */
+   if (w->num_params == 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i < w->num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(>kcontrol_news[i], w,
+   w->name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret < 0) {
+   dev_err(dapm->dev,
+   "ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n",
+   w->name, w->kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol->private_data = w;
+   w->kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   

[PATCH v6] ASoC: dapm: add code to configure dai link parameters

2014-09-12 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  143 --
 4 files changed, 146 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 6b59471..3ee031e 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index ed9e2d7..51c6c4f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -906,6 +906,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b87d7d8..1db2168 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1461,7 +1461,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
@@ -1473,7 +1474,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index cdc837e..68f6057 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -729,6 +729,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w-dapm;
+   struct snd_card *card = dapm-card-snd_card;
+
+   /* skip control creation for links with 1 config */
+   if (w-num_params == 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i  w-num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(w-kcontrol_news[i], w,
+   w-name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret  0) {
+   dev_err(dapm-dev,
+   ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n,
+   w-name, w-kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol-private_data = w;
+   w-kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   struct list_head *sink)
@@ -2664,6 +2694,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card

[PATCH v5] ASoC: dapm: add code to configure dai link parameters

2014-09-11 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal 
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  143 --
 4 files changed, 146 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 6b59471..3ee031e 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index ed9e2d7..51c6c4f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -906,6 +906,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b87d7d8..1db2168 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1461,7 +1461,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
@@ -1473,7 +1474,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index cdc837e..d0323f1 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -729,6 +729,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w->dapm;
+   struct snd_card *card = dapm->card->snd_card;
+
+   /* skip control creation for links with 1 config */
+   if (w->num_params == 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i < w->num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(>kcontrol_news[i], w,
+   w->name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret < 0) {
+   dev_err(dapm->dev,
+   "ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n",
+   w->name, w->kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol->private_data = w;
+   w->kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   

[PATCH v5] ASoC: dapm: add code to configure dai link parameters

2014-09-11 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  143 --
 4 files changed, 146 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 6b59471..3ee031e 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index ed9e2d7..51c6c4f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -906,6 +906,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b87d7d8..1db2168 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1461,7 +1461,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
@@ -1473,7 +1474,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index cdc837e..d0323f1 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -729,6 +729,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w-dapm;
+   struct snd_card *card = dapm-card-snd_card;
+
+   /* skip control creation for links with 1 config */
+   if (w-num_params == 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i  w-num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(w-kcontrol_news[i], w,
+   w-name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret  0) {
+   dev_err(dapm-dev,
+   ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n,
+   w-name, w-kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol-private_data = w;
+   w-kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   struct list_head *sink)
@@ -2664,6 +2694,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card

[PATCH v4] ASOC: dapm: add code to configure dai link parameters

2014-09-01 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal 
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  139 --
 4 files changed, 142 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 6b59471..3ee031e 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index ed9e2d7..51c6c4f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -906,6 +906,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b87d7d8..1db2168 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1461,7 +1461,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
@@ -1473,7 +1474,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index cdc837e..a9c4c2e 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -729,6 +729,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w->dapm;
+   struct snd_card *card = dapm->card->snd_card;
+
+   /* skip control creation for links with 1 config */
+   if (w->num_params == 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i < w->num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(>kcontrol_news[i], w,
+   w->name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret < 0) {
+   dev_err(dapm->dev,
+   "ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n",
+   w->name, w->kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol->private_data = w;
+   w->kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   

[PATCH v4] ASOC: dapm: add code to configure dai link parameters

2014-09-01 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |6 +-
 sound/soc/soc-dapm.c |  139 --
 4 files changed, 142 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 6b59471..3ee031e 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index ed9e2d7..51c6c4f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -906,6 +906,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b87d7d8..1db2168 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1461,7 +1461,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
@@ -1473,7 +1474,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w,
+  play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index cdc837e..a9c4c2e 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -729,6 +729,36 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w-dapm;
+   struct snd_card *card = dapm-card-snd_card;
+
+   /* skip control creation for links with 1 config */
+   if (w-num_params == 1)
+   return 0;
+
+   /* add kcontrol */
+   for (i = 0; i  w-num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(w-kcontrol_news[i], w,
+   w-name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret  0) {
+   dev_err(dapm-dev,
+   ASoC: failed to add widget %s dapm kcontrol 
%s: %d\n,
+   w-name, w-kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol-private_data = w;
+   w-kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   struct list_head *sink)
@@ -2664,6 +2694,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card

[PATCH v2] mfd: wm8994: declare dc servo register for wm8958 as volatile

2014-08-13 Thread Nikesh Oswal
DC Servo register 57h holds the DC offset value after the hardware has
completed the DC Servo Correction, so declare this register as volatile
because it is changed by the hardware.

Signed-off-by: Nikesh Oswal 
---
 drivers/mfd/wm8994-regmap.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/wm8994-regmap.c b/drivers/mfd/wm8994-regmap.c
index 2fbce9c..fa1630d 100644
--- a/drivers/mfd/wm8994-regmap.c
+++ b/drivers/mfd/wm8994-regmap.c
@@ -1169,6 +1169,7 @@ static bool wm8958_volatile_register(struct device *dev, 
unsigned int reg)
case WM8958_FW_MINOR_0:
case WM8958_FW_PATCH_1:
case WM8958_FW_PATCH_0:
+   case WM8994_DC_SERVO_4:
return true;
default:
return wm8994_volatile_register(dev, reg);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ASoC: wm_hubs: Fix DC Servo readback

2014-08-13 Thread Nikesh Oswal
wm_hubs is a common driver code shared by WM8958, WM1811, WM8944
and WM8993 all these codecs have the DC Servo Values either in register
57h or 59h. Current code was reading register 58h for WM8958 and WM8994
revisions 2 and 3 but looking at the data sheet the DC Servo Values are
stored in register 57h for these codecs. This patch fixes it by reading
the correct register for DC Servo

Signed-off-by: Nikesh Oswal 
---
 sound/soc/codecs/wm_hubs.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 916817f..95c5d71 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -210,9 +210,6 @@ static int wm_hubs_read_dc_servo(struct snd_soc_codec 
*codec,
case 2:
dcs_reg = WM8994_DC_SERVO_4E;
break;
-   case 1:
-   dcs_reg = WM8994_DC_SERVO_READBACK;
-   break;
default:
dcs_reg = WM8993_DC_SERVO_3;
break;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mfd: wm8994: declare dc servo register for wm8958 as volatile

2014-08-13 Thread Nikesh Oswal
DC Servo register 57h holds the DC offset value after the hardware has
completed the DC Servo Correction, so declare this register as volatile
because it is changed by the hardware.

Signed-off-by: Nikesh Oswal 
---
 drivers/mfd/wm8994-regmap.c  |1 +
 include/linux/mfd/wm8994/registers.h |1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/mfd/wm8994-regmap.c b/drivers/mfd/wm8994-regmap.c
index 2fbce9c..e775565 100644
--- a/drivers/mfd/wm8994-regmap.c
+++ b/drivers/mfd/wm8994-regmap.c
@@ -1169,6 +1169,7 @@ static bool wm8958_volatile_register(struct device *dev, 
unsigned int reg)
case WM8958_FW_MINOR_0:
case WM8958_FW_PATCH_1:
case WM8958_FW_PATCH_0:
+   case WM8958_DC_SERVO:
return true;
default:
return wm8994_volatile_register(dev, reg);
diff --git a/include/linux/mfd/wm8994/registers.h 
b/include/linux/mfd/wm8994/registers.h
index db8cef3..85b4fec 100644
--- a/include/linux/mfd/wm8994/registers.h
+++ b/include/linux/mfd/wm8994/registers.h
@@ -71,6 +71,7 @@
 #define WM8994_DC_SERVO_1   0x54
 #define WM8994_DC_SERVO_2   0x55
 #define WM8994_DC_SERVO_4   0x57
+#define WM8958_DC_SERVO0x57
 #define WM8994_DC_SERVO_READBACK0x58
 #define WM8994_DC_SERVO_4E 0x59
 #define WM8994_ANALOGUE_HP_10x60
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] ASoC: wm8994: Demux the microphone detection IRQ

2014-08-13 Thread Nikesh Oswal
Current code only allows direct routing of the WM8994 microphone
detection signal to a GPIO this change adds support to demux the
interrupt from the main interrupt line of the codec.

Signed-off-by: Nikesh Oswal 
---
 sound/soc/codecs/wm8994.c |   18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 247b390..557156e 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -4089,17 +4089,23 @@ static int wm8994_codec_probe(struct snd_soc_codec 
*codec)
 
switch (control->type) {
case WM8994:
-   if (wm8994->micdet_irq) {
+   if (wm8994->micdet_irq)
ret = request_threaded_irq(wm8994->micdet_irq, NULL,
   wm8994_mic_irq,
   IRQF_TRIGGER_RISING,
   "Mic1 detect",
   wm8994);
-   if (ret != 0)
-   dev_warn(codec->dev,
-"Failed to request Mic1 detect IRQ: 
%d\n",
-ret);
-   }
+else
+   ret = wm8994_request_irq(wm8994->wm8994,
+   WM8994_IRQ_MIC1_DET,
+   wm8994_mic_irq, "Mic 1 detect",
+   wm8994);
+
+   if (ret != 0)
+   dev_warn(codec->dev,
+"Failed to request Mic1 detect IRQ: %d\n",
+ret);
+
 
ret = wm8994_request_irq(wm8994->wm8994,
 WM8994_IRQ_MIC1_SHRT,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] ASoC: wm8994: Demux the microphone detection IRQ

2014-08-13 Thread Nikesh Oswal
Current code only allows direct routing of the WM8994 microphone
detection signal to a GPIO this change adds support to demux the
interrupt from the main interrupt line of the codec.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 sound/soc/codecs/wm8994.c |   18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 247b390..557156e 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -4089,17 +4089,23 @@ static int wm8994_codec_probe(struct snd_soc_codec 
*codec)
 
switch (control-type) {
case WM8994:
-   if (wm8994-micdet_irq) {
+   if (wm8994-micdet_irq)
ret = request_threaded_irq(wm8994-micdet_irq, NULL,
   wm8994_mic_irq,
   IRQF_TRIGGER_RISING,
   Mic1 detect,
   wm8994);
-   if (ret != 0)
-   dev_warn(codec-dev,
-Failed to request Mic1 detect IRQ: 
%d\n,
-ret);
-   }
+else
+   ret = wm8994_request_irq(wm8994-wm8994,
+   WM8994_IRQ_MIC1_DET,
+   wm8994_mic_irq, Mic 1 detect,
+   wm8994);
+
+   if (ret != 0)
+   dev_warn(codec-dev,
+Failed to request Mic1 detect IRQ: %d\n,
+ret);
+
 
ret = wm8994_request_irq(wm8994-wm8994,
 WM8994_IRQ_MIC1_SHRT,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mfd: wm8994: declare dc servo register for wm8958 as volatile

2014-08-13 Thread Nikesh Oswal
DC Servo register 57h holds the DC offset value after the hardware has
completed the DC Servo Correction, so declare this register as volatile
because it is changed by the hardware.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 drivers/mfd/wm8994-regmap.c  |1 +
 include/linux/mfd/wm8994/registers.h |1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/mfd/wm8994-regmap.c b/drivers/mfd/wm8994-regmap.c
index 2fbce9c..e775565 100644
--- a/drivers/mfd/wm8994-regmap.c
+++ b/drivers/mfd/wm8994-regmap.c
@@ -1169,6 +1169,7 @@ static bool wm8958_volatile_register(struct device *dev, 
unsigned int reg)
case WM8958_FW_MINOR_0:
case WM8958_FW_PATCH_1:
case WM8958_FW_PATCH_0:
+   case WM8958_DC_SERVO:
return true;
default:
return wm8994_volatile_register(dev, reg);
diff --git a/include/linux/mfd/wm8994/registers.h 
b/include/linux/mfd/wm8994/registers.h
index db8cef3..85b4fec 100644
--- a/include/linux/mfd/wm8994/registers.h
+++ b/include/linux/mfd/wm8994/registers.h
@@ -71,6 +71,7 @@
 #define WM8994_DC_SERVO_1   0x54
 #define WM8994_DC_SERVO_2   0x55
 #define WM8994_DC_SERVO_4   0x57
+#define WM8958_DC_SERVO0x57
 #define WM8994_DC_SERVO_READBACK0x58
 #define WM8994_DC_SERVO_4E 0x59
 #define WM8994_ANALOGUE_HP_10x60
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ASoC: wm_hubs: Fix DC Servo readback

2014-08-13 Thread Nikesh Oswal
wm_hubs is a common driver code shared by WM8958, WM1811, WM8944
and WM8993 all these codecs have the DC Servo Values either in register
57h or 59h. Current code was reading register 58h for WM8958 and WM8994
revisions 2 and 3 but looking at the data sheet the DC Servo Values are
stored in register 57h for these codecs. This patch fixes it by reading
the correct register for DC Servo

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 sound/soc/codecs/wm_hubs.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 916817f..95c5d71 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -210,9 +210,6 @@ static int wm_hubs_read_dc_servo(struct snd_soc_codec 
*codec,
case 2:
dcs_reg = WM8994_DC_SERVO_4E;
break;
-   case 1:
-   dcs_reg = WM8994_DC_SERVO_READBACK;
-   break;
default:
dcs_reg = WM8993_DC_SERVO_3;
break;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] mfd: wm8994: declare dc servo register for wm8958 as volatile

2014-08-13 Thread Nikesh Oswal
DC Servo register 57h holds the DC offset value after the hardware has
completed the DC Servo Correction, so declare this register as volatile
because it is changed by the hardware.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 drivers/mfd/wm8994-regmap.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/wm8994-regmap.c b/drivers/mfd/wm8994-regmap.c
index 2fbce9c..fa1630d 100644
--- a/drivers/mfd/wm8994-regmap.c
+++ b/drivers/mfd/wm8994-regmap.c
@@ -1169,6 +1169,7 @@ static bool wm8958_volatile_register(struct device *dev, 
unsigned int reg)
case WM8958_FW_MINOR_0:
case WM8958_FW_PATCH_1:
case WM8958_FW_PATCH_0:
+   case WM8994_DC_SERVO_4:
return true;
default:
return wm8994_volatile_register(dev, reg);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] gpiolib: wm8994: Fix irq offset for gpio_to_irq

2014-08-12 Thread Nikesh Oswal
Earlier code was using the gpio offset as is to get the irq.
For wm8994 driver the gpio related irq's starts from a fixed
offset as fixed by this patch.

Signed-off-by: Nikesh Oswal 
---
 drivers/gpio/gpio-wm8994.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
index d93b6b5..dec47c2 100644
--- a/drivers/gpio/gpio-wm8994.c
+++ b/drivers/gpio/gpio-wm8994.c
@@ -113,7 +113,8 @@ static int wm8994_gpio_to_irq(struct gpio_chip *chip, 
unsigned offset)
struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
struct wm8994 *wm8994 = wm8994_gpio->wm8994;
 
-   return regmap_irq_get_virq(wm8994->irq_data, offset);
+   return regmap_irq_get_virq(wm8994->irq_data,
+   WM8994_IRQ_GPIO(offset + 1));
 }
 
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ASoC: wm8994: register irq handler for mic1 detect

2014-08-12 Thread Nikesh Oswal
Signed-off-by: Nikesh Oswal 
---
 sound/soc/codecs/wm8994.c |9 +
 1 file changed, 9 insertions(+)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 247b390..24bcbe3 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -4099,6 +4099,15 @@ static int wm8994_codec_probe(struct snd_soc_codec 
*codec)
dev_warn(codec->dev,
 "Failed to request Mic1 detect IRQ: 
%d\n",
 ret);
+   } else {
+   ret = wm8994_request_irq(wm8994->wm8994,
+   WM8994_IRQ_MIC1_DET,
+   wm8994_mic_irq, "Mic 1 detect",
+   wm8994);
+   if (ret != 0)
+   dev_warn(codec->dev,
+   "Failed to request Mic1 detect IRQ: %d\n",
+   ret);
}
 
ret = wm8994_request_irq(wm8994->wm8994,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ASoC: wm8994: register irq handler for mic1 detect

2014-08-12 Thread Nikesh Oswal
Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 sound/soc/codecs/wm8994.c |9 +
 1 file changed, 9 insertions(+)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 247b390..24bcbe3 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -4099,6 +4099,15 @@ static int wm8994_codec_probe(struct snd_soc_codec 
*codec)
dev_warn(codec-dev,
 Failed to request Mic1 detect IRQ: 
%d\n,
 ret);
+   } else {
+   ret = wm8994_request_irq(wm8994-wm8994,
+   WM8994_IRQ_MIC1_DET,
+   wm8994_mic_irq, Mic 1 detect,
+   wm8994);
+   if (ret != 0)
+   dev_warn(codec-dev,
+   Failed to request Mic1 detect IRQ: %d\n,
+   ret);
}
 
ret = wm8994_request_irq(wm8994-wm8994,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] gpiolib: wm8994: Fix irq offset for gpio_to_irq

2014-08-12 Thread Nikesh Oswal
Earlier code was using the gpio offset as is to get the irq.
For wm8994 driver the gpio related irq's starts from a fixed
offset as fixed by this patch.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 drivers/gpio/gpio-wm8994.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
index d93b6b5..dec47c2 100644
--- a/drivers/gpio/gpio-wm8994.c
+++ b/drivers/gpio/gpio-wm8994.c
@@ -113,7 +113,8 @@ static int wm8994_gpio_to_irq(struct gpio_chip *chip, 
unsigned offset)
struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
struct wm8994 *wm8994 = wm8994_gpio-wm8994;
 
-   return regmap_irq_get_virq(wm8994-irq_data, offset);
+   return regmap_irq_get_virq(wm8994-irq_data,
+   WM8994_IRQ_GPIO(offset + 1));
 }
 
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3] ASOC: dapm: add code to configure dai link parameters

2014-08-06 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal 
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |4 +-
 sound/soc/soc-dapm.c |  140 --
 4 files changed, 141 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 6b59471..3ee031e 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index ed9e2d7..51c6c4f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -906,6 +906,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b87d7d8..db1572a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1461,7 +1461,7 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w, 
play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
@@ -1473,7 +1473,7 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai->capture_widget;
if (play_w && capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-  capture_w, play_w);
+  dai_link->num_params, capture_w, 
play_w);
if (ret != 0) {
dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
play_w->name, capture_w->name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index cdc837e..41f835b 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -729,6 +729,33 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w->dapm;
+   struct snd_card *card = dapm->card->snd_card;
+
+
+   /* add kcontrol */
+   for (i = 0; i < w->num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(>kcontrol_news[i], w,
+   w->name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret < 0) {
+   dev_err(dapm->dev,
+   "ASoC: failed to add widget %s dapm kcontrol %s: %d\n",
+   w->name, w->kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol->private_data = w;
+   w->kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   struct list_head *sink)
@@ -2664,6 +2691,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
case snd_soc_dapm_out_drv:
dapm_new_pga(w

[PATCH v3] ASOC: dapm: add code to configure dai link parameters

2014-08-06 Thread Nikesh Oswal
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 include/sound/soc-dapm.h |3 +
 include/sound/soc.h  |1 +
 sound/soc/soc-core.c |4 +-
 sound/soc/soc-dapm.c |  140 --
 4 files changed, 141 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 6b59471..3ee031e 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card 
*card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 const struct snd_soc_pcm_stream *params,
+unsigned int num_params,
 struct snd_soc_dapm_widget *source,
 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
void *priv; /* widget specific data */
struct regulator *regulator;/* attached regulator */
const struct snd_soc_pcm_stream *params; /* params for dai links */
+   unsigned int num_params; /* number of params for dai links */
+   unsigned int params_select; /* currently selected param for dai link */
 
/* dapm control */
int reg;/* negative reg = no direct 
dapm */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index ed9e2d7..51c6c4f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -906,6 +906,7 @@ struct snd_soc_dai_link {
int be_id;  /* optional ID for machine driver BE identification */
 
const struct snd_soc_pcm_stream *params;
+   unsigned int num_params;
 
unsigned int dai_fmt;   /* format to set on init */
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b87d7d8..db1572a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1461,7 +1461,7 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = cpu_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w, 
play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
@@ -1473,7 +1473,7 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
capture_w = codec_dai-capture_widget;
if (play_w  capture_w) {
ret = snd_soc_dapm_new_pcm(card, dai_link-params,
-  capture_w, play_w);
+  dai_link-num_params, capture_w, 
play_w);
if (ret != 0) {
dev_err(card-dev, ASoC: Can't link %s to %s: %d\n,
play_w-name, capture_w-name, ret);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index cdc837e..41f835b 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -729,6 +729,33 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
return 0;
 }
 
+/* create new dapm dai link control */
+static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
+{
+   int i, ret;
+   struct snd_kcontrol *kcontrol;
+   struct snd_soc_dapm_context *dapm = w-dapm;
+   struct snd_card *card = dapm-card-snd_card;
+
+
+   /* add kcontrol */
+   for (i = 0; i  w-num_kcontrols; i++) {
+   kcontrol = snd_soc_cnew(w-kcontrol_news[i], w,
+   w-name, NULL);
+   ret = snd_ctl_add(card, kcontrol);
+   if (ret  0) {
+   dev_err(dapm-dev,
+   ASoC: failed to add widget %s dapm kcontrol %s: %d\n,
+   w-name, w-kcontrol_news[i].name, ret);
+   return ret;
+   }
+   kcontrol-private_data = w;
+   w-kcontrols[i] = kcontrol;
+   }
+
+   return 0;
+}
+
 /* reset 'walked' bit for each dapm path */
 static void dapm_clear_walk_output(struct snd_soc_dapm_context *dapm,
   struct list_head *sink)
@@ -2664,6 +2691,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
case snd_soc_dapm_out_drv:
dapm_new_pga(w);
break;
+   case snd_soc_dapm_dai_link:
+   dapm_new_dai_link(w

[PATCH v2] regulator: arizona-ldo1: remove bypass functionality

2014-07-04 Thread Nikesh Oswal
WM5110/8280 devices do not support bypass mode for LDO1 so remove
the bypass callbacks registered with regulator core.

Signed-off-by: Nikesh Oswal 
---
 drivers/regulator/arizona-ldo1.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index 04f262a..4c9db58 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -143,8 +143,6 @@ static struct regulator_ops arizona_ldo1_ops = {
.map_voltage = regulator_map_voltage_linear,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
-   .get_bypass = regulator_get_bypass_regmap,
-   .set_bypass = regulator_set_bypass_regmap,
 };
 
 static const struct regulator_desc arizona_ldo1 = {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] regulator: arizona-ldo1: remove bypass functionality

2014-07-04 Thread Nikesh Oswal
WM5110/8280 devices do not support bypass mode for LDO1 so remove
the bypass callbacks registered with regulator core.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 drivers/regulator/arizona-ldo1.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index 04f262a..4c9db58 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -143,8 +143,6 @@ static struct regulator_ops arizona_ldo1_ops = {
.map_voltage = regulator_map_voltage_linear,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
-   .get_bypass = regulator_get_bypass_regmap,
-   .set_bypass = regulator_set_bypass_regmap,
 };
 
 static const struct regulator_desc arizona_ldo1 = {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] regulator: arizona-ldo1: remove bypass functionality

2014-07-03 Thread Nikesh Oswal
From: Nikesh Oswal 

WM5110/8280 devices do not support bypass mode for LDO1 so remove
the bypass callbacks registered with regulator core.

Signed-off-by: Nikesh Oswal 
---
 drivers/regulator/arizona-ldo1.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index 04f262a..4c9db58 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -143,8 +143,6 @@ static struct regulator_ops arizona_ldo1_ops = {
.map_voltage = regulator_map_voltage_linear,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
-   .get_bypass = regulator_get_bypass_regmap,
-   .set_bypass = regulator_set_bypass_regmap,
 };
 
 static const struct regulator_desc arizona_ldo1 = {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] regulator: arizona-ldo1: remove bypass functionality

2014-07-03 Thread Nikesh Oswal
From: Nikesh Oswal nikesh.os...@wolfsonmicro.com

WM5110/8280 devices do not support bypass mode for LDO1 so remove
the bypass callbacks registered with regulator core.

Signed-off-by: Nikesh Oswal nik...@opensource.wolfsonmicro.com
---
 drivers/regulator/arizona-ldo1.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index 04f262a..4c9db58 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -143,8 +143,6 @@ static struct regulator_ops arizona_ldo1_ops = {
.map_voltage = regulator_map_voltage_linear,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
-   .get_bypass = regulator_get_bypass_regmap,
-   .set_bypass = regulator_set_bypass_regmap,
 };
 
 static const struct regulator_desc arizona_ldo1 = {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/