Skip to contentSkip to conversation

ASoC: zx: Add ZTE zx296702 pcm support

PATCH Jun Nie 2 participants 9 messages May 18, 2015 – May 23, 2015 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jun Nie

author
#1 lore raw

2015-05-06 20:38 GMT+08:00 Jun Nie <[email protected]>:

Quoted 3 lines

This patch adds zx296702 ASoC DMA audio support. It handle audio dma based on soc-dmaengine

Mark,

Do you have any comments on this patch set? Or you suggest to add HDMI API calling in the same serial patch? For the HDMI calling, I have no good idea except direct call currently. Because I need dts hook to audio driver, while no HDMI call back data can be shared from video side to audio side in this independent initialization case.

Jun

Quoted 123 lines
---
 sound/soc/Kconfig            |  1 +
 sound/soc/Makefile           |  1 +
 sound/soc/zte/Kconfig        |  8 ++++++++
 sound/soc/zte/Makefile       |  1 +
 sound/soc/zte/zx296702-pcm.c | 46 ++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/zte/zx296702-pcm.h |  6 ++++++
 6 files changed, 63 insertions(+)
 create mode 100644 sound/soc/zte/Kconfig
 create mode 100644 sound/soc/zte/Makefile
 create mode 100644 sound/soc/zte/zx296702-pcm.c
 create mode 100644 sound/soc/zte/zx296702-pcm.h
sound/soc/Kconfig +1 -0
index 3ba52da..e2828e1 100644
@@ -57,6 +57,7 @@ source "sound/soc/tegra/Kconfig"
 source "sound/soc/txx9/Kconfig"
 source "sound/soc/ux500/Kconfig"
 source "sound/soc/xtensa/Kconfig"
+source "sound/soc/zte/Kconfig"
 
 # Supported codecs
 source "sound/soc/codecs/Kconfig"
sound/soc/Makefile +1 -0
index 974ba70..57bf32d 100644
@@ -38,3 +38,4 @@ obj-$(CONFIG_SND_SOC) += tegra/
 obj-$(CONFIG_SND_SOC)  += txx9/
 obj-$(CONFIG_SND_SOC)  += ux500/
 obj-$(CONFIG_SND_SOC)  += xtensa/
+obj-$(CONFIG_SND_SOC)  += zte/
sound/soc/zte/Kconfig new file +8 -0
new file mode 100644
index 0000000..392ffa6
@@ -0,0 +1,8 @@
+config SND_SOC_ZX296702
+       tristate "SoC Audio for the ZX296702 System-on-Chip"
+       depends on SOC_ZX296702 || COMPILE_TEST
+       depends on COMMON_CLK
+       select SND_SOC_GENERIC_DMAENGINE_PCM
+       help
+         Say Y or M here if you want support for SoC audio on ZX296702
+         chip.
sound/soc/zte/Makefile new file +1 -0
new file mode 100644
index 0000000..f2a6af8
@@ -0,0 +1 @@
+obj-$(CONFIG_SND_SOC_ZX296702) += zx296702-pcm.o
sound/soc/zte/zx296702-pcm.c new file +46 -0
new file mode 100644
index 0000000..6e1a61a
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 Linaro
+ *
+ * Author: Jun Nie <[email protected]>
+ *
+ * License terms: GNU General Public License (GPL) version 2
+ */
+
+#include <linux/device.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/soc.h>
+#include <sound/dmaengine_pcm.h>
+
+#include "zx296702-pcm.h"
+
+static const struct snd_pcm_hardware snd_zx_hardware = {
+       .info                   = SNDRV_PCM_INFO_MMAP |
+                                 SNDRV_PCM_INFO_MMAP_VALID |
+                                 SNDRV_PCM_INFO_INTERLEAVED |
+                                 SNDRV_PCM_INFO_PAUSE |
+                                 SNDRV_PCM_INFO_RESUME |
+                                 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
+       .period_bytes_min       = 32,
+       .period_bytes_max       = 16 * 1024,
+       .periods_min            = 2,
+       .periods_max            = 32,
+       .buffer_bytes_max       = 64 * 1024,
+};
+
+static const struct snd_dmaengine_pcm_config zx_dmaengine_pcm_config = {
+       .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
+       .pcm_hardware = &snd_zx_hardware,
+       .prealloc_buffer_size = 64 * 1024,
+};
+
+int zx_pcm_platform_register(struct device *dev)
+{
+       return devm_snd_dmaengine_pcm_register(dev, &zx_dmaengine_pcm_config,
+                       0);
+}
+EXPORT_SYMBOL_GPL(zx_pcm_platform_register);
+
+MODULE_LICENSE("GPL");
sound/soc/zte/zx296702-pcm.h new file +6 -1
new file mode 100644
index 0000000..4809a38
@@ -0,0 +1,6 @@
+#ifndef _ZX_PCM_H
+#define _ZX_PCM_H
+
+int zx_pcm_platform_register(struct device *dev);
+
+#endif
--

1.9.1

#2 lore raw
Quoted 3 lines · Jun Nie

2015-05-06 20:38 GMT+08:00 Jun Nie <[email protected]>:

Do you have any comments on this patch set? Or you suggest to add HDMI

Please don't send pings, they just add to the mail volume.

Quoted 4 lines

API calling in the same serial patch? For the HDMI calling, I have no good idea except direct call currently. Because I need dts hook to audio driver, while no HDMI call back data can be shared from video side to audio side in this independent initialization case.

My previous suggestion was to have a CODEC driver for the HDMI IP - I'm not sure why that would require a "direct call"?

author
#3 lore raw

2015-05-22 4:04 GMT+08:00 Mark Brown <[email protected]>:

Quoted 7 lines · Jun Nie
Quoted 3 lines

2015-05-06 20:38 GMT+08:00 Jun Nie <[email protected]>:

Do you have any comments on this patch set? Or you suggest to add HDMI

Please don't send pings, they just add to the mail volume.

Quoted 7 lines
Quoted 4 lines

API calling in the same serial patch? For the HDMI calling, I have no good idea except direct call currently. Because I need dts hook to audio driver, while no HDMI call back data can be shared from video side to audio side in this independent initialization case.

My previous suggestion was to have a CODEC driver for the HDMI IP - I'm not sure why that would require a "direct call"?

I mean I have to direct call HDMI API in HDMI codec driver, is that acceptable?

Jun

#4 lore raw
Quoted 6 lines · Jun Nie

2015-05-22 4:04 GMT+08:00 Mark Brown <[email protected]>:

Quoted 2 lines

My previous suggestion was to have a CODEC driver for the HDMI IP - I'm not sure why that would require a "direct call"?

I mean I have to direct call HDMI API in HDMI codec driver, is that acceptable?

I don't know what you mean when you talk about "direct call HDMI API" - what is the HDMI API to which you refer here?

author
#5 lore raw

2015-05-22 19:35 GMT+08:00 Mark Brown <[email protected]>:

Quoted 10 lines · Jun Nie
Quoted 6 lines

2015-05-22 4:04 GMT+08:00 Mark Brown <[email protected]>:

Quoted 2 lines

My previous suggestion was to have a CODEC driver for the HDMI IP - I'm not sure why that would require a "direct call"?

I mean I have to direct call HDMI API in HDMI codec driver, is that acceptable?

I don't know what you mean when you talk about "direct call HDMI API" - what is the HDMI API to which you refer here?

Sorry for confusing you. I mean HDMI function in video part. I have to call ZTE specific HDMI function from ASoC codec driver.

Jun

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

Re: [PATCH v2 2/3] ASoC: zx: Add zx296702 SPDIF support

Quoted 1 line · Jun Nie

Add driver for zx296702 SPDIF controller

This all seems fine apart from the fact that you're adding a new DT binding with no binding documentation - all new DT binndings require binnding documentation.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Re: [PATCH v2 3/3] dt: Add documentation for the ZTE SPDIF controller

Quoted 2 lines · Jun Nie

This patch adds the devicetree documentation for the ZTE zx296702 SPDIF audio controller.

...and here it is! Sorry - the DT binding is normally before the code in the patch series. This is fine, it's just patch 1 that needs to be resolved then.

author
#10 lore raw

Re: [PATCH v2 3/3] dt: Add documentation for the ZTE SPDIF controller

2015-05-22 20:10 GMT+08:00 Mark Brown <[email protected]>:

Quoted 7 lines · Jun Nie
Quoted 2 lines

This patch adds the devicetree documentation for the ZTE zx296702 SPDIF audio controller.

...and here it is! Sorry - the DT binding is normally before the code in the patch series. This is fine, it's just patch 1 that needs to be resolved then.

Learn another community execution rule. I will add dts doc before code next time :)

Jun

#11 lore raw
In reply to a message not in the archive

Review

Quoted 13 lines · Jun Nie
(quoted diff) +13 -0
+static const struct snd_pcm_hardware snd_zx_hardware = {
+	.info			= SNDRV_PCM_INFO_MMAP |
+				  SNDRV_PCM_INFO_MMAP_VALID |
+				  SNDRV_PCM_INFO_INTERLEAVED |
+				  SNDRV_PCM_INFO_PAUSE |
+				  SNDRV_PCM_INFO_RESUME |
+				  SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
+	.period_bytes_min	= 32,
+	.period_bytes_max	= 16 * 1024,
+	.periods_min		= 2,
+	.periods_max		= 32,
+	.buffer_bytes_max       = 64 * 1024,
+};

As I said last time I'm not sure why you are manually defining these - the capabilities of the DMA controller should be being enumerated from the DMA controller driver. See dmaengine_pcm_set_runtime_hwparams().