From patchwork Fri Jul 12 12:43:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satya Priya Kakitapalli X-Patchwork-Id: 812350 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AD9516F85A; Fri, 12 Jul 2024 12:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720788286; cv=none; b=MjrVroAV26ecWA/gZLI89D8wBhB03v9lgitQKtu1AKc7F5itvUorujRAdzq8QobqW9p9DcgsNktlohEXiWluCmOVbtsmdZ5EW35fQCjWqmyDWX/qNbGN+GF08FgWq18Bk/gGwXGJFBOX4tjAFf+aJh8ZAkGchgAAK/+RJ9FxbLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720788286; c=relaxed/simple; bh=uayfwc7zaHpay9gBZLMKZsr6recU8UX7T3703k1ppJE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=iZlbFrobNZmuoz6Qq1UQHqTeSwXAbdtANnzCojSBjQUUV4D0LqXHr0Hls6CjiCIG/u4nOJvzIfQndbSPASB8wDpwP5+CXBiwIJO4DguVDtLMAmsXLZ+YgP/mK+8hVBT7bh1W9YJqKh5s43zAMWbVK68tPHDCIQgeFCntHFLBaE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=me29irso; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="me29irso" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46CCXPIC011771; Fri, 12 Jul 2024 12:44:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= LFoJzH2tRLlH37n1tUXEvEFwJRnSHELZkaV25RncfhM=; b=me29irso1NHvGaQ5 8yaOm3BbsgC5RBw2AkOLQwFMFzSG6uqMuZ0SUYYptNpwgxFQkGf43q+WXiVtfYaJ fAvsuXGYbAscoEAbWFiB4Ad6hbAvglFev67jvyVZ+LhH8jAKkZy2KAm1HfD5/f06 2rIQAoulCabEHd8Pr3MawrQGtksKTz0ftoHLfUHIeSUfAT0OHiYxSex84IcROWPK JC5GuLIQjmmv6aquJJyFrDUq1D//pqvbrqbO4i3yp3F4ZxvaDnXqJWe0XIGUzYI0 mZfVzwciGP0Ftqd4KiH/H5a0OHptMfOy4PEwTScG6imCWuO7AGE+Vc26flyOH12S Qdh2TQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 406wgwy8ye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 12:44:26 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 46CCiPXw024627 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 12:44:25 GMT Received: from hu-skakitap-hyd.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 12 Jul 2024 05:44:18 -0700 From: Satya Priya Kakitapalli Date: Fri, 12 Jul 2024 18:13:28 +0530 Subject: [PATCH 1/5] dt-bindings: iio: adc: Add ADC5 GEN3 Channel info for pm8775 PMIC Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240712-mbg-tm-support-v1-1-7d78bec920ca@quicinc.com> References: <20240712-mbg-tm-support-v1-0-7d78bec920ca@quicinc.com> In-Reply-To: <20240712-mbg-tm-support-v1-0-7d78bec920ca@quicinc.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , "Thara Gopinath" , Bjorn Andersson , Konrad Dybcio CC: Kamal Wadhwa , Taniya Das , Jishnu Prakash , , , , , , Satya Priya Kakitapalli , Ajit Pandey , "Imran Shaik" , Jagadeesh Kona X-Mailer: b4 0.13.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: q0CZ0Be9kE5wf-gzs1vTsJnwqvz-wVOo X-Proofpoint-ORIG-GUID: q0CZ0Be9kE5wf-gzs1vTsJnwqvz-wVOo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-12_09,2024-07-11_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 adultscore=0 malwarescore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407120086 Add definitions for ADC5 GEN3 virtual channels(combination of ADC channel number and PMIC SID number) used by PM8775. Signed-off-by: Satya Priya Kakitapalli Acked-by: Jonathan Cameron --- .../iio/adc/qcom,spmi-adc5-gen3-pm8775.h | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/include/dt-bindings/iio/adc/qcom,spmi-adc5-gen3-pm8775.h b/include/dt-bindings/iio/adc/qcom,spmi-adc5-gen3-pm8775.h new file mode 100644 index 000000000000..84ab07ed73cc --- /dev/null +++ b/include/dt-bindings/iio/adc/qcom,spmi-adc5-gen3-pm8775.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. + */ + +#ifndef _DT_BINDINGS_QCOM_SPMI_VADC_PM8775_H +#define _DT_BINDINGS_QCOM_SPMI_VADC_PM8775_H + +#include + +/* ADC channels for PM8775_ADC for PMIC5 Gen3 */ +#define PM8775_ADC5_GEN3_REF_GND(sid) ((sid) << 8 | ADC5_GEN3_REF_GND) +#define PM8775_ADC5_GEN3_1P25VREF(sid) ((sid) << 8 | ADC5_GEN3_1P25VREF) +#define PM8775_ADC5_GEN3_VREF_VADC(sid) ((sid) << 8 | ADC5_GEN3_VREF_VADC) +#define PM8775_ADC5_GEN3_DIE_TEMP(sid) ((sid) << 8 | ADC5_GEN3_DIE_TEMP) + +#define PM8775_ADC5_GEN3_AMUX1_THM(sid) ((sid) << 8 | ADC5_GEN3_AMUX1_THM) +#define PM8775_ADC5_GEN3_AMUX2_THM(sid) ((sid) << 8 | ADC5_GEN3_AMUX2_THM) +#define PM8775_ADC5_GEN3_AMUX3_THM(sid) ((sid) << 8 | ADC5_GEN3_AMUX3_THM) +#define PM8775_ADC5_GEN3_AMUX4_THM(sid) ((sid) << 8 | ADC5_GEN3_AMUX4_THM) +#define PM8775_ADC5_GEN3_AMUX5_THM(sid) ((sid) << 8 | ADC5_GEN3_AMUX5_THM) +#define PM8775_ADC5_GEN3_AMUX6_THM(sid) ((sid) << 8 | ADC5_GEN3_AMUX6_THM) +#define PM8775_ADC5_GEN3_AMUX1_GPIO9(sid) ((sid) << 8 | ADC5_GEN3_AMUX1_GPIO) +#define PM8775_ADC5_GEN3_AMUX2_GPIO10(sid) ((sid) << 8 | ADC5_GEN3_AMUX2_GPIO) +#define PM8775_ADC5_GEN3_AMUX3_GPIO11(sid) ((sid) << 8 | ADC5_GEN3_AMUX3_GPIO) +#define PM8775_ADC5_GEN3_AMUX4_GPIO12(sid) ((sid) << 8 | ADC5_GEN3_AMUX4_GPIO) + +/* 100k pull-up2 */ +#define PM8775_ADC5_GEN3_AMUX1_THM_100K_PU(sid) ((sid) << 8 | ADC5_GEN3_AMUX1_THM_100K_PU) +#define PM8775_ADC5_GEN3_AMUX2_THM_100K_PU(sid) ((sid) << 8 | ADC5_GEN3_AMUX2_THM_100K_PU) +#define PM8775_ADC5_GEN3_AMUX3_THM_100K_PU(sid) ((sid) << 8 | ADC5_GEN3_AMUX3_THM_100K_PU) +#define PM8775_ADC5_GEN3_AMUX4_THM_100K_PU(sid) ((sid) << 8 | ADC5_GEN3_AMUX4_THM_100K_PU) +#define PM8775_ADC5_GEN3_AMUX5_THM_100K_PU(sid) ((sid) << 8 | ADC5_GEN3_AMUX5_THM_100K_PU) +#define PM8775_ADC5_GEN3_AMUX6_THM_100K_PU(sid) ((sid) << 8 | ADC5_GEN3_AMUX6_THM_100K_PU) +#define PM8775_ADC5_GEN3_AMUX1_GPIO9_100K_PU(sid) ((sid) << 8 | ADC5_GEN3_AMUX1_GPIO_100K_PU) +#define PM8775_ADC5_GEN3_AMUX2_GPIO10_100K_PU(sid) ((sid) << 8 | ADC5_GEN3_AMUX2_GPIO_100K_PU) +#define PM8775_ADC5_GEN3_AMUX3_GPIO11_100K_PU(sid) ((sid) << 8 | ADC5_GEN3_AMUX3_GPIO_100K_PU) +#define PM8775_ADC5_GEN3_AMUX4_GPIO12_100K_PU(sid) ((sid) << 8 | ADC5_GEN3_AMUX4_GPIO_100K_PU) + +#define PM8775_ADC5_GEN3_VPH_PWR(sid) ((sid) << 8 | ADC5_GEN3_VPH_PWR) + +#endif /* _DT_BINDINGS_QCOM_SPMI_VADC_PM8775_H */ From patchwork Fri Jul 12 12:43:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satya Priya Kakitapalli X-Patchwork-Id: 812882 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CBEB17085C; Fri, 12 Jul 2024 12:44:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720788293; cv=none; b=N+bNt0kWgGWBVF7TIK4TFYTW0FqkTr4nsQrbSBtQIwyTgD/jySSriFglaeBohPit0KlH/RhRx5N1JBNZXLQRTW7y8zjqcEHs4WzUTlB3jHn40cZ1E+rf/dGH9xD9ocruAlb1woufedKZjBWIHvILAc4JvwixF7P0wdM3ZnT42Bg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720788293; c=relaxed/simple; bh=250wnUWhO7i4Ntv3rP4BHshTKI009EVQV0bDgNfGDjw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=KaJ2mA4jbZsWBOKWrn7I/+9VWhMY31Q0c6NLq4NxoThIYsjXmvbsimkUUW2bnluSgGjTrdBOgzYiyOf0KoyJcRaIsheH+Jq6wbipuEFCZf4T04EgaAo993FMpudMKhgfoPEhtF83vIwOeditBq8vyzUK3Trr7mzEbVortactA84= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=RqvTvCyZ; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="RqvTvCyZ" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46C42PPt014055; Fri, 12 Jul 2024 12:44:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= DTgoapDolPEDLSpj3zMasvqpzCe2tZ7FI7Phe2759dk=; b=RqvTvCyZuHw1Dgv9 ddJIerxbYfD/FeVV/UWPlFyI5MB4Tm2f90rlaf1dHPjbrXezyTVhAuOwASLP326b t8KQZJjWJTzykSUP1zFUzOmQSa7ltpCqlN/54TuE3BYmLRRIDVPP0D2Aiub7GIFb KYYxEW1OgGDOknmItk6rq2BDMO3xnu9dytnLdATICgcpCiuqTZ4Wego3K8ohGFMF TURYozmipojK5o7xp8f++1DBqHsqXdYKJ80MsAKuPOuHobnuMq1RVsd4ftyVOAR/ oJ4ANTNgBFzV5KCfET3d3v5vF8mAXRFPMnHFrpCedW4wSQF3bxkx1XQI/o0v3CfL 8+26pg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 409vydwghf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 12:44:34 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 46CCiWMP008379 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 12:44:32 GMT Received: from hu-skakitap-hyd.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 12 Jul 2024 05:44:25 -0700 From: Satya Priya Kakitapalli Date: Fri, 12 Jul 2024 18:13:29 +0530 Subject: [PATCH 2/5] dt-bindings: thermal: qcom: Add MBG thermal monitor bindings Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240712-mbg-tm-support-v1-2-7d78bec920ca@quicinc.com> References: <20240712-mbg-tm-support-v1-0-7d78bec920ca@quicinc.com> In-Reply-To: <20240712-mbg-tm-support-v1-0-7d78bec920ca@quicinc.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , "Thara Gopinath" , Bjorn Andersson , Konrad Dybcio CC: Kamal Wadhwa , Taniya Das , Jishnu Prakash , , , , , , Satya Priya Kakitapalli , Ajit Pandey , "Imran Shaik" , Jagadeesh Kona X-Mailer: b4 0.13.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Ji1j9zfevDxypHmgOoOtP1WJ36S28lpH X-Proofpoint-ORIG-GUID: Ji1j9zfevDxypHmgOoOtP1WJ36S28lpH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-12_09,2024-07-11_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 mlxlogscore=999 impostorscore=0 suspectscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407120086 Add bindings support for the MBG Temp alarm peripheral found on pm8775 pmics. Signed-off-by: Satya Priya Kakitapalli --- .../bindings/thermal/qcom-spmi-mbg-tm.yaml | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/Documentation/devicetree/bindings/thermal/qcom-spmi-mbg-tm.yaml b/Documentation/devicetree/bindings/thermal/qcom-spmi-mbg-tm.yaml new file mode 100644 index 000000000000..9b6d1bc34a11 --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/qcom-spmi-mbg-tm.yaml @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/thermal/qcom-spmi-mbg-tm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Technologies, Inc. SPMI PMIC MBG Thermal Monitoring + +maintainers: + - Satya Priya Kakitapalli + +description: | + Qualcomm's thermal driver for the MBG thermal monitoring device. + +properties: + compatible: + const: qcom,spmi-mbg-tm + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + io-channels: + description: + IIO channel specifier for the ADC channel, which reports + chip die temperature. + + io-channel-names: + const: thermal + + "#thermal-sensor-cells": + const: 0 + +required: + - compatible + - reg + - interrupts + - io-channels + - io-channel-names + - "#thermal-sensor-cells" + +additionalProperties: false + +examples: + - | + #include + #include + spmi_bus { + #address-cells = <1>; + #size-cells = <0>; + + pm8775_sail_1_tz: qcom,mbg-tm@d700 { + compatible = "qcom,spmi-mbg-tm"; + reg = <0xd700>; + interrupts = <0x1 0xd7 0x0 IRQ_TYPE_EDGE_RISING>; + io-channels = <&pm8775_1_adc PM8775_ADC5_GEN3_DIE_TEMP(1)>; + io-channel-names = "thermal"; + #thermal-sensor-cells = <0>; + }; + }; +... From patchwork Fri Jul 12 12:43:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satya Priya Kakitapalli X-Patchwork-Id: 812349 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3091316F848; Fri, 12 Jul 2024 12:44:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720788300; cv=none; b=FK/h4UWQQcNGDLcI//UAkU+qq5AmCTAXxKWwknxBK/Q12TQtk5ekBATzVU5AyTes5ppWhh2xcjJ4TGaU3X1KTHbiI4dyLX4B6uW1OKlss4PLR4Y96MmhdDymdmBdt0AfYj5Pgi8m2TTfklmUxWCzB6V2RlUQgtvq9LF8w1lZ28g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720788300; c=relaxed/simple; bh=XED/XmFhc1Ds7+nd2W8muR54svIrPQy95BDqvx3Nea4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ptTIZBC6FcW04ayRB6X1F/npai8Vwh9A/qDAG1ioeylNhkUEEZn1S+VKQNHxbtKhh5FuIZ4VYuRltrOyG2rMeILSeBa6nCF/y3/+yPbRl2yzyGf3E8H3A24McKV9FRkqGDcq/e0E6WY3SHUeqLgZa2yxyhx/xm/TvsjHcPkcS+Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=QGyfSoVO; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="QGyfSoVO" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46C3LLht011628; Fri, 12 Jul 2024 12:44:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= IsGU/rjkxMDFyd56KUf32egz0v6vp7eWZC1Rr57iv5A=; b=QGyfSoVOx9qwO80O N6XjYg3faCum13aLReRJtIt9GNwMfenWX5VbClYQB2iwAvjsxT6st1A6xRtRaFk1 y1+fQ5uhlYWtdmHDc2bFpssqbtZorQOJ40V2WgGFm5EkGI1Spnspbk1EjurekFeV /LQc7AUC6li/sZgLAaMAUFE0zi/tnA97RlpmriVwbPgYAuezvO8A9DvtV0K1v4YT eeveGzMkc4Ngyl9p7UBzNtIB7WGts3h1Yw9VMHaRuURSbLFIKl6/W/o8Z0v1OOeC l0z4Lo4T9keaUnKejLUvNhnwCOb1OJqD/d2PNDUUlWcOkPLX44UUwAJUQdVh56g3 hl1D3w== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 406wgwy8yx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 12:44:40 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 46CCidal028031 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 12:44:39 GMT Received: from hu-skakitap-hyd.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 12 Jul 2024 05:44:32 -0700 From: Satya Priya Kakitapalli Date: Fri, 12 Jul 2024 18:13:30 +0530 Subject: [PATCH 3/5] thermal: qcom: Add support for MBG Temp monitor Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240712-mbg-tm-support-v1-3-7d78bec920ca@quicinc.com> References: <20240712-mbg-tm-support-v1-0-7d78bec920ca@quicinc.com> In-Reply-To: <20240712-mbg-tm-support-v1-0-7d78bec920ca@quicinc.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , "Thara Gopinath" , Bjorn Andersson , Konrad Dybcio CC: Kamal Wadhwa , Taniya Das , Jishnu Prakash , , , , , , Satya Priya Kakitapalli , Ajit Pandey , "Imran Shaik" , Jagadeesh Kona X-Mailer: b4 0.13.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: fIuBoHZpjo_oqHlzSkSitOBB-eFRpaJy X-Proofpoint-ORIG-GUID: fIuBoHZpjo_oqHlzSkSitOBB-eFRpaJy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-12_09,2024-07-11_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 adultscore=0 malwarescore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407120086 Add driver for the MBG thermal monitoring device. It monitors the die temperature, and when there is a level 1 upper threshold violation, it receives an interrupt over spmi. The driver reads the fault status register and notifies thermal accordingly. Signed-off-by: Satya Priya Kakitapalli --- drivers/thermal/qcom/Kconfig | 11 ++ drivers/thermal/qcom/Makefile | 1 + drivers/thermal/qcom/qcom-spmi-mbg-tm.c | 269 ++++++++++++++++++++++++++++++++ 3 files changed, 281 insertions(+) diff --git a/drivers/thermal/qcom/Kconfig b/drivers/thermal/qcom/Kconfig index 2c7f3f9a26eb..46045094020c 100644 --- a/drivers/thermal/qcom/Kconfig +++ b/drivers/thermal/qcom/Kconfig @@ -21,6 +21,17 @@ config QCOM_SPMI_ADC_TM5 Thermal client sets threshold temperature for both warm and cool and gets updated when a threshold is reached. +config QCOM_SPMI_MBG_TM + tristate "Qualcomm Technologies, Inc. SPMI PMIC MBG Temperature monitor" + depends on OF && SPMI && IIO + select REGMAP_SPMI + help + This enables a thermal driver for the MBG thermal monitoring device. + It shows up in sysfs as a thermal sensor with two trip points. + It notifies the thermal framework when level 1 high threshold is + violated. The temperature reported by the thermal sensor reflects + the real time die temperature through ADC channel. + config QCOM_SPMI_TEMP_ALARM tristate "Qualcomm SPMI PMIC Temperature Alarm" depends on OF && SPMI && IIO diff --git a/drivers/thermal/qcom/Makefile b/drivers/thermal/qcom/Makefile index 0fa2512042e7..bc18e08ee3e2 100644 --- a/drivers/thermal/qcom/Makefile +++ b/drivers/thermal/qcom/Makefile @@ -4,5 +4,6 @@ obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o qcom_tsens-y += tsens.o tsens-v2.o tsens-v1.o tsens-v0_1.o \ tsens-8960.o obj-$(CONFIG_QCOM_SPMI_ADC_TM5) += qcom-spmi-adc-tm5.o +obj-$(CONFIG_QCOM_SPMI_MBG_TM) += qcom-spmi-mbg-tm.o obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM) += qcom-spmi-temp-alarm.o obj-$(CONFIG_QCOM_LMH) += lmh.o diff --git a/drivers/thermal/qcom/qcom-spmi-mbg-tm.c b/drivers/thermal/qcom/qcom-spmi-mbg-tm.c new file mode 100644 index 000000000000..70964ea5a48d --- /dev/null +++ b/drivers/thermal/qcom/qcom-spmi-mbg-tm.c @@ -0,0 +1,269 @@ +// SPDX-License-Identifier: GPL-2.0-only +//Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../thermal_core.h" + +#define MBG_TEMP_MON_MM_MON2_FAULT_STATUS 0x50 + +#define MON_FAULT_STATUS_MASK GENMASK(7, 6) +#define MON_FAULT_STATUS_SHIFT 6 +#define MON2_LVL1_ERR 0x1 + +#define MON2_LVL1_UP_THRESH 0x59 + +#define MBG_TEMP_MON_MM_MON2_MISC_CFG 0x5f +#define UP_THRESH_EN BIT(1) + +#define STEP_MV 8 +#define MBG_DEFAULT_TEMP_MV 600 +#define MBG_TEMP_CONSTANT 1000 +#define MIN_TRIP_TEMP 25000 +#define MAX_SUPPORTED_TEMP 160000 + +struct mbg_tm_chip { + struct regmap *map; + struct device *dev; + struct thermal_zone_device *tz_dev; + struct mutex lock; + unsigned int base; + int irq; + int last_temp; + bool last_temp_set; + struct iio_channel *adc; +}; + +struct mbg_map_table { + int min_temp; + int vtemp0; + int tc; +}; + +static const struct mbg_map_table map_table[] = { + /* minT vtemp0 tc */ + { -60000, 4337, 1967 }, + { -40000, 4731, 1964 }, + { -20000, 5124, 1957 }, + { 0, 5515, 1949 }, + { 20000, 5905, 1940 }, + { 40000, 6293, 1930 }, + { 60000, 6679, 1921 }, + { 80000, 7064, 1910 }, + { 100000, 7446, 1896 }, + { 120000, 7825, 1878 }, + { 140000, 8201, 1859 }, +}; + +static int mbg_tm_read(struct mbg_tm_chip *chip, u16 addr, int *data) +{ + return regmap_read(chip->map, chip->base + addr, data); +} + +static int mbg_tm_write(struct mbg_tm_chip *chip, u16 addr, int data) +{ + return regmap_write(chip->map, chip->base + addr, data); +} + +static int mbg_tm_reg_update(struct mbg_tm_chip *chip, u16 addr, u8 mask, u8 val) +{ + return regmap_write_bits(chip->map, chip->base + addr, mask, val); +} + +static int mbg_tm_get_temp(struct thermal_zone_device *tz, int *temp) +{ + struct mbg_tm_chip *chip = thermal_zone_device_priv(tz); + int ret, milli_celsius; + + if (!temp) + return -EINVAL; + + if (chip->last_temp_set) { + pr_debug("last_temp: %d\n", chip->last_temp); + chip->last_temp_set = false; + *temp = chip->last_temp; + return 0; + } + + ret = iio_read_channel_processed(chip->adc, &milli_celsius); + if (ret < 0) { + dev_err(chip->dev, "failed to read iio channel %d\n", ret); + return ret; + } + + *temp = milli_celsius; + + return 0; +} + +static int temp_to_vtemp(int temp) +{ + + int idx, vtemp, tc = 0, t0 = 0, vtemp0 = 0; + + if (temp > MAX_SUPPORTED_TEMP) + temp = MAX_SUPPORTED_TEMP - MBG_TEMP_CONSTANT; + + for (idx = 0; idx < ARRAY_SIZE(map_table); idx++) + if (temp >= map_table[idx].min_temp && + temp < (map_table[idx].min_temp + 20000)) { + tc = map_table[idx].tc; + t0 = map_table[idx].min_temp; + vtemp0 = map_table[idx].vtemp0; + break; + } + + /* + * Formula to calculate vtemp(mV) from a given temp + * vtemp = (temp - minT) * tc + vtemp0 + * tc, t0 and vtemp0 values are mentioned in the map_table array. + */ + vtemp = ((temp - t0) * tc + vtemp0 * 100000) / 1000000; + + return abs(vtemp - MBG_DEFAULT_TEMP_MV) / STEP_MV; +} + +static int mbg_tm_set_trip_temp(struct thermal_zone_device *tz, int low_temp, + int temp) +{ + struct mbg_tm_chip *chip = thermal_zone_device_priv(tz); + int ret = 0, vtemp = 0; + + mutex_lock(&chip->lock); + + /* The HW has a limitation that the trip set must be above 25C */ + if (temp > MIN_TRIP_TEMP && temp < INT_MAX) { + mbg_tm_reg_update(chip, MBG_TEMP_MON_MM_MON2_MISC_CFG, + UP_THRESH_EN, UP_THRESH_EN); + vtemp = temp_to_vtemp(temp); + ret = mbg_tm_write(chip, MON2_LVL1_UP_THRESH, vtemp); + if (ret < 0) { + mutex_unlock(&chip->lock); + return ret; + } + } else { + dev_dbg(chip->dev, "Setting %d failed, set trip between 25C and INT_MAX\n", temp); + mbg_tm_reg_update(chip, MBG_TEMP_MON_MM_MON2_MISC_CFG, + UP_THRESH_EN, 0); + } + + mutex_unlock(&chip->lock); + + /* + * Configure the last_temp one degree higher, to ensure the + * violated temp is returned to thermal framework when it reads + * temperature for the first time after the violation happens. + * This is needed to account for the inaccuracy in the conversion + * formula used which leads to the thermal framework setting back + * the same thresholds in case the temperature it reads does not + * show violation. + */ + chip->last_temp = temp + MBG_TEMP_CONSTANT; + + return ret; +} + +static const struct thermal_zone_device_ops mbg_tm_ops = { + .get_temp = mbg_tm_get_temp, + .set_trips = mbg_tm_set_trip_temp, +}; + +static irqreturn_t mbg_tm_isr(int irq, void *data) +{ + struct mbg_tm_chip *chip = data; + int ret; + int val = 0; + + mutex_lock(&chip->lock); + + ret = mbg_tm_read(chip, MBG_TEMP_MON_MM_MON2_FAULT_STATUS, &val); + + mutex_unlock(&chip->lock); + + if (ret < 0) + return IRQ_HANDLED; + + val &= MON_FAULT_STATUS_MASK; + if ((val >> MON_FAULT_STATUS_SHIFT) & MON2_LVL1_ERR) { + chip->last_temp_set = true; + thermal_zone_device_update(chip->tz_dev, + THERMAL_TRIP_VIOLATED); + dev_dbg(chip->dev, "Notifying Thermal, fault status=%d\n", val); + } else { + dev_dbg(chip->dev, "Lvl 1 upper threshold not violated, ignoring interrupt\n"); + } + + return IRQ_HANDLED; +} + +static int mbg_tm_probe(struct platform_device *pdev) +{ + struct mbg_tm_chip *chip; + struct device_node *node = pdev->dev.of_node; + u32 res; + int ret = 0; + + chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + chip->dev = &pdev->dev; + + mutex_init(&chip->lock); + + chip->map = dev_get_regmap(pdev->dev.parent, NULL); + if (!chip->map) + return -ENXIO; + + ret = of_property_read_u32(node, "reg", &res); + if (ret < 0) + return ret; + + chip->base = res; + + chip->irq = platform_get_irq(pdev, 0); + if (chip->irq < 0) + return chip->irq; + + chip->adc = devm_iio_channel_get(&pdev->dev, "thermal"); + if (IS_ERR(chip->adc)) + return PTR_ERR(chip->adc); + + chip->tz_dev = devm_thermal_of_zone_register(&pdev->dev, + 0, chip, &mbg_tm_ops); + if (IS_ERR(chip->tz_dev)) { + dev_err(&pdev->dev, "failed to register sensor\n"); + return PTR_ERR(chip->tz_dev); + } + + ret = devm_request_threaded_irq(&pdev->dev, chip->irq, NULL, + mbg_tm_isr, IRQF_ONESHOT, node->name, chip); + + return ret; +} + +static const struct of_device_id mbg_tm_match_table[] = { + { .compatible = "qcom,spmi-mbg-tm" }, + { } +}; +MODULE_DEVICE_TABLE(of, mbg_tm_match_table); + +static struct platform_driver mbg_tm_driver = { + .driver = { + .name = "qcom-spmi-mbg-tm", + .of_match_table = mbg_tm_match_table, + }, + .probe = mbg_tm_probe, +}; +module_platform_driver(mbg_tm_driver); + +MODULE_DESCRIPTION("PMIC MBG Temperature monitor driver"); +MODULE_LICENSE("GPL"); From patchwork Fri Jul 12 12:43:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satya Priya Kakitapalli X-Patchwork-Id: 812881 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D13D16F85B; Fri, 12 Jul 2024 12:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720788307; cv=none; b=g5lHuvqBp0m9DsB5bYkE6u8cYHAMc7+9THOJp1aXI57TM/MrdCWCPDKGHxk0K74WmvO4cxA78rj8eNsLs2turq6jRR/p7E7qP2bfBBK4Pc9XeMI/0AU3S46pMZNG6gCNC7NPtRtaT8LpFQd0Xrt94w8g3bfK9kYpmdBoWmF4Cc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720788307; c=relaxed/simple; bh=/NnIWX63FeKLVuoHGgZe6A4FAbULEhPeW8E6yv8jWHc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=RkXsQEbOO/FNS781mZ5Xehy96iYHOpoJSxx44XWC3wa2pS+CDtom2joH9+uNWpkd3GcKIct6pkjMnSL19nvF4BT40Ti2LnKxQ7h9wdVBFUgkiHyW74RRtmdabS1VgplGwNQODQcrq0jwdluK+tLoR99Eplrz1minRSD0YUit3NM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=eBIEwsE3; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="eBIEwsE3" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46C7LhWS030226; Fri, 12 Jul 2024 12:44:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ThRMC8FcCjQyzFvD1AUwqljCoPTz+CquU0rhPU6flz8=; b=eBIEwsE3OUWlpHFh gZAIXNZGffRpiArRkIHTsK1nHccfQd1feA68Kp7eZQNEJbSSNyu/epfzHWT3amux GOwwxDHpLHrSk08yT4KI6Z+xFCwn/Lap2sJQHOjjGFkwzGuv5tdexwfWYUP3TDNL fjrqPByvss/bCrcq266Iyp9Bwcsg+hm7CD7h22dIb3InyI7gez5+Y+jo6MZTUHOw fBgk81vsP0Iq2Q9LgHVZ3fzn9jCgKN5FYcLgf5qw2P+zrZOIXnH2LP+X0jjCRDy0 FmnGAzBIB1yBARE5fEDFvtyIIyi4dJ5cOmY62kRhI+bYOqmJWFCM1s/N9Qrgxub9 l6N/WA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40ajbqteaw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 12:44:48 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 46CCikl0010100 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 12:44:46 GMT Received: from hu-skakitap-hyd.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 12 Jul 2024 05:44:39 -0700 From: Satya Priya Kakitapalli Date: Fri, 12 Jul 2024 18:13:31 +0530 Subject: [PATCH 4/5] ARM: dts: qcom: Add vadc support for pm8775 pmic on SA8775P Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240712-mbg-tm-support-v1-4-7d78bec920ca@quicinc.com> References: <20240712-mbg-tm-support-v1-0-7d78bec920ca@quicinc.com> In-Reply-To: <20240712-mbg-tm-support-v1-0-7d78bec920ca@quicinc.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , "Thara Gopinath" , Bjorn Andersson , Konrad Dybcio CC: Kamal Wadhwa , Taniya Das , Jishnu Prakash , , , , , , Satya Priya Kakitapalli , Ajit Pandey , "Imran Shaik" , Jagadeesh Kona X-Mailer: b4 0.13.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ryM9PU3dxq8UJyvRcwGzmwAejAH0g0wz X-Proofpoint-ORIG-GUID: ryM9PU3dxq8UJyvRcwGzmwAejAH0g0wz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-12_09,2024-07-11_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=989 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 impostorscore=0 spamscore=0 malwarescore=0 suspectscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407120086 Add support for reading the adc channels of pm8775 on SA8775P platforms. Signed-off-by: Satya Priya Kakitapalli --- arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi | 90 +++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi b/arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi index 1369c3d43f86..bd4f5f51e094 100644 --- a/arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi @@ -1,8 +1,10 @@ // SPDX-License-Identifier: BSD-3-Clause /* * Copyright (c) 2023, Linaro Limited + * Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. */ +#include #include #include @@ -105,6 +107,28 @@ pmm8654au_0: pmic@0 { #address-cells = <1>; #size-cells = <0>; + pmm8654au_0_adc: vadc@8000 { + compatible = "qcom,spmi-adc5-gen3"; + reg = <0x8000>; + #address-cells = <1>; + #size-cells = <0>; + interrupts-extended = <&spmi_bus 0x0 0x80 0x1 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "adc-sdam0"; + #io-channel-cells = <1>; + + pmm8654au_0_die_temp { + reg = ; + label = "pmm8654au_0_die_temp"; + qcom,pre-scaling = <1 1>; + }; + + pmm8654au_0_vph_pwr { + reg = ; + label = "pmm8654au_0_vph_pwr"; + qcom,pre-scaling = <1 3>; + }; + }; + pmm8654au_0_temp_alarm: temp-alarm@a00 { compatible = "qcom,spmi-temp-alarm"; reg = <0xa00>; @@ -162,6 +186,28 @@ pmm8654au_1: pmic@2 { #address-cells = <1>; #size-cells = <0>; + pmm8654au_1_adc: vadc@8000 { + compatible = "qcom,spmi-adc5-gen3"; + reg = <0x8000>; + #address-cells = <1>; + #size-cells = <0>; + interrupts-extended = <&spmi_bus 0x2 0x80 0x1 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "adc-sdam0"; + #io-channel-cells = <1>; + + pmm8654au_1_die_temp { + reg = ; + label = "pmm8654au_1_die_temp"; + qcom,pre-scaling = <1 1>; + }; + + pmm8654au_1_vph_pwr { + reg = ; + label = "pmm8654au_1_vph_pwr"; + qcom,pre-scaling = <1 3>; + }; + }; + pmm8654au_1_temp_alarm: temp-alarm@a00 { compatible = "qcom,spmi-temp-alarm"; reg = <0xa00>; @@ -186,6 +232,28 @@ pmm8654au_2: pmic@4 { #address-cells = <1>; #size-cells = <0>; + pmm8654au_2_adc: vadc@8000 { + compatible = "qcom,spmi-adc5-gen3"; + reg = <0x8000>; + #address-cells = <1>; + #size-cells = <0>; + interrupts-extended = <&spmi_bus 0x4 0x80 0x1 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "adc-sdam0"; + #io-channel-cells = <1>; + + pmm8654au_2_die_temp { + reg = ; + label = "pmm8654au_2_die_temp"; + qcom,pre-scaling = <1 1>; + }; + + pmm8654au_2_vph_pwr { + reg = ; + label = "pmm8654au_2_vph_pwr"; + qcom,pre-scaling = <1 3>; + }; + }; + pmm8654au_2_temp_alarm: temp-alarm@a00 { compatible = "qcom,spmi-temp-alarm"; reg = <0xa00>; @@ -210,6 +278,28 @@ pmm8654au_3: pmic@6 { #address-cells = <1>; #size-cells = <0>; + pmm8654au_3_adc: vadc@8000 { + compatible = "qcom,spmi-adc5-gen3"; + reg = <0x8000>; + #address-cells = <1>; + #size-cells = <0>; + interrupts-extended = <&spmi_bus 0x6 0x80 0x1 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "adc-sdam0"; + #io-channel-cells = <1>; + + pmm8654au_3_die_temp { + reg = ; + label = "pmm8654au_3_die_temp"; + qcom,pre-scaling = <1 1>; + }; + + pmm8654au_3_vph_pwr { + reg = ; + label = "pmm8654au_3_vph_pwr"; + qcom,pre-scaling = <1 3>; + }; + }; + pmm8654au_3_temp_alarm: temp-alarm@a00 { compatible = "qcom,spmi-temp-alarm"; reg = <0xa00>; From patchwork Fri Jul 12 12:43:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satya Priya Kakitapalli X-Patchwork-Id: 812348 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFA0B16F85B; Fri, 12 Jul 2024 12:45:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720788315; cv=none; b=gf+Defsj8HUgKLbdauZ+XsNSyj4DWrdArBg/F6FAPerqyVLMKWe032eePvI+8diCrqt3tqIyrmJdRFPxaFXUmMfjAuofVkGBX75y1zYmeJu/2y9dLZTcB4DTZgQi7kCqW7iElVN/qQyt9MZRvvP25B0R5GCLXAGErMh11lxwSB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720788315; c=relaxed/simple; bh=xT3vdgzfitnNc45nl9KNHLr746ozbECZ34w19TY+CLQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=a6odkT09twu/3EYxTUuzpyQLQotILpnVLZvIVXJ9IPzz+tmp3z7e5J5dH2RBXhzmXGonqLP28ux8KRdJcX24bRky+0Z6rLo19iUnAwcyv2Z9sHBgXrtn8QqLBfTqTGUF/ubUi7/AGvfLQkHQnV7GgLB/bjQ1+XDzgzi3xvwel+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=IJTjXy04; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="IJTjXy04" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46CBAer6007447; Fri, 12 Jul 2024 12:44:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= LRIVKzH1hSjxSuvugXYotptQy+3/BurYv3ZsB9X2wks=; b=IJTjXy04IXXlH8yO yBJA8SrsIw4Gk9ZpePLi5+nOS+qRNnoUZyUSw17xA6Sdk+roi0qF9krwIBdmKEnD dRGyCYXeOHAx55URoqRtFL9A+8MeC41nFariZgHFxkSi7Xn6TRXnU4RfhX/cRL4F uoMU+fvP1rs+CGo3EGZGWs5Awf4gAFB8attTs/DiNfhMsZCeVGuBzpcb5EDvX6O9 F5y28ulHmXYCzTqYqKe4OchZLg/lGuZ4mKJH2kyyhVOPhmGZihWZjYkPMByvJ1NS YZHc7hEhCYe9Yerji4YQ9Ao9v9auqOVS3ndHdD3tkNZdFtyCRhln+X0E00gF3hKP RyI4Og== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40ac0gkh2f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 12:44:55 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 46CCirf0028069 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 12:44:53 GMT Received: from hu-skakitap-hyd.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 12 Jul 2024 05:44:46 -0700 From: Satya Priya Kakitapalli Date: Fri, 12 Jul 2024 18:13:32 +0530 Subject: [PATCH 5/5] ARM: dts: qcom: Add support for MBG TM for pm8775 on SA8775P Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240712-mbg-tm-support-v1-5-7d78bec920ca@quicinc.com> References: <20240712-mbg-tm-support-v1-0-7d78bec920ca@quicinc.com> In-Reply-To: <20240712-mbg-tm-support-v1-0-7d78bec920ca@quicinc.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , "Thara Gopinath" , Bjorn Andersson , Konrad Dybcio CC: Kamal Wadhwa , Taniya Das , Jishnu Prakash , , , , , , Satya Priya Kakitapalli , Ajit Pandey , "Imran Shaik" , Jagadeesh Kona X-Mailer: b4 0.13.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: nYXH9ngSNr5YB03qH1V5mF878LG88bvj X-Proofpoint-GUID: nYXH9ngSNr5YB03qH1V5mF878LG88bvj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-12_09,2024-07-11_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 mlxlogscore=823 mlxscore=0 impostorscore=0 clxscore=1015 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407120086 Add support for MBG TM peripheral for pm8775 sail pmics on SA8775P. Signed-off-by: Satya Priya Kakitapalli --- arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi | 120 ++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi b/arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi index bd4f5f51e094..69910306885e 100644 --- a/arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi @@ -89,6 +89,62 @@ trip1 { }; }; }; + + pmm8654au_0_mbg_tm: pmm8654au_0_mbg_tz { + polling-delay-passive = <100>; + polling-delay = <0>; + thermal-sensors = <&pmm8654au_0_tz>; + + trips { + trip0 { + temperature = <115000>; + hysteresis = <5000>; + type = "passive"; + }; + }; + }; + + pmm8654au_1_mbg_tm: pmm8654au_1_mbg_tz { + polling-delay-passive = <100>; + polling-delay = <0>; + thermal-sensors = <&pmm8654au_1_tz>; + + trips { + trip0 { + temperature = <115000>; + hysteresis = <5000>; + type = "passive"; + }; + }; + }; + + pmm8654au_2_mbg_tm: pmm8654au_2_mbg_tz { + polling-delay-passive = <100>; + polling-delay = <0>; + thermal-sensors = <&pmm8654au_2_tz>; + + trips { + trip0 { + temperature = <115000>; + hysteresis = <5000>; + type = "passive"; + }; + }; + }; + + pmm8654au_3_mbg_tm: pmm8654au_3_mbg_tz { + polling-delay-passive = <100>; + polling-delay = <0>; + thermal-sensors = <&pmm8654au_3_tz>; + + trips { + trip0 { + temperature = <115000>; + hysteresis = <5000>; + type = "passive"; + }; + }; + }; }; reboot-mode { @@ -180,6 +236,22 @@ reboot_reason: reboot-reason@48 { }; }; + pmm8654au_sail_0: pmic@1 { + compatible = "qcom,pmm8654au", "qcom,spmi-pmic"; + reg = <0x1 SPMI_USID>; + #address-cells = <1>; + #size-cells = <0>; + + pmm8654au_0_tz: qcom,mbg-tm@d700 { + compatible = "qcom,spmi-mgb-tm"; + reg = <0xd700>; + io-channels = <&pmm8654au_0_adc PM8775_ADC5_GEN3_DIE_TEMP(0)>; + io-channel-names = "thermal"; + interrupts-extended = <&spmi_bus 0x1 0xd7 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <0>; + }; + }; + pmm8654au_1: pmic@2 { compatible = "qcom,pmm8654au", "qcom,spmi-pmic"; reg = <0x2 SPMI_USID>; @@ -226,6 +298,22 @@ pmm8654au_1_gpios: gpio@8800 { }; }; + pmm8654au_sail_1: pmic@3 { + compatible = "qcom,pmm8654au", "qcom,spmi-pmic"; + reg = <0x3 SPMI_USID>; + #address-cells = <1>; + #size-cells = <0>; + + pmm8654au_1_tz: qcom,mbg-tm@d700 { + compatible = "qcom,spmi-mgb-tm"; + reg = <0xd700>; + io-channels = <&pmm8654au_1_adc PM8775_ADC5_GEN3_DIE_TEMP(2)>; + io-channel-names = "thermal"; + interrupts-extended = <&spmi_bus 0x3 0xd7 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <0>; + }; + }; + pmm8654au_2: pmic@4 { compatible = "qcom,pmm8654au", "qcom,spmi-pmic"; reg = <0x4 SPMI_USID>; @@ -272,6 +360,22 @@ pmm8654au_2_gpios: gpio@8800 { }; }; + pmm8654au_sail_2: pmic@5 { + compatible = "qcom,pmm8654au", "qcom,spmi-pmic"; + reg = <0x5 SPMI_USID>; + #address-cells = <1>; + #size-cells = <0>; + + pmm8654au_2_tz: qcom,mbg-tm@d700 { + compatible = "qcom,spmi-mgb-tm"; + reg = <0xd700>; + io-channels = <&pmm8654au_2_adc PM8775_ADC5_GEN3_DIE_TEMP(4)>; + io-channel-names = "thermal"; + interrupts-extended = <&spmi_bus 0x5 0xd7 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <0>; + }; + }; + pmm8654au_3: pmic@6 { compatible = "qcom,pmm8654au", "qcom,spmi-pmic"; reg = <0x6 SPMI_USID>; @@ -317,4 +421,20 @@ pmm8654au_3_gpios: gpio@8800 { #interrupt-cells = <2>; }; }; + + pmm8654au_sail_3: pmic@7 { + compatible = "qcom,pmm8654au", "qcom,spmi-pmic"; + reg = <0x7 SPMI_USID>; + #address-cells = <1>; + #size-cells = <0>; + + pmm8654au_3_tz: qcom,mbg-tm@d700 { + compatible = "qcom,spmi-mgb-tm"; + reg = <0xd700>; + io-channels = <&pmm8654au_3_adc PM8775_ADC5_GEN3_DIE_TEMP(6)>; + io-channel-names = "thermal"; + interrupts-extended = <&spmi_bus 0x7 0xd7 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <0>; + }; + }; };