Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1516490ybt; Thu, 2 Jul 2020 07:25:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy1PGODQ0FWn7q/e6Z1C00SbYl8bUqi9gZFMVId/BDWTKXtpTnjIgoPO+PXchH5SzQ8vEc X-Received: by 2002:a05:6402:1ac4:: with SMTP id ba4mr33699546edb.60.1593699943209; Thu, 02 Jul 2020 07:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593699943; cv=none; d=google.com; s=arc-20160816; b=s/5Mbj1mkZlUURiqmhGWsp3FVvvQ+YVM/x4jFagOFvaqH5p4WPAm93/B62rj6TaMD9 egR6ggFnwHV9y0B38u/WpxpD8zhGH+YBjheUzVMgwuKz/h2Gu0PBIwa715bmHcSN3N1b 4byJAJ8MnooS04MeltS5Z1ksseSGFomP1RugR2CMFS5z31gXFsIt2ZSbrkVdJF7ti9jW A/xSBpzy6KNr5PpG7S+OpoZ4GU5di5hGCXcDipf/V0q+mEv/4r3ooSZ/0DIIaFgLCeJh ETCaqNlwy96P+TxdFr46JEqUl9GOcZjArfGukJW40E+bHsSsuRyyG1koW4+8ShRiZGnf In+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from; bh=DbkN7tWFu3fRJhj335+JbQgBiCt7t3h6B9q68ZvV77Y=; b=u+5NboWF4pe90OPT+RIwE5RSP4nYUDPscfuTwhvRVoFnVvNgJZjeVUsPPmCRFglfRi IJHXaRR1j7WOcmRWOY+3fjK7KFmO4SD5AYEk7RS6qA4DFfPnojgzND/DLjgMutjuWZZs E5Mi3H85FpQoYYI2Pl5YgJVxlqRyOJoMRyWqnFKhA2rhCfjhb/ZNXxy1/M8a1rxs7b+z BG15udWVs5o+6q0pBIqhJcOkU6zvGgYH21X9S2LvE4QtACEhDTDJJtwV8n9uCp3dZd09 +epviOhEsQkKHzZAjS8LnoEnslPbbTcSz9c0yaEosMPFi6H3Whv2TQK8uL1+2qA+z4/j RE/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b21si6122871eds.107.2020.07.02.07.25.20; Thu, 02 Jul 2020 07:25:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729836AbgGBOXK (ORCPT + 99 others); Thu, 2 Jul 2020 10:23:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729399AbgGBOXI (ORCPT ); Thu, 2 Jul 2020 10:23:08 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF82DC08C5C1; Thu, 2 Jul 2020 07:23:08 -0700 (PDT) Received: from xps.home (unknown [IPv6:2a01:e35:2fb5:1510:315a:ecf0:6250:a3ed]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: aferraris) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 3489A2A5C36; Thu, 2 Jul 2020 15:23:07 +0100 (BST) From: Arnaud Ferraris Cc: kernel@collabora.com, Arnaud Ferraris , Liam Girdwood , Mark Brown , Rob Herring , Timur Tabi , Nicolin Chen , Xiubo Li , Fabio Estevam , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/4] ASoC: fsl_asrc: allow using arbitrary input and output clocks Date: Thu, 2 Jul 2020 16:22:33 +0200 Message-Id: <20200702142235.235869-3-arnaud.ferraris@collabora.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200702142235.235869-1-arnaud.ferraris@collabora.com> References: <20200702142235.235869-1-arnaud.ferraris@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fsl_asrc currently uses hardcoded input and output clocks, preventing its use for anything other than S/PDIF output. This patch adds the ability to select any clock as input or output (by using new DT properties), making it possible to use this peripheral in a more advanced way. Signed-off-by: Arnaud Ferraris --- sound/soc/fsl/fsl_asrc.c | 18 ++++++++++++++++-- sound/soc/fsl/fsl_asrc_common.h | 3 +++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 95f6a9617b0b..75df220e4b51 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -605,8 +605,8 @@ static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream, config.pair = pair->index; config.channel_num = channels; - config.inclk = INCLK_NONE; - config.outclk = OUTCLK_ASRCK1_CLK; + config.inclk = asrc->inclk; + config.outclk = asrc->outclk; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { config.input_format = params_format(params); @@ -1067,6 +1067,20 @@ static int fsl_asrc_probe(struct platform_device *pdev) asrc->channel_avail = 10; + ret = of_property_read_u32(np, "fsl,asrc-input-clock", + &asrc->inclk); + if (ret) { + dev_info(&pdev->dev, "no input clock specified, using none\n"); + asrc->inclk = INCLK_NONE; + } + + ret = of_property_read_u32(np, "fsl,asrc-output-clock", + &asrc->outclk); + if (ret) { + dev_info(&pdev->dev, "no output clock specified, using default\n"); + asrc->outclk = OUTCLK_ASRCK1_CLK; + } + ret = of_property_read_u32(np, "fsl,asrc-rate", &asrc->asrc_rate); if (ret) { diff --git a/sound/soc/fsl/fsl_asrc_common.h b/sound/soc/fsl/fsl_asrc_common.h index 7e1c13ca37f1..1468878fbaca 100644 --- a/sound/soc/fsl/fsl_asrc_common.h +++ b/sound/soc/fsl/fsl_asrc_common.h @@ -89,6 +89,9 @@ struct fsl_asrc { struct fsl_asrc_pair *pair[PAIR_CTX_NUM]; unsigned int channel_avail; + enum asrc_inclk inclk; + enum asrc_outclk outclk; + int asrc_rate; snd_pcm_format_t asrc_format; bool use_edma; -- 2.27.0