Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp984851imm; Wed, 4 Jul 2018 09:18:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfWFCEyuJR4emWKUI025r20r0sd0nh+xbNBSl1F6hdaVNCbKyhApXqH4cC1idvPbRjuryQt X-Received: by 2002:a62:15c8:: with SMTP id 191-v6mr1565239pfv.194.1530721122342; Wed, 04 Jul 2018 09:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530721122; cv=none; d=google.com; s=arc-20160816; b=qWrjOcP9fnMNuXCeVeFZ+Xu3mGJbXjwzKmdxBuJe7Lk7eyaQWmR6NLbptOCTS3Qsy+ /EjgVON0M1IjxRkFP+dSsw3CzVpettNHIcwLalMB64l1tyHepoPb53FmD+nY1NWhZx75 sv15EN4nUwIdPa45U6aHFbsB9TkGim8VqOrknyPQxge3W7w42kJe/bogKdr+z2DBBIYQ asMm0R+VRtYfk+4b1gq+ytN4jpEQTScdAB4q+Kjj3QBpTvxYC9H+CtM7/BLCjyovrRpJ GqdNE62MBb0DYM45t7iIfbzvHykTg0yu9sEfV0KOEcwbltL2lLjjEmjtzZeBbt0jjeJV /WQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :arc-authentication-results; bh=KqS9VJeV5q6KwAjTuPpjqAGWrd4PwMFYJBXd0g5x5sI=; b=iTIAyUyr1FuTSzTX3szUChuFLh6eB//lcmaDvKKD+f7o1CwA6wwBDR1Q6Zopa6yoDY akz9eigcHl92nTXOjYyzvyA2NXa+3j0tMG4UFAk0Rd2YqJ6dge0vtK+pgCR+KSIj4eW2 a3TgNwPyMbbFGq7I82NjNLpHQEkh+5vgdct6VVXldYSbjThkQSglaD7VtjKijXHgv5sf y6a7LPKJ/ade1FZB8GeYEU/7YT8GEHy4JffLrb5Wesn5tXDeGdnKlV2kOl/bv57e+6/Y wkcNvDXZhwL5+VxcOQsmqjTNuNKma/FuXVYDlyF5sc6PAJC6frqqvwnchexHtnrYmGiJ 50vA== 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 x6-v6si3736297plv.315.2018.07.04.09.18.27; Wed, 04 Jul 2018 09:18:42 -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 S1752622AbeGDQRn (ORCPT + 99 others); Wed, 4 Jul 2018 12:17:43 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:59808 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbeGDQRl (ORCPT ); Wed, 4 Jul 2018 12:17:41 -0400 Received: from ziggy.stardust ([37.223.136.20]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Wed, 04 Jul 2018 18:17:37 +0200 Subject: Re: [v3 03/10] mfd: mtk-mmsys: Add mmsys driver To: Lee Jones , Matthias Brugger Cc: matthias.bgg@kernel.org, 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, davem@davemloft.net, gregkh@linuxfoundation.org, mchehab@kernel.org, rdunlap@infradead.org, sean.wang@mediatek.com, linux-clk@vger.kernel.org, linux@armlinux.org.uk, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20180430101826.GC5147@dell> <5269ccfd-0274-3c12-7eeb-5de923197d92@gmail.com> <20180703071103.GE20176@dell> From: Matthias Brugger Openpgp: preference=signencrypt Autocrypt: addr=mbrugger@suse.com; prefer-encrypt=mutual; keydata= xsFNBFP1zgUBEAC21D6hk7//0kOmsUrE3eZ55kjc9DmFPKIz6l4NggqwQjBNRHIMh04BbCMY fL3eT7ZsYV5nur7zctmJ+vbszoOASXUpfq8M+S5hU2w7sBaVk5rpH9yW8CUWz2+ZpQXPJcFa OhLZuSKB1F5JcvLbETRjNzNU7B3TdS2+zkgQQdEyt7Ij2HXGLJ2w+yG2GuR9/iyCJRf10Okq gTh//XESJZ8S6KlOWbLXRE+yfkKDXQx2Jr1XuVvM3zPqH5FMg8reRVFsQ+vI0b+OlyekT/Xe 0Hwvqkev95GG6x7yseJwI+2ydDH6M5O7fPKFW5mzAdDE2g/K9B4e2tYK6/rA7Fq4cqiAw1+u EgO44+eFgv082xtBez5WNkGn18vtw0LW3ESmKh19u6kEGoi0WZwslCNaGFrS4M7OH+aOJeqK fx5dIv2CEbxc6xnHY7dwkcHikTA4QdbdFeUSuj4YhIZ+0QlDVtS1QEXyvZbZky7ur9rHkZvP ZqlUsLJ2nOqsmahMTIQ8Mgx9SLEShWqD4kOF4zNfPJsgEMB49KbS2o9jxbGB+JKupjNddfxZ HlH1KF8QwCMZEYaTNogrVazuEJzx6JdRpR3sFda/0x5qjTadwIW6Cl9tkqe2h391dOGX1eOA 1ntn9O/39KqSrWNGvm+1raHK+Ev1yPtn0Wxn+0oy1tl67TxUjQARAQABzSlNYXR0aGlhcyBC cnVnZ2VyIDxtYXR0aGlhcy5iZ2dAZ21haWwuY29tPsLBkgQTAQIAPAIbAwYLCQgHAwIGFQgC CQoLBBYCAwECHgECF4AWIQTmuZIYwPLDJRwsOhfZ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llDmG/fQ== Message-ID: Date: Wed, 4 Jul 2018 18:17:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180703071103.GE20176@dell> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/07/18 09:11, Lee Jones wrote: > On Mon, 25 Jun 2018, Matthias Brugger wrote: >> On 30/04/18 12:18, Lee Jones wrote: >>> On Fri, 27 Apr 2018, matthias.bgg@kernel.org wrote: >>> >>>> 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..d23a3b9a2c58 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 MFD_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; >>>> +}; >>> >>> This driver is pretty pointless. It doesn't actually do anything. >>> >>> I think you just want to use "simple-mfd" instead. >>> >> >> I think the problem is, that right now we have two drivers which use the same >> devicetree binding, which are clk and drm driver. With a simple-mfd we would >> need two compatibles, and this would break backwards compatibility. > > So what functionality does this driver provide you with that you do > not have currently? > I'm not sure if I get your question. Point is, that the MMSYS implementation for mt8173 is broken, as it assumes that we can probe two drivers with the mediatek,mt8173-mmsys compatible. Somehow it used to work, but from what I understand it was a bug. So older devicetrees use just on mt8173-mmsys compatible in ther DTB. I would like to keep backwards compatibility for the device tree, that's why I was searching for a solution where we can probe two drivers and came up with this mfd solution. So no new functionality, the clk driver provides the clock the drm components need. Regards, Matthias