From patchwork Wed Jun 24 17:49:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 191707 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp64953ilg; Wed, 24 Jun 2020 10:50:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVCNmg/Z9cc5CPMR1fhuLf+m/OePM06z5ciaLBSB6+oQ7Vm6du4gdYHV5dlcL2Z3Dd7jpx X-Received: by 2002:aa7:da17:: with SMTP id r23mr28946041eds.261.1593021041447; Wed, 24 Jun 2020 10:50:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593021041; cv=none; d=google.com; s=arc-20160816; b=T632tu781rac0dOZRJD0Gulp2h5389r0/UdYlgU3qrX8pe+daotwmS1yDX4OyyZ0v1 VndmEDNSGDYv9+Fw1lDyQAQrXAiKfh7Ecv4Ph+NxTFPutuqD/wpSg39MFmVjWL4QHihw mM2MkG8/hq7AfTzGpcH6ClRhcx9vA11rLPsPUETGGZ/Jfr81Ok6Np3dQaL+tadCH/fOU giB6dmBF6nVMGv7fn7DWdAZVbl6QUxg4f2rmkC5Z0KdsWXtWGEn9j6DRtp1emITTr9f/ WHDLNuYZWKbz6DONtWa0SUnnGP6VN0GfYwK6MKdDgsM/0xP9z4S9tG2tccQdM/JsFde8 R7DQ== 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=Y5MdwCGXU77RAWVwX/WygJujeCPyLUiyCkJR3oQySLQ=; b=W6+n+DeGhRRQ3ZzSp89Xq1P2y1u8ezRkX6eYIByuEHYaSLKRojY9JQN4aqigTcGTd2 X8IIsUZIddFzUB8IlslSRndWHVdsWP887W501lsvqq7i1p2uE/RJLSyeLcWBabZF0OfQ LnKdn7iZPD5+YIeiREb+THqOdovi2XWkCkhItVRIOzt0dq/RaNlmy3GjHJg3csg/TYM2 vU+N4Fiy0UNky7mRuOFzWaKvkSQmc5DRlGnW3e5ElDMs9qRYHjFj20XvihGX1E3ufJgO McZ7JarWk89j1RU37qNK5FMXTXLOmoKrtpTyWAh0mmfolAjpUyrD60AqmDWWDYEhhDtm d8kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=o5g25OCC; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e7si8850446edn.164.2020.06.24.10.50.41; Wed, 24 Jun 2020 10:50:41 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=o5g25OCC; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405687AbgFXRuk (ORCPT + 6 others); Wed, 24 Jun 2020 13:50:40 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:33094 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405556AbgFXRuk (ORCPT ); Wed, 24 Jun 2020 13:50:40 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 05OHnx6i062677; Wed, 24 Jun 2020 12:49:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1593020999; bh=Y5MdwCGXU77RAWVwX/WygJujeCPyLUiyCkJR3oQySLQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=o5g25OCCFUZZ3BAWAxqxAbf9F7AgYKdNEJZBl163nV9U3u4CQAUcyavwqVOXzeZK4 IHeZloQ4cQKB4dIp1bZjkykKUklkO0NVAcMtMzHcOP/8BbQZmSuFzvGgIcVQGLpWJl hZW2lVq4Jpe7lHpIZFM5+wESUO/byafWBnS8onEw= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05OHnxnB082225; Wed, 24 Jun 2020 12:49:59 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 24 Jun 2020 12:49:59 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 24 Jun 2020 12:49:59 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05OHnxUf119507; Wed, 24 Jun 2020 12:49:59 -0500 From: Dan Murphy To: , , , CC: , , , , Dan Murphy Subject: [PATCH v6 4/7] ASoC: tas2562: Add rx and tx slot programming Date: Wed, 24 Jun 2020 12:49:29 -0500 Message-ID: <20200624174932.9604-5-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200624174932.9604-1-dmurphy@ti.com> References: <20200624174932.9604-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add programming for the tdm slots for both tx and rx offsets. Signed-off-by: Dan Murphy --- sound/soc/codecs/tas2562.c | 17 ++++++++++++++++- sound/soc/codecs/tas2562.h | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-) -- 2.26.2 diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c index d26e30a2948c..2f1d4b697f01 100644 --- a/sound/soc/codecs/tas2562.c +++ b/sound/soc/codecs/tas2562.c @@ -208,6 +208,22 @@ static int tas2562_set_dai_tdm_slot(struct snd_soc_dai *dai, if (ret < 0) return ret; + if (tx_mask > TAS2562_TX_OFF_MAX) { + dev_err(tas2562->dev, "TX slot is larger then %d", + TAS2562_TX_OFF_MAX); + return -EINVAL; + } + + ret = snd_soc_component_update_bits(component, TAS2562_TDM_CFG1, + TAS2562_RX_OFF_MASK, rx_mask << 1); + if (ret < 0) + return ret; + + ret = snd_soc_component_update_bits(component, TAS2562_TDM_CFG4, + TAS2562_TX_OFF_MASK, tx_mask << 1); + if (ret < 0) + return ret; + return 0; } @@ -327,7 +343,6 @@ static int tas2562_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) ret = snd_soc_component_update_bits(component, TAS2562_TDM_CFG1, TAS2562_TDM_CFG1_RX_OFFSET_MASK, tdm_rx_start_slot); - if (ret < 0) return ret; diff --git a/sound/soc/codecs/tas2562.h b/sound/soc/codecs/tas2562.h index 28e75fc431d0..47e59c82eef3 100644 --- a/sound/soc/codecs/tas2562.h +++ b/sound/soc/codecs/tas2562.h @@ -34,6 +34,10 @@ #define TAS2562_TDM_DET TAS2562_REG(0, 0x11) #define TAS2562_REV_ID TAS2562_REG(0, 0x7d) +#define TAS2562_RX_OFF_MASK GENMASK(5, 1) +#define TAS2562_TX_OFF_MASK GENMASK(3, 1) +#define TAS2562_TX_OFF_MAX 7 + /* Page 2 */ #define TAS2562_DVC_CFG1 TAS2562_REG(2, 0x0c) #define TAS2562_DVC_CFG2 TAS2562_REG(2, 0x0d)