From: Chanwoo Choi <cw00.choi@samsung.com>
To: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Cc: myungjoo.ham@samsung.com, sameo@linux.intel.com,
lee.jones@linaro.org, broonie@linaro.org,
ckeepax@opensource.wolfsonmicro.com,
linux-kernel@vger.kernel.org,
patches@opensource.wolfsonmicro.com
Subject: Re: [PATCH] extcon: arizona: support inverted jack detect switch
Date: Wed, 21 May 2014 11:18:20 +0900 [thread overview]
Message-ID: <537C0CEC.5080406@samsung.com> (raw)
In-Reply-To: <20140520115632.GA13900@opensource.wolfsonmicro.com>
Hi Richard,
On 05/20/2014 08:56 PM, Richard Fitzgerald wrote:
> Add pdata option for inverted jack detect switch that
> opens when jack is inserted.
>
> Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
> ---
> drivers/extcon/extcon-arizona.c | 29 +++++++++++++++++++++--------
> include/linux/mfd/arizona/pdata.h | 3 +++
> 2 files changed, 24 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index 98a14f6..af926b9 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -962,10 +962,16 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
>
> if (arizona->pdata.jd_gpio5) {
> mask = ARIZONA_MICD_CLAMP_STS;
> - present = 0;
> + if (arizona->pdata.jd_invert)
> + present = ARIZONA_MICD_CLAMP_STS;
> + else
> + present = 0;
> } else {
> mask = ARIZONA_JD1_STS;
> - present = ARIZONA_JD1_STS;
> + if (arizona->pdata.jd_invert)
> + present = 0;
> + else
> + present = ARIZONA_JD1_STS;
> }
>
> ret = regmap_read(arizona->regmap, ARIZONA_AOD_IRQ_RAW_STATUS, &val);
> @@ -1096,6 +1102,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
> struct arizona_pdata *pdata = &arizona->pdata;
> struct arizona_extcon_info *info;
> unsigned int val;
> + unsigned int clamp_mode;
> int jack_irq_fall, jack_irq_rise;
> int ret, mode, i, j;
>
> @@ -1302,16 +1309,22 @@ static int arizona_extcon_probe(struct platform_device *pdev)
> regmap_write(arizona->regmap, ARIZONA_GPIO5_CTRL,
> val);
>
> - regmap_update_bits(arizona->regmap,
> - ARIZONA_MICD_CLAMP_CONTROL,
> - ARIZONA_MICD_CLAMP_MODE_MASK, 0x9);
> + if (arizona->pdata.jd_invert)
> + clamp_mode = 0xb;
What is meaning of '0xb'?
I prefer to use defined constant instead of using hex value directly.
For exmaple,
#define XXX_CLAMP_MODE 0xb
> + else
> + clamp_mode = 0x9;
ditto.
> } else {
> - regmap_update_bits(arizona->regmap,
> - ARIZONA_MICD_CLAMP_CONTROL,
> - ARIZONA_MICD_CLAMP_MODE_MASK, 0x4);
> + if (arizona->pdata.jd_invert)
> + clamp_mode = 0x5;
ditto.
> + else
> + clamp_mode = 0x4;
ditto.
> }
>
> regmap_update_bits(arizona->regmap,
> + ARIZONA_MICD_CLAMP_CONTROL,
> + ARIZONA_MICD_CLAMP_MODE_MASK, clamp_mode);
> +
> + regmap_update_bits(arizona->regmap,
> ARIZONA_JACK_DETECT_DEBOUNCE,
> ARIZONA_MICD_CLAMP_DB,
> ARIZONA_MICD_CLAMP_DB);
> diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
> index 12a5c13..4578c72 100644
> --- a/include/linux/mfd/arizona/pdata.h
> +++ b/include/linux/mfd/arizona/pdata.h
> @@ -127,6 +127,9 @@ struct arizona_pdata {
> /** Internal pull on GPIO5 is disabled when used for jack detection */
> bool jd_gpio5_nopull;
>
> + /** set to true if jackdet contact opens on insert */
> + bool jd_invert;
> +
> /** Use the headphone detect circuit to identify the accessory */
> bool hpdet_acc_id;
>
>
Thanks,
Chanwoo Choi
next prev parent reply other threads:[~2014-05-21 2:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 11:56 Richard Fitzgerald
2014-05-20 12:10 ` Lee Jones
2014-05-21 2:18 ` Chanwoo Choi [this message]
2014-05-23 11:54 ` [PATCH V2] " Richard Fitzgerald
2014-05-23 12:39 ` Lee Jones
2014-05-28 4:43 ` Chanwoo Choi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=537C0CEC.5080406@samsung.com \
--to=cw00.choi@samsung.com \
--cc=broonie@linaro.org \
--cc=ckeepax@opensource.wolfsonmicro.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=patches@opensource.wolfsonmicro.com \
--cc=rf@opensource.wolfsonmicro.com \
--cc=sameo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome