Skip to content

Commit

Permalink
Merge remote-tracking branches 'asoc/topic/codecs', 'asoc/topic/compr…
Browse files Browse the repository at this point in the history
…ess' and 'asoc/topic/cq93vc' into asoc-next
  • Loading branch information
Mark Brown committed Jan 18, 2018
4 parents f954054 + 7fb59e9 + e5acfc7 + 60e1780 commit 9a2fef7
Showing 4 changed files with 33 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/sound/dmic.txt
Original file line number Diff line number Diff line change
@@ -7,10 +7,12 @@ Required properties:

Optional properties:
- dmicen-gpios: GPIO specifier for dmic to control start and stop
- num-channels: Number of microphones on this DAI

Example node:

dmic_codec: dmic@0 {
compatible = "dmic-codec";
dmicen-gpios = <&gpio4 3 GPIO_ACTIVE_HIGH>;
num-channels = <1>;
};
10 changes: 6 additions & 4 deletions sound/soc/codecs/cq93vc.c
Original file line number Diff line number Diff line change
@@ -121,17 +121,19 @@ static struct snd_soc_dai_driver cq93vc_dai = {
.ops = &cq93vc_dai_ops,
};

static struct regmap *cq93vc_get_regmap(struct device *dev)
static int cq93vc_probe(struct snd_soc_component *component)
{
struct davinci_vc *davinci_vc = dev->platform_data;
struct davinci_vc *davinci_vc = component->dev->platform_data;

return davinci_vc->regmap;
snd_soc_component_init_regmap(component, davinci_vc->regmap);

return 0;
}

static const struct snd_soc_codec_driver soc_codec_dev_cq93vc = {
.set_bias_level = cq93vc_set_bias_level,
.get_regmap = cq93vc_get_regmap,
.component_driver = {
.probe = cq93vc_probe,
.controls = cq93vc_snd_controls,
.num_controls = ARRAY_SIZE(cq93vc_snd_controls),
},
24 changes: 23 additions & 1 deletion sound/soc/codecs/dmic.c
Original file line number Diff line number Diff line change
@@ -107,8 +107,30 @@ static const struct snd_soc_codec_driver soc_dmic = {

static int dmic_dev_probe(struct platform_device *pdev)
{
int err;
u32 chans;
struct snd_soc_dai_driver *dai_drv = &dmic_dai;

if (pdev->dev.of_node) {
err = of_property_read_u32(pdev->dev.of_node, "num-channels", &chans);
if (err && (err != -ENOENT))
return err;

if (!err) {
if (chans < 1 || chans > 8)
return -EINVAL;

dai_drv = devm_kzalloc(&pdev->dev, sizeof(*dai_drv), GFP_KERNEL);
if (!dai_drv)
return -ENOMEM;

memcpy(dai_drv, &dmic_dai, sizeof(*dai_drv));
dai_drv->capture.channels_max = chans;
}
}

return snd_soc_register_codec(&pdev->dev,
&soc_dmic, &dmic_dai, 1);
&soc_dmic, dai_drv, 1);
}

static int dmic_dev_remove(struct platform_device *pdev)
4 changes: 2 additions & 2 deletions sound/soc/soc-compress.c
Original file line number Diff line number Diff line change
@@ -1096,7 +1096,6 @@ static struct snd_compr_ops soc_compr_dyn_ops = {
*/
int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
{
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_platform *platform = rtd->platform;
struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
@@ -1199,8 +1198,9 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
ret = snd_compress_new(rtd->card->snd_card, num, direction,
new_name, compr);
if (ret < 0) {
component = rtd->codec_dai->component;
pr_err("compress asoc: can't create compress for codec %s\n",
codec->component.name);
component->name);
goto compr_err;
}

0 comments on commit 9a2fef7

Please sign in to comment.