mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 22:23:27 +00:00
c931b21161
SVN-Revision: 13619
117 lines
3.2 KiB
Diff
Executable File
117 lines
3.2 KiB
Diff
Executable File
From 897069d6ec20d26b29e4f71264e2c68de8a93053 Mon Sep 17 00:00:00 2001
|
|
From: Andy Green <andy@openmoko.com>
|
|
Date: Fri, 25 Jul 2008 23:06:11 +0100
|
|
Subject: [PATCH] introduce-pcf50633-resume-dependency-list.patch
|
|
|
|
Adds resume dependency support to pcf50633
|
|
|
|
Signed-off-by: Andy Green <andy@openmoko.com>
|
|
---
|
|
drivers/i2c/chips/pcf50633.c | 26 ++++++++++++++++++++++++--
|
|
include/linux/pcf50633.h | 6 ++++++
|
|
2 files changed, 30 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
|
|
index 38cabd2..e477cd7 100644
|
|
--- a/drivers/i2c/chips/pcf50633.c
|
|
+++ b/drivers/i2c/chips/pcf50633.c
|
|
@@ -53,6 +53,7 @@
|
|
#include <asm/arch/gta02.h>
|
|
|
|
#include "pcf50633.h"
|
|
+#include <linux/resume-dependency.h>
|
|
|
|
#if 1
|
|
#define DEBUGP(x, args ...) printk("%s: " x, __FUNCTION__, ## args)
|
|
@@ -167,6 +168,9 @@ struct pcf50633_data {
|
|
u_int8_t ena;
|
|
} ldo[__NUM_PCF50633_REGS];
|
|
} standby_regs;
|
|
+
|
|
+ struct resume_dependency resume_dependency;
|
|
+
|
|
#endif
|
|
};
|
|
|
|
@@ -1924,6 +1928,8 @@ static int pcf50633_detect(struct i2c_adapter *adapter, int address, int kind)
|
|
|
|
pcf50633_global = data;
|
|
|
|
+ init_resume_dependency_list(data->resume_dependency);
|
|
+
|
|
populate_sysfs_group(data);
|
|
|
|
err = sysfs_create_group(&new_client->dev.kobj, &pcf_attr_group);
|
|
@@ -2132,6 +2138,17 @@ int pcf50633_report_resumers(struct pcf50633_data *pcf, char *buf)
|
|
|
|
#ifdef CONFIG_PM
|
|
|
|
+/*
|
|
+ * we need to export this because pcf50633_data is kept opaque
|
|
+ */
|
|
+
|
|
+void pcf50633_register_resume_dependency(struct pcf50633_data *pcf,
|
|
+ struct pcf50633_resume_dependency *dep)
|
|
+{
|
|
+ register_resume_dependency(pcf->resume_dependency, dep);
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(pcf50633_register_resume_dep);
|
|
+
|
|
|
|
static int pcf50633_suspend(struct device *dev, pm_message_t state)
|
|
{
|
|
@@ -2223,8 +2240,11 @@ static int pcf50633_resume(struct device *dev)
|
|
struct i2c_client *client = to_i2c_client(dev);
|
|
struct pcf50633_data *pcf = i2c_get_clientdata(client);
|
|
int i;
|
|
+ struct list_head *pos, *q;
|
|
+ struct pcf50633_resume_dependency *dep;
|
|
+
|
|
|
|
- /* mutex_lock(&pcf->lock); */ /* resume in atomic context */
|
|
+ mutex_lock(&pcf->lock);
|
|
|
|
__reg_write(pcf, PCF50633_REG_LEDENA, 0x01);
|
|
|
|
@@ -2263,10 +2283,12 @@ static int pcf50633_resume(struct device *dev)
|
|
__reg_write(pcf, reg_out+1, pcf->standby_regs.ldo[i].ena);
|
|
}
|
|
|
|
- /* mutex_unlock(&pcf->lock); */ /* resume in atomic context */
|
|
+ mutex_unlock(&pcf->lock);
|
|
|
|
pcf50633_irq(pcf->irq, pcf);
|
|
|
|
+ callback_all_resume_dependencies(pcf->resume_dependency);
|
|
+
|
|
return 0;
|
|
}
|
|
#else
|
|
diff --git a/include/linux/pcf50633.h b/include/linux/pcf50633.h
|
|
index c0fdbe8..2bef616 100644
|
|
--- a/include/linux/pcf50633.h
|
|
+++ b/include/linux/pcf50633.h
|
|
@@ -2,6 +2,7 @@
|
|
#define _LINUX_PCF50633_H
|
|
|
|
#include <linux/pcf506xx.h>
|
|
+#include <linux/resume-dependency.h>
|
|
|
|
|
|
/* public in-kernel pcf50633 api */
|
|
@@ -124,6 +125,11 @@ pcf50633_battvolt(struct pcf50633_data *pcf);
|
|
extern int
|
|
pcf50633_report_resumers(struct pcf50633_data *pcf, char *buf);
|
|
|
|
+extern void
|
|
+pcf50633_register_resume_dependency(struct pcf50633_data *pcf,
|
|
+ struct pcf50633_resume_dependency *dep);
|
|
+
|
|
+
|
|
#define PCF50633_FEAT_EXTON 0x00000001 /* not yet supported */
|
|
#define PCF50633_FEAT_MBC 0x00000002
|
|
#define PCF50633_FEAT_BBC 0x00000004 /* not yet supported */
|
|
--
|
|
1.5.6.3
|
|
|