From 5f5a9c97f5917e6659316249222c893663e1b790 Mon Sep 17 00:00:00 2001 From: Abel Vesa Date: Tue, 3 Sep 2019 16:02:00 +0300 Subject: [PATCH] mfd: Add audiomix support Some of the i.MX SoCs have a IP for interfacing the audio dedicated IPs with clocks, resets and interrupts, plus some DSP specific control registers. To allow the functionality to be split between drivers, this MFD driver is added that has only two purposes: register the devices and map the entire register addresses. Everything else is left to the dedicated drivers that will bind to the registered devices. Signed-off-by: Abel Vesa Reviewed-by: Leonard Crestez --- drivers/mfd/Kconfig | 6 +++++ drivers/mfd/Makefile | 1 + drivers/mfd/imx-audiomix.c | 48 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 drivers/mfd/imx-audiomix.c diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index b53f65a7cb05..5043f43d0291 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -467,6 +467,12 @@ config MFD_MXC_HDMI This is the core driver for the Freescale i.MX6 on-chip HDMI. This MFD driver connects with the video and audio drivers for HDMI. +config MFD_IMX_AUDIOMIX + tristate "NXP i.MX8MP Audiomix Control Driver" + depends on OF || COMPILE_TEST + help + Enable audiomix support + config MFD_HI6421_PMIC tristate "HiSilicon Hi6421 PMU/Codec IC" depends on OF diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index b982b3b76f09..622be1a92c1c 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -113,6 +113,7 @@ obj-$(CONFIG_TWL6040_CORE) += twl6040.o obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o obj-$(CONFIG_MFD_MXC_HDMI) += mxc-hdmi-core.o +obj-$(CONFIG_MFD_IMX_AUDIOMIX) += imx-audiomix.o obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o diff --git a/drivers/mfd/imx-audiomix.c b/drivers/mfd/imx-audiomix.c new file mode 100644 index 000000000000..d3f8c7179cc2 --- /dev/null +++ b/drivers/mfd/imx-audiomix.c @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2019 NXP. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static int imx_audiomix_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct resource *res; + void __iomem *base; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + + dev_set_drvdata(dev, base); + + return devm_of_platform_populate(dev); +} + +static const struct of_device_id imx_audiomix_of_match[] = { + { .compatible = "fsl,imx8mp-audiomix" }, + { /* Sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, imx_audiomix_of_match); + +static struct platform_driver imx_audiomix_driver = { + .probe = imx_audiomix_probe, + .driver = { + .name = "imx-audiomix", + .of_match_table = of_match_ptr(imx_audiomix_of_match), + }, +}; +module_platform_driver(imx_audiomix_driver);