From patchwork Sun Dec 4 05:58:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 630924 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD6DEC4321E for ; Sun, 4 Dec 2022 05:59:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229687AbiLDF7P (ORCPT ); Sun, 4 Dec 2022 00:59:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbiLDF7O (ORCPT ); Sun, 4 Dec 2022 00:59:14 -0500 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC848140D2 for ; Sat, 3 Dec 2022 21:59:12 -0800 (PST) Received: by mail-lj1-x22c.google.com with SMTP id a7so9917651ljq.12 for ; Sat, 03 Dec 2022 21:59:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zhINbGmUkR446pTjVDx9epaOw6+W6fX9AeKTKkDRvH0=; b=j8b+O9T72R0RPQIslmr9y94FHdZndU+uu1Cdaebc9xn6dU6NqPygMGcGyT+GC/hR8v 4Oe+9VA91xcAUuDbj/XSVookl/8ch26NLxTblE8net368LIgcDTV4J/jFH0AyN3qn1nX 0Km971OI2tWuCZJWS4TbVYZ8HJ1psovARKoMB25xK0mLNDWFBDY1WoPv6mFQISAI4wG7 0BDD4PiMB3KYPyfZ7H/pI08Psqqbt8YeGtdeCpFI1m/L4aweQDjMUwJs33SBmfINwjmr nuDpz1tfwO+prgtHQHksdhn4lXRij6m8JH1rMreH+UwgMT22f+zr84vwPfqgkxI9/8pE cjmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zhINbGmUkR446pTjVDx9epaOw6+W6fX9AeKTKkDRvH0=; b=bt8cAmr6WOfjM/Kh4tclP7CV2g5U7gMbN+LB0VNBV5CXWDEveGgPHCJWjQIsaz80Ky zTwXVmvR69njtjMj/uKJjTWLxF4as4HSzkzlZR62WlH/F+rsY+do50ovL7g7Kkaq8ee1 +woZ6cz8IDR4doxSv20R1IVf7OagdTlf/czbXs+BZblwxzwO5kEPpfswUnv428JPoF0D xSZh2Xc3A/SzYw1vkbr8Fq6c35ghkCtr1LO7j2S2bm7L6M6T1OL6slxIQzp4wF0BfJL7 zMpVGL0hCWzPC+ANOa8/H+NBz+ME73Fx6JMWo12gP7EG3fqGkX3AlUw2vogXZoLf/fs4 Dn9w== X-Gm-Message-State: ANoB5pm+KYEsk1320VgggwBiJolim0SHDu3WCh7ZZWfRpnsCdj99Rdyw +kAvMGOUaMUygnkDGC7EBn58Gw== X-Google-Smtp-Source: AA0mqf5A4bw4tbHZFxBQx69OlO2zCAnop58y/4Y3LvtVNo6rZmDYB0YghQmyl5nBuQ7NA1k/UBVb0A== X-Received: by 2002:a2e:7210:0:b0:279:9c12:1ef3 with SMTP id n16-20020a2e7210000000b002799c121ef3mr11515027ljc.392.1670133551162; Sat, 03 Dec 2022 21:59:11 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id o6-20020a05651205c600b004917a30c82bsm1650028lfo.153.2022.12.03.21.59.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Dec 2022 21:59:10 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Amit Kucheria , Thara Gopinath , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 00/15] thermal/drivers/tsens: specify nvmem cells in DT rather than parsing them manually Date: Sun, 4 Dec 2022 07:58:54 +0200 Message-Id: <20221204055909.1351895-1-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Historically the tsens driver fetches the calibration data as a blob and then parses the blob on its own. This results in semi-duplicated code spreading over the platform-specific functions. This patch series changes tsens calibration code to per-value nvmem cells rather than parsing the blob in the driver. For backwards compatibility the old code is left in place for msm8916, msm8974 and qcs404, the platforms which have in-tree DT files. For all other affected platforms the old parsing code has been dropped as a part of this series. The code was tested on msm8916 and qcs404 only. Note: the DTs changes depend on driver changes. Tsens driver will not work if DT patches are merged, but the driver bits are not. As the thermal sense is critical for device safety, I'd suggest merging binding and driver during one merge window and then merging DT changes in the next merge window. Changes since the RFC: - Sorted out the msm8976/msm8956, custom slopes are used only for msm8956, - Implemented proper support for msm8974/apq8084, - Added tsens_calibrate_common() and ops_v0_1 which can be used in common cases, - Removed superfluous identity hw_ids - Fixed calibration calculation in tsens_calibrate_nvmem() for ONE_PT_CALIB case Dmitry Baryshkov (15): dt-bindings: thermal: tsens: add msm8956 compat dt-bindings: thermal: tsens: support per-sensor calibration cells dt-bindings: thermal: tsens: add per-sensor cells for msm8974 thermal/drivers/tsens: Drop unnecessary hw_ids thermal/drivers/tsens: Drop msm8976-specific defines thermal/drivers/tsens: Sort out msm8976 vs msm8956 data thermal/drivers/tsens: Support using nvmem cells for calibration data thermal/drivers/tsens: Drop single-cell code for msm8939 thermal/drivers/tsens: Drop single-cell code for mdm9607 thermal/drivers/tsens: Drop single-cell code for msm8976/msm8956 thermal/drivers/tsens: Support using nvmem cells for msm8974 calibration arm64: dts: qcom: msm8916: specify per-sensor calibration cells arm64: dts: qcom: qcs404: specify per-sensor calibration cells ARM: dts: qcom-msm8974: specify per-sensor calibration cells ARM: dts: qcom-apq8084: specify per-sensor calibration cells .../bindings/thermal/qcom-tsens.yaml | 123 +++++++- arch/arm/boot/dts/qcom-apq8084.dtsi | 262 ++++++++++++++++- arch/arm/boot/dts/qcom-msm8974.dtsi | 262 ++++++++++++++++- arch/arm64/boot/dts/qcom/msm8916.dtsi | 70 ++++- arch/arm64/boot/dts/qcom/qcs404.dtsi | 121 +++++++- drivers/thermal/qcom/tsens-v0_1.c | 267 ++++-------------- drivers/thermal/qcom/tsens-v1.c | 190 +++---------- drivers/thermal/qcom/tsens.c | 102 +++++++ drivers/thermal/qcom/tsens.h | 8 +- 9 files changed, 1002 insertions(+), 403 deletions(-)