All of lore.kernel.org
 help / color / mirror / Atom feed
From: 함명주 <myungjoo.ham@samsung.com>
To: "Mark Brown" <broonie@opensource.wolfsonmicro.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	박경민 <kyungmin.park@samsung.com>
Cc: "patches@opensource.wolfsonmicro.com" 
	<patches@opensource.wolfsonmicro.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Extcon: Arizona: Add driver for Wolfson Arizona class devices
Date: Mon, 25 Jun 2012 04:48:23 +0000 (GMT)	[thread overview]
Message-ID: <14300735.10471340599701741.JavaMail.weblogic@epv6ml01> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 4163 bytes --]

> Most Wolfson Arizona class audio hub CODECs include a flexible ultra low
> power accessory detection subsystem. This driver exposes initial support
> for this subsystem via the Extcon framework, implementing support for
> ultra low power detection of headphone and headset with the ability to
> detect the polarity of a headset.
> 
> The functionality of the devices is much richer and more flexible than
> the current driver, future patches will extend the features of the
> driver to more fully exploit this.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---

Hello,

> +static void arizona_start_mic(struct arizona_extcon_info *info)
> +{
> +	struct arizona *arizona = info->arizona;
> +	bool change;
> +	int ret;
> +
> +	info->detecting = true;
> +	info->mic = false;
> +	info->jack_flips = 0;
> +
> +	/* Microphone detection can't use idle mode */
> +	pm_runtime_get(info->dev);

Is it alright to use asynchronous get here?
(sync not required?)

> +
> +	ret = regulator_enable(info->micvdd);
> +	if (ret != 0) {
> +		dev_err(arizona->dev, "Failed to enable MICVDD: %d\n",
> +			ret);
> +	}
> +
> +	if (info->micd_reva) {
> +		regmap_write(arizona->regmap, 0x80, 0x3);
> +		regmap_write(arizona->regmap, 0x294, 0);
> +		regmap_write(arizona->regmap, 0x80, 0x0);
> +	}
> +
> +	regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1,
> +				 ARIZONA_MICD_ENA, ARIZONA_MICD_ENA,
> +				 &change);
> +	if (!change) {
> +		regulator_disable(info->micvdd);
> +		pm_runtime_put_autosuspend(info->dev);
> +	}
> +}
> +

[]

> +static int __devinit arizona_extcon_probe(struct platform_device *pdev)
> +{
> +	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
> +	struct arizona_pdata *pdata;
> +	struct arizona_extcon_info *info;
> +	int ret, mode;
> +
> +	pdata = dev_get_platdata(arizona->dev);
> +
> +	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
> +	if (!info) {
> +		dev_err(&pdev->dev, "failed to allocate memory\n");
> +		ret = -ENOMEM;
> +		goto err;
> +	}
> +
> +	info->micvdd = devm_regulator_get(arizona->dev, "MICVDD");
> +	if (IS_ERR(info->micvdd)) {
> +		ret = PTR_ERR(info->micvdd);
> +		dev_err(arizona->dev, "Failed to get MICVDD: %d\n", ret);
> +		goto err;
> +	}
> +
> +	mutex_init(&info->lock);
> +	info->arizona = arizona;
> +	info->dev = &pdev->dev;
> +	info->detecting = true;
> +	platform_set_drvdata(pdev, info);
> +
> +	switch (arizona->type) {
> +	case WM5102:
> +		switch (arizona->rev) {
> +		case 0:
> +			info->micd_reva = true;
> +			break;
> +		default:
> +			break;
> +		}
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	info->edev.name = "Headset Jack";
> +	info->edev.supported_cable = arizona_cable;
> +	info->edev.mutually_exclusive = arizona_exclusions;
> +
> +	ret = extcon_dev_register(&info->edev, arizona->dev);
> +	if (ret < 0) {
> +		dev_err(arizona->dev, "extcon_dev_regster() failed: %d\n",
> +			ret);
> +		goto err;
> +	}
> +
> +	if (pdata->num_micd_configs) {
> +		info->micd_modes = pdata->micd_configs;
> +		info->micd_num_modes = pdata->num_micd_configs;
> +	} else {
> +		info->micd_modes = micd_default_modes;
> +		info->micd_num_modes = ARRAY_SIZE(micd_default_modes);
> +	}
> +
> +	if (arizona->pdata.micd_pol_gpio > 0) {
> +		if (info->micd_modes[0].gpio)
> +			mode = GPIOF_OUT_INIT_HIGH;
> +		else
> +			mode = GPIOF_OUT_INIT_LOW;
> +
> +		ret = devm_gpio_request_one(&pdev->dev,
> +					    arizona->pdata.micd_pol_gpio,
> +					    mode,
> +					    "MICD polarity");
> +		if (ret != 0) {
> +			dev_err(arizona->dev, "Failed to request GPIO%d: %d\n",
> +				arizona->pdata.micd_pol_gpio, ret);
> +			goto err_register;
> +		}
> +	}
> +
> +	arizona_extcon_set_mode(info, 0);
> +
> +	pm_runtime_enable(&pdev->dev);
> +	pm_runtime_idle(&pdev->dev);
> +	pm_runtime_get_sync(&pdev->dev);
> +
> +	ret = arizona_request_irq(arizona, ARIZONA_IRQ_JD_RISE,
> +				  "JACKDET rise", arizona_jackdet, info);

Is this arizone_request_irq using threaded irq? (it's fine if so)


Cheers!
MyungJoo.
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

             reply	other threads:[~2012-06-25  4:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-25  4:48 함명주 [this message]
2012-06-25  8:51 ` [PATCH] Extcon: Arizona: Add driver for Wolfson Arizona class devices Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2012-06-28  2:08 MyungJoo Ham
2012-06-28 10:17 ` Mark Brown
2012-06-24 11:09 Mark Brown

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=14300735.10471340599701741.JavaMail.weblogic@epv6ml01 \
    --to=myungjoo.ham@samsung.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.