Skip to contentSkip to conversation

mfd: rn5t618: add ADC support

PATCH In review Andreas Kemnade 2 participants 10 messages Feb 23, 2020 – Feb 27, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v5 cover mfd: rn5t618: add ADC support

This series adds support for the ADC in the RN5T618/RC5T619. It depends on the IRQ support added in the RTC support series here:
https://lore.kernel.org/lkml/[email protected]/

I tested the driver only with the RC5T619 but it should work with the with the RN5T618 as well based on these facts:
- The corresponding register definitions originally went into the kernel for the RN5T618
- Public datasheet sections about the ADC look same.
- Out-of-tree code for these chips look same regarding to ADC

But due to missing hardware I cannot test the patches 2/3 and 3/3 which add support for the RN5T618 ADC.
I marked these untested patches as RFC, and IMHO they require a Tested-By. Feel free to ignore them if the whole series would be delayed just because of missing Tested-By for those.

Changes in v5:
- fixed typo

Changes in v4:
- drop RFC patches, seems nobody finds time to test now
- added trivial change and Reviewed-By

Changes in v3:
- re-included former 2/5 of these patches, since it was not applied

Changes in v2:
- got an "Applied, thanks" message for the first two, so I do not include them anymore
- some cleanups for the ADC driver itself

Andreas Kemnade (2):
mfd: rn5t618: add ADC subdevice for RC5T619
iio: adc: rn5t618: Add ADC driver for RN5T618/RC5T619

 drivers/iio/adc/Kconfig       |  10 ++
 drivers/iio/adc/Makefile      |   1 +
 drivers/iio/adc/rn5t618-adc.c | 256 ++++++++++++++++++++++++++++++++++
 drivers/mfd/rn5t618.c         |   1 +
 4 files changed, 268 insertions(+)
 create mode 100644 drivers/iio/adc/rn5t618-adc.c
Signature · 1 line
2.20.1
#1 lore raw

PATCH v5 1/2 mfd: rn5t618: add ADC subdevice for RC5T619

This adds a subdevice for the ADC in the RC5T619

---
depends on:
https://lore.kernel.org/lkml/[email protected]/

Changes in v3:
re-added it to the series because of
"Oh, it looks like there was a conflict. Could you collect any Acks (including mine) rebase and resend please?"

 drivers/mfd/rn5t618.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mfd/rn5t618.c +1 -0
index 073de8e0e78b..321836f78120 100644
@@ -24,6 +24,7 @@ static const struct mfd_cell rn5t618_cells[] = {
 };
 
 static const struct mfd_cell rc5t619_cells[] = {
+	{ .name = "rn5t618-adc" },
 	{ .name = "rn5t618-regulator" },
 	{ .name = "rc5t619-rtc" },
 	{ .name = "rn5t618-wdt" },
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH v5 1/2] mfd: rn5t618: add ADC subdevice for RC5T619

Quoted 11 lines · Andreas Kemnade

This adds a subdevice for the ADC in the RC5T619

---
depends on:
https://lore.kernel.org/lkml/[email protected]/

Changes in v3:
re-added it to the series because of
"Oh, it looks like there was a conflict. Could you collect any Acks (including mine) rebase and resend please?"

Looks like there is still a conflict. Sure, it's not a complicated fix, but that's beside the point. What tree is this set based on?

Quoted 8 lines
 drivers/mfd/rn5t618.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mfd/rn5t618.c +0 -0
index 073de8e0e78b..321836f78120 100644

drivers/mfd/rn5t618.c static const struct mfd_cell rn5t618_cells[] = { · line 29

Quoted 6 lines
drivers/mfd/rn5t618.c +1 -0
@@ -24,6 +24,7 @@ static const struct mfd_cell rn5t618_cells[] = {
 };
 
 static const struct mfd_cell rc5t619_cells[] = {
+	{ .name = "rn5t618-adc" },
 	{ .name = "rn5t618-regulator" },
 	{ .name = "rc5t619-rtc" },

In what upstream tree is this line present?

Quoted 1 line
drivers/mfd/rn5t618.c +0 -0
 	{ .name = "rn5t618-wdt" },
Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw

Re: [PATCH v5 1/2] mfd: rn5t618: add ADC subdevice for RC5T619

Quoted 9 lines · On Wed, 26 Feb 2020 15:40:55 +0000 Lee Jones <[email protected]> wrote:
Quoted 7 lines · Andreas Kemnade

This adds a subdevice for the ADC in the RC5T619

---
depends on:
https://lore.kernel.org/lkml/[email protected]/

Quoted 8 lines
Quoted 4 lines

Changes in v3:
re-added it to the series because of
"Oh, it looks like there was a conflict. Could you collect any Acks (including mine) rebase and resend please?"

Looks like there is still a conflict. Sure, it's not a complicated fix, but that's beside the point. What tree is this set based on?

It must be applied on top of my rc5t619 rtc series here:
https://lore.kernel.org/lkml/[email protected]/

I expected it to make it into 5.6 and when I first sent the RTC series
(in October) I had no idea when I will continue with other stuff.

That is why I sent this ADC series separately, also to give the IIO maintainer plenty of time to review.

Do you want me to resend all that pending stuff together in one series? I have little experience with this multi-subdevice process.

Regards,
Andreas

#4 lore raw

Re: [PATCH v5 1/2] mfd: rn5t618: add ADC subdevice for RC5T619

Quoted 20 lines · Andreas Kemnade
Quoted 9 lines · On Wed, 26 Feb 2020 15:40:55 +0000 Lee Jones <[email protected]> wrote:
Quoted 7 lines · Andreas Kemnade

This adds a subdevice for the ADC in the RC5T619

---
depends on:
https://lore.kernel.org/lkml/[email protected]/

Quoted 8 lines
Quoted 4 lines

Changes in v3:
re-added it to the series because of
"Oh, it looks like there was a conflict. Could you collect any Acks (including mine) rebase and resend please?"

Looks like there is still a conflict. Sure, it's not a complicated fix, but that's beside the point. What tree is this set based on?

Quoted 8 lines

It must be applied on top of my rc5t619 rtc series here:
https://lore.kernel.org/lkml/[email protected]/

I expected it to make it into 5.6 and when I first sent the RTC series
(in October) I had no idea when I will continue with other stuff.

That is why I sent this ADC series separately, also to give the IIO maintainer plenty of time to review.

If a patch-set can or should be applied on its own, you should send it based on an upstream commit, or else things like this happen.

My advice would be to maintain topic branches, each based on an upstream release, which you can merge together into an integration branch for full coverage testing.

Quoted 2 lines

Do you want me to resend all that pending stuff together in one series? I have little experience with this multi-subdevice process.

It makes more sense to rebase this set onto the latest full release and resubmit this set on its own.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#5 lore raw

Re: [PATCH v5 1/2] mfd: rn5t618: add ADC subdevice for RC5T619

Quoted 25 lines · On Wed, 26 Feb 2020 17:46:40 +0000 Lee Jones <[email protected]> wrote:
Quoted 23 lines · Andreas Kemnade
Quoted 9 lines · On Wed, 26 Feb 2020 15:40:55 +0000 Lee Jones <[email protected]> wrote:
Quoted 7 lines · Andreas Kemnade

This adds a subdevice for the ADC in the RC5T619

---
depends on:
https://lore.kernel.org/lkml/[email protected]/

Quoted 8 lines
Quoted 4 lines

Changes in v3:
re-added it to the series because of
"Oh, it looks like there was a conflict. Could you collect any Acks (including mine) rebase and resend please?"

Looks like there is still a conflict. Sure, it's not a complicated fix, but that's beside the point. What tree is this set based on?

It must be applied on top of my rc5t619 rtc series here:
https://lore.kernel.org/lkml/[email protected]/

Quoted 9 lines
Quoted 5 lines

I expected it to make it into 5.6 and when I first sent the RTC series
(in October) I had no idea when I will continue with other stuff.

That is why I sent this ADC series separately, also to give the IIO maintainer plenty of time to review.

If a patch-set can or should be applied on its own, you should send it based on an upstream commit, or else things like this happen.

It cannot without breaking bisectability. The RTC series adds IRQ support in the PMIC which is used here.

Quoted 10 lines

My advice would be to maintain topic branches, each based on an upstream release, which you can merge together into an integration branch for full coverage testing.

Quoted 2 lines

Do you want me to resend all that pending stuff together in one series? I have little experience with this multi-subdevice process.

It makes more sense to rebase this set onto the latest full release and resubmit this set on its own.

So, I resend the RC5T619 RTC series mentioned above as you answered upont Nikolaus question and wait with this series until review is through.
Ok, so wait and rebase it onto 5.7-rc1 or 5.8-rc1 or whatever release the RTC stuff will appear.
So you are not going to create an ib-mfd-rtc-iio branch.

Regards,
Andreas

#6 lore raw

Re: [PATCH v5 1/2] mfd: rn5t618: add ADC subdevice for RC5T619

Quoted 31 lines · Andreas Kemnade
Quoted 28 lines · On Wed, 26 Feb 2020 17:46:40 +0000 Lee Jones <[email protected]> wrote:
Quoted 26 lines · Andreas Kemnade
Quoted 9 lines · On Wed, 26 Feb 2020 15:40:55 +0000 Lee Jones <[email protected]> wrote:
Quoted 7 lines · Andreas Kemnade

This adds a subdevice for the ADC in the RC5T619

---
depends on:
https://lore.kernel.org/lkml/[email protected]/

Quoted 8 lines
Quoted 4 lines

Changes in v3:
re-added it to the series because of
"Oh, it looks like there was a conflict. Could you collect any Acks (including mine) rebase and resend please?"

Looks like there is still a conflict. Sure, it's not a complicated fix, but that's beside the point. What tree is this set based on?

It must be applied on top of my rc5t619 rtc series here:
https://lore.kernel.org/lkml/[email protected]/

I expected it to make it into 5.6 and when I first sent the RTC series
(in October) I had no idea when I will continue with other stuff.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

That is why I sent this ADC series separately, also to give the IIO maintainer plenty of time to review.

If a patch-set can or should be applied on its own, you should send it based on an upstream commit, or else things like this happen.

It cannot without breaking bisectability. The RTC series adds IRQ support in the PMIC which is used here.

Then Kconfig should reflect that.

Or, if that's not possible, then you should not break-up and submit sets which cannot be applied by themselves. Either submit the whole set together, or submit them piece by piece, not submitting the next part until it's predecessor has been applied.

Quoted 10 lines
Quoted 10 lines

My advice would be to maintain topic branches, each based on an upstream release, which you can merge together into an integration branch for full coverage testing.

Quoted 2 lines

Do you want me to resend all that pending stuff together in one series? I have little experience with this multi-subdevice process.

It makes more sense to rebase this set onto the latest full release and resubmit this set on its own.

Quoted 6 lines

So, I resend the RC5T619 RTC series mentioned above as you answered upont Nikolaus question and wait with this series until review is through.
Ok, so wait and rebase it onto 5.7-rc1 or 5.8-rc1 or whatever release the RTC stuff will appear.
So you are not going to create an ib-mfd-rtc-iio branch.

As above.

If you go the whole-patch-set route, yes, either myself or someone else would have to create an immutable pull-request, but you don't have to concern yourself with that.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#7 lore raw

Re: [PATCH v5 1/2] mfd: rn5t618: add ADC subdevice for RC5T619

Quoted 42 lines · On Thu, 27 Feb 2020 09:40:06 +0000 Lee Jones <[email protected]> wrote:
Quoted 31 lines · Andreas Kemnade
Quoted 28 lines · On Wed, 26 Feb 2020 17:46:40 +0000 Lee Jones <[email protected]> wrote:
Quoted 26 lines · Andreas Kemnade
Quoted 9 lines · On Wed, 26 Feb 2020 15:40:55 +0000 Lee Jones <[email protected]> wrote:
Quoted 7 lines · Andreas Kemnade

This adds a subdevice for the ADC in the RC5T619

---
depends on:
https://lore.kernel.org/lkml/[email protected]/

Quoted 8 lines
Quoted 4 lines

Changes in v3:
re-added it to the series because of
"Oh, it looks like there was a conflict. Could you collect any Acks (including mine) rebase and resend please?"

Looks like there is still a conflict. Sure, it's not a complicated fix, but that's beside the point. What tree is this set based on?

It must be applied on top of my rc5t619 rtc series here:
https://lore.kernel.org/lkml/[email protected]/

I expected it to make it into 5.6 and when I first sent the RTC series
(in October) I had no idea when I will continue with other stuff.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

That is why I sent this ADC series separately, also to give the IIO maintainer plenty of time to review.

If a patch-set can or should be applied on its own, you should send it based on an upstream commit, or else things like this happen.

It cannot without breaking bisectability. The RTC series adds IRQ support in the PMIC which is used here.

Quoted 7 lines

Then Kconfig should reflect that.

Or, if that's not possible, then you should not break-up and submit sets which cannot be applied by themselves. Either submit the whole set together, or submit them piece by piece, not submitting the next part until it's predecessor has been applied.

I will send you a complete series containing both RTC and ADC support. Then you can decide wether you
1. apply the whole series (both things)
2. apply RTC for 5.7 and this series later
3. ignore them (not my preferred choice ;-) ).

BTW: The way I did was based on the following note in Documentation/process/submitting-patches.rst

"If one patch depends on another patch in order for a change to be complete, that is OK. Simply note **"this patch depends on patch X"** in your patch description."

Regards,
Andreas

#8 lore raw

PATCH v5 2/2 iio: adc: rn5t618: Add ADC driver for RN5T618/RC5T619

In reply to Andreas Kemnade

Both chips have an A/D converter capable of measuring things like VBAT, VUSB and analog inputs.

---
depends on (build and runtime):
https://lore.kernel.org/lkml/[email protected]/

Changes in v4:
- merged ret = and return into one line
- added Reviewed-by:

Changes in v3:
- output scale instead of processed
- prefixed symbols with RN5T618

Changes in v2:
- enum for channels
- bulk read instead of single byte read for conversion result
- fix get_virq error handling
- use devm for registering device and requesting IRQ

 drivers/iio/adc/Kconfig       |  10 ++
 drivers/iio/adc/Makefile      |   1 +
 drivers/iio/adc/rn5t618-adc.c | 256 ++++++++++++++++++++++++++++++++++
 3 files changed, 267 insertions(+)
 create mode 100644 drivers/iio/adc/rn5t618-adc.c
drivers/iio/adc/Kconfig +10 -0
index 5d8540b7b427..e7e74e775336 100644
@@ -766,6 +766,16 @@ config RCAR_GYRO_ADC
 	  To compile this driver as a module, choose M here: the
 	  module will be called rcar-gyroadc.
 
+config RN5T618_ADC
+	tristate "ADC for the RN5T618/RC5T619 family of chips"
+	depends on MFD_RN5T618
+	help
+	  Say yes here to build support for the integrated ADC inside the
+	  RN5T618/619 series PMICs:
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rn5t618-adc.
+
 config ROCKCHIP_SARADC
 	tristate "Rockchip SARADC driver"
 	depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST)
drivers/iio/adc/Makefile +1 -0
index a1f1fbec0f87..ea95f89c91cd 100644
@@ -72,6 +72,7 @@ obj-$(CONFIG_QCOM_VADC_COMMON) += qcom-vadc-common.o
 obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o
 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_SC27XX_ADC) += sc27xx_adc.o
 obj-$(CONFIG_SPEAR_ADC) += spear_adc.o
drivers/iio/adc/rn5t618-adc.c new file +256 -0

256 lines not on this page · raw message

Signature · 1 line
2.20.1
#9 lore raw

Re: [PATCH v5 2/2] iio: adc: rn5t618: Add ADC driver for RN5T618/RC5T619

Hi,

drivers/iio/adc/rn5t618-adc.c line 212

Quoted 4 lines · On Sun, 23 Feb 2020 14:16:38 +0100 Andreas Kemnade <[email protected]> wrote:
drivers/iio/adc/rn5t618-adc.c new file +4 -0
+	if (rn5t618->irq_data)
+		adc->irq = regmap_irq_get_virq(rn5t618->irq_data,
+					       RN5T618_IRQ_ADC);
+

RN5T618_IRQ_ADC is defined in the RTC patchset mentioned as dependency, which adds IRQ support and I am asked to rebase it on top of plain mainline. Does that mean that the kernel git source does not need to be bisectable anymore?

Regards,
Andreas