Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2595222rwa; Mon, 22 Aug 2022 10:08:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR5flnlgl55gWFh8vty5E7vWZAtJw2J8q07oARi/2uihZukGnhlT+N7U7BamDFsdEW/CB6Qd X-Received: by 2002:a17:907:2721:b0:73d:81e2:2cee with SMTP id d1-20020a170907272100b0073d81e22ceemr3739667ejl.584.1661188111122; Mon, 22 Aug 2022 10:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661188111; cv=none; d=google.com; s=arc-20160816; b=fhw14uNd8noFoSP+KjX2jZon20fDZLbfdZ7QiJe0xxazK/HcFD17CcmxxnQ8pPh5QP uI7VllzcUwCFk8JLsls43gIQtlp0JFInIQ2O9AXD4mQUMe3xqTqWP2wIKKhAfo8pxWv9 jkgzSAdkdsx0Umq+3ul16pZHZnR2NupW1ijkNoCmz+HK3xgpopI9rVOQl8CTYH4P4Doe Odx/755ANIUJ/7l8UINJCjWsY5qENvp9yNW5zvj0176ah8gteGpbnSAaM+2YZdZLfdgh 2SFBD4v4Iy1bDDjJ0cI1n5rL/M8PSx8pvYJ9+BQvpV3eg2s6onzx1ppl3sjHwTVAYoy6 dGDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=YZmav0eU9Re8BRlMJU0qUlh7LdCj5JWcUumcigXHBac=; b=WqYXSnmRkGbSY6BMpEWjfPOvJsiO55UuruT+kKiw6i+D1enmDHNXyft8GNaOg4ULd9 bP1QYm2kXJCjkvhrSnMuf9DMtoqbWdT2BjrbcIDP0gMcSHOIhtk9QAirJDX7JSOnJN2O BDzxtIE/QnfDyV1yEkyQ/0WKjVXdZ2KptjF3uP3I3TFWicLAaZfjunpmLU8TZrwVT8u/ NdUOnVgmWhJsPW474tf5yJ+TwUMJngMo+cswYK3f0g7mV/8H7HxfOEFkOxFoIpS5FjPy 1a6WHX6lZMNKnzQu5ptQl/A/bzffnB4j6Q07MwGY5Aru6HSRFuIAP3gKqNEp7tBB6Qah iZqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eCDPhFB5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt9-20020a170907728900b0072b3b4f016bsi3783549ejc.628.2022.08.22.10.08.04; Mon, 22 Aug 2022 10:08:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eCDPhFB5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237007AbiHVQ2M (ORCPT + 99 others); Mon, 22 Aug 2022 12:28:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbiHVQ2J (ORCPT ); Mon, 22 Aug 2022 12:28:09 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71BFB40E35; Mon, 22 Aug 2022 09:28:08 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id f21so11510505pjt.2; Mon, 22 Aug 2022 09:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc; bh=YZmav0eU9Re8BRlMJU0qUlh7LdCj5JWcUumcigXHBac=; b=eCDPhFB5hJl5EvTuxV5MVr5fM/PfS5HR20uStCf9L/RoP17bBuyr3VXqZ6N2fhTn1n GIOLVWCSKjih3mnz0lIkMgI70fIpdlwq2iG7mqSPXz2TAbXbl8HLz/rMpOVYtWLBTP4N DyiDazVAxuWWnoY02lSNoem2I9Xhi6NYB24nCzvntSs/yB1wCbSa3qbu76ENlJJxUtTr BkpfebRdOhkLgPgtt+jsQ+Mo0+a8WU6SwRAwXWTk0ibV3/ISyQTu8x/X234QiEIqytRY w83mPFAa2FfX+m7MQ8ktIWWv/eQXAGL9XhLp1tMCv1eQThcZvdJxZc+JLo5nRB6ilz7M juKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc; bh=YZmav0eU9Re8BRlMJU0qUlh7LdCj5JWcUumcigXHBac=; b=7ZMX14RGQPYZRlYioIdSZVZj+5f7WrthkXAK86QKtQg0brXJlDshIVkVesTcr1ryf+ QWpsdvcapQ8aVCUAm6VkUCfses2v3Bilaqx6Dtf0FsKzUPFlj7fT1IkUZ3GiR6U4v500 A+qrmm/nPTKEBAIOoA4zST+LPjRz46CiLMboO3QuB6gc3Bxi1xhCQucvYflhez4fPn/t OkPfFh5ooIDZ9T2iNogjkcpMZjkz2cBAftQJLxJV8+xmRPXCHXouiZnkXz0Vwkw3ZmCo 7004cbltLAtoHmNgGOcFYRQV6pnEGOS4O2eDaWO4sig8U1ysLN7XMhtP0d31dltsV9BS KQnQ== X-Gm-Message-State: ACgBeo156Ugj1oBwSTHK3Km0qqYaPwNHHaB3f2wqapqgchFCzyS8pLo2 +GC1yznkCcite/hvWx1CmzE= X-Received: by 2002:a17:902:ce04:b0:172:9ff7:6747 with SMTP id k4-20020a170902ce0400b001729ff76747mr19929368plg.166.1661185687900; Mon, 22 Aug 2022 09:28:07 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id m21-20020a170902d19500b0016d1bee1519sm8525757plb.102.2022.08.22.09.28.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 09:28:06 -0700 (PDT) Sender: Guenter Roeck Date: Mon, 22 Aug 2022 09:28:05 -0700 From: Guenter Roeck To: "Farber, Eliav" Cc: jdelvare@suse.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, talel@amazon.com, hhhawa@amazon.com, jonnyc@amazon.com, hanochu@amazon.com, ronenk@amazon.com, itamark@amazon.com, shellykz@amazon.com, shorer@amazon.com, amitlavi@amazon.com, almogbs@amazon.com, dwmw@amazon.co.uk, rtanwar@maxlinear.com Subject: Re: [PATCH v2 16/16] hwmon: (mr75203) add debugfs to read and write temperature coefficients Message-ID: <20220822162805.GD4098765@roeck-us.net> References: <20220817054321.6519-1-farbere@amazon.com> <20220817054321.6519-17-farbere@amazon.com> <20220818231106.GA3505191@roeck-us.net> <75165e58-8601-1fe5-7bdb-98761a73701f@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <75165e58-8601-1fe5-7bdb-98761a73701f@amazon.com> X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 22, 2022 at 04:59:43PM +0300, Farber, Eliav wrote: > On 8/19/2022 2:11 AM, Guenter Roeck wrote: > > On Wed, Aug 17, 2022 at 05:43:21AM +0000, Eliav Farber wrote: > > > This change adds debugfs to read and write TS coefficients - g, h, j and > > > cal5. > > > > > > The coefficients can vary between product and product, so to calibrate > > > them it can be very useful to to be able to modify them on the fly. > > > > > > e.g. > > > > > > cat /sys/kernel/debug/940f23d0000.pvt/ts_coeff_cal5 > > > 4096 > > > > > > echo 83000 > sys/kernel/debug/940f23d0000.pvt/ts_coeff_g > > > > > > > What happens if you write 0 into all those attributes, or 0xffffffff ? > The driver equation is: > T = G + H * (n / cal5 - 0.5) + J * F > So I added protection for cal5 not being 0. > Besides that there is no limitation on what these values can be. > I can't really think of any other logical limitation I can apply. > There needs to be an overflow protection. I am quite sure that 0xffffffff would result in overflows and thus in quite random reported values. Thanks, Guenter > -- > Regards, Eliav