| Message ID | 20220512074359.446999-1-tommaso.merciai@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-amarula+bncBD6ZNPUKRQLBBRPV6KJQMGQE3I7M26A@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 326113F0E8 for <linux-amarula@patchwork.amarulasolutions.com>; Thu, 12 May 2022 09:44:06 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id h7-20020a056402094700b00425a52983dfsf2682222edz.8 for <linux-amarula@patchwork.amarulasolutions.com>; Thu, 12 May 2022 00:44:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652341446; cv=pass; d=google.com; s=arc-20160816; b=bcGrZwdDjpjcX8fk1dpIBzYs1xN9vTi7MZlP7MxYmoNfp/qkfk+zyzY+ag1Ugznprd 7ixg5wwGLkbKwov7bG1K/iwxtEkC81glUW5OAS8cUwQLiQ4uVG49VrJ7SuYR4+Sl0HBV sRvvuh3SyTPFqc/cWNy/MzjSuxDmOlqDYDK6UCcs3tAai588OwF9VcmHvmixImGEbvhU E2LPdQVRq8C+Ho2V3P1bYo+hdFhAtt4WCyWhK1Aq8MmXWHTYf3qyPLneCcD9/ryH1+8Z xfnYI/0iGN0adafM+BxpTrH7Y+kVPWAoV+kjD2H8rCpgS/kPjh26bf50e0RPSS1kONQq 9OsQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=5Mc6FORiLtCji1N14aZ0BWpYGfYZjMKJfbMJ5VW06wo=; b=mWUYAO/8FSzyOgjbmL/eYw6+b5sSh5eLcuZdU/xt03RY3xhGd+TlocTKZ3/d45O7y4 HQFZjD0Lx4agOvlZuQr2v8o3LwCUUdN3WzMgGKATXwcgSG7ptccmjDyzbQE8NmiTkQ5H ZmjVwb6480/Q422YOUX/nRnEldG1ZxhiP58y+DZ+9+EhrbwO6UaxzW8s+giY7k+Q/HGL GMxfKaujBT5kbwD5sQxMSdTW6PGOIFZ3IRDbbmtC+ryRmstURJsBUxA1RbLdnEs+Z06B qtxbPHt9m/fCesDUIzbbgcMewxZHhwU2nOQZytIaBnTJCIXeQuMt9pHdwWfV/TTQt4Hn waPQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DiruNwr0; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=5Mc6FORiLtCji1N14aZ0BWpYGfYZjMKJfbMJ5VW06wo=; b=HZ6AlKsleGRfBzLum40l1kbGDlrqpjIciURHQC/Ap97cVTZN3LlrhEohzVVyMkEOqM yhoWT9yPtbVJRwm9KmMhAqQ3IWhE9UMOPJcklnRRqqWhXSbsd1vxbcBbcJ3tDd19Pw7t Sx4rpMnSOvfiGFh+5jR0tKrmaXVr4AXTOzkng= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-unsubscribe; bh=5Mc6FORiLtCji1N14aZ0BWpYGfYZjMKJfbMJ5VW06wo=; b=E2PpeDhB9m0BQ5vLfhnrzostC3yaBNt9r/10lVDQptjgSi586gJNSHNw94QTPf1SRA 5wGxG3D/thaBAdQ/1TAVRLKzER4Amqln6gWNmMCrBiJkV18okuqkhmRAPC69TrLqEg+E FCWdGpf8vpc1q5MLOBDWZL1mTAkyKPlDrtnN7S98bIO81JghF0SOyawSfClB6Rt+ny7h 9/bW7DPkLzsRZPd7eF2IPr9fMtKbeWqGROq8xUPiP71ZWKhDKowi7oC/Dtq/4tdB+Icb nfBACMVlFf/yzmMsYpqhemNb15yUNwS/w664nYvCMA+LI3QORa9VZjpZVPudw+rjhEnn KsVA== X-Gm-Message-State: AOAM531bkXc7uY+uFkN3+WcjLML6Cfgb9L9m0c1qMxHKgi5mBLDdYSZV yVrwFBOq6ItIKgnQYtdUMZdBAyGe X-Google-Smtp-Source: ABdhPJxFoilvo7XJ6ptn8cFDKjtpkbAwgfLU805G4m0ujZyjZja5h9ogmAOB53QYcRCoPKyEEmM1OA== X-Received: by 2002:a17:907:6daa:b0:6f4:4822:549d with SMTP id sb42-20020a1709076daa00b006f44822549dmr28841387ejc.322.1652341445717; Thu, 12 May 2022 00:44:05 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:40d4:b0:428:1043:6204 with SMTP id z20-20020a05640240d400b0042810436204ls895357edb.2.gmail; Thu, 12 May 2022 00:44:04 -0700 (PDT) X-Received: by 2002:aa7:d5c5:0:b0:425:b144:ab84 with SMTP id d5-20020aa7d5c5000000b00425b144ab84mr33931390eds.200.1652341444508; Thu, 12 May 2022 00:44:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652341444; cv=none; d=google.com; s=arc-20160816; b=NvXRJMkhFajDj1S1oiR6iGCN0bo8YXGfkfLItF0qLvcuqgWN6yaSUv5ZHAAakR/Byo WGbvl4DUMrO9e9LE6gvqyihl2f45Z9vkwsr56wpIrWrMz4venpC3rRviKIJalVfy/TEv k3Kp7TFe2TgFJwztNLJWpXOjGrBe+gF5LVJmRAMyLqNg+GIGzE6y5YSlDnr6+hxPACMr GJf5uRdrW14yLNft1KPVyv5xr2gH0PtlSBexwvmYX0Ki8fwqiTtQXpnmWKR6gTxxgMz6 uOeFTQERlq36X4hmzJYPr5OUgJ9ecrAsk9Dx34AuB/oGTTCoE8Mb60kD5hXnlR1KGKuT /WxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=DrDbGhLo7XaClO51j9YJvUywtHQ0+/I5lMy5wJbGhKc=; b=jcnZp3YDL9BvOx82zZgPJGnIJ4FoNUDKShcKE4O78OVLQXWIbWU+wlNfNbSr/LT5aQ BEo9dKsnZ0xdO8ujRsQf15y97mwj0c9sopKDV0FEIDu8987AthL//Rgrub861pWsLmXQ G5nlCxZ3IHVHqchcfKu7YqurlQGhSusDgy+BwhMEuuW42N2QKM32ahkmcDtvOQ/36t3s v7rsogT/nfOY0DkUcaP0P8tUyrZLusFSP7AGDI8aBfbzThqlXXRIXXszk9SutBZrh/Cq A0PQ+K+1STk7hfyHKBHW1SsG/7SUGcND1swwhcgzSFkHECM9LjeVKa+b60LJqH1dbNUQ 1zrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DiruNwr0; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id d12-20020a50c88c000000b0041d7abba132sor3209659edh.7.2022.05.12.00.44.04 for <linux-amarula@amarulasolutions.com> (Google Transport Security); Thu, 12 May 2022 00:44:04 -0700 (PDT) Received-SPF: pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6402:4241:b0:428:177b:5fd with SMTP id g1-20020a056402424100b00428177b05fdmr32950480edb.193.1652341444209; Thu, 12 May 2022 00:44:04 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-59-245.cust.vodafonedsl.it. [188.217.59.245]) by smtp.gmail.com with ESMTPSA id cm10-20020a0564020c8a00b0042617ba63c0sm2192721edb.74.2022.05.12.00.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 00:44:03 -0700 (PDT) From: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> To: Cc: tommaso.merciai@amarulasolutions.com, linux-amarula@amarulasolutions.com, linuxfancy@googlegroups.com, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: max98088: add support for reg_4a_cfg_bypass reg Date: Thu, 12 May 2022 09:43:58 +0200 Message-Id: <20220512074359.446999-1-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: tommaso.merciai@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DiruNwr0; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
| Series |
ASoC: max98088: add support for reg_4a_cfg_bypass reg
|
|
Commit Message
Tommaso Merciai
May 12, 2022, 7:43 a.m. UTC
Add mixer controls support for M98088_REG_4A_CFG_BYPASS register
References:
- https://datasheets.maximintegrated.com/en/ds/MAX98089.pdf p71, p113
Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
---
sound/soc/codecs/max98088.c | 5 +++++
1 file changed, 5 insertions(+)
Comments
On Thu, May 12, 2022 at 09:43:58AM +0200, Tommaso Merciai wrote: > Add mixer controls support for M98088_REG_4A_CFG_BYPASS register > +++ b/sound/soc/codecs/max98088.c > @@ -486,6 +486,11 @@ static const struct snd_kcontrol_new max98088_snd_controls[] = { > SOC_SINGLE("EQ1 Switch", M98088_REG_49_CFG_LEVEL, 0, 1, 0), > SOC_SINGLE("EQ2 Switch", M98088_REG_49_CFG_LEVEL, 1, 1, 0), > > + SOC_SINGLE("SPK Bypass Switch", M98088_REG_4A_CFG_BYPASS, 0, 1, 0), > + SOC_SINGLE("REC Bypass Switch", M98088_REG_4A_CFG_BYPASS, 1, 1, 0), > + SOC_SINGLE("MIC2 Bypass Switch", M98088_REG_4A_CFG_BYPASS, 4, 1, 0), > + SOC_SINGLE("INA Bypass Switch", M98088_REG_4A_CFG_BYPASS, 7, 1, 0), These look like they should be DAPM controls since they're controlling audio routing but they're being added as regular controls.
On Thu, May 12, 2022 at 11:12:02AM +0100, Mark Brown wrote: > On Thu, May 12, 2022 at 09:43:58AM +0200, Tommaso Merciai wrote: > > > Add mixer controls support for M98088_REG_4A_CFG_BYPASS register > > > +++ b/sound/soc/codecs/max98088.c > > @@ -486,6 +486,11 @@ static const struct snd_kcontrol_new max98088_snd_controls[] = { > > SOC_SINGLE("EQ1 Switch", M98088_REG_49_CFG_LEVEL, 0, 1, 0), > > SOC_SINGLE("EQ2 Switch", M98088_REG_49_CFG_LEVEL, 1, 1, 0), > > > > + SOC_SINGLE("SPK Bypass Switch", M98088_REG_4A_CFG_BYPASS, 0, 1, 0), > > + SOC_SINGLE("REC Bypass Switch", M98088_REG_4A_CFG_BYPASS, 1, 1, 0), > > + SOC_SINGLE("MIC2 Bypass Switch", M98088_REG_4A_CFG_BYPASS, 4, 1, 0), > > + SOC_SINGLE("INA Bypass Switch", M98088_REG_4A_CFG_BYPASS, 7, 1, 0), > > These look like they should be DAPM controls since they're controlling > audio routing but they're being added as regular controls. Hi Mark, Thanks for the review, I'll send v2. Tommaso
On Thu, May 12, 2022 at 11:12:02AM +0100, Mark Brown wrote: > On Thu, May 12, 2022 at 09:43:58AM +0200, Tommaso Merciai wrote: > > > Add mixer controls support for M98088_REG_4A_CFG_BYPASS register > > > +++ b/sound/soc/codecs/max98088.c > > @@ -486,6 +486,11 @@ static const struct snd_kcontrol_new max98088_snd_controls[] = { > > SOC_SINGLE("EQ1 Switch", M98088_REG_49_CFG_LEVEL, 0, 1, 0), > > SOC_SINGLE("EQ2 Switch", M98088_REG_49_CFG_LEVEL, 1, 1, 0), > > > > + SOC_SINGLE("SPK Bypass Switch", M98088_REG_4A_CFG_BYPASS, 0, 1, 0), > > + SOC_SINGLE("REC Bypass Switch", M98088_REG_4A_CFG_BYPASS, 1, 1, 0), > > + SOC_SINGLE("MIC2 Bypass Switch", M98088_REG_4A_CFG_BYPASS, 4, 1, 0), > > + SOC_SINGLE("INA Bypass Switch", M98088_REG_4A_CFG_BYPASS, 7, 1, 0), > > These look like they should be DAPM controls since they're controlling > audio routing but they're being added as regular controls. Hi Mark, Sorry again. You suggest to create a new structure for these entries, for example: /* Out Bypass mixer switch */ static const struct snd_kcontrol_new max98088_out_bypass_mixer_controls[] = { SOC_DAPM_SINGLE("INA Switch", M98088_REG_4A_CFG_BYPASS, 7, 1, 0), SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_4A_CFG_BYPASS, 4, 1, 0), SOC_DAPM_SINGLE("REC Switch", M98088_REG_4A_CFG_BYPASS, 1, 1, 0), SOC_DAPM_SINGLE("SPK Switch", M98088_REG_4A_CFG_BYPASS, 0, 1, 0), }; Let me know. Thanks in advance. Tommaso
On Thu, May 12, 2022 at 12:46:42PM +0200, Tommaso Merciai wrote: > On Thu, May 12, 2022 at 11:12:02AM +0100, Mark Brown wrote: > > These look like they should be DAPM controls since they're controlling > > audio routing but they're being added as regular controls. > Sorry again. You suggest to create a new structure for these entries, > for example: > /* Out Bypass mixer switch */ > static const struct snd_kcontrol_new max98088_out_bypass_mixer_controls[] = { > SOC_DAPM_SINGLE("INA Switch", M98088_REG_4A_CFG_BYPASS, 7, 1, 0), > SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_4A_CFG_BYPASS, 4, 1, 0), > SOC_DAPM_SINGLE("REC Switch", M98088_REG_4A_CFG_BYPASS, 1, 1, 0), > SOC_DAPM_SINGLE("SPK Switch", M98088_REG_4A_CFG_BYPASS, 0, 1, 0), > }; If that's how they fit into the routing for the device, yes - you'd need to define the bypass mixer as well and set up appropraite routes.
On Thu, May 12, 2022 at 11:53:07AM +0100, Mark Brown wrote: > On Thu, May 12, 2022 at 12:46:42PM +0200, Tommaso Merciai wrote: > > On Thu, May 12, 2022 at 11:12:02AM +0100, Mark Brown wrote: > > > > These look like they should be DAPM controls since they're controlling > > > audio routing but they're being added as regular controls. > > > Sorry again. You suggest to create a new structure for these entries, > > for example: > > > /* Out Bypass mixer switch */ > > static const struct snd_kcontrol_new max98088_out_bypass_mixer_controls[] = { > > SOC_DAPM_SINGLE("INA Switch", M98088_REG_4A_CFG_BYPASS, 7, 1, 0), > > SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_4A_CFG_BYPASS, 4, 1, 0), > > SOC_DAPM_SINGLE("REC Switch", M98088_REG_4A_CFG_BYPASS, 1, 1, 0), > > SOC_DAPM_SINGLE("SPK Switch", M98088_REG_4A_CFG_BYPASS, 0, 1, 0), > > }; > > If that's how they fit into the routing for the device, yes - you'd need > to define the bypass mixer as well and set up appropraite routes. Hi, I added this reg as regular controls because this reg is pretty generic as you can see this controll bypass of some output, not all. What do you think about? Thanks, Tommaso
On Thu, May 12, 2022 at 01:09:59PM +0200, Tommaso Merciai wrote: > On Thu, May 12, 2022 at 11:53:07AM +0100, Mark Brown wrote: > > On Thu, May 12, 2022 at 12:46:42PM +0200, Tommaso Merciai wrote: > > > On Thu, May 12, 2022 at 11:12:02AM +0100, Mark Brown wrote: > > > > These look like they should be DAPM controls since they're controlling > > > > audio routing but they're being added as regular controls. > > > Sorry again. You suggest to create a new structure for these entries, > > > for example: > > If that's how they fit into the routing for the device, yes - you'd need > > to define the bypass mixer as well and set up appropraite routes. > I added this reg as regular controls because this reg is pretty generic > as you can see this controll bypass of some output, not all. > What do you think about? That sounds exactly like a DAPM control, please make them DAPM controls.
On Thu, May 12, 2022 at 12:19:03PM +0100, Mark Brown wrote: > On Thu, May 12, 2022 at 01:09:59PM +0200, Tommaso Merciai wrote: > > On Thu, May 12, 2022 at 11:53:07AM +0100, Mark Brown wrote: > > > On Thu, May 12, 2022 at 12:46:42PM +0200, Tommaso Merciai wrote: > > > > On Thu, May 12, 2022 at 11:12:02AM +0100, Mark Brown wrote: > > > > > > These look like they should be DAPM controls since they're controlling > > > > > audio routing but they're being added as regular controls. > > > > > Sorry again. You suggest to create a new structure for these entries, > > > > for example: > > > > If that's how they fit into the routing for the device, yes - you'd need > > > to define the bypass mixer as well and set up appropraite routes. > > > I added this reg as regular controls because this reg is pretty generic > > as you can see this controll bypass of some output, not all. > > What do you think about? > > That sounds exactly like a DAPM control, please make them DAPM controls. Hi Mark, Perfect, thanks for your suggestion. I'll do it in V2. Tommaso
On Thu, May 12, 2022 at 12:19:03PM +0100, Mark Brown wrote: > On Thu, May 12, 2022 at 01:09:59PM +0200, Tommaso Merciai wrote: > > On Thu, May 12, 2022 at 11:53:07AM +0100, Mark Brown wrote: > > > On Thu, May 12, 2022 at 12:46:42PM +0200, Tommaso Merciai wrote: > > > > On Thu, May 12, 2022 at 11:12:02AM +0100, Mark Brown wrote: > > > > > > These look like they should be DAPM controls since they're controlling > > > > > audio routing but they're being added as regular controls. > > > > > Sorry again. You suggest to create a new structure for these entries, > > > > for example: > > > > If that's how they fit into the routing for the device, yes - you'd need > > > to define the bypass mixer as well and set up appropraite routes. > > > I added this reg as regular controls because this reg is pretty generic > > as you can see this controll bypass of some output, not all. > > What do you think about? > > That sounds exactly like a DAPM control, please make them DAPM controls. Hi Mark, Sorry again, but I'm quite new on alsa subsystem. I need an help on figuring out on how to implements your solution. From what you suggest I got that I need to create a bypass mixer for every switch (4 -> SPK, REC, MIC2, INA): /* Out Mixer SPK */ static const struct snd_kcontrol_new max98088_output_bypass_spk_mixer_controls[] = { SOC_DAPM_SINGLE("SPK Bypass Switch", M98088_REG_4A_CFG_BYPASS, 0, 1, 0), }; /* Out Mixer REC */ static const struct snd_kcontrol_new max98088_output_bypass_rec_mixer_controls[] = { SOC_DAPM_SINGLE("REC Bypass Switch", M98088_REG_4A_CFG_BYPASS, 1, 1, 0), }; /* Out Mixer MIC */ static const struct snd_kcontrol_new max98088_output_bypass_mic_mixer_controls[] = { SOC_DAPM_SINGLE("MIC2 Bypass Switch", M98088_REG_4A_CFG_BYPASS, 4, 1, 0), }; /* Out Mixer INA */ static const struct snd_kcontrol_new max98088_output_bypass_ina_mixer_controls[] = { SOC_DAPM_SINGLE("INA Bypass Switch", M98088_REG_4A_CFG_BYPASS, 7, 1, 0), }; After that, I need to route the new control mixers on the switch: {"Out Mixer SPK", "SPK Bypass Switch", "RECN"}, {"Out Mixer REC", "REC Bypass Switch", "RECP"}, {"Out Mixer MIC", "MIC2 Bypass Switch", "MIC1"}, {"Out Mixer INA", "INA Bypass Switch", "INA"}, Then route the bypass switch to the new output: {"SPKL", NULL, "SPK Bypass Switch"}, {"RECN", NULL, "REC Bypass Switch"}, {"MIC2", NULL, "MIC2 Bypass Switch"}, {"MIC1", NULL, "INA Bypass Switch"}, I'm in the right way? What do you think about? Can you point me a similar bypass switch into the kernel to take as reference? Thanks in advance Regards, Tommmaso
On Fri, May 13, 2022 at 05:20:55PM +0200, Tommaso Merciai wrote: > On Thu, May 12, 2022 at 12:19:03PM +0100, Mark Brown wrote: > > That sounds exactly like a DAPM control, please make them DAPM controls. > Sorry again, but I'm quite new on alsa subsystem. I need an help on figuring out > on how to implements your solution. From what you suggest I got that I need to create > a bypass mixer for every switch (4 -> SPK, REC, MIC2, INA): It depends how the audio is routed - that would be a fairly unusual structure for hardware but it's possible. Often bypass paths feed into mixers that have other, non-bypass paths. > After that, I need to route the new control mixers on the switch: > {"Out Mixer SPK", "SPK Bypass Switch", "RECN"}, > {"Out Mixer REC", "REC Bypass Switch", "RECP"}, > {"Out Mixer MIC", "MIC2 Bypass Switch", "MIC1"}, > {"Out Mixer INA", "INA Bypass Switch", "INA"}, > Then route the bypass switch to the new output: > > {"SPKL", NULL, "SPK Bypass Switch"}, > {"RECN", NULL, "REC Bypass Switch"}, > {"MIC2", NULL, "MIC2 Bypass Switch"}, > {"MIC1", NULL, "INA Bypass Switch"}, > I'm in the right way? What do you think about? That's pretty much it if they're a bunch of separate things. > Can you point me a similar bypass switch into the kernel to take as reference? If you search for "Bypass" in sound/soc/codecs you'll see a bunch of examples - a lot of the Wolfson devices have bypass paths for example. You'll see that for example with wm9713 the bypass paths go into mixers that have other inputs rather than being totally separate things - I see that this device has things like "Right SPK Mixer" which look like they might fit here.
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 429717d4ac5a..f8ec2f164e08 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -486,6 +486,11 @@ static const struct snd_kcontrol_new max98088_snd_controls[] = { SOC_SINGLE("EQ1 Switch", M98088_REG_49_CFG_LEVEL, 0, 1, 0), SOC_SINGLE("EQ2 Switch", M98088_REG_49_CFG_LEVEL, 1, 1, 0), + SOC_SINGLE("SPK Bypass Switch", M98088_REG_4A_CFG_BYPASS, 0, 1, 0), + SOC_SINGLE("REC Bypass Switch", M98088_REG_4A_CFG_BYPASS, 1, 1, 0), + SOC_SINGLE("MIC2 Bypass Switch", M98088_REG_4A_CFG_BYPASS, 4, 1, 0), + SOC_SINGLE("INA Bypass Switch", M98088_REG_4A_CFG_BYPASS, 7, 1, 0), + SOC_ENUM("EX Limiter Mode", max98088_exmode_enum), SOC_ENUM("EX Limiter Threshold", max98088_ex_thresh_enum),