Commit 218df4a2 authored by Hans-Christian Egtvedt's avatar Hans-Christian Egtvedt Committed by Haavard Skinnemoen

avr32: Add platform data for AC97C platform device

This patch adds platform data to the AC97C platform device. This will
let the board add a GPIO line which is connected to the external codecs
reset line.

The platform data, ac97c_platform_data, must also contain the DMA
controller ID, RX channel ID and TX channel ID.

Tested with Wolfson WM9712 and AP7000.
Signed-off-by: default avatarHans-Christian Egtvedt <hcegtvedt@atmel.com>
Signed-off-by: default avatarHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
parent fbfca4b8
...@@ -1883,9 +1883,11 @@ static struct clk atmel_ac97c0_pclk = { ...@@ -1883,9 +1883,11 @@ static struct clk atmel_ac97c0_pclk = {
.index = 10, .index = 10,
}; };
struct platform_device *__init at32_add_device_ac97c(unsigned int id) struct platform_device *__init
at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data)
{ {
struct platform_device *pdev; struct platform_device *pdev;
struct ac97c_platform_data _data;
if (id != 0) if (id != 0)
return NULL; return NULL;
...@@ -1896,19 +1898,37 @@ struct platform_device *__init at32_add_device_ac97c(unsigned int id) ...@@ -1896,19 +1898,37 @@ struct platform_device *__init at32_add_device_ac97c(unsigned int id)
if (platform_device_add_resources(pdev, atmel_ac97c0_resource, if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
ARRAY_SIZE(atmel_ac97c0_resource))) ARRAY_SIZE(atmel_ac97c0_resource)))
goto err_add_resources; goto fail;
if (!data) {
data = &_data;
memset(data, 0, sizeof(struct ac97c_platform_data));
data->reset_pin = GPIO_PIN_NONE;
}
data->dma_rx_periph_id = 3;
data->dma_tx_periph_id = 4;
data->dma_controller_id = 0;
select_peripheral(PB(20), PERIPH_B, 0); /* SYNC */ if (platform_device_add_data(pdev, data,
select_peripheral(PB(21), PERIPH_B, 0); /* SDO */ sizeof(struct ac97c_platform_data)))
select_peripheral(PB(22), PERIPH_B, 0); /* SDI */ goto fail;
select_peripheral(PB(23), PERIPH_B, 0); /* SCLK */
select_peripheral(PB(20), PERIPH_B, 0); /* SDO */
select_peripheral(PB(21), PERIPH_B, 0); /* SYNC */
select_peripheral(PB(22), PERIPH_B, 0); /* SCLK */
select_peripheral(PB(23), PERIPH_B, 0); /* SDI */
/* TODO: gpio_is_valid(data->reset_pin) with kernel 2.6.26. */
if (data->reset_pin != GPIO_PIN_NONE)
at32_select_gpio(data->reset_pin, 0);
atmel_ac97c0_pclk.dev = &pdev->dev; atmel_ac97c0_pclk.dev = &pdev->dev;
platform_device_add(pdev); platform_device_add(pdev);
return pdev; return pdev;
err_add_resources: fail:
platform_device_put(pdev); platform_device_put(pdev);
return NULL; return NULL;
} }
......
...@@ -82,7 +82,15 @@ struct mci_platform_data; ...@@ -82,7 +82,15 @@ struct mci_platform_data;
struct platform_device * struct platform_device *
at32_add_device_mci(unsigned int id, struct mci_platform_data *data); at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
struct platform_device *at32_add_device_ac97c(unsigned int id); struct ac97c_platform_data {
unsigned short dma_rx_periph_id;
unsigned short dma_tx_periph_id;
unsigned short dma_controller_id;
int reset_pin;
};
struct platform_device *
at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data);
struct platform_device *at32_add_device_abdac(unsigned int id); struct platform_device *at32_add_device_abdac(unsigned int id);
struct platform_device *at32_add_device_psif(unsigned int id); struct platform_device *at32_add_device_psif(unsigned int id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment