forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/misc/ad525x_dpot.c
....@@ -1,7 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * ad525x_dpot: Driver for the Analog Devices digital potentiometers
34 * Copyright (c) 2009-2010 Analog Devices, Inc.
4
- * Author: Michael Hennerich <hennerich@blackfin.uclinux.org>
5
+ * Author: Michael Hennerich <michael.hennerich@analog.com>
56 *
67 * DEVID #Wipers #Positions Resistor Options (kOhm)
78 * AD5258 1 64 1, 10, 50, 100
....@@ -57,16 +58,14 @@
5758 * AD5272 1 1024 20, 50, 100 (50-TP)
5859 * AD5274 1 256 20, 50, 100 (50-TP)
5960 *
60
- * See Documentation/misc-devices/ad525x_dpot.txt for more info.
61
+ * See Documentation/misc-devices/ad525x_dpot.rst for more info.
6162 *
6263 * derived from ad5258.c
6364 * Copyright (c) 2009 Cyber Switching, Inc.
6465 * Author: Chris Verges <chrisv@cyberswitching.com>
6566 *
6667 * derived from ad5252.c
67
- * Copyright (c) 2006-2011 Michael Hennerich <hennerich@blackfin.uclinux.org>
68
- *
69
- * Licensed under the GPL-2 or later.
68
+ * Copyright (c) 2006-2011 Michael Hennerich <michael.hennerich@analog.com>
7069 */
7170
7271 #include <linux/module.h>
....@@ -202,22 +201,20 @@
202201 return dpot_read_r8d8(dpot, ctrl);
203202 case DPOT_UID(AD5272_ID):
204203 case DPOT_UID(AD5274_ID):
205
- dpot_write_r8d8(dpot,
204
+ dpot_write_r8d8(dpot,
206205 (DPOT_AD5270_1_2_4_READ_RDAC << 2), 0);
207206
208
- value = dpot_read_r8d16(dpot,
209
- DPOT_AD5270_1_2_4_RDAC << 2);
207
+ value = dpot_read_r8d16(dpot, DPOT_AD5270_1_2_4_RDAC << 2);
208
+ if (value < 0)
209
+ return value;
210
+ /*
211
+ * AD5272/AD5274 returns high byte first, however
212
+ * underling smbus expects low byte first.
213
+ */
214
+ value = swab16(value);
210215
211
- if (value < 0)
212
- return value;
213
- /*
214
- * AD5272/AD5274 returns high byte first, however
215
- * underling smbus expects low byte first.
216
- */
217
- value = swab16(value);
218
-
219
- if (dpot->uid == DPOT_UID(AD5274_ID))
220
- value = value >> 2;
216
+ if (dpot->uid == DPOT_UID(AD5274_ID))
217
+ value = value >> 2;
221218 return value;
222219 default:
223220 if ((reg & DPOT_REG_TOL) || (dpot->max_pos > 256))
....@@ -760,6 +757,6 @@
760757
761758
762759 MODULE_AUTHOR("Chris Verges <chrisv@cyberswitching.com>, "
763
- "Michael Hennerich <hennerich@blackfin.uclinux.org>");
760
+ "Michael Hennerich <michael.hennerich@analog.com>");
764761 MODULE_DESCRIPTION("Digital potentiometer driver");
765762 MODULE_LICENSE("GPL");