From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B196765A for ; Fri, 9 Sep 2022 07:50:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16542C433D6; Fri, 9 Sep 2022 07:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662709812; bh=UDnbEwzulMssJ3lao9cmXQluHxSgc+Mdz3SMmAGC94o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nGMDup9/by5HBu7emjRkrfKV2YERfKP2sb6C8tsGKEoYU8EON8PK7TZ6kPJNmRg3b miPDC/ZLNdUVG/Ffl1idu0EmfpW24cJ97X2P3srf2P9IR6Rd9+9iB9xl1o5fnAq2SH FnaWQgqIvMgBBeG4UNjcM/gbgQqnj0rBhxORskISNOV5638i7/ltM3XPrbGTnXBD1s fpCcRYxuS2kDgKBM1aH+kL/9BoYY8nzZ2uwa+YYc5zkPT5E8B3tHfwILb0UQNvK1Nk iNE5LdJzDMHtLaK1WjFK0DsAtHQo/KhyAzBOwwR9SC3IFSFz8sJu4Nh+P8U7A8TR08 d9/c5rJK9RMLg== Date: Fri, 9 Sep 2022 08:50:07 +0100 From: Lee Jones To: Hector Martin Cc: Russell King , Arnd Bergmann , Linus Walleij , Alyssa Rosenzweig , asahi@lists.linux.dev, Bartosz Golaszewski , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Sven Peter Subject: Re: [PATCH 4/6] platform/apple: Add new Apple Mac SMC driver Message-ID: References: <45ed0a37-60ac-3a06-92d1-6b30e18261ff@marcan.st> <8f30a490-f970-6605-20cb-c2256daab9de@marcan.st> <82088b05-2a0d-69cc-ba2c-d61c74c9d855@marcan.st> Precedence: bulk X-Mailing-List: asahi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <82088b05-2a0d-69cc-ba2c-d61c74c9d855@marcan.st> On Thu, 08 Sep 2022, Hector Martin wrote: > On 08/09/2022 22.36, Lee Jones wrote: > > On Thu, 08 Sep 2022, Hector Martin wrote: > > > >> On 08/09/2022 21.31, Lee Jones wrote: > >>> The long and the short of it is; if you wish to treat this device, or > >>> at least a section of it, as a type of MFD, then please draft that > >>> part of it as an MFD driver, residing in drivers/mfd. If it's "not > >>> really an MFD", then find another way to represent the conglomeration > >>> please. > >>> > >>> If the MFD route is the best, then you can register each of the > >>> devices, including the *-core from drivers/mfd. Grep for "cross-ec" > >>> as a relatively recently good example. > >> > >> I think cros-ec is similar enough, yeah. As long as you don't mind > >> having the core codebase in mfd/ (4 files: core, rtkit backend, and > >> future T2 and legacy backends) we can do that. > > > > That's actually not what I'm suggesting. > > > > You *only* need to move the subsequent-device-registration handling > > into drivers/mfd. The remainder really should be treated as Platform > > (not to be confused with Arch Platform) code and should reside in > > drivers/platform. Just as we do with cros-ec. > > That's... an interesting approach. How you decide to initially architect it would be your choice. We can then discuss any potential improvements / suggestions. > Is the code in drivers/mfd supposed > to be a subdevice itself? That seems to be what's going on with > cros_ec_dev.c, but do we really need that layer of indirection? Ideally not. The evolution of cros-ec happened over many iterations and much time. Initially it was almost entirely implemented in drivers/mfd until I requested for a lot of the truly platform code to be moved out, as it grew beyond the bounds of, and was therefore no longer relevant to MFD. If we were to design and build it up again from scratch, I'd suggest that the MFD part would be the core-driver / entry-point. That driver should request and initialise shared resources and register the other devices, which is essentially the MFD's mantra. > What's the point of just having effectively an array of mfd_cell and > wrappers to call into the mfd core in the drivers/mfd/ tree and the > rest of the driver elsewhere? They should be separate drivers, with MFD registering the Platform. -- Lee Jones [李琼斯] From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E3DEECAAD3 for ; Fri, 9 Sep 2022 07:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=E/c7PggmqajyN8fTKtiURzuIbsPIxWx11pGyqVyiC3E=; b=oaNPG6tiS55ETT kvknLbCb5c1VAKKiq1M6NiCPpQ7BfNS4CFMLkOYhTsUr8jUgJ9duZI1avWHxmtXZMwqxclYswhisB rgUH0WlvVvObl0OhsvDNhY2QwVbWVw+ICbpOrX33bS1l4CPuoLDubMG0sDeFiT4m5pFnKj3gnsR2N 8Po4WvrYXqtH2WWVYoRclmrBzekwuuBL7dam0vHg5I4mEpuj60vDF0YbH8tlEb5kzHkvIoXryGm+W 5dbeVfSooHrK1Zv+cvO4qRSVqgbjFc6PpeFAm7qHQrP8NX+VtkoWqb3zDqzxmceu/wBCQKkuWAR59 KGSnFD3HZGBk/rZbbPJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oWYqc-00EC5X-P3; Fri, 09 Sep 2022 07:54:47 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oWYmI-00E98t-5y for linux-arm-kernel@lists.infradead.org; Fri, 09 Sep 2022 07:50:20 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 669D2CE2159; Fri, 9 Sep 2022 07:50:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16542C433D6; Fri, 9 Sep 2022 07:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662709812; bh=UDnbEwzulMssJ3lao9cmXQluHxSgc+Mdz3SMmAGC94o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nGMDup9/by5HBu7emjRkrfKV2YERfKP2sb6C8tsGKEoYU8EON8PK7TZ6kPJNmRg3b miPDC/ZLNdUVG/Ffl1idu0EmfpW24cJ97X2P3srf2P9IR6Rd9+9iB9xl1o5fnAq2SH FnaWQgqIvMgBBeG4UNjcM/gbgQqnj0rBhxORskISNOV5638i7/ltM3XPrbGTnXBD1s fpCcRYxuS2kDgKBM1aH+kL/9BoYY8nzZ2uwa+YYc5zkPT5E8B3tHfwILb0UQNvK1Nk iNE5LdJzDMHtLaK1WjFK0DsAtHQo/KhyAzBOwwR9SC3IFSFz8sJu4Nh+P8U7A8TR08 d9/c5rJK9RMLg== Date: Fri, 9 Sep 2022 08:50:07 +0100 From: Lee Jones To: Hector Martin Cc: Russell King , Arnd Bergmann , Linus Walleij , Alyssa Rosenzweig , asahi@lists.linux.dev, Bartosz Golaszewski , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Sven Peter Subject: Re: [PATCH 4/6] platform/apple: Add new Apple Mac SMC driver Message-ID: References: <45ed0a37-60ac-3a06-92d1-6b30e18261ff@marcan.st> <8f30a490-f970-6605-20cb-c2256daab9de@marcan.st> <82088b05-2a0d-69cc-ba2c-d61c74c9d855@marcan.st> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <82088b05-2a0d-69cc-ba2c-d61c74c9d855@marcan.st> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220909_005018_607337_1F181BBC X-CRM114-Status: GOOD ( 27.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org T24gVGh1LCAwOCBTZXAgMjAyMiwgSGVjdG9yIE1hcnRpbiB3cm90ZToKCj4gT24gMDgvMDkvMjAy MiAyMi4zNiwgTGVlIEpvbmVzIHdyb3RlOgo+ID4gT24gVGh1LCAwOCBTZXAgMjAyMiwgSGVjdG9y IE1hcnRpbiB3cm90ZToKPiA+IAo+ID4+IE9uIDA4LzA5LzIwMjIgMjEuMzEsIExlZSBKb25lcyB3 cm90ZToKPiA+Pj4gVGhlIGxvbmcgYW5kIHRoZSBzaG9ydCBvZiBpdCBpczsgaWYgeW91IHdpc2gg dG8gdHJlYXQgdGhpcyBkZXZpY2UsIG9yCj4gPj4+IGF0IGxlYXN0IGEgc2VjdGlvbiBvZiBpdCwg YXMgYSB0eXBlIG9mIE1GRCwgdGhlbiBwbGVhc2UgZHJhZnQgdGhhdAo+ID4+PiBwYXJ0IG9mIGl0 IGFzIGFuIE1GRCBkcml2ZXIsIHJlc2lkaW5nIGluIGRyaXZlcnMvbWZkLiAgSWYgaXQncyAibm90 Cj4gPj4+IHJlYWxseSBhbiBNRkQiLCB0aGVuIGZpbmQgYW5vdGhlciB3YXkgdG8gcmVwcmVzZW50 IHRoZSBjb25nbG9tZXJhdGlvbgo+ID4+PiBwbGVhc2UuCj4gPj4+Cj4gPj4+I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