From patchwork Mon Aug 5 00:39:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13752866 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011021.outbound.protection.outlook.com [52.101.125.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C7351755C for ; Mon, 5 Aug 2024 00:39:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.125.21 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722818351; cv=fail; b=sP1u0tOYv7vdSBZEPZ/SWO0wRHIpmH9QKQFKFSGSuPIAp+5HYg3jkLXmikKUD6CdToq08bzpX6yPKYzgVdKRiiun3e2a8cAwXKr8i4wgWc56SHkhAQIPw0hqudbUAxHbxAdKkFETuya/Lj3d01M2c4Q3OjYX+QdCgk9J7s9Tv/U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722818351; c=relaxed/simple; bh=ZVla2kCVfa7OyH6JF+K1WgC/yZlrEDto9pnX6hfnapI=; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type: Date:MIME-Version; b=dzfwetG1Pnoy9GQKcEpE0Qzvt/OKjtgvVz1ZOWwolJ9eBJl0UOoDkqPbBbIoiLBQTAjU7bTliogNoHxnAEopex0CVsgjl0I6ELL7N0oxZ5Tm5It7Wf8Md08fVuYxXzXzx8TnRvj4xXmO/9qVxeJQstnH3Lzbj4sNMzgo8kuGoR0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=cSPFrZCp; arc=fail smtp.client-ip=52.101.125.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="cSPFrZCp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Rprrc8CnulSq3eIEOjYdXT/R6PyGizQZARKtPK2K64SaUzO+4UBt6hf3TM/8VN5sez+6Z9YDpnvpqLJ4ro8gEYipTeGF+8aOr2dPyB6t6YZzRyFrqqDr8kVJRZKfA0Rdlf/cu7kOzS7AaBqQCQTz5fSv7hgVlmlGBhezTpwRO2bYZB/Yp9N0QC1dwbyqkcZyF0sjoIDP73baSlCdMaWX8K49LzUY7idg039LPVNDsh0VANX8M/DRWBCxe01eYUO0CY9XWUTMaktDfZcON4FP9H6X2d28K1g59AaDiDL6eWcWMJx/awPW1ZZON87Jh5i+MVnYI+mo3PdhBV7uJBVUwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=diqNshMfNO0lQYIcWhAiRyqi4EE1UTUgbAzeKkTFsGk=; b=dNJPe1BOH/sAC916ZAjz4qRyeEmYlUBJlXczSdihT9EKreIRodsXObZexDzPohPWad9Se+t9t9mZbP9x52XcTq3UcrqpBA2ffXHbJ6eRM6XNOXDFtL2qfyDXdBAVdruRRnkUj4xWmHrlwuTijJWpxSSLNCboQiVYjzFKDoNCNVIytHHQgl0e5G4R0vr8hmW7h3JFO32CxDLKkuDNiB3LNxDoRH4m4wtzYythnB2x5rWYDyKhmNnlaEeWTD/xDYoZ2gGR6nJ+bEuGIRG5vdXy5ssBGPjatjlnVg8L55iq43sxFUJ+LNkWk/l01sF04JnYH37bc4b0DGLSsfFoq37FeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=diqNshMfNO0lQYIcWhAiRyqi4EE1UTUgbAzeKkTFsGk=; b=cSPFrZCpDPme3CZ63yjaEGBM3H+nhzn1LKmOtWadcaEKMfKh0C2zgb5a4/Jz+oYMwagkv2Fzt4ZVlrsVtNtxWWblJbel7DpCWeU4lwuuFxhOBrqDRFd31bYwDbXS1HcQn6yT4TkeOQmG7y3b7tjx/YNoIF5Sj2zBLWEl9afrzCg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OSZPR01MB9459.jpnprd01.prod.outlook.com (2603:1096:604:1d0::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.25; Mon, 5 Aug 2024 00:39:04 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7828.023; Mon, 5 Aug 2024 00:39:04 +0000 Message-ID: <877ccvztuf.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 048/113] ASoC: dwc: use snd_pcm_is_playback/capture() User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Mark Brown Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-staging@lists.linux.dev, Linux-ALSA In-Reply-To: <874j7z3j1a.wl-kuninori.morimoto.gx@renesas.com> References: <874j7z3j1a.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 5 Aug 2024 00:39:04 +0000 X-ClientProxiedBy: TYCPR01CA0148.jpnprd01.prod.outlook.com (2603:1096:400:2b7::7) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB9459:EE_ X-MS-Office365-Filtering-Correlation-Id: 70b70dab-b8b5-40b7-00ba-08dcb4e7021c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: hsebqS8rhKR9qM3QLJpIWRjs/RCiXTvArChppTQMOTd9rf416Az+CGLtv+iBP7NRr640aR1Y9aE4hjf3T1uIuz2n5oVSwoWlzTtZbgdxLzTaj9RaSxWtr1BYxeiv/yzVuYSYp3XFWg699x4T/cid4B675PSgGxbFkihiSX0gz2UwDZ9/ao7m7niYRdVI77Jr5d76XPYkR6vH7N3wHxPlImfuFl4H8vMKI2I/uHCW6CyG4BgJGvOlPIoqparig+vUtG3KhAG1OzV+qQz6wo/k6AKXETYyvNLOPK8v54jb3kER2FXrE62bnd/QlmsCFB68Bi5237qFEfV9gMqQ6T5dZDjVJomo5skZ9WHE5OK2N+m5o0crHzxzFu0b8bzo8KQHjpEW/vRh206tVmFbPyTEnCKKqwAI9oj2FW6T05fnjb9G4nHBeRfNZlyUAtMTdXJdB9TuZ7nC8bfWyNgANNp4GyhLL8hm7+tyNJW/nE1gH/sBjOCf9btjhdtZOsWIlmuam6bBzkAt+UOsuV/o1cje1LPmoTiOvHg0/X8hBZwDrom2zSYMIvcseHFs2f2Xsqv3F17U/9IiFwcNsbWwCMDx1lBM+VzEWaL7I0iw2GOqzCwCGwWAdTe7/CoAsi8hN+gTMUejJYrWiO/VCrzw+9Q4vAzJdtCQXyM0roPP8WPOO1VtyE5CgLmYu+61hGfJjl7kZwbybESXMxus5nF7nOiBuzvhcTJfRxehT27werCdFHDa0YgMH4gp0PM0koQmYbUMPt0ZVlxxMFkpy1Z7AGdIqlLGqDBWzxASwPmPY64rN3y8KaqBQ/NP9s3YVFhmkKm/KzmyQ4s/TJNuRUWo26XmwRdyE1a+Ioz6906NcJ97YadDa4tzma/UvjdE7V8cKaAOW69Azk6PIlZL6UMhxOs4E24ODdp7zKmKGRbEVZVAf9wi+wIW55gX61YHS8ai+HtZjJEPA6/dgyZr5UeEIizbt9zTPatMahmqI1RLkk5ZaZvRBrRVnI0wFADfMVSoBQIluoiFKXSuaOs9H9FxmhQykTz6vfFLmP7t9aecpKZ4oxkZsGl0GrHXusgUNEVFlz0MNSIc2GVjkHKqLc6BCDhBZiX+Xh9wnrZoJB4oz44Wvi3ikDQb17C+SZfMu9mfKESXcVsKTmj2edGDsFBm5I4420rtGeOCQxuB6Qsa/WcSze11CbxN4P4RM1YG80sygInRgIDMKCLrcnNVH1slRtdNplS1ngKNDtnrub7O9Ki425XXXW3g5LLegUwOmqA8wVXVl41Ktn63RQRqfkjIpXlWdRbt4qomRvWs8aLoDXySm5neyL6sub3qrTmpfYIM4CFnqvrpcTlfPExIfSB72TZ4DgPAutUTf268jj3UmKH3hnG6CgFZHVKmFSugroDCah/yjcwqfcazNYdql3eZV6yi7Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6fTSicm4/IP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oTOmcPGr4zIz7J4xmCNSM/65JmNbneKMM6JgqpfuqTvNoriosOhs9gwP0dVPQKOiN5SKbVuJ6kLNEPC+CiXZab/2KapbnVcRQ6qM65ubmf7akLY9mKzpV5t7WbI1tQhWXBT8srm/wPStu6b7j43cmxoy59XmVcAo1MPc8kSNB+6m+03EEvZB8h02QRzCtZ11MM3FEjLtYTbp+Bj6MA4hG8zljiGA/Vse8Z0y+PkqyA34Tet0STpTeuKJlvLLa33NvQAxDclV20uS9UAC/DISTavB61okCfZumDhkdK9NAUikwfTa+9a4kNVPFhiIkh1BdYWMqh2l4HO8hahONa5K40PfGB7ZRT2o3E7we1cLcjXZsznsWH34AD9S7rNI3iOiZISiKAnbi0lOjjJXW80fGpLfC+sDFHnIc4coV3gYNVAdLtwBVFgT30uVI0JoDPp0r99T38zZg3EvWQXfaIPSzKeCI+29WTVZYBfXm/6v9Zdbdv8fdtYrlsEwy4VZ/18qe3k6g0825dWpnaTA0yCKKqBjaH2jjs= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70b70dab-b8b5-40b7-00ba-08dcb4e7021c X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2024 00:39:04.6655 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +xtTOvRolP3bWeTJIyogDPntqzmq2DaNmUwtDE2S44XiMn262FugBThct+zL5lGMNDivsk9TTMOMMmcHtm1sprVAbo549oK1Zt/ma/dob0y2HBbzzFJ3kEWohbS0+yGH X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB9459 We can use snd_pcm_is_playback/capture(). Let's use it. Signed-off-by: Kuninori Morimoto --- sound/soc/dwc/dwc-i2s.c | 20 ++++++++++---------- sound/soc/dwc/dwc-pcm.c | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c index c04466f5492e9..874d5bf2985e6 100644 --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c @@ -42,7 +42,7 @@ static inline void i2s_disable_channels(struct dw_i2s_dev *dev, u32 stream) { u32 i = 0; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(stream)) { for (i = 0; i < 4; i++) i2s_write_reg(dev->i2s_base, TER(i), 0); } else { @@ -55,7 +55,7 @@ static inline void i2s_clear_irqs(struct dw_i2s_dev *dev, u32 stream) { u32 i = 0; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(stream)) { for (i = 0; i < 4; i++) i2s_read_reg(dev->i2s_base, TOR(i)); } else { @@ -69,7 +69,7 @@ static inline void i2s_disable_irqs(struct dw_i2s_dev *dev, u32 stream, { u32 i, irq; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(stream)) { for (i = 0; i < (chan_nr / 2); i++) { irq = i2s_read_reg(dev->i2s_base, IMR(i)); i2s_write_reg(dev->i2s_base, IMR(i), irq | 0x30); @@ -87,7 +87,7 @@ static inline void i2s_enable_irqs(struct dw_i2s_dev *dev, u32 stream, { u32 i, irq; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(stream)) { for (i = 0; i < (chan_nr / 2); i++) { irq = i2s_read_reg(dev->i2s_base, IMR(i)); i2s_write_reg(dev->i2s_base, IMR(i), irq & ~0x30); @@ -156,7 +156,7 @@ static void i2s_enable_dma(struct dw_i2s_dev *dev, u32 stream) u32 dma_reg = i2s_read_reg(dev->i2s_base, I2S_DMACR); /* Enable DMA handshake for stream */ - if (stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(stream)) dma_reg |= I2S_DMAEN_TXBLOCK; else dma_reg |= I2S_DMAEN_RXBLOCK; @@ -169,7 +169,7 @@ static void i2s_disable_dma(struct dw_i2s_dev *dev, u32 stream) u32 dma_reg = i2s_read_reg(dev->i2s_base, I2S_DMACR); /* Disable DMA handshake for stream */ - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(stream)) { dma_reg &= ~I2S_DMAEN_TXBLOCK; i2s_write_reg(dev->i2s_base, I2S_RTXDMA, 1); } else { @@ -194,7 +194,7 @@ static void i2s_start(struct dw_i2s_dev *dev, i2s_write_reg(dev->i2s_base, IER, reg); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) i2s_write_reg(dev->i2s_base, ITER, 1); else i2s_write_reg(dev->i2s_base, IRER, 1); @@ -213,7 +213,7 @@ static void i2s_stop(struct dw_i2s_dev *dev, { i2s_clear_irqs(dev, substream->stream); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) i2s_write_reg(dev->i2s_base, ITER, 0); else i2s_write_reg(dev->i2s_base, IRER, 0); @@ -253,7 +253,7 @@ static void dw_i2s_config(struct dw_i2s_dev *dev, int stream) i2s_disable_channels(dev, stream); for (ch_reg = 0; ch_reg < (config->chan_nr / 2); ch_reg++) { - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(stream)) { i2s_write_reg(dev->i2s_base, TCR(ch_reg), dev->xfer_resolution); i2s_write_reg(dev->i2s_base, TFCR(ch_reg), @@ -352,7 +352,7 @@ static int dw_i2s_prepare(struct snd_pcm_substream *substream, { struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) i2s_write_reg(dev->i2s_base, TXFFR, 1); else i2s_write_reg(dev->i2s_base, RXFFR, 1); diff --git a/sound/soc/dwc/dwc-pcm.c b/sound/soc/dwc/dwc-pcm.c index a418265c030a5..673218e010607 100644 --- a/sound/soc/dwc/dwc-pcm.c +++ b/sound/soc/dwc/dwc-pcm.c @@ -200,7 +200,7 @@ static int dw_pcm_trigger(struct snd_soc_component *component, case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(substream)) { WRITE_ONCE(dev->tx_ptr, 0); rcu_assign_pointer(dev->tx_substream, substream); } else { @@ -211,7 +211,7 @@ static int dw_pcm_trigger(struct snd_soc_component *component, case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) rcu_assign_pointer(dev->tx_substream, NULL); else rcu_assign_pointer(dev->rx_substream, NULL); @@ -231,7 +231,7 @@ static snd_pcm_uframes_t dw_pcm_pointer(struct snd_soc_component *component, struct dw_i2s_dev *dev = runtime->private_data; snd_pcm_uframes_t pos; - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) pos = READ_ONCE(dev->tx_ptr); else pos = READ_ONCE(dev->rx_ptr);