From patchwork Tue Jun 27 18:30:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 113544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8394322vqr; Tue, 27 Jun 2023 11:33:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5geG+G0+/YNW0GkE+tJcYWMhGleBlhtxlTQ89aaG8El11bkhLDz5cvVs7Tzziouovv56mR X-Received: by 2002:a17:906:8a74:b0:98d:dd76:7201 with SMTP id hy20-20020a1709068a7400b0098ddd767201mr7324318ejc.16.1687890799786; Tue, 27 Jun 2023 11:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687890799; cv=none; d=google.com; s=arc-20160816; b=k3T7ZJahD9iSBQMwUwHgmBYpkCF4AnAI3Pjg1oOc6H6sxjovcM+EozR+Vrsf/RJSI6 9Jz+YjxKdgSe5rJpFklC6oha1THx0cqbeA9NWJX3a/hEu5kqGUVlOolXtKRJPK7q+vWI CiWFS4XluATC1/SsJiRIYUWCt3puqOtA/Mf4DrQo279gjlrCItsNId5uMp3fOipHK2on YN4x2ClgpYe/zxhYpeN6Hbuh77z003U1tX/hPOZW9UeFCwAYkb0CWYAhtkdHYhkFYVcj E2+P6VQ5paDpg+7AZGv9Rvql7Qo/35Jjj8EC7oa3LNCXq4kgmab6AvnTtgYjgCACwqf1 GG+A== 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=Fqj6R0x83e0TahespDKwnXutqvr9UEZtKIcwLjDCi7I=; b=CX+g7Ut1MfEdEFMbZKAKNDTry7ooLd8xuI+er6ySo1Z7RrtPMKi2IA6Tepga4b7ba2 r5OUX7zKnXwwREuhy+2bAcztk4M5F9e4JEbZZDF5UOiBZSzWQgdo/Uae9aweSQxtjmok 34rJdHXMWoFYhFn92k4rovpH4OaoWaMyGkIV5dibA8GJp270AzzJJQVkysQl+jZVfRok Y2/bYbiqFExW5RXovt7YOTRrOPNeZIuzuhejKX+LVryCyEQ8mgFuqJVOPBBy9Q4zTO8I XSNyLymwD25Yec7roH3McE59gLz8cx3HkyZBxyLSq8CgA3cCsLvAWN1iHJIV3CuwvDBl BRTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eldDyj+v; 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 h22-20020a170906829600b009827e8c1b4dsi4479411ejx.140.2023.06.27.11.32.53; Tue, 27 Jun 2023 11:33:19 -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=eldDyj+v; 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 S231424AbjF0SbR (ORCPT + 99 others); Tue, 27 Jun 2023 14:31:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231317AbjF0SbA (ORCPT ); Tue, 27 Jun 2023 14:31:00 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01DF72106 for ; Tue, 27 Jun 2023 11:30:57 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4f86fbe5e4fso6592270e87.2 for ; Tue, 27 Jun 2023 11:30:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687890655; x=1690482655; 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=eldDyj+vrO8B1EHdlEMPLEOHFCl6Si0hRnQUWciBEd3htvn9vdm6kAyicutqD76S0g bGgWtm34+fKxqnz0FT5RSv1j8tOoh1DE8FEUBE6TFikADzN/k/qfb8gNg0eAAIqb0ols wsxmDPYyNPikkpL5q4J/wvHYv+azzdwd1FylVlMD+zCTEh7dMs/HtN1/Xfn73L67Yqqr 0s8Mr8ib8dHxbk4xv9DFlSlIlbqop+IogDwUSJwaf/fLpuG1we7DVl7+BPSIWv+EhfQu rX76z9OPET8WM7HJQkiZ863JQtr3PP9YlzUOuKN4VBae/83/QllOXFzUv5dM9tQ6rfPc 2QRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687890655; x=1690482655; 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=VJWSOtR+iAxBkCNs9Ipex6qi2PrB1b9ngdfkGt4kZ4CyP/UDaG5Yn21/+ZksYLDXUY +oyAXOaYPksceJiKntYYdKrnGWAUPH3bdTDv2XOBihe8cP9QmOiRe6+vYRdZUECKP0FA yFITsaPP2EkR9mL06K3xmT0puslYVqzWl7ETFB3MNrm4j38pzMpABbtIMq5UvJ9XM6Cj 7uGOwvr5ATaHIyWwBJ4YeKjmZi8X54ekCGImzuev0MVMYgp5Zb2MRYGQVlY+Cz2I4aS5 TqYviJ6jugNP+1tRyuxIal2owOAqYXRewFDivf5JiLRgluH53LCDJzohUvMtFnrzzhFZ 3VsQ== X-Gm-Message-State: AC+VfDxdx3KB32i1ECEsrQXRzQHnXU1u5GFAjbSfXcyzQvB3cLfN/Xee e7c7fp//lT5PfHtsuuYSAJqO3w== X-Received: by 2002:a19:5e0b:0:b0:4f8:72fd:ed95 with SMTP id s11-20020a195e0b000000b004f872fded95mr13852593lfb.22.1687890655186; Tue, 27 Jun 2023 11:30:55 -0700 (PDT) Received: from [192.168.1.101] (abxj103.neoplus.adsl.tpnet.pl. [83.9.3.103]) by smtp.gmail.com with ESMTPSA id q16-20020ac25290000000b004f640b0fb04sm1605205lfm.212.2023.06.27.11.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 11:30:54 -0700 (PDT) From: Konrad Dybcio Date: Tue, 27 Jun 2023 20:30:41 +0200 Subject: [PATCH v11 5/9] soc: qcom: cpr-common: Add support for flat fuse adjustment MIME-Version: 1.0 Message-Id: <20230217-topic-cpr3h-v11-5-ba22b4daa5d6@linaro.org> References: <20230217-topic-cpr3h-v11-0-ba22b4daa5d6@linaro.org> In-Reply-To: <20230217-topic-cpr3h-v11-0-ba22b4daa5d6@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, Marijn Suijten , Konrad Dybcio , AngeloGioacchino Del Regno X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687890646; l=2032; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=PZkzlg9a1T62vJjNL6pym3+YcX1sRFAyVy3l058FxdA=; b=Jypq10op7Z+li1iCijvCe2nLKNbkLjsWKK5RAHWVm+FoT/8W3Lflq5ZzgQ9bTceYQ5dFZ+Mn3 hR2F0M7g/scBQPRCt1AExVa6Pwry++CGbTcN+a6RIhxkdmuAJDiKrcT 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?1769881783424691642?= X-GMAIL-MSGID: =?utf-8?q?1769881783424691642?= 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 */