summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattis fjallstrom <mattis@acm.org>2015-07-06 14:16:00 -0700
committermattis fjallstrom <mattis@acm.org>2015-07-06 14:16:18 -0700
commitcdfe941141942b368f24d98b9ee5733d4cab21ee (patch)
tree503bd1d801bf5004bc630d2e7f7e51d802927085
parente93fc20a5d45e7a0aed4cd81de52bb8258746ab7 (diff)
parent9bf9e3a205f36d4349bc6aa63da76cdaf3e855c3 (diff)
downloadolio-linux-3.10-cdfe941141942b368f24d98b9ee5733d4cab21ee.tar.xz
olio-linux-3.10-cdfe941141942b368f24d98b9ee5733d4cab21ee.zip
Merge branch 'android-3.10-bringup' of ssh://internal.oliodevices.com:29418/kernel/omap into android-3.10-bringup
Change-Id: I600f39719a0637ef9b964f92cec395cd76f30f07
-rw-r--r--arch/arm/boot/dts/omap3_h1.dts5
-rw-r--r--sound/soc/omap/omap3h1.c77
2 files changed, 56 insertions, 26 deletions
diff --git a/arch/arm/boot/dts/omap3_h1.dts b/arch/arm/boot/dts/omap3_h1.dts
index 0fa2fbe72cc..45cc88876a9 100644
--- a/arch/arm/boot/dts/omap3_h1.dts
+++ b/arch/arm/boot/dts/omap3_h1.dts
@@ -105,6 +105,11 @@
<0x9f4 123 1>, /* BT host wake */
<0x1b0 23 1>; /* sys_nirq */
};
+
+ sound {
+ compatible = "olio,omap-soc-omap3h1";
+ olio,mcbsp = <&mcbsp3>;
+ };
};
&vc {
diff --git a/sound/soc/omap/omap3h1.c b/sound/soc/omap/omap3h1.c
index 108d104502d..2cd624744ea 100644
--- a/sound/soc/omap/omap3h1.c
+++ b/sound/soc/omap/omap3h1.c
@@ -26,6 +26,7 @@
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
@@ -46,7 +47,7 @@ static int omap3h1_hw_params(struct snd_pcm_substream *substream,
//freq = 256 * params_rate(params);
// We are triggering from the 96 MHz FSCK
- pr_info("ASoc OMAP3H1: setting according to system clock\n");
+ pr_info("ASoc OMAP3H1: setting system clock to: %d", freq);
ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_SYSCLK_CLKS_FCLK,
96000000, SND_SOC_CLOCK_OUT);
if (ret < 0) {
@@ -103,45 +104,69 @@ static struct snd_soc_card snd_soc_omap3h1 = {
// .num_dapm_routes = ARRAY_SIZE(dmic_audio_map),
};
-static struct platform_device *omap3h1_snd_device;
-
-static int __init omap3h1_soc_init(void)
+static int omap3h1_card_probe(struct platform_device *pdev)
{
- int ret;
+ struct device_node *node = pdev->dev.of_node;
+ struct snd_soc_card *card = &snd_soc_omap3h1;
+ int ret = 0;
- if (!(machine_is_omap3_h1()))
- return -ENODEV;
- pr_info("OMAP3 H1 SoC init\n");
+#ifdef CONFIG_OF
+ if (node) {
+ struct device_node *dai_node;
+
+ dai_node = of_parse_phandle(node, "olio,mcbsp", 0);
+ if (!dai_node) {
+ dev_err(&pdev->dev, "mcbsp node is not provided\n");
+ return -EINVAL;
+ }
+ omap3h1_dai.cpu_dai_name = NULL;
+ omap3h1_dai.cpu_of_node = dai_node;
- omap3h1_snd_device = platform_device_alloc("soc-audio", -1);
- if (!omap3h1_snd_device) {
- printk(KERN_ERR "Platform device allocation failed\n");
- return -ENOMEM;
+ } else {
+ dev_err(&pdev->dev, "Missing node\n");
+ return -ENODEV;
}
+#endif
- platform_set_drvdata(omap3h1_snd_device, &snd_soc_omap3h1);
+ card->dev = &pdev->dev;
+ snd_soc_card_set_drvdata(card, NULL);
- ret = platform_device_add(omap3h1_snd_device);
- if (ret)
- goto err1;
+ ret = snd_soc_register_card(card);
+ if (ret) {
+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
+ ret);
+ return ret;
+ }
return 0;
-
-err1:
- printk(KERN_ERR "Unable to add platform device\n");
- platform_device_put(omap3h1_snd_device);
-
- return ret;
}
-static void __exit omap3h1_soc_exit(void)
+static int omap3h1_card_remove(struct platform_device *pdev)
{
- platform_device_unregister(omap3h1_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(omap3h1_soc_init);
-module_exit(omap3h1_soc_exit);
+static const struct of_device_id omap_soc_h1_of_match[] = {
+ {.compatible = "olio,omap-soc-omap3h1", },
+ { },
+};
+MODULE_DEVICE_TABLE(of, omap_soc_h1_of_match);
+
+static struct platform_driver omap3h1_driver = {
+ .driver = {
+ .name = "omap-soc-omap3h1",
+ .of_match_table = of_match_ptr(omap_soc_h1_of_match),
+ },
+ .probe = omap3h1_card_probe,
+ .remove = omap3h1_card_remove,
+};
+
+module_platform_driver(omap3h1_driver);
MODULE_AUTHOR("Evan Wilson <evan@oliodevices.com");
MODULE_DESCRIPTION("ALSA SoC OMAP3 H1");
MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:omap-soc-omap3h1");