Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp4603102pxb; Sun, 27 Mar 2022 23:08:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz57tHaCZ/iOe/wZjXEy2Y5VkQD/ASV9po9TNoMPoqlF4yr8hpY/nxtN+DE8Dud+mu/vl1d X-Received: by 2002:a17:907:6e2a:b0:6db:c440:532b with SMTP id sd42-20020a1709076e2a00b006dbc440532bmr26045733ejc.95.1648447717216; Sun, 27 Mar 2022 23:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648447717; cv=none; d=google.com; s=arc-20160816; b=0iDc2EAPLmtbkDCjeh1uqQofx3k8lZeFersEczHGi/sBDrK5d7JK7VY5tt/wC6iiC0 NkH1ultqvnDVfmp6ydMelcSlQZ9R245ppHKUsPMvp+SXn8PtwaqOEjntWXf5qxRB+9TS GhRjOZt7fQiD7MI3uQtIW+SGuFIDe/KvIZP+TkrR0eWniTbStTmAoI+TGEg6j/6EvgSb jrJ8aLZnVz2/13oGAyUskOML2SJgbzutn72yd4xwAq7CLWZOzAYhSXCCQfHqHG7sQvGa hq+GoypGJVVss0iD+HF7AEbb1CaYGEgAFI+S5s/OxfeSlzWiYc9Jp9jBmOjc6hJ19yw0 gPCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=U1ALIM523p8MqRPqP+ugG3tBGGFZ31pckruL6+qSD2I=; b=TcWNwNycCoMTw/MIAeJ+OrC1km2vyVo7rXQGw34jjWCfu/dSKLJah+MhoRxTQqWyu/ PxNhG75rSfxzH7h7g+kC9edEBr6WYo+BtlxDYval4MnXKZ7C9bOiVQkwDTt2QUNIjDCB yB9kjR6/OKKTTz+kQw+hH8WW3VLRUrutwnRgukvO1tCsCSGKPpSfBdYKy9qIBWNEGQ+h /n5cXRWU2uNe6MJRHO70QikYMUiUr1voOn+Y95Cft3yZHptNlMf11vpJDNqI7+JJFwVX enSbdyFXnvZmT0t6zg0Ew8xpMQrwgv8fiMxZHAniG4HjlVn5d2jTOlV02pzeJTpFlHY1 40ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=oF8vTnEa; 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 h21-20020a170906719500b006df76385f22si11609440ejk.962.2022.03.27.23.08.11; Sun, 27 Mar 2022 23:08:37 -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=@walle.cc header.s=mail2016061301 header.b=oF8vTnEa; 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 S234676AbiCZTZp (ORCPT + 99 others); Sat, 26 Mar 2022 15:25:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234091AbiCZTZj (ORCPT ); Sat, 26 Mar 2022 15:25:39 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42C7D32983; Sat, 26 Mar 2022 12:24:01 -0700 (PDT) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 446CC22246; Sat, 26 Mar 2022 20:23:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1648322639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=U1ALIM523p8MqRPqP+ugG3tBGGFZ31pckruL6+qSD2I=; b=oF8vTnEabgoC+nwYoxSucgQqWZCsS618tKBCeW+k+R2xWnBmiA6uPjG2eKDqQAabxLP+ZG 85GY+aOtFFMr1w09twyikBIvhCeB2myFKrpkYFshWBMtiy2zZGH6ql35W+tAjX3a95mz/B pJpDHOykJRDZY45BiMo3Lcv1HiAb5rc= From: Michael Walle To: Jean Delvare , Guenter Roeck , Rob Herring , Krzysztof Kozlowski Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Walle Subject: [PATCH v1 0/4] hwmon: add lan9668 driver Date: Sat, 26 Mar 2022 20:23:43 +0100 Message-Id: <20220326192347.2940747-1-michael@walle.cc> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Add a temperature and fan controller driver for the Microchip LAN9668 SoC. The temperature sensor uses a polynomial to calculate the actual temperature. Fortunately, the bt1-pvt already has such a calculation. It seems that the LAN9668 uses the same Analog Bits sensor as the BT1 although with a different characteristic. To be able to reuse the code move it to lib/ as it seems pretty generic to calculate any polynomial using integers only, which might also be used by other parts of the kernel. Another option might be to move the code to hwmon-poly.c, I'm not sure. Thoughts? I also plan on submitting patches to add temperature sensor support for the GPYxxx and LAN8814 PHYs which also use polynomial_calc(). The last two patches adds the actual driver and the dt-binding for it. Michael Walle (4): lib: add generic polynomial calculation hwmon: (bt1-pvt) use generic polynomial functions dt-bindings: hwmon: add Microchip LAN966x bindings hwmon: add driver for the Microchip LAN966x SoC .../bindings/hwmon/microchip,lan966x.yaml | 53 +++ drivers/hwmon/Kconfig | 12 + drivers/hwmon/Makefile | 1 + drivers/hwmon/bt1-pvt.c | 50 +-- drivers/hwmon/lan966x-hwmon.c | 384 ++++++++++++++++++ include/linux/polynomial.h | 35 ++ lib/Kconfig | 3 + lib/Makefile | 2 + lib/polynomial.c | 95 +++++ 9 files changed, 598 insertions(+), 37 deletions(-) create mode 100644 Documentation/devicetree/bindings/hwmon/microchip,lan966x.yaml create mode 100644 drivers/hwmon/lan966x-hwmon.c create mode 100644 include/linux/polynomial.h create mode 100644 lib/polynomial.c -- 2.30.2