Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3115937ybl; Mon, 19 Aug 2019 12:28:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8LcxecWsGZ0GHzHvZtz26IRglVjfmg1zN6fYscJvr7TiU0/9M7CRgl+1Jcq5nN4GoTB5g X-Received: by 2002:a17:902:8b8a:: with SMTP id ay10mr9183737plb.305.1566242917877; Mon, 19 Aug 2019 12:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566242917; cv=none; d=google.com; s=arc-20160816; b=VWw+dk3fSZvoKwdz+hHIcKJJ2UwImgVdd7AhPwas5+YCGVnVeGA6A8umSFfdMMyWMn Sz1ioF3ETwVU5HVX9FN5w1gVHAOBTbgZzn3qn9pPesJObaHKFCY1siABFV+Q7WJkoCnB i1w7xZEQrKDdeV4r+HXDiOzFtxp6++ZTAYX25YqI9fwZ20LVvCjJlH1wkxUNk0VDHM1J 7T3HLCzSbN9a7Zq2Bz84gEBn2R/dXAfrTNYRI1WlP7yMPdviulH/xkKxBCgon4i2G1NH zwxuLrsqoD4V5OO9OBlao2+bfH1cyQqsemtIvwqOM23d13bocM1xilQQlrqD4TbAqd48 SHNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FDRjD/e9drfONx43qV4TcEpltB9hhz8MEIEtzd/tAIk=; b=V1NsEQj8d4fAkxS/qsTu29RQa20ersJKt10PQB3DzSlMD4F7/0fsKqabiaxRtGs8KX mfbRCnlk/u5GnxOXriKgedKOnDPglOIbtKoJnJ3pbyA1egrHu7Ba3Xz8FiDx5Lb2hW9Y vvZNMR8+Hsbd39WfPtI/KNnMIKkNcdAFEhpQoE9NwjcdNgYQXGhVYbEvft9ISpiqibfX 5PC5shOY82JIdu4ZpYOkc+zIEtYfI7ucbMjVgKDht2glKPQ6gPHk579+g+j7D2mW7mHj h2CEgnWkLbRtcvu8pQvWqVQmuS/agl2VFLIG1gqHpqy1Zbed0v69MmezsipxyskUiRn9 Qb6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U0okEGtF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x26si11104417pfn.78.2019.08.19.12.28.23; Mon, 19 Aug 2019 12:28:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U0okEGtF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728786AbfHST0e (ORCPT + 99 others); Mon, 19 Aug 2019 15:26:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:42498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728764AbfHST0a (ORCPT ); Mon, 19 Aug 2019 15:26:30 -0400 Received: from localhost (lfbn-1-10718-76.w90-89.abo.wanadoo.fr [90.89.68.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CF44422CEC; Mon, 19 Aug 2019 19:26:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566242789; bh=ymigtzJxDzs6w2lYCkBBjjo8T8VlyeDsLvih9ONSq0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U0okEGtFQwjlX7U1MXSTG746Qc8KNHUPK39wSVFPinZ3XhYJgpFLKTLiSpqdc7htN jblgOU4qZSeqvvxu4rHG6VdivnWnQvg2oR+Lr+VoWdCAX8VXlUrl5w2I5vBF0h9x7/ CffkLNgcHwGDYZO7dO416TPSZBS0zqpE/v0U7xUY= From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , lgirdwood@gmail.com, broonie@kernel.org Cc: alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, codekipper@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH 19/21] ASoC: sun4i-i2s: Support more channels Date: Mon, 19 Aug 2019 21:25:26 +0200 Message-Id: <27d9de5cd56f3a544851b8cd8af08bf836d19637.1566242458.git-series.maxime.ripard@bootlin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxime Ripard We've been limited to 2 channels in the driver while the controller supports from 1 to 8 channels, in both capture and playback. let's remove the hardcoded checks and numbers, and extend the range of channel numbers we can use. Signed-off-by: Maxime Ripard --- sound/soc/sunxi/sun4i-i2s.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 905e9bd16024..0dac09814b65 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -400,9 +400,6 @@ static int sun4i_i2s_set_chan_cfg(const struct sun4i_i2s *i2s, { unsigned int channels = params_channels(params); - if (channels != 2) - return -EINVAL; - /* Map the channels for playback and capture */ regmap_write(i2s->regmap, SUN4I_I2S_TX_CHAN_MAP_REG, 0x76543210); regmap_write(i2s->regmap, SUN4I_I2S_RX_CHAN_MAP_REG, 0x00003210); @@ -423,9 +420,6 @@ static int sun8i_i2s_set_chan_cfg(const struct sun4i_i2s *i2s, { unsigned int channels = params_channels(params); - if (channels != 2) - return -EINVAL; - /* Map the channels for playback and capture */ regmap_write(i2s->regmap, SUN8I_I2S_TX_CHAN_MAP_REG, 0x76543210); regmap_write(i2s->regmap, SUN8I_I2S_RX_CHAN_MAP_REG, 0x76543210); @@ -458,6 +452,7 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct sun4i_i2s *i2s = snd_soc_dai_get_drvdata(dai); + unsigned int channels = params_channels(params); int ret, sr, wss; u32 width; @@ -490,7 +485,7 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream, regmap_field_write(i2s->field_fmt_sr, sr); return sun4i_i2s_set_clk_rate(dai, params_rate(params), - 2, params_width(params)); + channels, params_width(params)); } static int sun4i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, @@ -814,15 +809,15 @@ static struct snd_soc_dai_driver sun4i_i2s_dai = { .probe = sun4i_i2s_dai_probe, .capture = { .stream_name = "Capture", - .channels_min = 2, - .channels_max = 2, + .channels_min = 1, + .channels_max = 8, .rates = SNDRV_PCM_RATE_8000_192000, .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .playback = { .stream_name = "Playback", - .channels_min = 2, - .channels_max = 2, + .channels_min = 1, + .channels_max = 8, .rates = SNDRV_PCM_RATE_8000_192000, .formats = SNDRV_PCM_FMTBIT_S16_LE, }, -- git-series 0.9.1