From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D0A8C4345F for ; Sun, 14 Apr 2024 10:48:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=33/ozD5VEbf2CCMTCYPriZPbHBTaiAOwMxE1ukSzqlc=; b=TcR1RIbTXbZ9C3 Jhm8RxcBSKSUblbpH3OU83uIn79cw/Ski5yK9dRHlcJnU1aiszkcECvaYa56XtGc3ltpMdodERIoU zMAXeIrROclZpeDS+kQ7nvkMn32QVHgI1wOFX6dtu9e5jHA3bMADtffJr8q5MhxHkRcLCLIa9LYHU K8bd8421DMizgpTKMEsEpQtcPFlallutxlzxEupgCcv2w3cMfiJXEXnicPq0fE7r5HSNsxqjZr4mf n/dUP4t8BeSrf/sy+ywhXD0+A+d/0BqcevuP+VaT/ZzZCfjev/Xbe+1+edmp3ky0JyJmis3dJ82f6 Egd61aW+qOwZPfVC+uHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvxPQ-00000005Hvw-02jI; Sun, 14 Apr 2024 10:48:28 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvxPK-00000005HvP-3dLv for linux-arm-kernel@lists.infradead.org; Sun, 14 Apr 2024 10:48:26 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a44665605f3so229389666b.2 for ; Sun, 14 Apr 2024 03:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713091700; x=1713696500; darn=lists.infradead.org; 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=x/mEm9VxMgunJVGx3eWq8zXkvnaXSuLo3RVjgAEd/rI=; b=DULCE/unnMsNMderrU4B2bJQC+6Z2iDoqIbl8DfKKstJXuitcMlq9R6NIGyoJ6cwvM ZHgnfPnFT8yRW7XkkgqU+dRnagMhYN5ihSu+Ip86mhZ4gHC4+/cIYXcIUJoewCXFvA1Q iw/QguQf29VIXUR7ekkNFH4V5XbTM+MLqNNKUUDRy/mgo7dbg+iNQjC2WWjjttP9EqPf TVyFvo5e8mDz17/6JPK/nt8iK7oVj/AqLzu6aCjK3QD+a4xWeDg7bWXZX5ggPeWd3R0g A1qj+uQbSHHvpR7nsVHtU55mpdh30U+M2Rya9F3D3N2klFwfyb/12zURaT77pWNWVh5r PBaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713091700; x=1713696500; 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=x/mEm9VxMgunJVGx3eWq8zXkvnaXSuLo3RVjgAEd/rI=; b=UuksFRfrUIHw8yBYP/qQUJpnmchTwRMYP2L8S7athpKkBL3x9UDz9YdWmfr6YFgcHs JNVUpcS73YwXtJZ+KujWJaS3ftO3YovvUC6gOtzq3bGuoC/2pY0cN9v0Xahw1ovQ1jGo LCivdk9x+ZgHzTGmLNcT1bpPsUxgdwwaoEhsSwlzzRZkT8PAYMwbXvUGlp0BGrLQX2UQ pglHvuu36Sn+pQf69WXZDug5Z73TV4fzzx6HuFHKjGccy6d59VOkgEDai3yvjzoaB+86 /jW2bZRZ3gVnFxiSdaCsa46Am0QNdzC84d4SXMtfICNXg1TuxPtFviiQFPcuDgS4o5/I m6qg== X-Forwarded-Encrypted: i=1; AJvYcCXiGcov2ZXu+J/kbdlakTaZlAvyj6wmVZBxdZVkGlY4nlmujMImU+wO2m278zqufiqfxJ5GFfNqznENxul7jnptIWodViJPH+pvK/BW0Q12JKgrcVE= X-Gm-Message-State: AOJu0YzKIT0WK0i4ThM2zoGuJ6szFa+MO9ajNvABE2tGt8J4nYfplrlB ZopJ75nRpzwTbn+wFCj7IO0PjtmBMwQxaFnXDsMGePY5mhA4Nh4I5I2WiEhU X-Google-Smtp-Source: AGHT+IHioJIDXt3U+RODv/eSjkVBLxKX703mo9NFte/m+z5JlwQDMaUrTXF1oC/MLZwQ0sZ4qwSY3g== X-Received: by 2002:a17:907:7244:b0:a52:3010:af03 with SMTP id ds4-20020a170907724400b00a523010af03mr5152756ejc.5.1713091700187; Sun, 14 Apr 2024 03:48:20 -0700 (PDT) Received: from jernej-laptop.localnet (APN-123-252-50-gprs.simobil.net. [46.123.252.50]) by smtp.gmail.com with ESMTPSA id cr19-20020a170906d55300b00a46b4c09670sm4070532ejc.131.2024.04.14.03.48.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 03:48:19 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Chen-Yu Tsai , Samuel Holland , John Watts Cc: linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, John Watts Subject: Re: [PATCH v2] ASoC: sunxi: sun4i-i2s: Support 32-bit audio formats Date: Sun, 14 Apr 2024 12:48:17 +0200 Message-ID: <1787594.VLH7GnMWUR@jernej-laptop> In-Reply-To: <20240403-sunxi_s32-v2-1-29ebf6ad590a@jookia.org> References: <20240403-sunxi_s32-v2-1-29ebf6ad590a@jookia.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240414_034822_955404_FB06D292 X-CRM114-Status: GOOD ( 27.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Dne sreda, 3. april 2024 ob 05:47:35 CEST je John Watts napisal(a): > The I2S cores used in the H3 onwards support 32-bit sample rates. > Support these by adding a per-variant PCM format list. > > Signed-off-by: John Watts Acked-by: Jernej Skrabec Best regards, Jernej > --- > This patch enables support for 32-bit audio in the sunxi I2S driver. > > I have only tested this on the Allwinner T113 but I'm fairly > certain it will work on older boards. > --- > Changes in v2: > - Specify PCM formats for each variant instead of failing in hw_params > - Link to v1: https://lore.kernel.org/r/20240326-sunxi_s32-v1-1-899f71dcb1e6@jookia.org > --- > sound/soc/sunxi/sun4i-i2s.c | 33 ++++++++++++++++++++++++++++----- > 1 file changed, 28 insertions(+), 5 deletions(-) > > diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c > index a736f632bf0b..59830f2a0d30 100644 > --- a/sound/soc/sunxi/sun4i-i2s.c > +++ b/sound/soc/sunxi/sun4i-i2s.c > @@ -156,6 +156,7 @@ struct sun4i_i2s; > /** > * struct sun4i_i2s_quirks - Differences between SoC variants. > * @has_reset: SoC needs reset deasserted. > + * @pcm_formats: available PCM formats > * @reg_offset_txdata: offset of the tx fifo. > * @sun4i_i2s_regmap: regmap config to use. > * @field_clkdiv_mclk_en: regmap field to enable mclk output. > @@ -175,6 +176,7 @@ struct sun4i_i2s; > */ > struct sun4i_i2s_quirks { > bool has_reset; > + snd_pcm_format_t pcm_formats; > unsigned int reg_offset_txdata; /* TX FIFO */ > const struct regmap_config *sun4i_i2s_regmap; > > @@ -1092,8 +1094,18 @@ static int sun4i_i2s_dai_probe(struct snd_soc_dai *dai) > return 0; > } > > +static int sun4i_i2s_dai_startup(struct snd_pcm_substream *sub, struct snd_soc_dai *dai) > +{ > + struct sun4i_i2s *i2s = snd_soc_dai_get_drvdata(dai); > + struct snd_pcm_runtime *runtime = sub->runtime; > + > + return snd_pcm_hw_constraint_mask64(runtime, SNDRV_PCM_HW_PARAM_FORMAT, > + i2s->variant->pcm_formats); > +} > + > static const struct snd_soc_dai_ops sun4i_i2s_dai_ops = { > .probe = sun4i_i2s_dai_probe, > + .startup = sun4i_i2s_dai_startup, > .hw_params = sun4i_i2s_hw_params, > .set_fmt = sun4i_i2s_set_fmt, > .set_sysclk = sun4i_i2s_set_sysclk, > @@ -1101,9 +1113,10 @@ static const struct snd_soc_dai_ops sun4i_i2s_dai_ops = { > .trigger = sun4i_i2s_trigger, > }; > > -#define SUN4I_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ > - SNDRV_PCM_FMTBIT_S20_LE | \ > - SNDRV_PCM_FMTBIT_S24_LE) > +#define SUN4I_FORMATS_ALL (SNDRV_PCM_FMTBIT_S16_LE | \ > + SNDRV_PCM_FMTBIT_S20_LE | \ > + SNDRV_PCM_FMTBIT_S24_LE | \ > + SNDRV_PCM_FMTBIT_S32_LE) > > static struct snd_soc_dai_driver sun4i_i2s_dai = { > .capture = { > @@ -1111,14 +1124,14 @@ static struct snd_soc_dai_driver sun4i_i2s_dai = { > .channels_min = 1, > .channels_max = 8, > .rates = SNDRV_PCM_RATE_8000_192000, > - .formats = SUN4I_FORMATS, > + .formats = SUN4I_FORMATS_ALL, > }, > .playback = { > .stream_name = "Playback", > .channels_min = 1, > .channels_max = 8, > .rates = SNDRV_PCM_RATE_8000_192000, > - .formats = SUN4I_FORMATS, > + .formats = SUN4I_FORMATS_ALL, > }, > .ops = &sun4i_i2s_dai_ops, > .symmetric_rate = 1, > @@ -1340,8 +1353,12 @@ static int sun4i_i2s_runtime_suspend(struct device *dev) > return 0; > } > > +#define SUN4I_FORMATS_A10 (SUN4I_FORMATS_ALL & ~SNDRV_PCM_FMTBIT_S32_LE) > +#define SUN4I_FORMATS_H3 SUN4I_FORMATS_ALL > + > static const struct sun4i_i2s_quirks sun4i_a10_i2s_quirks = { > .has_reset = false, > + .pcm_formats = SUN4I_FORMATS_A10, > .reg_offset_txdata = SUN4I_I2S_FIFO_TX_REG, > .sun4i_i2s_regmap = &sun4i_i2s_regmap_config, > .field_clkdiv_mclk_en = REG_FIELD(SUN4I_I2S_CLK_DIV_REG, 7, 7), > @@ -1360,6 +1377,7 @@ static const struct sun4i_i2s_quirks sun4i_a10_i2s_quirks = { > > static const struct sun4i_i2s_quirks sun6i_a31_i2s_quirks = { > .has_reset = true, > + .pcm_formats = SUN4I_FORMATS_A10, > .reg_offset_txdata = SUN4I_I2S_FIFO_TX_REG, > .sun4i_i2s_regmap = &sun4i_i2s_regmap_config, > .field_clkdiv_mclk_en = REG_FIELD(SUN4I_I2S_CLK_DIV_REG, 7, 7), > @@ -1383,6 +1401,7 @@ static const struct sun4i_i2s_quirks sun6i_a31_i2s_quirks = { > */ > static const struct sun4i_i2s_quirks sun8i_a83t_i2s_quirks = { > .has_reset = true, > + .pcm_formats = SUN4I_FORMATS_A10, > .reg_offset_txdata = SUN8I_I2S_FIFO_TX_REG, > .sun4i_i2s_regmap = &sun4i_i2s_regmap_config, > .field_clkdiv_mclk_en = REG_FIELD(SUN4I_I2S_CLK_DIV_REG, 7, 7), > @@ -1401,6 +1420,7 @@ static const struct sun4i_i2s_quirks sun8i_a83t_i2s_quirks = { > > static const struct sun4i_i2s_quirks sun8i_h3_i2s_quirks = { > .has_reset = true, > + .pcm_formats = SUN4I_FORMATS_H3, > .reg_offset_txdata = SUN8I_I2S_FIFO_TX_REG, > .sun4i_i2s_regmap = &sun8i_i2s_regmap_config, > .field_clkdiv_mclk_en = REG_FIELD(SUN4I_I2S_CLK_DIV_REG, 8, 8), > @@ -1419,6 +1439,7 @@ static const struct sun4i_i2s_quirks sun8i_h3_i2s_quirks = { > > static const struct sun4i_i2s_quirks sun50i_a64_codec_i2s_quirks = { > .has_reset = true, > + .pcm_formats = SUN4I_FORMATS_H3, > .reg_offset_txdata = SUN8I_I2S_FIFO_TX_REG, > .sun4i_i2s_regmap = &sun4i_i2s_regmap_config, > .field_clkdiv_mclk_en = REG_FIELD(SUN4I_I2S_CLK_DIV_REG, 7, 7), > @@ -1437,6 +1458,7 @@ static const struct sun4i_i2s_quirks sun50i_a64_codec_i2s_quirks = { > > static const struct sun4i_i2s_quirks sun50i_h6_i2s_quirks = { > .has_reset = true, > + .pcm_formats = SUN4I_FORMATS_H3, > .reg_offset_txdata = SUN8I_I2S_FIFO_TX_REG, > .sun4i_i2s_regmap = &sun50i_h6_i2s_regmap_config, > .field_clkdiv_mclk_en = REG_FIELD(SUN4I_I2S_CLK_DIV_REG, 8, 8), > @@ -1455,6 +1477,7 @@ static const struct sun4i_i2s_quirks sun50i_h6_i2s_quirks = { > > static const struct sun4i_i2s_quirks sun50i_r329_i2s_quirks = { > .has_reset = true, > + .pcm_formats = SUN4I_FORMATS_H3, > .reg_offset_txdata = SUN8I_I2S_FIFO_TX_REG, > .sun4i_i2s_regmap = &sun50i_h6_i2s_regmap_config, > .field_clkdiv_mclk_en = REG_FIELD(SUN4I_I2S_CLK_DIV_REG, 8, 8), > > --- > base-commit: 13227c2baa6b345451128828c9c2b0ec3868bd0d > change-id: 20240326-sunxi_s32-f2ab25b8e688 > > Best regards, > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel