Esempio n. 1
0
static int wm8350_remove(struct platform_device *pdev)
{
	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
	struct snd_soc_codec *codec = socdev->card->codec;
	struct wm8350 *wm8350 = codec->control_data;
	struct wm8350_data *priv = codec->private_data;
	int ret;

	wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,
			  WM8350_JDL_ENA | WM8350_JDR_ENA);
	wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA);

	wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L);
	wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R);

	priv->hpl.jack = NULL;
	priv->hpr.jack = NULL;

	/* cancel any work waiting to be queued. */
	ret = cancel_delayed_work(&codec->delayed_work);

	/* if there was any work waiting then we run it now and
	 * wait for its completion */
	if (ret) {
		schedule_delayed_work(&codec->delayed_work, 0);
		flush_scheduled_work();
	}

	wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF);

	wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);

	return 0;
}
void wm8350_free(struct wm8350 *wm8350)
{
#if BATTERY
    struct wm8350_power *power = &wm8350->power;
#endif

    wm8350_mask_irq(wm8350, WM8350_IRQ_GPIO(7));
    wm8350_free_irq(wm8350, WM8350_IRQ_GPIO(7));
    wm8350_mask_irq(wm8350, WM8350_IRQ_WKUP_ONKEY);
    wm8350_free_irq(wm8350, WM8350_IRQ_WKUP_ONKEY);

#if BATTERY
    wm8350_charger_enable(power, 0);
    wm8350_fast_charger_enable(power, 0);
#endif
    if (wm8350->nirq)
        free_irq(wm8350->nirq, wm8350);

    flush_scheduled_work();

    if (wm8350->pmic.dev.is_registered)
        device_unregister(&wm8350->pmic.dev);
    if (wm8350->rtc.dev.is_registered)
        device_unregister(&wm8350->rtc.dev);
    if (wm8350->wdg.dev.is_registered)
        device_unregister(&wm8350->wdg.dev);
    if (wm8350->power.dev.is_registered)
        device_unregister(&wm8350->power.dev);

    platform_device_unregister(imx_snd_device);
}
Esempio n. 3
0
static int wm8350_rtc_remove(struct platform_device *pdev)
{
	struct wm8350 *wm8350 = platform_get_drvdata(pdev);

	wm8350_free_irq(wm8350, WM8350_IRQ_RTC_SEC, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_RTC_ALM, wm8350);

	return 0;
}
static int __devexit wm8350_rtc_remove(struct platform_device *pdev)
{
	struct wm8350 *wm8350 = platform_get_drvdata(pdev);
	struct wm8350_rtc *wm_rtc = &wm8350->rtc;

	wm8350_free_irq(wm8350, WM8350_IRQ_RTC_SEC, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_RTC_ALM, wm8350);

	rtc_device_unregister(wm_rtc->rtc);

	return 0;
}
Esempio n. 5
0
static int wm8350_regulator_remove(struct platform_device *pdev)
{
	struct regulator_dev *rdev = platform_get_drvdata(pdev);
	struct wm8350 *wm8350 = rdev_get_drvdata(rdev);

	wm8350_free_irq(wm8350, wm8350_reg[pdev->id].irq, rdev);

	return 0;
}
static int imx_3stack_wm8350_remove(struct platform_device *pdev)
{
	struct imx_3stack_priv *priv = &machine_priv;
	struct wm8350 *wm8350 = priv->wm8350;

	wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R);
	wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R);

	return 0;
}
Esempio n. 7
0
static int __exit wm8350_rtc_remove(struct platform_device *pdev)
{
	struct wm8350 *wm8350 = platform_get_drvdata(pdev);
	struct wm8350_rtc *wm_rtc = &wm8350->rtc;
	int ret;

	if (wm_rtc->per_irq)
		free_irq(wm_rtc->per_irq, wm8350);
	wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_SEC);
	wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_ALM);
	wm8350_free_irq(wm8350, WM8350_IRQ_RTC_SEC);
	wm8350_free_irq(wm8350, WM8350_IRQ_RTC_ALM);
	rtc_device_unregister(wm_rtc->rtc);

	ret = wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5,
				WM8350_RTC_TICK_ENA);
	if (ret < 0)
		printk(KERN_ERR "wm8350-rtc: failed to enable RTC\n");

	return 0;
}
static int  wm8350_codec_remove(struct snd_soc_codec *codec)
{
	struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
	struct wm8350 *wm8350 = dev_get_platdata(codec->dev);
	int ret;

	wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,
			  WM8350_JDL_ENA | WM8350_JDR_ENA);
	wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA);

	wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_MICD, priv);
	wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_MICSCD, priv);
	wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, priv);
	wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, priv);

	priv->hpl.jack = NULL;
	priv->hpr.jack = NULL;
	priv->mic.jack = NULL;

	/* cancel any work waiting to be queued. */
	ret = cancel_delayed_work(&codec->delayed_work);

	/* if there was any work waiting then we run it now and
	 * wait for its completion */
	if (ret) {
		schedule_delayed_work(&codec->delayed_work, 0);
		flush_scheduled_work();
	}

	wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF);

	wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);

	regulator_bulk_free(ARRAY_SIZE(priv->supplies), priv->supplies);
	kfree(priv);
	return 0;
}
static void free_charger_irq(struct wm8350 *wm8350)
{
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_EXT_USB_FB, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, wm8350);
	wm8350_free_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, wm8350);
}
Esempio n. 10
0
static void free_charger_irq(struct wm8350 *wm8350)
{
	wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT);
	wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD);
	wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL);
	wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_TO);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO);
	wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_END);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END);
	wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_START);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START);
	wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9);
	wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1);
	wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85);
	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85);
	wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_USB_FB);
	wm8350_free_irq(wm8350, WM8350_IRQ_EXT_USB_FB);
	wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB);
	wm8350_free_irq(wm8350, WM8350_IRQ_EXT_WALL_FB);
	wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB);
	wm8350_free_irq(wm8350, WM8350_IRQ_EXT_BAT_FB);
}