ASoC: fsl_acm: add audio clock mux driver
authorViorel Suman <viorel.suman@nxp.com>
Thu, 20 Apr 2017 08:26:22 +0000 (11:26 +0300)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:22:03 +0000 (15:22 -0500)
Add audio clock mux (ACM) driver. The Audio Clock Mux (ACM)
is a collection of control registers and multiplexers that are
used to route the audio source clocks to the audio peripherals.
Each audio peripheral has its dedicated audio clock mux and
control register.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Documentation/devicetree/bindings/sound/fsl,acm.txt [new file with mode: 0644]
sound/soc/fsl/Kconfig
sound/soc/fsl/Makefile
sound/soc/fsl/fsl_acm.c [new file with mode: 0644]

diff --git a/Documentation/devicetree/bindings/sound/fsl,acm.txt b/Documentation/devicetree/bindings/sound/fsl,acm.txt
new file mode 100644 (file)
index 0000000..05d224a
--- /dev/null
@@ -0,0 +1,18 @@
+NXP Audio Clock Mux (ACM)
+
+The Audio Clock Mux (ACM) is a collection of control registers and multiplexers
+that are used to route the audio source clocks to the audio peripherals.
+Each audio peripheral has its dedicated audio clock mux and control register.
+
+Required properties:
+
+  - compatible : Contains "nxp,imx8qm-acm".
+  - reg                : Offset and length of the register set for the device.
+
+Example:
+
+acm:  acm@59e00000 {
+       compatible = "nxp,imx8qm-acm";
+       reg = <0x0 0x59e00000 0x0 0x1D0000>;
+       status = "okay";
+};
index 1475a63..5423cc1 100644 (file)
@@ -24,6 +24,14 @@ config SND_SOC_FSL_SAI
          This option is only useful for out-of-tree drivers since
          in-tree drivers select it automatically.
 
+config SND_SOC_FSL_ACM
+       tristate "Audio Clock Multiplexer (ACM) module support"
+       help
+         Say Y if you want to add Audio Clock Multiplexer (ACM)
+         support for the Freescale CPUs.
+         This option is only useful for out-of-tree drivers since
+         in-tree drivers select it automatically.
+
 config SND_SOC_FSL_SSI
        tristate "Synchronous Serial Interface module (SSI) support"
        select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
index 367106d..687ed7d 100644 (file)
@@ -11,6 +11,7 @@ snd-soc-p1022-rdk-objs := p1022_rdk.o
 obj-$(CONFIG_SND_SOC_P1022_RDK) += snd-soc-p1022-rdk.o
 
 # Freescale SSI/DMA/SAI/SPDIF Support
+snd-soc-fsl-acm-objs := fsl_acm.o
 snd-soc-fsl-asoc-card-objs := fsl-asoc-card.o
 snd-soc-fsl-asrc-objs := fsl_asrc.o fsl_asrc_dma.o
 snd-soc-fsl-sai-objs := fsl_sai.o
@@ -21,6 +22,7 @@ snd-soc-fsl-esai-objs := fsl_esai.o
 snd-soc-fsl-utils-objs := fsl_utils.o
 snd-soc-fsl-dma-objs := fsl_dma.o
 snd-soc-fsl-rpmsg-i2s-objs := fsl_rpmsg_i2s.o
+obj-$(CONFIG_SND_SOC_FSL_ACM) += snd-soc-fsl-acm.o
 obj-$(CONFIG_SND_SOC_FSL_ASOC_CARD) += snd-soc-fsl-asoc-card.o
 snd-soc-fsl-hdmi-objs := fsl_hdmi.o
 obj-$(CONFIG_SND_SOC_FSL_ASRC) += snd-soc-fsl-asrc.o
diff --git a/sound/soc/fsl/fsl_acm.c b/sound/soc/fsl/fsl_acm.c
new file mode 100644 (file)
index 0000000..d923e92
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Freescale ALSA SoC Digital Audio Interface (ACM) driver.
+ *
+ * Copyright 2016 Freescale Semiconductor, Inc.
+ *
+ * This program is free software, you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 2 of the License, or(at your
+ * option) any later version.
+ *
+ */
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+
+static int fsl_acm_probe(struct platform_device *pdev)
+{
+       struct resource *res;
+       void __iomem *base;
+
+       pr_info("***** imx8qm_acm_init *****\n");
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       base = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(base))
+               return PTR_ERR(base);
+
+       return 0;
+}
+
+static const struct of_device_id fsl_acm_ids[] = {
+       { .compatible = "nxp,imx8qm-acm", },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, fsl_acm_ids);
+
+static struct platform_driver fsl_acm_driver = {
+       .probe = fsl_acm_probe,
+       .driver = {
+               .name = "fsl-acm",
+               .of_match_table = fsl_acm_ids,
+       },
+};
+module_platform_driver(fsl_acm_driver);
+
+MODULE_DESCRIPTION("Freescale Soc ACM Interface");
+MODULE_ALIAS("platform:fsl-acm");
+MODULE_LICENSE("GPL");