From patchwork Mon Aug 5 00:35:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13752832 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010029.outbound.protection.outlook.com [52.101.229.29]) (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 4C09F746E for ; Mon, 5 Aug 2024 00:35:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.29 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722818143; cv=fail; b=birVLt9NbKH0GacjgU16QbwNilaOKBaDzJzUxXLEPfoi0pzkgnOaGBJ+EHJG6y1CkrMvj6dAkc9UzdX5ScKhbI9lyrt/sp7K2pBBaRw+hv+2I2y/q/veP+klqqw3FGiR46+P5dTVuYiyspgHeWfxBz8rJ+R6LAG6nhwNGz4UqKI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722818143; c=relaxed/simple; bh=E62+TX6G4XfDRmg37BFmjd1R2msZXwoXLs7ZjLQXKEs=; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type: Date:MIME-Version; b=OC33t1R6Hwbb4UoZ9ZKGMnM3TuJ6jw7AHnuy9F5TeiXxr1iL26afOe4fmwJkqaHp+NBRXv5W/HTZ8CReNJOgzx4mM5ZW/6ilYa6SocaABACdg3gUmVpjbBaR7ekSoyGPVZIRyaIlZx3YNZNQQNc5KbAVmzz+h+e1wvkwHD4S4Yw= 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=FzOjOaEI; arc=fail smtp.client-ip=52.101.229.29 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="FzOjOaEI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=w8UUIV2DETiUQqytPYVB8h1+t7fNQCo9ai51eZjfIl1ggmrkv9ilIwqBifcAi2aunnFA11ZyfG5TNrFF73UaJLK/HpYjpaKuJtDAcadYZ/MjCSFiIiCujrJR4XQ1ca4/WUqT1vP5PFGFGpbyTXFsxLGeithaIrwyamxzzOyEkh66kKKlBhn5aH+ErniyxgkZtYvz/OuZqVOgeQja6qnYNnNQKcJT9gD8eV8YQxzUQ7BQLLnGt8Z9YrIoQLq4wvZliNnkot7NB3EMPX0dMGZt/G47LlAHggvKFaIfgCI9hiRlJCr59eB27yP02nTMC/apIPeHw6wRixSLdwfRUR1L4g== 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=X6E7hugC9TJp4HKlVqIg//X4XKAVcOkqxHfcKFYvU4I=; b=IyuQNujUcAJZGjzS8KZzdHiv8NSOAkNixgCxUhf2iee5pOSdVPK/rx+vs7ea9XDZXJQxK47tqisDqp4+NY3yaejv0o4OMDhhnId8UEry1KCuyBfUrzn5B8q9cAwKkZGcIZ1dA6zDj8tSi707u86ncSnHV33pC5H7PsokJ69ZpsUXRAYxttBK51AKaqkmX6og5LzxAVoDlANkgyXxpXPEn9IlM9TDNclju1mfTbfcxqYElthHOb5QyxfRx3IxIKnDYV6gevcjrM+DD6C0E32urT+hb18D2iUtIg1S/1A2vdBKXL64o3rx06lcQb1O4ZFCy8T60jz5j2GjIhUxn//a6A== 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=X6E7hugC9TJp4HKlVqIg//X4XKAVcOkqxHfcKFYvU4I=; b=FzOjOaEIq2b0Ec7HcB/UoixT8IB7izO5CD4BppuE3IbRdhNT6ELGV5AQg2yWYot3/wCaHusCou3LLWjpCTqFq6S4MA2pJWMogBVYaIg72dihABpH8Q4HCOdnVraAleFFIojwOVECkSCjjNdKpUqtIzm+0VzFLKXihRDAW0fgvKg= 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 OS3PR01MB7994.jpnprd01.prod.outlook.com (2603:1096:604:163::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:35:39 +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:35:39 +0000 Message-ID: <87jzgv24dh.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 014/113] ALSA: pci: hda: 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:35:38 +0000 X-ClientProxiedBy: TYCP286CA0013.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::20) 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_|OS3PR01MB7994:EE_ X-MS-Office365-Filtering-Correlation-Id: bdc2056f-5988-4ff5-0c41-08dcb4e68798 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: 9KrPppJpNjuJ/dXzrNTLygcewmfoIvcl2n8M9tqhAULi6iy/gzd6lFxs7PEWsCUbOjR5GaMx/zrwOHLJwGloxQOcxGS4ywHiD9VxproT8eYoxlDPRFJzJMtNl6ORBumpRQ3FxvOpjaL4HMDbr7yu/SLMbMyvF2i8Y6AcOs0PIzDoqsgKRbCOckXJAP9519WrtQZe2+JbmQ1tBpeXoS/rVPW2m4hw7jK4hsgkEbgfT7woe4W585CPRYQeUnqyVJbVQbL2u4tdji170dT906FSW52G10tGs71dJgX7BqfeBAc8Mr2iLyLFc3S+2A0PHvt5Jbr3t3MHa8bYCxwUopcRJPdY3ikLO5X3y3RCLSD/y+xF6fK6EuFPLrLgBrDkVVvJDeC7Wt18k6rHrlJiKCVbWWqmnFZaTY49gh1U8nVsIjLtDp6eVXbg11RXHrHkpdludgC/R3bC+hHxyUka/MUMO1mi3C5yRrc3lElnU0zFKhlZ0AFOudzKC2HiCYafcGafAmcRlrIURr7uv56LdEfNhYGUN7ft6iw9o1J+bxBHAVFeazvmfOyVwPO2VnuetYl67dk9QLsG0MLQXjUIA5iW4s+G5gjuMptyvNHs83oO+iRjDx2v6GmAGJNu5SyQpw68mGk/tAxnlt0KhW1/V9BiGq96wDFCbTdPGTMuzJ6Xlq7I9PpYIz09jsqxTAzodrBvyfI461vkptHH8ooLdY/4H19rMwVLsFAbUys0DjQEDcBY6FPqJAcmoXN8Un2KmX6qdKlTvfD7K/F1wDkTpvn9l1+IxbzsCfrQ/ggNgcDdkULARcsp+Pf+zRW8VUhOqDbaWRnPFIH0O7XAUZW1NtVp5H+dLgWsQsgcr8XEJEVgVZ8YBOKkEO8VgkRFklP7Na6/tSugYK53Npi6ISwRDlKcN915ZEc3oOR3XzZiGjqZfTUHonLHOlruwRvpirefFITjIZrO6q4gV/j/sJn4GCWZLr0ZZi+zKIMbBK1hI09N18MFjzmklSUW7vj7VyzQqVNIDTrOR9oeKhI8cPPrIETv/lZBpPdcO9byppxyUg2Arki05R8QoAknhhbNO5ucE4w0qGR9FO+xVspELuz6+pfp4WT4E9GnsZSw9p6I1pI+eXQmBbi2vZhff3X6BKROarzjmbqNVAM14w1B2YQItVTpY4cwizv8NlqG6gkIxXLae0qk1iHbqnbXMa/Z2ljt5OGKQTZAFsV7pfzFDX3dtuhMpLfniZT75cd3kaMtAxtKx6A1QVtIx/szJbZGm1F1xPhKMtuc3vkyFbpbrtAcdum5kitWors0T6v82YbwoYsSfDAV4jyOp44NHoF7T8IJzaaNuWo4D9q58mDVoZWPubc+8ZiqarWoxhoDwAQSldcnrsvZQI3MRsBwlVGOxkwxUsKHjomciim7PN5A2VX0LOhbSA== 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: vzZYyO9E/7F4tt3jBSt+0EHgd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VO2U80gHhaU7P/8BWLVhlA3+HxpIh/6GDlsiJzBPygkGLwDOWdUrFqGKmpxnHER+5yN7tAyKQ+z1xYds3YPj1Ix6S+1VhhB3lnUHasqOy5TDBQEcpW7ijfgJVI9hxWFKR7UGUypHefMobhrH3llUtrez1sLrpylMhKUFY42AmBqDhKDQEq1J+G1Dv19ipLfgYWsSP8ubXVy3JXDrgYcPbgXAWgKEAycK0ERRlRe0q/R9ciQyCb/oG4x8T92KH2AAJ9ojO986eGlVkbTygkGPDxm729R0hsXWOrjtejCYxEC6Q+hQgeyZ11HTIbyxGjKpPo0C0mr0VnGl2EaWH+ZzRTE+83h9IXewhIiN7taAzbMLkgBwoXmcoS+6Pn2bWQBKLT5FltyyVt2DxVpgCw8YICCag01Rtniy5WCfVRVN7fQ53Ij+wVhFtz/3lu3njONAn5/0hG2kE4E2/RZc/oNOSXVUJXY9buiSo3fywroieC3hsIEUng/Sq6OijZfdR6dm6DpIvnlFHARc7vivnbARrp3XKq8Lr075/478= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: bdc2056f-5988-4ff5-0c41-08dcb4e68798 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:35:39.0810 (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: /grWJbpRfTIk0CF0pdgtcwXSFFvbC5wJZT/jrmmuh6mx4zSIc7CjpOpbKNe6/uvS8Qx8TUDz6PIqDfvYCOsZks/0tn4opIs0aa8fMphJWT3Arz5MDXSNzrCYOpJl6Vj2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7994 We can use snd_pcm_is_playback/capture(). Let's use it. Signed-off-by: Kuninori Morimoto --- sound/pci/hda/hda_controller.c | 6 +++--- sound/pci/hda/hda_intel.c | 6 +++--- sound/pci/hda/patch_si3054.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 5d86e5a9c814a..9efa43afd0c16 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -75,7 +75,7 @@ static u64 azx_adjust_codec_delay(struct snd_pcm_substream *substream, codec_nsecs = div_u64(codec_frames * 1000000000LL, substream->runtime->rate); - if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + if (snd_pcm_is_capture(substream)) return nsec + codec_nsecs; return (nsec > codec_nsecs) ? nsec - codec_nsecs : 0; @@ -385,7 +385,7 @@ static int azx_get_sync_time(ktime_t *device, runtime = substream->runtime; - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) direction = 1; else direction = 0; @@ -659,7 +659,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) /* disable LINK_ATIME timestamps for capture streams until we figure out how to handle digital inputs */ - if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { + if (snd_pcm_is_capture(substream)) { runtime->hw.info &= ~SNDRV_PCM_INFO_HAS_WALL_CLOCK; /* legacy */ runtime->hw.info &= ~SNDRV_PCM_INFO_HAS_LINK_ATIME; } diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index b79020adce63b..c9552b71c0e9d 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -583,7 +583,7 @@ static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev, unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev); int delay; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(stream)) delay = pos - lpib_pos; else delay = lpib_pos - pos; @@ -800,7 +800,7 @@ static unsigned int azx_via_get_position(struct azx *chip, unsigned int fifo_size; link_pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev)); - if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(azx_dev->core.substream)) { /* Playback, no problem using link position */ return link_pos; } @@ -869,7 +869,7 @@ static unsigned int azx_get_pos_fifo(struct azx *chip, struct azx_dev *azx_dev) } /* correct the DMA position for capture stream */ - if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { + if (snd_pcm_is_capture(substream)) { if (pos < delay) pos += azx_dev->core.bufsize; pos -= delay; diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c index 763eae80a148e..9f13732a89064 100644 --- a/sound/pci/hda/patch_si3054.c +++ b/sound/pci/hda/patch_si3054.c @@ -142,8 +142,8 @@ static int si3054_pcm_prepare(struct hda_pcm_stream *hinfo, SET_REG(codec, SI3054_LINE_RATE, substream->runtime->rate); val = GET_REG(codec, SI3054_LINE_LEVEL); - val &= 0xff << (8 * (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)); - val |= ((stream_tag & 0xf) << 4) << (8 * (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); + val &= 0xff << (8 * (!snd_pcm_is_playback(substream))); + val |= ((stream_tag & 0xf) << 4) << (8 * (snd_pcm_is_playback(substream))); SET_REG(codec, SI3054_LINE_LEVEL, val); snd_hda_codec_setup_stream(codec, hinfo->nid,