Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7167252ybp; Wed, 16 Oct 2019 04:56:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNdym6yfifWVkDge/XvhuGoXm1ShMUFwZNofFXCGv04xYaqZG+aWH0hsEUs9BdGWOLBmzJ X-Received: by 2002:a17:906:6a54:: with SMTP id n20mr39761728ejs.30.1571226976778; Wed, 16 Oct 2019 04:56:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571226976; cv=none; d=google.com; s=arc-20160816; b=I7P/nmejK3089YAKRA1vyMTb18Lij3NXqbQR1ifwK4efL8mwPNt60YhrYpPO56Z0/v 1Hi8HgiuhdfH8BR8RDBRd4QpVJuIupHtFxC/wJdlqDeTCxQ3W57exnpKkE3CivQzZ0zf vgEHqislcjttn4h/vqL6KEFX0FmVwanCnucnRZxeexg/AUMStXXfh8FaKbrfmSeKzwex CBRJgCtiVraFnbWK8BSVUsgVabUtiaUoGTLXM9F2jdQpEaQ8Uu7acTRJdIFWqw53YPoK NMkWegjkPoDsv7jNwaup2uHlqoA4p0Sq3AduD1sD0crH3jXBK9h6Dg2V2Wi+cuIrH6nK 4+MA== 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=kDtdILcfLHoVejEtGgLfvnr1m900cxUvF44JNpWqBWQ=; b=g1vJRGqj2caJZfgf2fNese0kcxISLti7LwddBvwszQhOCFCtyCNr+qbccglvMsOsf9 NwDpo1W1XLAau3qMgFTHR3APmAO9ZfWnfxCEDUf5flPgCUYialCRen68Au2xC4imzRtT subF+41stPwE+m585F4ht/mPONlK35sdPROwzGdcV98KWuKrQmjZPuvD5X0bKHgdY+7b phcdap5G54g8Wch+jDd5XDMOeQuCiyY9z+JzgAI+qDPViBwQ3r3YmIhn1agVaMhXWVic fZM6C+aREKGacmSpn/mQtOeCTLuiq0BNPX5wznwcOYlIqxmY/BJfnHPj207p9rzObRtJ vqXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XNEosleP; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g37si17462293edg.59.2019.10.16.04.55.54; Wed, 16 Oct 2019 04:56:16 -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=@gmail.com header.s=20161025 header.b=XNEosleP; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389586AbfJPHHq (ORCPT + 99 others); Wed, 16 Oct 2019 03:07:46 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:43370 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389465AbfJPHHq (ORCPT ); Wed, 16 Oct 2019 03:07:46 -0400 Received: by mail-lj1-f193.google.com with SMTP id n14so22776327ljj.10 for ; Wed, 16 Oct 2019 00:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kDtdILcfLHoVejEtGgLfvnr1m900cxUvF44JNpWqBWQ=; b=XNEoslePrQiCPCXuOnDyy5PnKlhPhOjFeGvb9qfXg63GuYrL1wakT6kL3MgLI7npCd SICpSGkSVRWkjYZ64LBiiMnOtjDXe+5RnsP2Ko1deb/JUik1ialZMRvRvWzFV0ytNCNn C1mnQPSR+Zk1niRVJzjo5QCTHUIT+/KwUfAE41lqF0eF/L5vL99jfL/VXmKXS2fSeDEQ KjNG0lEiyju1a5qnai9EJJ0oHfwp54AG86k8qK3xtFDreiTsBoGoaZcZxMUeaHW6yPD9 ynztCpZHXYXllLnfhQsUjlgGCuKzFq9CZmqkAderDUGu4nxmuDpPgqMlD1JuUDMYk1sk KJmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kDtdILcfLHoVejEtGgLfvnr1m900cxUvF44JNpWqBWQ=; b=noBVJQqETP6daCx0Qn9rrOmIF2rDflWI+tH6UfoWZVaWmuAD93oAHWG0L1MP9GSetR p/pAyH9XBYIK5fQMSHmuH3EroAofH327c0GQidbZE5yzRhKj1Gen/J6O0xYzgJ+FD7IB U0ZF0gSdqtVHbB6Mz1+qgyqzBaQPVWIlRTL8ZnzLmzs3UTNjqfU3ugP2IvP2LTh0b+Ib zAJwappCrkmTTe+2yoMW4sLuVhXS0hLGWT/g1antl57hoS5DzFPQZYtBlaCwjA+fqLXe ug3VTaRVuetnetRmZNuZJ3GABjIYPsGbSWC4Mrn1P0jgbichLvJPLczFgXOyW7JD6bk+ Im9Q== X-Gm-Message-State: APjAAAX/nU6Y+i63MM0d/NlImCeEC8flpYHwuSHdCnJXA/yuU5Dn1q/8 8O9O0U3Z4miCWKDzjkvIBcM= X-Received: by 2002:a2e:9117:: with SMTP id m23mr24989061ljg.82.1571209663820; Wed, 16 Oct 2019 00:07:43 -0700 (PDT) Received: from localhost.localdomain (c213-102-65-51.bredband.comhem.se. [213.102.65.51]) by smtp.gmail.com with ESMTPSA id j191sm1361493lfj.49.2019.10.16.00.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 00:07:43 -0700 (PDT) From: codekipper@gmail.com To: mripard@kernel.org, wens@csie.org, linux-sunxi@googlegroups.com Cc: linux-arm-kernel@lists.infradead.org, lgirdwood@gmail.com, broonie@kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, be17068@iperbole.bo.it, Marcus Cooper Subject: [PATCH v6 1/7] ASoC: sun4i-i2s: Move channel select offset Date: Wed, 16 Oct 2019 09:07:34 +0200 Message-Id: <20191016070740.121435-2-codekipper@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016070740.121435-1-codekipper@gmail.com> References: <20191016070740.121435-1-codekipper@gmail.com> 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: Marcus Cooper On the newer SoCs the offset is used to set the mode of the connection. As it is to be used elsewhere then it makes sense to move it to the main structure. Signed-off-by: Marcus Cooper --- sound/soc/sunxi/sun4i-i2s.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index d0a8d5810c0a..f1a80973c450 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -156,7 +156,7 @@ struct sun4i_i2s_quirks { s8 (*get_wss)(const struct sun4i_i2s *, int); int (*set_chan_cfg)(const struct sun4i_i2s *, const struct snd_pcm_hw_params *); - int (*set_fmt)(const struct sun4i_i2s *, unsigned int); + int (*set_fmt)(struct sun4i_i2s *, unsigned int); }; struct sun4i_i2s { @@ -169,6 +169,7 @@ struct sun4i_i2s { unsigned int mclk_freq; unsigned int slots; unsigned int slot_width; + unsigned int offset; struct snd_dmaengine_dai_dma_data capture_dma_data; struct snd_dmaengine_dai_dma_data playback_dma_data; @@ -516,7 +517,7 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream, slots, slot_width); } -static int sun4i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, +static int sun4i_i2s_set_soc_fmt(struct sun4i_i2s *i2s, unsigned int fmt) { u32 val; @@ -589,11 +590,10 @@ static int sun4i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, return 0; } -static int sun8i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, +static int sun8i_i2s_set_soc_fmt(struct sun4i_i2s *i2s, unsigned int fmt) { u32 mode, val; - u8 offset; /* * DAI clock polarity @@ -632,27 +632,27 @@ static int sun8i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_DSP_A: mode = SUN8I_I2S_CTRL_MODE_PCM; - offset = 1; + i2s->offset = 1; break; case SND_SOC_DAIFMT_DSP_B: mode = SUN8I_I2S_CTRL_MODE_PCM; - offset = 0; + i2s->offset = 0; break; case SND_SOC_DAIFMT_I2S: mode = SUN8I_I2S_CTRL_MODE_LEFT; - offset = 1; + i2s->offset = 1; break; case SND_SOC_DAIFMT_LEFT_J: mode = SUN8I_I2S_CTRL_MODE_LEFT; - offset = 0; + i2s->offset = 0; break; case SND_SOC_DAIFMT_RIGHT_J: mode = SUN8I_I2S_CTRL_MODE_RIGHT; - offset = 0; + i2s->offset = 0; break; default: @@ -663,10 +663,10 @@ static int sun8i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, SUN8I_I2S_CTRL_MODE_MASK, mode); regmap_update_bits(i2s->regmap, SUN8I_I2S_TX_CHAN_SEL_REG, SUN8I_I2S_TX_CHAN_OFFSET_MASK, - SUN8I_I2S_TX_CHAN_OFFSET(offset)); + SUN8I_I2S_TX_CHAN_OFFSET(i2s->offset)); regmap_update_bits(i2s->regmap, SUN8I_I2S_RX_CHAN_SEL_REG, SUN8I_I2S_TX_CHAN_OFFSET_MASK, - SUN8I_I2S_TX_CHAN_OFFSET(offset)); + SUN8I_I2S_TX_CHAN_OFFSET(i2s->offset)); /* DAI clock master masks */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { -- 2.23.0