From mboxrd@z Thu Jan 1 00:00:00 1970 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 B986228C009 for ; Thu, 25 Jun 2026 08:03:09 +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=1782374591; cv=none; b=g9nfX2TfuYtf2hYiUPNPtTqGDEfjYOdOYwzuDpAIMc90PtxJw3L+RGz7RPSmeHl+Z4wRswSNUPE7O3mDgLYKpCugEoXQA7ynp6Dgva57FWS7GW7wQGu2X0t5GxwGhS37TwYDvv1zBzvBUBsJhW1uNR6jOT+BkJHmPFAw3hAxJZA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782374591; c=relaxed/simple; bh=+LeUK2W5WFxMKhi1pUwMIkmIdcqHQRyIWqYHLGd/T/0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mWDKrZbibh1QNZAEIMlhZDW50u2evUT0fNfKq+RboxMKpHI4sI+1BmyCX2c/GgilOHQaHAqaH54eif98WQUhizQ6L9mXSAOLJ2BdU1SMwAbH2h3daZ5i5MJYPojxHw1AIX3LEuaq5ndw5CK5leffF8vRmnQa+dZeLSlAUCyUH+c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=AqIS9j1t; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=AEGvldsS; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="AqIS9j1t"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="AEGvldsS" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65P3e9xg904421 for ; Thu, 25 Jun 2026 08:03:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= rO5FCGXsOoFHvv0mUd0JcJWaoLBN4ynun7BHL8hKdy8=; b=AqIS9j1to+afer2w TBq4LwesK9SicCLGAyGSt08s7w0zPebsw7YZg0wTrIa8NQqDpF2CSvLrOXzh1nK1 vwaNumsxuvNfWr+X7k0wcoTa22j8ydLkGKabfRLryANYtODU8Tmbx7oPyb/LxLFs SNNse8jCF7jR/jxa38+qzk4X7y2HLWd8KB6R60skirMK/VoJtCuJzyfYch7Q+gTb zQgdD9V9PGVtkmlsQ0EeHj0c6DnHINfFDF7siO9XMm1o5YnzJZGh3uZAsRfgJEE3 pA1cvXx/ezBX/dX1RgfKIF8/9u/ZW43exOYR/4dEBrLEcWau0zPWit3kyR9rUSBR ds1/WQ== Received: from mail-vk1-f198.google.com (mail-vk1-f198.google.com [209.85.221.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4f0j7du9m1-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 25 Jun 2026 08:03:08 +0000 (GMT) Received: by mail-vk1-f198.google.com with SMTP id 71dfb90a1353d-5bbe6a1d5fdso43319e0c.3 for ; Thu, 25 Jun 2026 01:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1782374588; x=1782979388; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=rO5FCGXsOoFHvv0mUd0JcJWaoLBN4ynun7BHL8hKdy8=; b=AEGvldsSKfHU7MuVHBGJyXthXCQVM9RC/a6LBzhnlduPif/3pXJY0bq/tRFOZABg3/ na7BYBdKwOm2+/gHr/Yi2Exa06G2wq0rQu/rALgxuKbIkIL0aczAHVXVDpmZmjK2o/D8 agdcCJkfhZ1/5n3QVSp19i5ooPODkdzskO8lwo2eturfTx8HyznS9CSIjM9ZM8PkHjve jxcVNGS2Y6wZlJ1/QulpjIbys2iY+xQLzPomUjPqrofwQwfAwT/3Ga/sjKra8q1OUBcw 4RWeGRGs8vTCwebhbe6GzWMx46b+VqqDFHxWCeUZm18muSgnqG7h4QrdwUIfz9OvckAe R+EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782374588; x=1782979388; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rO5FCGXsOoFHvv0mUd0JcJWaoLBN4ynun7BHL8hKdy8=; b=RZjxEARe1Aqq2VBVZI82wffNFx9EkBITXz2KJWPjSB677ywsRPmnKuEAwT6f1dxtOB 4l4QxSKoT1Dy3TjUkLZeR6ez0Fb5fCvqZGr8HnzxYyIbRUXs7y7KMwA+VWS93T+HODRG 0YnSnc6TyPlPnHwxNLfkvkuON6h6o0Pk8duWQErENd1D9uzPn2yfs7TrogsSv87/kQ0I j9Fh8yhVkQd8oaWxeagzPH77Fmv4RHl9ZGatSmL99UWeB8/S6BxFnhj3okf5rlf4weWT R7WNQl5/aSgQ+qcWLPEK8bdmYbqDlWLwHYRHNLrOJPPpt4HWB766+DF88ilPcEoCoP0J wZJQ== X-Forwarded-Encrypted: i=1; AHgh+RosIhSd4DYjeZtQMnsSu4LRtIFl0AfHnqj2fU8xWmxuPJQy/67606pWwia9SnxeJp/7dyV8RZ2wtViM02A=@vger.kernel.org X-Gm-Message-State: AOJu0Yxuam0SAyIDQ977nlf3/4nVC9PN6KVXemD1C7/DTe7OG7ecGBpR vlUvxPUJYn7Cba3h1U+zi1SaNOlkzTMejgwUi/FRwJA79Oq0C7aqxGHlAOFtIT4QEN+UyXNxY8o PCFSGNllMm9aFRZhC28qq214m3OydKe57J7MS7DNBOMPhZWQmHcowmI3UHZkzws0KmZ2h3o1I/p I= X-Gm-Gg: AfdE7clAC3PT+4I54rq8X4dnAo2dfkQImZ/LLsgVL8D/RMf6U+lYq2WUf10vuGhGcwK J0ALBP7i3J47fTKKbRi9xzGms8oLUYCbIiIkks9GjI+78Dyes8x4IKy1R+nRKKQh/9vJq2gC8Zw 1sdAVl5GEj/UGbtTWxAt955UZ9bXvGBnn/A458iO3I5+koJfY/8btGtK+a5RujcYl1Ece3HD5xS 3hlECEHJvWfLcTrOWHoAmLVbtOAWPb6F01OtFQjzIxz8H3Xi6D3B69Ac5We73ozuzQthLGml8dS bSOEyVqpAnnO+8Fd/it4bwTyxYn+WWPE8Z0e8fdCoFTwg+4Euny3inoWO5RqiEVROSSBR855NNn mzja4xSkMK6mH6C7ZC8AFvu2pAPh9qPKEKd8= X-Received: by 2002:a05:6102:548a:b0:632:9ebf:6069 with SMTP id ada2fe7eead31-734360a285amr157857137.4.1782374587898; Thu, 25 Jun 2026 01:03:07 -0700 (PDT) X-Received: by 2002:a05:6102:548a:b0:632:9ebf:6069 with SMTP id ada2fe7eead31-734360a285amr157854137.4.1782374587428; Thu, 25 Jun 2026 01:03:07 -0700 (PDT) Received: from [192.168.120.170] ([178.235.128.140]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c11fbe59504sm121399566b.43.2026.06.25.01.03.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Jun 2026 01:03:06 -0700 (PDT) Message-ID: <1d26c917-917e-41b8-ad52-8c1f3e306ce6@oss.qualcomm.com> Date: Thu, 25 Jun 2026 10:03:02 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/3] drivers/platform: lenovo-t14s-ec: Add hwmon support for temperatures and fan speed To: Daniel Lezcano , sre@kernel.org, hansg@kernel.org, ilpo.jarvinen@linux.intel.com, linux@roeck-us.net, andersson@kernel.org, konradybcio@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: bryan.odonoghue@linaro.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org References: <20260624210825.264454-1-daniel.lezcano@oss.qualcomm.com> <20260624210825.264454-2-daniel.lezcano@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <20260624210825.264454-2-daniel.lezcano@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: Wc3GO24dzp_7wWs66koae3weXfyEtt6X X-Authority-Analysis: v=2.4 cv=NvHhtcdJ c=1 sm=1 tr=0 ts=6a3ce0bc cx=c_pps a=1Os3MKEOqt8YzSjcPV0cFA==:117 a=PRfkaYvzSr8QmIIGAkY2Sg==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=3l1M8v5O_xJZoUiDCkgA:9 a=QEXdDO2ut3YA:10 a=hhpmQAJR8DioWGSBphRh:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNjI1MDA2OCBTYWx0ZWRfXyaM1q9y2zlOS lnHp5baqu3J75F2sFTEE+DeNFBW1zi1TA/3ucsyfcpFGfPu/lp4OmGeUKxuByGmSrTe4k7BhYOk pgOZzfZTc5P25/kWC/QkLKKPFUs31PA= X-Proofpoint-ORIG-GUID: Wc3GO24dzp_7wWs66koae3weXfyEtt6X X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjI1MDA2OCBTYWx0ZWRfXyxsL2QWh6+QB fGha5y7yaZ82GBYdUu1if/Qfg0VFR3ltsSVLH5Rfm/kVfWso2YZu/tFILlheyxRZGt08sp7s7D5 DbHkMMskv+7lCxlZBPBRFZUnx78epGtJX7fXenGVhM3K2dOracjd7/9RzFN9xhnbEnDqDUFFYvw 1aFvw7WTMOKYAdgvP9PFPC/hdHOvC3StmgZv/6v9mmLLT4oS6aLSqISfYOfpi//SUitryrEEoaC a/2PxhvUxcQIl/V9Vgy++2RKwbXnhCketO0DIRhxoDSOFN6TwzcPmHBccJxBmNIpU79CBOBP4w9 Tce+Q4j3vJVSA9K50lNqc9ROaWqKkOr15/u4674UCc7AvpGd0V12qS0EppdKV49oENDD7qPr3S5 xXJWi18yjIclKHgqRoLDKG0kcL+6hnvoC16RidWax80LBn6VxfUaeffET/fxLKTU5YArbqEH+bD 8iZS0J+AzJPEiUa27uQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-25_01,2026-06-24_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 suspectscore=0 adultscore=0 impostorscore=0 phishscore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606250068 On 6/24/26 11:08 PM, Daniel Lezcano wrote: > Expose the Lenovo ThinkPad T14s EC environmental sensors through > the hwmon subsystem. > > The driver now registers a hwmon device providing access to six EC > temperature sensors corresponding to the SoC, keyboard area, base > cover, PMIC/charging circuitry, QTM module and SSD. Sensor labels > are exported to allow user space to identify each measurement. > > Additionally, expose the system fan speed by reading the fan RPM > registers from the embedded controller. > > This allows standard monitoring tools such as lm-sensors to report > platform temperatures and fan speed. > > Signed-off-by: Daniel Lezcano daniel.lezcano@oss.qualcomm.com > --- [...] > + case hwmon_fan: > + if (attr == hwmon_fan_input) { > + int lsb, msb; > + ret = t14s_ec_read(ec, T14S_EC_FAN_RPM_LSB, &lsb); > + if (ret) > + return ret; > + > + ret = t14s_ec_read(ec, T14S_EC_FAN_RPM_MSB, &msb); > + if (ret) > + return ret; > + > + *val = 0; > + *val = lsb + (msb << 8); '+' looks funny here.. although t14s_ec_read() only reads a single byte and assigns a u8 value to the u32 that's being passed to it, so it never *actually* breaks.. [...] > +static const struct hwmon_channel_info *t14s_ec_hwmon_info[] = { > + HWMON_CHANNEL_INFO(temp, > + HWMON_T_INPUT | HWMON_T_LABEL, > + HWMON_T_INPUT | HWMON_T_LABEL, > + HWMON_T_INPUT | HWMON_T_LABEL, > + HWMON_T_INPUT | HWMON_T_LABEL, > + HWMON_T_INPUT | HWMON_T_LABEL, > + HWMON_T_INPUT | HWMON_T_LABEL), > + HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT), > + NULL > +}; > + > +static const struct hwmon_chip_info t14s_ec_chip_info = { > + .ops = &t14s_ec_hwmon_ops, > + .info = t14s_ec_hwmon_info, > +}; > + > +static int t14s_ec_hwmon_probe(struct t14s_ec *ec) > +{ > + struct device *dev; > + struct t14s_ec_hwmon_sys_thermx sys_thermx[] = { > + { T14S_EC_SYS_THERM0, "soc" }, > + { T14S_EC_SYS_THERM1, "keyboard" }, > + { T14S_EC_SYS_THERM2, "base" }, > + { T14S_EC_SYS_THERM3, "pmbm" }, > + { T14S_EC_SYS_THERM6, "qtm" }, > + { T14S_EC_SYS_THERM7, "ssd" }, Makes one wonder what happened to THERM4/5 - may they be dedicated to the 5G modem, perhaps? Konrad