Skip to contentSkip to conversation

ASoC: mediatek: mt8183-mt6358-ts3a227-max98357: support WoV

PATCH Superseded Tzung-Bi Shih 4 participants 19 messages Oct 5, 2019 – Oct 14, 2019

Subsystems (7)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover ASoC: mediatek: mt8183-mt6358-ts3a227-max98357: support WoV

This series makes mt6358, cros_ec_codec, and mt8183-mt6358-ts3a227-max98357 support WoV (wake on voice).

The first 3 commits are some cleanups and refactors. It looks like breaking the existing interface. But please be noticed that, the cros_ec_codec has not used by any real device yet. The refactor is very necessary to keep the style consistent and for easier to further extend and maintain.
platform/chrome: cros_ec: remove unused EC feature
ASoC: cros_ec_codec: refactor I2S RX
ASoC: cros_ec_codec: extract DMIC EC command from I2S RX

The 4th commit extends the feature offered from EC codec.
platform/chrome: cros_ec: add common commands for EC codec

The 5th commit changes the behavior of setting and getting DMIC gains.
ASoC: cros_ec_codec: read max DMIC gain from EC codec

The 6th and 7th commit make cros_ec_codec support WoV.
ASoC: dt-bindings: cros_ec_codec: add SHM bindings
ASoC: cros_ec_codec: support WoV

The 8th commit sets necessary registers on mt6358 to support WoV.
ASoC: mediatek: mt6358: support WoV

The last 2 commit make machine driver mt8183-mt6358-ts3a227-max98357 support WoV if ec-codec is in DTS.
ASoC: dt-bindings: mt8183: add ec-codec
ASoC: mediatek: mt8183: support WoV

Changes from v1:
- fix a compile error and make kbuild bot happy
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-October/156315.html

Tzung-Bi Shih (10):
platform/chrome: cros_ec: remove unused EC feature
ASoC: cros_ec_codec: refactor I2S RX
ASoC: cros_ec_codec: extract DMIC EC command from I2S RX platform/chrome: cros_ec: add common commands for EC codec
ASoC: cros_ec_codec: read max DMIC gain from EC codec
ASoC: dt-bindings: cros_ec_codec: add SHM bindings
ASoC: cros_ec_codec: support WoV
ASoC: mediatek: mt6358: support WoV
ASoC: dt-bindings: mt8183: add ec-codec
ASoC: mediatek: mt8183: support WoV

 .../bindings/sound/google,cros-ec-codec.txt   |   24 +-
 .../sound/mt8183-mt6358-ts3a227-max98357.txt  |    3 +
 drivers/platform/chrome/cros_ec_trace.c       |    5 +-
 .../linux/platform_data/cros_ec_commands.h    |  285 ++++-
 sound/soc/codecs/cros_ec_codec.c              | 1125 +++++++++++++----
 sound/soc/codecs/mt6358.c                     |  105 ++
 sound/soc/mediatek/Kconfig                    |    1 +
 .../mt8183/mt8183-mt6358-ts3a227-max98357.c   |   70 +-
 8 files changed, 1292 insertions(+), 326 deletions(-)
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
#1 lore raw

PATCH v2 1/10 platform/chrome: cros_ec: remove unused EC feature

Remove unused EC_FEATURE_AUDIO_CODEC.

---
 include/linux/platform_data/cros_ec_commands.h | 2 --
 1 file changed, 2 deletions(-)
include/linux/platform_data/cros_ec_commands.h +0 -2
index 98415686cbfa..43b8f7dae4cc 100644
@@ -1277,8 +1277,6 @@ enum ec_feature_code {
 	 * MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE.
 	 */
 	EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37,
-	/* EC supports audio codec. */
-	EC_FEATURE_AUDIO_CODEC = 38,
 	/* The MCU is a System Companion Processor (SCP). */
 	EC_FEATURE_SCP = 39,
 	/* The MCU is an Integrated Sensor Hub */
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
#2 lore raw

PATCH v2 2/10 ASoC: cros_ec_codec: refactor I2S RX

In reply to Tzung-Bi Shih

Refactor by the following items:
- reformat copyright declaration
- use more specific name "i2s rx"
- use verbose symbol names to separate namespaces
- make some short functions inline
- remove unused TDM-related code

---
 drivers/platform/chrome/cros_ec_trace.c       |   2 +-
 .../linux/platform_data/cros_ec_commands.h    | 120 ++---
 sound/soc/codecs/cros_ec_codec.c              | 502 +++++++-----------
 3 files changed, 251 insertions(+), 373 deletions(-)
drivers/platform/chrome/cros_ec_trace.c +1 -1
index 6f80ff4532ae..901850004b2b 100644
@@ -98,7 +98,7 @@
 	TRACE_SYMBOL(EC_CMD_SB_READ_BLOCK), \
 	TRACE_SYMBOL(EC_CMD_SB_WRITE_BLOCK), \
 	TRACE_SYMBOL(EC_CMD_BATTERY_VENDOR_PARAM), \
-	TRACE_SYMBOL(EC_CMD_CODEC_I2S), \
+	TRACE_SYMBOL(EC_CMD_EC_CODEC_I2S_RX), \
 	TRACE_SYMBOL(EC_CMD_REBOOT_EC), \
 	TRACE_SYMBOL(EC_CMD_GET_PANIC_INFO), \
 	TRACE_SYMBOL(EC_CMD_ACPI_READ), \
include/linux/platform_data/cros_ec_commands.h +51 -69

143 lines not on this page · raw message

sound/soc/codecs/cros_ec_codec.c +199 -303

619 lines not on this page · raw message

Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
#3 lore raw

PATCH v2 3/10 ASoC: cros_ec_codec: extract DMIC EC command from I2S RX

In reply to Tzung-Bi Shih

Extract DMIC EC command from I2S RX. Setting and getting microphone gains is common features.

---
 drivers/platform/chrome/cros_ec_trace.c       |  1 +
 .../linux/platform_data/cros_ec_commands.h    | 49 +++++++++++-----
 sound/soc/codecs/cros_ec_codec.c              | 57 ++++++++++---------
 3 files changed, 68 insertions(+), 39 deletions(-)
drivers/platform/chrome/cros_ec_trace.c +1 -0
index 901850004b2b..e73bb6a8b00e 100644
@@ -98,6 +98,7 @@
 	TRACE_SYMBOL(EC_CMD_SB_READ_BLOCK), \
 	TRACE_SYMBOL(EC_CMD_SB_WRITE_BLOCK), \
 	TRACE_SYMBOL(EC_CMD_BATTERY_VENDOR_PARAM), \
+	TRACE_SYMBOL(EC_CMD_EC_CODEC_DMIC), \
 	TRACE_SYMBOL(EC_CMD_EC_CODEC_I2S_RX), \
 	TRACE_SYMBOL(EC_CMD_REBOOT_EC), \
 	TRACE_SYMBOL(EC_CMD_GET_PANIC_INFO), \
include/linux/platform_data/cros_ec_commands.h +36 -13

73 lines not on this page · raw message

sound/soc/codecs/cros_ec_codec.c +31 -26

91 lines not on this page · raw message

Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
#4 lore raw

PATCH v2 4/10 platform/chrome: cros_ec: add common commands for EC codec

In reply to Tzung-Bi Shih

Add the following common commands:
- GET_CAPABILITIES
- GET_SHM_ADDR
- SET_SHM_ADDR

---
 drivers/platform/chrome/cros_ec_trace.c       |  1 +
 .../linux/platform_data/cros_ec_commands.h    | 64 ++++++++++++++++++-
 2 files changed, 63 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_trace.c +1 -0
index e73bb6a8b00e..2ea0d4e0d54d 100644
@@ -98,6 +98,7 @@
 	TRACE_SYMBOL(EC_CMD_SB_READ_BLOCK), \
 	TRACE_SYMBOL(EC_CMD_SB_WRITE_BLOCK), \
 	TRACE_SYMBOL(EC_CMD_BATTERY_VENDOR_PARAM), \
+	TRACE_SYMBOL(EC_CMD_EC_CODEC), \
 	TRACE_SYMBOL(EC_CMD_EC_CODEC_DMIC), \
 	TRACE_SYMBOL(EC_CMD_EC_CODEC_I2S_RX), \
 	TRACE_SYMBOL(EC_CMD_REBOOT_EC), \
include/linux/platform_data/cros_ec_commands.h +62 -2

77 lines not on this page · raw message

Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
#5 lore raw

PATCH v2 5/10 ASoC: cros_ec_codec: read max DMIC gain from EC codec

In reply to Tzung-Bi Shih

Read max DMIC gain from EC codec instead of DTS. Also removes the dt-binding of max-dmic-gain.

---
 .../bindings/sound/google,cros-ec-codec.txt   |  4 +-
 .../linux/platform_data/cros_ec_commands.h    | 43 +++++++++++----
 sound/soc/codecs/cros_ec_codec.c              | 53 ++++++++++++++-----
 3 files changed, 73 insertions(+), 27 deletions(-)
Documentation/devicetree/bindings/sound/google,cros-ec-codec.txt +1 -3
index 1084f7f22eea..0ce9fafc78e2 100644
@@ -1,4 +1,4 @@
-* Audio codec controlled by ChromeOS EC
+Audio codec controlled by ChromeOS EC
 
 Google's ChromeOS EC codec is a digital mic codec provided by the
 Embedded Controller (EC) and is controlled via a host-command interface.
@@ -9,7 +9,6 @@ Documentation/devicetree/bindings/mfd/cros-ec.txt).
 Required properties:
 - compatible: Must contain "google,cros-ec-codec"
 - #sound-dai-cells: Should be 1. The cell specifies number of DAIs.
-- max-dmic-gain: A number for maximum gain in dB on digital microphone.
 
 Example:
 
@@ -21,6 +20,5 @@ cros-ec@0 {
 	cros_ec_codec: ec-codec {
 		compatible = "google,cros-ec-codec";
 		#sound-dai-cells = <1>;
-		max-dmic-gain = <43>;
 	};
 };
include/linux/platform_data/cros_ec_commands.h +33 -10

63 lines not on this page · raw message

sound/soc/codecs/cros_ec_codec.c +39 -14

91 lines not on this page · raw message

Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
maintainer Acked-by on v2 5/10
#6 lore raw

Re: [alsa-devel] [PATCH v2 05/10] ASoC: cros_ec_codec: read max DMIC gain from EC codec

Quoted 10 lines · Tzung-Bi Shih

Read max DMIC gain from EC codec instead of DTS. Also removes the dt-binding of max-dmic-gain.

---
 .../bindings/sound/google,cros-ec-codec.txt   |  4 +-
 .../linux/platform_data/cros_ec_commands.h    | 43 +++++++++++----
 sound/soc/codecs/cros_ec_codec.c              | 53 ++++++++++++++-----
 3 files changed, 73 insertions(+), 27 deletions(-)
#7 lore raw

PATCH v2 6/10 ASoC: dt-bindings: cros_ec_codec: add SHM bindings

In reply to Tzung-Bi Shih

- Add "ec-shm" for binding to shared memory exposed by EC.
- Add "memory-region" for binding to memory region shared by AP.

---
 .../bindings/sound/google,cros-ec-codec.txt   | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
Documentation/devicetree/bindings/sound/google,cros-ec-codec.txt +20 -0
index 0ce9fafc78e2..cb46bc082b4b 100644
@@ -10,8 +10,26 @@ Required properties:
 - compatible: Must contain "google,cros-ec-codec"
 - #sound-dai-cells: Should be 1. The cell specifies number of DAIs.
 
+Optional properties:
+- ec-shm: Shared memory region from EC.  It contains 3 unsigned 32-bit
+          integer.  The first 2 integers combine to become an unsigned
+	  64-bit address.  The last one integer is length of the shared
+	  memory.
+- memory-region: Shared memory region to EC.  A "shared-dma-pool".  See
+                 ../reserved-memory/reserved-memory.txt for details.
+
 Example:
 
+{
+	...
+
+	reserved_mem: reserved_mem {
+		compatible = "shared-dma-pool";
+		reg = <0 0x52800000 0 0x100000>;
+		no-map;
+	};
+}
+
 cros-ec@0 {
 	compatible = "google,cros-ec-spi";
 
@@ -20,5 +38,7 @@ cros-ec@0 {
 	cros_ec_codec: ec-codec {
 		compatible = "google,cros-ec-codec";
 		#sound-dai-cells = <1>;
+		ec-shm = <0x0 0x10500000 0x80000>;
+		memory-region = <&reserved_mem>;
 	};
 };
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
maintainer
#8 lore raw

Re: [alsa-devel] [PATCH v2 06/10] ASoC: dt-bindings: cros_ec_codec: add SHM bindings

Quoted 13 lines · Tzung-Bi Shih

- Add "ec-shm" for binding to shared memory exposed by EC.
- Add "memory-region" for binding to memory region shared by AP.

---
 .../bindings/sound/google,cros-ec-codec.txt   | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
Documentation/devicetree/bindings/sound/google,cros-ec-codec.txt +0 -0
index 0ce9fafc78e2..cb46bc082b4b 100644

Documentation/devicetree/bindings/sound/google,cros-ec-codec.txt Required properties: · line 17

Quoted 8 lines
Documentation/devicetree/bindings/sound/google,cros-ec-codec.txt +5 -0
@@ -10,8 +10,26 @@ Required properties:
 - compatible: Must contain "google,cros-ec-codec"
 - #sound-dai-cells: Should be 1. The cell specifies number of DAIs.
 
+Optional properties:
+- ec-shm: Shared memory region from EC.  It contains 3 unsigned 32-bit
+          integer.  The first 2 integers combine to become an unsigned
+	  64-bit address.  The last one integer is length of the shared
+	  memory.

This is an address accessible to the main CPU? If so, then it really should be using 'reg' and be translatable.

Quoted 29 lines
Documentation/devicetree/bindings/sound/google,cros-ec-codec.txt +15 -0
+- memory-region: Shared memory region to EC.  A "shared-dma-pool".  See
+                 ../reserved-memory/reserved-memory.txt for details.
+
 Example:
 
+{
+	...
+
+	reserved_mem: reserved_mem {
+		compatible = "shared-dma-pool";
+		reg = <0 0x52800000 0 0x100000>;
+		no-map;
+	};
+}
+
 cros-ec@0 {
 	compatible = "google,cros-ec-spi";
 
@@ -20,5 +38,7 @@ cros-ec@0 {
 	cros_ec_codec: ec-codec {
 		compatible = "google,cros-ec-codec";
 		#sound-dai-cells = <1>;
+		ec-shm = <0x0 0x10500000 0x80000>;
+		memory-region = <&reserved_mem>;
 	};
 };
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
#9 lore raw

PATCH v2 7/10 ASoC: cros_ec_codec: support WoV

In reply to Tzung-Bi Shih

1. Get EC codec's capabilities.
2. Get and set SHM address if any.
3. Transmit language model to EC codec if needed.
4. Start to read audio data from EC codec if receives host event.

---
 drivers/platform/chrome/cros_ec_trace.c       |   1 +
 .../linux/platform_data/cros_ec_commands.h    |  69 ++
 sound/soc/codecs/cros_ec_codec.c              | 695 +++++++++++++++++-
 3 files changed, 763 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_trace.c +1 -0
index 2ea0d4e0d54d..5af1d66d9eca 100644
@@ -101,6 +101,7 @@
 	TRACE_SYMBOL(EC_CMD_EC_CODEC), \
 	TRACE_SYMBOL(EC_CMD_EC_CODEC_DMIC), \
 	TRACE_SYMBOL(EC_CMD_EC_CODEC_I2S_RX), \
+	TRACE_SYMBOL(EC_CMD_EC_CODEC_WOV), \
 	TRACE_SYMBOL(EC_CMD_REBOOT_EC), \
 	TRACE_SYMBOL(EC_CMD_GET_PANIC_INFO), \
 	TRACE_SYMBOL(EC_CMD_ACPI_READ), \
include/linux/platform_data/cros_ec_commands.h +69 -0

91 lines not on this page · raw message

sound/soc/codecs/cros_ec_codec.c +693 -2

746 lines not on this page · raw message

Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
#10 lore raw

Re: [alsa-devel] [PATCH v2 07/10] ASoC: cros_ec_codec: support WoV

Thank you for the patch! Perhaps something to improve:

Hi Tzung-Bi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[cannot apply to v5.4-rc1 next-20191004]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Tzung-Bi-Shih/ASoC-mediatek-mt8183-mt6358-ts3a227-max98357-support-WoV/20191005-171021
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-rc1-42-g38eda53-dirty
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag

sparse warnings: (new ones prefixed by >>)

>> sound/soc/codecs/cros_ec_codec.c:430:39: sparse: sparse: incorrect type in return expression (different address spaces) @@    expected void * @@    got void [noderef] <asvoid * @@
>> sound/soc/codecs/cros_ec_codec.c:430:39: sparse:    expected void *
>> sound/soc/codecs/cros_ec_codec.c:430:39: sparse:    got void [noderef] <asn:2> *
>> sound/soc/codecs/cros_ec_codec.c:549:69: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void const volatile [noderef] <asn:2> * @@    got latile [noderef] <asn:2> * @@
>> sound/soc/codecs/cros_ec_codec.c:549:69: sparse:    expected void const volatile [noderef] <asn:2> *
>> sound/soc/codecs/cros_ec_codec.c:549:69: sparse:    got unsigned char [usertype] *addr
>> sound/soc/codecs/cros_ec_codec.c:698:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void volatile [noderef] <asn:2> * @@    got latile [noderef] <asn:2> * @@
>> sound/soc/codecs/cros_ec_codec.c:698:33: sparse:    expected void volatile [noderef] <asn:2> *
>> sound/soc/codecs/cros_ec_codec.c:698:33: sparse:    got unsigned char [usertype] *wov_lang_shm_p
   sound/soc/codecs/cros_ec_codec.c:699:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void volatile [noderef] <asn:2> * @@    got latile [noderef] <asn:2> * @@
   sound/soc/codecs/cros_ec_codec.c:699:48: sparse:    expected void volatile [noderef] <asn:2> *
>> sound/soc/codecs/cros_ec_codec.c:699:48: sparse:    got unsigned char [usertype] *

vim +430 sound/soc/codecs/cros_ec_codec.c

406
407 static void *wov_map_shm(struct cros_ec_codec_priv *priv,
408 uint8_t shm_id, uint32_t *len, uint8_t *type)
409 {
410 struct ec_param_ec_codec p;
411 struct ec_response_ec_codec_get_shm_addr r;
412 uint32_t req, offset;
413
414 p.cmd = EC_CODEC_GET_SHM_ADDR;
415 p.get_shm_addr_param.shm_id = shm_id;
416 if (send_ec_host_command(priv->ec_device, EC_CMD_EC_CODEC,
417 (uint8_t *)&p, sizeof(p),
418 (uint8_t *)&r, sizeof(r)) < 0) {
419 dev_err(priv->dev, "failed to EC_CODEC_GET_SHM_ADDR\n");
420 return NULL;
421 }
422
423 dev_dbg(priv->dev, "phys_addr=%#llx, len=%#x\n", r.phys_addr, r.len);
424
425 *len = r.len;
426 *type = r.type;
427
428 switch (r.type) {
429 case EC_CODEC_SHM_TYPE_EC_RAM:

 > 430			return devm_ioremap_wc(priv->dev,
   431					       r.phys_addr + priv->ec_shm_addr, r.len);
   432		case EC_CODEC_SHM_TYPE_SYSTEM_RAM:
   433			if (r.phys_addr) {
   434				dev_err(priv->dev, "unknown status\n");
   435				return NULL;
   436			}
   437	
   438			req = round_up(r.len, PAGE_SIZE);
   439			dev_dbg(priv->dev, "round up from %u to %u\n", r.len, req);
   440	
   441			if (priv->ap_shm_last_alloc + req >
   442			    priv->ap_shm_phys_addr + priv->ap_shm_len) {
   443				dev_err(priv->dev, "insufficient space for AP SHM\n");
   444				return NULL;
   445			}
   446	
   447			dev_dbg(priv->dev, "alloc AP SHM addr=%#llx, len=%#x\n",
   448				priv->ap_shm_last_alloc, req);
   449	
   450			p.cmd = EC_CODEC_SET_SHM_ADDR;
   451			p.set_shm_addr_param.phys_addr = priv->ap_shm_last_alloc;
   452			p.set_shm_addr_param.len = req;
   453			p.set_shm_addr_param.shm_id = shm_id;
   454			if (send_ec_host_command(priv->ec_device, EC_CMD_EC_CODEC,
   455						 (uint8_t *)&p, sizeof(p),
   456						 NULL, 0) < 0) {
   457				dev_err(priv->dev, "failed to EC_CODEC_SET_SHM_ADDR\n");
   458				return NULL;
   459			}
   460	
   461			/*
   462			 * Note: EC codec only requests for `r.len' but we allocate
   463			 * round up PAGE_SIZE `req'.
   464			 */
   465			offset = priv->ap_shm_last_alloc - priv->ap_shm_phys_addr;
   466			priv->ap_shm_last_alloc += req;
   467	
   468			return (void *)(uintptr_t)(priv->ap_shm_addr + offset);
   469		default:
   470			return NULL;
   471		}
   472	}
   473	
   474	static bool wov_queue_full(struct cros_ec_codec_priv *priv)
   475	{
   476		return ((priv->wov_wp + 1) % sizeof(priv->wov_buf)) == priv->wov_rp;
   477	}
   478	
   479	static size_t wov_queue_size(struct cros_ec_codec_priv *priv)
   480	{
   481		if (priv->wov_wp >= priv->wov_rp)
   482			return priv->wov_wp - priv->wov_rp;
   483		else
   484			return sizeof(priv->wov_buf) - priv->wov_rp + priv->wov_wp;
   485	}
   486	
   487	static void wov_queue_dequeue(struct cros_ec_codec_priv *priv, size_t len)
   488	{
   489		struct snd_pcm_runtime *runtime = priv->wov_substream->runtime;
   490		size_t req;
   491	
   492		while (len) {
   493			req = min(len, runtime->dma_bytes - priv->wov_dma_offset);
   494			if (priv->wov_wp >= priv->wov_rp)
   495				req = min(req, (size_t)priv->wov_wp - priv->wov_rp);
   496			else
   497				req = min(req, sizeof(priv->wov_buf) - priv->wov_rp);
   498	
   499			memcpy(runtime->dma_area + priv->wov_dma_offset,
   500			       priv->wov_buf + priv->wov_rp, req);
   501	
   502			priv->wov_dma_offset += req;
   503			if (priv->wov_dma_offset == runtime->dma_bytes)
   504				priv->wov_dma_offset = 0;
   505	
   506			priv->wov_rp += req;
   507			if (priv->wov_rp == sizeof(priv->wov_buf))
   508				priv->wov_rp = 0;
   509	
   510			len -= req;
   511		}
   512	
   513		snd_pcm_period_elapsed(priv->wov_substream);
   514	}
   515	
   516	static void wov_queue_try_dequeue(struct cros_ec_codec_priv *priv)
   517	{
   518		size_t period_bytes = snd_pcm_lib_period_bytes(priv->wov_substream);
   519	
   520		while (period_bytes && wov_queue_size(priv) >= period_bytes) {
   521			wov_queue_dequeue(priv, period_bytes);
   522			period_bytes = snd_pcm_lib_period_bytes(priv->wov_substream);
   523		}
   524	}
   525	
   526	static void wov_queue_enqueue(struct cros_ec_codec_priv *priv,
   527				      uint8_t *addr, size_t len, bool iomem)
   528	{
   529		size_t req;
   530	
   531		while (len) {
   532			if (wov_queue_full(priv)) {
   533				wov_queue_try_dequeue(priv);
   534	
   535				if (wov_queue_full(priv)) {
   536					dev_err(priv->dev, "overrun detected\n");
   537					return;
   538				}
   539			}
   540	
   541			if (priv->wov_wp >= priv->wov_rp)
   542				req = sizeof(priv->wov_buf) - priv->wov_wp;
   543			else
   544				/* Note: waste 1-byte to differentiate full and empty */
   545				req = priv->wov_rp - priv->wov_wp - 1;
   546			req = min(req, len);
   547	
   548			if (iomem)
 > 549				memcpy_fromio(priv->wov_buf + priv->wov_wp, addr, req);

550 else
551 memcpy(priv->wov_buf + priv->wov_wp, addr, req);
552
553 priv->wov_wp += req;
554 if (priv->wov_wp == sizeof(priv->wov_buf))
555 priv->wov_wp = 0;
556
557 addr += req;
558 len -= req;
559 }
560
561 wov_queue_try_dequeue(priv);
562 }
563

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

#11 lore raw

Re: [alsa-devel] [PATCH v2 07/10] ASoC: cros_ec_codec: support WoV

Quoted 23 lines · kbuild test robot
url:    https://github.com/0day-ci/linux/commits/Tzung-Bi-Shih/ASoC-mediatek-mt8183-mt6358-ts3a227-max98357-support-WoV/20191005-171021
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-rc1-42-g38eda53-dirty
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag

sparse warnings: (new ones prefixed by >>)

Quoted 9 lines
Quoted 9 lines

sound/soc/codecs/cros_ec_codec.c:430:39: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] <asvoid * @@
sound/soc/codecs/cros_ec_codec.c:430:39: sparse: expected void *
sound/soc/codecs/cros_ec_codec.c:430:39: sparse: got void [noderef] <asn:2> *
sound/soc/codecs/cros_ec_codec.c:549:69: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const volatile [noderef] <asn:2> * @@ got latile [noderef] <asn:2> * @@
sound/soc/codecs/cros_ec_codec.c:549:69: sparse: expected void const volatile [noderef] <asn:2> *
sound/soc/codecs/cros_ec_codec.c:549:69: sparse: got unsigned char [usertype] *addr
sound/soc/codecs/cros_ec_codec.c:698:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] <asn:2> * @@ got latile [noderef] <asn:2> * @@
sound/soc/codecs/cros_ec_codec.c:698:33: sparse: expected void volatile [noderef] <asn:2> *
sound/soc/codecs/cros_ec_codec.c:698:33: sparse: got unsigned char [usertype] *wov_lang_shm_p

Quoted 3 lines

sound/soc/codecs/cros_ec_codec.c:699:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] <asn:2> * @@ got latile [noderef] <asn:2> * @@
sound/soc/codecs/cros_ec_codec.c:699:48: sparse: expected void volatile [noderef] <asn:2> *

Quoted 1 line
Quoted 1 line

sound/soc/codecs/cros_ec_codec.c:699:48: sparse: got unsigned char [usertype] *

I cannot reproduce the same sparse errors.

My commit stack: apply my patches onto broonie/sound.git for-next

$ git log --oneline
b4471777f5d8 (HEAD -> draft) ASoC: mediatek: mt8183: support WoV
b6bb558fa59d ASoC: dt-bindings: mt8183: add ec-codec
a08bede115d4 ASoC: mediatek: mt6358: support WoV
f67068fd0c91 ASoC: cros_ec_codec: support WoV
7e11271c070e ASoC: dt-bindings: cros_ec_codec: add SHM bindings
fd04f20e77d3 ASoC: cros_ec_codec: read max DMIC gain from EC codec
c008f01d5bc3 platform/chrome: cros_ec: add common commands for EC codec
50d2c1f9b1f4 ASoC: cros_ec_codec: extract DMIC EC command from I2S RX
00e5a1c121eb ASoC: cros_ec_codec: refactor I2S RX
3f0c475d6ec8 platform/chrome: cros_ec: remove unused EC feature
3877dcd0194c (mark/for-next, asoc-next) Merge branch 'asoc-5.5' into asoc-next

My reproduce steps:

$ make ARCH=x86_64 mrproper
$ make ARCH=x86_64 allmodconfig
$ make ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' -j40
2>&1 | grep -v sched | tee log.txt
(Note: filter sched out to not get flood sparse errors)
$ grep cros_ec_codec log.txt
  CHECK   sound/soc/codecs/cros_ec_codec.c
  CC [M]  sound/soc/codecs/cros_ec_codec.o

It did not generate the same message as 0day reported.

One difference would be the sparse version (it is from "apt install" in my environment):

$ sparse --version
0.6.0 (Debian: 0.6.0-3)
On the other hand, 0day used "v0.6.1-rc1-42-g38eda53-dirty".

Guenter, what we could do in the case? Do you have any idea?

#12 lore raw

Re: [alsa-devel] [kbuild-all] Re: [PATCH v2 07/10] ASoC: cros_ec_codec: support WoV

Quoted 53 lines · Tzung-Bi Shih
Quoted 23 lines · kbuild test robot
url:    https://github.com/0day-ci/linux/commits/Tzung-Bi-Shih/ASoC-mediatek-mt8183-mt6358-ts3a227-max98357-support-WoV/20191005-171021
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
reproduce:
         # apt-get install sparse
         # sparse version: v0.6.1-rc1-42-g38eda53-dirty
         make ARCH=x86_64 allmodconfig
         make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag

sparse warnings: (new ones prefixed by >>)

Quoted 9 lines
Quoted 9 lines

sound/soc/codecs/cros_ec_codec.c:430:39: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] <asvoid * @@
sound/soc/codecs/cros_ec_codec.c:430:39: sparse: expected void *
sound/soc/codecs/cros_ec_codec.c:430:39: sparse: got void [noderef] <asn:2> *
sound/soc/codecs/cros_ec_codec.c:549:69: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const volatile [noderef] <asn:2> * @@ got latile [noderef] <asn:2> * @@
sound/soc/codecs/cros_ec_codec.c:549:69: sparse: expected void const volatile [noderef] <asn:2> *
sound/soc/codecs/cros_ec_codec.c:549:69: sparse: got unsigned char [usertype] *addr
sound/soc/codecs/cros_ec_codec.c:698:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] <asn:2> * @@ got latile [noderef] <asn:2> * @@
sound/soc/codecs/cros_ec_codec.c:698:33: sparse: expected void volatile [noderef] <asn:2> *
sound/soc/codecs/cros_ec_codec.c:698:33: sparse: got unsigned char [usertype] *wov_lang_shm_p

Quoted 3 lines

sound/soc/codecs/cros_ec_codec.c:699:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] <asn:2> * @@ got latile [noderef] <asn:2> * @@
sound/soc/codecs/cros_ec_codec.c:699:48: sparse: expected void volatile [noderef] <asn:2> *

Quoted 1 line
Quoted 1 line

sound/soc/codecs/cros_ec_codec.c:699:48: sparse: got unsigned char [usertype] *

I cannot reproduce the same sparse errors.

My commit stack: apply my patches onto broonie/sound.git for-next

$ git log --oneline
b4471777f5d8 (HEAD -> draft) ASoC: mediatek: mt8183: support WoV
b6bb558fa59d ASoC: dt-bindings: mt8183: add ec-codec
a08bede115d4 ASoC: mediatek: mt6358: support WoV
f67068fd0c91 ASoC: cros_ec_codec: support WoV
7e11271c070e ASoC: dt-bindings: cros_ec_codec: add SHM bindings
fd04f20e77d3 ASoC: cros_ec_codec: read max DMIC gain from EC codec
c008f01d5bc3 platform/chrome: cros_ec: add common commands for EC codec
50d2c1f9b1f4 ASoC: cros_ec_codec: extract DMIC EC command from I2S RX
00e5a1c121eb ASoC: cros_ec_codec: refactor I2S RX
3f0c475d6ec8 platform/chrome: cros_ec: remove unused EC feature
3877dcd0194c (mark/for-next, asoc-next) Merge branch 'asoc-5.5' into asoc-next

My reproduce steps:

$ make ARCH=x86_64 mrproper
$ make ARCH=x86_64 allmodconfig
$ make ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' -j40
2>&1 | grep -v sched | tee log.txt
(Note: filter sched out to not get flood sparse errors)
$ grep cros_ec_codec log.txt
   CHECK   sound/soc/codecs/cros_ec_codec.c
   CC [M]  sound/soc/codecs/cros_ec_codec.o
Quoted 7 lines

It did not generate the same message as 0day reported.

One difference would be the sparse version (it is from "apt install" in my environment):

$ sparse --version
0.6.0 (Debian: 0.6.0-3)
On the other hand, 0day used "v0.6.1-rc1-42-g38eda53-dirty".

Hi,

The sparse warnings could be generated by the latest sparse
(https://github.com/lucvoo/sparse.git). Could you try again?

Best Regards,
Rong Chen

Quoted 5 lines

Guenter, what we could do in the case? Do you have any idea?
_______________________________________________
kbuild-all mailing list -- [email protected] To unsubscribe send an email to [email protected]

#13 lore raw

Re: [alsa-devel] [kbuild-all] Re: [PATCH v2 07/10] ASoC: cros_ec_codec: support WoV

Quoted 47 lines · Rong Chen
Quoted 43 lines · Tzung-Bi Shih
Quoted 23 lines · kbuild test robot
url:    https://github.com/0day-ci/linux/commits/Tzung-Bi-Shih/ASoC-mediatek-mt8183-mt6358-ts3a227-max98357-support-WoV/20191005-171021
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
reproduce:
         # apt-get install sparse
         # sparse version: v0.6.1-rc1-42-g38eda53-dirty
         make ARCH=x86_64 allmodconfig
         make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag

sparse warnings: (new ones prefixed by >>)

Quoted 9 lines
Quoted 9 lines

sound/soc/codecs/cros_ec_codec.c:430:39: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] <asvoid * @@
sound/soc/codecs/cros_ec_codec.c:430:39: sparse: expected void *
sound/soc/codecs/cros_ec_codec.c:430:39: sparse: got void [noderef] <asn:2> *
sound/soc/codecs/cros_ec_codec.c:549:69: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const volatile [noderef] <asn:2> * @@ got latile [noderef] <asn:2> * @@
sound/soc/codecs/cros_ec_codec.c:549:69: sparse: expected void const volatile [noderef] <asn:2> *
sound/soc/codecs/cros_ec_codec.c:549:69: sparse: got unsigned char [usertype] *addr
sound/soc/codecs/cros_ec_codec.c:698:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] <asn:2> * @@ got latile [noderef] <asn:2> * @@
sound/soc/codecs/cros_ec_codec.c:698:33: sparse: expected void volatile [noderef] <asn:2> *
sound/soc/codecs/cros_ec_codec.c:698:33: sparse: got unsigned char [usertype] *wov_lang_shm_p

Quoted 3 lines

sound/soc/codecs/cros_ec_codec.c:699:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] <asn:2> * @@ got latile [noderef] <asn:2> * @@
sound/soc/codecs/cros_ec_codec.c:699:48: sparse: expected void volatile [noderef] <asn:2> *

Quoted 1 line
Quoted 1 line

sound/soc/codecs/cros_ec_codec.c:699:48: sparse: got unsigned char [usertype] *

I cannot reproduce the same sparse errors.

My commit stack: apply my patches onto broonie/sound.git for-next

$ git log --oneline
b4471777f5d8 (HEAD -> draft) ASoC: mediatek: mt8183: support WoV
b6bb558fa59d ASoC: dt-bindings: mt8183: add ec-codec
a08bede115d4 ASoC: mediatek: mt6358: support WoV
f67068fd0c91 ASoC: cros_ec_codec: support WoV
7e11271c070e ASoC: dt-bindings: cros_ec_codec: add SHM bindings
fd04f20e77d3 ASoC: cros_ec_codec: read max DMIC gain from EC codec
c008f01d5bc3 platform/chrome: cros_ec: add common commands for EC codec
50d2c1f9b1f4 ASoC: cros_ec_codec: extract DMIC EC command from I2S RX
00e5a1c121eb ASoC: cros_ec_codec: refactor I2S RX
3f0c475d6ec8 platform/chrome: cros_ec: remove unused EC feature
3877dcd0194c (mark/for-next, asoc-next) Merge branch 'asoc-5.5' into asoc-next
Quoted 4 lines
Quoted 4 lines

My reproduce steps:

$ make ARCH=x86_64 mrproper
$ make ARCH=x86_64 allmodconfig
$ make ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' -j40

Find a typo from my previous message. It should be "make ARCH=... C=1 ...".

Quoted 14 lines
Quoted 6 lines

2>&1 | grep -v sched | tee log.txt
(Note: filter sched out to not get flood sparse errors)

$ grep cros_ec_codec log.txt
   CHECK   sound/soc/codecs/cros_ec_codec.c
   CC [M]  sound/soc/codecs/cros_ec_codec.o
Quoted 7 lines

It did not generate the same message as 0day reported.

One difference would be the sparse version (it is from "apt install" in my environment):

$ sparse --version
0.6.0 (Debian: 0.6.0-3)
On the other hand, 0day used "v0.6.1-rc1-42-g38eda53-dirty".
Quoted 4 lines

Hi,

The sparse warnings could be generated by the latest sparse
(https://github.com/lucvoo/sparse.git). Could you try again?

Thanks. By using the version from github, it can generate the same sparse errors.

$ sparse --version
v0.6.1-rc1-43-g0ccb3b4

It seems current debian's version (i.e. 0.6.0 (Debian: 0.6.0-3)) cannot reproduce the errors even without the typo mentioned above.

Quoted 10 lines

Best Regards,
Rong Chen

Quoted 5 lines

Guenter, what we could do in the case? Do you have any idea?
_______________________________________________
kbuild-all mailing list -- [email protected] To unsubscribe send an email to [email protected]

#14 lore raw

PATCH v2 8/10 ASoC: mediatek: mt6358: support WoV

In reply to Tzung-Bi Shih

Switch mono DMIC on to support wake-on-voice.

---
 sound/soc/codecs/mt6358.c | 105 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)
sound/soc/codecs/mt6358.c +105 -0
index bb737fd678cc..1b830ea4f6ed 100644
@@ -93,6 +93,8 @@ struct mt6358_priv {
 	int mtkaif_protocol;
 
 	struct regulator *avdd_reg;
+
+	int wov_enabled;
 };
 
 int mt6358_set_mtkaif_protocol(struct snd_soc_component *cmpnt,
@@ -464,6 +466,106 @@ static int mt6358_put_volsw(struct snd_kcontrol *kcontrol,
 	return ret;
 }
 
+static void mt6358_restore_pga(struct mt6358_priv *priv);
+
+static int mt6358_enable_wov_phase2(struct mt6358_priv *priv)
+{
+	/* analog */
+	regmap_update_bits(priv->regmap, MT6358_AUDDEC_ANA_CON13,
+			   0xffff, 0x0000);
+	regmap_update_bits(priv->regmap, MT6358_DCXO_CW14, 0xffff, 0xa2b5);
+	regmap_update_bits(priv->regmap, MT6358_AUDENC_ANA_CON1,
+			   0xffff, 0x0800);
+	mt6358_restore_pga(priv);
+
+	regmap_update_bits(priv->regmap, MT6358_DCXO_CW13, 0xffff, 0x9929);
+	regmap_update_bits(priv->regmap, MT6358_AUDENC_ANA_CON9,
+			   0xffff, 0x0025);
+	regmap_update_bits(priv->regmap, MT6358_AUDENC_ANA_CON8,
+			   0xffff, 0x0005);
+
+	/* digital */
+	regmap_update_bits(priv->regmap, MT6358_AUD_TOP_CKPDN_CON0,
+			   0xffff, 0x0000);
+	regmap_update_bits(priv->regmap, MT6358_GPIO_MODE3, 0xffff, 0x0120);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG0, 0xffff, 0xffff);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG1, 0xffff, 0x0200);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG2, 0xffff, 0x2424);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG3, 0xffff, 0xdbac);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG4, 0xffff, 0x029e);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG5, 0xffff, 0x0000);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_POSDIV_CFG0,
+			   0xffff, 0x0000);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_HPF_CFG0,
+			   0xffff, 0x0451);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_TOP, 0xffff, 0x68d1);
+
+	return 0;
+}
+
+static int mt6358_disable_wov_phase2(struct mt6358_priv *priv)
+{
+	/* digital */
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_TOP, 0xffff, 0xc000);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_HPF_CFG0,
+			   0xffff, 0x0450);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_POSDIV_CFG0,
+			   0xffff, 0x0c00);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG5, 0xffff, 0x0100);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG4, 0xffff, 0x006c);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG3, 0xffff, 0xa879);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG2, 0xffff, 0x2323);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG1, 0xffff, 0x0400);
+	regmap_update_bits(priv->regmap, MT6358_AFE_VOW_CFG0, 0xffff, 0x0000);
+	regmap_update_bits(priv->regmap, MT6358_GPIO_MODE3, 0xffff, 0x02d8);
+	regmap_update_bits(priv->regmap, MT6358_AUD_TOP_CKPDN_CON0,
+			   0xffff, 0x0000);
+
+	/* analog */
+	regmap_update_bits(priv->regmap, MT6358_AUDENC_ANA_CON8,
+			   0xffff, 0x0004);
+	regmap_update_bits(priv->regmap, MT6358_AUDENC_ANA_CON9,
+			   0xffff, 0x0000);
+	regmap_update_bits(priv->regmap, MT6358_DCXO_CW13, 0xffff, 0x9829);
+	regmap_update_bits(priv->regmap, MT6358_AUDENC_ANA_CON1,
+			   0xffff, 0x0000);
+	mt6358_restore_pga(priv);
+	regmap_update_bits(priv->regmap, MT6358_DCXO_CW14, 0xffff, 0xa2b5);
+	regmap_update_bits(priv->regmap, MT6358_AUDDEC_ANA_CON13,
+			   0xffff, 0x0010);
+
+	return 0;
+}
+
+static int mt6358_get_wov(struct snd_kcontrol *kcontrol,
+			  struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
+	struct mt6358_priv *priv = snd_soc_component_get_drvdata(c);
+
+	ucontrol->value.integer.value[0] = priv->wov_enabled;
+	return 0;
+}
+
+static int mt6358_put_wov(struct snd_kcontrol *kcontrol,
+			  struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
+	struct mt6358_priv *priv = snd_soc_component_get_drvdata(c);
+	int enabled = ucontrol->value.integer.value[0];
+
+	if (priv->wov_enabled != enabled) {
+		if (enabled)
+			mt6358_enable_wov_phase2(priv);
+		else
+			mt6358_disable_wov_phase2(priv);
+
+		priv->wov_enabled = enabled;
+	}
+
+	return 0;
+}
+
 static const DECLARE_TLV_DB_SCALE(playback_tlv, -1000, 100, 0);
 static const DECLARE_TLV_DB_SCALE(pga_tlv, 0, 600, 0);
 
@@ -483,6 +585,9 @@ static const struct snd_kcontrol_new mt6358_snd_controls[] = {
 			     MT6358_AUDENC_ANA_CON0, MT6358_AUDENC_ANA_CON1,
 			     8, 4, 0,
 			     snd_soc_get_volsw, mt6358_put_volsw, pga_tlv),
+
+	SOC_SINGLE_BOOL_EXT("Wake-on-Voice Phase2 Switch", 0,
+			    mt6358_get_wov, mt6358_put_wov),
 };
 
 /* MUX */
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
#15 lore raw

PATCH v2 9/10 ASoC: dt-bindings: mt8183: add ec-codec

In reply to Tzung-Bi Shih

Add an optional property "ec-codec". If specified, mt8183 could use the "wake on voice" feature offered by EC codec.

---
 .../bindings/sound/mt8183-mt6358-ts3a227-max98357.txt          | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +3 -0
index 17ff3892f439..decaa013a07e 100644
@@ -6,12 +6,15 @@ Required properties:
 
 Optional properties:
 - mediatek,headset-codec: the phandles of ts3a227 codecs
+- mediatek,ec-codec: the phandle of EC codecs.
+                     See google,cros-ec-codec.txt for more details.
 
 Example:
 
 	sound {
 		compatible = "mediatek,mt8183_mt6358_ts3a227_max98357";
 		mediatek,headset-codec = <&ts3a227>;
+		mediatek,ec-codec = <&ec_codec>;
 		mediatek,platform = <&afe>;
 	};
 
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
maintainer
#16 lore raw

Re: [alsa-devel] [PATCH v2 09/10] ASoC: dt-bindings: mt8183: add ec-codec

Quoted 13 lines · Tzung-Bi Shih

Add an optional property "ec-codec". If specified, mt8183 could use the "wake on voice" feature offered by EC codec.

---
 .../bindings/sound/mt8183-mt6358-ts3a227-max98357.txt          | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +0 -0
index 17ff3892f439..decaa013a07e 100644

Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt Required properties: · line 10

Quoted 5 lines
Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +2 -0
@@ -6,12 +6,15 @@ Required properties:
 
 Optional properties:
 - mediatek,headset-codec: the phandles of ts3a227 codecs
+- mediatek,ec-codec: the phandle of EC codecs.
+                     See google,cros-ec-codec.txt for more details.

Not the best designed audio binding here. We really should just have links to codecs and then you can look at the codec nodes to determine the type.

Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt Required properties: · line 15

Quoted 5 lines
Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +0 -0
 Example:
 
 	sound {
 		compatible = "mediatek,mt8183_mt6358_ts3a227_max98357";

Don't you need to add EC codec to this? Just kidding. Just highlighting the weirdness of this binding.

Quoted 8 lines
Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +1 -0
 		mediatek,headset-codec = <&ts3a227>;
+		mediatek,ec-codec = <&ec_codec>;
 		mediatek,platform = <&afe>;
 	};
 
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
#17 lore raw

Re: [alsa-devel] [PATCH v2 09/10] ASoC: dt-bindings: mt8183: add ec-codec

Quoted 16 lines · Rob Herring
Quoted 14 lines · Tzung-Bi Shih

Add an optional property "ec-codec". If specified, mt8183 could use the "wake on voice" feature offered by EC codec.

---
 .../bindings/sound/mt8183-mt6358-ts3a227-max98357.txt          | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +0 -0
index 17ff3892f439..decaa013a07e 100644
@@ -6,12 +6,15 @@ Required properties:
 
Quoted 8 lines

Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt Required properties: · line 10

Quoted 4 lines
Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +2 -0
 Optional properties:
 - mediatek,headset-codec: the phandles of ts3a227 codecs
+- mediatek,ec-codec: the phandle of EC codecs.
+                     See google,cros-ec-codec.txt for more details.

Not the best designed audio binding here. We really should just have links to codecs and then you can look at the codec nodes to determine the type.

Did you mean: we should use an "audio-codec" array. In the machine driver, we should maintain a table of correspondence of compatible string and the related context. And use of_device_is_compatible( ) to determine their types? Something similar to
https://elixir.bootlin.com/linux/v5.3.5/source/sound/soc/rockchip/rk3399_gru_sound.c#L436

Quoted 9 lines

Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt Required properties: · line 15

Quoted 6 lines
Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +0 -0
 Example:
 
      sound {
              compatible = "mediatek,mt8183_mt6358_ts3a227_max98357";

Don't you need to add EC codec to this? Just kidding. Just highlighting the weirdness of this binding.

Could you explain some? I cannot understand the "weird" here. I thought add the property "mediatek,ec-codec" could be enough.
Or did you mean: the compatible string should reflect the EC codec presence?

Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +1 -1
              mediatek,headset-codec = <&ts3a227>;
+             mediatek,ec-codec = <&ec_codec>;
              mediatek,platform = <&afe>;
      };
 
--

2.23.0.581.g78d2f28ef7-goog

#18 lore raw

PATCH v2 10/10 ASoC: mediatek: mt8183: support WoV

In reply to Tzung-Bi Shih

Add DAI link and pin muxing for wake on voice.

---
 sound/soc/mediatek/Kconfig                    |  1 +
 .../mt8183/mt8183-mt6358-ts3a227-max98357.c   | 70 ++++++++++++++++++-
 2 files changed, 68 insertions(+), 3 deletions(-)
sound/soc/mediatek/Kconfig +1 -0
index 111e44b64b38..8b29f3979899 100644
@@ -125,6 +125,7 @@ config SND_SOC_MT8183_MT6358_TS3A227E_MAX98357A
 	select SND_SOC_MAX98357A
 	select SND_SOC_BT_SCO
 	select SND_SOC_TS3A227E
+	select SND_SOC_CROS_EC_CODEC
 	help
 	  This adds ASoC driver for Mediatek MT8183 boards
 	  with the MT6358 TS3A227E MAX98357A audio codec.
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +67 -3

113 lines not on this page · raw message

Signature · 1 line
2.23.0.581.g78d2f28ef7-goog