From: Kevin Hilman <khilman@deeprootsystems.com>
To: miguel.aguilar@ridgerun.com
Cc: davinci-linux-open-source@linux.davincidsp.com,
clark.becker@ridgerun.com, santiago.nunez@ridgerun.com,
diego.dompe@ridgerun.com, alsa-devel@alsa-project.org,
nsnehaprabha@ti.com, todd.fischer@ridgerun.com
Subject: Re: [PATCH 2/2] Davinci: DM365: Enable DaVinci Voice Codec support for DM365 EVM
Date: Mon, 11 Jan 2010 08:04:20 -0800 [thread overview]
Message-ID: <87vdf8ocfv.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1262902641-14821-1-git-send-email-miguel.aguilar@ridgerun.com> (miguel aguilar's message of "Thu\, 7 Jan 2010 16\:17\:21 -0600")
miguel.aguilar@ridgerun.com writes:
> From: Miguel Aguilar <miguel.aguilar@ridgerun.com>
>
> It sets up one single card for the DM365 EVM with two subdevices:
> the AIC3x and the Voice Codec.
>
> The general structures are defined at DM365 SoC file and the specific
> platform data structure for the EVM is defined at board file.
You don't describe how you changed the muxing to be dynamic etc.
Could also use a bit more description about how/when the new callback
is intended to be used.
> Signed-off-by: Miguel Aguilar <miguel.aguilar@ridgerun.com>
> ---
> arch/arm/mach-davinci/board-dm365-evm.c | 39 +++++++++++++++++++++++++++-
> arch/arm/mach-davinci/dm365.c | 37 ++++++++++++++++++++++++--
> arch/arm/mach-davinci/include/mach/asp.h | 1 +
> arch/arm/mach-davinci/include/mach/dm365.h | 5 +++
> arch/arm/mach-davinci/include/mach/mux.h | 2 +
> 5 files changed, 80 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
> index 8d23972..74f3519 100644
> --- a/arch/arm/mach-davinci/board-dm365-evm.c
> +++ b/arch/arm/mach-davinci/board-dm365-evm.c
> @@ -175,7 +175,43 @@ static struct at24_platform_data eeprom_info = {
> .context = (void *)0x7f00,
> };
>
> -static struct snd_platform_data dm365_evm_snd_data;
> +static int dm365_snd_dma_event_mux(int device, int enable, int playback)
I think enable and playback should be bool, no?
> +{
> + static int tx_dma_mux = 0;
> + static int rx_dma_mux = 0;
these should be bool also.
also, scripts/checkpatch.pl should tell you you don't need to assign
these statics to zero
> + if (!enable) {
> + if (playback)
> + tx_dma_mux = 0;
> + else
> + rx_dma_mux = 0;
> + return 0;
> + }
> +
> + if (playback) {
> + if (tx_dma_mux == 1)
> + return -EBUSY;
> + if (device == 0)
As Mark pointed out, for readability, rather than zero you should have
some symbolic name, either a #define or enum of the options would
greatly improve readability.
Kevin
> + davinci_cfg_reg(DM365_EVT2_ASP_TX);
> + else
> + davinci_cfg_reg(DM365_EVT2_VC_TX);
> + tx_dma_mux = 1;
> + } else {
> + if (rx_dma_mux == 1)
> + return -EBUSY;
> + if (device == 0)
> + davinci_cfg_reg(DM365_EVT3_ASP_RX);
> + else
> + davinci_cfg_reg(DM365_EVT3_VC_RX);
> + rx_dma_mux = 1;
> + }
> +
> + return 0;
> +}
> +
> +static struct snd_platform_data dm365_evm_snd_data = {
> + .dma_event_mux = &dm365_snd_dma_event_mux,
> +};
>
> static struct i2c_board_info i2c_info[] = {
> {
> @@ -513,6 +549,7 @@ static __init void dm365_evm_init(void)
> evm_init_cpld();
>
> dm365_init_asp(&dm365_evm_snd_data);
> + dm365_init_vc(&dm365_evm_snd_data);
> dm365_init_rtc();
>
> #ifdef CONFIG_KEYBOARD_DAVINCI
> diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
> index cc3bae4..024cbab 100644
> --- a/arch/arm/mach-davinci/dm365.c
> +++ b/arch/arm/mach-davinci/dm365.c
> @@ -455,7 +455,7 @@ static struct davinci_clk dm365_clks[] = {
> CLK(NULL, "timer3", &timer3_clk),
> CLK(NULL, "usb", &usb_clk),
> CLK("davinci_emac.1", NULL, &emac_clk),
> - CLK("voice_codec", NULL, &voicecodec_clk),
> + CLK("davinci_voicecodec", NULL, &voicecodec_clk),
> CLK("davinci-asp.0", NULL, &asp0_clk),
> CLK(NULL, "rto", &rto_clk),
> CLK(NULL, "mjcp", &mjcp_clk),
> @@ -604,6 +604,8 @@ INT_CFG(DM365, INT_IMX1_DISABLE, 24, 1, 0, false)
> INT_CFG(DM365, INT_NSF_ENABLE, 25, 1, 1, false)
> INT_CFG(DM365, INT_NSF_DISABLE, 25, 1, 0, false)
>
> +EVT_CFG(DM365, EVT2_VC_TX, 0, 1, 1, false)
> +EVT_CFG(DM365, EVT3_VC_RX, 1, 1, 1, false)
> EVT_CFG(DM365, EVT2_ASP_TX, 0, 1, 0, false)
> EVT_CFG(DM365, EVT3_ASP_RX, 1, 1, 0, false)
> #endif
> @@ -835,6 +837,31 @@ static struct platform_device dm365_asp_device = {
> .resource = dm365_asp_resources,
> };
>
> +static struct resource dm365_vc_resources[] = {
> + {
> + .start = DAVINCI_DM365_VC_BASE,
> + .end = DAVINCI_DM365_VC_BASE + SZ_1K - 1,
> + .flags = IORESOURCE_MEM,
> + },
> + {
> + .start = DAVINCI_DMA_VC_TX,
> + .end = DAVINCI_DMA_VC_TX,
> + .flags = IORESOURCE_DMA,
> + },
> + {
> + .start = DAVINCI_DMA_VC_RX,
> + .end = DAVINCI_DMA_VC_RX,
> + .flags = IORESOURCE_DMA,
> + },
> +};
> +
> +static struct platform_device dm365_vc_device = {
> + .name = "davinci_voicecodec",
> + .id = -1,
> + .num_resources = ARRAY_SIZE(dm365_vc_resources),
> + .resource = dm365_vc_resources,
> +};
> +
> static struct resource dm365_rtc_resources[] = {
> {
> .start = DM365_RTC_BASE,
> @@ -985,12 +1012,16 @@ void __init dm365_init_asp(struct snd_platform_data *pdata)
> davinci_cfg_reg(DM365_MCBSP0_BDR);
> davinci_cfg_reg(DM365_MCBSP0_R);
> davinci_cfg_reg(DM365_MCBSP0_BFSR);
> - davinci_cfg_reg(DM365_EVT2_ASP_TX);
> - davinci_cfg_reg(DM365_EVT3_ASP_RX);
> dm365_asp_device.dev.platform_data = pdata;
> platform_device_register(&dm365_asp_device);
> }
>
> +void __init dm365_init_vc(struct snd_platform_data *pdata)
> +{
> + dm365_vc_device.dev.platform_data = pdata;
> + platform_device_register(&dm365_vc_device);
> +}
> +
> void __init dm365_init_ks(struct davinci_ks_platform_data *pdata)
> {
> davinci_cfg_reg(DM365_KEYSCAN);
> diff --git a/arch/arm/mach-davinci/include/mach/asp.h b/arch/arm/mach-davinci/include/mach/asp.h
> index 834725f..6a175eb 100644
> --- a/arch/arm/mach-davinci/include/mach/asp.h
> +++ b/arch/arm/mach-davinci/include/mach/asp.h
> @@ -50,6 +50,7 @@
> #define DAVINCI_ASP1_TX_INT IRQ_MBXINT
>
> struct snd_platform_data {
> + int (*dma_event_mux)(int, int, int);
> u32 tx_dma_offset;
> u32 rx_dma_offset;
> enum dma_event_q eventq_no; /* event queue number */
> diff --git a/arch/arm/mach-davinci/include/mach/dm365.h b/arch/arm/mach-davinci/include/mach/dm365.h
> index 3c07a88..50aeaec 100644
> --- a/arch/arm/mach-davinci/include/mach/dm365.h
> +++ b/arch/arm/mach-davinci/include/mach/dm365.h
> @@ -31,8 +31,13 @@
>
> #define DM365_RTC_BASE (0x01C69000)
>
> +#define DAVINCI_DM365_VC_BASE (0x01D0C000)
> +#define DAVINCI_DMA_VC_TX 2
> +#define DAVINCI_DMA_VC_RX 3
> +
> void __init dm365_init(void);
> void __init dm365_init_asp(struct snd_platform_data *pdata);
> +void __init dm365_init_vc(struct snd_platform_data *pdata);
> void __init dm365_init_ks(struct davinci_ks_platform_data *pdata);
> void __init dm365_init_rtc(void);
>
> diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h
> index b60c693..2937c51 100644
> --- a/arch/arm/mach-davinci/include/mach/mux.h
> +++ b/arch/arm/mach-davinci/include/mach/mux.h
> @@ -325,6 +325,8 @@ enum davinci_dm365_index {
> DM365_INT_NSF_DISABLE,
>
> /* EDMA event muxing */
> + DM365_EVT2_VC_TX,
> + DM365_EVT3_VC_RX,
> DM365_EVT2_ASP_TX,
> DM365_EVT3_ASP_RX,
> DM365_EVT26_MMC0_RX,
> --
> 1.6.0.4
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2010-01-11 16:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-07 22:17 [PATCH 2/2] Davinci: DM365: Enable DaVinci Voice Codec support for DM365 EVM miguel.aguilar
2010-01-08 11:31 ` Mark Brown
2010-01-08 17:36 ` Miguel Aguilar
2010-01-08 19:37 ` Mark Brown
2010-01-11 15:11 ` Miguel Aguilar
2010-01-11 15:34 ` Mark Brown
2010-01-11 15:53 ` Miguel Aguilar
2010-01-11 16:21 ` Mark Brown
2010-01-19 20:47 ` Miguel Aguilar
2010-01-19 22:10 ` Mark Brown
2010-01-20 14:32 ` Miguel Aguilar
2010-01-20 15:01 ` Mark Brown
2010-01-11 16:04 ` Kevin Hilman [this message]
2010-01-11 16:08 ` Miguel Aguilar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vdf8ocfv.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=alsa-devel@alsa-project.org \
--cc=clark.becker@ridgerun.com \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=diego.dompe@ridgerun.com \
--cc=miguel.aguilar@ridgerun.com \
--cc=nsnehaprabha@ti.com \
--cc=santiago.nunez@ridgerun.com \
--cc=todd.fischer@ridgerun.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.