static int __init e740_init(void)
{
	int ret;

	if (!machine_is_e740())
		return -ENODEV;

	ret = gpio_request(GPIO_E740_MIC_ON,  "Mic amp");
	if (ret)
		return ret;

	ret = gpio_request(GPIO_E740_AMP_ON, "Output amp");
	if (ret)
		goto free_mic_amp_gpio;

	ret = gpio_request(GPIO_E740_WM9705_nAVDD2, "Audio power");
	if (ret)
		goto free_op_amp_gpio;

	/* Disable audio */
	ret = gpio_direction_output(GPIO_E740_MIC_ON, 0);
	if (ret)
		goto free_apwr_gpio;
	ret = gpio_direction_output(GPIO_E740_AMP_ON, 0);
	if (ret)
		goto free_apwr_gpio;
	ret = gpio_direction_output(GPIO_E740_WM9705_nAVDD2, 1);
	if (ret)
		goto free_apwr_gpio;

	e740_snd_device = platform_device_alloc("soc-audio", -1);
	if (!e740_snd_device) {
		ret = -ENOMEM;
		goto free_apwr_gpio;
	}

	platform_set_drvdata(e740_snd_device, &e740_snd_devdata);
	e740_snd_devdata.dev = &e740_snd_device->dev;
	ret = platform_device_add(e740_snd_device);

	if (!ret)
		return 0;

/* Fail gracefully */
	platform_device_put(e740_snd_device);
free_apwr_gpio:
	gpio_free(GPIO_E740_WM9705_nAVDD2);
free_op_amp_gpio:
	gpio_free(GPIO_E740_AMP_ON);
free_mic_amp_gpio:
	gpio_free(GPIO_E740_MIC_ON);

	return ret;
}
static int eseries_battery_init(void) {
	int ret;

	if(!(machine_is_e740() || machine_is_e750() || machine_is_e800()))
		return -ENODEV;

	ret = request_irq(IRQ_GPIO(10), eseries_battery_irq, 0, "battery", NULL);
	if(ret)
		return ret;
	set_irq_type(IRQ_GPIO(10), IRQT_BOTHEDGE);

	eseries_battery_probe(NULL);

	return 0;
}
Exemple #3
0
static int __init e740_init(void)
{
	int ret;

	if (!machine_is_e740())
		return -ENODEV;

	e740_snd_device = platform_device_alloc("soc-audio", -1);
	if (!e740_snd_device)
		return -ENOMEM;

	platform_set_drvdata(e740_snd_device, &e740_snd_devdata);
	e740_snd_devdata.dev = &e740_snd_device->dev;
	ret = platform_device_add(e740_snd_device);

	if (ret)
		platform_device_put(e740_snd_device);

	return ret;
}
static int __init e740_pcmcia_init(void)
{
	int ret;

	if (!machine_is_e740())
		return -ENODEV;

	e740_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
	if (!e740_pcmcia_device)
		return -ENOMEM;

	ret = platform_device_add_data(e740_pcmcia_device, &e740_pcmcia_ops,
					sizeof(e740_pcmcia_ops));

	if (!ret)
		ret = platform_device_add(e740_pcmcia_device);

	if (ret)
		platform_device_put(e740_pcmcia_device);

	return ret;
}