Exemplo n.º 1
0
static int __devexit gpio_keys_remove(struct platform_device *pdev)
{
    struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);
    struct input_dev *input = ddata->input;
    int i;

    nvtec_ac_notifier_unregister(&ddata->nb);

    sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group);

    switch_gpio_notifier_unregister(&switch_gpio_notifier);
    device_init_wakeup(&pdev->dev, 0);

    for (i = 0; i < ddata->n_buttons; i++)
        gpio_remove_key(&ddata->data[i]);

    input_unregister_device(input);

    /*
     * If we had no platform_data, we allocated buttons dynamically, and
     * must free them here. ddata->data[0].button is the pointer to the
     * beginning of the allocated array.
     */
    if (!pdev->dev.platform_data)
        kfree(ddata->data[0].button);

    kfree(ddata);

    return 0;
}
Exemplo n.º 2
0
static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev)
{
	struct snd_soc_card *card = platform_get_drvdata(pdev);
	struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
	struct tegra_wm8903_platform_data *pdata = machine->pdata;

	device_remove_file(card->dev, &dev_attr_jack_status);
	device_remove_file(card->dev, &dev_attr_input_source);
	device_remove_file(card->dev, &dev_attr_voice_call);
	device_remove_file(card->dev, &dev_attr_audio_mode);

	if (machine->gpio_requested & GPIO_HP_DET)
		snd_soc_jack_free_gpios(&tegra_wm8903_hp_jack,
					1,
					&tegra_wm8903_hp_jack_gpio);
	if (machine->gpio_requested & GPIO_EXT_MIC_EN)
		gpio_free(pdata->gpio_ext_mic_en);
	if (machine->gpio_requested & GPIO_INT_MIC_EN)
		gpio_free(pdata->gpio_int_mic_en);
	if (machine->gpio_requested & GPIO_HP_MUTE)
		gpio_free(pdata->gpio_hp_mute);
	if (machine->gpio_requested & GPIO_SPKR_EN)
		gpio_free(pdata->gpio_spkr_en);
	gpio_free(pdata->gpio_ext_mic_det);
	machine->gpio_requested = 0;

	if (machine->spk_reg)
		regulator_put(machine->spk_reg);
	if (machine->dmic_reg)
		regulator_put(machine->dmic_reg);
	if (machine->amic_reg)
		regulator_put(machine->amic_reg);
    if (machine->codec_reg)
        regulator_put(machine->codec_reg);

	snd_soc_unregister_card(card);

	tegra_asoc_utils_fini(&machine->util_data);

#ifdef CONFIG_SWITCH
	switch_dev_unregister(&tegra_wm8903_headset_switch);
#endif
	nvtec_ac_notifier_unregister(&machine->ac_notifier);
	kfree(machine);

	return 0;
}