Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1326197pxb; Thu, 4 Mar 2021 08:33:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxlRiZMOhDGJTnbwwaYO1YMhaLom0aT8PQx0tr1l7cnSMzFulE+JhT7aZtoXBXtJMTXO1PE X-Received: by 2002:a05:6402:27d4:: with SMTP id c20mr5311240ede.271.1614875615442; Thu, 04 Mar 2021 08:33:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614875615; cv=none; d=google.com; s=arc-20160816; b=ZNdF7h6a88u+C54swsVtWpe+5KFyXW6M59SHJLs+cDZ5c90TwuDoFRruGaFjjgoMOS C5Ddec2KVO03oU6S159NZLFxJrv8eZIiN/E+btTqD4M2q93j94XgbP1a0MB8/zle869m X+ceAPXg22k9jn9AxVE33cUDftSESuaX0WSFLTL4v3d2wFAx1f7+7oJ6Y9sqzAbv5yIX yr5Zg1wOKyuphCuDlX1rfhGlwiXOflo1hq/1AAGWWZpXE7QvUQRCvDUC4uvp6lZZQlDX EKGHjD171lpWp8/qsAfFZ6I4IJiFg3bsCF9B2Qz+OyNOsEFVwTxQrjzk0e6c9CqJ2fPT N3nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from; bh=rlACR9GlcEGYi0JxxJSxFKSxWtcSncE/VZbbXtmns9I=; b=AsJo1mnWHh5MCBOsA3jc5J15vcm/cUMODB6Tb6gIVVPAA/LQTZUIUN/XDvlk65oQY9 IfLFCKGUpR9PPUSLxwOeveK3Xt/QGFFb9XaT2i412ZhKF9dikzBKswRRs/dtYyQ30gVX GNuSKtmUVa1xUMDvWV270ZYGgn7U4TaO5DQxys/8ZvX2/vLJTkHJd3xPILypiyQY/oPA iGACGIb4aelZI9+pCZxIPnWaIpBxVu+jURthE9pH+e3IwK7QxuA00cTTU7owsazrCS7d rfno+EcEeaCc3jmvy/eooaq4wxil16CnTVUv+dLuz1DC4l9NuiQT6Z3q9y48mPW2J4KM rcsQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cesnet.cz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr14si9824709ejc.394.2021.03.04.08.33.12; Thu, 04 Mar 2021 08:33:35 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cesnet.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239310AbhCDLBY (ORCPT + 99 others); Thu, 4 Mar 2021 06:01:24 -0500 Received: from mail-wr1-f46.google.com ([209.85.221.46]:33347 "EHLO mail-wr1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239251AbhCDLAy (ORCPT ); Thu, 4 Mar 2021 06:00:54 -0500 Received: by mail-wr1-f46.google.com with SMTP id 7so27146762wrz.0; Thu, 04 Mar 2021 03:00:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rlACR9GlcEGYi0JxxJSxFKSxWtcSncE/VZbbXtmns9I=; b=jAbdWMq1IkDGwFYDcQSK5qKDbLNbrklgoblo0H0u0AyVUWea2ykOoDzOAMpNMFTPRf oUzQzDbUb3iFuZ7SOtKwoZUiw2d1L9ahsoLMuIO5Grm8uedO18OykXCW45De0ovfttq/ cKctxA7YHAjBvJRpO3W6dgQjAzVufVLvnUME+EAkuW9OvMY2g/mK87Fv2DK5FiqRG+CB 712gn7mwSUlELO3da7LAdOxo0wTwv6MZRCOustMtWhmMNA+tza4CKiI4MEq2pm1wQuK+ PY5SuLqUwwPCAIzgfMX5z1ZfItRloH0Y98UsnRAx4VaTXCvbTx58us6it5iWDic0ItAR fu0g== X-Gm-Message-State: AOAM531lU3VwJvDmMSagmeWG4IbsZxYIjLCorkzR2/TRxG6hWCEkkwRy vxPyfEI4aE5lshTL6/CD944= X-Received: by 2002:adf:e84f:: with SMTP id d15mr3364431wrn.394.1614855612414; Thu, 04 Mar 2021 03:00:12 -0800 (PST) Received: from localhost ([2a02:8308:387:c900:a7b5:b859:9449:c07b]) by smtp.gmail.com with ESMTPSA id x13sm35184151wrt.75.2021.03.04.03.00.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Mar 2021 03:00:12 -0800 (PST) From: =?UTF-8?q?V=C3=A1clav=20Kubern=C3=A1t?= Cc: =?UTF-8?q?V=C3=A1clav=20Kubern=C3=A1t?= , Jean Delvare , Guenter Roeck , Jonathan Corbet , linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] hwmon: (max31790) Update documentation Date: Thu, 4 Mar 2021 11:58:30 +0100 Message-Id: <20210304105830.507176-7-kubernat@cesnet.cz> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210304105830.507176-1-kubernat@cesnet.cz> References: <20210304105830.507176-1-kubernat@cesnet.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The conditions for fan fault and its connection to the PWM mode are now documented. The pwm_rate_of_change and fan_window are now mentioned. According to our testing with Sunon PF36281BX-000U-S99, these values are crucial in how RPM mode works and how long it takes for the RPM to stabilize. For example, setting 5000 RPM (the fan goes up to 23000), the pwm_rate_of_change needed to be changed to the lowest possible value, otherwise the chip would just go from pwm 0 to pwm 60 back and forth and never achieving 5000 RPM (and also signaling fan fault). Based on this testing, we found out that it the pwm_rate_of_change and fan_window values need to be changed manually by the user, based on the user's exact fan configuration. Signed-off-by: Václav Kubernát --- Documentation/hwmon/max31790.rst | 48 +++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/Documentation/hwmon/max31790.rst b/Documentation/hwmon/max31790.rst index 627816fa45fb..d5ab7caa491a 100644 --- a/Documentation/hwmon/max31790.rst +++ b/Documentation/hwmon/max31790.rst @@ -30,6 +30,51 @@ monitoring and control of fan RPM as well as detection of fan failure. Six pins are dedicated tachometer inputs. Any of the six PWM outputs can also be configured to serve as tachometer inputs. +About pwm[1-6]_enable +--------------------- +full-speed +- The chip doesn't have a specific way to set "full speed", so setting pwm[1-6]_enable to 0 is just "set PWM mode with 255 duty cycle". + +PWM mode +- Fan speed is controlled by writing a value to pwm[1-6]. + +RPM mode +- Fan speed is controlled by writing a value to fan[1-6]_target. + +About fan[1-6]_fault +-------------------- +In PWM (or full-speed) mode, if the input RPM goes below what is set +in fan[1-6]_target, fan[1-6]_fault gets set to 1. In other words, +fan[1-6]_target works as the minimum input RPM before a fan fault goes off. + +In RPM mode, fan fault is set when the fan spins "too slowly" (exact +conditions are in the datasheet). RPM mode depends on four variables: + +- target_speed: This is set by fan[1-6]_target. +- speed_range: This is set automatically when setting target_speed or manually by fan[1-12]_div. +- pwm_rate_of_change: NOT set by the driver. +- fan_window: NOT set by the driver. + +The last two values are not set by the driver, because there's no generic way to +compute them. You should set them manually through i2c (in the bootloader for +example). Check the datasheet for details. The driver uses `regmap`, so it +should be easy to read the values of the registers from userspace. + +The fan fault value latches. To reset it, set a value to pwm[1-6] +or fan[1-6]_target. + +About fan[1-12]_pulses +---------------------- +You should set this depending on the fan you use. It affects what values +are in fan[1-12]_input and also what gets written to fan[1-6]_target. + +About fan[1-12]_div +------------------- +This value affects the measurable range of the chip. The driver sets this value +automatically in RPM based on fan[1-6]_target. In PWM mode, you should set this +value manually based on the details from the datasheet. Setting the speed range +is disabled while in RPM mode to prevent overwriting the automatically +calculated value. Sysfs entries ------------- @@ -40,7 +85,8 @@ fan[1-12]_pulses RW pulses per fan revolution (default: 2) fan[1-12]_input RO fan tachometer speed in RPM fan[1-12]_fault RO fan experienced fault fan[1-12]_div RW set the measurable speed range, not available in RPM mode -fan[1-6]_target RW desired fan speed in RPM +fan[1-6]_target RW RPM mode = desired fan speed, + PWM mode = minimum fan speed until fault pwm[1-6]_enable RW regulator mode, 0=full speed, 1=manual (pwm) mode, 2=rpm mode setting rpm mode sets fan*_enable to 1 pwm[1-6] RW fan target duty cycle (0-255) -- 2.30.1