Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp795203ybk; Wed, 13 May 2020 13:19:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHWOL7L6oogn+zTOaQ9C+XsHzAPNn+67NBq12zWG1TaECzSlCuG4mS3tO1vdi6zhpNFPTM X-Received: by 2002:a05:6402:2c4:: with SMTP id b4mr1269821edx.331.1589401178531; Wed, 13 May 2020 13:19:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589401178; cv=none; d=google.com; s=arc-20160816; b=OqDjoSLavhQke8fMqFMnfrQ7a68w8y6+lcQVV4c18wXJlGpp/2s/iAa+9+l/dlMJJK VqfH6gjnaCae8QCW0CWLVzBFfKbKMJLN+hWtLnXZEfJi18+pjJ92XIYxXeZxPJcKOKNL s1hjaVx0c8vQBQxv1YZNwgwNwQ0Ng0e/ZZkUgMZQM4xyzTNFdoFb4wUz8DI7Hb2wV6dg v9BuzRo6Xm1ns6LSUuL2PX6EMJOCs1utfTktMxDXALY7qMArxr9+09gM7Iqb6SaYD2u7 j3ubocUC+OpaeK2/3NIIaEE3vvvtQ5EtvxlhMHpxlHERKR2CmPdSkHj92c+Pi9hTrXQL xIKQ== 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=e5oLHvSAcu1wID8AuM4YdTSx1fGtweYfUrxREiY/l9M=; b=BgfBlwaT2zrv4QL9ldgjB3FYkZLV39rw/Ucvvn0KKl3BOrRql3umFjPI+s6k+KuAxC 93TM0Fo5Ia73zXag9oIddaZhhZ+lrJN1CbLpVzSIwHAG3g0opwIxUJOyNb+nJMVOJZHy sl7E2f7rYDDGkmeQAyBWPI4NxlOa7CQzZRqLdqY8MRLLudOdNos1FBC1MXqqyJtAnwGv Ps//k7qj/i7HI3fSA+BanpGiZfBiPAoY8P6IUEKy70g4xIPGowfYW6+YblloaEv3qvf4 +w8t4Ef25o5BjiiBfGZX9qteXBnSq1DMGr1rKO6Gcylx8w/Oq6+HZaSNHgHkYpBwupmM cXlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=w9MiBenm; 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=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 v10si404655edl.365.2020.05.13.13.19.15; Wed, 13 May 2020 13:19:38 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=w9MiBenm; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390888AbgEMUQQ (ORCPT + 99 others); Wed, 13 May 2020 16:16:16 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:55226 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387732AbgEMUQP (ORCPT ); Wed, 13 May 2020 16:16:15 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04DKFWJl087999; Wed, 13 May 2020 15:15:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1589400932; bh=e5oLHvSAcu1wID8AuM4YdTSx1fGtweYfUrxREiY/l9M=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=w9MiBenm9D8ZHY+/L/57qgHSEKW48jrlzcJSJGtMMKcsRgqfR+e6KNViQ2ihpKt6+ A3aTdp2RCgv/IY+jYENwdiDsihwnuA4zTYAjh7FG5L3CKLS4dqqvIr/M4FuF61ln3R Gj68e1c5zmu1VBoRLPcO6w6EqWQwlMeF5I5byF8E= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04DKFWf3084915 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 13 May 2020 15:15:32 -0500 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 13 May 2020 15:15:31 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE113.ent.ti.com (10.64.6.34) 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, 13 May 2020 15:15:31 -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 04DKFVsb096766; Wed, 13 May 2020 15:15:31 -0500 From: Dan Murphy To: , , , CC: , , Dan Murphy Subject: [PATCH v2 3/3] ASoC: tlv320adcx140: Configure PDM sampling edge Date: Wed, 13 May 2020 15:05:49 -0500 Message-ID: <20200513200549.12213-3-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200513200549.12213-1-dmurphy@ti.com> References: <20200513200549.12213-1-dmurphy@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Configure the PDM sampling edges based on the values from the firmware. Signed-off-by: Dan Murphy --- sound/soc/codecs/tlv320adcx140.c | 22 ++++++++++++++++++++++ sound/soc/codecs/tlv320adcx140.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c index 97634e0ca0ba..140a5802a9a9 100644 --- a/sound/soc/codecs/tlv320adcx140.c +++ b/sound/soc/codecs/tlv320adcx140.c @@ -760,6 +760,10 @@ static int adcx140_codec_probe(struct snd_soc_component *component) int sleep_cfg_val = ADCX140_WAKE_DEV; u8 bias_source; u8 vref_source; + int pdm_count; + u32 pdm_edges[ADCX140_NUM_PDM_EDGES]; + u32 pdm_edge_val = 0; + int i; int ret; ret = device_property_read_u8(adcx140->dev, "ti,mic-bias-source", @@ -786,6 +790,24 @@ static int adcx140_codec_probe(struct snd_soc_component *component) bias_source |= vref_source; + pdm_count = device_property_count_u32(adcx140->dev, + "ti,pdm-edge-select"); + if (pdm_count <= ADCX140_NUM_PDM_EDGES && pdm_count > 0) { + ret = device_property_read_u32_array(adcx140->dev, + "ti,pdm-edge-select", + pdm_edges, pdm_count); + if (ret) + return ret; + + for (i = 0; i < pdm_count; i++) + pdm_edge_val |= pdm_edges[i] << (ADCX140_PDM_EDGE_SHIFT - i); + + ret = regmap_write(adcx140->regmap, ADCX140_PDM_CFG, + pdm_edge_val); + if (ret) + return ret; + } + ret = adcx140_reset(adcx140); if (ret) goto out; diff --git a/sound/soc/codecs/tlv320adcx140.h b/sound/soc/codecs/tlv320adcx140.h index 6d055e55909e..432eaf25d1a7 100644 --- a/sound/soc/codecs/tlv320adcx140.h +++ b/sound/soc/codecs/tlv320adcx140.h @@ -128,4 +128,7 @@ #define ADCX140_TX_OFFSET_MASK GENMASK(4, 0) +#define ADCX140_NUM_PDM_EDGES 4 +#define ADCX140_PDM_EDGE_SHIFT 7 + #endif /* _TLV320ADCX140_ */ -- 2.26.2