Skip to content

Commit 768a806

Browse files
committed
iio: dac: ad5413: Integrate reviewer feedback
This patch addresses various improvements based on reviewer suggestions: - Removed unused index variable in parse_dt() - Fixed misleading indentation in probe() conditional blocks - Reworked DT bindings: switched to enum/oneOf and restricted voltage/current ranges - Added driver-side range validation for voltage and current modes - Replaced manual bit macros with FIELD_PREP() for DAC_CONFIG - Removed unnecessary include: <linux/kernel.h> - Sorted entries in Kconfig and Makefile - Quoted DT required property names and simplified mutual-exclusion logic - Tidied up whitespace, blank lines, and long lines Signed-off-by: Bruce Tsao <[email protected]> iio: dac: ad5413: apply reviewer cleanups Address various reviewer comments and style fixes: - Move FIELD_PREP mask definitions directly beneath their register defines - Replace usleep_range() with fsleep() in wait loops - Return -ETIMEDOUT on timeout instead of -EIO - Use dev_err_probe() for probe-time failures in DT parsing - Rename ad5413_find_closest_match() to ad5413_find_best_match() - Change out_range to a pointer to avoid per-field copies - Guard devm_mutex_init() with kernel version check; fall back to mutex_init() - Remove redundant comments and simplify error paths - Simplify pwr_down logic with ternary assignment - Fix indentation, tab/space usage, and other style issues as per checkpatch Signed-off-by: Bruce Tsao <[email protected]> iio: dac: ad5413: final cleanups after style check Address remaining checkpatch warnings: - remove trailing '(' - adjust CamelCase enum name - fix unnecessary parentheses Signed-off-by: Bruce Tsao <[email protected]>
1 parent def3ac3 commit 768a806

File tree

4 files changed

+223
-239
lines changed

4 files changed

+223
-239
lines changed

Documentation/devicetree/bindings/iio/dac/adi,ad5413.yaml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,20 @@ properties:
2121

2222
adi,range-microvolt:
2323
description: Voltage output range <min, max> in microvolts
24-
enum:
25-
- [-10500000, 10500000]
26-
- [-12600000, 12600000]
24+
oneOf:
25+
- items:
26+
- const: -10500000
27+
- const: 10500000
2728

2829
adi,range-microamp:
2930
description: Current output range <min, max> in microamps
30-
enum:
31-
- [0, 24000]
31+
oneOf:
32+
- items:
33+
- const: 0
34+
- const: 24000
3235

3336
adi,slew-time-us:
34-
description: |
35-
Output digital slew control time in microseconds
37+
description: Output digital slew control time in microseconds
3638
minimum: 0
3739
maximum: 1000000
3840

@@ -43,17 +45,10 @@ required:
4345

4446
allOf:
4547
- $ref: /schemas/spi/spi-peripheral-props.yaml#
46-
- if:
47-
required: [adi, range-microamp]
48-
then:
49-
properties:
50-
adi,range-microvolt: false
51-
- if:
52-
required: [adi, range-microvolt]
53-
then:
54-
properties:
55-
adi,range-microamp: false
56-
48+
- oneOf:
49+
- required: ['adi,range-microamp']
50+
- required: ['adi,range-microvolt']
51+
5752
unevaluatedProperties: false
5853

5954
examples:

drivers/iio/dac/Kconfig

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ config AD5380
9494
To compile this driver as module choose M here: the module will be called
9595
ad5380.
9696

97+
config AD5413
98+
tristate "Analog Devices AD5413 DAC driver"
99+
depends on SPI_MASTER
100+
help
101+
Say yes here to build support for Analog Devices AD5413 single channel
102+
Digital to Analog Converter.
103+
104+
To compile this driver as a module, choose M here: the
105+
module will be called ad5758.
106+
97107
config AD5421
98108
tristate "Analog Devices AD5421 DAC driver"
99109
depends on SPI
@@ -563,14 +573,4 @@ config VF610_DAC
563573

564574
This driver can also be built as a module. If so, the module will
565575
be called vf610_dac.
566-
567-
config AD5413
568-
tristate "Analog Devices AD5413 DAC driver"
569-
depends on SPI_MASTER
570-
help
571-
Say yes here to build support for Analog Devices AD5413 single channel
572-
Digital to Analog Converter.
573-
574-
To compile this driver as a module, choose M here: the
575-
module will be called ad5758.
576576
endmenu

drivers/iio/dac/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ obj-$(CONFIG_AD3552R) += ad3552r.o
1111
obj-$(CONFIG_AD5270) += ad5270.o
1212
obj-$(CONFIG_AD5360) += ad5360.o
1313
obj-$(CONFIG_AD5380) += ad5380.o
14+
obj-$(CONFIG_AD5413) += ad5413.o
1415
obj-$(CONFIG_AD5421) += ad5421.o
1516
obj-$(CONFIG_AD5624R_SPI) += ad5624r_spi.o
1617
obj-$(CONFIG_AD5064) += ad5064.o
@@ -57,4 +58,4 @@ obj-$(CONFIG_TI_DAC5571) += ti-dac5571.o
5758
obj-$(CONFIG_TI_DAC7311) += ti-dac7311.o
5859
obj-$(CONFIG_TI_DAC7612) += ti-dac7612.o
5960
obj-$(CONFIG_VF610_DAC) += vf610_dac.o
60-
obj-$(CONFIG_AD5413) += ad5413.o
61+

0 commit comments

Comments
 (0)