linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Michael Walle <michael@walle.cc>
Subject: [PATCH v4 0/4] hwmon: add lan9668 driver
Date: Fri,  1 Apr 2022 23:40:28 +0200	[thread overview]
Message-ID: <20220401214032.3738095-1-michael@walle.cc> (raw)

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.

changes since v3:
 - validate input frequency in lan966x_hwmon_write_pwm_freq()
 - enable sensor before registering hwmon device
 - automatically disable sensor when driver is removed
 - set the required clock devider in case someone changed the
   hardware default before the driver is loaded
 - remove extra empty lines

changes since v2:
 - strip unwanted copy pasta.. oops
 - use "select REGMAP" instead of "depends on"

changes since v1:
 - add doc string to polynomial_calc(), moved the comment
   into the function.
 - add missing "select POLYNOMIAL" to the bt1_pvt driver
   Kconfig symbol
 - add hwmon driver documentation
 - cache sys_clk rate during probe
 - add missing ERR_CAST()
 - adapted comment for the PPS->RPM calculation
 - add temporary variable in lan966x_hwmon_read_pwm_freq()

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 +++
 Documentation/hwmon/lan966x.rst               |  40 ++
 drivers/hwmon/Kconfig                         |  13 +
 drivers/hwmon/Makefile                        |   1 +
 drivers/hwmon/bt1-pvt.c                       |  50 +--
 drivers/hwmon/lan966x-hwmon.c                 | 418 ++++++++++++++++++
 include/linux/polynomial.h                    |  35 ++
 lib/Kconfig                                   |   3 +
 lib/Makefile                                  |   2 +
 lib/polynomial.c                              | 108 +++++
 10 files changed, 686 insertions(+), 37 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwmon/microchip,lan966x.yaml
 create mode 100644 Documentation/hwmon/lan966x.rst
 create mode 100644 drivers/hwmon/lan966x-hwmon.c
 create mode 100644 include/linux/polynomial.h
 create mode 100644 lib/polynomial.c

-- 
2.30.2


             reply	other threads:[~2022-04-01 21:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 21:40 Michael Walle [this message]
2022-04-01 21:40 ` [PATCH v4 1/4] lib: add generic polynomial calculation Michael Walle
2022-05-02  4:32   ` Guenter Roeck
2022-04-01 21:40 ` [PATCH v4 2/4] hwmon: (bt1-pvt) use generic polynomial functions Michael Walle
2022-05-02  4:33   ` Guenter Roeck
2022-04-01 21:40 ` [PATCH v4 3/4] dt-bindings: hwmon: add Microchip LAN966x bindings Michael Walle
2022-04-24 16:37   ` Guenter Roeck
2022-04-24 16:38     ` Krzysztof Kozlowski
2022-05-02  4:33   ` Guenter Roeck
2022-04-01 21:40 ` [PATCH v4 4/4] hwmon: add driver for the Microchip LAN966x SoC Michael Walle
2022-04-24 16:38   ` Guenter Roeck
2022-04-24 16:44     ` Michael Walle
2022-05-02  4:34   ` Guenter Roeck
2022-04-18 17:44 ` [PATCH v4 0/4] hwmon: add lan9668 driver Michael Walle
2022-04-19  0:31   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220401214032.3738095-1-michael@walle.cc \
    --to=michael@walle.cc \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).