Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp79836rdb; Tue, 31 Oct 2023 00:54:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE9LV/x4d1Fa6o7x9B2+EUl1d9JP/ZJAXMTV/+JdjQvWDP5tlsxrmed/drrFgLE6qb/IV0n X-Received: by 2002:a17:902:e743:b0:1cc:4336:8c7b with SMTP id p3-20020a170902e74300b001cc43368c7bmr7612101plf.39.1698738895781; Tue, 31 Oct 2023 00:54:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698738895; cv=none; d=google.com; s=arc-20160816; b=Gla1rv+S6ibGTBA/sP/BdVHKzk4NSwIple6Nqknf4MoJYOCrXYS1oW0ZZ3ehzJXbEg uPkRxMqmynZSAURSC4lv0XudTTgZqu0D86JduyEjz7C6vqVExdsxRvs8T/YWzbfjfwLz +7nRJ3R+OPc1HlMMIzBiibvOMXSI03NWYXtTDtZEP8118dhttYbmlm+a697lkKP0WtyL nP1el6MFibgHNDcVQWlvQkxehMScbBXRxsWswR6F24sapMSxRUe8NcHEmFXUSRBgjQZH D+bzmlaM5r2yBaoOnmFdXQbovQL+dkIG0rp3shdWI3TxffqiTa4r+E8eu2OiHg0io0OJ P+kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BxgfRq08akdKpYPvawQ/qmWvcE1o35b6GhP90H8S4Mw=; fh=qU3HfgIPqMhtyTa+fA0WUA6OCqMoLPj5Qb+Hf//mFgA=; b=pS09BMfnx71tW1FgbJOfm2TG2atMwquph/b9JzTSQusAQi9bqtfirgw1iFF2dp/OmZ m/GseHDOPWkERn/oOerCHJbmwJu19SMUcIXgv+Yr7xhZ1vYbpvQxwpQT/OZBIBabgeWT cxTDrTRFKFyAwSZ3KLEa+Dz6o2PkJQFa4HqQDaWrGWOVsR0itiV9Ltw5Xf1EphuxwG7b PFLvqSeA54KP45aUIPVvAjzEpUYYpm1QJhM3mvJJ+n16VuH5bByP94um0VGV4LupweD4 0fOm3FhyX+xiaC6r5r1a9pljmN47pW+wU9C++ctf4vAz/j0nzbEwz9PtH25WXKRykiPq KQ1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eZSxllZ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id s12-20020a170903200c00b001cc4efcc852si621579pla.427.2023.10.31.00.54.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 00:54:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eZSxllZ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 113B180BB3CF; Tue, 31 Oct 2023 00:54:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343825AbjJaHy1 (ORCPT + 99 others); Tue, 31 Oct 2023 03:54:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343816AbjJaHyZ (ORCPT ); Tue, 31 Oct 2023 03:54:25 -0400 Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7209ADF; Tue, 31 Oct 2023 00:54:15 -0700 (PDT) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-5a82c2eb50cso45584227b3.2; Tue, 31 Oct 2023 00:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698738854; x=1699343654; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BxgfRq08akdKpYPvawQ/qmWvcE1o35b6GhP90H8S4Mw=; b=eZSxllZ0b7Eit4t59bPFoYnEC3CrOLynCaHi8tW93TTyfNrH4ZfBz0ezgc2Wmt751v 45jeZ4kqhS1XdbhlbIuZUBVN0fSMPRKR4LR3ZnxzUBOLccqAY5XxynnV2YbYkbMac/jT rD1M65b6ZbcOFsyVxiCDpDvag2K914ckC86aspDdkOCPALUl0QDJOBRV7EzaVyF65idd 4Xn0F/MWt/bCelRXYHxjJmqEvPpABykMeWxzibI3iNqO+tn7xPdgMnCQUmnyBfhpVy3u Q7tYLGMgCUUSVlS6K3yRaJaYq/jA1oaYpsDkfcaJfrEyyMc8YD6VmFuP64sitYlwHDOy 4h8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698738854; x=1699343654; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BxgfRq08akdKpYPvawQ/qmWvcE1o35b6GhP90H8S4Mw=; b=VRpwxnEsy4INdzi1YXz2Arrq0XmnWxQrJ87l9j/28B0av+fIEJSxFPkZFsxS0qbHFk 8nszRxORbLJKS+HBJFFycWaubIKCE2MQHyhhl4zncqR6VpE1wAcfbPnOUhcbFKGjKvfR Zm8bRO8jfnmo276xOh5bI01ifGdbhAUT8tyIm6R0w71YzkVEtfTBbyPII6/EZ6Sd3F0G lfX+8CeShOtWSWvr2dH4IcLgq5e60pJkCNnwkE499ZDTTxUoIRYN8dZjgq+RC6s5bzk2 boj3wFv+bsx6ct35JjvvV+eoMM1MITealcam7iFwDxvbjoezI+GfPY00X9pLQdpCBX00 K2LA== X-Gm-Message-State: AOJu0YxGt7uTyez5Fk13q5tDjBAAXW6guoNhdmxwtj4phTDNHNV7C5tN cwEgc+0IuCP0DQpioU+H/zYF58eQOE4KNGyPM6w= X-Received: by 2002:a81:ad62:0:b0:5a7:c01d:268 with SMTP id l34-20020a81ad62000000b005a7c01d0268mr10163703ywk.18.1698738854542; Tue, 31 Oct 2023 00:54:14 -0700 (PDT) MIME-Version: 1.0 References: <20231030150119.342791-1-tmaimon77@gmail.com> <20231030150119.342791-2-tmaimon77@gmail.com> In-Reply-To: From: Tomer Maimon Date: Tue, 31 Oct 2023 09:54:03 +0200 Message-ID: Subject: Re: [PATCH v3 1/1] hwmon: npcm750-pwm-fan: Add NPCM8xx support To: Guenter Roeck Cc: jdelvare@suse.com, avifishman70@gmail.com, tali.perry1@gmail.com, joel@jms.id.au, andrew@codeconstruct.com.au, venture@google.com, yuenn@google.com, benjaminfair@google.com, j.neuschaefer@gmx.net, openbmc@lists.ozlabs.org, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 31 Oct 2023 00:54:52 -0700 (PDT) Hi Guenter, Thanks for your comments On Mon, 30 Oct 2023 at 17:57, Guenter Roeck wrote: > > On 10/30/23 08:01, Tomer Maimon wrote: > > Adding Pulse Width Modulation (PWM) and fan tacho NPCM8xx support to > > NPCM PWM and fan tacho driver. > > NPCM8xx uses a different number of PWM devices. > > > > As part of adding NPCM8XX support: > > - Add NPCM8xx specific compatible string. > > - Add data to handle architecture-specific PWM and fan tacho parameters. > > > > Signed-off-by: Tomer Maimon > > --- > > drivers/hwmon/npcm750-pwm-fan.c | 34 +++++++++++++++++++++++++++++---- > > 1 file changed, 30 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c > > index 10ed3f4335d4..765b08fa0396 100644 > > --- a/drivers/hwmon/npcm750-pwm-fan.c > > +++ b/drivers/hwmon/npcm750-pwm-fan.c > > @@ -46,9 +46,9 @@ > > #define NPCM7XX_PWM_CTRL_CH3_EN_BIT BIT(16) > > > > /* Define the maximum PWM channel number */ > > -#define NPCM7XX_PWM_MAX_CHN_NUM 8 > > +#define NPCM7XX_PWM_MAX_CHN_NUM 12 > > #define NPCM7XX_PWM_MAX_CHN_NUM_IN_A_MODULE 4 > > -#define NPCM7XX_PWM_MAX_MODULES 2 > > +#define NPCM7XX_PWM_MAX_MODULES 3 > > > > /* Define the Counter Register, value = 100 for match 100% */ > > #define NPCM7XX_PWM_COUNTER_DEFAULT_NUM 255 > > @@ -171,6 +171,10 @@ > > #define FAN_PREPARE_TO_GET_FIRST_CAPTURE 0x01 > > #define FAN_ENOUGH_SAMPLE 0x02 > > > > +struct npcm_hwmon_info { > > + u32 pwm_max_channel; > > +}; > > + > > struct npcm7xx_fan_dev { > > u8 fan_st_flg; > > u8 fan_pls_per_rev; > > @@ -204,6 +208,7 @@ struct npcm7xx_pwm_fan_data { > > struct timer_list fan_timer; > > struct npcm7xx_fan_dev fan_dev[NPCM7XX_FAN_MAX_CHN_NUM]; > > struct npcm7xx_cooling_device *cdev[NPCM7XX_PWM_MAX_CHN_NUM]; > > + const struct npcm_hwmon_info *info; > > u8 fan_select; > > }; > > > > @@ -619,9 +624,13 @@ static umode_t npcm7xx_is_visible(const void *data, > > enum hwmon_sensor_types type, > > u32 attr, int channel) > > { > > + const struct npcm7xx_pwm_fan_data *hwmon_data = data; > > + > > switch (type) { > > case hwmon_pwm: > > - return npcm7xx_pwm_is_visible(data, attr, channel); > > + if (channel < hwmon_data->info->pwm_max_channel) > > + return npcm7xx_pwm_is_visible(data, attr, channel); > > I would have expected this check to be handled in npcm7xx_pwm_is_visible(). I will change the handle in npcm7xx_pwm_is_visible > > Guenter > Thanks, Tomer