Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp72205pxj; Thu, 20 May 2021 04:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIp11Qed2I7sv7Q55HJOfZ5uqRwg8gSa1m+eORxAHOrv+BTDGtkOSZKFH5OPOefCeVVHVS X-Received: by 2002:a17:906:6c8a:: with SMTP id s10mr4263886ejr.276.1621511517173; Thu, 20 May 2021 04:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621511517; cv=none; d=google.com; s=arc-20160816; b=ogOixRBuYA9HLpPXG8wisRvlQFmueX4BcapV5cNiH7GRn0SbOYd/c2RMY41nKCqe+E LbZNBPIMs7uI8wFthG2+KvV/OVm87ZIbwWGcWhMNmqf8WoHW1BGZTcObREfUY0okuF4l ECT5jGcVA/Qd3Lvixk/JK0+a9Nh5bMicKlkEaHQX3uQAD67tAmXqLkZwQ4hP8MorqqBl MDhi25mdJ6zFZAlv0DOQ3WcJ6UNRg8f09bxpZKFN6DHsS8G0YapezjxDH7kIlynm4iDl GahbUXPXX99JpvSDHYAZrnBgo/tdfs6dTMZ9bXLUyWFrUMLsyZPlF74ln9x3Se2Cm+Fk JLrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:user-agent :organization:references:in-reply-to:message-id:mime-version:date :subject:cc:to:from:dkim-signature; bh=hlH5MiV+pHvEjTzZVRlEtFB7ucGjCHd76P6F/bq75QQ=; b=VZBIag1PIq4aksuarlvZSiGY5V2z4h1wZGmHzuh1lgRQd39rFtCQKXttAy0c96BFWg fANezVOOZlc62GoHA3/iBrTcyQxl5RJjmt7XMLUjZibsyPfDBLgXgUSHI+RYN11++O8T O9K0X2npYcWKIOYr/UelfaLsA1EPjsvOZKPLlo4ipGyycUnwLEifGfYqIkQZi1jd0Ac8 dPGoM/+YZ00M8DhFhNthVL+zdZ5Hh/mWpj5jpYFJM8Q01OUeDUEMQ/bcIUwyrGpDKVXL hczIct7nUSUGaAWULbCX0FN6cb9M3DnOc4w4/jofE9DywL0WSZqLtTQNR0rDQqWnr1eD feaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cesnet.cz header.s=office2-2020 header.b=Y499jaLr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cesnet.cz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h20si2563144ejl.393.2021.05.20.04.51.32; Thu, 20 May 2021 04:51:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cesnet.cz header.s=office2-2020 header.b=Y499jaLr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cesnet.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243600AbhETLuU (ORCPT + 99 others); Thu, 20 May 2021 07:50:20 -0400 Received: from office2.cesnet.cz ([195.113.144.244]:40924 "EHLO office2.cesnet.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241101AbhETLbF (ORCPT ); Thu, 20 May 2021 07:31:05 -0400 X-Greylist: delayed 94763 seconds by postgrey-1.27 at vger.kernel.org; Thu, 20 May 2021 07:31:00 EDT Received: from localhost (ip-78-45-210-72.net.upcbroadband.cz [78.45.210.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 6BE9D40006B; Thu, 20 May 2021 13:29:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2-2020; t=1621510164; bh=hlH5MiV+pHvEjTzZVRlEtFB7ucGjCHd76P6F/bq75QQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y499jaLrNQDvGYFs6T1IcIQh63oVg1U0GvxX99UTXLVXpA11kxXA0hp6+oqn4+zi1 jl4blfDxEiANWLJwJr7nuzIpmsestbwKmXCSPgfwEIyDt7cvb2gDniOQkhTuBI2av3 6evzJb1+GJTmSneRbst0CNovvWl0LT+w0nFm6OQul6381rNvJuRWODCiM2RmNJlaUA IQlCtDSPsCNxywRrrjbBpWWnKg+bXdVSsP9LBeEvJTNaafkZGvNSXKNS1I2atSUs+x fkPyOw0wWSizodMaTJ/y4bmGNZV8fTNOR7nA7EXaDDyJQ+VadzelaBzue6GlDhHmxn vYIxWZBZdpepw== From: =?iso-8859-1?Q?Jan_Kundr=E1t?= To: Guenter Roeck , =?iso-8859-1?Q?V=E1clav_Kubern=E1t?= Cc: Jean Delvare , Jonathan Corbet , , , Subject: Re: [PATCH v5 2/5] hwmon: (max31790) Fix and split =?iso-8859-1?Q?pwm*=5Fenable?= Date: Thu, 20 May 2021 13:29:24 +0200 MIME-Version: 1.0 Message-ID: <9bbdc7a7-f34d-4e3a-8e64-c20810456d11@cesnet.cz> In-Reply-To: <76619e11-3999-1e89-de93-fb5942970844@roeck-us.net> References: <20210518211609.GA3532746@roeck-us.net> <6f256c72-df4d-4f9a-ba5f-eabfd9f2365f@cesnet.cz> <76619e11-3999-1e89-de93-fb5942970844@roeck-us.net> Organization: CESNET User-Agent: Trojita/unstable-2020-07-06; Qt/5.15.2; xcb; Linux; Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > As for fan[7-12]_enable, I don't even know if those can be enabled > separately. I see two options: Drop those attributes entirely ( > assuming that those fan inputs are always enabled if the associated > pins are configured as inputs), or align them with fan[1-6]_enable. I think we need to decide first who provides the initial configuration for=20= this chip. There's always at least six TACH inputs, and then there's six=20 more pins where each can be either a PWM output or a TACH input. Who=20 decides that? Is the kernel supposed to export six knobs to the userspace?=20= So far, I've assumed that this should be driven via sysfs. But perhaps you=20= would you like to rely on the FW (?) to set this up properly? (On our=20 board, that would be a few random calls to `i2cset` from a U-Boot boot=20 script. Not pretty, but doable. Just one more place to keep track of.) It's proabably "tricky" to do this at runtime -- and I don't expect to see=20= many boards where you have such a big freedom of reconnecting the actual=20 fans once manufactured, anyway. So, either some DT parameters, or an=20 autodetection based on whatever is in the registers at power up, which=20 would make an explicit assumption that "something" has set up the nPWM/TACH=20= bits properly in the Fan Configuration Register. OK, that might work, but=20 the kernel must not ever reset that chip afterwards. There's also the Fan Fault Mask register, which controls which fans=20 propagate their failures to the nFAN_FAIL output pin. This one requires a=20 semi-independent control than the nPWM/TACH bit above. It's feasible that=20 not all TACH inputs have an actual fan connected, and this can well vary=20 between products. For example, ours has just four fan connectors, so we=20 don't want "failures" of fans 5 and 6 to assert the nFAN_FAIL pin. Also,=20 there should be a check which prevents unmasking these failures for those=20 TACH channels which are configured as PWM outputs. Or we can once again=20 ignore this one and rely on the FW. The current kernel code in max31790_read_fan() reads beyond the end of=20 data->fan_dynamics, hitting the content of `fault_status` or `tach` fields=20= instead, and therefore returning garbage. Not a big deal, just a missing %=20= operator I guess, but to me, that's a pretty strong suggestion that nobody=20= has used or even tested monitoring more than six fans on this chip, ever.=20 (And yeah, the datasheet is not clear on how it's supposed to work anyway.=20= Using a modulo is just a guess.) Neither Vaclav nor me have any way of testing this feature -- hence my=20 proposal to only improve what we need, and ignore TACH channels 7-12. But I=20= guess it's not OK from your point of view? With kind regards, Jan