From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0208C433B4 for ; Mon, 26 Apr 2021 12:46:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6901961007 for ; Mon, 26 Apr 2021 12:46:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232795AbhDZMrY (ORCPT ); Mon, 26 Apr 2021 08:47:24 -0400 Received: from office2.cesnet.cz ([195.113.144.244]:46088 "EHLO office2.cesnet.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231862AbhDZMrY (ORCPT ); Mon, 26 Apr 2021 08:47:24 -0400 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by office2.cesnet.cz (Postfix) with ESMTPSA id 422A6400052; Mon, 26 Apr 2021 14:46:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2-2020; t=1619441201; bh=vAAsbBiBH7LAbBh1t9loyx/hGv7nApOFY9XOY22lVNg=; h=References:In-Reply-To:From:Date:Subject:To:Cc; b=aKdaeQQmkMCROGpYjyLcjsOEBCprIG7wrCPrVQ5HqomHNBDoHwBPWJZCn6ZQXtabE pHsrmmkEicC00vRdQ2n3ELyIGG9hj3XNmHsb7seMPBpbRMk4Q/NN8hgtatP+uzMtfK jKMjKJ919ECBYJPOiu48KDaZ4LCsMsjXQiu+x94SSnZ1PVS+ar2BPU15ptVfEmUBDC q2DcT+/k3M0EI/fafovQ6F/XzFtvszfYxR+2EPp2j4Iw5QRegzB54985sppPZPT2IE FyuAXeCp25b03P1aV5z1IA+qSVfbEtfTAD+m4HcUohDQuNUMi554u1DRSJRJ2rKU0J d0IHLxGEQaWcg== Received: by mail-pj1-f45.google.com with SMTP id md17so1524734pjb.0; Mon, 26 Apr 2021 05:46:41 -0700 (PDT) X-Gm-Message-State: AOAM531het5S/UIIBVooOVqB7eNTSrGHke5axXrG277hgfLVdqCbv7TP WyJQLDVPDN97oJRw87FOZITEh30kCHgwcLCxngQ= X-Google-Smtp-Source: ABdhPJw45wCj7QeQGS20UcVMLO74ChUMRhb/yYlOPI3Wl6DXngaPVEiVwR8/pT7CtHuZCHWgY8+dy+ZmltO0gzr0AcY= X-Received: by 2002:a17:902:b408:b029:ec:e879:bbd8 with SMTP id x8-20020a170902b408b02900ece879bbd8mr12993884plr.65.1619441199370; Mon, 26 Apr 2021 05:46:39 -0700 (PDT) MIME-Version: 1.0 References: <20210413025948.901867-1-kubernat@cesnet.cz> <250c1c16-541a-984f-c720-1a8b6176e97e@roeck-us.net> In-Reply-To: <250c1c16-541a-984f-c720-1a8b6176e97e@roeck-us.net> From: =?UTF-8?B?VsOhY2xhdiBLdWJlcm7DoXQ=?= Date: Mon, 26 Apr 2021 14:46:27 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/5] hwmon: (max31790) Rework to use regmap To: Guenter Roeck Cc: Jean Delvare , Jonathan Corbet , linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Hello. I'm sending a new version of my patch on max31790. This new version fixes the cache issue and actually makes it work by setting .cache_type. You were right about the "yes/no" ranges, so I flipped those. By the way, it seems that the reason your reply got lost is because of weird addresses in the "Cc:" email field, they end with "cesnet.cz", so it could be that I'm sending email incorrectly. Let me know if I'm doing something wrong. Thanks, V=C3=A1clav =C4=8Dt 22. 4. 2021 v 3:31 odes=C3=ADlatel Guenter Roeck napsal: > > On 4/12/21 7:59 PM, V=C3=A1clav Kubern=C3=A1t wrote: > > Converting the driver to use regmap makes it more generic. It also make= s > > it a lot easier to debug through debugfs. > > > > Signed-off-by: V=C3=A1clav Kubern=C3=A1t > > --- > > drivers/hwmon/Kconfig | 1 + > > drivers/hwmon/max31790.c | 254 ++++++++++++++++++++------------------- > > 2 files changed, 133 insertions(+), 122 deletions(-) > > > > diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig > > index 1ecf697d8d99..9f11d036c316 100644 > > --- a/drivers/hwmon/Kconfig > > +++ b/drivers/hwmon/Kconfig > > @@ -1095,6 +1095,7 @@ config SENSORS_MAX6697 > > config SENSORS_MAX31790 > > tristate "Maxim MAX31790 sensor chip" > > depends on I2C > > + select REGMAP_I2C > > help > > If you say yes here you get support for 6-Channel PWM-Output > > Fan RPM Controller. > > diff --git a/drivers/hwmon/max31790.c b/drivers/hwmon/max31790.c > > index 2c6b333a28e9..e3765ce4444a 100644 > > --- a/drivers/hwmon/max31790.c > > +++ b/drivers/hwmon/max31790.c > > @@ -12,6 +12,7 @@ > > #include > > #include > > #include > > +#include > > #include > > > > /* MAX31790 registers */ > > @@ -46,92 +47,53 @@ > > > > #define NR_CHANNEL 6 > > > > +#define MAX31790_REG_USER_BYTE_67 0x67 > > + > > +#define BULK_TO_U16(msb, lsb) (((msb) << 8) + (lsb)) > > +#define U16_MSB(num) (((num) & 0xFF00) >> 8) > > +#define U16_LSB(num) ((num) & 0x00FF) > > + > > +static const struct regmap_range max31790_ro_range =3D { > > + .range_min =3D MAX31790_REG_TACH_COUNT(0), > > + .range_max =3D MAX31790_REG_PWMOUT(0) - 1, > > +}; > > + > > +static const struct regmap_access_table max31790_wr_table =3D { > > + .no_ranges =3D &max31790_ro_range, > > + .n_no_ranges =3D 1, > > +}; > > + > > +static const struct regmap_range max31790_volatile_ranges[] =3D { > > + regmap_reg_range(MAX31790_REG_TACH_COUNT(0), MAX31790_REG_TACH_CO= UNT(12)), > > + regmap_reg_range(MAX31790_REG_FAN_FAULT_STATUS2, MAX31790_REG_FAN= _FAULT_STATUS1), > > +}; > > + > > +static const struct regmap_access_table max31790_volatile_table =3D { > > + .no_ranges =3D max31790_volatile_ranges, > > + .n_no_ranges =3D 2, > > + .n_yes_ranges =3D 0 > > +}; > > Looks like my reply to this got lost. Other regmap code suggests that > volatile register ranges are identified with yes_ranges, not with no_rang= es. > "no" seems to mean "not volatile". Please verify and confirm if the > above code does what you want it to do. > > Thanks, > Guenter