From patchwork Wed Jun 28 14:00:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 113916 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8950441vqr; Wed, 28 Jun 2023 07:04:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5b9vK1b8Cjwo8nXsXNukD/m1Tj2Y8sL4OP6jS7w5U/AXtznicwwYDSjCiH3BXLVTxNLIg1 X-Received: by 2002:a05:6402:27c8:b0:51d:9611:db3d with SMTP id c8-20020a05640227c800b0051d9611db3dmr8293396ede.2.1687961072502; Wed, 28 Jun 2023 07:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687961072; cv=none; d=google.com; s=arc-20160816; b=niX7t5vYFIDKnBvI0jluadPGRpa9KgKsNa5KapS1sB88frTcIcRJLLkCjW2KMtlgF/ IS1VKviGY10bY0xyAsw94YRODkldZWSNuYHaR6Uyr/oAjIfCMCqEov181MRRWhjFIro7 rYpCVR8d5PT3SIQPsMLGEh05M3roht3dzzebybgTboQ8v+jUlRABaEBMT7ZT5uRqJLua hmZ1Zcpz5gOvMBZ3GnaedyZOE4xDkKqP9g4xp1/LFax7rzKuNT7k6PZqHJ9/R3z2Ul4h /OiD/MqpwpRAoPKLo+l/24BR7OlTBNx0iGyBRAQg2UTKbb/tVc6QZET2/fjp2PZX5xby mdGg== 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=dlJNXwesiBvinVlCm08BsBVW76YCVdXRX2U7PUbcI/o=; fh=S8/9DkMJ+4w60oR6r4rB6LSoaBTEwLAws8O+AnmOA2I=; b=qhL614V1XC3h7fyVJ9DqqFD515M11wqaSGdbif8zGSNA6ehCZOqGKvSlacAa//hWjY Fx0bM5znSe2SW6/dqGJnszx7DDuWCNsnIn9C0TCQhXWxjhJClfrRcRBalf1X9tkAOgGv RO4tU8aEMSxOtPL378sEIxn4wUjTfC+y9nUTOeZdjIUw/xmiH0fN6AZYSBN2XClogaTl H47S39lJxcWKUnc4qG+L39PcYzWYFURWVzAWkOj/rcD5kTugnjgSZSenI031n7uxCKGB CiD2udZD6sMV6v7bodsmWk/P6BpFOjLC/RDKqc+VG4KnyQMZvqIrPxZkWxgBSONCp0a0 3xQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wjXkcSOY; 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 x2-20020aa7d6c2000000b0051bebea18f8si5156239edr.136.2023.06.28.07.04.07; Wed, 28 Jun 2023 07:04:32 -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=wjXkcSOY; 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 S232373AbjF1OCI (ORCPT + 99 others); Wed, 28 Jun 2023 10:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232380AbjF1OBK (ORCPT ); Wed, 28 Jun 2023 10:01:10 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 908912D60 for ; Wed, 28 Jun 2023 07:00:58 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4f957a45b10so8155314e87.0 for ; Wed, 28 Jun 2023 07:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687960857; x=1690552857; 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=dlJNXwesiBvinVlCm08BsBVW76YCVdXRX2U7PUbcI/o=; b=wjXkcSOYLCmNXkLjTYyrJOKHBDMmFwmDnRDK0j1pFPFRb1ZM/pt7ICV1ZebjyLN71N hq4pmTJa7jqZGdNawj771dofrzaTLkJ4loY1+LX9R13tNYzcLaGRb5YW5c0Xh3ZV7X95 ibGz3ChPD290BemGem64XqAnYUTVOuy4z/3SvgN7QONaWMfX3TF9dpVFuoA4JufA3CgI wq486zch/B2BIFDGr/qZPWk6mFjbn1XH7DO1CDBzb5/MMoJrNFRYw2QKOvRBtzDG7wEB 04Hyx86s5pNRkQU258oxnYYiyMH5Hd3e3NJQwYH4YIqCcgWraub7tHvITlRmaAwVF2NO yOEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687960857; x=1690552857; 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=dlJNXwesiBvinVlCm08BsBVW76YCVdXRX2U7PUbcI/o=; b=lYB9iyeoxGF+8i2Se7TVxMbpAi7Uy2OU3MWR8EC3421x8uQp38YW3WTKVRIAmNPTDc fLh1GjY7ZurNjKRIfGlxs9hYK9/3GBrp6zz8/hjcI94044iZtrZybNamcbvi0tk77uC5 etjePzmoC8WpueNK6T9xKlfgOLRXrsKmpqp7P0T7vxhp1vLECJicHqmkf4W6jOs/A2OL 2A5OA2AtYhXFlrDpyL7gn4sCxKXTj1reY5UCSvIDMDagHvM/2zRfTP/nGfdGks8tZXWn jK9OFcvJ+/KtZM+s4XB4Q4HgFwZoRnn2ZCtCiPpJ9PKn35IPgL8Je0lg99hX9CSJJitO eFTw== X-Gm-Message-State: AC+VfDyBRlEezO0oPf945X1iAF3j2qCeZjHnH6B8GaztyIcTSIUP2hsi dgXret9ktjIC8Ne7PU+Sx1HX9Q== X-Received: by 2002:a05:6512:2314:b0:4fa:21d4:b3ca with SMTP id o20-20020a056512231400b004fa21d4b3camr8000519lfu.2.1687960855394; Wed, 28 Jun 2023 07:00:55 -0700 (PDT) Received: from [192.168.1.101] (abyk82.neoplus.adsl.tpnet.pl. [83.9.30.82]) by smtp.gmail.com with ESMTPSA id w2-20020a05651204c200b004f8586ab633sm1941359lfq.279.2023.06.28.07.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 07:00:54 -0700 (PDT) From: Konrad Dybcio Date: Wed, 28 Jun 2023 16:00:45 +0200 Subject: [PATCH v12 06/10] soc: qcom: cpr-common: Add support for flat fuse adjustment MIME-Version: 1.0 Message-Id: <20230217-topic-cpr3h-v12-6-1a4d050e1e67@linaro.org> References: <20230217-topic-cpr3h-v12-0-1a4d050e1e67@linaro.org> In-Reply-To: <20230217-topic-cpr3h-v12-0-1a4d050e1e67@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 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=1687960842; l=2032; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=PZkzlg9a1T62vJjNL6pym3+YcX1sRFAyVy3l058FxdA=; b=CyanBX6AWB/zukL+HolgU51mINIbt7hEOwCypuhVvimrPxwU46e7Yvm1wDX8Boj8j51vy/o4h a6uaPnYmV3NAKdMOR/wzDdlKRIUuYDrosGEBoxAFTaWXS38KH0cDGeS 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_NONE, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769955469368607116?= X-GMAIL-MSGID: =?utf-8?q?1769955469368607116?= 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] Signed-off-by: Konrad Dybcio --- drivers/soc/qcom/cpr-common.c | 9 ++++++--- drivers/soc/qcom/cpr-common.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/soc/qcom/cpr-common.c b/drivers/soc/qcom/cpr-common.c index ea85f6b4bef8..44c681bbbf13 100644 --- a/drivers/soc/qcom/cpr-common.c +++ b/drivers/soc/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/soc/qcom/cpr-common.h b/drivers/soc/qcom/cpr-common.h index 1f2ebf9394cf..0aa227617d2f 100644 --- a/drivers/soc/qcom/cpr-common.h +++ b/drivers/soc/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 */