diff options
author | Richard Zhao <richard.zhao@linaro.org> | 2012-03-05 09:31:04 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-06 07:44:21 -0500 |
commit | 9d5ef2663fe220a88412a7190942b7d933da0333 (patch) | |
tree | c0d21bf370a59498c6f11a2f5ebf948f23c54e53 /sound/soc/imx | |
parent | f320515a589eeb9bfbc317801e60b87a12f9eae1 (diff) |
ASoC: fsl: add dt support for imx-audmux
It adds device tree probe support for imx-audmux driver.
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/imx')
-rw-r--r-- | sound/soc/imx/imx-audmux.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sound/soc/imx/imx-audmux.c b/sound/soc/imx/imx-audmux.c index 87f8768e1cdc..b83699d905bb 100644 --- a/sound/soc/imx/imx-audmux.c +++ b/sound/soc/imx/imx-audmux.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <linux/err.h> | 22 | #include <linux/err.h> |
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/of.h> | ||
26 | #include <linux/of_device.h> | ||
25 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
26 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
27 | 29 | ||
@@ -197,6 +199,13 @@ static struct platform_device_id imx_audmux_ids[] = { | |||
197 | }; | 199 | }; |
198 | MODULE_DEVICE_TABLE(platform, imx_audmux_ids); | 200 | MODULE_DEVICE_TABLE(platform, imx_audmux_ids); |
199 | 201 | ||
202 | static const struct of_device_id imx_audmux_dt_ids[] = { | ||
203 | { .compatible = "fsl,imx21-audmux", .data = &imx_audmux_ids[0], }, | ||
204 | { .compatible = "fsl,imx31-audmux", .data = &imx_audmux_ids[1], }, | ||
205 | { /* sentinel */ } | ||
206 | }; | ||
207 | MODULE_DEVICE_TABLE(of, imx_audmux_dt_ids); | ||
208 | |||
200 | static const uint8_t port_mapping[] = { | 209 | static const uint8_t port_mapping[] = { |
201 | 0x0, 0x4, 0x8, 0x10, 0x14, 0x1c, | 210 | 0x0, 0x4, 0x8, 0x10, 0x14, 0x1c, |
202 | }; | 211 | }; |
@@ -243,6 +252,8 @@ EXPORT_SYMBOL_GPL(imx_audmux_v2_configure_port); | |||
243 | static int __init imx_audmux_probe(struct platform_device *pdev) | 252 | static int __init imx_audmux_probe(struct platform_device *pdev) |
244 | { | 253 | { |
245 | struct resource *res; | 254 | struct resource *res; |
255 | const struct of_device_id *of_id = | ||
256 | of_match_device(imx_audmux_dt_ids, &pdev->dev); | ||
246 | 257 | ||
247 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 258 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
248 | audmux_base = devm_request_and_ioremap(&pdev->dev, res); | 259 | audmux_base = devm_request_and_ioremap(&pdev->dev, res); |
@@ -256,6 +267,8 @@ static int __init imx_audmux_probe(struct platform_device *pdev) | |||
256 | audmux_clk = NULL; | 267 | audmux_clk = NULL; |
257 | } | 268 | } |
258 | 269 | ||
270 | if (of_id) | ||
271 | pdev->id_entry = of_id->data; | ||
259 | audmux_type = pdev->id_entry->driver_data; | 272 | audmux_type = pdev->id_entry->driver_data; |
260 | if (audmux_type == IMX31_AUDMUX) | 273 | if (audmux_type == IMX31_AUDMUX) |
261 | audmux_debugfs_init(); | 274 | audmux_debugfs_init(); |
@@ -279,6 +292,7 @@ static struct platform_driver imx_audmux_driver = { | |||
279 | .driver = { | 292 | .driver = { |
280 | .name = DRIVER_NAME, | 293 | .name = DRIVER_NAME, |
281 | .owner = THIS_MODULE, | 294 | .owner = THIS_MODULE, |
295 | .of_match_table = imx_audmux_dt_ids, | ||
282 | } | 296 | } |
283 | }; | 297 | }; |
284 | 298 | ||