Messages in this thread |  | | | Date | Mon, 25 Jun 2012 04:48:23 +0000 (GMT) | | From | 함명주 <> | | Subject | Re: [PATCH] Extcon: Arizona: Add driver for Wolfson Arizona class devices |
| |
> 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.
|  |