| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ad525x_dpot: Driver for the Analog Devices digital potentiometers |
|---|
| 3 | 4 | * Copyright (c) 2009-2010 Analog Devices, Inc. |
|---|
| 4 | | - * Author: Michael Hennerich <hennerich@blackfin.uclinux.org> |
|---|
| 5 | + * Author: Michael Hennerich <michael.hennerich@analog.com> |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * DEVID #Wipers #Positions Resistor Options (kOhm) |
|---|
| 7 | 8 | * AD5258 1 64 1, 10, 50, 100 |
|---|
| .. | .. |
|---|
| 57 | 58 | * AD5272 1 1024 20, 50, 100 (50-TP) |
|---|
| 58 | 59 | * AD5274 1 256 20, 50, 100 (50-TP) |
|---|
| 59 | 60 | * |
|---|
| 60 | | - * See Documentation/misc-devices/ad525x_dpot.txt for more info. |
|---|
| 61 | + * See Documentation/misc-devices/ad525x_dpot.rst for more info. |
|---|
| 61 | 62 | * |
|---|
| 62 | 63 | * derived from ad5258.c |
|---|
| 63 | 64 | * Copyright (c) 2009 Cyber Switching, Inc. |
|---|
| 64 | 65 | * Author: Chris Verges <chrisv@cyberswitching.com> |
|---|
| 65 | 66 | * |
|---|
| 66 | 67 | * 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> |
|---|
| 70 | 69 | */ |
|---|
| 71 | 70 | |
|---|
| 72 | 71 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 202 | 201 | return dpot_read_r8d8(dpot, ctrl); |
|---|
| 203 | 202 | case DPOT_UID(AD5272_ID): |
|---|
| 204 | 203 | case DPOT_UID(AD5274_ID): |
|---|
| 205 | | - dpot_write_r8d8(dpot, |
|---|
| 204 | + dpot_write_r8d8(dpot, |
|---|
| 206 | 205 | (DPOT_AD5270_1_2_4_READ_RDAC << 2), 0); |
|---|
| 207 | 206 | |
|---|
| 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); |
|---|
| 210 | 215 | |
|---|
| 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; |
|---|
| 221 | 218 | return value; |
|---|
| 222 | 219 | default: |
|---|
| 223 | 220 | if ((reg & DPOT_REG_TOL) || (dpot->max_pos > 256)) |
|---|
| .. | .. |
|---|
| 760 | 757 | |
|---|
| 761 | 758 | |
|---|
| 762 | 759 | MODULE_AUTHOR("Chris Verges <chrisv@cyberswitching.com>, " |
|---|
| 763 | | - "Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
|---|
| 760 | + "Michael Hennerich <michael.hennerich@analog.com>"); |
|---|
| 764 | 761 | MODULE_DESCRIPTION("Digital potentiometer driver"); |
|---|
| 765 | 762 | MODULE_LICENSE("GPL"); |
|---|