Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7964251rwl; Thu, 23 Mar 2023 10:47:09 -0700 (PDT) X-Google-Smtp-Source: AK7set8R8Wpjbe4WAvRxkBHuIH32K5TckHNlp1R16tsq5jNQoQocRlaIAbBbSj6iG1jlBEeAW3xU X-Received: by 2002:a17:90b:1bcc:b0:23d:39e0:142 with SMTP id oa12-20020a17090b1bcc00b0023d39e00142mr9048717pjb.42.1679593629311; Thu, 23 Mar 2023 10:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679593629; cv=none; d=google.com; s=arc-20160816; b=RWoPkm2o//vqzpHXAshUC0DfuGvbPcCcNCGqDlEMa6x9tla8NC/T8EZNh4SXJgJpLz naqrsih8gIbgDvxDNWP9TBgLnwk4mGgotBceSPZaqOrFwzu1SXwOgdUd5Am462SyevlO LyTr/trXhVDv7rw+L3NhF3MJ3djXMkBvzDoVbCyBzmp8Mia1HS4I847JeQfEtjgae2dl oizOwMh/xmxk7wwbRVNORrLZKGd5DxmNbTrMi9QUMS7AX3kdST3iS0OU0o4dP34k0OtE ScwkbqiamtrH20W7LCawWgHjbcPemCUmCHMETt4VDADcA1XRgSpMpBj+5xh2PXQse9Cp buDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=4zZwoU/ke6dQ47Fpxm1JOoGRUjkQ68oE18bTPBtGnSQ=; b=Q4f9kHb9WavvroQfrr1/3NL91deu3QqnqxAK/gwLt8+HKaV8DjKpyDufnnTGMN/O3T 0fMyYfTQouZqhi99OIny70YcQYtU6PJ8BPACy9q3A6fcQ/kOgi0pz91QsIgSt27ualoD CnAKsAn8ByaCPd3Gpr03ZqD0wvW0jyoyod7IHO2IBj6bCKabtsA2Pst6Ryq9Sa2lLuyM kN+TrSE6yC5UmSLCFj/FSWgFdiXqkct/FDR8eOnYZ35TmjvHnqxcOVNTbPNrGAQIhzQa dTticnhBl7cmxC9dO2HmXsW+kQEcJyn1545LreY1Y/hjoMOQVg6N1siNEqk7aqAiI4Xk 1cvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=n5SeMFeS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a17090a110800b00230ca3efcf3si2270902pja.158.2023.03.23.10.46.19; Thu, 23 Mar 2023 10:47:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=n5SeMFeS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbjCWRpn (ORCPT + 99 others); Thu, 23 Mar 2023 13:45:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbjCWRpl (ORCPT ); Thu, 23 Mar 2023 13:45:41 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F0463AAE; Thu, 23 Mar 2023 10:45:40 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32N5m0Hh012881; Thu, 23 Mar 2023 12:45:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : content-transfer-encoding : in-reply-to; s=PODMain02222019; bh=4zZwoU/ke6dQ47Fpxm1JOoGRUjkQ68oE18bTPBtGnSQ=; b=n5SeMFeSWfjHR72rba5hOWcSboS2zdP1AeKv9THzzFBSlcPEJ12a/DByd5il3XUnlqLb C1yKny3Da/mHqTT0DG4dOXwrf3J7Joftn6iPX5sBNznD7MWz29/phFDD4wt+LPnYdmhO ac8C+BVv2zDzY8UXai1s++DWFP+fOulUqD1cWkeaxdvYFRVJ1oTLQFNkgG9OM+SeaKWD E2nbA6g4UGVTgTp3yaiAv6h6GiXVlX0nVcNW28B8Rj5CytKZwq0icldAWqrz278lJ2Z1 cSEvzBo77CWcnfFm/aSN8K39N0sKDmjEoTsZRRrakj2dmfeugTLLb0Kmuxbf/77YXWGG Ug== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3pf7tj597b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Mar 2023 12:45:33 -0500 Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Thu, 23 Mar 2023 12:45:31 -0500 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Thu, 23 Mar 2023 12:45:31 -0500 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id C4E80B06; Thu, 23 Mar 2023 17:45:31 +0000 (UTC) Date: Thu, 23 Mar 2023 17:45:31 +0000 From: Charles Keepax To: Doug Anderson CC: Marek Szyprowski , , , Liam Girdwood , Mark Brown , Subject: Re: [PATCH] regulator: wm8994: Use PROBE_FORCE_SYNCHRONOUS Message-ID: <20230323174531.GM68926@ediswmail.ad.cirrus.com> References: <20230323083312.199189-1-m.szyprowski@samsung.com> <20230323114035.GL68926@ediswmail.ad.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-ORIG-GUID: BOPtBcpPpYEA3VAHEFh4VZ5WuTIQKaDu X-Proofpoint-GUID: BOPtBcpPpYEA3VAHEFh4VZ5WuTIQKaDu X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 23, 2023 at 09:53:18AM -0700, Doug Anderson wrote: > On Thu, Mar 23, 2023 at 4:40 AM Charles Keepax > If my analysis is correct, there's still potential to run into similar > problems even with PROBE_FORCE_SYNCHRONOUS. I don't think that > mfd_add_devices() is _guaranteed_ to finish probing all the > sub-devices by the time it returns. Specifically, imagine that > wm8994_ldo_probe() tries to get a GPIO that that system hasn't made > available yet. Potentially the system could return -EPROBE_DEFER there > and that would put the LDO on the deferred probe list. Doing so won't > cause mfd_add_devices() to fail. Now we'll end up with a dummy > regulator again. Admittedly most cases GPIO providers probe really > early and so this argument is a bit of a stretch, but I guess the > point is that there's no official guarantee that mfd_add_devices() > will finish probing all sub-devices so it's not ideal to rely on. > Also, other drivers with a similar pattern might have other reasons to > -EPROBE_DEFER. > > These types of issues are the same ones I faced with DP AUX bus and > the solutions were never super amazing... > > One solution we ended up with for the DP AUX bus was to add a > "done_probing" callback argument to devm_of_dp_aux_populate_bus(). > This allowed the parent to be called back when all the children were > done probing. This implementation is easier for DP AUX bus than it > would be in the generic MFD case, but conceivably it would be possible > there too? > > Another possible solution is to somehow break the driver up into more > sub-drivers. Essentially, you have a top-level "wm8994" that's not > much more than a container. Then you create a new-sub-device and > relegate anything that needs the regulators to the new sub-device. The > new sub-device can just -EPROBE_DEFER until it detects that the > regulators have finished probing. I ended up doing stuff like this for > "ti-sn65dsi86.c" using the Linux aux bus (not to be confused with the > DP Aux bus) and it was a bit odd but worked OK. Yes I believe you are correct, there is still an issue here, indeed a quick test suggests I can still cause this by forcing a probe defer in the regulator driver. I think really the best place to look at this would be at the regulator level. It is fine if mfd_add_devices passes, the problem really is that the regulator core doesn't realise the regulator is going to be arriving, and thus returns a dummy regulator, rather than returning EPROBE_DEFER. If it did the MFD driver would probe defer at the point of requesting the regulator, which would all make sense. I will see if I can find some time to think about that further but very unlikely to happen this week. Thanks, Charles