From nobody Thu Dec 18 07:58:13 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B652C77B73 for ; Mon, 8 May 2023 11:32:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235811AbjEHLcB (ORCPT ); Mon, 8 May 2023 07:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235917AbjEHLbj (ORCPT ); Mon, 8 May 2023 07:31:39 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D05503DC91 for ; Mon, 8 May 2023 04:30:57 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4efe8991b8aso5073249e87.0 for ; Mon, 08 May 2023 04:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1683545456; x=1686137456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PXV6n/ZoBKctzecySAN7sPYLUBR2V7OtAf+/Kf5BsKA=; b=jRtjCAcypKAY/Gu9ja9yDpxwx/UWqHXXOoAHQdAeNM6o0l/gf+lfkFTlXuaFhhK4yE 3rzj7X9wmF2xbyaS3DBcTwkuYi0jYjvyCkVWBa0XdFxuNyHNVRC6+XRy2MzKBZa0MtzO 5AMw7InyfPJ5mhbF5BPmPnw/I0POgBd7y9rMCYFN4kA4p7Juv0MAj78DXIbftJnezCih Iotnwk33EQlsiF3y7/V99vLLV/Hsy6vRkJutoQ+WY2vdzR+yKt4QtiB2mCINzDAAKwbj tNKlXrncXdppG6+7iHXeS/MFiAmi/IFLU75eC0ues1kBzy2G2ymeH6e3dzi2vXM8cOx5 W7LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683545456; x=1686137456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PXV6n/ZoBKctzecySAN7sPYLUBR2V7OtAf+/Kf5BsKA=; b=fHAcnUfptaJBb3aS4oDsFyK/1D8ZY6BRbZjsYvbEHANhiz+O7V6haCybv0Exqye+AG Mx+S+vxig2hgs4m06+l5B9Rs/FsTTQpNRI258G76QudK3k/1FkEpl+IZwo382GlVYDih j6gDCP7/WDnrbnwTWg8N9KTx0UB7n48ya8jA6G3YvvSjZUXg6KykBea0J5C7SlqJc20h 5b3DgDYlICQqNP+abDFU5J0kaQ2fa5g0NsDenNG0XS/rrrDISkCiAkCrMAszZoBq8ow0 zVXVA5BUpDwPvj4We5wZ/Nsw47J3rdZ4z0P0Q4Zw6yc1VtnzOP/nWqsYpbeNMlin7oXz dQ/g== X-Gm-Message-State: AC+VfDyL6oXdx/xvxn4cRLyFPYk1bH5bEFbaY6FoqRUSYotCUe91R3c+ rJ5KuhWj0/kebl0kaENbWlEeBQ== X-Google-Smtp-Source: ACHHUZ52jbpSDsNhMgYMTMdCCma+vzl2q3QzDPXEkCR8puwHV4pYcc70RByBdauqf7y0WixG4jzAaA== X-Received: by 2002:a05:651c:235:b0:2a8:b7e9:82ee with SMTP id z21-20020a05651c023500b002a8b7e982eemr2377512ljn.1.1683545456116; Mon, 08 May 2023 04:30:56 -0700 (PDT) Received: from panikiel.office.semihalf.net ([83.142.187.84]) by smtp.gmail.com with ESMTPSA id k8-20020a2e2408000000b002a8b9353338sm1144406ljk.117.2023.05.08.04.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 May 2023 04:30:55 -0700 (PDT) From: =?UTF-8?q?Pawe=C5=82=20Anikiel?= To: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, lgirdwood@gmail.com, broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dinguyen@kernel.org, lars@metafoo.de, nuno.sa@analog.com, upstream@semihalf.com, amstan@chromium.org, =?UTF-8?q?Pawe=C5=82=20Anikiel?= Subject: [PATCH v2 1/7] ASoC: Add Google Chameleon v3 i2s driver Date: Mon, 8 May 2023 13:30:31 +0200 Message-ID: <20230508113037.137627-2-pan@semihalf.com> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog In-Reply-To: <20230508113037.137627-1-pan@semihalf.com> References: <20230508113037.137627-1-pan@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add driver for the i2s IP present on Google Chameleon v3 Signed-off-by: Pawe=C5=82 Anikiel --- sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/google/Kconfig | 6 + sound/soc/google/Makefile | 2 + sound/soc/google/chv3-i2s.c | 338 ++++++++++++++++++++++++++++++++++++ 5 files changed, 348 insertions(+) create mode 100644 sound/soc/google/Kconfig create mode 100644 sound/soc/google/Makefile create mode 100644 sound/soc/google/chv3-i2s.c diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index 848fbae26c3b..48e778c18912 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig @@ -75,6 +75,7 @@ source "sound/soc/bcm/Kconfig" source "sound/soc/cirrus/Kconfig" source "sound/soc/dwc/Kconfig" source "sound/soc/fsl/Kconfig" +source "sound/soc/google/Kconfig" source "sound/soc/hisilicon/Kconfig" source "sound/soc/jz4740/Kconfig" source "sound/soc/kirkwood/Kconfig" diff --git a/sound/soc/Makefile b/sound/soc/Makefile index 507eaed1d6a1..d5cc3eb710f9 100644 --- a/sound/soc/Makefile +++ b/sound/soc/Makefile @@ -43,6 +43,7 @@ obj-$(CONFIG_SND_SOC) +=3D bcm/ obj-$(CONFIG_SND_SOC) +=3D cirrus/ obj-$(CONFIG_SND_SOC) +=3D dwc/ obj-$(CONFIG_SND_SOC) +=3D fsl/ +obj-$(CONFIG_SND_SOC) +=3D google/ obj-$(CONFIG_SND_SOC) +=3D hisilicon/ obj-$(CONFIG_SND_SOC) +=3D jz4740/ obj-$(CONFIG_SND_SOC) +=3D img/ diff --git a/sound/soc/google/Kconfig b/sound/soc/google/Kconfig new file mode 100644 index 000000000000..7603782fb060 --- /dev/null +++ b/sound/soc/google/Kconfig @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config SND_SOC_CHV3_I2S + tristate "Google Chameleon v3 I2S device" + help + Enable support for the Google Chameleon v3 I2S device. diff --git a/sound/soc/google/Makefile b/sound/soc/google/Makefile new file mode 100644 index 000000000000..862496af1ae1 --- /dev/null +++ b/sound/soc/google/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_SND_SOC_CHV3_I2S) +=3D chv3-i2s.o diff --git a/sound/soc/google/chv3-i2s.c b/sound/soc/google/chv3-i2s.c new file mode 100644 index 000000000000..0f6513444906 --- /dev/null +++ b/sound/soc/google/chv3-i2s.c @@ -0,0 +1,338 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include +#include +#include + +#include + +/* + * The I2S interface consists of two ring buffers - one for RX and one for + * TX. A ring buffer has a producer index and a consumer index. Depending + * on which way the data is flowing, either the software or the hardware + * writes data and updates the producer index, and the other end reads data + * and updates the consumer index. + * + * The pointer managed by software is updated using the .ack callback + * (see chv3_dma_ack). This seems to be the only way to reliably obtain + * the appl_ptr from within the driver and pass it to hardware. + * + * Because of the two pointer design, the ring buffer can never be full. W= ith + * capture this isn't a problem, because the hardware being the producer + * will wait for the consumer index to move out of the way. With playback, + * however, this is problematic, because ALSA wants to fill up the buffer + * completely when waiting for hardware. In the .ack callback, the driver + * would have to wait for the consumer index to move out of the way by + * busy-waiting, which would keep stalling the kernel for quite a long tim= e. + * + * The workaround to this problem is to "lie" to ALSA that the hw_pointer + * is one frame behind what it actually is (see chv3_dma_pointer). This + * way, ALSA will not try to fill up the entire buffer, and all callbacks + * are wait-free. + */ + +#define I2S_TX_ENABLE 0x00 +#define I2S_TX_BASE_ADDR 0x04 +#define I2S_TX_BUFFER_SIZE 0x08 +#define I2S_TX_PRODUCER_IDX 0x0c +#define I2S_TX_CONSUMER_IDX 0x10 +#define I2S_RX_ENABLE 0x14 +#define I2S_RX_BASE_ADDR 0x18 +#define I2S_RX_BUFFER_SIZE 0x1c +#define I2S_RX_PRODUCER_IDX 0x20 +#define I2S_RX_CONSUMER_IDX 0x24 + +#define I2S_SOFT_RESET 0x2c +#define I2S_SOFT_RESET_RX_BIT 0x1 +#define I2S_SOFT_RESET_TX_BIT 0x2 + +#define I2S_RX_IRQ 0x4c +#define I2S_RX_IRQ_CONST 0x50 +#define I2S_TX_IRQ 0x54 +#define I2S_TX_IRQ_CONST 0x58 + +#define I2S_IRQ_MASK 0x8 +#define I2S_IRQ_CLR 0xc +#define I2S_IRQ_RX_BIT 0x1 +#define I2S_IRQ_TX_BIT 0x2 + +#define I2S_MAX_BUFFER_SIZE 0x200000 + +struct chv3_i2s_dev { + struct device *dev; + void __iomem *iobase; + void __iomem *iobase_irq; + struct snd_pcm_substream *rx_substream; + struct snd_pcm_substream *tx_substream; + int tx_bytes_to_fetch; +}; + +static struct snd_soc_dai_driver chv3_i2s_dai =3D { + .name =3D "chv3-i2s", + .capture =3D { + .channels_min =3D 1, + .channels_max =3D 128, + .rates =3D SNDRV_PCM_RATE_CONTINUOUS, + .rate_min =3D 8000, + .rate_max =3D 96000, + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + }, + .playback =3D { + .channels_min =3D 1, + .channels_max =3D 128, + .rates =3D SNDRV_PCM_RATE_CONTINUOUS, + .rate_min =3D 8000, + .rate_max =3D 96000, + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + }, +}; + +static const struct snd_pcm_hardware chv3_dma_hw =3D { + .info =3D SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_BLOCK_TRANSFER, + .buffer_bytes_max =3D I2S_MAX_BUFFER_SIZE, + .period_bytes_min =3D 64, + .period_bytes_max =3D 8192, + .periods_min =3D 4, + .periods_max =3D 256, +}; + +static inline void chv3_i2s_wr(struct chv3_i2s_dev *i2s, int offset, u32 v= al) +{ + writel(val, i2s->iobase + offset); +} + +static inline u32 chv3_i2s_rd(struct chv3_i2s_dev *i2s, int offset) +{ + return readl(i2s->iobase + offset); +} + +static irqreturn_t chv3_i2s_isr(int irq, void *data) +{ + struct chv3_i2s_dev *i2s =3D data; + u32 reg; + + reg =3D readl(i2s->iobase_irq + I2S_IRQ_CLR); + if (!reg) + return IRQ_NONE; + + if (reg & I2S_IRQ_RX_BIT) + snd_pcm_period_elapsed(i2s->rx_substream); + + if (reg & I2S_IRQ_TX_BIT) + snd_pcm_period_elapsed(i2s->tx_substream); + + writel(reg, i2s->iobase_irq + I2S_IRQ_CLR); + + return IRQ_HANDLED; +} + +static int chv3_dma_open(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd =3D asoc_substream_to_rtd(substream); + struct chv3_i2s_dev *i2s =3D snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd,= 0)); + int res; + + snd_soc_set_runtime_hwparams(substream, &chv3_dma_hw); + + res =3D snd_pcm_hw_constraint_pow2(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_BUFFER_BYTES); + if (res) + return res; + + if (substream->stream =3D=3D SNDRV_PCM_STREAM_CAPTURE) + i2s->rx_substream =3D substream; + else + i2s->tx_substream =3D substream; + + return 0; +} +static int chv3_dma_close(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd =3D asoc_substream_to_rtd(substream); + struct chv3_i2s_dev *i2s =3D snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd,= 0)); + + if (substream->pstr->stream =3D=3D SNDRV_PCM_STREAM_CAPTURE) + chv3_i2s_wr(i2s, I2S_RX_ENABLE, 0); + else + chv3_i2s_wr(i2s, I2S_TX_ENABLE, 0); + + return 0; +} + +static int chv3_dma_pcm_construct(struct snd_soc_component *component, + struct snd_soc_pcm_runtime *rtd) +{ + struct chv3_i2s_dev *i2s =3D snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd,= 0)); + struct snd_pcm_substream *substream; + int res; + + substream =3D rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; + if (substream) { + res =3D snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, i2s->dev, + I2S_MAX_BUFFER_SIZE, &substream->dma_buffer); + if (res) + return res; + } + + substream =3D rtd->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; + if (substream) { + res =3D snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, i2s->dev, + I2S_MAX_BUFFER_SIZE, &substream->dma_buffer); + if (res) + return res; + } + + return 0; +} + +static int chv3_dma_hw_params(struct snd_soc_component *component, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); + return 0; +} + +static int chv3_dma_prepare(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd =3D asoc_substream_to_rtd(substream); + struct chv3_i2s_dev *i2s =3D snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd,= 0)); + unsigned int buffer_bytes, period_bytes, period_size; + + buffer_bytes =3D snd_pcm_lib_buffer_bytes(substream); + period_bytes =3D snd_pcm_lib_period_bytes(substream); + period_size =3D substream->runtime->period_size; + + if (substream->pstr->stream =3D=3D SNDRV_PCM_STREAM_CAPTURE) { + chv3_i2s_wr(i2s, I2S_SOFT_RESET, I2S_SOFT_RESET_RX_BIT); + chv3_i2s_wr(i2s, I2S_RX_BASE_ADDR, substream->dma_buffer.addr); + chv3_i2s_wr(i2s, I2S_RX_BUFFER_SIZE, buffer_bytes); + chv3_i2s_wr(i2s, I2S_RX_IRQ, (period_size << 8) | 1); + chv3_i2s_wr(i2s, I2S_RX_ENABLE, 1); + } else { + chv3_i2s_wr(i2s, I2S_SOFT_RESET, I2S_SOFT_RESET_TX_BIT); + chv3_i2s_wr(i2s, I2S_TX_BASE_ADDR, substream->dma_buffer.addr); + chv3_i2s_wr(i2s, I2S_TX_BUFFER_SIZE, buffer_bytes); + chv3_i2s_wr(i2s, I2S_TX_IRQ, ((period_bytes / i2s->tx_bytes_to_fetch) <<= 8) | 1); + chv3_i2s_wr(i2s, I2S_TX_ENABLE, 1); + } + writel(I2S_IRQ_RX_BIT | I2S_IRQ_TX_BIT, i2s->iobase_irq + I2S_IRQ_MASK); + + return 0; +} + +static snd_pcm_uframes_t chv3_dma_pointer(struct snd_soc_component *compon= ent, + struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd =3D asoc_substream_to_rtd(substream); + struct chv3_i2s_dev *i2s =3D snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd,= 0)); + u32 frame_bytes, buffer_bytes; + u32 idx_bytes; + + frame_bytes =3D substream->runtime->frame_bits * 8; + buffer_bytes =3D snd_pcm_lib_buffer_bytes(substream); + + if (substream->pstr->stream =3D=3D SNDRV_PCM_STREAM_CAPTURE) { + idx_bytes =3D chv3_i2s_rd(i2s, I2S_RX_PRODUCER_IDX); + } else { + idx_bytes =3D chv3_i2s_rd(i2s, I2S_TX_CONSUMER_IDX); + /* lag the pointer by one frame */ + idx_bytes =3D (idx_bytes - frame_bytes) & (buffer_bytes - 1); + } + + return bytes_to_frames(substream->runtime, idx_bytes); +} + +static int chv3_dma_ack(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime =3D substream->runtime; + struct snd_soc_pcm_runtime *rtd =3D asoc_substream_to_rtd(substream); + struct chv3_i2s_dev *i2s =3D snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd,= 0)); + unsigned int bytes, idx; + + bytes =3D frames_to_bytes(runtime, runtime->control->appl_ptr); + idx =3D bytes & (snd_pcm_lib_buffer_bytes(substream) - 1); + + if (substream->pstr->stream =3D=3D SNDRV_PCM_STREAM_CAPTURE) + chv3_i2s_wr(i2s, I2S_RX_CONSUMER_IDX, idx); + else + chv3_i2s_wr(i2s, I2S_TX_PRODUCER_IDX, idx); + + return 0; +} + +static const struct snd_soc_component_driver chv3_i2s_comp =3D { + .name =3D "chv3-i2s-comp", + .open =3D chv3_dma_open, + .close =3D chv3_dma_close, + .pcm_construct =3D chv3_dma_pcm_construct, + .hw_params =3D chv3_dma_hw_params, + .prepare =3D chv3_dma_prepare, + .pointer =3D chv3_dma_pointer, + .ack =3D chv3_dma_ack, +}; + +static int chv3_i2s_probe(struct platform_device *pdev) +{ + struct chv3_i2s_dev *i2s; + int res; + int irq; + + i2s =3D devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); + if (!i2s) + return -ENOMEM; + + i2s->iobase =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(i2s->iobase)) + return PTR_ERR(i2s->iobase); + + i2s->iobase_irq =3D devm_platform_ioremap_resource(pdev, 1); + if (IS_ERR(i2s->iobase_irq)) + return PTR_ERR(i2s->iobase_irq); + + i2s->tx_bytes_to_fetch =3D (chv3_i2s_rd(i2s, I2S_TX_IRQ_CONST) >> 8) & 0x= ffff; + + i2s->dev =3D &pdev->dev; + dev_set_drvdata(&pdev->dev, i2s); + + irq =3D platform_get_irq(pdev, 0); + if (irq < 0) + return -ENXIO; + res =3D devm_request_irq(i2s->dev, irq, chv3_i2s_isr, 0, "chv3-i2s", i2s); + if (res) + return res; + + res =3D devm_snd_soc_register_component(&pdev->dev, &chv3_i2s_comp, + &chv3_i2s_dai, 1); + if (res) { + dev_err(&pdev->dev, "couldn't register component: %d\n", res); + return res; + } + + return 0; +} + +static const struct of_device_id chv3_i2s_of_match[] =3D { + { .compatible =3D "google,chv3-i2s" }, + {}, +}; + +static struct platform_driver chv3_i2s_driver =3D { + .probe =3D chv3_i2s_probe, + .driver =3D { + .name =3D "chv3-i2s", + .of_match_table =3D chv3_i2s_of_match, + }, +}; + +module_platform_driver(chv3_i2s_driver); + +MODULE_AUTHOR("Pawel Anikiel "); +MODULE_DESCRIPTION("Chameleon v3 I2S interface"); +MODULE_LICENSE("GPL"); --=20 2.40.1.521.gf1e218fcd8-goog From nobody Thu Dec 18 07:58:13 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02BC5C7EE23 for ; Mon, 8 May 2023 11:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235973AbjEHLcD (ORCPT ); Mon, 8 May 2023 07:32:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235725AbjEHLbk (ORCPT ); Mon, 8 May 2023 07:31:40 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBA9C3ED95 for ; Mon, 8 May 2023 04:30:58 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2acb6571922so23178271fa.0 for ; Mon, 08 May 2023 04:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1683545457; x=1686137457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o2cwSVPDrISRaMS+TiPqbK95SQtfCrrQXRWy9POwydI=; b=Q2+7zx5XBPX3Qle9Q5F5A+ArjF579cSfettt8OHLU3QE6XyugWzozq1wny9taFV8uN 7eMWkicsNrluXd//3cLjKPfUYIL0bxqmab+qgzL0c/S58nIQFU/rMk4VnOUQ+ppeC9HP 1JBMZwQGh7I2FyDmhvypzj2l8+4I7O+aDA4y2/O4kTn3QalHGaitRma6drTzEljdKlUP EfBMVQeJIG5QID8hBfI3h+cvHTfyPSkYFBCykz+DsE7PjGB2m1wRabnKS54dzv4iHR3w 9TfmmfaVmglmCH6+MGtFyA5Fj7ucnOGzCcxnPEc9N5DeQUv8PmgYobPJzorgk7sZqL3W tZ9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683545457; x=1686137457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o2cwSVPDrISRaMS+TiPqbK95SQtfCrrQXRWy9POwydI=; b=kJ1QjA4D0QrEKo2tnD6sKY6WPvayYTsAVd4LR+00DHA72entmNQom1RLg16G3k8P19 ZJh/UApRVb0w1emSGYTHs/0OIBhr8iSPBFgYt7G90NQn5W+BAtAry6yaCt4EByMrdYpe xe0mfsWbQZyhwuWe4hyVBDhd63Xcju4cupZwQuokTCpWfxtctSVOqRBM1uZDO7WhKFMy 9pJnl7BoXMqzfTUxPYXAnXeVi205+PkP24FD148EHWD8Q20y3NxZNCVenfh8E7p0si2Y 7WOtx3q7K58U9u3if02YyGTBilaVfqxRl4btSa6KUqAgrdRLBgQFIvxy8JUNTRCgomt/ mnvQ== X-Gm-Message-State: AC+VfDzsXguD9Ks6bNNhDRwnmrzwRbarHgymrDOCdasFX5zzte3TlIpk O4afYQ0XKLUS4IhMAfKQV526+A== X-Google-Smtp-Source: ACHHUZ6JsQ8xU/b2e4ZdMXFrq9+Cq/sYpLOJ81BdGrWzqI6ZiNx1yFtr5xGyQd0JPhRjQmMVMNJloA== X-Received: by 2002:a2e:99da:0:b0:2a7:6e85:e287 with SMTP id l26-20020a2e99da000000b002a76e85e287mr3071975ljj.45.1683545456984; Mon, 08 May 2023 04:30:56 -0700 (PDT) Received: from panikiel.office.semihalf.net ([83.142.187.84]) by smtp.gmail.com with ESMTPSA id k8-20020a2e2408000000b002a8b9353338sm1144406ljk.117.2023.05.08.04.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 May 2023 04:30:56 -0700 (PDT) From: =?UTF-8?q?Pawe=C5=82=20Anikiel?= To: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, lgirdwood@gmail.com, broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dinguyen@kernel.org, lars@metafoo.de, nuno.sa@analog.com, upstream@semihalf.com, amstan@chromium.org, =?UTF-8?q?Pawe=C5=82=20Anikiel?= Subject: [PATCH v2 2/7] ASoC: Add Google Chameleon v3 codec driver Date: Mon, 8 May 2023 13:30:32 +0200 Message-ID: <20230508113037.137627-3-pan@semihalf.com> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog In-Reply-To: <20230508113037.137627-1-pan@semihalf.com> References: <20230508113037.137627-1-pan@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add driver for the codec IP present on Google Chameleon v3 Signed-off-by: Pawe=C5=82 Anikiel --- sound/soc/codecs/Kconfig | 8 +++++++ sound/soc/codecs/Makefile | 2 ++ sound/soc/codecs/chv3-codec.c | 41 +++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 sound/soc/codecs/chv3-codec.c diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 79d2362ad055..f8f15e96ade5 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -57,6 +57,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_AW88395 imply SND_SOC_BT_SCO imply SND_SOC_BD28623 + imply SND_SOC_CHV3_CODEC imply SND_SOC_CQ0093VC imply SND_SOC_CROS_EC_CODEC imply SND_SOC_CS35L32 @@ -643,6 +644,13 @@ config SND_SOC_BD28623 config SND_SOC_BT_SCO tristate "Dummy BT SCO codec driver" =20 +config SND_SOC_CHV3_CODEC + tristate "Google Chameleon v3 codec driver" + help + Enable support for the Google Chameleon v3 audio codec. + This codec does not have a control interface, it always outputs + 8 channel S32_LE audio. + config SND_SOC_CPCAP tristate "Motorola CPCAP codec" depends on MFD_CPCAP || COMPILE_TEST diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 5cdbae88e6e3..8cee836f4831 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -51,6 +51,7 @@ snd-soc-aw88395-objs :=3D aw88395/aw88395.o \ aw88395/aw88395_device.o snd-soc-bd28623-objs :=3D bd28623.o snd-soc-bt-sco-objs :=3D bt-sco.o +snd-soc-chv3-codec-objs :=3D chv3-codec.o snd-soc-cpcap-objs :=3D cpcap.o snd-soc-cq93vc-objs :=3D cq93vc.o snd-soc-cros-ec-codec-objs :=3D cros_ec_codec.o @@ -425,6 +426,7 @@ obj-$(CONFIG_SND_SOC_AW88395_LIB) +=3D snd-soc-aw88395-= lib.o obj-$(CONFIG_SND_SOC_AW88395) +=3Dsnd-soc-aw88395.o obj-$(CONFIG_SND_SOC_BD28623) +=3D snd-soc-bd28623.o obj-$(CONFIG_SND_SOC_BT_SCO) +=3D snd-soc-bt-sco.o +obj-$(CONFIG_SND_SOC_CHV3_CODEC) +=3D snd-soc-chv3-codec.o obj-$(CONFIG_SND_SOC_CQ0093VC) +=3D snd-soc-cq93vc.o obj-$(CONFIG_SND_SOC_CPCAP) +=3D snd-soc-cpcap.o obj-$(CONFIG_SND_SOC_CROS_EC_CODEC) +=3D snd-soc-cros-ec-codec.o diff --git a/sound/soc/codecs/chv3-codec.c b/sound/soc/codecs/chv3-codec.c new file mode 100644 index 000000000000..ab99effa6874 --- /dev/null +++ b/sound/soc/codecs/chv3-codec.c @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include +#include + +static struct snd_soc_dai_driver chv3_codec_dai =3D { + .name =3D "chv3-codec-hifi", + .capture =3D { + .stream_name =3D "Capture", + .channels_min =3D 8, + .channels_max =3D 8, + .rates =3D SNDRV_PCM_RATE_CONTINUOUS, + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + }, +}; + +static const struct snd_soc_component_driver soc_component_dev_chv3_codec = =3D { +}; + +static int chv3_codec_probe(struct platform_device *pdev) +{ + return devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_chv3_codec, &chv3_codec_dai, 1); +} + +static const struct of_device_id chv3_codec_of_match[] =3D { + { .compatible =3D "google,chv3-codec", }, + { } +}; + +static struct platform_driver chv3_codec_platform_driver =3D { + .driver =3D { + .name =3D "chv3-codec", + .of_match_table =3D chv3_codec_of_match, + }, + .probe =3D chv3_codec_probe, +}; +module_platform_driver(chv3_codec_platform_driver); + +MODULE_DESCRIPTION("ASoC Chameleon v3 codec driver"); +MODULE_AUTHOR("Pawel Anikiel "); +MODULE_LICENSE("GPL"); --=20 2.40.1.521.gf1e218fcd8-goog From nobody Thu Dec 18 07:58:13 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A83C0C77B7F for ; Mon, 8 May 2023 11:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235926AbjEHLcG (ORCPT ); Mon, 8 May 2023 07:32:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235882AbjEHLbm (ORCPT ); Mon, 8 May 2023 07:31:42 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C38473EDA6 for ; Mon, 8 May 2023 04:30:59 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4f00d41df22so28208181e87.1 for ; Mon, 08 May 2023 04:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1683545458; x=1686137458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SCcpa8mh8EUPdc5cCKwnMcMZnzZb8Ven1VF00UODHfU=; b=qUCA3KSpK0KLofEQAl1J4VbNkFSBblrbel7Qyuby6GRPvaAdm4jfsLW4bnPm6lbW1e qcx4KopofnzhxwdlRp5SgOvrsC8bSrQikYwDCe8CB0VzaaV29H3evCR07OyELOjjd9hv 4ABDXIq9k+NnJkSnIvGCTxqEkC3J2ijAsap0a326g4cBJErQiTFHDh1HyeEJrrF0aQyV so4WxN+vdwxfLVQ0zsQ/oAPw6hl8Xp6RSbAhruzbWScKKnzz8m7iuYWDzcUiK2HoQxYM dfPCaLnF77CwiboVDj2zI3wlkFslCIvwTwL3Z9dta+vjQS4I0jKVO0i/fTAS+KT0Ztz0 GLuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683545458; x=1686137458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SCcpa8mh8EUPdc5cCKwnMcMZnzZb8Ven1VF00UODHfU=; b=bPA3eyyZq3hAb+Qs6Y+AnYdYwHYFBrlYwMS0cZkhm6HdD7Fwd2HcgaVhOZZgWKdoXl 8BU49xpSMBHQc2e7Epdb2uMar5SIYqFL92qzi4Ny9yyhL3UQXhaA8H/FTuUTFIjqLeHO nmbiygVDh97zHC62wgvkQHczlovKEHSfSlLobL3Dro/rEsYm0zUZ71aGeVOzlw84baPs nvx/CCc4GmaHikcCZBN4p/3303rWrgstuhY/BERRehynpHojzzmcwFnmUiGml1PLzRpf qBj2rZ53k6YP/1BelH2rKNatXZg/GOW4nx+km47BcwNfck+uZW6orqdo6QYrLv/I6yn7 CE/g== X-Gm-Message-State: AC+VfDzH1BbpT0kWbcTTY/gdWTRZBbbIbcC1+lDt5KhL7t2FXi/1DGaM Af5JtGAJ4CW9E8CGTCogV5GvLQ== X-Google-Smtp-Source: ACHHUZ4EEcaGcUaK7vu//980DZoWeqhAaPt+zAj10ov/qO3SBtQsFVya9VsjeLlvmcsuL40m+iZZXQ== X-Received: by 2002:a2e:b5d4:0:b0:2a9:45fb:6331 with SMTP id g20-20020a2eb5d4000000b002a945fb6331mr2698032ljn.6.1683545457872; Mon, 08 May 2023 04:30:57 -0700 (PDT) Received: from panikiel.office.semihalf.net ([83.142.187.84]) by smtp.gmail.com with ESMTPSA id k8-20020a2e2408000000b002a8b9353338sm1144406ljk.117.2023.05.08.04.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 May 2023 04:30:57 -0700 (PDT) From: =?UTF-8?q?Pawe=C5=82=20Anikiel?= To: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, lgirdwood@gmail.com, broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dinguyen@kernel.org, lars@metafoo.de, nuno.sa@analog.com, upstream@semihalf.com, amstan@chromium.org, =?UTF-8?q?Pawe=C5=82=20Anikiel?= Subject: [PATCH v2 3/7] ASoC: dt-bindings: Add Google Chameleon v3 i2s device Date: Mon, 8 May 2023 13:30:33 +0200 Message-ID: <20230508113037.137627-4-pan@semihalf.com> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog In-Reply-To: <20230508113037.137627-1-pan@semihalf.com> References: <20230508113037.137627-1-pan@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add binding for google,chv3-i2s device. Signed-off-by: Pawe=C5=82 Anikiel Reviewed-by: Krzysztof Kozlowski --- .../bindings/sound/google,chv3-i2s.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-i2s= .yaml diff --git a/Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml b= /Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file mode 100644 index 000000000000..3ce910f44d39 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-i2s.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 I2S device + +maintainers: + - Pawe=C5=82 Anikiel + +description: | + I2S device for the Google Chameleon v3. The device handles both RX + and TX using a producer/consumer ring buffer design. + +properties: + compatible: + const: google,chv3-i2s + + reg: + items: + - description: core registers + - description: irq registers + + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include + + i2s@c0060300 { + compatible =3D "google,chv3-i2s"; + reg =3D <0xc0060300 0x100>, + <0xc0060f00 0x10>; + interrupts =3D ; + }; --=20 2.40.1.521.gf1e218fcd8-goog From nobody Thu Dec 18 07:58:13 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9993FC77B73 for ; Mon, 8 May 2023 11:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235978AbjEHLcK (ORCPT ); Mon, 8 May 2023 07:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235925AbjEHLbo (ORCPT ); Mon, 8 May 2023 07:31:44 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA4F73EDB6 for ; Mon, 8 May 2023 04:31:00 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4f14468ef54so5014554e87.0 for ; Mon, 08 May 2023 04:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1683545458; x=1686137458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=shiQSDHxh2e+KlYJCYWsmpEL6ugBkLgWKoLDXET6U5s=; b=n8CNxVHOk+38/s0589knvXD81SPym5aqdK0A73K52Br0MOHeFOM9Gr1OdsbbgzcbgP CdI1J7TsZjoVcLmoHVrfwtp7KnxCGHSnxbAH9Nin+SFoCizJewq0XFhB4glBWCgP5flD Uq6+pxH1hJy/WdI3ksWcwMGf3Zndb1eNYiO5mXQtTGQe/C+VNe30Jje6G9Q5hVsZQLme 19iNgCeO8LSwrAwfo+zp9FoXx1WRS1e+ZE+2Ls+m9HrnCGJ4XU+Urxkfo4qCBBJAGGfg n0QW1h1NoKyf+nGMljdfdfHOhgohcigAgK40Zhwpg5+iNmWFgPoQoMdhpUGVu3xm3cg1 bDLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683545458; x=1686137458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=shiQSDHxh2e+KlYJCYWsmpEL6ugBkLgWKoLDXET6U5s=; b=lYeKTI7yIztwvC4pB+fhKZqoUGGkvi8+G5/q+avFbZMZ4AmI7Qs/rbQxa6z43GHruq OQ6bv7xhlCcuzeu2t0a1WXkxPBGkV+5WFdys1Ad3MUxy46tAvZf/OtVTMUx19vDDBzN4 74CZyKfs6Y2CNnN5/6S8H86VXhKdkJHJKft1q+u0TxHV8An0uQHSjmVXM42+IumXdX+w QNWOsruAiL9mW5nVp3aknFjLb/XAnGdU/y9gccu4Xu9KQeRyYimnO+NnWaDkJ3iUhy/X 4loD2aQx3/XQmSURojxyy+Cj60kCh0FRXiLi1ZeTMr8zMBdhXzCI4HploBuUJXcsLqQn mjSw== X-Gm-Message-State: AC+VfDzn0qSdzhx3FCDZ9LQiQd/5bTX0PDWzXUCuZIjm3wLaMdGLyfmW FM/uY5Gluu9GWiLilBaRRRIprA== X-Google-Smtp-Source: ACHHUZ50+PimcUDxTXMGgv4EmguGyZF2tQHBDg+ZcDZGs3SUV4qB2dxtuCHtl09GTLefG4MJiuTaHw== X-Received: by 2002:ac2:4461:0:b0:4ee:e0c7:434d with SMTP id y1-20020ac24461000000b004eee0c7434dmr2134076lfl.51.1683545458729; Mon, 08 May 2023 04:30:58 -0700 (PDT) Received: from panikiel.office.semihalf.net ([83.142.187.84]) by smtp.gmail.com with ESMTPSA id k8-20020a2e2408000000b002a8b9353338sm1144406ljk.117.2023.05.08.04.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 May 2023 04:30:58 -0700 (PDT) From: =?UTF-8?q?Pawe=C5=82=20Anikiel?= To: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, lgirdwood@gmail.com, broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dinguyen@kernel.org, lars@metafoo.de, nuno.sa@analog.com, upstream@semihalf.com, amstan@chromium.org, =?UTF-8?q?Pawe=C5=82=20Anikiel?= Subject: [PATCH v2 4/7] ASoC: dt-bindings: Add Google Chameleon v3 audio codec Date: Mon, 8 May 2023 13:30:34 +0200 Message-ID: <20230508113037.137627-5-pan@semihalf.com> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog In-Reply-To: <20230508113037.137627-1-pan@semihalf.com> References: <20230508113037.137627-1-pan@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add binding for google,chv3-codec device. Signed-off-by: Pawe=C5=82 Anikiel --- .../bindings/sound/google,chv3-codec.yaml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-cod= ec.yaml diff --git a/Documentation/devicetree/bindings/sound/google,chv3-codec.yaml= b/Documentation/devicetree/bindings/sound/google,chv3-codec.yaml new file mode 100644 index 000000000000..5329dc140b1c --- /dev/null +++ b/Documentation/devicetree/bindings/sound/google,chv3-codec.yaml @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-codec.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 audio codec + +maintainers: + - Pawe=C5=82 Anikiel + +allOf: + - $ref: dai-common.yaml# + +properties: + compatible: + const: google,chv3-codec + + "#sound-dai-cells": + const: 0 + +required: + - compatible + +additionalProperties: false + +examples: + - | + audio-codec { + compatible =3D "google,chv3-codec"; + }; --=20 2.40.1.521.gf1e218fcd8-goog From nobody Thu Dec 18 07:58:13 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 859FEC77B73 for ; Mon, 8 May 2023 11:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235822AbjEHLcM (ORCPT ); Mon, 8 May 2023 07:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235929AbjEHLbq (ORCPT ); Mon, 8 May 2023 07:31:46 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB984BBFE for ; Mon, 8 May 2023 04:31:01 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2ac8cc8829fso32055791fa.3 for ; Mon, 08 May 2023 04:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1683545459; x=1686137459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ago5W1TH3NtYlqnoMKL2QoZcqhImH0EhtanUKlx90+o=; b=ubqJyPUXHkbI4WVG4p1/PBG73AtSJIpqB/ICYxMLF8yrq2pTPj0EmaTlq3zuCful4n MFM9xrXSTPVnn4YflEdt3wvK4GTbpC3Xj2EeRLfcCKfyEtX4jXTwKMWNG/dQOLRvLFfp xy7ky6fMUjmLdBl5TBiz+RqdJWePrLWSaJln1Hxes8TL6RxSTRfDpG1IDXsXe432PRZV Wr1rxHAZ66XoVTFDYbgrOFkA+ohh52HMjDI8drQu8SZw4zGiKMZ0f41TAj4KT17K9ogG HZ2jU4GPk/oRejiYUuBS9z13dOZXLx0o1MRT2uR8V+LhKeCy2kWDGNja1DvLGZJT0W7Q E6FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683545459; x=1686137459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ago5W1TH3NtYlqnoMKL2QoZcqhImH0EhtanUKlx90+o=; b=TXTOa4iG4oztnOnh3s6yzD2u2gyW02STmyVH+lCpNFrxwQrpgNcmueHOfWJJC/ak7B i/kpHzPbUQphBRyaV2TyyNZHurKE15YNcEOcxGujWlCnfwDEYERdIFVMVv74IPxHLjFe NocfLQDKpur/CZGszeZwOcuV6QwqJA6Mtg0W5esrwPeYYgUdz2tAL15QR9ri3+U7Tt00 dT0hCes7gGrMY6pxVB5muiTqRyUB/2d3b+Q56C83lmy39hBTyEy1T29rc0RhsVZf63LY 8uV6H0CDXGkYhHZ0MywjqH0mAAz8qlUsCmyS24LsCjSjcI5zxF4D1pblZEzW5zqSzoBb q33g== X-Gm-Message-State: AC+VfDyvYT79N5AQuRdweLEVAkqlWC7jAkSQ66Tj2g3MQzSnU1ah9JAZ QhGY4rYBQtWXD41yP2txUfYarg== X-Google-Smtp-Source: ACHHUZ6dznyxLhJT/VBoJN3aVEWWHkYoCuIWMKXSx1E6hT10TgdkNvC/r4/EbQWmrtsm3zZdT804Jw== X-Received: by 2002:a2e:9b08:0:b0:2a8:e480:a3c8 with SMTP id u8-20020a2e9b08000000b002a8e480a3c8mr2548687lji.44.1683545459588; Mon, 08 May 2023 04:30:59 -0700 (PDT) Received: from panikiel.office.semihalf.net ([83.142.187.84]) by smtp.gmail.com with ESMTPSA id k8-20020a2e2408000000b002a8b9353338sm1144406ljk.117.2023.05.08.04.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 May 2023 04:30:59 -0700 (PDT) From: =?UTF-8?q?Pawe=C5=82=20Anikiel?= To: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, lgirdwood@gmail.com, broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dinguyen@kernel.org, lars@metafoo.de, nuno.sa@analog.com, upstream@semihalf.com, amstan@chromium.org, =?UTF-8?q?Pawe=C5=82=20Anikiel?= Subject: [PATCH v2 5/7] ARM: dts: chameleonv3: Add mute gpio hog Date: Mon, 8 May 2023 13:30:35 +0200 Message-ID: <20230508113037.137627-6-pan@semihalf.com> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog In-Reply-To: <20230508113037.137627-1-pan@semihalf.com> References: <20230508113037.137627-1-pan@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add an output-high gpio hog for the mute pin. Signed-off-by: Pawe=C5=82 Anikiel --- arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts b/arch/arm/b= oot/dts/socfpga_arria10_chameleonv3.dts index 422d00cd4c74..f0483ef46a36 100644 --- a/arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts +++ b/arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts @@ -69,6 +69,12 @@ u80: gpio@21 { "TP122", "TP123", "TP124"; + + mute { + gpio-hog; + gpios =3D <0 0>; + output-high; + }; }; }; =20 --=20 2.40.1.521.gf1e218fcd8-goog From nobody Thu Dec 18 07:58:13 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A7C2C77B73 for ; Mon, 8 May 2023 11:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235991AbjEHLcQ (ORCPT ); Mon, 8 May 2023 07:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235935AbjEHLbq (ORCPT ); Mon, 8 May 2023 07:31:46 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C6B03D209 for ; Mon, 8 May 2023 04:31:02 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4f00d41df22so28208382e87.1 for ; Mon, 08 May 2023 04:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1683545460; x=1686137460; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AhrKh4Q91sZcDX0gh+ihiUBjUKwTDAbt/DVIKMwpD58=; b=lUUfpAeVYiOp9sTbu7V2dri2yipImnljXZO7JnejQP6OpjQt/zWkyKihYCsVro6o7l S6UoN+QxuZHfcuwgC7cHr0l/mHxbd8R51UUYxQf7lq+3B8QRTTEtR79Gd3vqBdR4HjB7 ORczo3vCzMS1X9nxfzh1q1ueq1vL4qovPEgx3aNxeJfYNfBk1PQw9qUyEttYkaCKijrP v0ilfSf5XaV/Tm0RaeID6+sTVhfZhWbnJXFaWc1G/55u9fKVa4vyaX0iqEkIWDQzRaPH a7LMrAUfDUv92d6hkbLrHXZSZTHomOqJ8DxpjfGweDH2J38eBlSoyQkC7btL/t9C4adM xudQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683545460; x=1686137460; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AhrKh4Q91sZcDX0gh+ihiUBjUKwTDAbt/DVIKMwpD58=; b=BPikLsMElbE8s4jFZ9w1WA2pCNV0b2nEGH8hfBPyyOKh1oRvbd7jqm0hFndtgjW/W1 rN8sAWkpfCJ/2CwWiD/lom1Cbx+ZX7I1Pf78lkZVPNHnXCHorDIDP/EKQnWRmUczRWmq iftTodj74JSNzE2tzh1hOlYM7h9bOFMu8dLc96rhYPC1DNCzFer39e2JilePA29/Cmmu riGy3ANRzraknod6/x/uhwdfzl5/StxEKYkRASdrhpGDfBM8AoYBoIgNozHh2lSKBf2U /3L0y4DrjZK5mfA/CYttzB2gPzeQ6vgh/C4L3vdDSd6PdPWY7/ZpsIrz9gw1lP79PFJF M+sA== X-Gm-Message-State: AC+VfDzlA+rT4fAe1Zk6brVqxY4CbBgtA2ligtPUD3+VengaXCOicVjo cX9pbAXni9E4lVuUmlac56Lh2g== X-Google-Smtp-Source: ACHHUZ4C5KbrYUeGkSphmYDewWuv94QqJjr9H/rTtEfQLFyPH78jorLDZ2/w5tdPPZSc1PQ/QXjNPg== X-Received: by 2002:a2e:8e3a:0:b0:2a9:d4f0:6 with SMTP id r26-20020a2e8e3a000000b002a9d4f00006mr2845808ljk.17.1683545460507; Mon, 08 May 2023 04:31:00 -0700 (PDT) Received: from panikiel.office.semihalf.net ([83.142.187.84]) by smtp.gmail.com with ESMTPSA id k8-20020a2e2408000000b002a8b9353338sm1144406ljk.117.2023.05.08.04.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 May 2023 04:31:00 -0700 (PDT) From: =?UTF-8?q?Pawe=C5=82=20Anikiel?= To: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, lgirdwood@gmail.com, broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dinguyen@kernel.org, lars@metafoo.de, nuno.sa@analog.com, upstream@semihalf.com, amstan@chromium.org, =?UTF-8?q?Pawe=C5=82=20Anikiel?= Subject: [PATCH v2 6/7] ARM: dts: chameleonv3: Add Chameleon v3 audio Date: Mon, 8 May 2023 13:30:36 +0200 Message-ID: <20230508113037.137627-7-pan@semihalf.com> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog In-Reply-To: <20230508113037.137627-1-pan@semihalf.com> References: <20230508113037.137627-1-pan@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add dts nodes for i2s, audio codec, and simple-audio-card devices. Signed-off-by: Pawe=C5=82 Anikiel --- .../boot/dts/socfpga_arria10_chameleonv3.dts | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts b/arch/arm/b= oot/dts/socfpga_arria10_chameleonv3.dts index f0483ef46a36..a69819e26144 100644 --- a/arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts +++ b/arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts @@ -15,6 +15,61 @@ aliases { i2c0 =3D &i2c0; i2c1 =3D &i2c1; }; + + soc { + i2s0: i2s@c0060300 { + compatible =3D "google,chv3-i2s"; + reg =3D <0xc0060300 0x100>, + <0xc0060f00 0x10>; + interrupts =3D ; + #sound-dai-cells =3D <0>; + }; + + i2s1: i2s@c0060400 { + compatible =3D "google,chv3-i2s"; + reg =3D <0xc0060400 0x100>, + <0xc0060f10 0x10>; + interrupts =3D ; + #sound-dai-cells =3D <0>; + }; + }; + + sound { + compatible =3D "simple-audio-card"; + simple-audio-card,name =3D "chv3-audio"; + #address-cells =3D <1>; + #size-cells =3D <0>; + + simple-audio-card,dai-link@0 { + reg =3D <0>; + cpu { + sound-dai =3D <&i2s0>; + }; + codec { + sound-dai =3D <&chv3_codec>; + }; + }; + + simple-audio-card,dai-link@1 { + reg =3D <1>; + format =3D "i2s"; + cpu { + sound-dai =3D <&i2s1>; + }; + codec { + sound-dai =3D <&ssm2603>; + bitclock-master; + frame-master; + system-clock-frequency =3D <22579200>; + mclk-fs =3D <512>; + }; + }; + }; + + chv3_codec: audio-codec { + compatible =3D "google,chv3-codec"; + #sound-dai-cells =3D <0>; + }; }; =20 &gmac0 { @@ -39,6 +94,7 @@ &i2c0 { ssm2603: audio-codec@1a { compatible =3D "adi,ssm2603"; reg =3D <0x1a>; + #sound-dai-cells =3D <0>; }; }; =20 --=20 2.40.1.521.gf1e218fcd8-goog From nobody Thu Dec 18 07:58:13 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A43D8C7EE22 for ; Mon, 8 May 2023 11:32:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235937AbjEHLcY (ORCPT ); Mon, 8 May 2023 07:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235948AbjEHLbs (ORCPT ); Mon, 8 May 2023 07:31:48 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A007E3D211 for ; Mon, 8 May 2023 04:31:03 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2ac7462d9f1so49314451fa.2 for ; Mon, 08 May 2023 04:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1683545461; x=1686137461; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ymKooIYpnS0yXmXMVqwK3LSKOegi+Ec1cIWEbDw6jNE=; b=EkbqMgpAbp9yuEgOG1A3wXusm0aFuxDIqSVict33dumhnUUCzPqZz/659moGrwOhHF pPFk+3yCI4QXcUi01EhSOBw6VaAiHtQPM+YIMzA/2+qi7olUCEk3u6uDy6A2v+8NQ2zK ZnZ8RpyT9XAfSuCIsajRwnGBkA/LT9BBPy2uK+9KuAlJZ70s0z/DkhmcR/+MLKSseZ39 3WZg6CT0HDHuiKqwgjwg7prejSMg5M1t4v+TP+dat13Mf0wDnfP2JIzfd9rgkmr24x63 G8P6wTgwuIp/0vi7wl2VIM5kk47T2Xj7Cka51IRwAm6KoWVs4p1sfhGcV93fJMslV/tE +rhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683545461; x=1686137461; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ymKooIYpnS0yXmXMVqwK3LSKOegi+Ec1cIWEbDw6jNE=; b=GAA/lRWrz+rX03QA78yOT88Ma6ixcD+AY1xCp0RbDEU6K55ah0hIwzdzn3sGiZT/41 Lw53sTvJ2UpqlfWHlE8XgedL32HWn/7UUWxihlc6+aG1HCIcykH9wFCa8/1++xN9QL8e jTbtiiX25Eh31L0GVwwEtr0ybWNEQrgAO7E+8SHDTCdwLA1/k3UolowpCRurHERTeLZb ++mPB9yNyDBJFoD/DWp5/5KZ1xI/ahp6vPdgep1jUMjeE98rs1qVoho98B6Ahz+9Fxs3 euF37s8Eb1udvdvdoth6FY8UxecwpAYxNPGF4dKTv+Ix4r9m5+AgPwJqm+FB0+W3laYF yEyQ== X-Gm-Message-State: AC+VfDyTXFafs1FexwF1C3/7uW3CkxZAF9YgXhLkmuuJ1oGDgECEQIuL Ha44Dark6hMqwD7zmo1EwiJ9ZA== X-Google-Smtp-Source: ACHHUZ7Xo1m77SC9+1H52SaylyUjEYosNnuWegDfTXW98eJ0YFRyE7rIxq+OofISewu6mn1JhUksog== X-Received: by 2002:a2e:9d87:0:b0:2a8:a629:c203 with SMTP id c7-20020a2e9d87000000b002a8a629c203mr2801101ljj.32.1683545461381; Mon, 08 May 2023 04:31:01 -0700 (PDT) Received: from panikiel.office.semihalf.net ([83.142.187.84]) by smtp.gmail.com with ESMTPSA id k8-20020a2e2408000000b002a8b9353338sm1144406ljk.117.2023.05.08.04.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 May 2023 04:31:01 -0700 (PDT) From: =?UTF-8?q?Pawe=C5=82=20Anikiel?= To: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, lgirdwood@gmail.com, broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dinguyen@kernel.org, lars@metafoo.de, nuno.sa@analog.com, upstream@semihalf.com, amstan@chromium.org, =?UTF-8?q?Pawe=C5=82=20Anikiel?= Subject: [PATCH v2 7/7] ASoC: ssm2602: Add workaround for playback distortions Date: Mon, 8 May 2023 13:30:37 +0200 Message-ID: <20230508113037.137627-8-pan@semihalf.com> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog In-Reply-To: <20230508113037.137627-1-pan@semihalf.com> References: <20230508113037.137627-1-pan@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Apply a workaround for what appears to be a hardware quirk. The problem seems to happen when enabling "whole chip power" (bit D7 register R6) for the very first time after the chip receives power. If either "output" (D4) or "DAC" (D3) aren't powered on at that time, playback becomes very distorted later on. This happens on the Google Chameleon v3, as well as on a ZYBO Z7-10: https://ez.analog.com/audio/f/q-a/543726/solved-ssm2603-right-output-offset= -issue/480229 I suspect this happens only when using an external MCLK signal (which is the case for both of these boards). Here are some experiments run on a Google Chameleon v3. These were run in userspace using a wrapper around the i2cset utility: ssmset() { i2cset -y 0 0x1a $(($1*2)) $2 } For each of the following sequences, we apply power to the ssm2603 chip, set the configuration registers R0-R5 and R7-R8, run the selected sequence, and check for distortions on playback. ssmset 0x09 0x01 # core ssmset 0x06 0x07 # chip, out, dac OK ssmset 0x09 0x01 # core ssmset 0x06 0x87 # out, dac ssmset 0x06 0x07 # chip OK (disable MCLK) ssmset 0x09 0x01 # core ssmset 0x06 0x1f # chip ssmset 0x06 0x07 # out, dac (enable MCLK) OK ssmset 0x09 0x01 # core ssmset 0x06 0x1f # chip ssmset 0x06 0x07 # out, dac NOT OK ssmset 0x06 0x1f # chip ssmset 0x09 0x01 # core ssmset 0x06 0x07 # out, dac NOT OK ssmset 0x09 0x01 # core ssmset 0x06 0x0f # chip, out ssmset 0x06 0x07 # dac NOT OK ssmset 0x09 0x01 # core ssmset 0x06 0x17 # chip, dac ssmset 0x06 0x07 # out NOT OK For each of the following sequences, we apply power to the ssm2603 chip, run the selected sequence, issue a reset with R15, configure R0-R5 and R7-R8, run one of the NOT OK sequences from above, and check for distortions. ssmset 0x09 0x01 # core ssmset 0x06 0x07 # chip, out, dac OK (disable MCLK) ssmset 0x09 0x01 # core ssmset 0x06 0x07 # chip, out, dac (enable MCLK after reset) NOT OK ssmset 0x09 0x01 # core ssmset 0x06 0x17 # chip, dac NOT OK ssmset 0x09 0x01 # core ssmset 0x06 0x0f # chip, out NOT OK ssmset 0x06 0x07 # chip, out, dac NOT OK Signed-off-by: Pawe=C5=82 Anikiel --- sound/soc/codecs/ssm2602.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index 00b60369b029..c29324403e9d 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -53,6 +53,18 @@ static const struct reg_default ssm2602_reg[SSM2602_CACH= EREGNUM] =3D { { .reg =3D 0x09, .def =3D 0x0000 } }; =20 +/* + * ssm2602 register patch + * Workaround for playback distortions after power up: activates digital + * core, and then powers on output, DAC, and whole chip at the same time + */ + +static const struct reg_sequence ssm2602_patch[] =3D { + { SSM2602_ACTIVE, 0x01 }, + { SSM2602_PWR, 0x07 }, + { SSM2602_RESET, 0x00 }, +}; + =20 /*Appending several "None"s just for OSS mixer use*/ static const char *ssm2602_input_select[] =3D { @@ -598,6 +610,9 @@ static int ssm260x_component_probe(struct snd_soc_compo= nent *component) return ret; } =20 + regmap_register_patch(ssm2602->regmap, ssm2602_patch, + ARRAY_SIZE(ssm2602_patch)); + /* set the update bits */ regmap_update_bits(ssm2602->regmap, SSM2602_LINVOL, LINVOL_LRIN_BOTH, LINVOL_LRIN_BOTH); --=20 2.40.1.521.gf1e218fcd8-goog