Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 355090
b: refs/heads/master
c: 027fcd5
h: refs/heads/master
v: v3
  • Loading branch information
Chanwoo Choi committed Feb 13, 2013
1 parent 047e727 commit 652b052
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 07c70503a420d48402b3859e2c1c4c847a130a8b
refs/heads/master: 027fcd50500fd87847891d5c2f341c1f002de3e8
42 changes: 42 additions & 0 deletions trunk/drivers/extcon/extcon-max8997.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@

#define DEV_NAME "max8997-muic"

enum max8997_muic_adc_debounce_time {
ADC_DEBOUNCE_TIME_0_5MS = 0, /* 0.5ms */
ADC_DEBOUNCE_TIME_10MS, /* 10ms */
ADC_DEBOUNCE_TIME_25MS, /* 25ms */
ADC_DEBOUNCE_TIME_38_62MS, /* 38.62ms */
};

struct max8997_muic_irq {
unsigned int irq;
const char *name;
Expand Down Expand Up @@ -94,6 +101,38 @@ static const char *max8997_extcon_cable[] = {
NULL,
};

/*
* max8997_muic_set_debounce_time - Set the debounce time of ADC
* @info: the instance including private data of max8997 MUIC
* @time: the debounce time of ADC
*/
static int max8997_muic_set_debounce_time(struct max8997_muic_info *info,
enum max8997_muic_adc_debounce_time time)
{
int ret;

switch (time) {
case ADC_DEBOUNCE_TIME_0_5MS:
case ADC_DEBOUNCE_TIME_10MS:
case ADC_DEBOUNCE_TIME_25MS:
case ADC_DEBOUNCE_TIME_38_62MS:
ret = max8997_update_reg(info->muic,
MAX8997_MUIC_REG_CONTROL3,
time << CONTROL3_ADCDBSET_SHIFT,
CONTROL3_ADCDBSET_MASK);
if (ret) {
dev_err(info->dev, "failed to set ADC debounce time\n");
return -EAGAIN;
}
break;
default:
dev_err(info->dev, "invalid ADC debounce time\n");
return -EINVAL;
}

return 0;
};

/*
* max8997_muic_set_path - Set hardware line according to attached cable
* @info: the instance including private data of max8997 MUIC
Expand Down Expand Up @@ -507,6 +546,9 @@ static int max8997_muic_probe(struct platform_device *pdev)
}
}

/* Set ADC debounce time */
max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS);

/* Initial device detection */
max8997_muic_detect_dev(info);

Expand Down
7 changes: 7 additions & 0 deletions trunk/include/linux/mfd/max8997-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ enum max8997_muic_reg {
#define CONTROL2_USBCPINT_MASK (0x1 << CONTROL2_USBCPINT_SHIFT)
#define CONTROL2_RCPS_MASK (0x1 << CONTROL2_RCPS_SHIFT)

#define CONTROL3_JIGSET_SHIFT (0)
#define CONTROL3_BTLDSET_SHIFT (2)
#define CONTROL3_ADCDBSET_SHIFT (4)
#define CONTROL3_JIGSET_MASK (0x3 << CONTROL3_JIGSET_SHIFT)
#define CONTROL3_BTLDSET_MASK (0x3 << CONTROL3_BTLDSET_SHIFT)
#define CONTROL3_ADCDBSET_MASK (0x3 << CONTROL3_ADCDBSET_SHIFT)

#define MAX8997_ADC_GROUND 0x00
#define MAX8997_ADC_MHL 0x01
#define MAX8997_ADC_JIG_USB_1 0x18
Expand Down

0 comments on commit 652b052

Please sign in to comment.