Skip to contentSkip to conversation

Add I2S/ADV7511 audio support for ARC AXS10x boards

PATCH Superseded Jose Abreu 4 participants 24 messages Apr 7, 2016 – Apr 11, 2016

Subsystems (7)

v4 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Jose Abreu

author
#0 lore raw

v4 cover Add I2S/ADV7511 audio support for ARC AXS10x boards

ARC AXS10x platforms consist of a mainboard with several peripherals. One of those peripherals is an HDMI output port controlled by the ADV7511 transmitter.

This patch set adds audio for the ADV7511 transmitter and I2S audio for the AXS10x platform.

Changes v3 -> v4:
* Reintroduced custom PCM driver (see note below)
* Use DT boolean to switch between ALSA DMA engine PCM or custom PCM
* Use fifo depth to program I2S FCR
* Update I2S documentation

Changes v2 -> v3:
* Removed pll_config functions (as suggested by Alexey Brodkin)
* Removed HDMI start at adv7511_core (as suggested by Archit Taneja)
* Use NOP functions for adv7511_audio (as suggested by Archit Taneja)
* Added adv7511_audio_exit() function (as suggested by Archit Taneja)
* Moved adv7511 to its own folder (as suggested by Archit Taneja)
* Separated file rename of adv7511_core (as suggested by Emil Velikov)
* Compile adv7511 as module if ALSA SoC is compiled as module
* Load adv7511 audio only if declared in device tree (as suggested by Laurent Pinchart)
* Dropped custom platform driver, using now ALSA DMA engine
* Dropped IRQ handler for I2S

Changes v1 -> v2:
* DT bindings moved to separate patch (as suggested by Alexey Brodkin)
* Removed defconfigs entries (as suggested by Alexey Brodkin)

NOTE:
Although the mainline I2S driver uses ALSA DMA engine, this controller can be built without DMA support so it was necessary to add this custom platform driver so that HDMI audio works in AXS boards.

Jose Abreu (5):
drm/i2c/adv7511: Rename and move to separate folder drm/i2c/adv7511: Add audio support
ASoC: dwc: Use fifo depth to program FCR
ASoC: dwc: Add custom PCM driver
ASoC: dwc: Update DOCUMENTATION for I2S Driver

 .../bindings/display/bridge/adi,adv7511.txt        |   3 +
 .../devicetree/bindings/sound/designware-i2s.txt   |   5 +
 drivers/gpu/drm/i2c/Kconfig                        |   6 +-
 drivers/gpu/drm/i2c/Makefile                       |   2 +-
 drivers/gpu/drm/i2c/adv7511/Kconfig                |  18 ++
 drivers/gpu/drm/i2c/adv7511/Makefile               |   3 +
 drivers/gpu/drm/i2c/{ => adv7511}/adv7511.h        |  53 ++++
 drivers/gpu/drm/i2c/adv7511/adv7511_audio.c        | 310 +++++++++++++++++++++
 .../drm/i2c/{adv7511.c => adv7511/adv7511_core.c}  |  43 +--
 include/sound/soc-dai.h                            |   1 +
 sound/soc/dwc/Kconfig                              |   9 +
 sound/soc/dwc/Makefile                             |   1 +
 sound/soc/dwc/designware.h                         |  70 +++++
 sound/soc/dwc/designware_i2s.c                     | 106 +++++--
 sound/soc/dwc/designware_pcm.c                     | 230 +++++++++++++++
 15 files changed, 796 insertions(+), 64 deletions(-)
 create mode 100644 drivers/gpu/drm/i2c/adv7511/Kconfig
 create mode 100644 drivers/gpu/drm/i2c/adv7511/Makefile
 rename drivers/gpu/drm/i2c/{ => adv7511}/adv7511.h (90%)
 create mode 100644 drivers/gpu/drm/i2c/adv7511/adv7511_audio.c
 rename drivers/gpu/drm/i2c/{adv7511.c => adv7511/adv7511_core.c} (97%)
 create mode 100644 sound/soc/dwc/designware.h
 create mode 100644 sound/soc/dwc/designware_pcm.c
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v4 1/5 drm/i2c/adv7511: Rename and move to separate folder

Main file of adv7511 driver was renamed from adv7511.c to adv7511_core.c and moved to separate folder in order to prepare the adding of audio support.

Struct adv7511 was moved to adv7511.h and functions adv7511_packet_enable() and adv7511_packet_disable() were made public also to prepare the adding of audio support.

---

No changes v3 -> v4.

This patch was only introduced in v3.

 drivers/gpu/drm/i2c/Kconfig                        |  6 +---
 drivers/gpu/drm/i2c/Makefile                       |  2 +-
 drivers/gpu/drm/i2c/adv7511/Kconfig                |  6 ++++
 drivers/gpu/drm/i2c/adv7511/Makefile               |  2 ++
 drivers/gpu/drm/i2c/{ => adv7511}/adv7511.h        | 31 +++++++++++++++++++++
 .../drm/i2c/{adv7511.c => adv7511/adv7511_core.c}  | 32 ++--------------------
 6 files changed, 43 insertions(+), 36 deletions(-)
 create mode 100644 drivers/gpu/drm/i2c/adv7511/Kconfig
 create mode 100644 drivers/gpu/drm/i2c/adv7511/Makefile
 rename drivers/gpu/drm/i2c/{ => adv7511}/adv7511.h (93%)
 rename drivers/gpu/drm/i2c/{adv7511.c => adv7511/adv7511_core.c} (97%)
drivers/gpu/drm/i2c/Kconfig +1 -5
index 22c7ed6..9258daf 100644
@@ -1,11 +1,7 @@
 menu "I2C encoder or helper chips"
      depends on DRM && DRM_KMS_HELPER && I2C
 
-config DRM_I2C_ADV7511
-	tristate "AV7511 encoder"
-	select REGMAP_I2C
-	help
-	  Support for the Analog Device ADV7511(W) and ADV7513 HDMI encoders.
+source "drivers/gpu/drm/i2c/adv7511/Kconfig"
 
 config DRM_I2C_CH7006
 	tristate "Chrontel ch7006 TV encoder"
drivers/gpu/drm/i2c/Makefile +1 -1
index 2c72eb5..f144830 100644
@@ -1,6 +1,6 @@
 ccflags-y := -Iinclude/drm
 
-obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511.o
+obj-y += adv7511/
 
 ch7006-y := ch7006_drv.o ch7006_mode.o
 obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o
drivers/gpu/drm/i2c/adv7511/Kconfig new file +6 -0
new file mode 100644
index 0000000..302c8e34
@@ -0,0 +1,6 @@
+config DRM_I2C_ADV7511
+	tristate "AV7511 encoder"
+	select REGMAP_I2C
+	help
+	  Support for the Analog Device ADV7511(W) and ADV7513 HDMI encoders.
+
drivers/gpu/drm/i2c/adv7511/Makefile new file +2 -0
new file mode 100644
index 0000000..c13f5a1
@@ -0,0 +1,2 @@
+adv7511-y := adv7511_core.o
+obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511.o
drivers/gpu/drm/i2c/adv7511/adv7511.h renamed from drivers/gpu/drm/i2c/adv7511.h +31 -0
similarity index 93%
rename from drivers/gpu/drm/i2c/adv7511.h
rename to drivers/gpu/drm/i2c/adv7511/adv7511.h
index 38515b3..fcae1ee 100644
@@ -286,4 +286,35 @@ struct adv7511_video_config {
 	struct hdmi_avi_infoframe avi_infoframe;
 };
 
+struct adv7511 {
+	struct i2c_client *i2c_main;
+	struct i2c_client *i2c_edid;
+
+	struct regmap *regmap;
+	struct regmap *packet_memory_regmap;
+	enum drm_connector_status status;
+	bool powered;
+
+	unsigned int f_tmds;
+
+	unsigned int current_edid_segment;
+	uint8_t edid_buf[256];
+	bool edid_read;
+
+	wait_queue_head_t wq;
+	struct drm_encoder *encoder;
+
+	bool embedded_sync;
+	enum adv7511_sync_polarity vsync_polarity;
+	enum adv7511_sync_polarity hsync_polarity;
+	bool rgb;
+
+	struct edid *edid;
+
+	struct gpio_desc *gpio_pd;
+};
+
+int adv7511_packet_enable(struct adv7511 *adv7511, unsigned int packet);
+int adv7511_packet_disable(struct adv7511 *adv7511, unsigned int packet);
+
 #endif /* __DRM_I2C_ADV7511_H__ */
drivers/gpu/drm/i2c/adv7511/adv7511_core.c renamed from drivers/gpu/drm/i2c/adv7511.c +2 -30
similarity index 97%
rename from drivers/gpu/drm/i2c/adv7511.c
rename to drivers/gpu/drm/i2c/adv7511/adv7511_core.c
index a02112b..2b00581 100644
@@ -20,34 +20,6 @@
 
 #include "adv7511.h"
 
-struct adv7511 {
-	struct i2c_client *i2c_main;
-	struct i2c_client *i2c_edid;
-
-	struct regmap *regmap;
-	struct regmap *packet_memory_regmap;
-	enum drm_connector_status status;
-	bool powered;
-
-	unsigned int f_tmds;
-
-	unsigned int current_edid_segment;
-	uint8_t edid_buf[256];
-	bool edid_read;
-
-	wait_queue_head_t wq;
-	struct drm_encoder *encoder;
-
-	bool embedded_sync;
-	enum adv7511_sync_polarity vsync_polarity;
-	enum adv7511_sync_polarity hsync_polarity;
-	bool rgb;
-
-	struct edid *edid;
-
-	struct gpio_desc *gpio_pd;
-};
-
 static struct adv7511 *encoder_to_adv7511(struct drm_encoder *encoder)
 {
 	return to_encoder_slave(encoder)->slave_priv;
@@ -194,7 +166,7 @@ static void adv7511_set_colormap(struct adv7511 *adv7511, bool enable,
 			   ADV7511_CSC_UPDATE_MODE, 0);
 }
 
-static int adv7511_packet_enable(struct adv7511 *adv7511, unsigned int packet)
+int adv7511_packet_enable(struct adv7511 *adv7511, unsigned int packet)
 {
 	if (packet & 0xff)
 		regmap_update_bits(adv7511->regmap, ADV7511_REG_PACKET_ENABLE0,
@@ -209,7 +181,7 @@ static int adv7511_packet_enable(struct adv7511 *adv7511, unsigned int packet)
 	return 0;
 }
 
-static int adv7511_packet_disable(struct adv7511 *adv7511, unsigned int packet)
+int adv7511_packet_disable(struct adv7511 *adv7511, unsigned int packet)
 {
 	if (packet & 0xff)
 		regmap_update_bits(adv7511->regmap, ADV7511_REG_PACKET_ENABLE0,
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v4 2/5 drm/i2c/adv7511: Add audio support

In reply to Jose Abreu

This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.

The code was ported from Analog Devices linux tree from commit 1770c4a1e32b ("Merge remote-tracking branch 'xilinx/master' into xcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/

The audio can be disabled using menu-config and/or device tree so it is possible to use only video mode. The audio (when enabled) registers as a codec into ALSA.

SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.

---

No changes v3 -> v4.

Changes v2 -> v3:
* Removed HDMI start at adv7511_core (as suggested by Archit Taneja)
* Use NOP functions for adv7511_audio (as suggested by Archit Taneja)
* Added adv7511_audio_exit() function (as suggested by Archit Taneja)
* Moved adv7511 to its own folder (as suggested by Archit Taneja)
* Compile adv7511 as module if ALSA SoC is compiled as module
* Load adv7511 audio only if declared in device tree (as suggested by Laurent Pinchart)

No changes v1 -> v2.

 .../bindings/display/bridge/adi,adv7511.txt        |   3 +
 drivers/gpu/drm/i2c/adv7511/Kconfig                |  12 +
 drivers/gpu/drm/i2c/adv7511/Makefile               |   1 +
 drivers/gpu/drm/i2c/adv7511/adv7511.h              |  22 ++
 drivers/gpu/drm/i2c/adv7511/adv7511_audio.c        | 310 +++++++++++++++++++++
 drivers/gpu/drm/i2c/adv7511/adv7511_core.c         |  11 +
 include/sound/soc-dai.h                            |   1 +
 7 files changed, 360 insertions(+)
 create mode 100644 drivers/gpu/drm/i2c/adv7511/adv7511_audio.c
Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt +3 -0
index 96c25ee..920e542 100644
@@ -43,6 +43,9 @@ Optional properties:
   data stream (similar to BT.656). Defaults to separate H/V synchronization
   signals.
 
+- adi,enable-audio: If set the ADV7511 driver will register a codec interface
+  into ALSA SoC.
+
 Required nodes:
 
 The ADV7511 has two video ports. Their connections are modelled using the OF
drivers/gpu/drm/i2c/adv7511/Kconfig +12 -0
index 302c8e34..900f3e9 100644
@@ -4,3 +4,15 @@ config DRM_I2C_ADV7511
 	help
 	  Support for the Analog Device ADV7511(W) and ADV7513 HDMI encoders.
 
+config DRM_I2C_ADV7511_AUDIO
+	bool "ADV7511 audio"
+	depends on DRM_I2C_ADV7511
+	depends on SND_SOC=y || (SND_SOC && DRM_I2C_ADV7511=m)
+	default y
+	help
+	  This adds support for audio on the ADV7511(W) and ADV7513 HDMI
+	  encoders.
+
+	  By selecting this option the ADV7511 will register a codec interface
+	  into ALSA.
+
drivers/gpu/drm/i2c/adv7511/Makefile +1 -0
index c13f5a1..d68773a 100644
@@ -1,2 +1,3 @@
 adv7511-y := adv7511_core.o
+adv7511-$(CONFIG_DRM_I2C_ADV7511_AUDIO) += adv7511_audio.o
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511.o
drivers/gpu/drm/i2c/adv7511/adv7511.h +22 -0
index fcae1ee..35828f0 100644
@@ -10,6 +10,7 @@
 #define __DRM_I2C_ADV7511_H__
 
 #include <linux/hdmi.h>
+#include <drm/drmP.h>
 
 #define ADV7511_REG_CHIP_REVISION		0x00
 #define ADV7511_REG_N0				0x01
@@ -241,6 +242,7 @@ enum adv7511_sync_polarity {
  * @sync_pulse:			Select the sync pulse
  * @vsync_polarity:		vsync input signal configuration
  * @hsync_polarity:		hsync input signal configuration
+ * @enable_audio		True if audio is enabled
  */
 struct adv7511_link_config {
 	unsigned int input_color_depth;
@@ -255,6 +257,8 @@ struct adv7511_link_config {
 	enum adv7511_input_sync_pulse sync_pulse;
 	enum adv7511_sync_polarity vsync_polarity;
 	enum adv7511_sync_polarity hsync_polarity;
+
+	bool enable_audio;
 };
 
 /**
@@ -296,6 +300,10 @@ struct adv7511 {
 	bool powered;
 
 	unsigned int f_tmds;
+	unsigned int f_audio;
+
+	unsigned int audio_source;
+	bool enable_audio;
 
 	unsigned int current_edid_segment;
 	uint8_t edid_buf[256];
@@ -317,4 +325,18 @@ struct adv7511 {
 int adv7511_packet_enable(struct adv7511 *adv7511, unsigned int packet);
 int adv7511_packet_disable(struct adv7511 *adv7511, unsigned int packet);
 
+#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO
+int adv7511_audio_init(struct device *dev);
+void adv7511_audio_exit(struct device *dev);
+#else
+int adv7511_audio_init(struct device *dev)
+{
+	return 0;
+}
+void adv7511_audio_exit(struct device *dev)
+{
+
+}
+#endif
+
 #endif /* __DRM_I2C_ADV7511_H__ */
drivers/gpu/drm/i2c/adv7511/adv7511_audio.c new file +310 -0

310 lines not on this page · raw message

drivers/gpu/drm/i2c/adv7511/adv7511_core.c +11 -0
index 2b00581..140a64b 100644
@@ -329,6 +329,7 @@ static void adv7511_set_link_config(struct adv7511 *adv7511,
 	adv7511->hsync_polarity = config->hsync_polarity;
 	adv7511->vsync_polarity = config->vsync_polarity;
 	adv7511->rgb = config->input_colorspace == HDMI_COLORSPACE_RGB;
+	adv7511->enable_audio = config->enable_audio;
 }
 
 static void adv7511_power_on(struct adv7511 *adv7511)
@@ -822,6 +823,7 @@ static int adv7511_parse_dt(struct device_node *np,
 		return -EINVAL;
 
 	config->embedded_sync = of_property_read_bool(np, "adi,embedded-sync");
+	config->enable_audio = of_property_read_bool(np, "adi,enable-audio");
 
 	/* Hardcode the sync pulse configurations for now. */
 	config->sync_pulse = ADV7511_INPUT_SYNC_PULSE_NONE;
@@ -916,6 +918,12 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 
 	adv7511_set_link_config(adv7511, &link_config);
 
+	if (link_config.enable_audio) {
+		ret = adv7511_audio_init(&i2c->dev);
+		if (ret)
+			goto err_i2c_unregister_device;
+	}
+
 	return 0;
 
 err_i2c_unregister_device:
@@ -930,6 +938,9 @@ static int adv7511_remove(struct i2c_client *i2c)
 
 	i2c_unregister_device(adv7511->i2c_edid);
 
+	if (adv7511->enable_audio)
+		adv7511_audio_exit(&i2c->dev);
+
 	kfree(adv7511->edid);
 
 	return 0;
include/sound/soc-dai.h +1 -0
index 964b7de..539c091 100644
@@ -33,6 +33,7 @@ struct snd_compr_stream;
 #define SND_SOC_DAIFMT_DSP_B		5 /* L data MSB during FRM LRC */
 #define SND_SOC_DAIFMT_AC97		6 /* AC97 */
 #define SND_SOC_DAIFMT_PDM		7 /* Pulse density modulation */
+#define SND_SOC_DAIFMT_SPDIF		8 /* SPDIF */
 
 /* left and right justified also known as MSB and LSB respectively */
 #define SND_SOC_DAIFMT_MSB		SND_SOC_DAIFMT_LEFT_J
Signature · 1 line
1.9.1
#3 lore raw

Re: [alsa-devel] [PATCH 2/5 v4] drm/i2c/adv7511: Add audio support

Quoted 7 lines · Jose Abreu

This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.

The code was ported from Analog Devices linux tree from commit 1770c4a1e32b ("Merge remote-tracking branch 'xilinx/master' into xcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/

The reason why this driver is still out of tree, is because there has been no conclusion yet on how to go forward with the whole HDMI integration. So this is not going to get merged until that issue has been addressed.

[...]

Quoted 2 lines
+- adi,enable-audio: If set the ADV7511 driver will register a codec interface
+  into ALSA SoC.

This is not a description of the hardware.

[...]

include/sound/soc-dai.h struct snd_compr_stream; · line 36

Quoted 9 lines
include/sound/soc-dai.h +1 -0
index 964b7de..539c091 100644
@@ -33,6 +33,7 @@ struct snd_compr_stream;
 #define SND_SOC_DAIFMT_DSP_B		5 /* L data MSB during FRM LRC */
 #define SND_SOC_DAIFMT_AC97		6 /* AC97 */
 #define SND_SOC_DAIFMT_PDM		7 /* Pulse density modulation */
+#define SND_SOC_DAIFMT_SPDIF		8 /* SPDIF */

This needs to be a separate patch.

author
#4 lore raw

PATCH v4 2/5 drm/i2c/adv7511: Add audio support

Hi Lars,

Quoted 11 lines · Lars-Peter Clausen
Quoted 7 lines · Jose Abreu

This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.

The code was ported from Analog Devices linux tree from commit 1770c4a1e32b ("Merge remote-tracking branch 'xilinx/master' into xcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/

The reason why this driver is still out of tree, is because there has been no conclusion yet on how to go forward with the whole HDMI integration. So this is not going to get merged until that issue has been addressed.

Ok, will then drop the patches related with adv7511 but will update with your comments so that when this HDMI issue is addressed I can send again the patches. Is this okay?

Quoted 5 lines

[...]

Quoted 2 lines
+- adi,enable-audio: If set the ADV7511 driver will register a codec interface
+  into ALSA SoC.

This is not a description of the hardware.

Is this okay: "adi,enable-audio: Set this boolean parameter if ADV7511 transmitter routes audio signals" ?

Quoted 12 lines

[...]

include/sound/soc-dai.h struct snd_compr_stream; · line 36

Quoted 9 lines
include/sound/soc-dai.h +1 -0
index 964b7de..539c091 100644
@@ -33,6 +33,7 @@ struct snd_compr_stream;
 #define SND_SOC_DAIFMT_DSP_B		5 /* L data MSB during FRM LRC */
 #define SND_SOC_DAIFMT_AC97		6 /* AC97 */
 #define SND_SOC_DAIFMT_PDM		7 /* Pulse density modulation */
+#define SND_SOC_DAIFMT_SPDIF		8 /* SPDIF */

This needs to be a separate patch.

Ok.

Quoted 6 lines

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Best regards,
Jose Miguel Abreu

author
#5 lore raw

Re: [alsa-devel] [PATCH 2/5 v4] drm/i2c/adv7511: Add audio support

In reply to Lars-Peter Clausen

Hi Lars,

Quoted 11 lines · Lars-Peter Clausen
Quoted 7 lines · Jose Abreu

This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.

The code was ported from Analog Devices linux tree from commit 1770c4a1e32b ("Merge remote-tracking branch 'xilinx/master' into xcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/

The reason why this driver is still out of tree, is because there has been no conclusion yet on how to go forward with the whole HDMI integration. So this is not going to get merged until that issue has been addressed.

Ok, will then drop the patches related with adv7511 but will update with your comments so that when this HDMI issue is addressed I can send again the patches. Is this okay?

Quoted 5 lines

[...]

Quoted 2 lines
+- adi,enable-audio: If set the ADV7511 driver will register a codec interface
+  into ALSA SoC.

This is not a description of the hardware.

Is this okay: "adi,enable-audio: Set this boolean parameter if ADV7511 transmitter routes audio signals" ?

Quoted 12 lines

[...]

include/sound/soc-dai.h struct snd_compr_stream; · line 36

Quoted 9 lines
include/sound/soc-dai.h +1 -0
index 964b7de..539c091 100644
@@ -33,6 +33,7 @@ struct snd_compr_stream;
 #define SND_SOC_DAIFMT_DSP_B		5 /* L data MSB during FRM LRC */
 #define SND_SOC_DAIFMT_AC97		6 /* AC97 */
 #define SND_SOC_DAIFMT_PDM		7 /* Pulse density modulation */
+#define SND_SOC_DAIFMT_SPDIF		8 /* SPDIF */

This needs to be a separate patch.

Ok.

Quoted 6 lines

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Best regards,
Jose Miguel Abreu

#6 lore raw

Re: [alsa-devel] [PATCH 2/5 v4] drm/i2c/adv7511: Add audio support

On 04/08/2016 06:12 PM, Jose Abreu wrote:
[...]

Quoted 8 lines
Quoted 5 lines

[...]

Quoted 2 lines
+- adi,enable-audio: If set the ADV7511 driver will register a codec interface
+  into ALSA SoC.

This is not a description of the hardware.

Is this okay: "adi,enable-audio: Set this boolean parameter if ADV7511 transmitter routes audio signals" ?

I don't think we need this property. There is no problem with registering the audio part unconditionally. As long as there is no connection we wont create a sound card that is exposed to userspace.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#7 lore raw

Re: [alsa-devel] [PATCH 2/5 v4] drm/i2c/adv7511: Add audio support

Hi Lars,

Quoted 12 lines · Lars-Peter Clausen

On 04/08/2016 06:12 PM, Jose Abreu wrote:
[...]

Quoted 6 lines
Quoted 4 lines

[...]

Quoted 2 lines
+- adi,enable-audio: If set the ADV7511 driver will register a codec interface
+  into ALSA SoC.

This is not a description of the hardware.

Is this okay: "adi,enable-audio: Set this boolean parameter if ADV7511 transmitter routes audio signals" ?

I don't think we need this property. There is no problem with registering the audio part unconditionally. As long as there is no connection we wont create a sound card that is exposed to userspace.

This change was suggested by Laurent Pinchart and was introduced in v3. Quoting Laurent:
"The idea is that enabling support for ADV7511 audio in the kernel isn't coupled with whether the system includes audio support. It would be confusing, and would also waste resources, to create a Linux sound device when no sound channel is routed on the board."

Should I revert this?

Best regards,
Jose Miguel Abreu

#8 lore raw

Re: [alsa-devel] [PATCH 2/5 v4] drm/i2c/adv7511: Add audio support

Quoted 17 lines · Jose Abreu

Hi Lars,

Quoted 12 lines · Lars-Peter Clausen

On 04/08/2016 06:12 PM, Jose Abreu wrote:
[...]

Quoted 6 lines
Quoted 4 lines

[...]

Quoted 2 lines
+- adi,enable-audio: If set the ADV7511 driver will register a codec interface
+  into ALSA SoC.

This is not a description of the hardware.

Is this okay: "adi,enable-audio: Set this boolean parameter if ADV7511 transmitter routes audio signals" ?

I don't think we need this property. There is no problem with registering the audio part unconditionally. As long as there is no connection we wont create a sound card that is exposed to userspace.

Quoted 6 lines

This change was suggested by Laurent Pinchart and was introduced in v3. Quoting Laurent:
"The idea is that enabling support for ADV7511 audio in the kernel isn't coupled with whether the system includes audio support. It would be confusing, and would also waste resources, to create a Linux sound device when no sound channel is routed on the board."

I wouldn't care too much about this at this point, the extra amount of resources required for registering the CODEC (but not the sound card) is just a few bytes (sizeof(struct snd_soc_codec)).

Nevertheless what we should do is describe the hardware and from this information infer whether there is a audio connection or not and if there is none we might skip registering the CODEC. In my opinion this hardware description should be modeled using of-graph, having a connection between the SoC side and the adv7511 SPDIF or I2S port.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#9 lore raw

Re: [alsa-devel] [PATCH 2/5 v4] drm/i2c/adv7511: Add audio support

Hi Lars,

Quoted 27 lines · Lars-Peter Clausen
Quoted 16 lines · Jose Abreu

Hi Lars,

Quoted 12 lines · Lars-Peter Clausen

On 04/08/2016 06:12 PM, Jose Abreu wrote:
[...]

Quoted 6 lines
Quoted 4 lines

[...]

Quoted 2 lines
+- adi,enable-audio: If set the ADV7511 driver will register a codec interface
+  into ALSA SoC.

This is not a description of the hardware.

Is this okay: "adi,enable-audio: Set this boolean parameter if ADV7511 transmitter routes audio signals" ?

I don't think we need this property. There is no problem with registering the audio part unconditionally. As long as there is no connection we wont create a sound card that is exposed to userspace.

Quoted 6 lines

This change was suggested by Laurent Pinchart and was introduced in v3. Quoting Laurent:
"The idea is that enabling support for ADV7511 audio in the kernel isn't coupled with whether the system includes audio support. It would be confusing, and would also waste resources, to create a Linux sound device when no sound channel is routed on the board."

I wouldn't care too much about this at this point, the extra amount of resources required for registering the CODEC (but not the sound card) is just a few bytes (sizeof(struct snd_soc_codec)).

Quoted 6 lines

Nevertheless what we should do is describe the hardware and from this information infer whether there is a audio connection or not and if there is none we might skip registering the CODEC. In my opinion this hardware description should be modeled using of-graph, having a connection between the SoC side and the adv7511 SPDIF or I2S port.

You mean something like this:

sound_playback: sound_playback {
    compatible = "simple-audio-card";
    [...]
    simple-audio-card,format = "i2s";
    [...]
}
adv7511@xx {
    compatible = "adi,adv7511";
    [...]

    ports {
        [...]
        /* Audio Output */
        port@x {
            reg = <x>;
            endpoint {
                remote-endpoint = <&sound_playback>;
            }
        }
    }
}

?

Best regards,
Jose Miguel Abreu

#10 lore raw

Re: [alsa-devel] [PATCH 2/5 v4] drm/i2c/adv7511: Add audio support

Quoted 47 lines · Jose Abreu

Hi Lars,

Quoted 27 lines · Lars-Peter Clausen
Quoted 16 lines · Jose Abreu

Hi Lars,

Quoted 12 lines · Lars-Peter Clausen

On 04/08/2016 06:12 PM, Jose Abreu wrote:
[...]

Quoted 6 lines
Quoted 4 lines

[...]

Quoted 2 lines
+- adi,enable-audio: If set the ADV7511 driver will register a codec interface
+  into ALSA SoC.

This is not a description of the hardware.

Is this okay: "adi,enable-audio: Set this boolean parameter if ADV7511 transmitter routes audio signals" ?

I don't think we need this property. There is no problem with registering the audio part unconditionally. As long as there is no connection we wont create a sound card that is exposed to userspace.

Quoted 6 lines

This change was suggested by Laurent Pinchart and was introduced in v3. Quoting Laurent:
"The idea is that enabling support for ADV7511 audio in the kernel isn't coupled with whether the system includes audio support. It would be confusing, and would also waste resources, to create a Linux sound device when no sound channel is routed on the board."

I wouldn't care too much about this at this point, the extra amount of resources required for registering the CODEC (but not the sound card) is just a few bytes (sizeof(struct snd_soc_codec)).

Quoted 6 lines

Nevertheless what we should do is describe the hardware and from this information infer whether there is a audio connection or not and if there is none we might skip registering the CODEC. In my opinion this hardware description should be modeled using of-graph, having a connection between the SoC side and the adv7511 SPDIF or I2S port.

You mean something like this:

sound_playback: sound_playback {
    compatible = "simple-audio-card";
    [...]
    simple-audio-card,format = "i2s";
    [...]
}
Quoted 15 lines
adv7511@xx {
    compatible = "adi,adv7511";
    [...]

    ports {
        [...]
        /* Audio Output */
        port@x {
            reg = <x>;
            endpoint {
                remote-endpoint = <&sound_playback>;
            }
        }
    }
}

Yes, something like that. Not exactly like that, but similar. One of the core concepts of of-graph is that there is always a description of the connection from both sides, this way each side can independently figure out where it is connected.

Currently there is also zero support of of-graph in ASoC, so a bit of work is required to get this integrated properly.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#11 lore raw

Re: [alsa-devel] [PATCH 2/5 v4] drm/i2c/adv7511: Add audio support

Hi Lars,

Quoted 62 lines · Lars-Peter Clausen
Quoted 46 lines · Jose Abreu

Hi Lars,

Quoted 27 lines · Lars-Peter Clausen
Quoted 16 lines · Jose Abreu

Hi Lars,

Quoted 12 lines · Lars-Peter Clausen

On 04/08/2016 06:12 PM, Jose Abreu wrote:
[...]

Quoted 6 lines
Quoted 4 lines

[...]

Quoted 2 lines
+- adi,enable-audio: If set the ADV7511 driver will register a codec interface
+  into ALSA SoC.

This is not a description of the hardware.

Is this okay: "adi,enable-audio: Set this boolean parameter if ADV7511 transmitter routes audio signals" ?

I don't think we need this property. There is no problem with registering the audio part unconditionally. As long as there is no connection we wont create a sound card that is exposed to userspace.

Quoted 6 lines

This change was suggested by Laurent Pinchart and was introduced in v3. Quoting Laurent:
"The idea is that enabling support for ADV7511 audio in the kernel isn't coupled with whether the system includes audio support. It would be confusing, and would also waste resources, to create a Linux sound device when no sound channel is routed on the board."

I wouldn't care too much about this at this point, the extra amount of resources required for registering the CODEC (but not the sound card) is just a few bytes (sizeof(struct snd_soc_codec)).

Quoted 6 lines

Nevertheless what we should do is describe the hardware and from this information infer whether there is a audio connection or not and if there is none we might skip registering the CODEC. In my opinion this hardware description should be modeled using of-graph, having a connection between the SoC side and the adv7511 SPDIF or I2S port.

You mean something like this:

sound_playback: sound_playback {
    compatible = "simple-audio-card";
    [...]
    simple-audio-card,format = "i2s";
    [...]
}
Quoted 15 lines
adv7511@xx {
    compatible = "adi,adv7511";
    [...]

    ports {
        [...]
        /* Audio Output */
        port@x {
            reg = <x>;
            endpoint {
                remote-endpoint = <&sound_playback>;
            }
        }
    }
}
Quoted 8 lines

Yes, something like that. Not exactly like that, but similar. One of the core concepts of of-graph is that there is always a description of the connection from both sides, this way each side can independently figure out where it is connected.

Currently there is also zero support of of-graph in ASoC, so a bit of work is required to get this integrated properly.

I also believe this would be the better option but in the meantime can't I integrate the audio like it is being done in the dw-hdmi driver[1]? In this driver the audio is registered as a sound card and is conditionally built using Kconfig, just like I was doing in the previous versions. I know you said the HDMI audio is still an open issue but it seems that for this case it was accepted.

[1] http://lxr.free-electrons.com/source/drivers/gpu/drm/bridge/dw-hdmi-ahb-audio.c

Best regards,
Jose Miguel Abreu

#12 lore raw

Re: [alsa-devel] [PATCH 2/5 v4] drm/i2c/adv7511: Add audio support

On 04/11/2016 04:08 PM, Jose Abreu wrote:
[...]

Quoted 11 lines
Quoted 3 lines

Currently there is also zero support of of-graph in ASoC, so a bit of work is required to get this integrated properly.

I also believe this would be the better option but in the meantime can't I integrate the audio like it is being done in the dw-hdmi driver[1]? In this driver the audio is registered as a sound card and is conditionally built using Kconfig, just like I was doing in the previous versions. I know you said the HDMI audio is still an open issue but it seems that for this case it was accepted.

[1] http://lxr.free-electrons.com/source/drivers/gpu/drm/bridge/dw-hdmi-ahb-audio.c

Maybe, but I'm not sure it would work in this case. Resources are probably better invested in working towards a proper solution.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#13 lore raw

PATCH v4 3/5 ASoC: dwc: Use fifo depth to program FCR

In reply to Jose Abreu

This patch makes Designware I2S driver use the fifo depth value to program the fifo configuration register instead of using hardcoded values.

---

This patch was only introduced in v4.

 sound/soc/dwc/designware_i2s.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
sound/soc/dwc/designware_i2s.c +7 -2
index 3effcd1..0db69b7 100644
@@ -100,6 +100,7 @@ struct dw_i2s_dev {
 	struct device *dev;
 	u32 ccr;
 	u32 xfer_resolution;
+	u32 fifo_th;
 
 	/* data related to DMA transfers b/w i2s and DMAC */
 	union dw_i2s_snd_dma_data play_dma_data;
@@ -232,14 +233,16 @@ static void dw_i2s_config(struct dw_i2s_dev *dev, int stream)
 		if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
 			i2s_write_reg(dev->i2s_base, TCR(ch_reg),
 				      dev->xfer_resolution);
-			i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02);
+			i2s_write_reg(dev->i2s_base, TFCR(ch_reg),
+				      dev->fifo_th - 1);
 			irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
 			i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30);
 			i2s_write_reg(dev->i2s_base, TER(ch_reg), 1);
 		} else {
 			i2s_write_reg(dev->i2s_base, RCR(ch_reg),
 				      dev->xfer_resolution);
-			i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07);
+			i2s_write_reg(dev->i2s_base, RFCR(ch_reg),
+				      dev->fifo_th - 1);
 			irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
 			i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03);
 			i2s_write_reg(dev->i2s_base, RER(ch_reg), 1);
@@ -499,6 +502,7 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
 	 */
 	u32 comp1 = i2s_read_reg(dev->i2s_base, dev->i2s_reg_comp1);
 	u32 comp2 = i2s_read_reg(dev->i2s_base, dev->i2s_reg_comp2);
+	u32 fifo_depth = 1 << (1 + COMP1_FIFO_DEPTH_GLOBAL(comp1));
 	u32 idx;
 
 	if (dev->capability & DWC_I2S_RECORD &&
@@ -537,6 +541,7 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
 		dev->capability |= DW_I2S_SLAVE;
 	}
 
+	dev->fifo_th = fifo_depth / 2;
 	return 0;
 }
 
Signature · 1 line
1.9.1
maintainer
#14 lore raw

Applied "ASoC: dwc: Use fifo depth to program FCR" to the asoc tree

The patch

ASoC: dwc: Use fifo depth to program FCR

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

From 3fafd14d9422c46f5c2a142298384dc15dbf88b2 Mon Sep 17 00:00:00 2001
From: Jose Abreu <[email protected]>
Date: Thu, 7 Apr 2016 17:53:57 +0100
Subject: [PATCH] ASoC: dwc: Use fifo depth to program FCR

This patch makes Designware I2S driver use the fifo depth value to program the fifo configuration register instead of using hardcoded values.

---
 sound/soc/dwc/designware_i2s.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
sound/soc/dwc/designware_i2s.c +7 -2
index 3effcd1a7df8..0db69b7e9617 100644
@@ -100,6 +100,7 @@ struct dw_i2s_dev {
 	struct device *dev;
 	u32 ccr;
 	u32 xfer_resolution;
+	u32 fifo_th;
 
 	/* data related to DMA transfers b/w i2s and DMAC */
 	union dw_i2s_snd_dma_data play_dma_data;
@@ -232,14 +233,16 @@ static void dw_i2s_config(struct dw_i2s_dev *dev, int stream)
 		if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
 			i2s_write_reg(dev->i2s_base, TCR(ch_reg),
 				      dev->xfer_resolution);
-			i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02);
+			i2s_write_reg(dev->i2s_base, TFCR(ch_reg),
+				      dev->fifo_th - 1);
 			irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
 			i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30);
 			i2s_write_reg(dev->i2s_base, TER(ch_reg), 1);
 		} else {
 			i2s_write_reg(dev->i2s_base, RCR(ch_reg),
 				      dev->xfer_resolution);
-			i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07);
+			i2s_write_reg(dev->i2s_base, RFCR(ch_reg),
+				      dev->fifo_th - 1);
 			irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
 			i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03);
 			i2s_write_reg(dev->i2s_base, RER(ch_reg), 1);
@@ -499,6 +502,7 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
 	 */
 	u32 comp1 = i2s_read_reg(dev->i2s_base, dev->i2s_reg_comp1);
 	u32 comp2 = i2s_read_reg(dev->i2s_base, dev->i2s_reg_comp2);
+	u32 fifo_depth = 1 << (1 + COMP1_FIFO_DEPTH_GLOBAL(comp1));
 	u32 idx;
 
 	if (dev->capability & DWC_I2S_RECORD &&
@@ -537,6 +541,7 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
 		dev->capability |= DW_I2S_SLAVE;
 	}
 
+	dev->fifo_th = fifo_depth / 2;
 	return 0;
 }
 
Signature · 6 lines
2.8.0.rc3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#15 lore raw

PATCH v4 4/5 ASoC: dwc: Add custom PCM driver

In reply to Jose Abreu

HDMI audio support was added to the AXS board using an I2S cpu driver and a custom platform driver.

The platform driver supports two channels @ 16 bits with rates 32k, 44.1k and 48k.

Although the mainline I2S driver uses ALSA DMA engine, this controller can be built without DMA support so it was necessary to add this custom platform driver so that HDMI audio works in AXS boards.

The selection between the use of DMA engine or custom PCM can be made using a device tree boolean parameter which was introduced in this patch ('snps,use-dmaengine').

---

Changes v3 -> v4:
* Reintroduced custom PCM driver
* Use DT boolean to switch between ALSA DMA engine PCM or custom PCM

Changes v2 -> v3:
* Removed pll_config functions (as suggested by Alexey Brodkin)
* Dropped custom platform driver, using now ALSA DMA engine
* Dropped IRQ handler for I2S

No changes v1 -> v2.

 sound/soc/dwc/Kconfig          |   9 ++
 sound/soc/dwc/Makefile         |   1 +
 sound/soc/dwc/designware.h     |  70 +++++++++++++
 sound/soc/dwc/designware_i2s.c |  99 +++++++++++++-----
 sound/soc/dwc/designware_pcm.c | 230 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 382 insertions(+), 27 deletions(-)
 create mode 100644 sound/soc/dwc/designware.h
 create mode 100644 sound/soc/dwc/designware_pcm.c
sound/soc/dwc/Kconfig +9 -0
index d50e085..2a21120 100644
@@ -7,4 +7,13 @@ config SND_DESIGNWARE_I2S
 	 Synopsys desigwnware I2S device. The device supports upto
 	 maximum of 8 channels each for play and record.
 
+config SND_DESIGNWARE_PCM
+	tristate "Synopsys I2S PCM Driver"
+	help
+	 Say Y or M if you want to add support for ALSA ASoC platform driver
+	 using I2S.
+
+	 Select this option if you want to be able to create a sound interface
+	 using the I2S device driver as CPU driver. Instead of using ALSA
+	 DMA engine by selecting this driver a custom PCM driver will be used.
 
sound/soc/dwc/Makefile +1 -0
index 319371f..1b48bccc 100644
@@ -1,3 +1,4 @@
 # SYNOPSYS Platform Support
 obj-$(CONFIG_SND_DESIGNWARE_I2S) += designware_i2s.o
+obj-$(CONFIG_SND_DESIGNWARE_PCM) += designware_pcm.o
 
sound/soc/dwc/designware.h new file +70 -0

70 lines not on this page · raw message

sound/soc/dwc/designware_i2s.c +72 -27

147 lines not on this page · raw message

sound/soc/dwc/designware_pcm.c new file +230 -0

230 lines not on this page · raw message

Signature · 1 line
1.9.1
#16 lore raw

Re: [PATCH 4/5 v4] ASoC: dwc: Add custom PCM driver

reproduce:

Hi Jose,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.6-rc2 next-20160407]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Jose-Abreu/Add-I2S-ADV7511-audio-support-for-ARC-AXS10x-boards/20160408-005829
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> sound/soc/dwc/designware_pcm.c:46:5: error: redefinition of 'dw_pcm_transfer'

int dw_pcm_transfer(u32 *lsample, u32 *rsample, int bytes, int buf_size,
^
In file included from sound/soc/dwc/designware_pcm.c:20:0:
sound/soc/dwc/designware.h:63:5: note: previous definition of 'dw_pcm_transfer' was here
int dw_pcm_transfer(u32 *lsample, u32 *rsample, int bytes, int buf_size,
^

vim +/dw_pcm_transfer +46 sound/soc/dwc/designware_pcm.c

    40		.period_bytes_min = PERIOD_BYTES_MIN,
    41		.period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN,
    42		.periods_min = PERIODS_MIN,
    43		.periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN,
    44	};
    45	
  > 46	int dw_pcm_transfer(u32 *lsample, u32 *rsample, int bytes, int buf_size,
    47			struct dw_pcm_binfo *bi)
    48	{
    49		struct snd_pcm_runtime *rt = bi->stream->runtime;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

author
#17 lore raw

PATCH v4 5/5 ASoC: dwc: Update DOCUMENTATION for I2S Driver

In reply to Jose Abreu

This patch updates documentation for the Designware I2S driver.

---

This patch was only introduced in v4.

 Documentation/devicetree/bindings/sound/designware-i2s.txt | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/sound/designware-i2s.txt +5 -0
index 7bb5424..f3b5c17 100644
@@ -7,6 +7,10 @@ Required properties:
    clocks. The controller expects one clock: the clock used as the sampling
    rate reference clock sample.
  - clock-names : "i2sclk" for the sample rate reference clock.
+
+ Optional properties:
+ - snps,use-dmaengine: If set the driver will use ALSA DMA engine. If set
+   it is required to use the properties 'dmas' and 'dma-names'.
  - dmas: Pairs of phandle and specifier for the DMA channels that are used by
    the core. The core expects one or two dma channels: one for transmit and
    one for receive.
@@ -26,6 +30,7 @@ Example:
 		clocks = <&scpi_i2sclk 0>;
 		clock-names = "i2sclk";
 		#sound-dai-cells = <0>;
+		snps,use-dmaengine;
 		dmas = <&dma0 5>;
 		dma-names = "tx";
 	};
Signature · 1 line
1.9.1
maintainer
#18 lore raw

Re: [PATCH 5/5 v4] ASoC: dwc: Update DOCUMENTATION for I2S Driver

Quoted 3 lines · Jose Abreu

+ Optional properties:
+ - snps,use-dmaengine: If set the driver will use ALSA DMA engine. If set
+ it is required to use the properties 'dmas' and 'dma-names'.

This is not a good interface, it's describing Linux internal APIs. If the device needs to operate in PIO mode it should just do that.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#19 lore raw

Re: [PATCH 5/5 v4] ASoC: dwc: Update DOCUMENTATION for I2S Driver

Hi Mark,

Quoted 7 lines · Mark Brown
Quoted 3 lines · Jose Abreu

+ Optional properties:
+ - snps,use-dmaengine: If set the driver will use ALSA DMA engine. If set
+ it is required to use the properties 'dmas' and 'dma-names'.

This is not a good interface, it's describing Linux internal APIs. If the device needs to operate in PIO mode it should just do that.

I added this interface because there is no direct way to check if DMA is available on the I2S controller so it is not possible to automatically change between DMA and PIO mode. As the I2S controller can be built with or without DMA support it is necessary to somehow check if DMA is enabled or not and according to that use either ALSA DMA engine or the custom platform driver sent in these patches. I did not want to remove drivers functionality so I added this property to the DT. This way a user can select between DMA and PIO mode.

Is there a better option to do this without removing the possibility of using ALSA DMA engine in the driver?

Best regards,
Jose Miguel Abreu

#20 lore raw

Re: [alsa-devel] [PATCH 5/5 v4] ASoC: dwc: Update DOCUMENTATION for I2S Driver

Quoted 12 lines · Jose Abreu

Hi Mark,

Quoted 7 lines · Mark Brown
Quoted 3 lines · Jose Abreu

+ Optional properties:
+ - snps,use-dmaengine: If set the driver will use ALSA DMA engine. If set
+ it is required to use the properties 'dmas' and 'dma-names'.

This is not a good interface, it's describing Linux internal APIs. If the device needs to operate in PIO mode it should just do that.

Quoted 7 lines

I added this interface because there is no direct way to check if DMA is available on the I2S controller so it is not possible to automatically change between DMA and PIO mode. As the I2S controller can be built with or without DMA support it is necessary to somehow check if DMA is enabled or not and according to that use either ALSA DMA engine or the custom platform driver sent in these patches. I did not want to remove drivers functionality so I added this property to the DT. This way a user can select between DMA and PIO mode.

That's OK, but you need to describe the hardware, not the indented behavior of the software driver.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#21 lore raw

Re: [alsa-devel] [PATCH 5/5 v4] ASoC: dwc: Update DOCUMENTATION for I2S Driver

Hi Lars,

Quoted 19 lines · Lars-Peter Clausen
Quoted 11 lines · Jose Abreu

Hi Mark,

Quoted 7 lines · Mark Brown
Quoted 3 lines · Jose Abreu

+ Optional properties:
+ - snps,use-dmaengine: If set the driver will use ALSA DMA engine. If set
+ it is required to use the properties 'dmas' and 'dma-names'.

This is not a good interface, it's describing Linux internal APIs. If the device needs to operate in PIO mode it should just do that.

Quoted 7 lines

I added this interface because there is no direct way to check if DMA is available on the I2S controller so it is not possible to automatically change between DMA and PIO mode. As the I2S controller can be built with or without DMA support it is necessary to somehow check if DMA is enabled or not and according to that use either ALSA DMA engine or the custom platform driver sent in these patches. I did not want to remove drivers functionality so I added this property to the DT. This way a user can select between DMA and PIO mode.

Quoted 3 lines

That's OK, but you need to describe the hardware, not the indented behavior of the software driver.

Is this okay: "snps,use-dmaengine: Set this boolean paramater if I2S controller has DMA support. If set the properties 'dmas' and 'dma-names' must be also set" ?

Best regards,
Jose Miguel Abreu

#22 lore raw

Re: [alsa-devel] [PATCH 5/5 v4] ASoC: dwc: Update DOCUMENTATION for I2S Driver

Quoted 23 lines · Jose Abreu

Hi Lars,

Quoted 19 lines · Lars-Peter Clausen
Quoted 18 lines · Jose Abreu

Hi Mark,

Quoted 7 lines · Mark Brown
Quoted 3 lines · Jose Abreu

+ Optional properties:
+ - snps,use-dmaengine: If set the driver will use ALSA DMA engine. If set
+ it is required to use the properties 'dmas' and 'dma-names'.

This is not a good interface, it's describing Linux internal APIs. If the device needs to operate in PIO mode it should just do that.

I added this interface because there is no direct way to check if DMA is available on the I2S controller so it is not possible to automatically change between DMA and PIO mode. As the I2S controller can be built with or without DMA support it is necessary to somehow check if DMA is enabled or not and according to that use either ALSA DMA engine or the custom platform driver sent in these patches. I did not want to remove drivers functionality so I added this property to the DT. This way a user can select between DMA and PIO mode.

Quoted 6 lines
Quoted 3 lines

That's OK, but you need to describe the hardware, not the indented behavior of the software driver.

Is this okay: "snps,use-dmaengine: Set this boolean paramater if I2S controller has DMA support. If set the properties 'dmas' and 'dma-names' must be also set" ?

The description is better. But the name of the property is still imperative rather then descriptive. It tells the software what should be done rather then describing what the hardware looks like.

Since there is already the dmas property which is present if a DMA is connected and is absent when no DMA is present it should be enough to just check that property rather than requiring an additional one.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#23 lore raw

Re: [alsa-devel] [PATCH 5/5 v4] ASoC: dwc: Update DOCUMENTATION for I2S Driver

Hi Lars,

Quoted 29 lines · Lars-Peter Clausen
Quoted 23 lines · Jose Abreu

Hi Lars,

Quoted 19 lines · Lars-Peter Clausen
Quoted 18 lines · Jose Abreu

Hi Mark,

Quoted 7 lines · Mark Brown
Quoted 3 lines · Jose Abreu

+ Optional properties:
+ - snps,use-dmaengine: If set the driver will use ALSA DMA engine. If set
+ it is required to use the properties 'dmas' and 'dma-names'.

This is not a good interface, it's describing Linux internal APIs. If the device needs to operate in PIO mode it should just do that.

I added this interface because there is no direct way to check if DMA is available on the I2S controller so it is not possible to automatically change between DMA and PIO mode. As the I2S controller can be built with or without DMA support it is necessary to somehow check if DMA is enabled or not and according to that use either ALSA DMA engine or the custom platform driver sent in these patches. I did not want to remove drivers functionality so I added this property to the DT. This way a user can select between DMA and PIO mode.

Quoted 5 lines
Quoted 3 lines

That's OK, but you need to describe the hardware, not the indented behavior of the software driver.

Is this okay: "snps,use-dmaengine: Set this boolean paramater if I2S controller has DMA support. If set the properties 'dmas' and 'dma-names' must be also set" ?

Quoted 7 lines

The description is better. But the name of the property is still imperative rather then descriptive. It tells the software what should be done rather then describing what the hardware looks like.

Since there is already the dmas property which is present if a DMA is connected and is absent when no DMA is present it should be enough to just check that property rather than requiring an additional one.

Ok, will then use the DMA property to decide which mode to use: PIO or DMA.

Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Best regards,
Jose Miguel Abreu