Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2754538rwa; Mon, 22 Aug 2022 13:08:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR5/WNazgDK7iqCPIAvb7kwPe+iC4rWEV8eRJuXtSmejo3AQJx3V7v1lAls+yprT3LZqdxE/ X-Received: by 2002:a17:90b:4a0e:b0:1fb:4c5e:9584 with SMTP id kk14-20020a17090b4a0e00b001fb4c5e9584mr43592pjb.152.1661198885497; Mon, 22 Aug 2022 13:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661198885; cv=none; d=google.com; s=arc-20160816; b=vJ4H08dxxbCIQWjU3onzDn8HAUPNscQTE5uGNACWwarnsJQm4/2JNUDkOHR4t3E5AK 87rM6XVPK183+/M2YooWgfLTjZNjipJ/1vgzNBNzZNR1hd/y123Zhhop+1NnhsLAf5Un qlZ5So+YjEheMKOZKMQ//4yaDZcZzHthe2XBzhrU0LFi8dlqU4a63IYIeDPNpjZ8KYU0 bUl3yD7oWFBFREsHsPGAllAvnHH2Hhi1L7Ue2/XB1NQCEn5y8RSWao4fiRlsxTBHnTo6 F0JATXfVv0CYkPGvfuYDnBxMKcOuRtzH3YEPBjhE6HPnRffKW7zC1AGZxPkzmzMK1nEL Aziw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=utqk4gGdKcZK/drHg6MTAGb5WN+LseARDrrEG5K9cnM=; b=D2Unpv8Faqapf0oPhq0Zr+i+bcUXzilThAUYnkdumtyRXj/cQzvA2oAdzx5iKwbpjL +uoAx6lIpRyXVIp+1e2qOq6f1yLzmHdP+PNzCpTIAbgbmZWqKy98xY/A6ADayvjSb0I3 RlA0Pd5tn3ZHJhwqynQfawH2CGmwsA11kDGxx3lMdZ281slcSxHn4uioLhPAdhoCOxcm e6CSmzwugxxKe/xXev2t2BK6jBIoUgAKbxFUTxSFQuuFAD9P3oL2kGCAaq+By5TzB5e6 gySgTqIULo5GL62vlooDYQiQK6yPsmmoN6/dNfdwDUeypGY2pEKTtM3eErbd0l4n2soR T4jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UzwmU6I1; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q187-20020a6343c4000000b0041af5f9cf2asi13646017pga.114.2022.08.22.13.07.54; Mon, 22 Aug 2022 13:08:05 -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=@redhat.com header.s=mimecast20190719 header.b=UzwmU6I1; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238858AbiHVTcf (ORCPT + 99 others); Mon, 22 Aug 2022 15:32:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238707AbiHVTcC (ORCPT ); Mon, 22 Aug 2022 15:32:02 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27D585FD4 for ; Mon, 22 Aug 2022 12:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661196720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=utqk4gGdKcZK/drHg6MTAGb5WN+LseARDrrEG5K9cnM=; b=UzwmU6I1XJq7PnDeaL9qOi/VKVZ0zFiWZiin9H/gtA/aM7/+HgaA2AY+mA0JRNECMQCEaT Nhs3PcCWscmR/LjTtK98l6AEzz11JmBVLKsRylP+bLsFYRwobvLAUBAPJ/mX+S3zPLiUyX Q/HHJdDUaD27IuHRU/dJ4uiDBMXDu+Y= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-650-893OLe_kPtq-IxfqF8KUeg-1; Mon, 22 Aug 2022 15:31:57 -0400 X-MC-Unique: 893OLe_kPtq-IxfqF8KUeg-1 Received: by mail-qk1-f197.google.com with SMTP id ay10-20020a05620a178a00b006bbcab9d554so9391608qkb.13 for ; Mon, 22 Aug 2022 12:31:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=utqk4gGdKcZK/drHg6MTAGb5WN+LseARDrrEG5K9cnM=; b=OxOqiVUyrBf5mE4ZS2nsAg0i+impqyi9MSsMGu3FsQWVy4lR889Aiiq3SJpooRMIrm PXhWL90FdedjxUhst9F8Zzknok4tLA4f0aSRQgq3ujtrehhoOkY2qtW3TU8LAxcOtaa5 RWPZl5GQLb3rz7Lh5HJ6TDCVZDRs89CvjNbtwr4MeHu+8GAj/WnMeGuu2bSaXQ36BWCR xR33m+6ipGRGxN9lHs01AYNIBhkRvt2FlzIfa5pp38WuaM0ECz7RaVcrVMxfQd5Afz3X X73Z11hpFFdFHA4gktjvC0h1aSJyl20YqVaXV2uwJvtyI5URdq02L81guUkOoirW/A/n J9ZQ== X-Gm-Message-State: ACgBeo07TsapgD9WpXwsoEUBjZHtCwR0EimU5HXiemQAebIdNSkuy4Lb CjvU40TN2fg+4xS3Zypr46G0ppuMtNFqBC/LVxmZrb9pNIIhhfyOkvg3Fr9hSObzgCWg/PvwWHh gjUtROh9j567jp+E3G0B72JXb X-Received: by 2002:a05:622a:305:b0:343:5601:d5c4 with SMTP id q5-20020a05622a030500b003435601d5c4mr16528081qtw.130.1661196717025; Mon, 22 Aug 2022 12:31:57 -0700 (PDT) X-Received: by 2002:a05:622a:305:b0:343:5601:d5c4 with SMTP id q5-20020a05622a030500b003435601d5c4mr16528055qtw.130.1661196716788; Mon, 22 Aug 2022 12:31:56 -0700 (PDT) Received: from halaneylaptop ([2600:1700:1ff0:d0e0::48]) by smtp.gmail.com with ESMTPSA id y16-20020ac85f50000000b0031ecddf2278sm10252393qta.37.2022.08.22.12.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 12:31:56 -0700 (PDT) Date: Mon, 22 Aug 2022 14:31:53 -0500 From: Andrew Halaney To: Douglas Anderson Cc: Mark Brown , Andy Gross , Bjorn Andersson , Konrad Dybcio , Liam Girdwood , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] regulator: qcom-rpmh: Implement get_optimum_mode(), not set_load() Message-ID: <20220822193153.zn2oxljmd76awqot@halaneylaptop> References: <20220726102024.1.Icc838fe7bf0ef54a014ab2fee8af311654f5342a@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220726102024.1.Icc838fe7bf0ef54a014ab2fee8af311654f5342a@changeid> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Hey Douglas, On Tue, Jul 26, 2022 at 10:20:29AM -0700, Douglas Anderson wrote: > Since we don't actually pass the load to the firmware, switch to using > get_optimum_mode() instead of open-coding it. > > This is intended to have no effect other than cleanup. I hate to post something without looking into it very deeply, but with this statement about no effect I figured I'd report what I'm noticing before diving deeper. I'm currently playing with the dts patches in [0], and without this patch (and a hack patch applied that is unrelated to this) the board boots fine. With this patch applied I get the messages reported in [1] (which I think is still a clean up that should be applied) and the board fails to boot due to regulator_enable() failing at the first invocation I see. Is that something you expect? Here's the ultimate failure message for regulator_enable(): [ 1.213419] ufshcd-qcom 1d84000.ufs: Adding to iommu group 0 [ 1.219492] ufshcd-qcom 1d84000.ufs: ufshcd_populate_vreg: Unable to find vdd-hba-supply regulator, assuming enabled [ 1.230287] ufshcd-qcom 1d84000.ufs: ufshcd_populate_vreg: Unable to find vccq2-supply regulator, assuming enabled [ 1.241079] vreg_l17c: invalid input voltage found [ 1.246002] ufshcd-qcom 1d84000.ufs: ufshcd_enable_vreg: vcc enable failed, err=-22 [ 1.253952] ufshcd-qcom 1d84000.ufs: Initialization failed [ 1.259622] ufshcd-qcom 1d84000.ufs: ufshcd_pltfrm_init() failed -22 [ 1.266151] ufshcd-qcom: probe of 1d84000.ufs failed with error -22 [0] https://lore.kernel.org/all/20220722143711.17563-1-quic_ppareek@quicinc.com/ [1] https://lore.kernel.org/all/166118500944.215002.10320899094541954077.b4-ty@kernel.org/ Thanks, Andrew > > Signed-off-by: Douglas Anderson > --- > > drivers/regulator/qcom-rpmh-regulator.c | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) > > diff --git a/drivers/regulator/qcom-rpmh-regulator.c b/drivers/regulator/qcom-rpmh-regulator.c > index 561de6b2e6e3..b2debde79361 100644 > --- a/drivers/regulator/qcom-rpmh-regulator.c > +++ b/drivers/regulator/qcom-rpmh-regulator.c > @@ -306,9 +306,10 @@ static unsigned int rpmh_regulator_vrm_get_mode(struct regulator_dev *rdev) > } > > /** > - * rpmh_regulator_vrm_set_load() - set the regulator mode based upon the load > - * current requested > + * rpmh_regulator_vrm_get_optimum_mode() - get the mode based on the load > * @rdev: Regulator device pointer for the rpmh-regulator > + * @input_uV: Input voltage > + * @output_uV: Output voltage > * @load_uA: Aggregated load current in microamps > * > * This function is used in the regulator_ops for VRM type RPMh regulator > @@ -316,17 +317,15 @@ static unsigned int rpmh_regulator_vrm_get_mode(struct regulator_dev *rdev) > * > * Return: 0 on success, errno on failure > */ > -static int rpmh_regulator_vrm_set_load(struct regulator_dev *rdev, int load_uA) > +static unsigned int rpmh_regulator_vrm_get_optimum_mode( > + struct regulator_dev *rdev, int input_uV, int output_uV, int load_uA) > { > struct rpmh_vreg *vreg = rdev_get_drvdata(rdev); > - unsigned int mode; > > if (load_uA >= vreg->hw_data->hpm_min_load_uA) > - mode = REGULATOR_MODE_NORMAL; > + return REGULATOR_MODE_NORMAL; > else > - mode = REGULATOR_MODE_IDLE; > - > - return rpmh_regulator_vrm_set_mode(rdev, mode); > + return REGULATOR_MODE_IDLE; > } > > static int rpmh_regulator_vrm_set_bypass(struct regulator_dev *rdev, > @@ -375,7 +374,7 @@ static const struct regulator_ops rpmh_regulator_vrm_drms_ops = { > .list_voltage = regulator_list_voltage_linear_range, > .set_mode = rpmh_regulator_vrm_set_mode, > .get_mode = rpmh_regulator_vrm_get_mode, > - .set_load = rpmh_regulator_vrm_set_load, > + .get_optimum_mode = rpmh_regulator_vrm_get_optimum_mode, > }; > > static const struct regulator_ops rpmh_regulator_vrm_bypass_ops = { > -- > 2.37.1.359.gd136c6c3e2-goog >