diff options
| -rw-r--r-- | arch/sh/boards/mach-ecovec24/setup.c | 90 | ||||
| -rw-r--r-- | arch/sh/boards/mach-se/7724/setup.c | 101 | ||||
| -rw-r--r-- | include/sound/simple_card.h | 26 | ||||
| -rw-r--r-- | sound/soc/renesas/fsi.c | 16 |
4 files changed, 220 insertions, 13 deletions
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index fe78dba442f9..a641e26f8fdf 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -42,6 +42,9 @@ #include <media/i2c/mt9t112.h> #include <media/i2c/tw9910.h> +#include <sound/sh_fsi.h> +#include <sound/simple_card.h> + #include <video/sh_mobile_lcdc.h> /* @@ -69,6 +72,16 @@ * OFF-ON : MMC */ +/* + * FSI - DA7210 + * + * it needs amixer settings for playing + * + * amixer set 'HeadPhone' 80 + * amixer set 'Out Mixer Left DAC Left' on + * amixer set 'Out Mixer Right DAC Right' on + */ + #define CEU_BUFFER_MEMORY_SIZE (4 << 20) static phys_addr_t ceu0_dma_membase; static phys_addr_t ceu1_dma_membase; @@ -508,6 +521,9 @@ static struct mt9t112_platform_data mt9t112_1_pdata = { static struct i2c_board_info i2c0_devices[] = { { + I2C_BOARD_INFO("da7210", 0x1a), + }, + { I2C_BOARD_INFO("tw9910", 0x45), .platform_data = &tw9910_info, }, @@ -845,6 +861,51 @@ static struct gpiod_lookup_table msiof_gpio_table = { #endif +/* FSI */ +static struct resource fsi_resources[] = { + [0] = { + .name = "FSI", + .start = 0xFE3C0000, + .end = 0xFE3C021d, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = evt2irq(0xf80), + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device fsi_device = { + .name = "sh_fsi", + .id = 0, + .num_resources = ARRAY_SIZE(fsi_resources), + .resource = fsi_resources, +}; + +static struct simple_util_info fsi_da7210_info = { + .name = "DA7210", + .card = "FSIB-DA7210", + .codec = "da7210.0-001a", + .platform = "sh_fsi.0", + .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBP_CFP, + .cpu_dai = { + .name = "fsib-dai", + }, + .codec_dai = { + .name = "da7210-hifi", + }, +}; + +static struct platform_device fsi_da7210_device = { + .name = "asoc-simple-card", + .dev = { + .platform_data = &fsi_da7210_info, + .coherent_dma_mask = DMA_BIT_MASK(32), + .dma_mask = &fsi_da7210_device.dev.coherent_dma_mask, + }, +}; + + /* IrDA */ static struct resource irda_resources[] = { [0] = { @@ -970,6 +1031,8 @@ static struct platform_device *ecovec_devices[] __initdata = { #else &msiof0_device, #endif + &fsi_device, + &fsi_da7210_device, &irda_device, &vou_device, #if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE) @@ -1294,6 +1357,33 @@ static int __init arch_setup(void) __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000, IODRIVEA); + /* enable FSI */ + gpio_request(GPIO_FN_FSIMCKB, NULL); + gpio_request(GPIO_FN_FSIIBSD, NULL); + gpio_request(GPIO_FN_FSIOBSD, NULL); + gpio_request(GPIO_FN_FSIIBBCK, NULL); + gpio_request(GPIO_FN_FSIIBLRCK, NULL); + gpio_request(GPIO_FN_FSIOBBCK, NULL); + gpio_request(GPIO_FN_FSIOBLRCK, NULL); + gpio_request(GPIO_FN_CLKAUDIOBO, NULL); + + /* set SPU2 clock to 83.4 MHz */ + clk = clk_get(NULL, "spu_clk"); + if (!IS_ERR(clk)) { + clk_set_rate(clk, clk_round_rate(clk, 83333333)); + clk_put(clk); + } + + /* change parent of FSI B */ + clk = clk_get(NULL, "fsib_clk"); + if (!IS_ERR(clk)) { + /* 48kHz dummy clock was used to make sure 1/1 divide */ + clk_set_rate(&sh7724_fsimckb_clk, 48000); + clk_set_parent(clk, &sh7724_fsimckb_clk); + clk_set_rate(clk, 48000); + clk_put(clk); + } + gpio_request(GPIO_PTU0, NULL); gpio_direction_output(GPIO_PTU0, 0); mdelay(20); diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index 58e86ba9ad73..e500feb91053 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c @@ -37,6 +37,9 @@ #include <mach-se/mach/se7724.h> #include <media/drv-intf/renesas-ceu.h> +#include <sound/sh_fsi.h> +#include <sound/simple_card.h> + #include <video/sh_mobile_lcdc.h> #define CEU_BUFFER_MEMORY_SIZE (4 << 20) @@ -63,6 +66,13 @@ static phys_addr_t ceu1_dma_membase; * and change SW41 to use 720p */ +/* + * about sound + * + * This setup.c supports FSI slave mode. + * Please change J20, J21, J22 pin to 1-2 connection. + */ + /* Heartbeat */ static struct resource heartbeat_resource = { .start = PA_LED, @@ -268,6 +278,50 @@ static struct platform_device ceu1_device = { }, }; +/* FSI */ +/* change J20, J21, J22 pin to 1-2 connection to use slave mode */ +static struct resource fsi_resources[] = { + [0] = { + .name = "FSI", + .start = 0xFE3C0000, + .end = 0xFE3C021d, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = evt2irq(0xf80), + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device fsi_device = { + .name = "sh_fsi", + .id = 0, + .num_resources = ARRAY_SIZE(fsi_resources), + .resource = fsi_resources, +}; + +static struct simple_util_info fsi_ak4642_info = { + .name = "AK4642", + .card = "FSIA-AK4642", + .codec = "ak4642-codec.0-0012", + .platform = "sh_fsi.0", + .daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBP_CFP, + .cpu_dai = { + .name = "fsia-dai", + }, + .codec_dai = { + .name = "ak4642-hifi", + .sysclk = 11289600, + }, +}; + +static struct platform_device fsi_ak4642_device = { + .name = "asoc-simple-card", + .dev = { + .platform_data = &fsi_ak4642_info, + }, +}; + /* KEYSC in SoC (Needs SW33-2 set to ON) */ static struct sh_keysc_info keysc_info = { .mode = SH_KEYSC_MODE_1, @@ -535,12 +589,21 @@ static struct platform_device *ms7724se_devices[] __initdata = { &sh_eth_device, &sh7724_usb0_host_device, &sh7724_usb1_gadget_device, + &fsi_device, + &fsi_ak4642_device, &sdhi0_cn7_device, &sdhi1_cn8_device, &irda_device, &vou_device, }; +/* I2C device */ +static struct i2c_board_info i2c0_devices[] = { + { + I2C_BOARD_INFO("ak4642", 0x12), + }, +}; + #define EEPROM_OP 0xBA206000 #define EEPROM_ADR 0xBA206004 #define EEPROM_DATA 0xBA20600C @@ -603,9 +666,19 @@ extern char ms7724se_sdram_enter_end; extern char ms7724se_sdram_leave_start; extern char ms7724se_sdram_leave_end; +static int __init arch_setup(void) +{ + /* enable I2C device */ + i2c_register_board_info(0, i2c0_devices, + ARRAY_SIZE(i2c0_devices)); + return 0; +} +arch_initcall(arch_setup); + static int __init devices_setup(void) { u16 sw = __raw_readw(SW4140); /* select camera, monitor */ + struct clk *clk; u16 fpga_out; /* register board specific self-refresh code */ @@ -626,6 +699,7 @@ static int __init devices_setup(void) (1 << 4) | /* AK8813 PDN */ (1 << 5) | /* AK8813 RESET */ (1 << 6) | /* VIDEO DAC */ + (1 << 7) | /* AK4643 */ (1 << 8) | /* IrDA */ (1 << 12) | /* USB0 */ (1 << 14)); /* RMII */ @@ -755,6 +829,33 @@ static int __init devices_setup(void) gpio_request(GPIO_FN_KEYOUT1, NULL); gpio_request(GPIO_FN_KEYOUT0, NULL); + /* enable FSI */ + gpio_request(GPIO_FN_FSIMCKA, NULL); + gpio_request(GPIO_FN_FSIIASD, NULL); + gpio_request(GPIO_FN_FSIOASD, NULL); + gpio_request(GPIO_FN_FSIIABCK, NULL); + gpio_request(GPIO_FN_FSIIALRCK, NULL); + gpio_request(GPIO_FN_FSIOABCK, NULL); + gpio_request(GPIO_FN_FSIOALRCK, NULL); + gpio_request(GPIO_FN_CLKAUDIOAO, NULL); + + /* set SPU2 clock to 83.4 MHz */ + clk = clk_get(NULL, "spu_clk"); + if (!IS_ERR(clk)) { + clk_set_rate(clk, clk_round_rate(clk, 83333333)); + clk_put(clk); + } + + /* change parent of FSI A */ + clk = clk_get(NULL, "fsia_clk"); + if (!IS_ERR(clk)) { + /* 48kHz dummy clock was used to make sure 1/1 divide */ + clk_set_rate(&sh7724_fsimcka_clk, 48000); + clk_set_parent(clk, &sh7724_fsimcka_clk); + clk_set_rate(clk, 48000); + clk_put(clk); + } + /* SDHI0 connected to cn7 */ gpio_request(GPIO_FN_SDHI0CD, NULL); gpio_request(GPIO_FN_SDHI0WP, NULL); diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h new file mode 100644 index 000000000000..2e999916dbd7 --- /dev/null +++ b/include/sound/simple_card.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * ASoC simple sound card support + * + * Copyright (C) 2012 Renesas Solutions Corp. + * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> + */ + +#ifndef __SIMPLE_CARD_H +#define __SIMPLE_CARD_H + +#include <sound/soc.h> +#include <sound/simple_card_utils.h> + +struct simple_util_info { + const char *name; + const char *card; + const char *codec; + const char *platform; + + unsigned int daifmt; + struct simple_util_dai cpu_dai; + struct simple_util_dai codec_dai; +}; + +#endif /* __SIMPLE_CARD_H */ diff --git a/sound/soc/renesas/fsi.c b/sound/soc/renesas/fsi.c index b72396b5de7d..fb376569b470 100644 --- a/sound/soc/renesas/fsi.c +++ b/sound/soc/renesas/fsi.c @@ -2002,20 +2002,10 @@ static int fsi_probe(struct platform_device *pdev) memset(&info, 0, sizeof(info)); - core = NULL; - if (np) { - core = of_device_get_match_data(&pdev->dev); - fsi_of_parse("fsia", np, &info.port_a, &pdev->dev); - fsi_of_parse("fsib", np, &info.port_b, &pdev->dev); - } else { - const struct platform_device_id *id_entry = pdev->id_entry; - if (id_entry) - core = (struct fsi_core *)id_entry->driver_data; - - if (pdev->dev.platform_data) - memcpy(&info, pdev->dev.platform_data, sizeof(info)); - } + fsi_of_parse("fsia", np, &info.port_a, &pdev->dev); + fsi_of_parse("fsib", np, &info.port_b, &pdev->dev); + core = of_device_get_match_data(&pdev->dev); if (!core) { dev_err(&pdev->dev, "unknown fsi device\n"); return -ENODEV; |
