Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3058211pxb; Mon, 24 Jan 2022 01:12:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyG9Lm1Zlfb4Cp0tKT4YQckhs3pqqx7GTrfoEk79Fjpq+LWA1eVDU1xCP+gxxSJdhh4tiiW X-Received: by 2002:a17:902:9a83:b0:14a:a893:f7ff with SMTP id w3-20020a1709029a8300b0014aa893f7ffmr13604784plp.6.1643015563910; Mon, 24 Jan 2022 01:12:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643015563; cv=none; d=google.com; s=arc-20160816; b=qeNd0QHDjamFRASqqrZSP5lBZ8LIt8WyEXys+iejfbubiftDWnDSg9KDnUv5fRtvTk jMFBSkQwQPDuffkzdXCAsziw0YKMHU/SPQRVyNkF9mGQjkqgwp5qhwzPEmoeZlBzkKc7 QhcZVym8oMwFwd7aelPF/Efw3Aj074kahoSR47gKDqrI/ONl9eRJyxBCFX7Md+ouxGTY Eo/sKdDOGGT8s5dBOPT0gQPl7jv526IZi/p96E0gQAbSbN4NZ3ov5sHtsKKNimMYPyTM MgAVuRKHwFI7cZrwyv7p3UBgmpNubp6U5Yoo0nO8O3n3ePUYwVzAJvgrGZllsgWIndAu zhsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=mycJ8+dHfD1xjVxrdmxmttz3DlLMs0BIC5UpIx3conI=; b=WDIHoOtBiLP3EHz/fdPbojaBjkf9zccuGIivul3c98w0XKVUzrCaZFlJ4MAwZ39jK5 vfYTgBAHxtT4xPYD3nNcZRqoBQNrZAfpbcQMlD47wvzOaf+Etl3rY2ArUxknavaRAwS7 D7hgodlfhOZiPay2gocr5ni1igExlQ7jCtJoG0Jw9oLhB4f5bSx3YjxmuatRUSTpqS3k 6OWmMepdmMFirwJYJfSLt9+CWuXFyB0YOh3b/GpqIuzzB5QJVChs50WSqWWXugmOi/g4 YNm/hSgIa/4r6URGLJ2Lz0WETtmYRszql6XihRWPB9znA0pOHLqhJj8hai+sAFhqwLQN CfJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=uX2QxqOz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si11604139pll.107.2022.01.24.01.12.31; Mon, 24 Jan 2022 01:12:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=uX2QxqOz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236819AbiAWOqd (ORCPT + 99 others); Sun, 23 Jan 2022 09:46:33 -0500 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:45565 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233533AbiAWOqb (ORCPT ); Sun, 23 Jan 2022 09:46:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1642949191; x=1674485191; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=mycJ8+dHfD1xjVxrdmxmttz3DlLMs0BIC5UpIx3conI=; b=uX2QxqOzUr0aitJ1yvfTtHjgOL5lSKV3ZAOV+DtZSNJPLK3+lNu8hBtL mUgRYJiKSOKZF3274lDsolz6tR/hwuMrG7HaWfweDYCfxyr3Pg6yQAdUH 4da428md+3IXFfEJGv/mwLKtCNo3Z+jE/eVxgQIQ4B+6alufm2T6EPfKN 0=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 23 Jan 2022 06:46:30 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jan 2022 06:46:29 -0800 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Sun, 23 Jan 2022 06:46:29 -0800 Received: from [10.216.26.9] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Sun, 23 Jan 2022 06:46:19 -0800 Message-ID: <6eed66b8-a04b-fa1e-49ec-d1051641b2e9@quicinc.com> Date: Sun, 23 Jan 2022 20:16:14 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH V3 4/4] thermal: qcom: add support for PMIC5 Gen2 ADCTM Content-Language: en-US To: Jonathan Cameron CC: , , , , , , , , , , , , , , , , , , Thara Gopinath , "Rafael J. Wysocki" , , , , , References: <1637647025-20409-1-git-send-email-quic_jprakash@quicinc.com> <1637647025-20409-5-git-send-email-quic_jprakash@quicinc.com> <20211126184613.00002816@Huawei.com> From: Jishnu Prakash In-Reply-To: <20211126184613.00002816@Huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jonathan, On 11/27/2021 12:16 AM, Jonathan Cameron wrote: > On Tue, 23 Nov 2021 11:27:04 +0530 > Jishnu Prakash wrote: > >> Add support for PMIC5 Gen2 ADC_TM, used on PMIC7 chips. It is a >> close counterpart of PMIC7 ADC and has the same functionality as >> PMIC5 ADC_TM, for threshold monitoring and interrupt generation. >> It is present on PMK8350 alone, like PMIC7 ADC and can be used >> to monitor up to 8 ADC channels, from any of the PMIC7 PMICs >> having ADC on a target, through PBS(Programmable Boot Sequence). >> >> Signed-off-by: Jishnu Prakash > Just one note on using put_unaligned_le16() below. Otherwise, from > a drive by review point of view it looks fine to someone not that > familiar with the driver or thermal :) > > Reviewed-by: Jonathan Cameron > >> --- >> drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 375 ++++++++++++++++++++++++++++++- >> 1 file changed, 372 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c >> index fc8cd45..a7b33a8 100644 >> --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c >> +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c >> @@ -4,7 +4,10 @@ >> * >> * Based on original driver: >> * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. >> + * >> + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. >> */ >> + >> + /* Low temperature corresponds to high voltage threshold */ >> + if (low != -INT_MAX) { >> + channel->high_thr_en = true; >> + adc_code = qcom_adc_tm5_gen2_temp_res_scale(low); >> + >> + buf[11] = adc_code & 0xff; >> + buf[12] = adc_code >> 8; > looks like a little endian put though not necessarily aligned so > put_unaligned_le16() preferred to open coding it. Same in similar places. > Not my area though so maintainer may not care as much. I'll use put_unaligned_le16 as suggested, in similar places in the next post. >> + } else { >> + channel->high_thr_en = false; >> + } >> + >> + buf[13] = ADC_TM_GEN2_MEAS_EN; >> + if (channel->high_thr_en) >> + buf[13] |= ADC_TM5_GEN2_HIGH_THR_INT_EN; Thanks, Jishnu