From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (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 02AF31A680B for ; Tue, 28 Jul 2026 00:22:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785198175; cv=none; b=EhFPkbJQ9/5yrwaVNyE/rwGd9zy4QM2TpN2dJwlDTaKDDpMgsEwHGJ05+zHRQiMp93oUnBnOTPRIuagzKZoAJ1V0Bxgf6oou7Z+6BBeVqU8rFVkYjBwv8otZiP/da0xRwUNzvNPZHMVe0x+PpTk9KDV9VcAY5TGxgaUNcK+vlhc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785198175; c=relaxed/simple; bh=wFnkSUxoYQs64deDm4md1UugE+lxjqSSKbZd1i66CDo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LnQsy58dsYpaZaZoFovVFtxfs/e3Ac4UcfIBhRULF2pHdjzx/OMGFcFqeLl1/1n90f0+YHHLM97RLx3HX3QeQzUOd3SvqDC0WV3jfYYQVdj9QbOs9QoWmGz1aSDAqBq0qk08x/AmmS2UqygS69yf8zVMsSytcX4jFJgQpDOLPF4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lgNSvdqC; arc=none smtp.client-ip=209.85.128.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lgNSvdqC" Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-7dbcb505578so30281197b3.3 for ; Mon, 27 Jul 2026 17:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785198173; x=1785802973; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=6qMd5YuwwfiN67Wq+l9yFaJ3wbJ9/YjqS4Jgn0/FeAo=; b=lgNSvdqCuApejdw9lu4xZX/r17qWjcHrMhOc663ug7a2jeZ8W5bnOASHIM2rI6U4EG IeCp4tGyVI7etsrVhGIS549uthLzJ0IUvEEBZ4EjpFMt1cv12iEBJ7Tgy6ivuHFLRzuF 82HXcKKLVJFb+zU0PmK2uDTm28G2D0xJ2Z9GSEC2wlHnmRn6Fp8B5wJP0Ld3wgOeuUa4 sToCMfWcjENAj1cRtQkdht7+p8s42oSS5LW/8kSnlWF2DNMaLSB3K0XpCMsQNheoqcKC ogxxLFddSLGnv31fYZ6ADoIAB6e4vWZfUtgxR/8BTPJheq10HlNRzEYt7zeTSOJBlLhT PiLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785198173; x=1785802973; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=6qMd5YuwwfiN67Wq+l9yFaJ3wbJ9/YjqS4Jgn0/FeAo=; b=ew1DKvdET7Ju6R6fgHcycHEGhv+kIOP94A4HEGC5AjMrHIT1T5KpjdLLIrl9pinc2S ZkpJVOQMQnKpyHcPmbpg19AGsUNVB0gkyF+oCQftaDoqBTbWxrOMLofP4Q5K69aTU8EV PmOhOk4FDhIo+MVQPXWx6HTN6ZM810sCOAcY/fFqcypNYDsr2hia3YCX6SOZ8OCEexP1 E+xkXV7Zm7qhxnpIlSP1ZVak1+NNWZOiaPLbB8d9QC8th8L/28eakCmA8gXV1eXuOo6n icCHAEg+4hLIFuV9dH2tO3PLMEwXpDBsWCHqwv8ctS+W4UgXSvZ+EofPxo603cy/RVrL 3/rw== X-Forwarded-Encrypted: i=1; AHgh+Rp8W8A+6iuhLw1uHXCigoI7goaFXGwlPzKVOlMoVwgAYIN0rwRF70wQmexE2yiMPclQ0sCIJqn8qA0kHuE=@vger.kernel.org X-Gm-Message-State: AOJu0YwLUn06ZDQEnlGShnibYj4ldEUVwlim8D4Q7PnN+QAFWlWK35tZ Qdqu+lxJgAFD+TYjkHFjncZZoDq+btiyi/bke5f9WPCdOSNVAt9In0Mo X-Gm-Gg: AR+sD13OkPW2tLEPFMLZYu2k1OTEl/tR//UCEpaayMYfE5J4B6WT0ilXEpKqJb2dWBs LJhrQD2ow79Md9RAWheiiMK2BNTISye1I7jNJGQhrMDNATl/KQ2msK0WYgGNkcT184UDuphNfjK 39SmeMj6QFfhU/AMLxCa4CIuxS/4KLVmRa7Kj2yfergv8fW63dxYT9W08qgWIzwvIG8whgz4jYP CbbmTQDQhR9pAlmvaMSVJfCm3rzgDuzm9p1aLNw++AZtjvxS8XrQyvjKdNd5Hbhu2AaEuZVJ5Cb msCE2pp2yGeswau1EL/iRoVADD97EUF9ZSFnlEoGfkU02i/WxFBf1iy6GCzDHUTIcnBvC+Ih29H ZZt7fe3Ske7SO8pyp21LCctcGo2gKbPmbhaSukjLAGPCuqqBuehcKTsr2AfHIKvnGGPivv//5BL L2KLryCdcmh0OSZL/XnQ== X-Received: by 2002:a05:690c:305:b0:81e:776b:ba51 with SMTP id 00721157ae682-81f9923f195mr492387b3.58.1785198172999; Mon, 27 Jul 2026 17:22:52 -0700 (PDT) Received: from tresc054937.tre-sc.gov.br ([187.65.210.13]) by smtp.gmail.com with ESMTPSA id 00721157ae682-81f655acc7csm39583707b3.0.2026.07.27.17.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 17:22:51 -0700 (PDT) From: Luiz Angelo Daros de Luca Date: Mon, 27 Jul 2026 21:22:20 -0300 Subject: [hwmon PATCH v2 4/8] hwmon: (adt7470) Fix swapped PWM3 and PWM4 auto mode masks 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: 7bit Message-Id: <20260727-adt7470_fixes-v2-4-598e38a46ba6@gmail.com> References: <20260727-adt7470_fixes-v2-0-598e38a46ba6@gmail.com> In-Reply-To: <20260727-adt7470_fixes-v2-0-598e38a46ba6@gmail.com> To: Guenter Roeck , Chris Packham , Andrew Morton , "Darrick J. Wong" , "Mark M. Hoffman" Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Luiz Angelo Daros de Luca X-Mailer: b4 0.15.2 The ADT7470_PWM3_AUTO_MASK and ADT7470_PWM4_AUTO_MASK macros are currently defined with swapped bit values. According to Table 22 of the ADT7470 datasheet, the Fan Control Mode Configuration for register 0x69 follows the exact same bit position layout as register 0x68: - 0x68 Bit[7] corresponds to BHVR1 (PWM1) -> 0x80 - 0x68 Bit[6] corresponds to BHVR2 (PWM2) -> 0x40 - 0x69 Bit[7] corresponds to BHVR3 (PWM3) -> 0x80 - 0x69 Bit[6] corresponds to BHVR4 (PWM4) -> 0x40 Consequently, PWM3 should use mask 0x80 and PWM4 should use 0x40. This typo did not cause any functional bugs because these specific macros are never referenced in the driver code. Instead, the driver correctly applies the configuration by relying on the modulo parity of the channel index (e.g., `channel % 2`) to selectively apply either ADT7470_PWM1_AUTO_MASK (0x80) or ADT7470_PWM2_AUTO_MASK (0x40). Since the bit layout is identical between the two configuration registers, the hardware is currently configured correctly. Fix the macro definitions to reflect the datasheet accurately and prevent future bugs or confusion during code review and refactoring. As this is a purely cosmetic fix with no functional impact, a backport to stable kernels is not necessary. Fixes: 6f9703d0be16 ("hwmon: add support for adt7470") Signed-off-by: Luiz Angelo Daros de Luca --- drivers/hwmon/adt7470.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index 0b19b0925d1c..a34635526aaa 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c @@ -70,8 +70,8 @@ static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END }; #define ADT7470_PWM1_AUTO_MASK 0x80 #define ADT7470_PWM_AUTO_MASK 0xC0 #define ADT7470_REG_PWM34_CFG 0x69 -#define ADT7470_PWM3_AUTO_MASK 0x40 -#define ADT7470_PWM4_AUTO_MASK 0x80 +#define ADT7470_PWM4_AUTO_MASK 0x40 +#define ADT7470_PWM3_AUTO_MASK 0x80 #define ADT7470_REG_PWM_MIN_BASE_ADDR 0x6A #define ADT7470_REG_PWM_MIN_MAX_ADDR 0x6D #define ADT7470_REG_PWM_TEMP_MIN_BASE_ADDR 0x6E -- 2.55.0