diff options
| author | Chanwoo Choi <cw00.choi@samsung.com> | 2013-02-12 18:50:00 -0500 |
|---|---|---|
| committer | Chanwoo Choi <cw00.choi@samsung.com> | 2013-02-13 17:54:09 -0500 |
| commit | 027fcd50500fd87847891d5c2f341c1f002de3e8 (patch) | |
| tree | 32fd5d9c9ce5ccd99e3d43e524f8504af2dd6010 /drivers/extcon | |
| parent | 07c70503a420d48402b3859e2c1c4c847a130a8b (diff) | |
extcon: max8997: Set default of ADC debounce time during initialization
This patch set default of ADC Debounce Time(25ms) during probe step.
Also, can possible change ADC Debounce Time according to H/W situation
by using max8997_set_adc_debounce_time()
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/extcon')
| -rw-r--r-- | drivers/extcon/extcon-max8997.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index 8739b50c2b36..3206daaf8e08 100644 --- a/drivers/extcon/extcon-max8997.c +++ b/drivers/extcon/extcon-max8997.c | |||
| @@ -30,6 +30,13 @@ | |||
| 30 | 30 | ||
| 31 | #define DEV_NAME "max8997-muic" | 31 | #define DEV_NAME "max8997-muic" |
| 32 | 32 | ||
| 33 | enum max8997_muic_adc_debounce_time { | ||
| 34 | ADC_DEBOUNCE_TIME_0_5MS = 0, /* 0.5ms */ | ||
| 35 | ADC_DEBOUNCE_TIME_10MS, /* 10ms */ | ||
| 36 | ADC_DEBOUNCE_TIME_25MS, /* 25ms */ | ||
| 37 | ADC_DEBOUNCE_TIME_38_62MS, /* 38.62ms */ | ||
| 38 | }; | ||
| 39 | |||
| 33 | struct max8997_muic_irq { | 40 | struct max8997_muic_irq { |
| 34 | unsigned int irq; | 41 | unsigned int irq; |
| 35 | const char *name; | 42 | const char *name; |
| @@ -95,6 +102,38 @@ static const char *max8997_extcon_cable[] = { | |||
| 95 | }; | 102 | }; |
| 96 | 103 | ||
| 97 | /* | 104 | /* |
| 105 | * max8997_muic_set_debounce_time - Set the debounce time of ADC | ||
| 106 | * @info: the instance including private data of max8997 MUIC | ||
| 107 | * @time: the debounce time of ADC | ||
| 108 | */ | ||
| 109 | static int max8997_muic_set_debounce_time(struct max8997_muic_info *info, | ||
| 110 | enum max8997_muic_adc_debounce_time time) | ||
| 111 | { | ||
| 112 | int ret; | ||
| 113 | |||
| 114 | switch (time) { | ||
| 115 | case ADC_DEBOUNCE_TIME_0_5MS: | ||
| 116 | case ADC_DEBOUNCE_TIME_10MS: | ||
| 117 | case ADC_DEBOUNCE_TIME_25MS: | ||
| 118 | case ADC_DEBOUNCE_TIME_38_62MS: | ||
| 119 | ret = max8997_update_reg(info->muic, | ||
| 120 | MAX8997_MUIC_REG_CONTROL3, | ||
| 121 | time << CONTROL3_ADCDBSET_SHIFT, | ||
| 122 | CONTROL3_ADCDBSET_MASK); | ||
| 123 | if (ret) { | ||
| 124 | dev_err(info->dev, "failed to set ADC debounce time\n"); | ||
| 125 | return -EAGAIN; | ||
| 126 | } | ||
| 127 | break; | ||
| 128 | default: | ||
| 129 | dev_err(info->dev, "invalid ADC debounce time\n"); | ||
| 130 | return -EINVAL; | ||
| 131 | } | ||
| 132 | |||
| 133 | return 0; | ||
| 134 | }; | ||
| 135 | |||
| 136 | /* | ||
| 98 | * max8997_muic_set_path - Set hardware line according to attached cable | 137 | * max8997_muic_set_path - Set hardware line according to attached cable |
| 99 | * @info: the instance including private data of max8997 MUIC | 138 | * @info: the instance including private data of max8997 MUIC |
| 100 | * @value: the path according to attached cable | 139 | * @value: the path according to attached cable |
| @@ -507,6 +546,9 @@ static int max8997_muic_probe(struct platform_device *pdev) | |||
| 507 | } | 546 | } |
| 508 | } | 547 | } |
| 509 | 548 | ||
| 549 | /* Set ADC debounce time */ | ||
| 550 | max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS); | ||
| 551 | |||
| 510 | /* Initial device detection */ | 552 | /* Initial device detection */ |
| 511 | max8997_muic_detect_dev(info); | 553 | max8997_muic_detect_dev(info); |
| 512 | 554 | ||
