AD5274 userspace driver

We are using the ad5274 device to control an LCD contrast pin. I have successfully instantiated the ad5274 linux driver. The driver exposes a couple of files in /sys/bus/i2c/devices/000-02c. The files of note are rdac0, otp0en, and otp0. I can't find any documentation that explains how someone is to use these files to program the ad5274 device. Any help?

Parents
  • 0
    •  Analog Employees 
    on Feb 22, 2016 8:53 AM

    Hi Michael,

    Sorry for the delay - we tested the AD5272/5274 support using a AD5272 which always worked flawless.

    In fact there is typo which caused the AD5274 read-back problems.

    A fix was send mainline:

    LKML: <michael.hennerich@analog ...: [PATCH] drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors

    Testing:

    root@linaro-ubuntu-desktop:~# cd /sys/bus/i2c/devices/0-002f/

    root@linaro-ubuntu-desktop:/sys/bus/i2c/devices/0-002f# ls -al

    total 0

    drwxr-xr-x 3 root root    0 Jan  1  1970 .

    drwxr-xr-x 6 root root    0 Jan  1  1970 ..

    lrwxrwxrwx 1 root root    0 Feb 22 09:36 driver -> ../../../../../../bus/i2c/drivers/ad_dpot

    -r--r--r-- 1 root root 4096 Feb 22 09:36 modalias

    -r--r--r-- 1 root root 4096 Feb 22 09:36 name

    lrwxrwxrwx 1 root root    0 Feb 22 09:36 of_node -> ../../../../../../firmware/devicetree/base/amba/i2c@e0004000/ad5172@2f

    -rw-r--r-- 1 root root 4096 Feb 22 09:36 otp0

    -rw-r--r-- 1 root root 4096 Feb 22 09:36 otp0en

    drwxr-xr-x 2 root root    0 Feb 22 09:36 power

    -rw-r--r-- 1 root root 4096 Feb 22 09:36 rdac0

    lrwxrwxrwx 1 root root    0 Jan  1  1970 subsystem -> ../../../../../../bus/i2c

    -rw-r--r-- 1 root root 4096 Jan  1  1970 uevent

    root@linaro-ubuntu-desktop:/sys/bus/i2c/devices/0-002f# grep "" *

    modalias:i2c:ad5274

    name:ad5274

    otp0:42

    otp0en:disabled

    rdac0:42

    uevent:DRIVER=ad_dpot

    uevent:OF_NAME=ad5172

    uevent:OF_FULLNAME=/amba/i2c@e0004000/ad5172@2f

    uevent:OF_COMPATIBLE_0=ad5274

    uevent:OF_COMPATIBLE_N=1

    uevent:MODALIAS=i2c:ad5274

    root@linaro-ubuntu-desktop:/sys/bus/i2c/devices/0-002f# for i in `seq 0 255`; do echo $i > rdac0;cat rdac0; done;                                                                                           

    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    [ --snip-- ]

    240

    241

    242

    243

    244

    245

    246

    247

    248

    249

    250

    251

    252

    253

    254

    255

    root@linaro-ubuntu-desktop:/sys/bus/i2c/devices/0-002f#

    -Michael

Reply
  • 0
    •  Analog Employees 
    on Feb 22, 2016 8:53 AM

    Hi Michael,

    Sorry for the delay - we tested the AD5272/5274 support using a AD5272 which always worked flawless.

    In fact there is typo which caused the AD5274 read-back problems.

    A fix was send mainline:

    LKML: <michael.hennerich@analog ...: [PATCH] drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors

    Testing:

    root@linaro-ubuntu-desktop:~# cd /sys/bus/i2c/devices/0-002f/

    root@linaro-ubuntu-desktop:/sys/bus/i2c/devices/0-002f# ls -al

    total 0

    drwxr-xr-x 3 root root    0 Jan  1  1970 .

    drwxr-xr-x 6 root root    0 Jan  1  1970 ..

    lrwxrwxrwx 1 root root    0 Feb 22 09:36 driver -> ../../../../../../bus/i2c/drivers/ad_dpot

    -r--r--r-- 1 root root 4096 Feb 22 09:36 modalias

    -r--r--r-- 1 root root 4096 Feb 22 09:36 name

    lrwxrwxrwx 1 root root    0 Feb 22 09:36 of_node -> ../../../../../../firmware/devicetree/base/amba/i2c@e0004000/ad5172@2f

    -rw-r--r-- 1 root root 4096 Feb 22 09:36 otp0

    -rw-r--r-- 1 root root 4096 Feb 22 09:36 otp0en

    drwxr-xr-x 2 root root    0 Feb 22 09:36 power

    -rw-r--r-- 1 root root 4096 Feb 22 09:36 rdac0

    lrwxrwxrwx 1 root root    0 Jan  1  1970 subsystem -> ../../../../../../bus/i2c

    -rw-r--r-- 1 root root 4096 Jan  1  1970 uevent

    root@linaro-ubuntu-desktop:/sys/bus/i2c/devices/0-002f# grep "" *

    modalias:i2c:ad5274

    name:ad5274

    otp0:42

    otp0en:disabled

    rdac0:42

    uevent:DRIVER=ad_dpot

    uevent:OF_NAME=ad5172

    uevent:OF_FULLNAME=/amba/i2c@e0004000/ad5172@2f

    uevent:OF_COMPATIBLE_0=ad5274

    uevent:OF_COMPATIBLE_N=1

    uevent:MODALIAS=i2c:ad5274

    root@linaro-ubuntu-desktop:/sys/bus/i2c/devices/0-002f# for i in `seq 0 255`; do echo $i > rdac0;cat rdac0; done;                                                                                           

    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    [ --snip-- ]

    240

    241

    242

    243

    244

    245

    246

    247

    248

    249

    250

    251

    252

    253

    254

    255

    root@linaro-ubuntu-desktop:/sys/bus/i2c/devices/0-002f#

    -Michael

Children
No Data