From: Martin Sperl <kernel@xxxxxxxxxxxxxxxx> Add support for hw_params_rules to simple_card. Signed-off-by: Martin Sperl <kernel@xxxxxxxxxxxxxxxx> --- Documentation/devicetree/bindings/sound/simple-card.txt | 1 + sound/soc/generic/simple-card.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index cf3979e..2cfed39 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -31,6 +31,7 @@ Optional subnodes: omitted when the card has only one DAI link. See the examples and the section bellow. +- hw-params-rules : Please refer to hw-params-rules.txt. Dai-link subnode properties and subnodes: diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 2389ab4..6b95ea1 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -8,6 +8,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#include "hw-params-rules.h" #include <linux/clk.h> #include <linux/device.h> #include <linux/gpio.h> @@ -33,6 +34,7 @@ struct simple_card_data { int gpio_hp_det_invert; int gpio_mic_det; int gpio_mic_det_invert; + struct list_head hw_params_rules; struct snd_soc_dai_link dai_link[]; /* dynamically allocated */ }; @@ -51,7 +53,7 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream) ret = clk_prepare_enable(dai_props->cpu_dai.clk); if (ret) return ret; - + ret = clk_prepare_enable(dai_props->codec_dai.clk); if (ret) clk_disable_unprepare(dai_props->cpu_dai.clk); @@ -99,7 +101,9 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, if (ret && ret != -ENOTSUPP) goto err; } - return 0; + + return asoc_generic_hw_params_process_rules( + &priv->hw_params_rules, substream, params); err: return ret; } @@ -509,7 +513,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, if (!priv->snd_card.name) priv->snd_card.name = priv->snd_card.dai_link->name; - return 0; + return asoc_generic_hw_params_rules_parse_of( + dev, node, &priv->hw_params_rules); } /* Decrease the reference count of the device nodes */ -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html