From patchwork Thu Nov 8 07:29:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 10673653 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D326C14D6 for ; Thu, 8 Nov 2018 07:29:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B94EB2D1BF for ; Thu, 8 Nov 2018 07:29:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADA602D20F; Thu, 8 Nov 2018 07:29:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 492582D1BF for ; Thu, 8 Nov 2018 07:29:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726145AbeKHRDO (ORCPT ); Thu, 8 Nov 2018 12:03:14 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:50216 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbeKHRDO (ORCPT ); Thu, 8 Nov 2018 12:03:14 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id wA87SpEb091514; Thu, 8 Nov 2018 01:28:51 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1541662131; bh=lcBVe7aDqBvsiEQJVPyP0CMGqOCD9YkcdmP1hdYIfJ4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=QLANWfxvOOupIfFuO4PxZ0yvuXweheSQIsLq9UB5OHV6dOssagwVwh4B3mTXEaDfZ DseI1HKuuO2kFEnx1Ay+c04MFbpxdBZCl44KbZhMenbHtHFx4Xt/2wODpkubLafqlg ezGc/G01Cr0dsn1Ejac+uq/zbgo8e0HPVRQhN6VU= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wA87SpTx037322 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Nov 2018 01:28:51 -0600 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Thu, 8 Nov 2018 01:28:51 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Thu, 8 Nov 2018 01:28:51 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id wA87SfHx020264; Thu, 8 Nov 2018 01:28:49 -0600 From: Peter Ujfalusi To: Mark Brown , Liam Girdwood , CC: , Subject: [PATCH v3 4/8] ASoC: omap-mcbsp: Simplify the mcbsp_start/_stop function parameters Date: Thu, 8 Nov 2018 09:29:56 +0200 Message-ID: <20181108073000.21114-5-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108073000.21114-1-peter.ujfalusi@ti.com> References: <20181108073000.21114-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We either start/stop TX or RX, never both. Move the tx/rx direction selection within the functions. Signed-off-by: Peter Ujfalusi Acked-by: Jarkko Nikula --- sound/soc/omap/mcbsp.c | 8 ++++++-- sound/soc/omap/mcbsp.h | 4 ++-- sound/soc/omap/omap-mcbsp.c | 9 ++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c index fca0b0e9186b..7ff22561f00f 100644 --- a/sound/soc/omap/mcbsp.c +++ b/sound/soc/omap/mcbsp.c @@ -637,8 +637,10 @@ void omap_mcbsp_free(struct omap_mcbsp *mcbsp) * If no transmitter or receiver is active prior calling, then sample-rate * generator and frame sync are started. */ -void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int tx, int rx) +void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int stream) { + int tx = (stream == SNDRV_PCM_STREAM_PLAYBACK); + int rx = !tx; int enable_srg = 0; u16 w; @@ -694,8 +696,10 @@ void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int tx, int rx) omap_mcbsp_dump_reg(mcbsp); } -void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int tx, int rx) +void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int stream) { + int tx = (stream == SNDRV_PCM_STREAM_PLAYBACK); + int rx = !tx; int idle; u16 w; diff --git a/sound/soc/omap/mcbsp.h b/sound/soc/omap/mcbsp.h index 46ae1269a698..92472c6ef358 100644 --- a/sound/soc/omap/mcbsp.h +++ b/sound/soc/omap/mcbsp.h @@ -339,8 +339,8 @@ u16 omap_mcbsp_get_rx_delay(struct omap_mcbsp *mcbsp); int omap_mcbsp_get_dma_op_mode(struct omap_mcbsp *mcbsp); int omap_mcbsp_request(struct omap_mcbsp *mcbsp); void omap_mcbsp_free(struct omap_mcbsp *mcbsp); -void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int tx, int rx); -void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int tx, int rx); +void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int stream); +void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int stream); /* McBSP functional clock source changing function */ int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id); diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index caa24c463b3e..a18b7ecc3a2e 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -201,27 +201,26 @@ static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *cpu_dai) { struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); - int err = 0, play = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: mcbsp->active++; - omap_mcbsp_start(mcbsp, play, !play); + omap_mcbsp_start(mcbsp, substream->stream); break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - omap_mcbsp_stop(mcbsp, play, !play); + omap_mcbsp_stop(mcbsp, substream->stream); mcbsp->active--; break; default: - err = -EINVAL; + return -EINVAL; } - return err; + return 0; } static snd_pcm_sframes_t omap_mcbsp_dai_delay(