Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354948
b: refs/heads/master
c: 297620f
h: refs/heads/master
v: v3
  • Loading branch information
Chanwoo Choi committed Jan 15, 2013
1 parent 2b336b6 commit da5d5c8
Show file tree
Hide file tree
Showing 3 changed files with 37 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: 39bf369e4ed321158eb8dc5031b4a9f2108ea614
refs/heads/master: 297620fd1e14edf5fefa1736f873b9228336eee1
37 changes: 34 additions & 3 deletions trunk/drivers/extcon/extcon-max77693.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/irqdomain.h>

#define DEV_NAME "max77693-muic"
#define DELAY_MS_DEFAULT 20000 /* unit: millisecond */

enum max77693_muic_adc_debounce_time {
ADC_DEBOUNCE_TIME_5MS = 0,
Expand All @@ -52,6 +53,14 @@ struct max77693_muic_info {
struct work_struct irq_work;
struct mutex mutex;

/*
* Use delayed workqueue to detect cable state and then
* notify cable state to notifiee/platform through uevent.
* After completing the booting of platform, the extcon provider
* driver should notify cable state to upper layer.
*/
struct delayed_work wq_detcable;

/* Button of dock device */
struct input_dev *dock;
};
Expand Down Expand Up @@ -912,13 +921,23 @@ static int max77693_muic_detect_accessory(struct max77693_muic_info *info)
return ret;
}

static void max77693_muic_detect_cable_wq(struct work_struct *work)
{
struct max77693_muic_info *info = container_of(to_delayed_work(work),
struct max77693_muic_info, wq_detcable);

max77693_muic_detect_accessory(info);
}

static int max77693_muic_probe(struct platform_device *pdev)
{
struct max77693_dev *max77693 = dev_get_drvdata(pdev->dev.parent);
struct max77693_platform_data *pdata = dev_get_platdata(max77693->dev);
struct max77693_muic_platform_data *muic_pdata = pdata->muic_data;
struct max77693_muic_info *info;
int ret, i;
int delay_jiffies;
int ret;
int i;
u8 id;

info = devm_kzalloc(&pdev->dev, sizeof(struct max77693_muic_info),
Expand Down Expand Up @@ -1051,8 +1070,20 @@ static int max77693_muic_probe(struct platform_device *pdev)
/* Set ADC debounce time */
max77693_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS);

/* Detect accessory on boot */
max77693_muic_detect_accessory(info);
/*
* Detect accessory after completing the initialization of platform
*
* - Use delayed workqueue to detect cable state and then
* notify cable state to notifiee/platform through uevent.
* After completing the booting of platform, the extcon provider
* driver should notify cable state to upper layer.
*/
INIT_DELAYED_WORK(&info->wq_detcable, max77693_muic_detect_cable_wq);
if (muic_pdata->detcable_delay_ms)
delay_jiffies = msecs_to_jiffies(muic_pdata->detcable_delay_ms);
else
delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
schedule_delayed_work(&info->wq_detcable, delay_jiffies);

return ret;

Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/mfd/max77693.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ struct max77693_reg_data {
struct max77693_muic_platform_data {
struct max77693_reg_data *init_data;
int num_init_data;

int detcable_delay_ms;
};

struct max77693_platform_data {
Expand Down

0 comments on commit da5d5c8

Please sign in to comment.