Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux 6.6 th1520 adc driver #20

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions Documentation/devicetree/bindings/iio/adc/thead,th1520-adc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/adc/thead,th1520-adc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: THEAD TH1520 Analog to Digital Converter (ADC)

maintainers:
- Fugang Duan <[email protected]>
- Xiangyi Zeng <[email protected]>
- Wei Fu <[email protected]>

description: |
12-Bit Analog to Digital Converter (ADC) on XuanTie TH1520
properties:
compatible:
const: thead,th1520

reg:
maxItems: 1

interrupts:
maxItems: 1

clocks:
maxItems: 1

clock-names:
const: adc

required:
- compatible
- reg
- interrupts
- clocks
- clock-names
- status

additionalProperties: false

examples:
- |
adc: adc@0xfffff51000 {
compatible = "thead,th1520-adc";
reg = <0xff 0xfff51000 0x0 0x1000>;
interrupts = <61 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&aonsys_clk>;
clock-names = "adc";
/* ADC pin is proprietary,no need to config pinctrl */
status = "disabled";
};
4 changes: 4 additions & 0 deletions arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
Original file line number Diff line number Diff line change
Expand Up @@ -410,3 +410,7 @@
vbus-supply = <&vcc5v_usb>;
};
};

&adc {
status = "okay";
};
10 changes: 10 additions & 0 deletions arch/riscv/boot/dts/thead/th1520.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -747,5 +747,15 @@
interrupts = <55 IRQ_TYPE_LEVEL_HIGH>;
};
};

adc: adc@0xfffff51000 {
compatible = "thead,th1520-adc";
reg = <0xff 0xfff51000 0x0 0x1000>;
interrupts = <61 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&aonsys_clk>;
clock-names = "adc";
/* ADC pin is proprietary,no need to config pinctrl */
status = "disabled";
};
};
};
2 changes: 2 additions & 0 deletions arch/riscv/configs/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,5 @@ CONFIG_USB_ONBOARD_HUB=m
CONFIG_USB_GADGET=m
CONFIG_TYPEC=m
CONFIG_USB_ROLE_SWITCH=m
CONFIG_IIO=y
CONFIG_THEAD_TH1520_ADC=m
13 changes: 13 additions & 0 deletions drivers/iio/adc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1441,4 +1441,17 @@ config XILINX_AMS
The driver can also be built as a module. If so, the module will be called
xilinx-ams.

config THEAD_TH1520_ADC
tristate "THEAD TH1520 ADC driver"
depends on OF
depends on HAS_IOMEM
depends on ARCH_THEAD
default y
help
Say yes here to support for THEAD TH1520 MPW analog-to-digital
converter.

This driver can also be built as a module. If so, the module will be
called thead-th1520-adc.

endmenu
1 change: 1 addition & 0 deletions drivers/iio/adc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,4 @@ xilinx-xadc-y := xilinx-xadc-core.o xilinx-xadc-events.o
obj-$(CONFIG_XILINX_XADC) += xilinx-xadc.o
obj-$(CONFIG_XILINX_AMS) += xilinx-ams.o
obj-$(CONFIG_SD_ADC_MODULATOR) += sd_adc_modulator.o
obj-$(CONFIG_THEAD_TH1520_ADC) += th1520-adc.o
Loading
Loading