From patchwork Thu Sep 1 10:54:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupesh Sharma X-Patchwork-Id: 12962298 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 EDC59C0502C for ; Thu, 1 Sep 2022 10:54:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234143AbiIAKye (ORCPT ); Thu, 1 Sep 2022 06:54:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234086AbiIAKyd (ORCPT ); Thu, 1 Sep 2022 06:54:33 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFB751321D2 for ; Thu, 1 Sep 2022 03:54:29 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id o4so16785721pjp.4 for ; Thu, 01 Sep 2022 03:54:29 -0700 (PDT) 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; bh=2j/euuewrJLsmuH7PP5LuRSskWex4MK4oenY2YNmi7o=; b=TbZl7S2tkGZvo64LY0ebTP/BW0w7CEo9wRD3fni+bu2LoIcaSC3RsN1j2a9D5p4Cte l4YM+fizu2O9DwG/CDcZ1Re5rMqXlRMnOE0W2TrlA77q52LVDnmgf/l4NGOoe9ritQxe 2DjHFEva0mj3FCO6L4ZhH0fBoMlLX65aQ55hjmtq0J6MAtklj3VVReWDD88Yz+bUpzy+ Ek1vJ4FVAxbYYr0mA3aU8pi2TE4AUitLfieLTueKMzMMN8m25PMpM8VXpsfuDcIr0LSw eR46jCvJ2av61H3vVKJfFyYWKme0iGc2+l9UQ4eZOBFTTavnr+wkDmaS8/F56QTcYx0S xmAw== 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; bh=2j/euuewrJLsmuH7PP5LuRSskWex4MK4oenY2YNmi7o=; b=hFgLIDA9WCnlqduO9am3hpGcwYnd3FxOTQKPUxYsctZcvZk7jr0f1Gqqq2PE7oaEBx CxZjSsixGOXnvfq+5xMJUjWS3IapByDgMvPCoRkWOD7R7FBx9HrX1iGyeqaLMIF3A2X5 fGtZCNLWdVqY4haClFsQWJI8Q6UI4pXC/6k0m8HpAX79fqcCHj4Ppd9oHhsXBVzrhAoE 4HIO3HDdR9tGKamFPcyiLyxiV4TYmLnYXxycLg6UbZtr3FWQixkN5ExFhBHALeSSTC+D PvrQeO61KNKoxVM3ZV7a/k1VYpyE7+jtrpjHlBej2ycjqVZ5hV8YAPbI5quZug9cuNNW VFDw== X-Gm-Message-State: ACgBeo1SXPZ57DFrYP3Q2Op3dFFdzkMqJO2LDTbLZjwx+x3LafOweVyj PB4Bj5CrqPCGB9jj3l4FTFoVRGnXH/0tWw== X-Google-Smtp-Source: AA6agR4X3IrGw9Bu8aLpEws0oDKUEuYQZPfL9DS3huamNRggIRsK5P/pRA3DqtdZdhsdCAc6I+RCTg== X-Received: by 2002:a17:90b:3907:b0:1fe:34a0:e760 with SMTP id ob7-20020a17090b390700b001fe34a0e760mr6671416pjb.45.1662029668590; Thu, 01 Sep 2022 03:54:28 -0700 (PDT) Received: from localhost.localdomain ([2401:4900:1c60:5362:8069:f46:34af:eb19]) by smtp.gmail.com with ESMTPSA id ij13-20020a170902ab4d00b0016c57657977sm13508910plb.41.2022.09.01.03.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 03:54:28 -0700 (PDT) From: Bhupesh Sharma To: linux-pm@vger.kernel.org Cc: bhupesh.sharma@linaro.org, bhupesh.linux@gmail.com, linux-kernel@vger.kernel.org, andersson@kernel.org, konrad.dybcio@somainline.org, linux-arm-msm@vger.kernel.org, daniel.lezcano@linaro.org, robh+dt@kernel.org, rafael@kernel.org, Amit Kucheria , Thara Gopinath Subject: [PATCH v4 0/4] Add support for tsens controller reinit via trustzone Date: Thu, 1 Sep 2022 16:24:10 +0530 Message-Id: <20220901105414.1171813-1-bhupesh.sharma@linaro.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Changes since v3: ----------------- - v3 can be viewed here: https://lore.kernel.org/linux-arm-msm/20220804054638.3197294-1-bhupesh.sharma@linaro.org/ - Addressed review comments from Bjorn regarding early exit paths, spin lock being held while returning from func, etc. - Also added Bjorn's R-Bs for v3 patches. - Rebased on latest linux-next (master branch) tip. Changes since v2: ----------------- - v2 can be viewed here: https://lore.kernel.org/linux-arm-msm/20220724122424.2509021-1-bhupesh.sharma@linaro.org/ - Dropped sm6375 specific patch from v3, as suggested by Konrad. - Rebased on latest linux-next (master branch) tip. Changes since v1: ----------------- - v1 can be viewed here: https://lore.kernel.org/linux-arm-msm/20220701145815.2037993-1-bhupesh.sharma@linaro.org/ - Addressed several comments from Bjorn regarding locking, serialization etc received on v1. - Addressed Konrad's concerns about the tsens controller found on sm6375 SoC which seems to start in a bad state or is disabled when entering the linux world. - This series would depend on sm6375 tsens controller changes being added by Konrad. It is based on linux-next (master branch) tip. Some versions of Qualcomm tsens controller might enter a 'bad state' causing sensor temperatures/interrupts status to be in an 'invalid' state. It is recommended to re-initialize the tsens controller via trustzone (secure registers) using scm call(s) when that happens. This patchset adds the support for the same. Cc: andersson@kernel.org Cc: Amit Kucheria Cc: Thara Gopinath Cc: linux-pm@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org Bhupesh Sharma (4): firmware: qcom: scm: Add support for tsens reinit workaround thermal: qcom: tsens: Add hooks for supplying platform specific reinit quirks thermal: qcom: tsens: Add driver support for re-initialization quirk thermal: qcom: tsens: Add reinit quirk support for tsens v2 controllers drivers/firmware/qcom_scm.c | 15 +++ drivers/firmware/qcom_scm.h | 4 + drivers/thermal/qcom/tsens-v2.c | 15 +++ drivers/thermal/qcom/tsens.c | 193 ++++++++++++++++++++++++++++++++ drivers/thermal/qcom/tsens.h | 18 ++- include/linux/qcom_scm.h | 2 + 6 files changed, 246 insertions(+), 1 deletion(-)