pmu相关常用函数:
#include <linux/regulator/machine.h>
static struct regulator *regulator_LDO23;
regulator_LDO23 = regulator_get(NULL, "LCD_3V3");
if (IS_ERR(regulator_LDO23)) {
printk("failed to get resource %s\n", "LCD_3V3\n");
}
if(blank_mode == FB_BLANK_POWERDOWN) {
regulator_disable(regulator_LDO23);
printk(" Disable LCD_3V3\n");
}
regulator_put(regulator_LDO23);
regulator_LDO23 = ERR_PTR(-ENODEV);
regulator_LDO23 = regulator_get(NULL, "LCD_3V3");
if (IS_ERR(regulator_LDO23)) {
printk("failed to get resource %s\n", "LCD_3V3\n");
}
regulator_enable(regulator_LDO23);
printk(" Enable LCD_3V3\n");
regulator_put(regulator_LDO23);
regulator_LDO23 = ERR_PTR(-ENODEV);
######################################################################
#include <linux/wakelock.h>
struct wake_lock vbus_wake_lock;
wake_lock_init(&vbus_wake_lock, WAKE_LOCK_SUSPEND, "vbus_present");
wake_lock(&vbus_wake_lock);
wake_lock_timeout(&vbus_wake_lock, HZ / 2);
wake_unlock(&vbus_wake_lock);
#####################################################################
#include <linux/workqueue.h>
struct delayed_work charge_curr_work;
INIT_DELAYED_WORK_DEFERRABLE(&charge_curr_work, change_curr_work);
static void change_curr_work(struct work_struct *work)
{
}
schedule_delayed_work(&data->charge_curr_work, 5000);
####################################################################
#define PQ24166_DEBUG 0
void bq24166_DEBUG (char *format, ...){
#if PQ24166_DEBUG
char buf[512];
va_list arg_pt;
va_start(arg_pt, format);
vsprintf(buf,format,arg_pt);
printk("PQ24166_DEBUG:: %s",buf);
#endif
}
bq24166_DEBUG("+++Supply-IN disconnected\n");
####################################################################
irq_set_irq_wake(gpio_to_irq(CHARGE_USB), 1);
####################################################################
#include <plat/gpio-cfg.h>
#include <linux/gpio.h>
err = gpio_request(EXYNOS5_GPY5(5), "GPD5");
if (err)
printk(KERN_ERR "#### failed to request GPD5_5 ####\n");
s3c_gpio_setpull(EXYNOS5_GPY5(5), S3C_GPIO_PULL_NONE);
gpio_direction_output(EXYNOS5_GPY5(5), 0);
gpio_free(EXYNOS5_GPY5(5));