Skip to content

Commit f617134

Browse files
committed
Merge remote-tracking branches 'asoc/topic/rt5665', 'asoc/topic/rt5670', 'asoc/topic/rt5677', 'asoc/topic/samsung' and 'asoc/topic/simple' into asoc-next
6 parents b35ddfd + f2826c1 + d252800 + a40db07 + 1bfbc26 + 29a43aa commit f617134

File tree

22 files changed

+751
-1210
lines changed

22 files changed

+751
-1210
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Samsung Exynos5433 TM2(E) audio complex with WM5110 codec
2+
3+
Required properties:
4+
5+
- compatible : "samsung,tm2-audio"
6+
- model : the user-visible name of this sound complex
7+
- audio-codec : the phandle of the wm5110 audio codec node,
8+
as described in ../mfd/arizona.txt
9+
- i2s-controller : the phandle of the I2S controller
10+
- audio-amplifier : the phandle of the MAX98504 amplifier
11+
- samsung,audio-routing : a list of the connections between audio components;
12+
each entry is a pair of strings, the first being the
13+
connection's sink, the second being the connection's
14+
source; valid names for sources and sinks are the
15+
WM5110's and MAX98504's pins and the jacks on the
16+
board: HP, SPK, Main Mic, Sub Mic, Third Mic,
17+
Headset Mic
18+
- mic-bias-gpios : GPIO pin that enables the Main Mic bias regulator
19+
20+
21+
Example:
22+
23+
sound {
24+
compatible = "samsung,tm2-audio";
25+
audio-codec = <&wm5110>;
26+
i2s-controller = <&i2s0>;
27+
audio-amplifier = <&max98504>;
28+
mic-bias-gpios = <&gpr3 2 0>;
29+
model = "wm5110";
30+
samsung,audio-routing =
31+
"HP", "HPOUT1L",
32+
"HP", "HPOUT1R",
33+
"SPK", "SPKOUT",
34+
"SPKOUT", "HPOUT2L",
35+
"SPKOUT", "HPOUT2R",
36+
"Main Mic", "MICBIAS2",
37+
"IN1R", "Main Mic";
38+
};

include/sound/simple_card_utils.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*
2-
* simple_card_core.h
2+
* simple_card_utils.h
33
*
44
* Copyright (c) 2016 Kuninori Morimoto <[email protected]>
55
*
66
* This program is free software; you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License version 2 as
88
* published by the Free Software Foundation.
99
*/
10-
#ifndef __SIMPLE_CARD_CORE_H
11-
#define __SIMPLE_CARD_CORE_H
10+
#ifndef __SIMPLE_CARD_UTILS_H
11+
#define __SIMPLE_CARD_UTILS_H
1212

1313
#include <sound/soc.h>
1414

@@ -68,4 +68,4 @@ void asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
6868

6969
int asoc_simple_card_clean_reference(struct snd_soc_card *card);
7070

71-
#endif /* __SIMPLE_CARD_CORE_H */
71+
#endif /* __SIMPLE_CARD_UTILS_H */

sound/soc/codecs/rt5665.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4587,7 +4587,7 @@ static void rt5665_calibrate(struct rt5665_priv *rt5665)
45874587
pr_err("HP Calibration Failure\n");
45884588
regmap_write(rt5665->regmap, RT5665_RESET, 0);
45894589
regcache_cache_bypass(rt5665->regmap, false);
4590-
return;
4590+
goto out_unlock;
45914591
}
45924592

45934593
count++;
@@ -4606,7 +4606,7 @@ static void rt5665_calibrate(struct rt5665_priv *rt5665)
46064606
pr_err("MONO Calibration Failure\n");
46074607
regmap_write(rt5665->regmap, RT5665_RESET, 0);
46084608
regcache_cache_bypass(rt5665->regmap, false);
4609-
return;
4609+
goto out_unlock;
46104610
}
46114611

46124612
count++;
@@ -4621,6 +4621,7 @@ static void rt5665_calibrate(struct rt5665_priv *rt5665)
46214621
regmap_write(rt5665->regmap, RT5665_BIAS_CUR_CTRL_8, 0xa602);
46224622
regmap_write(rt5665->regmap, RT5665_ASRC_8, 0x0120);
46234623

4624+
out_unlock:
46244625
mutex_unlock(&rt5665->calibrate_mutex);
46254626
}
46264627

@@ -4676,11 +4677,9 @@ static int rt5665_i2c_probe(struct i2c_client *i2c,
46764677
}
46774678

46784679
if (gpio_is_valid(rt5665->pdata.ldo1_en)) {
4679-
if (devm_gpio_request(&i2c->dev, rt5665->pdata.ldo1_en,
4680-
"rt5665"))
4680+
if (devm_gpio_request_one(&i2c->dev, rt5665->pdata.ldo1_en,
4681+
GPIOF_OUT_INIT_HIGH, "rt5665"))
46814682
dev_err(&i2c->dev, "Fail gpio_request gpio_ldo\n");
4682-
else if (gpio_direction_output(rt5665->pdata.ldo1_en, 1))
4683-
dev_err(&i2c->dev, "Fail gpio_direction gpio_ldo\n");
46844683
}
46854684

46864685
/* Sleep for 300 ms miniumum */

sound/soc/codecs/rt5670.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2618,15 +2618,15 @@ static int rt5670_set_bias_level(struct snd_soc_codec *codec,
26182618
RT5670_OSW_L_DIS | RT5670_OSW_R_DIS);
26192619
snd_soc_update_bits(codec, RT5670_DIG_MISC, 0x1, 0x1);
26202620
snd_soc_update_bits(codec, RT5670_PWR_ANLG1,
2621-
RT5670_LDO_SEL_MASK, 0x3);
2621+
RT5670_LDO_SEL_MASK, 0x5);
26222622
}
26232623
break;
26242624
case SND_SOC_BIAS_STANDBY:
26252625
snd_soc_update_bits(codec, RT5670_PWR_ANLG1,
26262626
RT5670_PWR_VREF1 | RT5670_PWR_VREF2 |
26272627
RT5670_PWR_FV1 | RT5670_PWR_FV2, 0);
26282628
snd_soc_update_bits(codec, RT5670_PWR_ANLG1,
2629-
RT5670_LDO_SEL_MASK, 0x1);
2629+
RT5670_LDO_SEL_MASK, 0x3);
26302630
break;
26312631
case SND_SOC_BIAS_OFF:
26322632
if (rt5670->pdata.jd_mode)
@@ -2813,6 +2813,7 @@ MODULE_DEVICE_TABLE(i2c, rt5670_i2c_id);
28132813
#ifdef CONFIG_ACPI
28142814
static const struct acpi_device_id rt5670_acpi_match[] = {
28152815
{ "10EC5670", 0},
2816+
{ "10EC5672", 0},
28162817
{ },
28172818
};
28182819
MODULE_DEVICE_TABLE(acpi, rt5670_acpi_match);
@@ -2826,6 +2827,13 @@ static const struct dmi_system_id dmi_platform_intel_braswell[] = {
28262827
DMI_MATCH(DMI_BOARD_NAME, "Braswell CRB"),
28272828
},
28282829
},
2830+
{
2831+
.ident = "Dell Wyse 3040",
2832+
.matches = {
2833+
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
2834+
DMI_MATCH(DMI_PRODUCT_NAME, "Wyse 3040"),
2835+
},
2836+
},
28292837
{}
28302838
};
28312839

@@ -2889,6 +2897,9 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
28892897
if (ret != 0)
28902898
dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret);
28912899

2900+
regmap_update_bits(rt5670->regmap, RT5670_DIG_MISC,
2901+
RT5670_MCLK_DET, RT5670_MCLK_DET);
2902+
28922903
if (rt5670->pdata.in2_diff)
28932904
regmap_update_bits(rt5670->regmap, RT5670_IN2,
28942905
RT5670_IN_DF2, RT5670_IN_DF2);
@@ -2903,7 +2914,6 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
29032914
RT5670_GP1_PIN_MASK, RT5670_GP1_PIN_IRQ);
29042915
regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2,
29052916
RT5670_GP1_PF_MASK, RT5670_GP1_PF_OUT);
2906-
regmap_update_bits(rt5670->regmap, RT5670_DIG_MISC, 0x8, 0x8);
29072917
}
29082918

29092919
if (rt5670->pdata.jd_mode) {

sound/soc/codecs/rt5670.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,6 +1914,7 @@ enum {
19141914
#define RT5670_IF1_ADC1_IN2_SFT 11
19151915
#define RT5670_IF1_ADC2_IN1_SEL (0x1 << 10)
19161916
#define RT5670_IF1_ADC2_IN1_SFT 10
1917+
#define RT5670_MCLK_DET (0x1 << 3)
19171918

19181919
/* General Control2 (0xfb) */
19191920
#define RT5670_RXDC_SRC_MASK (0x1 << 7)

sound/soc/codecs/rt5677-spi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <linux/slab.h>
2121
#include <linux/gpio.h>
2222
#include <linux/sched.h>
23-
#include <linux/kthread.h>
2423
#include <linux/uaccess.h>
2524
#include <linux/miscdevice.h>
2625
#include <linux/regulator/consumer.h>

sound/soc/generic/simple-card-utils.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* simple-card-core.c
2+
* simple-card-utils.c
33
*
44
* Copyright (c) 2016 Kuninori Morimoto <[email protected]>
55
*
@@ -195,9 +195,6 @@ EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);
195195

196196
int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link)
197197
{
198-
if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name)
199-
return -EINVAL;
200-
201198
/* Assumes platform == cpu */
202199
if (!dai_link->platform_of_node)
203200
dai_link->platform_of_node = dai_link->cpu_of_node;

sound/soc/generic/simple-scu-card.c

Lines changed: 50 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <sound/soc-dai.h>
2323
#include <sound/simple_card_utils.h>
2424

25-
struct asoc_simple_card_priv {
25+
struct simple_card_data {
2626
struct snd_soc_card snd_card;
2727
struct snd_soc_codec_conf codec_conf;
2828
struct asoc_simple_dai *dai_props;
@@ -42,7 +42,7 @@ struct asoc_simple_card_priv {
4242
static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
4343
{
4444
struct snd_soc_pcm_runtime *rtd = substream->private_data;
45-
struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
45+
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
4646
struct asoc_simple_dai *dai_props =
4747
simple_priv_to_props(priv, rtd->num);
4848

@@ -52,7 +52,7 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
5252
static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
5353
{
5454
struct snd_soc_pcm_runtime *rtd = substream->private_data;
55-
struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
55+
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
5656
struct asoc_simple_dai *dai_props =
5757
simple_priv_to_props(priv, rtd->num);
5858

@@ -66,7 +66,7 @@ static const struct snd_soc_ops asoc_simple_card_ops = {
6666

6767
static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
6868
{
69-
struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
69+
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
7070
struct snd_soc_dai *dai;
7171
struct snd_soc_dai_link *dai_link;
7272
struct asoc_simple_dai *dai_props;
@@ -84,7 +84,7 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
8484
static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
8585
struct snd_pcm_hw_params *params)
8686
{
87-
struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
87+
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
8888
struct snd_interval *rate = hw_param_interval(params,
8989
SNDRV_PCM_HW_PARAM_RATE);
9090
struct snd_interval *channels = hw_param_interval(params,
@@ -101,8 +101,8 @@ static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
101101
return 0;
102102
}
103103

104-
static int asoc_simple_card_parse_links(struct device_node *np,
105-
struct asoc_simple_card_priv *priv,
104+
static int asoc_simple_card_dai_link_of(struct device_node *np,
105+
struct simple_card_data *priv,
106106
unsigned int daifmt,
107107
int idx, bool is_fe)
108108
{
@@ -195,22 +195,35 @@ static int asoc_simple_card_parse_links(struct device_node *np,
195195
return 0;
196196
}
197197

198-
static int asoc_simple_card_dai_link_of(struct device_node *node,
199-
struct asoc_simple_card_priv *priv)
198+
static int asoc_simple_card_parse_of(struct device_node *node,
199+
struct simple_card_data *priv)
200+
200201
{
201202
struct device *dev = simple_priv_to_dev(priv);
202203
struct device_node *np;
203204
unsigned int daifmt = 0;
204-
int ret, i;
205205
bool is_fe;
206+
int ret, i;
207+
208+
if (!node)
209+
return -EINVAL;
210+
211+
ret = snd_soc_of_parse_audio_routing(&priv->snd_card, PREFIX "routing");
212+
if (ret < 0)
213+
return ret;
214+
215+
/* sampling rate convert */
216+
of_property_read_u32(node, PREFIX "convert-rate", &priv->convert_rate);
217+
218+
/* channels transfer */
219+
of_property_read_u32(node, PREFIX "convert-channels", &priv->convert_channels);
206220

207221
/* find 1st codec */
208222
np = of_get_child_by_name(node, PREFIX "codec");
209223
if (!np)
210224
return -ENODEV;
211225

212-
ret = asoc_simple_card_parse_daifmt(dev, node, np,
213-
PREFIX, &daifmt);
226+
ret = asoc_simple_card_parse_daifmt(dev, node, np, PREFIX, &daifmt);
214227
if (ret < 0)
215228
return ret;
216229

@@ -220,58 +233,12 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
220233
if (strcmp(np->name, PREFIX "cpu") == 0)
221234
is_fe = true;
222235

223-
ret = asoc_simple_card_parse_links(np, priv, daifmt, i, is_fe);
236+
ret = asoc_simple_card_dai_link_of(np, priv, daifmt, i, is_fe);
224237
if (ret < 0)
225238
return ret;
226239
i++;
227240
}
228241

229-
return 0;
230-
}
231-
232-
static int asoc_simple_card_parse_of(struct device_node *node,
233-
struct asoc_simple_card_priv *priv,
234-
struct device *dev)
235-
{
236-
struct asoc_simple_dai *props;
237-
struct snd_soc_dai_link *links;
238-
int ret;
239-
int num;
240-
241-
if (!node)
242-
return -EINVAL;
243-
244-
num = of_get_child_count(node);
245-
props = devm_kzalloc(dev, sizeof(*props) * num, GFP_KERNEL);
246-
links = devm_kzalloc(dev, sizeof(*links) * num, GFP_KERNEL);
247-
if (!props || !links)
248-
return -ENOMEM;
249-
250-
priv->dai_props = props;
251-
priv->dai_link = links;
252-
253-
/* Init snd_soc_card */
254-
priv->snd_card.owner = THIS_MODULE;
255-
priv->snd_card.dev = dev;
256-
priv->snd_card.dai_link = priv->dai_link;
257-
priv->snd_card.num_links = num;
258-
priv->snd_card.codec_conf = &priv->codec_conf;
259-
priv->snd_card.num_configs = 1;
260-
261-
ret = snd_soc_of_parse_audio_routing(&priv->snd_card, PREFIX "routing");
262-
if (ret < 0)
263-
return ret;
264-
265-
/* sampling rate convert */
266-
of_property_read_u32(node, PREFIX "convert-rate", &priv->convert_rate);
267-
268-
/* channels transfer */
269-
of_property_read_u32(node, PREFIX "convert-channels", &priv->convert_channels);
270-
271-
ret = asoc_simple_card_dai_link_of(node, priv);
272-
if (ret < 0)
273-
return ret;
274-
275242
ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX);
276243
if (ret < 0)
277244
return ret;
@@ -286,17 +253,37 @@ static int asoc_simple_card_parse_of(struct device_node *node,
286253

287254
static int asoc_simple_card_probe(struct platform_device *pdev)
288255
{
289-
struct asoc_simple_card_priv *priv;
290-
struct device_node *np = pdev->dev.of_node;
256+
struct simple_card_data *priv;
257+
struct snd_soc_dai_link *dai_link;
258+
struct asoc_simple_dai *dai_props;
291259
struct device *dev = &pdev->dev;
292-
int ret;
260+
struct device_node *np = pdev->dev.of_node;
261+
int num, ret;
293262

294263
/* Allocate the private data */
295264
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
296265
if (!priv)
297266
return -ENOMEM;
298267

299-
ret = asoc_simple_card_parse_of(np, priv, dev);
268+
num = of_get_child_count(np);
269+
270+
dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL);
271+
dai_link = devm_kzalloc(dev, sizeof(*dai_link) * num, GFP_KERNEL);
272+
if (!dai_props || !dai_link)
273+
return -ENOMEM;
274+
275+
priv->dai_props = dai_props;
276+
priv->dai_link = dai_link;
277+
278+
/* Init snd_soc_card */
279+
priv->snd_card.owner = THIS_MODULE;
280+
priv->snd_card.dev = dev;
281+
priv->snd_card.dai_link = priv->dai_link;
282+
priv->snd_card.num_links = num;
283+
priv->snd_card.codec_conf = &priv->codec_conf;
284+
priv->snd_card.num_configs = 1;
285+
286+
ret = asoc_simple_card_parse_of(np, priv);
300287
if (ret < 0) {
301288
if (ret != -EPROBE_DEFER)
302289
dev_err(dev, "parse error %d\n", ret);

0 commit comments

Comments
 (0)