Received: by 10.192.165.148 with SMTP id m20csp4528228imm; Tue, 24 Apr 2018 04:26:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx49evLBPo1Ej+0FQd/CAut9ViqrPFZq5xTnYkS24HXabMMezyGaezPbVD6oSmI6D1Bb6KxiQ X-Received: by 10.99.113.80 with SMTP id b16mr19998447pgn.326.1524569176553; Tue, 24 Apr 2018 04:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524569176; cv=none; d=google.com; s=arc-20160816; b=susCngxPPepY96tljp7knNdEp81YQQUSrkEuSVb/mvisR8mmdzJAv3mlRcdo0BlcQP X4GATPr1rDT9J/yfrdMr1LmQdTQxPNgqnP4/HVR7MP7MxbW0KbIFBYLKGfH1VV0CMLvf 1w0cgwf2t/TjxGFRZsWptYyDXIizCuyq7rXbLot9J+s1CRlATVkQogRbAvigAxoa/K/+ OP6PO8aipucOl/fvvSkxznT9Ve+XhgBo2/uwo8jKIsF0xUaKaXDQdgbStl9ASFgdNVT6 m1GteoC3EZ1Zr4AXFPX4U/QMqgoGGcmHUPSaMOIjaHX+XkUIaMtfuJdzAeACfq5JOrvt kHTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=qW4HDFfmXx6IK2sYRpxIrGa7sf+sp0zwgEHKHX5GmGw=; b=ui0Y5d8PBNYzVuMJTGLugDtLpWalI8kwYYXBBkjeCN92Dljw5+Bjss3mVBD2DG2vDU 3dYXlUEpKF9AgNPpf6qCmIBdN3z1fcCYNdPuTBGfPT0VKuG3AeAXBybFh9tV5/fqEFtm O11WssjM8wwWJbLnbaXzNF4JvGbt6cKr/8Z0bRhh6z2H+ZUu9G9qb09HOfokikctpAzD U634Wds0vbHMcFG5extBxs41aGGgSorWp7/yE/A8BPTcr+/XKFczPzSmuFhyJykVRgwV Ddwrhv55ta4G9pY67jjNVe+EgpyerZS7ZuW5JGGRSk+0wzaHxLRErdUMOOkLAf1FBWyo pnug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e16si8486294pgq.322.2018.04.24.04.26.01; Tue, 24 Apr 2018 04:26:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756556AbeDXJrn (ORCPT + 99 others); Tue, 24 Apr 2018 05:47:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:47740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755791AbeDXJrh (ORCPT ); Tue, 24 Apr 2018 05:47:37 -0400 Received: from ziggy.de (144.pool85-56-49.dynamic.orange.es [85.56.49.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03FFC21835; Tue, 24 Apr 2018 09:47:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 03FFC21835 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=matthias.bgg@kernel.org From: matthias.bgg@kernel.org To: ulrich.hecht+renesas@gmail.com, laurent.pinchart@ideasonboard.com, ck.hu@mediatek.com, p.zabel@pengutronix.de, airlied@linux.ie, robh+dt@kernel.org, mark.rutland@arm.com, mturquette@baylibre.com, sboyd@codeaurora.org, lee.jones@linaro.org Cc: davem@davemloft.net, gregkh@linuxfoundation.org, mchehab@kernel.org, rdunlap@infradead.org, pi-cheng.chen@linaro.org, sean.wang@mediatek.com, linux-clk@vger.kernel.org, linux@armlinux.org.uk, matthias.bgg@gmail.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Matthias Brugger Subject: [v2 resend 03/10] mfd: mtk-mmsys: Add mmsys driver Date: Tue, 24 Apr 2018 11:47:00 +0200 Message-Id: <99bef17c57ad60eff6104da780cf59b785bd3e42.1524563001.git.mbrugger@suse.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthias Brugger The MMSYS subsystem includes clocks and drm components. This patch adds a MFD device to probe both drivers from the same device tree compatible. Signed-off-by: Matthias Brugger --- drivers/mfd/Kconfig | 9 ++++++ drivers/mfd/Makefile | 2 ++ drivers/mfd/mtk-mmsys.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 drivers/mfd/mtk-mmsys.c diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index b860eb5aa194..a2c928e26026 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -378,6 +378,15 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MEDIATEK_MMSYS + tristate "Mediatek MMSYS interface" + select MDF_CORE + select REGMAP_MMIO + help + Select this if you have a MMSYS subsystem in your SoC. The + MMSYS subsystem has at least a clock driver part and some + DRM components. + config MFD_MXS_LRADC tristate "Freescale i.MX23/i.MX28 LRADC" depends on ARCH_MXS || COMPILE_TEST diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index d9d2cf0d32ef..b96118bd68d9 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -98,6 +98,8 @@ obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o +obj-$(CONFIG_MFD_MEDIATEK_MMSYS) += mtk-mmsys.o + obj-$(CONFIG_MFD_CORE) += mfd-core.o obj-$(CONFIG_EZX_PCAP) += ezx-pcap.o diff --git a/drivers/mfd/mtk-mmsys.c b/drivers/mfd/mtk-mmsys.c new file mode 100644 index 000000000000..c802343fb1c6 --- /dev/null +++ b/drivers/mfd/mtk-mmsys.c @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * mtk-mmsys.c -- Mediatek MMSYS multi-function driver + * + * Copyright (c) 2018 Matthias Brugger + * + * Author: Matthias Brugger + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +enum { + MMSYS_MT2701 = 1, +}; + +static const struct mfd_cell mmsys_mt2701_devs[] = { + { .name = "clk-mt2701-mm", }, + { .name = "drm-mt2701-mm", }, +}; + +static int mmsys_probe(struct platform_device *pdev) +{ + const struct mfd_cell *mmsys_cells; + int nr_cells; + long id; + int ret; + + id = (long) of_device_get_match_data(&pdev->dev); + if (!id) { + dev_err(&pdev->dev, "of_device_get match_data() failed\n"); + return -EINVAL; + } + + switch (id) { + case MMSYS_MT2701: + mmsys_cells = mmsys_mt2701_devs; + nr_cells = ARRAY_SIZE(mmsys_mt2701_devs); + break; + default: + return -ENODEV; + } + + ret = devm_mfd_add_devices(&pdev->dev, 0, mmsys_cells, nr_cells, + NULL, 0, NULL); + if (ret) { + dev_err(&pdev->dev, "failed to add MFD devices %d\n", ret); + return ret; + } + + return 0; +}; + +static const struct of_device_id of_match_mmsys[] = { + { .compatible = "mediatek,mt2701-mmsys", + .data = (void *) MMSYS_MT2701, + }, + { /* sentinel */ }, +}; + +static struct platform_driver mmsys_drv = { + .probe = mmsys_probe, + .driver = { + .name = "mediatek-mmysys", + .of_match_table = of_match_ptr(of_match_mmsys), + }, +}; + +builtin_platform_driver(mmsys_drv); + +MODULE_DESCRIPTION("Mediatek MMSYS multi-function driver"); +MODULE_LICENSE("GPL"); -- 2.16.3