mbox series

[v4,0/3] hwmon: Add Baikal-T1 SoC Process, Voltage and Temp sensor support

Message ID 20200528142805.29115-1-Sergey.Semin@baikalelectronics.ru (mailing list archive)
Headers show
Series hwmon: Add Baikal-T1 SoC Process, Voltage and Temp sensor support | expand

Message

Serge Semin May 28, 2020, 2:28 p.m. UTC
In order to keep track of Baikal-T1 SoC power consumption and make sure
the chip heating is within the normal temperature limits, there is
a dedicated hardware monitor sensor embedded into the SoC. It is based
on the Analog Bits PVT sensor but equipped with a vendor-specific control
wrapper, which ease an access to the sensors functionality. Fist of all it
provides an accessed to the sampled Temperature, Voltage and
Low/Standard/High Voltage thresholds. In addition the wrapper generates
an interrupt in case if one enabled for alarm thresholds or data ready
event. All of these functionality is implemented in the Baikal-T1 PVT
driver submitted within this patchset. Naturally there is also a patch,
which creates a corresponding yaml-based dt-binding file for the sensor.

This patchset is rebased and tested on the mainline Linux kernel 5.6-rc4:
base-commit: 0e698dfa2822 ("Linux 5.7-rc4")
tag: v5.7-rc4

Note new vendor prefix for Baikal-T1 PVT device will be added in the
framework of the next patchset:
https://lkml.org/lkml/2020/5/6/1047

Changelog v2:
- Don't use a multi-arg clock phandle reference in the examples dt-bindings
  property. Thus reundant include pre-processor statement can be removed.
- Rearrange the SoBs with adding Maxim' co-development tag.
- Lowercase the node-name in the dt-schema example.
- Add dual license header to the dt-bindings file.
- Replace "additionalProperties: false" property with
  "unevaluatedProperties: false".
- Discard label definition from the binding example.
- Discard handwritten IO-access wrappers. Use normal readl/writel instead.
- Use generic FIELD_{GET,PREP} macros instead of handwritten ones.
- Since the driver depends on the OF config we can remove of_match_ptr()
  macro utilization.
- Don't print error-message if no platform IRQ found. Just return an error.
- Remove probe-status info string printout.
- Our corporate email server doesn't change Message-Id anymore, so the patchset
  is resubmitted being in the cover-letter-threaded format.

Link: https://lore.kernel.org/linux-hwmon/20200510103211.27905-1-Sergey.Semin@baikalelectronics.ru/
Changelog v3:
- Add bt1-pvt into the Documentation/hwmon/index.rst file.
- Discard explicit "default n" from the SENSORS_BT1_PVT_ALARMS config.
- Use "depends on SENSORS_BT1_PVT" statement instead of if-endif kbuild
  config clause.
- Alphabetically order the include macro operators.
- Discard unneeded include macro in the header file.
- Use new generic interface of the hwmon alarms notifications introduced
  in the first patch (based on hwmon_notify_event()).
- Add more descriptive information regarding the temp1_trim attribute.
- Discard setting the platforms device private data by using
  platform_set_drvdata(). It's redundant since unused in the driver.
- Pass "pvt" hwmon name instead of dev_name(dev) to
  devm_hwmon_device_register_with_info().
- Add "baikal,pvt-temp-trim-millicelsius" temperature trim DT property
  support.
- Discard kernel log warnings printed from the ISR when either min or
  max threshold levels are crossed.
- Discard CONFIG_OF dependency since there is non at compile-time.

Link: https://lore.kernel.org/linux-hwmon/20200526133823.20466-1-Sergey.Semin@baikalelectronics.ru
Changelog v4:
- Rename temp1_trim to the temp1_offset and use the standard API to
  expose the attribute.
- Rename "baikal,pvt-temp-trim-millicelsius" DT property to
  "baikal,pvt-temp-offset-millicelsius".
- Switch "const static" order to be "static const" where it's applicable.
- Add missing headers "linux/io.h" and "linux/of.h".
- Add static qualifier to the pvt_hwmon_write() method, which has been
  missed there by mistake.

Co-developed-by: Maxim Kaurkin <maxim.kaurkin@baikalelectronics.ru>
Signed-off-by: Maxim Kaurkin <Maxim.Kaurkin@baikalelectronics.ru>
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>
Cc: Ramil Zaripov <Ramil.Zaripov@baikalelectronics.ru>
Cc: Ekaterina Skachko <Ekaterina.Skachko@baikalelectronics.ru>
Cc: Vadim Vlasov <V.Vlasov@baikalelectronics.ru>
Cc: Alexey Kolotnikov <Alexey.Kolotnikov@baikalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-hwmon@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Guenter Roeck (1):
  hwmon: Add notification support

Serge Semin (2):
  dt-bindings: hwmon: Add Baikal-T1 PVT sensor binding
  hwmon: Add Baikal-T1 PVT sensor driver

 .../bindings/hwmon/baikal,bt1-pvt.yaml        |  107 ++
 Documentation/hwmon/bt1-pvt.rst               |  117 ++
 Documentation/hwmon/index.rst                 |    1 +
 drivers/hwmon/Kconfig                         |   25 +
 drivers/hwmon/Makefile                        |    1 +
 drivers/hwmon/bt1-pvt.c                       | 1146 +++++++++++++++++
 drivers/hwmon/bt1-pvt.h                       |  244 ++++
 drivers/hwmon/hwmon.c                         |   69 +-
 include/linux/hwmon.h                         |    3 +
 9 files changed, 1710 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwmon/baikal,bt1-pvt.yaml
 create mode 100644 Documentation/hwmon/bt1-pvt.rst
 create mode 100644 drivers/hwmon/bt1-pvt.c
 create mode 100644 drivers/hwmon/bt1-pvt.h

Comments

Guenter Roeck May 28, 2020, 3:08 p.m. UTC | #1
On Thu, May 28, 2020 at 05:28:02PM +0300, Serge Semin wrote:
> In order to keep track of Baikal-T1 SoC power consumption and make sure
> the chip heating is within the normal temperature limits, there is
> a dedicated hardware monitor sensor embedded into the SoC. It is based
> on the Analog Bits PVT sensor but equipped with a vendor-specific control
> wrapper, which ease an access to the sensors functionality. Fist of all it
> provides an accessed to the sampled Temperature, Voltage and
> Low/Standard/High Voltage thresholds. In addition the wrapper generates
> an interrupt in case if one enabled for alarm thresholds or data ready
> event. All of these functionality is implemented in the Baikal-T1 PVT
> driver submitted within this patchset. Naturally there is also a patch,
> which creates a corresponding yaml-based dt-binding file for the sensor.
> 
> This patchset is rebased and tested on the mainline Linux kernel 5.6-rc4:
> base-commit: 0e698dfa2822 ("Linux 5.7-rc4")
> tag: v5.7-rc4
> 

Series applied to hwmon-next.

Thanks,
Guenter

> Note new vendor prefix for Baikal-T1 PVT device will be added in the
> framework of the next patchset:
> https://lkml.org/lkml/2020/5/6/1047
> 
> Changelog v2:
> - Don't use a multi-arg clock phandle reference in the examples dt-bindings
>   property. Thus reundant include pre-processor statement can be removed.
> - Rearrange the SoBs with adding Maxim' co-development tag.
> - Lowercase the node-name in the dt-schema example.
> - Add dual license header to the dt-bindings file.
> - Replace "additionalProperties: false" property with
>   "unevaluatedProperties: false".
> - Discard label definition from the binding example.
> - Discard handwritten IO-access wrappers. Use normal readl/writel instead.
> - Use generic FIELD_{GET,PREP} macros instead of handwritten ones.
> - Since the driver depends on the OF config we can remove of_match_ptr()
>   macro utilization.
> - Don't print error-message if no platform IRQ found. Just return an error.
> - Remove probe-status info string printout.
> - Our corporate email server doesn't change Message-Id anymore, so the patchset
>   is resubmitted being in the cover-letter-threaded format.
> 
> Link: https://lore.kernel.org/linux-hwmon/20200510103211.27905-1-Sergey.Semin@baikalelectronics.ru/
> Changelog v3:
> - Add bt1-pvt into the Documentation/hwmon/index.rst file.
> - Discard explicit "default n" from the SENSORS_BT1_PVT_ALARMS config.
> - Use "depends on SENSORS_BT1_PVT" statement instead of if-endif kbuild
>   config clause.
> - Alphabetically order the include macro operators.
> - Discard unneeded include macro in the header file.
> - Use new generic interface of the hwmon alarms notifications introduced
>   in the first patch (based on hwmon_notify_event()).
> - Add more descriptive information regarding the temp1_trim attribute.
> - Discard setting the platforms device private data by using
>   platform_set_drvdata(). It's redundant since unused in the driver.
> - Pass "pvt" hwmon name instead of dev_name(dev) to
>   devm_hwmon_device_register_with_info().
> - Add "baikal,pvt-temp-trim-millicelsius" temperature trim DT property
>   support.
> - Discard kernel log warnings printed from the ISR when either min or
>   max threshold levels are crossed.
> - Discard CONFIG_OF dependency since there is non at compile-time.
> 
> Link: https://lore.kernel.org/linux-hwmon/20200526133823.20466-1-Sergey.Semin@baikalelectronics.ru
> Changelog v4:
> - Rename temp1_trim to the temp1_offset and use the standard API to
>   expose the attribute.
> - Rename "baikal,pvt-temp-trim-millicelsius" DT property to
>   "baikal,pvt-temp-offset-millicelsius".
> - Switch "const static" order to be "static const" where it's applicable.
> - Add missing headers "linux/io.h" and "linux/of.h".
> - Add static qualifier to the pvt_hwmon_write() method, which has been
>   missed there by mistake.
> 
> Co-developed-by: Maxim Kaurkin <maxim.kaurkin@baikalelectronics.ru>
> Signed-off-by: Maxim Kaurkin <Maxim.Kaurkin@baikalelectronics.ru>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
> Cc: Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>
> Cc: Ramil Zaripov <Ramil.Zaripov@baikalelectronics.ru>
> Cc: Ekaterina Skachko <Ekaterina.Skachko@baikalelectronics.ru>
> Cc: Vadim Vlasov <V.Vlasov@baikalelectronics.ru>
> Cc: Alexey Kolotnikov <Alexey.Kolotnikov@baikalelectronics.ru>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: linux-mips@vger.kernel.org
> Cc: linux-hwmon@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> 
> Guenter Roeck (1):
>   hwmon: Add notification support
> 
> Serge Semin (2):
>   dt-bindings: hwmon: Add Baikal-T1 PVT sensor binding
>   hwmon: Add Baikal-T1 PVT sensor driver
> 
>  .../bindings/hwmon/baikal,bt1-pvt.yaml        |  107 ++
>  Documentation/hwmon/bt1-pvt.rst               |  117 ++
>  Documentation/hwmon/index.rst                 |    1 +
>  drivers/hwmon/Kconfig                         |   25 +
>  drivers/hwmon/Makefile                        |    1 +
>  drivers/hwmon/bt1-pvt.c                       | 1146 +++++++++++++++++
>  drivers/hwmon/bt1-pvt.h                       |  244 ++++
>  drivers/hwmon/hwmon.c                         |   69 +-
>  include/linux/hwmon.h                         |    3 +
>  9 files changed, 1710 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/baikal,bt1-pvt.yaml
>  create mode 100644 Documentation/hwmon/bt1-pvt.rst
>  create mode 100644 drivers/hwmon/bt1-pvt.c
>  create mode 100644 drivers/hwmon/bt1-pvt.h
> 
> -- 
> 2.26.2
>