From patchwork Tue Jan 30 23:06:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivor Wanders X-Patchwork-Id: 194375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1550294dyb; Tue, 30 Jan 2024 15:07:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEler+SIaZ3o+IF+uAvy2eVDF+0Ulrawt0BBryPSwWP/SiyY1aTeBjgGn0FVBoXkNXdvJh9 X-Received: by 2002:a17:906:2dd2:b0:a2f:1817:2ef with SMTP id h18-20020a1709062dd200b00a2f181702efmr474614eji.70.1706656061245; Tue, 30 Jan 2024 15:07:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706656061; cv=pass; d=google.com; s=arc-20160816; b=Mabvx2qLzBRcbleh/F5I9R8WmXtcYvClNsOgz0g3NiK5G4uXIQzU1RPeUNZ7oHeKxd 8Uaap+ye5soOMH/wghyD6nMjoWn3KhluAJ+RpJzCa/McwywAuO8tK9JXDO6S70bSsdHI TofYGwqBUAGOXf8s17GiqorbLfEIeR5CY9vvrA4+QTYklfpvT+MilM5zuk5VQ9o/u6mN PzSlWyFpRVi79GGcIPwAy33KE6KLglfPuxWa1kgPcqNXBlwdCwxK2q907hWw3w9iTONv CsMhXVud0PrGMY1UR7Ylaw5wooYnjKJq/V3ke/Ct1izqYc/VVEA+cVbgbTsHb98H7soQ t+9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=XyHH5Unq92X0kSKpyQantcGDB1tT8ugB/3UImkmNwAE=; fh=tmP3r8kdHnjto9t/Q2hyg0WZlGuk2h+t0yEFfDzt3ZM=; b=EFA4aX8jnjY0VaTcs5iUF2cf6X5+oBAZwDBCw4nUsHV8ozCPCmiMQB3iCN0yVh5ygG 3kjxT4WpRrRThASK7NpbDj6X6G/GZkqIzVQFU5QCc8bBMYHczmhvppvFESAVc06lgP+t LLPYtJ1Udr8bwlQT24qCp86smvYJy9QRL/QKm2ilFj9n/hbHCwqaLZ96aZASU/EO56Hn DXPaKYcw83Roo9JavL7F7dC36ieZLogFAku7wMPrciKmzobaafx79zjloTRGOwK/ntp4 aIc8xLzSApF6t7FEZhRhsFmJkpQwYXlB2NOgAT83veFZ9EFMUYJYzPjxecOlqwaT+ssD rSyQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iwanders.net header.s=google header.b="IDFVj/lk"; arc=pass (i=1 spf=pass spfdomain=iwanders.net dkim=pass dkdomain=iwanders.net); spf=pass (google.com: domain of linux-kernel+bounces-45445-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45445-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f13-20020a170906390d00b00a30e66bcc58si4761587eje.765.2024.01.30.15.07.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 15:07:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45445-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@iwanders.net header.s=google header.b="IDFVj/lk"; arc=pass (i=1 spf=pass spfdomain=iwanders.net dkim=pass dkdomain=iwanders.net); spf=pass (google.com: domain of linux-kernel+bounces-45445-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45445-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D824E1F24BDB for ; Tue, 30 Jan 2024 23:07:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E14FB7B3CF; Tue, 30 Jan 2024 23:07:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iwanders.net header.i=@iwanders.net header.b="IDFVj/lk" Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 851257EF15 for ; Tue, 30 Jan 2024 23:07:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706656030; cv=none; b=QoSFS4KwgoclnptJhq7ii3SjepqrB+Zvmp6HrvnQrULNtnTLVFXvryiBdv/vGjqgILCGTtpo85ozjqXCA/g3pE+KpooGFdl7GHUJUdT5Wv8aY7cGhtNxyol4VZLoyBkgr/vzWzLrt3BOC+c+tGL+CxvhkhRpt14emgB2vF+4tVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706656030; c=relaxed/simple; bh=NQbNim9Kl9w3hMZilkX8mghToO2vPsILhxHQxKtN3Mg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=DVyYi5WJgJHae113akpxiYK9eXcGEkyGbI2KjEJY1T8kg+PRV7cBMn0UAiCsExMZFHRbFXpgiJDFTrpkawlFWT0uh1UaoCtPdOEkp1T7gggzZ4l2O4CNoSH4Uo55uZojr2VgL7GB/6VI150MwG4FX7NQMcW1fxy5YYDlzQDtLM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iwanders.net; spf=pass smtp.mailfrom=iwanders.net; dkim=pass (1024-bit key) header.d=iwanders.net header.i=@iwanders.net header.b=IDFVj/lk; arc=none smtp.client-ip=209.85.128.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iwanders.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iwanders.net Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-5ffdf06e009so44963557b3.3 for ; Tue, 30 Jan 2024 15:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iwanders.net; s=google; t=1706656027; x=1707260827; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=XyHH5Unq92X0kSKpyQantcGDB1tT8ugB/3UImkmNwAE=; b=IDFVj/lkAES27SD7y2PE+Akuu1uEcLvjm1pV7PsKvh1mqDPmiEnZqXYUtViiNbR7l6 VDkXTTkz0Hqx7eTMM9pDE91rV5p8KBew1Od+J0ZCzAfw4YA8HU+I5S/u1Wo3eAdTFrEd PEypRiIv+MaBGxLu4FRZv7keu2qR6yQ/Lzbxs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706656027; x=1707260827; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XyHH5Unq92X0kSKpyQantcGDB1tT8ugB/3UImkmNwAE=; b=Q8utxlLbYfdFVQh/Pw7plazYl1DPA5qjRlcc38gE38uUojLaLL6Kx3ZSS/7Dm3VV7k 17nQp34O7VhfZ8yteV1pWNE+pLYI00AKJUduzjMJQNobaEyv0KGSgOR970ueEbyhhM1v oX685cFby5X6ze1i70aybgRrWocXitbtZ+S6lDD6Itqh/6gWYSi52PHEvC+Z+/9TbJ+H BGaypUcvoZdVUCbovphvR+BxgPQeR/Pfoapusl2Uxwp5iiBPZCCveBDA/vAm7BtEZPm+ Nzo9PHoHoLCXfVxVkHlzkd62/kcEv4uTZRwHkDSrXUk7y7p9MOOLsdKjZbixkrkWDD4m CbyA== X-Gm-Message-State: AOJu0YxKk9OpTdXHaFrlBnqm+K7jkhpuohVTUI8D0mrVMXy/O01//xZf h0qzDACWg1gpjxlNxwPkUAfgE3HaoEbL9osRDD+QGcCSgnJveJfunSnavib3SaQ= X-Received: by 2002:a81:eb0e:0:b0:5ff:6084:421e with SMTP id n14-20020a81eb0e000000b005ff6084421emr7017803ywm.32.1706656027480; Tue, 30 Jan 2024 15:07:07 -0800 (PST) Received: from eagle.lan (24-246-30-234.cable.teksavvy.com. [24.246.30.234]) by smtp.gmail.com with ESMTPSA id di8-20020ad458e8000000b0068c47832171sm3081275qvb.65.2024.01.30.15.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 15:07:06 -0800 (PST) From: Ivor Wanders To: Jean Delvare , Guenter Roeck , Jonathan Corbet , Maximilian Luz , Ivor Wanders , Hans de Goede , Mark Gross Cc: linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v4 1/2] platform/surface: aggregator_registry: add entry for fan speed Date: Tue, 30 Jan 2024 18:06:53 -0500 Message-Id: <20240130230654.4218-2-ivor@iwanders.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240130230654.4218-1-ivor@iwanders.net> References: <20240130230654.4218-1-ivor@iwanders.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789558585801580714 X-GMAIL-MSGID: 1789558585801580714 Add an entry for the fan speed function. Add this new entry to the Surface Pro 9 group. Signed-off-by: Ivor Wanders Link: https://github.com/linux-surface/kernel/pull/144 Reviewed-by: Maximilian Luz --- Changes in v4: - No changes in this patch. Changes in v3: - No changes in this patch. Changes in v2: - No changes in this patch. --- drivers/platform/surface/surface_aggregator_registry.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c index 530db4db7..b0db25886 100644 --- a/drivers/platform/surface/surface_aggregator_registry.c +++ b/drivers/platform/surface/surface_aggregator_registry.c @@ -74,6 +74,12 @@ static const struct software_node ssam_node_tmp_pprof = { .parent = &ssam_node_root, }; +/* Fan speed function. */ +static const struct software_node ssam_node_fan_speed = { + .name = "ssam:01:05:01:01:01", + .parent = &ssam_node_root, +}; + /* Tablet-mode switch via KIP subsystem. */ static const struct software_node ssam_node_kip_tablet_switch = { .name = "ssam:01:0e:01:00:01", @@ -319,6 +325,7 @@ static const struct software_node *ssam_node_group_sp9[] = { &ssam_node_bat_ac, &ssam_node_bat_main, &ssam_node_tmp_pprof, + &ssam_node_fan_speed, &ssam_node_pos_tablet_switch, &ssam_node_hid_kip_keyboard, &ssam_node_hid_kip_penstash, From patchwork Tue Jan 30 23:06:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivor Wanders X-Patchwork-Id: 194376 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1550519dyb; Tue, 30 Jan 2024 15:08:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIhGlMUwinYiDcKq+5v64AmqKNGvoN9LDWuiB9+LvdFYIeiItnVOg8niCwkmP9MCYtoKQQ X-Received: by 2002:a92:c0d2:0:b0:363:94e6:94d2 with SMTP id t18-20020a92c0d2000000b0036394e694d2mr26793ilf.23.1706656088487; Tue, 30 Jan 2024 15:08:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706656088; cv=pass; d=google.com; s=arc-20160816; b=rmzis924+6+Q/P6n2/hXCdIpiTm/poKyBGe8cX2YbBW94Cw9CEupzF3yqy+1tbhkSa OGseN/v6dRe5srryKuQutarTrsBoDYT6OSvkxopg4jGy96jCK/CssIKE4kpwAuF94rQt LDJPRdsE8129iHmPyZ2CECxVdOh4nRXUCJTqCkckDFUuHvOtnTd4pVXbgkTwS8ru2+k9 4yrv3Sfm5ue0UeRWpis54VEUXuDfeyCvoq+Gm8VjC4G+LS2Dzz4P/i7JUJnWaV4Rfeq6 FZLeEQLniHzu1BhuzoXLHeBDZ/qgRJvzkuL5WLlrlAzi5eVPO+v1A3IDVqqKjuhsxKNI LINg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=ewNuteH+7JWkkhgRcvRINUdox40DYgFQx21HLo3QlY4=; fh=tmP3r8kdHnjto9t/Q2hyg0WZlGuk2h+t0yEFfDzt3ZM=; b=W5GeAmqBzub/ELJuqum8CZxL/CyhHMh16WLHNbVVn+Jt3o9G4N0fQBGfyF3BNvoSpO sRm/8iCZqBCtv4u1HAALqlk9WsiGwXOOD/trLMs4H1TrnU2XFWs0JNfXVhOrTk8Yt9eR fq+NnqopPuJhVNq0da9QvFByAAZVmGBk35zX/3n6DrMsAnEDD0CJNMPvRWeak7CwyN28 Elt88RVNv7kVRigXtiUhQaCSq/DERmQsnMp6lPTWpeHMvtHH0pw3CMIjZhXep8wXpEyx 81h2SMZ5vg5qn9mVBiPCurp3aXnMbvOo8Fad6svQHrCQkgsg7AKxJ1aoiKDuHkt54mFv aY1w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iwanders.net header.s=google header.b=HTWliAxJ; arc=pass (i=1 spf=pass spfdomain=iwanders.net dkim=pass dkdomain=iwanders.net); spf=pass (google.com: domain of linux-kernel+bounces-45446-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45446-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i64-20020a639d43000000b005d8b6e93993si6399139pgd.22.2024.01.30.15.08.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 15:08:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45446-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@iwanders.net header.s=google header.b=HTWliAxJ; arc=pass (i=1 spf=pass spfdomain=iwanders.net dkim=pass dkdomain=iwanders.net); spf=pass (google.com: domain of linux-kernel+bounces-45446-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45446-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4EA8CB22CD5 for ; Tue, 30 Jan 2024 23:07:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FCB27AE79; Tue, 30 Jan 2024 23:07:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iwanders.net header.i=@iwanders.net header.b="HTWliAxJ" Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F0A578697 for ; Tue, 30 Jan 2024 23:07:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706656033; cv=none; b=NBg0kwSVLwp1aVbQJ/oRBJZQYoXu6QOUuv0mOep8FkxRaRdScdfEDdpfg1p80fXypjgne71rgXpW/o456wv+v8Nwd3Q+SJrN4VRych1kPwJCimpqbZJJg8KcqeRghfAFqCYqHxDBzbimiifoPA/2/q3iHMK3d4v3gxwc+V3fI4g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706656033; c=relaxed/simple; bh=Fowyq8NobX0Ym3EDlrswcPrMJqTSU+6S5Ib7vRokd24=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=aPff7vJRTNFdVyZkyDWGNYPLG2Y7LUBuTfHk/VZYXDqAAJRu06Z1bub0ET++qaO5FP/8Q3ASAd/vqXh7G5MNNNMEwWucGyxX0Qg+U3Z6zOcspQV2wFSG8Ti8zzUQkFlMcUW4g7c17++2x9Kf5gsfD/jU17t4xgi1uu+Q29u4CTg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iwanders.net; spf=pass smtp.mailfrom=iwanders.net; dkim=pass (1024-bit key) header.d=iwanders.net header.i=@iwanders.net header.b=HTWliAxJ; arc=none smtp.client-ip=209.85.219.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iwanders.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iwanders.net Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-68c3d51ecebso25872906d6.3 for ; Tue, 30 Jan 2024 15:07:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iwanders.net; s=google; t=1706656029; x=1707260829; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=ewNuteH+7JWkkhgRcvRINUdox40DYgFQx21HLo3QlY4=; b=HTWliAxJW14RdrLxaB8hml1nXjIUamJUtNUHzL/JicDVEord8ccY24p5Eo2QzbtRX8 Vs621hCfGRQTOFe/GC+unpRMQDM214A6VBUMEcS+DxFildxA0T+vdJqW+3XErgnV+7Pg VugZtWGpS4fdOvOPeRXXQGPe/+PdhgcBW8kGA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706656029; x=1707260829; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ewNuteH+7JWkkhgRcvRINUdox40DYgFQx21HLo3QlY4=; b=r/psF+h2uKJhdFjtB82jlIozs9n8LNbNFL9djv0Xaa3Wt9J6+CKxk7nbcfIcHGjiAo cAuJhtOiCNT+gvQKubRTBurloB4Q1QL2vAcyvNw+KRR7VCxO05BruuaQmJFpKZI6tdPP 9bhdsC6e3GdQPp8cpeHlWyWrjti//3W4v7/NjEkSxYiZXDMQKEEKouGk4wLxvFaiVu9x Qiw/sDwxndogjWzSFCdxV4zmR3pC3NQufYYh7nlJmkg5F0tuZv+nYA92/rYWXPJV6nHh 9aA7U9XEau5mbyhUjHngnm00YqBYMHlP2YjzUtPJTQ4W9oGLm4NlLKQ8R8Kq1B1yPLWP UATA== X-Gm-Message-State: AOJu0Ywpt8rO5oF7zoP9+Nt3a2lNukd2xYzpKzpSBnyeR+eQJ2bkyVtY YM3B1jM7WMMA5M09QJnQZzMPutQQg2DTfzaXkqRoSpE++jPIu6aOTBel//1PfRM= X-Received: by 2002:a05:6214:21e8:b0:686:9f2e:d984 with SMTP id p8-20020a05621421e800b006869f2ed984mr6847qvj.22.1706656029290; Tue, 30 Jan 2024 15:07:09 -0800 (PST) Received: from eagle.lan (24-246-30-234.cable.teksavvy.com. [24.246.30.234]) by smtp.gmail.com with ESMTPSA id di8-20020ad458e8000000b0068c47832171sm3081275qvb.65.2024.01.30.15.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 15:07:08 -0800 (PST) From: Ivor Wanders To: Jean Delvare , Guenter Roeck , Jonathan Corbet , Maximilian Luz , Ivor Wanders , Hans de Goede , Mark Gross Cc: linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v4 2/2] hwmon: add fan speed monitoring driver for Surface devices Date: Tue, 30 Jan 2024 18:06:54 -0500 Message-Id: <20240130230654.4218-3-ivor@iwanders.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240130230654.4218-1-ivor@iwanders.net> References: <20240130230654.4218-1-ivor@iwanders.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789558614380583733 X-GMAIL-MSGID: 1789558614380583733 Adds a driver that provides read only access to the fan speed for Microsoft Surface Pro devices. The fan speed is always regulated by the EC and cannot be influenced directly. Signed-off-by: Ivor Wanders Link: https://github.com/linux-surface/kernel/pull/144 Reviewed-by: Maximilian Luz Reviewed-by: Armin Wolf --- Changes in v4: - Return 0 from surface_fan_hwmon_read instead of ret. - Use PTR_ERR_OR_ZERO in probe instead of if statement. Changes in v3: - Removed type and attr checks in read and is_visible. - Removed assigning sdev to ssam_device drvdata. - Propagate return from __ssam_fan_rpm_get. - Renamed hwmon chip name from 'fan' to 'surface_fan'. - Removed unnecessary platform_device header. Changes in v2: - Removed all sysfs attributes except fan1_input. Simplified code and updated documentation accordingly. --- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/surface_fan.rst | 25 ++++++++ MAINTAINERS | 8 +++ drivers/hwmon/Kconfig | 13 +++++ drivers/hwmon/Makefile | 1 + drivers/hwmon/surface_fan.c | 91 +++++++++++++++++++++++++++++ 6 files changed, 139 insertions(+) create mode 100644 Documentation/hwmon/surface_fan.rst create mode 100644 drivers/hwmon/surface_fan.c diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst index 042e1cf95..4dfb3b9bd 100644 --- a/Documentation/hwmon/index.rst +++ b/Documentation/hwmon/index.rst @@ -202,6 +202,7 @@ Hardware Monitoring Kernel Drivers smsc47m1 sparx5-temp stpddc60 + surface_fan sy7636a-hwmon tc654 tc74 diff --git a/Documentation/hwmon/surface_fan.rst b/Documentation/hwmon/surface_fan.rst new file mode 100644 index 000000000..07942574c --- /dev/null +++ b/Documentation/hwmon/surface_fan.rst @@ -0,0 +1,25 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Kernel driver surface_fan +========================= + +Supported Devices: + + * Microsoft Surface Pro 9 + +Author: Ivor Wanders + +Description +----------- + +This provides monitoring of the fan found in some Microsoft Surface Pro devices, +like the Surface Pro 9. The fan is always controlled by the onboard controller. + +Sysfs interface +--------------- + +======================= ======= ========================================= +Name Perm Description +======================= ======= ========================================= +``fan1_input`` RO Current fan speed in RPM. +======================= ======= ========================================= diff --git a/MAINTAINERS b/MAINTAINERS index 439cf523b..8e7870af3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14078,6 +14078,14 @@ F: Documentation/driver-api/surface_aggregator/clients/dtx.rst F: drivers/platform/surface/surface_dtx.c F: include/uapi/linux/surface_aggregator/dtx.h +MICROSOFT SURFACE SENSOR FAN DRIVER +M: Maximilian Luz +M: Ivor Wanders +L: linux-hwmon@vger.kernel.org +S: Maintained +F: Documentation/hwmon/surface_fan.rst +F: drivers/hwmon/surface_fan.c + MICROSOFT SURFACE GPE LID SUPPORT DRIVER M: Maximilian Luz L: platform-driver-x86@vger.kernel.org diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 307477b8a..4b4d999af 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -1965,6 +1965,19 @@ config SENSORS_SMM665 This driver can also be built as a module. If so, the module will be called smm665. +config SENSORS_SURFACE_FAN + tristate "Surface Fan Driver" + depends on SURFACE_AGGREGATOR + help + Driver that provides monitoring of the fan on Surface Pro devices that + have a fan, like the Surface Pro 9. + + This makes the fan's current speed accessible through the hwmon + system. It does not provide control over the fan, the firmware is + responsible for that, this driver merely provides monitoring. + + Select M or Y here, if you want to be able to read the fan's speed. + config SENSORS_ADC128D818 tristate "Texas Instruments ADC128D818" depends on I2C diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 3f4b0fda0..5ae214c06 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -198,6 +198,7 @@ obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o obj-$(CONFIG_SENSORS_SPARX5) += sparx5-temp.o obj-$(CONFIG_SENSORS_STTS751) += stts751.o +obj-$(CONFIG_SENSORS_SURFACE_FAN)+= surface_fan.o obj-$(CONFIG_SENSORS_SY7636A) += sy7636a-hwmon.o obj-$(CONFIG_SENSORS_AMC6821) += amc6821.o obj-$(CONFIG_SENSORS_TC74) += tc74.o diff --git a/drivers/hwmon/surface_fan.c b/drivers/hwmon/surface_fan.c new file mode 100644 index 000000000..31cd5da9e --- /dev/null +++ b/drivers/hwmon/surface_fan.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Surface Fan driver for Surface System Aggregator Module. It provides access + * to the fan's rpm through the hwmon system. + * + * Copyright (C) 2023 Ivor Wanders + */ + +#include +#include +#include +#include +#include + +// SSAM +SSAM_DEFINE_SYNC_REQUEST_CL_R(__ssam_fan_rpm_get, __le16, { + .target_category = SSAM_SSH_TC_FAN, + .command_id = 0x01, +}); + +// hwmon +umode_t surface_fan_hwmon_is_visible(const void *drvdata, + enum hwmon_sensor_types type, u32 attr, + int channel) +{ + return 0444; +} + +static int surface_fan_hwmon_read(struct device *dev, + enum hwmon_sensor_types type, u32 attr, + int channel, long *val) +{ + struct ssam_device *sdev = dev_get_drvdata(dev); + int ret; + __le16 value; + + ret = __ssam_fan_rpm_get(sdev, &value); + if (ret) + return ret; + + *val = le16_to_cpu(value); + + return 0; +} + +static const struct hwmon_channel_info *const surface_fan_info[] = { + HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT), + NULL +}; + +static const struct hwmon_ops surface_fan_hwmon_ops = { + .is_visible = surface_fan_hwmon_is_visible, + .read = surface_fan_hwmon_read, +}; + +static const struct hwmon_chip_info surface_fan_chip_info = { + .ops = &surface_fan_hwmon_ops, + .info = surface_fan_info, +}; + +static int surface_fan_probe(struct ssam_device *sdev) +{ + struct device *hdev; + + hdev = devm_hwmon_device_register_with_info(&sdev->dev, + "surface_fan", sdev, + &surface_fan_chip_info, + NULL); + + return PTR_ERR_OR_ZERO(hdev); +} + +static const struct ssam_device_id ssam_fan_match[] = { + { SSAM_SDEV(FAN, SAM, 0x01, 0x01) }, + {}, +}; +MODULE_DEVICE_TABLE(ssam, ssam_fan_match); + +static struct ssam_device_driver surface_fan = { + .probe = surface_fan_probe, + .match_table = ssam_fan_match, + .driver = { + .name = "surface_fan", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, + }, +}; +module_ssam_device_driver(surface_fan); + +MODULE_AUTHOR("Ivor Wanders "); +MODULE_DESCRIPTION("Fan Driver for Surface System Aggregator Module"); +MODULE_LICENSE("GPL");