Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp224668rdf; Tue, 21 Nov 2023 00:17:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFj8pYILFW23Sv/GCuoDalAbPSbEMYP0Sw+S0ENix/LehH3/+f6/i+WxscnHNnO5PutCIQT X-Received: by 2002:a17:902:ce81:b0:1cc:6d2c:fb59 with SMTP id f1-20020a170902ce8100b001cc6d2cfb59mr9605590plg.28.1700554620053; Tue, 21 Nov 2023 00:17:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700554620; cv=none; d=google.com; s=arc-20160816; b=CNd7IVxJWNxrap7jpcRgAZ8uG/vrf1ZSe6EZRy/JO0sx5HTdSXAWV9OPswwEPk9ayI qW8VBtn6OoCYKZZI3hKe0XMrU2kk+fUP0tEaUrAppL6U84PJiZne3X6zi8Lb27WXbh2J 3aR6qvs3affrPvrB4jMjrksok7Rhr7wEp/g8lkrT6yG2gDlOYeTQb+OH0+NV5W4dlzTd xG8M/mgdANjvg3OHWNKirKi8Pbz8Rx5FRF5z1HyeLhDof6fFu2p/KQSw4UBBKfVftzTM E0fw3D1/hMNFWlqXU4oWUEmcdmZv50B1NZrvuDSXYOJTzrBlYDtR+cWMv9i7UcdYWQwp svWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ivtSyt16d/q/4hJmFH8wkKbGBmxit30g3vcK59BKTWo=; fh=brTD9uWwHSBEuDMsNSIyrWZVEeJXt4Ae/wkRCvfJiZk=; b=xfYLcKy4psQhUQmEOQJPOrZbBJZTtYWLMZR1MbFbwLuY16IritHHT830gbYTeOE/Y+ PnsxImpm3BMrULpunKnMsHOaVoloVn63UfwsWNk8tbq3v6qycpn8IgKLpNNjzRC0X1mJ ia4bIoLFsmhK7pxugRsHmEHasWHRI44KrOFjM3J0bryWx3GJStjt5NpuHhFWzH+f1Vj3 M3TzwYA7R5yzudplReYaeqFkxbM8r1SF1lfi1JH6ogzatassh3WHPi9t0WOV/kZT+ZiC LsmUr5JyoBJ6lN9oAgAIvmZasn8UXCkTfFSmAeDa3OW18zLg6JEx18Nqp6WBGk8vU51N 1eyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=UjQpQ+yd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id l9-20020a170903120900b001cc2a6624e5si9986245plh.307.2023.11.21.00.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 00:17:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=UjQpQ+yd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id C511080BD757; Tue, 21 Nov 2023 00:16:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229837AbjKUIQk (ORCPT + 99 others); Tue, 21 Nov 2023 03:16:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjKUIQi (ORCPT ); Tue, 21 Nov 2023 03:16:38 -0500 Received: from m15.mail.163.com (m15.mail.163.com [45.254.50.220]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 72DA7E3; Tue, 21 Nov 2023 00:16:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=ivtSy t16d/q/4hJmFH8wkKbGBmxit30g3vcK59BKTWo=; b=UjQpQ+ydwcmU2U/RDwMLt OgkISEd+zpBzgIM0inBdR910o5ZFYz+h0r8WNohLxD4CdjxSAy9l7iRTtDtyBXMT t7bDq+/fuDyuvAUM5k8Et9AlsNFzl2Pzs/kjjkwJcw3/mUbkufCWCeSmuIvqRMRL 5RcdYClFNeqyemhdZVFKYM= Received: from localhost.localdomain (unknown [39.144.137.247]) by zwqz-smtp-mta-g2-0 (Coremail) with SMTP id _____wAn9ctEZ1xlUJ6BDg--.31532S4; Tue, 21 Nov 2023 16:16:08 +0800 (CST) From: Xing Tong Wu To: Guenter Roeck , Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Cc: xingtong.wu@siemens.com, tobias.schaffner@siemens.com, gerd.haeussler.ext@siemens.com Subject: [PATCH v3 2/2] hwmon: (nct6775) Fix fan speed set failure in automatic mode Date: Tue, 21 Nov 2023 16:16:04 +0800 Message-Id: <20231121081604.2499-3-xingtong_wu@163.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231121081604.2499-1-xingtong_wu@163.com> References: <20231121081604.2499-1-xingtong_wu@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wAn9ctEZ1xlUJ6BDg--.31532S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrtFWDWr4UXw45ZrykWrWfZrb_yoWfKFb_Ww 4F93s7urs8tF1Sk34DuF9Yya4UtFW5WF4xXFnFg3sxJFyjvwn8ZFyvqr9Fqw12kFW29FyD Gw47WrWF934UCjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUeFApUUUUUU== X-Originating-IP: [39.144.137.247] X-CM-SenderInfo: p0lqw35rqjs4rx6rljoofrz/xtbBnAov0FghlftTwAABss X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 21 Nov 2023 00:16:53 -0800 (PST) From: Xing Tong Wu Setting the fan speed is only valid in manual mode; it is not possible to set the fan's speed in automatic mode. Return error when attempting to set the fan speed in automatic mode. Signed-off-by: Xing Tong Wu --- drivers/hwmon/nct6775-core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c index 88300fb99bb9..83f1da5acd22 100644 --- a/drivers/hwmon/nct6775-core.c +++ b/drivers/hwmon/nct6775-core.c @@ -2553,6 +2553,13 @@ store_pwm(struct device *dev, struct device_attribute *attr, const char *buf, int err; u16 reg; + /* + * The fan control mode should be set to manual if the user wants to adjust + * the fan speed. Otherwise, it will fail to set. + */ + if (index == 0 && data->pwm_enable[nr] > manual) + return -EBUSY; + err = kstrtoul(buf, 10, &val); if (err < 0) return err; -- 2.25.1