Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2272232lqb; Mon, 27 May 2024 13:59:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXQ3bE5XC3MGcznLINQ8HjNBwHQsmasXpwhWKDGcFew56Ct5XBFxxqDatDhQEv2yzvLTv3qTPsYHf5ECMyJ+ima473trm/AGekRVqEI5w== X-Google-Smtp-Source: AGHT+IGFrGuupsBypTEdt82xtfa6I4kFdX+qHKxhdQ9eiR34vNEMpPqTkx5oXZIWhBDaTe40WnVh X-Received: by 2002:a17:90a:c7d7:b0:2bd:e06b:c37f with SMTP id 98e67ed59e1d1-2bf5ea3adb6mr9745706a91.5.1716843542748; Mon, 27 May 2024 13:59:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716843542; cv=pass; d=google.com; s=arc-20160816; b=ZcLK5eNis365Tt41j7JxqXr7ScNCBMk0enyP3UX+WP9U84EUPbaazqIYkSGySZ4W8R nDru4MOhRkQMnh2t9ZApkVYxH7VF5EPOajNbZz5gJ9cUWOT7/CBdwsfqR3ZPsbF5LQNA rxJh1lxpo/p834QFNkjx7KePPkjMGquC1e6+NERHAF37bS1SzyvJAPnz5I2ph7AQO3Cf DlSsdlalslkEnJ4XREYD+KF8+Dy513AdFtsnx4lDOQiGYU8kFhG9I4Gu81YIWThvqSTS TpV4BKXuR+AD3mfzVkGlx6U6EcG5U4tBAdhfaB/UbnmpwtiFFjKBofgM9J7SJtlv+WFk GTiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=p8jIeDCLutZxhcKjiZQYFACc8Xv/uKLEd5CVew45JpQ=; fh=DXvgmAMjYIGPnLJI84AhaEp0+NY1juUXBqeCCSt/eyg=; b=TNDoarvTL1r9+IXHlv94uV6LA6sPz8ClP6A5fYvYIrqwAbH24XR+yNbX/RU9siZtlp UBt26y6LATgE3kY11rM9eIynHjmzvnaLWLdpKUaoFo5xnaM8mPnNfc6Yf+dG7VyWvBkV pn5qJzMTuEyes1goRBbujhpKB/zs4j/2PGQEQiYtyc0+BT3hMi05dHd5FJtgdEf8rp4x 7w35q9DE0u6puOZ+GPpHOYkzY8YD/UTOygrtVgVIuCvrL5aHzvCxSqUlOojSNWAR5kF6 lGelGreVhgbEsXgcwPMX96zEF8RA2Ohe0jQUdHMm3/5E/+vnEgKlz/6RY/w7KmyoHDMt JDDw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=NSlbaAyO; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-191406-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191406-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bfebf54768si960766a91.0.2024.05.27.13.59.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 13:59:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191406-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=NSlbaAyO; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-191406-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191406-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4072C282696 for ; Mon, 27 May 2024 20:59:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC6CB53368; Mon, 27 May 2024 20:58:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="NSlbaAyO" Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 6D2064CB4B; Mon, 27 May 2024 20:58:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843533; cv=none; b=MHloI4HsJsBLKdkaEjTCYk3GXjvlgYphdE1pUQ4SqiSfO4Y+rvQ4Gs3Z6Rb4uZq8v5+adocyKatxUoV2fvunUebBtLfJkwE0w6/AMfO9Eoc1EERhJ6txGIedmqnO+qTlWN+sAc7GKGU3Exoy4KbLdJ0LQSs5gciaBukUwy/810s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843533; c=relaxed/simple; bh=DdNM+/xtasRS3TMXAogfc6wnpLVZnjD39yQ9DrOjLbY=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=KCrZONslP5eqC5erPBORWMLxzCdJg9wTrbM/KXvd3wJNrWn4C1kNdxv4ZwZf9bgy7LdLdRwRcG/pc713qNzrK2Psmhq3jRUjJsrLembFcBRKHqFPAwkdJGl/0Ey/h9wtMpohfMLUJQd6Id5xHtoXDzzzHb90iUxJHnP6z9rikfM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=NSlbaAyO; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1716843529; bh=DdNM+/xtasRS3TMXAogfc6wnpLVZnjD39yQ9DrOjLbY=; h=From:Subject:Date:To:Cc:From; b=NSlbaAyOTnDlCUIan/XD2zASVl2xUBjnC1HRmzJGrQW/Ll/p5BEwA6xlOg4hWgKao aEaHMB9WNRwLbTp1GcUXdQzBgZDbu9BPMWXykBaIoFLewfe+uwoScScze0CxpmsslX NeTiqvgxgOt6qsCvZd0nMGHi2D9F9mTLCVLy5up0= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Subject: [PATCH v3 0/3] ChromeOS Embedded controller hwmon driver Date: Mon, 27 May 2024 22:58:30 +0200 Message-Id: <20240527-cros_ec-hwmon-v3-0-e5cd5ab5ba37@weissschuh.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-B4-Tracking: v=1; b=H4sIAPbzVGYC/33MQQ7CIBCF4as0rMXQKZTGlfcwxtRxEBaCgUo1T e8ubeJGE5f/S943sUTRUWK7amKRsksu+BLNpmJoe38l7i6lGQiQQomWYwzpRMjteAueg2wbeRY aTWtY+dwjGfdcvcOxtHVpCPG18rle1o+kv6Rcc8EBpUaF1FGn9iO5lBLah916GtjCZfhLQCFqA EBlsBdG/xDzPL8BNWE+g/IAAAA= To: Jean Delvare , Guenter Roeck , Benson Leung , Lee Jones , Tzung-Bi Shih Cc: Guenter Roeck , linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, chrome-platform@lists.linux.dev, Dustin Howett , Mario Limonciello , Moritz Fischer , Stephen Horvath , Rajas Paranjpe , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716843528; l=3336; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=DdNM+/xtasRS3TMXAogfc6wnpLVZnjD39yQ9DrOjLbY=; b=f4XDCvcz440TWIren1etaYDNP3WdxUJ0EktzLuI4bfL1tNFBpD/S0dfWgsYAFbAImjQlApbhR Vb2OdBw/WdhCnWrMdoeqpKVLQyvqO+33etozfO+exKfGa3RIFP4+bNm X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Add a hwmon driver that reports fan and temperature readings from the ChromeOS Embedded controller. There was an earlier effort in 2017 to add such a driver [0], but there was no followup after v1. The new driver is complete reimplementation based on newer APIs and with more features (temp sensor names). It only works on LPC-connected ECs, as only those implement direct memory-map access. For other busses the data would need to be read with a command. Adding some helpers was discussed in the previous patchset [1]. The EC protocols also support reading and writing fan curves but that is not implemented. Tested on a Framework 13 AMD, Firmware 3.05. [0] https://lore.kernel.org/all/1491602410-31518-1-git-send-email-moritz.fischer@ettus.com/ [1] https://lore.kernel.org/all/ac61bfca-bfa0-143b-c9ca-365b8026ce8d@roeck-us.net/ To: Jean Delvare To: Guenter Roeck To: Benson Leung To: Lee Jones To: Tzung-Bi Shih Cc: Guenter Roeck Cc: linux-kernel@vger.kernel.org Cc: linux-hwmon@vger.kernel.org Cc: chrome-platform@lists.linux.dev Cc: Dustin Howett Cc: Mario Limonciello Cc: Moritz Fischer Cc: Stephen Horvath Cc: Rajas Paranjpe Changes in v3: - Drop Mario's Reviewed-by tag, as the code has changed - Introduce cros_ec_cmd_readmem() for non-LPC compatibility - Report fault state for fans and temp sensors - Avoid adding unnecessary space characters to channel label - Drop thermal_version from priv data - Read fans during probing only once - Don't include linux/kernel.h - Move _read_temp_sensor_info to similar functions - Insert MFD entry alphabetically - Link to v2: https://lore.kernel.org/r/20240507-cros_ec-hwmon-v2-0-1222c5fca0f7@weissschuh.net Changes in v2: - drop unnecessary range checks (Guenter) - only validate thermal_version during probing - reorder some variable declarations - validate thermal_version directly in cros_ec_hwmon_probe (Mario) - drop return value from probe_temp_sensors as it can't fail anymore - fail with -ENODEV if cmd_readmem is missing to avoid spurious warnings - Link to v1: https://lore.kernel.org/r/20240507-cros_ec-hwmon-v1-0-2c47c5ce8e85@weissschuh.net --- Thomas Weißschuh (3): platform/chrome: cros_ec_proto: Introduce cros_ec_cmd_readmem() hwmon: add ChromeOS EC driver mfd: cros_ec: Register hardware monitoring subdevice Documentation/hwmon/cros_ec_hwmon.rst | 26 +++ Documentation/hwmon/index.rst | 1 + MAINTAINERS | 8 + drivers/hwmon/Kconfig | 11 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/cros_ec_hwmon.c | 291 ++++++++++++++++++++++++++++ drivers/mfd/cros_ec_dev.c | 1 + drivers/platform/chrome/cros_ec_proto.c | 27 +++ include/linux/platform_data/cros_ec_proto.h | 2 + 9 files changed, 368 insertions(+) --- base-commit: 2bfcfd584ff5ccc8bb7acde19b42570414bf880b change-id: 20240506-cros_ec-hwmon-24634b07cf6f Best regards, -- Thomas Weißschuh