mbox series

[v8,0/4] Add support for Allwinner GPADC on D1/T113s/R329/T507 SoCs

Message ID 20230619154252.3951913-1-bigunclemax@gmail.com
Headers show
Series Add support for Allwinner GPADC on D1/T113s/R329/T507 SoCs | expand

Message

Maxim Kiselev June 19, 2023, 3:42 p.m. UTC
This series adds support for general purpose ADC (GPADC) on new
Allwinner's SoCs, such as D1, T113s, T507 and R329. The implemented driver
provides basic functionality for getting ADC channels data.

Change History:
v8:
- Added patch that changes Kconfig description for previous Allwinner GPADC
- Changed Kconfig description for this GPADC driver
- Fixed 'reg' range for gpadc node in 'sunxi-d1s-t113.dtsi'

v7:
- Fixed typo in DT bindings property

v6:
- Fixed DT bindings regexp for channel properties
- Dropped checking the max number of channels from the drivers code
  (This is redundant as we raly on DT bindings check)

v5:
- Fixed DT bindings properties for child nodes

v4:
- Fixed DT bindings warnings
- Used GENMASK to clear the irq register
- Minor formatting fixes

v3:
- Added DT bindings dual license, fixed property order and example formatting
- Added explanations comments for timeout and mutex
- Dropped unnecessary regmap and used readl/writel instead
- Added error message about getting channel number
- Renamed labels and variables to make them self-explanatory

v2:
- Added lastch flag to avoid addition work for already selected channel
- Added reset assertion on module remove
- Added dynamic channel allocation and dropped iio_chan_spec arrays
- Changed IIO_CHAN_INFO_SCALE type to FRACTIONAL_LOG2
- Dropped separate compatible strings and configs for T113s and R329
- Fixed includes
- Fixed Kconfig description
- Removed duplicate probe error messages
- Used FIELD_PREP for bit setup

v1:
- Initial version

Maksim Kiselev (4):
  iio: adc: Kconfig change description for Allwinner GPADC
  iio: adc: Add Allwinner D1/T113s/R329/T507 SoCs GPADC
  dt-bindings: iio: adc: Add Allwinner D1/T113s/R329/T507 SoCs GPADC
  riscv: dts: allwinner: d1: Add GPADC node

 .../iio/adc/allwinner,sun20i-d1-gpadc.yaml    |  91 ++++++
 .../boot/dts/allwinner/sunxi-d1s-t113.dtsi    |  10 +
 drivers/iio/adc/Kconfig                       |  12 +-
 drivers/iio/adc/Makefile                      |   1 +
 drivers/iio/adc/sun20i-gpadc-iio.c            | 276 ++++++++++++++++++
 5 files changed, 389 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
 create mode 100644 drivers/iio/adc/sun20i-gpadc-iio.c

Comments

Jonathan Cameron July 8, 2023, 2:05 p.m. UTC | #1
On Mon, 19 Jun 2023 18:42:23 +0300
Maksim Kiselev <bigunclemax@gmail.com> wrote:

> This series adds support for general purpose ADC (GPADC) on new
> Allwinner's SoCs, such as D1, T113s, T507 and R329. The implemented driver
> provides basic functionality for getting ADC channels data.
Applied 1-3 to the togreg branch of iio.git which will initially be pushed out as
testing so that 0-day can see if we missed anything. I'll also be rebasing it
on rc1 once available before pushing out as togreg.

Thanks,

Jonathan

> 
> Change History:
> v8:
> - Added patch that changes Kconfig description for previous Allwinner GPADC
> - Changed Kconfig description for this GPADC driver
> - Fixed 'reg' range for gpadc node in 'sunxi-d1s-t113.dtsi'
> 
> v7:
> - Fixed typo in DT bindings property
> 
> v6:
> - Fixed DT bindings regexp for channel properties
> - Dropped checking the max number of channels from the drivers code
>   (This is redundant as we raly on DT bindings check)
> 
> v5:
> - Fixed DT bindings properties for child nodes
> 
> v4:
> - Fixed DT bindings warnings
> - Used GENMASK to clear the irq register
> - Minor formatting fixes
> 
> v3:
> - Added DT bindings dual license, fixed property order and example formatting
> - Added explanations comments for timeout and mutex
> - Dropped unnecessary regmap and used readl/writel instead
> - Added error message about getting channel number
> - Renamed labels and variables to make them self-explanatory
> 
> v2:
> - Added lastch flag to avoid addition work for already selected channel
> - Added reset assertion on module remove
> - Added dynamic channel allocation and dropped iio_chan_spec arrays
> - Changed IIO_CHAN_INFO_SCALE type to FRACTIONAL_LOG2
> - Dropped separate compatible strings and configs for T113s and R329
> - Fixed includes
> - Fixed Kconfig description
> - Removed duplicate probe error messages
> - Used FIELD_PREP for bit setup
> 
> v1:
> - Initial version
> 
> Maksim Kiselev (4):
>   iio: adc: Kconfig change description for Allwinner GPADC
>   iio: adc: Add Allwinner D1/T113s/R329/T507 SoCs GPADC
>   dt-bindings: iio: adc: Add Allwinner D1/T113s/R329/T507 SoCs GPADC
>   riscv: dts: allwinner: d1: Add GPADC node
> 
>  .../iio/adc/allwinner,sun20i-d1-gpadc.yaml    |  91 ++++++
>  .../boot/dts/allwinner/sunxi-d1s-t113.dtsi    |  10 +
>  drivers/iio/adc/Kconfig                       |  12 +-
>  drivers/iio/adc/Makefile                      |   1 +
>  drivers/iio/adc/sun20i-gpadc-iio.c            | 276 ++++++++++++++++++
>  5 files changed, 389 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
>  create mode 100644 drivers/iio/adc/sun20i-gpadc-iio.c
>
Jernej Škrabec July 11, 2023, 6:14 p.m. UTC | #2
Dne ponedeljek, 19. junij 2023 ob 17:42:24 CEST je Maksim Kiselev napisal(a):
> This patch adds SoCs names to Allwinner GPADC description to
> make it more informative.

Please reword to remove "This patch".

> 
> Fixes: d1caa9905538 ("iio: adc: add support for Allwinner SoCs ADC")

I'm fine with the patch in general, but does this really warrant fixes tag?

Best regards,
Jernej


> Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
> ---
>  drivers/iio/adc/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index eb2b09ef5d5b..d93868684c7b 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -1105,7 +1105,7 @@ config STMPE_ADC
>  	  built-in ADC block (stmpe811).
> 
>  config SUN4I_GPADC
> -	tristate "Support for the Allwinner SoCs GPADC"
> +	tristate "Allwinner A10/A13/A31 and similar GPADCs driver"
>  	depends on IIO
>  	depends on MFD_SUN4I_GPADC || MACH_SUN8I
>  	depends on THERMAL || !THERMAL_OF
Jernej Škrabec July 11, 2023, 6:19 p.m. UTC | #3
Dne ponedeljek, 19. junij 2023 ob 17:42:27 CEST je Maksim Kiselev napisal(a):
> This patch adds declaration of the general purpose ADC for D1
> and T113s SoCs.
> 
> Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

> ---
>  arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
> b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi index
> 922e8e0e2c09..cb353d5805cb 100644
> --- a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
> +++ b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
> @@ -138,6 +138,16 @@ ccu: clock-controller@2001000 {
>  			#reset-cells = <1>;
>  		};
> 
> +		gpadc: adc@2009000 {
> +			compatible = "allwinner,sun20i-d1-gpadc";
> +			reg = <0x2009000 0x400>;
> +			clocks = <&ccu CLK_BUS_GPADC>;
> +			resets = <&ccu RST_BUS_GPADC>;
> +			interrupts = <SOC_PERIPHERAL_IRQ(57) 
IRQ_TYPE_LEVEL_HIGH>;
> +			status = "disabled";
> +			#io-channel-cells = <1>;
> +		};
> +
>  		dmic: dmic@2031000 {
>  			compatible = "allwinner,sun20i-d1-dmic",
>  				     "allwinner,sun50i-h6-dmic";
Krzysztof Kozlowski July 12, 2023, 5:37 a.m. UTC | #4
On 11/07/2023 20:14, Jernej Škrabec wrote:
> Dne ponedeljek, 19. junij 2023 ob 17:42:24 CEST je Maksim Kiselev napisal(a):
>> This patch adds SoCs names to Allwinner GPADC description to
>> make it more informative.
> 
> Please reword to remove "This patch".
> 
>>
>> Fixes: d1caa9905538 ("iio: adc: add support for Allwinner SoCs ADC")
> 
> I'm fine with the patch in general, but does this really warrant fixes tag?
> 

No, it's some fake fix. There is no bug here.

Best regards,
Krzysztof
Jonathan Cameron July 15, 2023, 4:53 p.m. UTC | #5
On Wed, 12 Jul 2023 07:37:38 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> On 11/07/2023 20:14, Jernej Škrabec wrote:
> > Dne ponedeljek, 19. junij 2023 ob 17:42:24 CEST je Maksim Kiselev napisal(a):  
> >> This patch adds SoCs names to Allwinner GPADC description to
> >> make it more informative.  
> > 
> > Please reword to remove "This patch".
> >   
> >>
> >> Fixes: d1caa9905538 ("iio: adc: add support for Allwinner SoCs ADC")  
> > 
> > I'm fine with the patch in general, but does this really warrant fixes tag?
> >   
> 
> No, it's some fake fix. There is no bug here.
> 
> Best regards,
> Krzysztof
> 

Dropped the tag.

Thanks for pointing this out.

Jonathan
Jernej Škrabec July 30, 2023, 10:19 p.m. UTC | #6
Dne ponedeljek, 19. junij 2023 ob 17:42:27 CEST je Maksim Kiselev napisal(a):
> This patch adds declaration of the general purpose ADC for D1
> and T113s SoCs.
> 
> Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>

Applied, thanks!

Best regards,
Jernej