Add Richtek RTQ6056 support
Subsystems (2)
v4 cover Add Richtek RTQ6056 support
From: ChiYuan Huang <[email protected]>
This patch series is to enable Richtek RTQ6056 support.
The RTQ6056 is a high accuracy current-sense monitor with I2C interface, and the device provides full information for system by reading out the load current and power.
Since v4
- Add '__aligned(8)' for timestamp member.
- Declare timestamp from 'int64_t' to more unified 's64'.
Since v3
- change the node name to be generic 'adc' in binding example.
- Refine pm_runtime API calling order in 'read_channel' API.
- Fix vshunt wrong scale for divider.
- Refine the comment text.
- Use 'devm_add_action_or_reset' to decrease the code usage in probe function.
- Use RUNTIME_PM_OPS to replace SET_RUNTIME_PM_OPS.
- minor fix for the comma.
- Use pm_ptr to replace the direct assigned pm_ops.
Since v2
- Change the resistor property name to be generic 'shunt-resistor-micro-ohms'.
- Rename file from 'rtq6056-adc' to 'rtq6056'.
- Refine the ABI, if generic already defined it, remove it and check the channel report unit.
- Add copyright text.
- include the correct header.
- change the property parsing name.
- To use iio_chan_spec address field.
- Refine each channel separate and shared_by_all.
- Use pm_runtime and pm_runtime_autosuspend.
- Remove the shutdown callback. From the HW suggestion, it's not recommended to use battery as the power supply.
- Check all scale unit (voltage->mV, current->mA, power->milliWatt).
- Use the read_avail to provide the interface for attribute value list.
- Add comma for the last element in the const integer array.
- Refine each ADC label text.
- In read_label callback, replace snprintf to sysfs_emit.
ChiYuan Huang (2):
dt-bindings: iio: adc: Add rtq6056 adc support
iio: adc: Add rtq6056 support
.../ABI/testing/sysfs-bus-iio-adc-rtq6056 | 6 + .../bindings/iio/adc/richtek,rtq6056.yaml | 56 ++ drivers/iio/adc/Kconfig | 15 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/rtq6056.c | 651 +++++++++++++++++++++ 5 files changed, 729 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-rtq6056 create mode 100644 Documentation/devicetree/bindings/iio/adc/richtek,rtq6056.yaml create mode 100644 drivers/iio/adc/rtq6056.c
Signature · 1 line
2.7.4
PATCH v4 1/2 dt-bindings: iio: adc: Add rtq6056 adc support
From: ChiYuan Huang <[email protected]>
Add the documentation for Richtek rtq6056.
---
Since v3
- change the node name to be generic 'adc' in binding example.
Since v2
- Change the resistor property name to be generic 'shunt-resistor-micro-ohms'.
--- .../bindings/iio/adc/richtek,rtq6056.yaml | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/richtek,rtq6056.yaml
Documentation/devicetree/bindings/iio/adc/richtek,rtq6056.yaml new file +56 -0
@@ -0,0 +1,56 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/richtek,rtq6056.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: RTQ6056 Bi-Directional Current and Power Monitor with 16-bit ADC + +maintainers: + - ChiYuan Huang <[email protected]> + +description: | + The RTQ6056 is a high accuracy current-sense monitor with I2C and SMBus + interface, and the device provides full information for system by reading + out the loading current and power. + + The device monitors both of the drops across sense resistor and the BUS + voltage, converts into the current in amperes, and power in watts through + internal analog-to-digital converter ADC. The programmable calibration, + adjustable conversion time, and averaging function are also built in for + more design flexibility. + + Datasheet is available at + https://www.richtek.com/assets/product_file/RTQ6056/DSQ6056-00.pdf + +properties: + compatible: + const: richtek,rtq6056 + + reg: + maxItems: 1 + + "#io-channel-cells": + const: 1 + + shunt-resistor-micro-ohms: + description: Shunt IN+/IN- sensing node resistor + +required: + - compatible + - reg + - "#io-channel-cells" + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + adc@40 { + compatible = "richtek,rtq6056"; + reg = <0x40>; + #io-channel-cells = <1>; + }; + };
Signature · 1 line
2.7.4
PATCH v4 2/2 iio: adc: Add rtq6056 support
In reply to cy_huangFrom: ChiYuan Huang <[email protected]>
Add Richtek rtq6056 supporting.
It can be used for the system to monitor load current and power with 16-bit resolution.
---
Since v4
- Add '__aligned(8)' for timestamp member in buffer_trigger_handler function.
- Declare timestamp from 'int64_t' to more unified 's64'.
Since v3
- Refine pm_runtime API calling order in 'read_channel' API.
- Fix vshunt wrong scale for divider.
- Refine the comment text.
- Use 'devm_add_action_or_reset' to decrease the code usage in probe function.
- Use RUNTIME_PM_OPS to replace SET_RUNTIME_PM_OPS.
- minor fix for the comma.
- Use pm_ptr to replace the direct assigned pm_ops.
Since v2
- Rename file from 'rtq6056-adc' to 'rtq6056'.
- Refine the ABI, if generic already defined it, remove it and check the channel report unit.
- Add copyright text.
- include the correct header.
- change the property parsing name.
- To use iio_chan_spec address field.
- Refine each channel separate and shared_by_all.
- Use pm_runtime and pm_runtime_autosuspend.
- Remove the shutdown callback. From the HW suggestion, it's not recommended to use battery as the power supply.
- Check all scale unit (voltage->mV, current->mA, power->milliWatt).
- Use the read_avail to provide the interface for attribute value list.
- Add comma for the last element in the const integer array.
- Refine each ADC label text.
- In read_label callback, replace snprintf to sysfs_emit.
--- .../ABI/testing/sysfs-bus-iio-adc-rtq6056 | 6 + drivers/iio/adc/Kconfig | 15 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/rtq6056.c | 651 +++++++++++++++++++++ 4 files changed, 673 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-rtq6056 create mode 100644 drivers/iio/adc/rtq6056.c
Documentation/ABI/testing/sysfs-bus-iio-adc-rtq6056 new file +6 -0
@@ -0,0 +1,6 @@ +What: /sys/bus/iio/devices/iio:deviceX/in_voltage0_integration_time +What: /sys/bus/iio/devices/iio:deviceX/in_voltage1_integration_time +KernelVersion: 5.15.31 +Contact: [email protected] +Description: + Each voltage conversion time in uS
drivers/iio/adc/Kconfig +15 -0
@@ -908,6 +908,21 @@ config ROCKCHIP_SARADC To compile this driver as a module, choose M here: the module will be called rockchip_saradc. +config RICHTEK_RTQ6056 + tristate "Richtek RTQ6056 Current and Power Monitor ADC" + depends on I2C + select REGMAP_I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to enable RQT6056 ADC support. + RTQ6056 is a high accuracy current-sense monitor with I2C and SMBus + compatible interface, and the device provides full information for + system by reading out the load current and power. + + This driver can also be built as a module. If so, the module will be + called rtq6056. + config RZG2L_ADC tristate "Renesas RZ/G2L ADC driver" depends on ARCH_RZG2L || COMPILE_TEST
drivers/iio/adc/Makefile +1 -0
@@ -84,6 +84,7 @@ obj-$(CONFIG_QCOM_PM8XXX_XOADC) += qcom-pm8xxx-xoadc.o obj-$(CONFIG_RCAR_GYRO_ADC) += rcar-gyroadc.o obj-$(CONFIG_RN5T618_ADC) += rn5t618-adc.o obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o +obj-$(CONFIG_RICHTEK_RTQ6056) += rtq6056.o obj-$(CONFIG_RZG2L_ADC) += rzg2l_adc.o obj-$(CONFIG_SC27XX_ADC) += sc27xx_adc.o obj-$(CONFIG_SPEAR_ADC) += spear_adc.o
drivers/iio/adc/rtq6056.c new file +651 -0
651 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v4 2/2] iio: adc: Add rtq6056 support
Quoted 10 lines · cy_huang
From: ChiYuan Huang <[email protected]>
Add Richtek rtq6056 supporting.
It can be used for the system to monitor load current and power with 16-bit resolution.
Signed-off-by ChiYuan Huang <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Since you sent a new version:
I said explicitly that the kernel version mustn't be not stable nor developing.
...
Quoted 1 line
+KernelVersion: 5.15.31
^^^ Wrong
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v4 2/2] iio: adc: Add rtq6056 support
Andy Shevchenko <[email protected]> 於 2022年7月6日 週三 凌晨3:09寫道:
Quoted 13 lines · cy_huang
Quoted 10 lines
From: ChiYuan Huang <[email protected]>
Add Richtek rtq6056 supporting.
It can be used for the system to monitor load current and power with 16-bit resolution.
Signed-off-by ChiYuan Huang <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Quoted 9 lines
Since you sent a new version:
I said explicitly that the kernel version mustn't be not stable nor developing....
Quoted 1 line
+KernelVersion: 5.15.31
^^^ Wrong
I really cannot understand what kernel version I need to specified.
https://lore.kernel.org/lkml/CAHp75VeBdgbyDQXEYb9ZZdi3AU=vPw6aKGWbNLnuA_QoN4LE4A@mail.gmail.com/
Last time, my understanding is to use the realistic kernel version. Then from my development environment, the kernel I used is 5.15.31. That's why I changed it from '5.18.2' to '5.15.31'.
Do you mind to tell me what kernel version I need to write for this ABI test document?
I'm almost confused about 'realistic', 'non-stable', nor 'developing'.
If to write '5.19' or the future version '5.20', is it ok?
Quoted 3 lines
--
With Best Regards,
Andy Shevchenko
Re: [PATCH v4 2/2] iio: adc: Add rtq6056 support
Quoted 2 lines · ChiYuan Huang
Andy Shevchenko <[email protected]> 於 2022年7月6日 週三 凌晨3:09寫道:
Quoted 1 line · cy_huang
...
Quoted 11 lines
Quoted 4 lines
Quoted 1 line
+KernelVersion: 5.15.31
^^^ Wrong
I really cannot understand what kernel version I need to specified.
https://lore.kernel.org/lkml/CAHp75VeBdgbyDQXEYb9ZZdi3AU=vPw6aKGWbNLnuA_QoN4LE4A@mail.gmail.com/Last time, my understanding is to use the realistic kernel version. Then from my development environment, the kernel I used is 5.15.31. That's why I changed it from '5.18.2' to '5.15.31'.
Quoted 5 lines
Do you mind to tell me what kernel version I need to write for this ABI test document?
I'm almost confused about 'realistic', 'non-stable', nor 'developing'.If to write '5.19' or the future version '5.20', is it ok?
It's as simple as "next version that most likely your patch will be in", in 99.9% cases it's 'current-cycle-version + 1', i.e. 5.20.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v4 2/2] iio: adc: Add rtq6056 support
Andy Shevchenko <[email protected]> 於 2022年7月6日 週三 晚上8:45寫道:
Quoted 18 lines · ChiYuan Huang
Quoted 2 lines
Andy Shevchenko <[email protected]> 於 2022年7月6日 週三 凌晨3:09寫道:
Quoted 1 line · cy_huang
...
Quoted 11 lines
Quoted 4 lines
Quoted 1 line
+KernelVersion: 5.15.31
^^^ Wrong
I really cannot understand what kernel version I need to specified.
https://lore.kernel.org/lkml/CAHp75VeBdgbyDQXEYb9ZZdi3AU=vPw6aKGWbNLnuA_QoN4LE4A@mail.gmail.com/Last time, my understanding is to use the realistic kernel version. Then from my development environment, the kernel I used is 5.15.31. That's why I changed it from '5.18.2' to '5.15.31'.
Quoted 9 lines
Quoted 5 lines
Do you mind to tell me what kernel version I need to write for this ABI test document?
I'm almost confused about 'realistic', 'non-stable', nor 'developing'.If to write '5.19' or the future version '5.20', is it ok?
It's as simple as "next version that most likely your patch will be in", in 99.9% cases it's 'current-cycle-version + 1', i.e. 5.20.
It really confuse me for days.
Now, it's clear.
Thanks.
Quoted 3 lines
--
With Best Regards,
Andy Shevchenko
Re: [PATCH v4 2/2] iio: adc: Add rtq6056 support
In reply to Andy ShevchenkoAndy Shevchenko <[email protected]> 於 2022年7月6日 週三 凌晨3:09寫道:
Quoted 7 lines · cy_huang
Quoted 5 lines
From: ChiYuan Huang <[email protected]>
Add Richtek rtq6056 supporting.
Quoted 9 lines
Quoted 5 lines
It can be used for the system to monitor load current and power with 16-bit resolution.
Signed-off-by ChiYuan Huang <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Since you sent a new version:
I said explicitly that the kernel version mustn't be not stable nor developing.
Sorry, and this.
Are you saying that patch series need to depend on the stable kernel version? I cannot always sync the latest one and have to use the tag to grab the stable one.
Right?
Quoted 9 lines
...
Quoted 1 line
+KernelVersion: 5.15.31
^^^ Wrong
--
With Best Regards,
Andy Shevchenko