Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330502
b: refs/heads/master
c: 60fd57e
h: refs/heads/master
v: v3
  • Loading branch information
Kim, Milo authored and Anton Vorontsov committed Sep 21, 2012
1 parent a185b21 commit cccc755
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 318cb389d020e3107979d7d794ab992e4bcd6665
refs/heads/master: 60fd57e06ed7ea13bc0bdf4cb5324d47039105ab
12 changes: 9 additions & 3 deletions trunk/drivers/power/lp8727_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <linux/power_supply.h>
#include <linux/platform_data/lp8727.h>

#define DEBOUNCE_MSEC 270
#define DEFAULT_DEBOUNCE_MSEC 270

/* Registers */
#define CTRL1 0x1
Expand Down Expand Up @@ -90,6 +90,7 @@ struct lp8727_chg {
struct lp8727_psy *psy;
struct lp8727_chg_param *chg_parm;
enum lp8727_dev_id devid;
unsigned long debounce_jiffies;
};

static int lp8727_read_bytes(struct lp8727_chg *pchg, u8 reg, u8 *data, u8 len)
Expand Down Expand Up @@ -236,15 +237,18 @@ static void lp8727_delayed_func(struct work_struct *_work)
static irqreturn_t lp8727_isr_func(int irq, void *ptr)
{
struct lp8727_chg *pchg = ptr;
unsigned long delay = msecs_to_jiffies(DEBOUNCE_MSEC);

queue_delayed_work(pchg->irqthread, &pchg->work, delay);
queue_delayed_work(pchg->irqthread, &pchg->work,
pchg->debounce_jiffies);

return IRQ_HANDLED;
}

static int lp8727_intr_config(struct lp8727_chg *pchg)
{
unsigned delay_msec = pchg->pdata ? pchg->pdata->debounce_msec :
DEFAULT_DEBOUNCE_MSEC;

INIT_DELAYED_WORK(&pchg->work, lp8727_delayed_func);

pchg->irqthread = create_singlethread_workqueue("lp8727-irqthd");
Expand All @@ -253,6 +257,8 @@ static int lp8727_intr_config(struct lp8727_chg *pchg)
return -ENOMEM;
}

pchg->debounce_jiffies = msecs_to_jiffies(delay_msec);

return request_threaded_irq(pchg->client->irq,
NULL,
lp8727_isr_func,
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/platform_data/lp8727.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct lp8727_chg_param {
* @get_batt_temp : get battery temperature
* @ac : charging parameters for AC type charger
* @usb : charging parameters for USB type charger
* @debounce_msec : interrupt debounce time
*/
struct lp8727_platform_data {
u8 (*get_batt_present)(void);
Expand All @@ -61,6 +62,7 @@ struct lp8727_platform_data {
u8 (*get_batt_temp)(void);
struct lp8727_chg_param *ac;
struct lp8727_chg_param *usb;
unsigned int debounce_msec;
};

#endif

0 comments on commit cccc755

Please sign in to comment.