]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sh: roll back Ecovec24/7724se Sound support
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 10 Jun 2026 00:48:31 +0000 (00:48 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 10 Jun 2026 11:00:23 +0000 (12:00 +0100)
Due to a communication miss, the Ecovec24/7724se Sound support
were removed. We need to keep them for a while, until they will
support "DT-style".
Roll back Ecovec24/7724se "platform data style", and its necessary header.

Fixes: deadb855b694d ("sh: 7724se: remove FSI/AK4642/Simple-Audio-Card support")
Fixes: 9cc93ebc85e71 ("sh: ecovec24: remove FSI/DA7210/Simple-Audio-Card support")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87v7br43vk.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
arch/sh/boards/mach-ecovec24/setup.c
arch/sh/boards/mach-se/7724/setup.c
include/sound/simple_card.h [new file with mode: 0644]

index fe78dba442f917864f07b355c2dc5d27e088dcd9..a641e26f8fdf736975f0a4d4a39a3a640a24c93e 100644 (file)
@@ -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>
 
 /*
  *                                  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;
@@ -507,6 +520,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);
index 58e86ba9ad735d5675435c53e1191dcad7197d65..e500feb91053930fc2e5b00bacc4540317d06c47 100644 (file)
@@ -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 (file)
index 0000000..2e99991
--- /dev/null
@@ -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 */