Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2833102rdh; Mon, 30 Oct 2023 08:57:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkDuCyDBUDGBOux78Ii/JOCptF5EaLwglHeVnuyBFKm0XlBSGv36MG8DDEW+CZTD8bJNFO X-Received: by 2002:a17:902:a389:b0:1c9:c46c:71fc with SMTP id x9-20020a170902a38900b001c9c46c71fcmr6584830pla.59.1698681442798; Mon, 30 Oct 2023 08:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698681442; cv=none; d=google.com; s=arc-20160816; b=jxBAsT5s8wK9/Z8Hmplxe9lEmCtr+MW/Pp7wxBhUPXCnYNToD7KTMGYDrNwXbudk5E hxAun0a1DRAgvX8gbx0xJ6f8ttFnjluNAD4BeEtd0M2ooAQys6aSLm/qy1TuNWPrQIu6 MtAKNJyA3GpMHK5hiOIG5Y6wTa41cDFHwyIoIVRWaOqpnIk9ibpXkpqCJhWV0Ijw8EYg dhOVx8a+xWBBBOxRt0dFcw6RUshKS2FoxbbKwym8wheq2MtGDBBNb+jmI6vWIzW7SSDN RS1EKaHO8wxgH/HiYaxYeA/dtcq6iPJ4JKuXB1MJQCMoEpUxZbpZGh6TKXcvDeALCpce +f2Q== 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:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:sender:dkim-signature; bh=KqEcy/FTVRmCJO3mUkkOypdWB4g67w6pVbljP7u/u5I=; fh=X7NP/h0EmAk/7gLFWOUMaEBCMUeKzFdZZ3g/JLmGO7Y=; b=hmnyfVFgSExkC8Xi7S7dnJ0+ba6KETcMXXZH5z2bz4nFDe/Cg77ZlLKoFIGHYa5Gxo 9NcXSh2agzwv+cd0UajHpMa0RrXUHhEx5zbZpl93y1KpVQgFkd1HLh9I3nAIRJ1IPbyG D6B4ZP44ACInG8pr5ERH31Esp2JAXFWlYafNnKuZnDFDpZIqHtX7z0evQ/Lwj/4W8Nm9 jkq861q6zh5bze8m6lyxtf+Hrir9etok9uKTmkVImvQixDF4kQNkWKc1VYNSHaEBQPX4 hG8O3LIMXz9O7pblyWyki2WGKAqJ9OjjHNE5z6kG2mAbFWcRHlceddOcLKXZ7vC1BPJ8 UiCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=h8trYql0; 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 Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id x13-20020a170902ec8d00b001b8904eadb8si2691169plg.460.2023.10.30.08.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 08:57:22 -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=h8trYql0; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3ADFD8047501; Mon, 30 Oct 2023 08:57:20 -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 S233630AbjJ3P5L (ORCPT + 99 others); Mon, 30 Oct 2023 11:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbjJ3P5K (ORCPT ); Mon, 30 Oct 2023 11:57:10 -0400 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 4CAA0D9; Mon, 30 Oct 2023 08:57:08 -0700 (PDT) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-5a7d9d357faso43532207b3.0; Mon, 30 Oct 2023 08:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698681427; x=1699286227; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=KqEcy/FTVRmCJO3mUkkOypdWB4g67w6pVbljP7u/u5I=; b=h8trYql0ZxP6HdfYh7yhVwyHwLZ3prtBQYJD7w/7qiDC8RQ7uFn+gcRdvvFxKBy1BQ ZrdgiWLgvhr3vPKahrbUgrdenMoIqArVk/VJJjOeNS+xE/JZ7fObCCjeRYu1Rfvo+jYF ByPGL44eGWPTswlTTGK3pSE587PIipHrMrsTPXxCHo8lVO4Bb2OTxETEsB74tIHP0oHj HHU1RCdUMSuhPQoFnF98V5ZCmwjdIuL/WcNslkfRzQmUu70KsIeAEmqr/DENVL5pqkPb p55wedwO7Efd6H9YL9joFucAz6DvmOjbWy0awPQRWGU6NCPwdEeB70Cwzzy67lpi0Xmd Fx5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698681427; x=1699286227; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KqEcy/FTVRmCJO3mUkkOypdWB4g67w6pVbljP7u/u5I=; b=waeHTeNHlmORMGumUT7ice9VR7dDRy0NmBbNhb08DSVjHTCsv6qYpBpFolnhi7VDeM vNjRMhYpKsY6+Lr/CncI9lNl67OAXOFvqZobttoGQg2eLofAToNbCevrBWG46Ca7WXSU OEDTRC1jEbZFbshzBaRBBJXWx0bYACp8cW8AjZz0GEm9W4B9Jks2ELy9V7xde1DtaqZb Rw++if6Bztz/qZlssTgpdfrh1whf+EbAmKJtFKTxB9+Kr+X/qLRymI1KF+mthlroulJc e8YvKQONd42ACPezWNXrf483LuLFB+WAwwpxn0rJYkU2g3c8P6HjCW/tH9NxmAuWKOZq 4/Hw== X-Gm-Message-State: AOJu0Yz1Vh8Lk/+2dnISxD9jI/LGsJoYjai/mBj0QqNHLuRJC+bjstzr 7xM2B2c3AR6dT7gW4jHFxkcIKuMhHgA= X-Received: by 2002:a81:5756:0:b0:5a7:a817:be43 with SMTP id l83-20020a815756000000b005a7a817be43mr10483325ywb.6.1698681427282; Mon, 30 Oct 2023 08:57:07 -0700 (PDT) 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 c190-20020a814ec7000000b005a7bbd713ddsm4423113ywb.108.2023.10.30.08.57.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Oct 2023 08:57:06 -0700 (PDT) Sender: Guenter Roeck Message-ID: Date: Mon, 30 Oct 2023 08:57:04 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/1] hwmon: npcm750-pwm-fan: Add NPCM8xx support Content-Language: en-US To: Tomer Maimon , 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 Cc: openbmc@lists.ozlabs.org, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231030150119.342791-1-tmaimon77@gmail.com> <20231030150119.342791-2-tmaimon77@gmail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/ZsFbnvBtiw7GchKKri2gDhRb2QNNDyBnQn5mRFw7CyuFclAksOdV/sdpQnYlYcRQWOUGY HhQ5eqTRZjm9z+qQe/T0HQpmiPTqQcIaG/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: <20231030150119.342791-2-tmaimon77@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 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]); Mon, 30 Oct 2023 08:57:20 -0700 (PDT) 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(). Guenter