return 0;
}
+int axp_get_vbus(void)
+{
+ int ret;
+ u8 val;
+
+ ret = axp221_init();
+ if (ret)
+ return ret;
+
+ ret = pmic_bus_read(AXP221_POWER_STATUS, &val);
+ if (ret)
+ return ret;
+
+ return (val & AXP221_POWER_STATUS_VBUS_USABLE) ? 1 : 0;
+}
+
static int axp_drivebus_setup(void)
{
int ret;
#define AXP223_RUNTIME_ADDR 0x2d
/* Page 0 addresses */
+#define AXP221_POWER_STATUS 0x00
+#define AXP221_POWER_STATUS_VBUS_AVAIL (1 << 5)
+#define AXP221_POWER_STATUS_VBUS_USABLE (1 << 4)
#define AXP221_CHIP_ID 0x03
#define AXP221_OUTPUT_CTRL1 0x10
#define AXP221_OUTPUT_CTRL1_DCDC0_EN (1 << 0)
/* Page 1 addresses */
#define AXP221_SID 0x20
+/* We support vbus detection */
+#define AXP_VBUS_DETECT
+
/* We support drivebus control */
#define AXP_DRIVEBUS
int axp221_set_eldo(int eldo_num, unsigned int mvolt);
int axp221_init(void);
int axp221_get_sid(unsigned int *sid);
+int axp_get_vbus(void);
int axp_drivebus_enable(void);
int axp_drivebus_disable(void);