[06/10] ARM: dts: stm32: adopt generic iio bindings for adc channels on avenger96

Message ID 20230112104446.1140551-7-olivier.moysan@foss.st.com
State New
Headers
Series ARM: dts: stm32: add adc internal channels on stm32mp15 |

Commit Message

Olivier MOYSAN Jan. 12, 2023, 10:44 a.m. UTC
  Use STM32 ADC generic bindings instead of legacy bindings on
Avenger96 board.

The STM32 ADC specific binding to declare channels has been deprecated,
hence adopt the generic IIO channels bindings, instead.
The STM32MP151 device tree now exposes internal channels using the
generic binding. This makes the change mandatory here to avoid a mixed
use of legacy and generic binding, which is not supported by the driver.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
---
 .../boot/dts/stm32mp15xx-dhcor-avenger96.dtsi | 28 ++++++++++++++++---
 1 file changed, 24 insertions(+), 4 deletions(-)
  

Comments

Marek Vasut Jan. 12, 2023, 2:28 p.m. UTC | #1
On 1/12/23 11:44, Olivier Moysan wrote:
> Use STM32 ADC generic bindings instead of legacy bindings on
> Avenger96 board.
> 
> The STM32 ADC specific binding to declare channels has been deprecated,
> hence adopt the generic IIO channels bindings, instead.
> The STM32MP151 device tree now exposes internal channels using the
> generic binding. This makes the change mandatory here to avoid a mixed
> use of legacy and generic binding, which is not supported by the driver.
> 
> Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
> ---
>   .../boot/dts/stm32mp15xx-dhcor-avenger96.dtsi | 28 ++++++++++++++++---
>   1 file changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi
> index 50af4a27d6be..62efb550ae64 100644
> --- a/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi
> +++ b/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi
> @@ -113,15 +113,35 @@ &adc {
>   	status = "okay";
>   
>   	adc1: adc@0 {
> -		st,adc-channels = <0 1 6>;
> -		st,min-sample-time-nsecs = <5000>;

U-Boot drivers/adc/stm32-adc.c depends on these properties , so if you 
drop them here and U-Boot DTs gets synced with Linux, the ADC driver 
there will start failing. Can you update the U-Boot ADC driver too ?

Maybe the easiest way would be to retain the old properties for now with 
a comment, and add the new properties ?
  

Patch

diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi
index 50af4a27d6be..62efb550ae64 100644
--- a/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi
+++ b/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi
@@ -113,15 +113,35 @@  &adc {
 	status = "okay";
 
 	adc1: adc@0 {
-		st,adc-channels = <0 1 6>;
-		st,min-sample-time-nsecs = <5000>;
 		status = "okay";
+		channel@0 {
+			reg = <0>;
+			st,min-sample-time-ns = <5000>;
+		};
+		channel@1 {
+			reg = <1>;
+			st,min-sample-time-ns = <5000>;
+		};
+		channel@6 {
+			reg = <6>;
+			st,min-sample-time-ns = <5000>;
+		};
 	};
 
 	adc2: adc@100 {
-		st,adc-channels = <0 1 2>;
-		st,min-sample-time-nsecs = <5000>;
 		status = "okay";
+		channel@0 {
+			reg = <0>;
+			st,min-sample-time-ns = <5000>;
+		};
+		channel@1 {
+			reg = <1>;
+			st,min-sample-time-ns = <5000>;
+		};
+		channel@2 {
+			reg = <2>;
+			st,min-sample-time-ns = <5000>;
+		};
 	};
 };