From patchwork Thu May 18 05:46:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 684531 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 DD69FC77B7D for ; Thu, 18 May 2023 05:48:26 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7D4E21FC; Thu, 18 May 2023 07:47:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7D4E21FC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1684388904; bh=XiBwgNldqNfPXA1xUaru4ezMKp6IHuzuXw7nG18iKYw=; h=From:To:Cc:In-Reply-To:References:Subject:Date:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=B7mRTqWNOBtVaLciLnKNTwB4JzX1kVmdf/DsUeWAhFfRrmBC+eZsWPex8dfB50EaE lpDLQe7Iz2iT+jqjn3oXclq9FF7mX0cGJDi1SIGMof0CgwDbpkPHk2rq8B9xs588F1 SQP0O/UrWq9wLzqiZ9YSzTOHRTENgyvlEXzpy5lU= Received: by alsa1.perex.cz (Postfix, from userid 50401) id DC774F80563; Thu, 18 May 2023 07:46:55 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 8DADFF80553; Thu, 18 May 2023 07:46:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A6456F80553; Thu, 18 May 2023 07:46:51 +0200 (CEST) Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2071c.outbound.protection.outlook.com [IPv6:2a01:111:f403:700c::71c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6CA31F8016A for ; Thu, 18 May 2023 07:46:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6CA31F8016A Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=renesas.com header.i=@renesas.com header.a=rsa-sha256 header.s=selector1 header.b=nl0zKJaR ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N36CJx1AsDM7rDo2Uo3ps4rTTGGsUH4iB2vrtfmXbXfNFqsAMWkg06mmvloAm+q/pEJT+894Ci009E/Kx4cBsn5KAv00nb8FMRdG3PtMy/P3/1vISwoxG3QUyh+U7/CxuEn6PCNVf8uTDlLQcktKfgX+mhWZXYfLMTgkEDgnK3bc4kk28F58aH25ufFBTC9qmu4YfNbMtQKWRdVh8DKWb88f4ZCOMpXhiK8SvPzai/2WBmUvtP2I2NIqFXKi6yjz/zZv27/i0XdGDyqeQ6BGqaqFf3dGLge+Q5vZnhXO721j6NKg60dykIQfMVR9RqPkX22LhybjMJrqWI+G9gNPNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Q0yb6mqpLZyX1In82m/+o8LwaAmRuegmgEgVyvbsKso=; b=LUTl8/41ejLsNVRTU/wA5u5uXG4r+VxY4RxssFdjyIIa3lXJqOMXwYjc0UHR1ArECWONnFBwSSwodhtAgXsZm2WOtaOqV9/ElpHe0IQrikPSedCi3EHhOlLRjY/UrMZAtzeo0KWCCiKVBJRa5y0D3BRlPUFxxdfG5hKABl9cc7Rhb2Dt92FhHhVK4qrQ0edXrGmZSZoXZKsjyTlUcqJMJ7BCX/fmSBKzNMM0jBJDVnvQ1Bp4yNZ07ITskNs4LqMnf3cfHQYrLrl4PSkmGWBQqSqLQFocwVfwk6/Llx6s8lwe64CkSSrD0yQQ3KDQgLLxk1EOp6IQhLOcbcgDgQ36Lw== 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=Q0yb6mqpLZyX1In82m/+o8LwaAmRuegmgEgVyvbsKso=; b=nl0zKJaR1/sEf40X6n+e8uDyMaWumFxzQ0E/057L1CZg19xZNsPsgt2kCbF0zLlS+3CPgDlX4oQ302yhxei93ji3LH3twEjlpcz8w5om0FOdxhtMMRnQlkd0agHYHNeAJWqQgCNZxc/RG1XicWMVzP5tf6RiEjmgsxbgSVqmJC4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) by TYWPR01MB10472.jpnprd01.prod.outlook.com (2603:1096:400:2f8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.18; Thu, 18 May 2023 05:46:41 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::91e7:a94f:9f75:d840]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::91e7:a94f:9f75:d840%6]) with mapi id 15.20.6411.018; Thu, 18 May 2023 05:46:41 +0000 Message-ID: <871qjeqji7.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Jaroslav Kysela , Liam Girdwood , Mark Brown , Takashi Iwai Cc: alsa-devel@alsa-project.org In-Reply-To: <87353uqjiu.wl-kuninori.morimoto.gx@renesas.com> References: <87353uqjiu.wl-kuninori.morimoto.gx@renesas.com> Subject: [PATCH 01/20] ASoC: soc-pcm.c: indicate error if stream has no playback no capture User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 Date: Thu, 18 May 2023 05:46:41 +0000 X-ClientProxiedBy: TY2PR06CA0029.apcprd06.prod.outlook.com (2603:1096:404:2e::17) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|TYWPR01MB10472:EE_ X-MS-Office365-Filtering-Correlation-Id: 80cdfc7c-9677-4550-8484-08db57634165 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /he/Pw5G4wzBBbnv8nYZzYNC8rwualGL89fBGrl0ijbzeiNnJ0pQ3fRqb8IiF2DONVJz9RGwIhw+Q7DwJ0Vssq/JnwgxdP6y8j4sp895bR/9Pnz7Nuy97q59rAaQ0BDwL8SJ9LnGmkUZcFEGzix359rK0iKB55/Fblfpv/jnhybyoGQPnljlKoJL2wUveIC8JiMQSQWyYQJ4HQYpJtznm9wWvn6tAkc3njNqq1gG5gvxsm4AJ4EDWTLF4zkWSZJH/E62VdpNIS0WU8mYrx2P0Q1CmSmA2KYH8/+TPIyGJKiWNYYCrWMdZgRMZmnjZj8zHa+/oxw7yZTksa1mpBSYTBfBaUMwADKvsvjzCnCykwxmiWiPY0m74PkVi5VshULXzrlhvEfrDv4987n1Lp7E2OwgkfwHYrAzxYChEcyPIHf0Vp+VMuRyngPGW6SMZouLgeL1LoqfepLJAg1c66ukkTCFhb8yY8HWF6UH095M8XMyhXrmlAlPTwHRhM7POtX3VwsmQ4V1EY/+qhiw5i68l3RQ36t6iGoT/LFcf0oYW99y+nUxnMEQh783cWswuVIZYcpu5z2hF0J7NclJmi8/t/5MjyedoH8uhUjRB8jb7/GHnQgxV5+8+CN9fNKxvl+b X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:OS3PR01MB8426.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(346002)(396003)(136003)(39860400002)(366004)(451199021)(6486002)(52116002)(110136005)(66556008)(316002)(66476007)(4326008)(66946007)(478600001)(2616005)(36756003)(6506007)(26005)(186003)(6512007)(5660300002)(8676002)(8936002)(41300700001)(2906002)(38350700002)(38100700002)(86362001)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: u9Fuj/4YnnbQU9+rS73ois+qzfq3N+e+V5+Xjf9KFhrG1knWbua9KBo4Mo6DxSlie8JsJpcCvWmDkuvLMZnXMXeMgyGdq1ltOkBlMMYSUfPd8i6SeRblJfNGu5gJsNG76RFKhVi16mmekN+ZFiKF6fdUWV2c+ioFpOaiusf9t2aJwKSQHyjP/jKmd4mnT1U3nnozhJwD2iF9/Mjod5PgivflPpEtTLIBgzJHeMVdr5oZFzGAdC5u0CKrgrEQ9Wy1a4yxISxGNsM3oDT+vHYgzkIoZgNB6oOyhQUgGcf+A2v7skUSC+E+kBCt/1UyC6zbS47XS0mpkGB92dgN5IPtF2R1I35YZ820A85FodQAA2RL/bFvmRGbLZf2QmhBwbFwWWok4YVRXgFs+SLq0HEqgIDA5Bk0rmsta2BJH4TxkYkucxJugURsGpwWCI3DLGFKiIXIcr7RuwPNdfhQAApZXF5HOTQtVJyu/CocLd/gpwTs/Ef2xX3wR05vSqRHP4ptR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R1mftWXqiqfVKYIkAHlfkP+kejRlGwUaqLbw4xFvfarFhQ= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80cdfc7c-9677-4550-8484-08db57634165 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2023 05:46:41.4945 (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: NUvHwp/d8UGtHHdSQ3k2OYn+OvoLr8HiFJmdd1+1WX8sRz6l+TTgnlWQOz35Mo71sIDQ/6D6cskVfFsd4I1aPP87C0Q2golfdGCsFz9MzA68C91T+5OL5+PnAWFOGRP2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB10472 Message-ID-Hash: 4NDCAUEXV45YJ5463S63QUDOWR75M76K X-Message-ID-Hash: 4NDCAUEXV45YJ5463S63QUDOWR75M76K X-MailFrom: kuninori.morimoto.gx@renesas.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: soc_get_playback_capture() (A) returns number of substreams for playback/capture (B). ASoC will probe the Sound Card and mapps CPU<->Codec pair. (A) static int soc_get_playback_capture(..., (B) int *playback, int *capture) { ... if (rtd->dai_link->playback_only) { *playback = 1; *capture = 0; } if (rtd->dai_link->capture_only) { *playback = 0; *capture = 1; } (C) return 0; } But it might be no playback no capture if it returns playback=0, capture=0. It is very difficult to notice about it. This patch indicates error at (C) then. Signed-off-by: Kuninori Morimoto --- sound/soc/soc-pcm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 7247f44faa1c..fe65994485f8 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2815,6 +2815,13 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, *capture = 1; } + if (!*playback && !*capture) { + dev_err(rtd->dev, "substream %s has no playback, no capture\n", + rtd->dai_link->stream_name); + + return -EINVAL; + } + return 0; }