aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/mach-at32ap
diff options
context:
space:
mode:
authorHans-Christian Egtvedt <hcegtvedt@atmel.com>2008-07-01 08:26:45 -0400
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-07-24 07:51:46 -0400
commit218df4a25a9b828df4bb44c86e35febe40c82e62 (patch)
treebcb16ce1f1231def1adcf5f5ed7915fa3a1f40fd /arch/avr32/mach-at32ap
parentfbfca4b8781757c1950b2225ba67d83072e0bc07 (diff)
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: Hans-Christian Egtvedt <hcegtvedt@atmel.com> Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/mach-at32ap')
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 4ac38d28891d..30c7cdab28d0 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1883,9 +1883,11 @@ static struct clk atmel_ac97c0_pclk = {
1883 .index = 10, 1883 .index = 10,
1884}; 1884};
1885 1885
1886struct platform_device *__init at32_add_device_ac97c(unsigned int id) 1886struct platform_device *__init
1887at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data)
1887{ 1888{
1888 struct platform_device *pdev; 1889 struct platform_device *pdev;
1890 struct ac97c_platform_data _data;
1889 1891
1890 if (id != 0) 1892 if (id != 0)
1891 return NULL; 1893 return NULL;
@@ -1896,19 +1898,37 @@ struct platform_device *__init at32_add_device_ac97c(unsigned int id)
1896 1898
1897 if (platform_device_add_resources(pdev, atmel_ac97c0_resource, 1899 if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
1898 ARRAY_SIZE(atmel_ac97c0_resource))) 1900 ARRAY_SIZE(atmel_ac97c0_resource)))
1899 goto err_add_resources; 1901 goto fail;
1902
1903 if (!data) {
1904 data = &_data;
1905 memset(data, 0, sizeof(struct ac97c_platform_data));
1906 data->reset_pin = GPIO_PIN_NONE;
1907 }
1908
1909 data->dma_rx_periph_id = 3;
1910 data->dma_tx_periph_id = 4;
1911 data->dma_controller_id = 0;
1900 1912
1901 select_peripheral(PB(20), PERIPH_B, 0); /* SYNC */ 1913 if (platform_device_add_data(pdev, data,
1902 select_peripheral(PB(21), PERIPH_B, 0); /* SDO */ 1914 sizeof(struct ac97c_platform_data)))
1903 select_peripheral(PB(22), PERIPH_B, 0); /* SDI */ 1915 goto fail;
1904 select_peripheral(PB(23), PERIPH_B, 0); /* SCLK */ 1916
1917 select_peripheral(PB(20), PERIPH_B, 0); /* SDO */
1918 select_peripheral(PB(21), PERIPH_B, 0); /* SYNC */
1919 select_peripheral(PB(22), PERIPH_B, 0); /* SCLK */
1920 select_peripheral(PB(23), PERIPH_B, 0); /* SDI */
1921
1922 /* TODO: gpio_is_valid(data->reset_pin) with kernel 2.6.26. */
1923 if (data->reset_pin != GPIO_PIN_NONE)
1924 at32_select_gpio(data->reset_pin, 0);
1905 1925
1906 atmel_ac97c0_pclk.dev = &pdev->dev; 1926 atmel_ac97c0_pclk.dev = &pdev->dev;
1907 1927
1908 platform_device_add(pdev); 1928 platform_device_add(pdev);
1909 return pdev; 1929 return pdev;
1910 1930
1911err_add_resources: 1931fail:
1912 platform_device_put(pdev); 1932 platform_device_put(pdev);
1913 return NULL; 1933 return NULL;
1914} 1934}