]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
power: Export register access functions from as3722
authorSimon Glass <sjg@chromium.org>
Wed, 15 Apr 2015 03:03:26 +0000 (21:03 -0600)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:39:34 +0000 (22:39 +0200)
With the full PMIC framework we may be able to avoid this. But for now
we need access to the PMIC.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
drivers/power/as3722.c
include/power/as3722.h

index a60bb5f83fbc5cda5a5533b3893f85e47d450c0a..c09e1de06f4c51147968978da7234a3aab7db617 100644 (file)
@@ -27,7 +27,7 @@
 #define  AS3722_DEVICE_ID 0x0c
 #define AS3722_ASIC_ID2 0x91
 
-static int as3722_read(struct udevice *pmic, u8 reg, u8 *value)
+int as3722_read(struct udevice *pmic, u8 reg, u8 *value)
 {
        int err;
 
@@ -38,7 +38,7 @@ static int as3722_read(struct udevice *pmic, u8 reg, u8 *value)
        return 0;
 }
 
-static int as3722_write(struct udevice *pmic, u8 reg, u8 value)
+int as3722_write(struct udevice *pmic, u8 reg, u8 value)
 {
        int err;
 
@@ -234,6 +234,15 @@ int as3722_gpio_direction_output(struct udevice *pmic, unsigned int gpio,
        return 0;
 }
 
+/* Temporary function until we get the pmic framework */
+int as3722_get(struct udevice **devp)
+{
+       int bus = 0;
+       int address = 0x40;
+
+       return i2c_get_chip_for_busnum(bus, address, 1, devp);
+}
+
 int as3722_init(struct udevice **devp)
 {
        struct udevice *pmic;
@@ -258,7 +267,8 @@ int as3722_init(struct udevice **devp)
 
        debug("AS3722 revision %#x found on I2C bus %u, address %#x\n",
              revision, bus, address);
-       *devp = pmic;
+       if (devp)
+               *devp = pmic;
 
        return 0;
 }
index aa966d2cca1ee4373fc1ab87076ed84327205329..0f22482ff705f4cb7c3c5c9ae70b963e5415d55f 100644 (file)
@@ -23,5 +23,8 @@ int as3722_gpio_configure(struct udevice *pmic, unsigned int gpio,
                          unsigned long flags);
 int as3722_gpio_direction_output(struct udevice *pmic, unsigned int gpio,
                                 unsigned int level);
+int as3722_read(struct udevice *pmic, u8 reg, u8 *value);
+int as3722_write(struct udevice *pmic, u8 reg, u8 value);
+int as3722_get(struct udevice **devp);
 
 #endif /* __POWER_AS3722_H__ */