Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2265157rdb; Mon, 20 Nov 2023 06:41:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPBXit38pQkUdOylon83Q2T+XXgqRiIzR2s9030vEW5oigmxLkS+GCYDo4nkrHF63JILUQ X-Received: by 2002:a17:903:1251:b0:1c5:d8a3:8789 with SMTP id u17-20020a170903125100b001c5d8a38789mr6729864plh.4.1700491295622; Mon, 20 Nov 2023 06:41:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700491295; cv=none; d=google.com; s=arc-20160816; b=NnHGshNoHb99E6YQR4oenlJIDtZEzA2CVz5i8b7txCiXWdP5TgSJ391/6mIOvIjya+ 2luioF+/Yj1306nF4NPw37GoU+oC88W+BD956l7GFie0nIrtNiNfvF9ix2cvAnB9ddJv XKGWA/mF5q1/dAI141YEehSyArNYM0Nvii2P65nI5XviTxwxoFYlPAJ9A3jB9/IDWB2W BBmCOU+9NXKIF+k51V1FFJkVDTXBtguDF43Uf0oHA/ldZvDjThzOPrjh/+qSbki+pg7x QVm+KWDlichrRJe4xBWuh29nV7otvRVNK3+ZpPVygwTdDT14UIlFgVzMOoWb6lLsDjJy YpUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:content-language:references:cc:to:subject:user-agent :mime-version:date:message-id:sender:dkim-signature; bh=KGHGuTDWNEl2LQwX/5JcgH6sbugZnAEf2kHBj6xk/f8=; fh=KlJEFr7/GBV/aGj8aWVMzxwQu322x8T9aLvT47fFLxQ=; b=rUadzkmo8tKue26YDiEKQ1vs+U8YCIyT6MbFH6G4iS9uMF9N4h5PktdjJ4JifKtmIa 9gICxYVpUQ+kvQX9YgOBHNkR6RKNZGj4CRBC5sjFhAGJHfVxmoXYd+jTHYzycHK2JsIX /EffcooHFWo0mEziM3r7caHeU3AkOLezwgVSDgVHSJu92p2fK5ugqfcecxPKLzX2bdwo yPE86QRdhPZ8m2HEnKpeYHTwZ9Gzq3j1QKQWnuas50lulG9wpWahy4ZQ8iOpwWAB4uwh 2vQ9a7iFA0Ui7sFPdlHRaEHL2X8XhMpDjoRV8XarQ5F9c02cH+9EtKMCW5y98Br778sS nkFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AMaOUkTv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id n15-20020a170903110f00b001c71e907ee6si8492208plh.124.2023.11.20.06.41.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 06:41:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AMaOUkTv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id CC3F680A49B5; Mon, 20 Nov 2023 06:41:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233532AbjKTOlT (ORCPT + 99 others); Mon, 20 Nov 2023 09:41:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233602AbjKTOlR (ORCPT ); Mon, 20 Nov 2023 09:41:17 -0500 Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01819110; Mon, 20 Nov 2023 06:41:12 -0800 (PST) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-5c6705515d8so36098747b3.2; Mon, 20 Nov 2023 06:41:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700491271; x=1701096071; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=KGHGuTDWNEl2LQwX/5JcgH6sbugZnAEf2kHBj6xk/f8=; b=AMaOUkTv8MW1kPC9ID2KvbAq6fNHhChS5YqpnAfAl3Eu1qeTRYjbpOfARplMQSjLM7 lQWwwBBXA0Dl0g6d9m4RTj0V53amHNMiElJBB25bcwLjO1sXshWzqjMLN7Wvi9IUa3dg PKxH8J/hfdJVwl2Qxdpx36nRSU/bqqGKdbY+KooOzPLEOAKw2BngNdKRHwgJF1PreHHB 6jorHFHQxl7ovq8fK5wYwZRdzuogonsGmxkKPKwb/uwfQs78I0JVA9ApPdc250pfkdl6 ZUGrLitLz/VHbHK73ktEPuzaov3lFnG7xRskr21wekUBsWhlhQi7FmX37jnkJ19PVMu9 +lrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700491271; x=1701096071; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KGHGuTDWNEl2LQwX/5JcgH6sbugZnAEf2kHBj6xk/f8=; b=gcJ5ANBrWENHz/JYSyhM3vkFnOgmcP48WMncyI/Du4PMrVAroE2Hg+QqDJyu45M0+j FsqZUz7V7kbfn2efx/CkYv0/3wbcmB13/evkc4BKwxGaqW/GIlSKwz27R4MwBOLkinnI GpfuflPg+wVNcnE+BCYJRmTaQFq2KrvbIp2xjMlm7nfNYc2LzyHm+qG5yo3Zz6DiGEsN qta1yOqe8sbWZsGZAFMWVFuxYMSsF3c+DAMLrcqHFlUsh1sr1izadcvQthfXZ9vx5cE7 IkVu+iqSkthBeB79RoIeGJeQH4zK20hAPWtut60uHKTGvd7sv3h9VEhHOcq+VlGcddZ+ nEFA== X-Gm-Message-State: AOJu0YyEavh7WUoKC2YTWBvcO+uAfzGhXn1oC3AIOOW84I4a2ZPuBvE9 cVP7G00ioojgZMhJ5tUwCro= X-Received: by 2002:a81:4f13:0:b0:5a5:65e:b847 with SMTP id d19-20020a814f13000000b005a5065eb847mr7925386ywb.34.1700491271057; Mon, 20 Nov 2023 06:41:11 -0800 (PST) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id x77-20020a81a050000000b005a7ba08b2acsm2397894ywg.0.2023.11.20.06.41.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Nov 2023 06:41:10 -0800 (PST) Sender: Guenter Roeck Message-ID: <4ed34030-d5c1-4caa-919a-69c7c5aa77ef@roeck-us.net> Date: Mon, 20 Nov 2023 06:41:08 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] hwmon: (nct6775) Fix incomplete register array To: "xingtong.wu" , 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 References: <20231116022330.2696-1-xingtong_wu@163.com> <20231116022330.2696-2-xingtong_wu@163.com> Content-Language: en-US From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+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pmiPTqQcIaG/edgKVTUjITfA7AJMKLQHgp04Vylb+G6jocnQQX JqvvP09whbqrABEBAAHCwWUEGAECAA8CGwwFAlVcpi8FCRmg08MACgkQyx8mb86fmYHNRQ/+ J0OZsBYP4leJvQF8lx9zif+v4ZY/6C9tTcUv/KNAE5leyrD4IKbnV4PnbrVhjq861it/zRQW cFpWQszZyWRwNPWUUz7ejmm9lAwPbr8xWT4qMSA43VKQ7ZCeTQJ4TC8kjqtcbw41SjkjrcTG wF52zFO4bOWyovVAPncvV9eGA/vtnd3xEZXQiSt91kBSqK28yjxAqK/c3G6i7IX2rg6pzgqh hiH3/1qM2M/LSuqAv0Rwrt/k+pZXE+B4Ud42hwmMr0TfhNxG+X7YKvjKC+SjPjqp0CaztQ0H nsDLSLElVROxCd9m8CAUuHplgmR3seYCOrT4jriMFBtKNPtj2EE4DNV4s7k0Zy+6iRQ8G8ng QjsSqYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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 groat.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 (groat.vger.email [0.0.0.0]); Mon, 20 Nov 2023 06:41:33 -0800 (PST) On 11/19/23 19:30, xingtong.wu wrote: > On 2023/11/17 09:35, Guenter Roeck wrote: >> On 11/15/23 18:23, Xing Tong Wu wrote: >>> From: Xing Tong Wu >>> >>> The nct6116 specification actually includes 5 PWMs, but only 3 >>> PWMs are present in the array. To address this, the missing 2 >>> PWMs have been added to the array. >>> >>> Signed-off-by: Xing Tong Wu >>> --- >>>   drivers/hwmon/nct6775-core.c | 4 ++-- >>>   1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c >>> index d928eb8ae5a3..2111f0cd9787 100644 >>> --- a/drivers/hwmon/nct6775-core.c >>> +++ b/drivers/hwmon/nct6775-core.c >>> @@ -769,7 +769,7 @@ static const u16 NCT6106_FAN_PULSE_SHIFT[] = { 0, 2, 4 }; >>>     static const u8 NCT6106_REG_PWM_MODE[] = { 0xf3, 0xf3, 0xf3 }; >>>   static const u8 NCT6106_PWM_MODE_MASK[] = { 0x01, 0x02, 0x04 }; >>> -static const u16 NCT6106_REG_PWM_READ[] = { 0x4a, 0x4b, 0x4c }; >>> +static const u16 NCT6106_REG_PWM_READ[] = { 0x4a, 0x4b, 0x4c, 0xd8, 0xd9 }; >> >> I have no idea where you got the above register addresses from. Looking at >> the datasheet, NCT6116 doesn't use those registers at all, and neither does >> NCT6106. The PWM registers for NCT6116 are >> > > I obtain these registers from the Nuvoton official specification > "NCT6116D_Datasheet_V1_0.pdf". There is a table that describes the access for the > PWM registers and corresponding fans: > > Fans: SYSFANOUT, CPUFANOUT, AUXFANOUT0, AUXFANOUT1, AUXFANOUT2 > PWM output duty (write): Bank1 Index19 bit[7:0], Bank1 Index29 bit[7:0], Bank1 Index39 bit[7:0], Bank1 Index99 bit[7:0], Bank1 IndexA9 bit[7:0] > Current output value (read): Bank0 Index4A, Bank0 Index4B, Bank0 Index4C, Bank0 IndexD8, Bank0 IndexD9 > > I have checked the NCT6106-NCT6126 series specification(These documents are not > publicly available, so I cannot share them with you), there are only 3 fans in > NCT6106: SYSFANOUT, CPUFANOUT, AUXFANOU0. However, for NCT6116D-NCT6126D, there > are 2 additional fans: AUXFANOUT1, AUXFANOUT2. The registers for these fans are > the same. I'll add a new array for NCT6116D's PWM read in my new patch. > I wasn't aware of NCT6126D, but I do have datasheets for NCT6102/4/6 and for NCT6112/4/6. There is no need to add a separate array. This is good as-is since the added registers are not used for NCT6102/4/6. >> static const u16 NCT6116_REG_PWM[] = { 0x119, 0x129, 0x139, 0x199, 0x1a9 }; > > Therefore, this array is only for writing, we need to add an array of registers for reading. > Ah, good point. I forgot that the read and write registers are different. Still, you'll need to extend NCT6106_REG_PWM_MODE[] and NCT6106_PWM_MODE_MASK[] as well. As far as I can see, aux1 and aux2 are always in pwm mode, so the register arrays need to be extended with ", 0, 0". Thanks, Guenter