From patchwork Wed Aug 2 12:37:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 129866 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp491868vqx; Wed, 2 Aug 2023 07:19:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlF+Y7iSZ1AivJz042Dz6cvVfwECfB8Tay0kuMka8TxqCYpmqQSMwipwxBq+di0F8tzLVp5M X-Received: by 2002:a05:6a20:7289:b0:13e:da98:966a with SMTP id o9-20020a056a20728900b0013eda98966amr2934027pzk.5.1690985966248; Wed, 02 Aug 2023 07:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690985966; cv=none; d=google.com; s=arc-20160816; b=l24gGF8/UtL5CuzCo0UtIfVQKhkIO7xsFet9Zl5A7dwCFBUr7QTLZopu1ft54zadbJ kgaTULF1MNmnm6JCLKuH5uHSsECG0hW3HGQ+JlZACR1X0kZ5LCdOUqWgedcEJ/uKoUXr +R+nLFmOc76dOh+cqK9UW204IdEqLp+K8iFhz6v1jtjbGU3z3pYYaOKdGAry7wWUT3Jx 2UxwvXt4eYS8x4gaTV7qkX41ptpdesGEYaoJY01ExWr1CZWtrHvkdkaWYib8sHh3lB08 a0aUOtMHhVYLI6i18N520EzMdVjXQkUXVN/PAfTMjZGedCmqfW2NBJkl7Hnjs2hYks5c mFcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=7foxAvTJNjxpzEzinqawhuOf8tl6MaxX0nC0Wnx2ikg=; fh=00i92FozdW145dv//HsHG4vo6csyYOdIKUCuPIVTXBE=; b=s0gESiZp+k9IRXLZI3OBlPhMJ95Qe/3yK1YD9Yaoj6N5hbAHVi82q6BdJ24C4WwDFI Bid+WT5l7pUlDacC+VaUQH1PwR/YNwIHpwdRN5pCHuFegx9LbDS0dorD9SyrVRNus+n5 dObVlUqFQO1DYNJis6b6nnowg25KYsRcUXZTJpe3+isfhtI4s5cr6sO4v+AxiENmT1Ne U0CfVbpJwvQMq1rn8AxANmF36yn7IimGG6llBpCYrFx8C5jpidwk2psP6sdc8NYwSWKH bNEPi3Tev7TQo8OT9K36z6LiFau8VznnvFUi4enufelS0rUSen69JYq9RGL9TpsZDIlX 6kww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DyBfrGhB; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be3-20020a656e43000000b00541710a9d44si6286942pgb.114.2023.08.02.07.19.09; Wed, 02 Aug 2023 07:19:26 -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=@linaro.org header.s=google header.b=DyBfrGhB; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234640AbjHBMi4 (ORCPT + 99 others); Wed, 2 Aug 2023 08:38:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234547AbjHBMig (ORCPT ); Wed, 2 Aug 2023 08:38:36 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E24D52D68 for ; Wed, 2 Aug 2023 05:38:28 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2b9bf52cd08so106514071fa.2 for ; Wed, 02 Aug 2023 05:38:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690979907; x=1691584707; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7foxAvTJNjxpzEzinqawhuOf8tl6MaxX0nC0Wnx2ikg=; b=DyBfrGhBAsiIZdO7TJN93/vtpKO4LaRGlAv16qGMa8VqcN3ltSc8bnr+G59OPKexX1 LG9E0K1FaTpy/ie/7lHW0c2LyYFY+UMWN+ToyyOPVYQRaf9IY9r5iRG7fuv2GU0SfVcN KTp1uKmROwLb7tGNcGuy7WPxUDAT1Y7Ml2m4lHA8CegJopXAgMhthh6UF7RI21w3/9m8 3i0vH82+pmDlFto4t+U8+fPBGNyCvLVVrML3Di1c3YX34qRR84jeKLsM9VbzWxviCIZ7 61YMDE1EJtgmF5mwSNLi0se/erX7XWGcwdMnPxVRqYx4PZWDZSOUlD/mxM9k9dZFIAqU 4LlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690979907; x=1691584707; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7foxAvTJNjxpzEzinqawhuOf8tl6MaxX0nC0Wnx2ikg=; b=NKDQkFWLyFNPXVfIy/k6DPbWtVy/ThI4Iv6p1Nw5uqveAf/yT+ntp9uUHWHjTYWCkF 1LrZYj7qQ27DB9TpPtyk9xMZmlJgCjK/1MDvhCbuXepJguOZRnYrkrpG4oKA+MqMlr0P 8g25MhRFSn9KtRkjaepGWX5N9tbM5wTVfnmfdrfeI1DMQgQGnJu9dXrNXivjc+u1yBZm opdQ7nMwmu9yJEVM0YvMJG+iltC62Vj04o2WItceBlmm6uq+PKJeWAw9G+h5nBR0WQtO OHKZG26jRcVPZ5a/Tke/cTAJ0FRZvsH+BNjbFqc7oo3otlgcXPkYw4P+MySofiZNHgJP rWIw== X-Gm-Message-State: ABy/qLaHZ++aL6uzIU2eLhS0LphUTjtF948y/GFu6IGFBhWc1l0BMtcH GRA+4IDCTWn8DBXFQjC5ov508w== X-Received: by 2002:a2e:9903:0:b0:2b9:b904:74d7 with SMTP id v3-20020a2e9903000000b002b9b90474d7mr5078871lji.18.1690979906812; Wed, 02 Aug 2023 05:38:26 -0700 (PDT) Received: from [192.168.1.101] (abyk53.neoplus.adsl.tpnet.pl. [83.9.30.53]) by smtp.gmail.com with ESMTPSA id h8-20020a2e9ec8000000b002b9e5fe86dasm1897050ljk.81.2023.08.02.05.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 05:38:26 -0700 (PDT) From: Konrad Dybcio Date: Wed, 02 Aug 2023 14:37:46 +0200 Subject: [PATCH v13 06/10] soc: qcom: cpr-common: Add support for flat fuse adjustment MIME-Version: 1.0 Message-Id: <20230217-topic-cpr3h-v13-6-d01cff1c54cf@linaro.org> References: <20230217-topic-cpr3h-v13-0-d01cff1c54cf@linaro.org> In-Reply-To: <20230217-topic-cpr3h-v13-0-d01cff1c54cf@linaro.org> To: AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Rob Herring , Krzysztof Kozlowski , Viresh Kumar , Nishanth Menon , Stephen Boyd , Niklas Cassel , Liam Girdwood , Mark Brown , Conor Dooley , "Rafael J. Wysocki" , Viresh Kumar , Ulf Hansson Cc: Robert Marko , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, Jeffrey Hugo , Marijn Suijten , Konrad Dybcio , AngeloGioacchino Del Regno X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1690979891; l=2102; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=/XcIm6aoB0M2m9RzHO8vr3y3r5RlnUHq0kq7ECIZUN0=; b=05407jLR9+kDlBp3QnNsjeFHTBJWo5qa2ankRUPVRlSZhnrlXf9N5TAkr4Odf0Kj/Xo6UWflS seOIpoabXUHDDUVJx8f/HxRMvUwP62kU1wqBCfbDbjUD10GtKJCha77 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773127300804900809 X-GMAIL-MSGID: 1773127300804900809 From: AngeloGioacchino Del Regno CPR3 makes use of post-calculation flat value adjustments. Add the necessary bits to the common functions to support it. Signed-off-by: AngeloGioacchino Del Regno [Konrad: separate this patch out of a bigger one] Tested-by: Jeffrey Hugo Signed-off-by: Konrad Dybcio --- drivers/genpd/qcom/cpr-common.c | 9 ++++++--- drivers/genpd/qcom/cpr-common.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/genpd/qcom/cpr-common.c b/drivers/genpd/qcom/cpr-common.c index ea85f6b4bef8..44c681bbbf13 100644 --- a/drivers/genpd/qcom/cpr-common.c +++ b/drivers/genpd/qcom/cpr-common.c @@ -49,7 +49,7 @@ int cpr_populate_ring_osc_idx(struct device *dev, EXPORT_SYMBOL_GPL(cpr_populate_ring_osc_idx); static int cpr_read_fuse_uV(int init_v_width, int step_size_uV, int ref_uV, - int step_volt, const char *init_v_efuse, + int adj, int step_volt, const char *init_v_efuse, struct device *dev) { int steps, uV; @@ -67,6 +67,9 @@ static int cpr_read_fuse_uV(int init_v_width, int step_size_uV, int ref_uV, uV = ref_uV + steps * step_size_uV; + /* Apply open-loop fixed adjustments to fused values */ + uV += adj; + return DIV_ROUND_UP(uV, step_volt) * step_volt; } @@ -119,8 +122,8 @@ int cpr_populate_fuse_common(struct device *dev, /* Populate uV */ uV = cpr_read_fuse_uV(init_v_width, init_v_step, - fdata->ref_uV, step_volt, - cpr_fuse->init_voltage, dev); + fdata->ref_uV, fdata->volt_oloop_adjust, + step_volt, cpr_fuse->init_voltage, dev); if (uV < 0) return uV; diff --git a/drivers/genpd/qcom/cpr-common.h b/drivers/genpd/qcom/cpr-common.h index 1f2ebf9394cf..0aa227617d2f 100644 --- a/drivers/genpd/qcom/cpr-common.h +++ b/drivers/genpd/qcom/cpr-common.h @@ -22,6 +22,7 @@ struct fuse_corner_data { int ref_uV; int max_uV; int min_uV; + int volt_oloop_adjust; int max_volt_scale; int max_quot_scale; /* fuse quot */