From: Florian Lobmaier <[email protected]> Added multi-function device driver support for ams AS3722 PMIC Includes modules gpio, regulator, rtc, and watchdog
Signed-off-by: Florian Lobmaier <[email protected]> --- diff -uprN -X Documentation/dontdiff ../kernel_3.8.8/linux-kernel/Documentation/mfd-as3722.txt ./Documentation/mfd-as3722.txt --- ../kernel_3.8.8/linux-kernel/Documentation/mfd-as3722.txt 1970-01-01 01:00:00.000000000 +0100 +++ ./Documentation/mfd-as3722.txt 2013-05-23 13:12:35.000000000 +0200 @@ -0,0 +1,133 @@ +AS3722 PMIC Driver documentation +-------------------------------- +Author: Florian Lobmaier <[email protected]> +Last update: 2013-04-12 + +This document describes how to use the multi-function device driver for +AS3722 PMICs. The AS3722 PMICs are accessed via i2c. + +Version info: +============= +Linux kernel: 3.4.38 +Patch created with: $ git diff f3b5af9a6e2a873110bb8546b42ae7c51f2213b3 > as3722_driver_v0.0.1.patch +Apply patch with: $ patch -p0 < as3722_driver_v0.0.1.patch + +Description of files: +===================== + +as3722_platform-data.c: +Platform data and as3722 regulator initialisation support. + +drivers/mfd/as3722-core.c: +AS3722 communication and device management + +drivers/regulator/as3722-regulator.c: +Adds the LDO's DCDC's and current regulators to /sys/class/regulator. + +drivers/gpio/gpio-as3722.c: +Adds the GPIOs of AS3722 to /sys/class/gpio and to GPIO framework. + +drivers/rtc/rtc-as3722.c: +Adds the RTC functionality of AS3722 to RTC framework. + +drivers/mfd/as3722-test.c: +Regulator test framework. Exports some tests to userspace (see below) + +include/linux/mfd/as3722-reg.h: +Register definitions + +include/linux/mfd/as3722-plat.h: +platform data struct definitions + +How do I configure it? +====================== + +1. Configure it in config by selecting + +CONFIG_MFD_CORE=y +CONFIG_MFD_AS3722=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_AS3722=y +CONFIG_GPIO_AS3722=y +CONFIG_RTC_DRV_AS3722=y + +2. Configure the driver according to the schematic by filling out the +as3722_platform_data. Additionally regulator initial data and initial register +setup can be done here. Add it to the list of attached devices when +registering the proper i2c bus. + +Testing Regulators: +=================== + +# insmod as3722-core.ko +# insmod as3722-regulators.ko + +Regulators using the linux kernel regulator framework can be found at +/sys/class/regulator. Via sysfs its possible to get some status information: + +# cd /sys/class/regulator/regulator.9 +# ls +# ls +device microvolts num_users type +max_microamps min_microamps power uevent +max_microvolts min_microvolts state +microamps name subsystem + +We can perform the testing by using the as3722-test.ko modules which provides +a testframework to userspace: + +Mount debugfs +# mount -t debugfs none /sys/kernel/debug/ + +Load test modules (needed for regulator tests) +# insmod as3722-test.ko + +Use the provided test-scripts. Transfer the scripts and the respective +command text files to the rowboat board via adb: + +(win cygwin) $ adb shell mkdir -p /testing/ && adb push regtest.sh /testing/regtest.sh +(win cygwin) $ adb push test-dig-ldo.txt /testing/test-dig-ldo.txt + +Run the script on the beagle-board testing the ldo3: +# sh /testing/regtest.sh as3722-ldo3 /testing/test-dig-ldo.txt + +Example testing the sd1 (using test-sd.txt): +# sh /testing/regtest.sh as3722-sd1 /testing/test-sd.txt + +Testing gpio: +============= +For testing the gpio framework the sysFS functions are used. Of course +all gpio framework functionality exists as well. +# cd /sys/class/gpio/ + +Now "export" and "unexport" files should be available. Use export function +to create a gpio211 node for GPIO #211 if that is not requested by kernel +code yet. (GPIO #211 is used as an example number, please substitute with +a valid AS3722 gpio number): +# echo 211 > export + +The gpio signal for gpio #211 should now be available at: +# ls /sys/class/gpio/gpio211/ +direction edge +value active_low + +This gpio framework files may now be used to setup and test the gpio. +Please refer to gpio.txt documentation on how to use the gpio framework +attributes. + +Testing rtc: +============ +The sysfs interface under /sys/class/rtc/rtcN provides access to various +rtc attributes without requiring the use of ioctls. All dates and times +are in the RTC's timezone, rather than in system time. +# cd /sys/class/rtc/rtc0/ +date max_user_freq since_epoch wakealarm +hctosys name time + +In order to set the current time or alarm time, IOCTL interface should +be used. The ioctl calls are supported by /dev/rtc and by the RTC class +framework. + +To test the rtc via IOCTL interface calls, the file rtctest.c copied from +kernel/Documentation/rtc.txt can be used. + -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

