aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Zhao <richard.zhao@freescale.com>2011-12-31 10:27:56 +0800
committerEric Miao <eric.miao@linaro.org>2012-01-11 21:51:18 +0800
commiteb6d1ece9e858556799674b6138dd147b3fb4627 (patch)
tree1dcd40a06f1e717befc8d2c71add5b47545dd785
parentf3d46153721ec8d7d866766609f4cc98e7953c07 (diff)
downloadlinux-linaro-eb6d1ece9e858556799674b6138dd147b3fb4627.tar.gz
arm/imx6q: add imx-sgtl5000 device from sabrelite board
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c51
-rw-r--r--sound/soc/imx/Kconfig2
2 files changed, 52 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 3f46730ac06..dc4e99f2b95 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -20,6 +20,8 @@
#include <linux/phy.h>
#include <linux/micrel_phy.h>
#include <linux/dma-mapping.h>
+#include <linux/clk.h>
+#include <linux/fsl_devices.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/hardware/gic.h>
#include <asm/mach/map.h>
@@ -124,6 +126,52 @@ static const struct of_dev_auxdata imx6q_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA("fsl,vpu", MX6Q_VPU_BASE_ADDR, "mxc_vpu.0", &vpu_pdata),
};
+static struct mxc_audio_platform_data mx6_sabrelite_audio_data;
+
+static int mx6_sabrelite_sgtl5000_init(void)
+{
+ struct clk *clko;
+ struct clk *new_parent;
+ int rate;
+
+ clko = clk_get(NULL, "clko_clk");
+ if (IS_ERR(clko)) {
+ pr_err("can't get CLKO clock.\n");
+ return PTR_ERR(clko);
+ }
+ new_parent = clk_get(NULL, "ahb");
+ if (!IS_ERR(new_parent)) {
+ clk_set_parent(clko, new_parent);
+ clk_put(new_parent);
+ }
+ rate = clk_round_rate(clko, 16000000);
+ if (rate < 8000000 || rate > 27000000) {
+ pr_err("Error:SGTL5000 mclk freq %d out of range!\n", rate);
+ clk_put(clko);
+ return -1;
+ }
+
+ mx6_sabrelite_audio_data.sysclk = rate;
+ clk_set_rate(clko, rate);
+ clk_enable(clko);
+ return 0;
+}
+
+static struct mxc_audio_platform_data mx6_sabrelite_audio_data = {
+ .ssi_num = 1,
+ .src_port = 2,
+ .ext_port = 4,
+ .init = mx6_sabrelite_sgtl5000_init,
+ .hp_gpio = -1,
+};
+
+static struct platform_device mx6_sabrelite_audio_device = {
+ .name = "imx-sgtl5000",
+ .dev = {
+ .platform_data = &mx6_sabrelite_audio_data,
+ },
+};
+
static void __init imx6q_init_machine(void)
{
if (of_machine_is_compatible("fsl,imx6q-sabrelite")) {
@@ -138,6 +186,9 @@ static void __init imx6q_init_machine(void)
iram_init(MX6Q_IRAM_BASE_ADDR, MX6Q_IRAM_SIZE);
+ if (of_machine_is_compatible("fsl,imx6q-sabrelite"))
+ platform_device_register(&mx6_sabrelite_audio_device);
+
imx6q_pm_init();
}
diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig
index 7ffeed2d351..32f0af77869 100644
--- a/sound/soc/imx/Kconfig
+++ b/sound/soc/imx/Kconfig
@@ -49,7 +49,7 @@ config SND_SOC_PHYCORE_AC97
config SND_SOC_IMX_SGTL5000
tristate "SoC Audio support for i.MX boards with sgtl5000"
- depends on MACH_MX35_3DS || MACH_MX51_BABBAGE || MACH_MX53_LOCO
+ depends on MACH_MX35_3DS || MACH_MX51_BABBAGE || MACH_MX53_LOCO || SOC_IMX6Q
select SND_SOC_SGTL5000
select SND_MXC_SOC_MX2
help