diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2012-03-16 04:56:41 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-01 06:28:27 -0400 |
commit | 8f549d7e7795e5e07ff871a79708bf2e387104dd (patch) | |
tree | 93de6a8ffba13bf6613c4a08875b3cbed97d1697 /sound/soc/fsl | |
parent | 60aae8da298e3ac0af07c8cdb6a98e47e8deab35 (diff) |
ASoC: fsl: remove helper fsl_asoc_get_codec_dev_name
The ASoC core now can support matching codec with device node besides
name, so we can save helper function fsl_asoc_get_codec_dev_name.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r-- | sound/soc/fsl/fsl_utils.c | 44 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_utils.h | 1 | ||||
-rw-r--r-- | sound/soc/fsl/mpc8610_hpcd.c | 13 | ||||
-rw-r--r-- | sound/soc/fsl/p1022_ds.c | 13 |
4 files changed, 4 insertions, 67 deletions
diff --git a/sound/soc/fsl/fsl_utils.c b/sound/soc/fsl/fsl_utils.c index 4370c28e5362..b9e42b503a37 100644 --- a/sound/soc/fsl/fsl_utils.c +++ b/sound/soc/fsl/fsl_utils.c | |||
@@ -12,55 +12,11 @@ | |||
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/of_address.h> | 14 | #include <linux/of_address.h> |
15 | #include <linux/of_i2c.h> | ||
16 | #include <sound/soc.h> | 15 | #include <sound/soc.h> |
17 | 16 | ||
18 | #include "fsl_utils.h" | 17 | #include "fsl_utils.h" |
19 | 18 | ||
20 | /** | 19 | /** |
21 | * fsl_asoc_get_codec_dev_name - determine the dev_name for a codec node | ||
22 | * | ||
23 | * @np: pointer to the I2C device tree node | ||
24 | * @buf: buffer to be filled with the dev_name of the I2C device | ||
25 | * @len: the length of the buffer | ||
26 | * | ||
27 | * This function determines the dev_name for an I2C node. This is the name | ||
28 | * that would be returned by dev_name() if this device_node were part of a | ||
29 | * 'struct device' It's ugly and hackish, but it works. | ||
30 | * | ||
31 | * The dev_name for such devices include the bus number and I2C address. For | ||
32 | * example, "cs4270.0-004f". | ||
33 | */ | ||
34 | int fsl_asoc_get_codec_dev_name(struct device_node *np, char *buf, size_t len) | ||
35 | { | ||
36 | const u32 *iprop; | ||
37 | u32 addr; | ||
38 | char temp[DAI_NAME_SIZE]; | ||
39 | struct i2c_client *i2c; | ||
40 | |||
41 | of_modalias_node(np, temp, DAI_NAME_SIZE); | ||
42 | |||
43 | iprop = of_get_property(np, "reg", NULL); | ||
44 | if (!iprop) | ||
45 | return -EINVAL; | ||
46 | |||
47 | addr = be32_to_cpup(iprop); | ||
48 | |||
49 | /* We need the adapter number */ | ||
50 | i2c = of_find_i2c_device_by_node(np); | ||
51 | if (!i2c) { | ||
52 | put_device(&i2c->dev); | ||
53 | return -ENODEV; | ||
54 | } | ||
55 | |||
56 | snprintf(buf, len, "%s.%u-%04x", temp, i2c->adapter->nr, addr); | ||
57 | put_device(&i2c->dev); | ||
58 | |||
59 | return 0; | ||
60 | } | ||
61 | EXPORT_SYMBOL(fsl_asoc_get_codec_dev_name); | ||
62 | |||
63 | /** | ||
64 | * fsl_asoc_get_dma_channel - determine the dma channel for a SSI node | 20 | * fsl_asoc_get_dma_channel - determine the dma channel for a SSI node |
65 | * | 21 | * |
66 | * @ssi_np: pointer to the SSI device tree node | 22 | * @ssi_np: pointer to the SSI device tree node |
diff --git a/sound/soc/fsl/fsl_utils.h b/sound/soc/fsl/fsl_utils.h index 44d143670c37..b2951126527c 100644 --- a/sound/soc/fsl/fsl_utils.h +++ b/sound/soc/fsl/fsl_utils.h | |||
@@ -18,7 +18,6 @@ | |||
18 | struct snd_soc_dai_link; | 18 | struct snd_soc_dai_link; |
19 | struct device_node; | 19 | struct device_node; |
20 | 20 | ||
21 | int fsl_asoc_get_codec_dev_name(struct device_node *np, char *buf, size_t len); | ||
22 | int fsl_asoc_get_dma_channel(struct device_node *ssi_np, const char *name, | 21 | int fsl_asoc_get_dma_channel(struct device_node *ssi_np, const char *name, |
23 | struct snd_soc_dai_link *dai, | 22 | struct snd_soc_dai_link *dai, |
24 | unsigned int *dma_channel_id, | 23 | unsigned int *dma_channel_id, |
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index 41951820b50e..8fdc430a4f68 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c | |||
@@ -41,7 +41,6 @@ struct mpc8610_hpcd_data { | |||
41 | unsigned int dma_id[2]; /* 0 = DMA1, 1 = DMA2, etc */ | 41 | unsigned int dma_id[2]; /* 0 = DMA1, 1 = DMA2, etc */ |
42 | unsigned int dma_channel_id[2]; /* 0 = ch 0, 1 = ch 1, etc*/ | 42 | unsigned int dma_channel_id[2]; /* 0 = ch 0, 1 = ch 1, etc*/ |
43 | char codec_dai_name[DAI_NAME_SIZE]; | 43 | char codec_dai_name[DAI_NAME_SIZE]; |
44 | char codec_name[DAI_NAME_SIZE]; | ||
45 | char platform_name[2][DAI_NAME_SIZE]; /* One for each DMA channel */ | 44 | char platform_name[2][DAI_NAME_SIZE]; /* One for each DMA channel */ |
46 | }; | 45 | }; |
47 | 46 | ||
@@ -215,16 +214,8 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) | |||
215 | machine_data->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); | 214 | machine_data->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); |
216 | machine_data->dai[0].ops = &mpc8610_hpcd_ops; | 215 | machine_data->dai[0].ops = &mpc8610_hpcd_ops; |
217 | 216 | ||
218 | /* Determine the codec name, it will be used as the codec DAI name */ | 217 | /* ASoC core can match codec with device node */ |
219 | ret = fsl_asoc_get_codec_dev_name(codec_np, machine_data->codec_name, | 218 | machine_data->dai[0].codec_of_node = codec_np; |
220 | DAI_NAME_SIZE); | ||
221 | if (ret) { | ||
222 | dev_err(&pdev->dev, "invalid codec node %s\n", | ||
223 | codec_np->full_name); | ||
224 | ret = -EINVAL; | ||
225 | goto error; | ||
226 | } | ||
227 | machine_data->dai[0].codec_name = machine_data->codec_name; | ||
228 | 219 | ||
229 | /* The DAI name from the codec (snd_soc_dai_driver.name) */ | 220 | /* The DAI name from the codec (snd_soc_dai_driver.name) */ |
230 | machine_data->dai[0].codec_dai_name = "cs4270-hifi"; | 221 | machine_data->dai[0].codec_dai_name = "cs4270-hifi"; |
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c index be79e7388c0f..202298556ba7 100644 --- a/sound/soc/fsl/p1022_ds.c +++ b/sound/soc/fsl/p1022_ds.c | |||
@@ -73,7 +73,6 @@ struct machine_data { | |||
73 | unsigned int ssi_id; /* 0 = SSI1, 1 = SSI2, etc */ | 73 | unsigned int ssi_id; /* 0 = SSI1, 1 = SSI2, etc */ |
74 | unsigned int dma_id[2]; /* 0 = DMA1, 1 = DMA2, etc */ | 74 | unsigned int dma_id[2]; /* 0 = DMA1, 1 = DMA2, etc */ |
75 | unsigned int dma_channel_id[2]; /* 0 = ch 0, 1 = ch 1, etc*/ | 75 | unsigned int dma_channel_id[2]; /* 0 = ch 0, 1 = ch 1, etc*/ |
76 | char codec_name[DAI_NAME_SIZE]; | ||
77 | char platform_name[2][DAI_NAME_SIZE]; /* One for each DMA channel */ | 76 | char platform_name[2][DAI_NAME_SIZE]; /* One for each DMA channel */ |
78 | }; | 77 | }; |
79 | 78 | ||
@@ -225,16 +224,8 @@ static int p1022_ds_probe(struct platform_device *pdev) | |||
225 | mdata->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); | 224 | mdata->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); |
226 | mdata->dai[0].ops = &p1022_ds_ops; | 225 | mdata->dai[0].ops = &p1022_ds_ops; |
227 | 226 | ||
228 | /* Determine the codec name, it will be used as the codec DAI name */ | 227 | /* ASoC core can match codec with device node */ |
229 | ret = fsl_asoc_get_codec_dev_name(codec_np, mdata->codec_name, | 228 | mdata->dai[0].codec_of_node = codec_np; |
230 | DAI_NAME_SIZE); | ||
231 | if (ret) { | ||
232 | dev_err(&pdev->dev, "invalid codec node %s\n", | ||
233 | codec_np->full_name); | ||
234 | ret = -EINVAL; | ||
235 | goto error; | ||
236 | } | ||
237 | mdata->dai[0].codec_name = mdata->codec_name; | ||
238 | 229 | ||
239 | /* We register two DAIs per SSI, one for playback and the other for | 230 | /* We register two DAIs per SSI, one for playback and the other for |
240 | * capture. We support codecs that have separate DAIs for both playback | 231 | * capture. We support codecs that have separate DAIs for both playback |