Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2976464rdh; Wed, 27 Sep 2023 21:00:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHAQI++O+1HN7dTNzF4RFadhSk7PQQLEklW2EmoRURS9fPvpenAzh1vfbmG4sao0XMJ7Wa X-Received: by 2002:a17:903:11c8:b0:1c7:23c9:a7e1 with SMTP id q8-20020a17090311c800b001c723c9a7e1mr82491plh.26.1695873622571; Wed, 27 Sep 2023 21:00:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695873622; cv=none; d=google.com; s=arc-20160816; b=JFvIkrwJEQDIIpnyqtOVGSBpGIiW2NKxhZVX1qb8D+YXmGQT5RXPg36iVUlrpjpD0b i1j0x6r7mSsYrYypW2OeXdpHwjVlzTqWOgkEzGcbiIT/f9cVWBJO4dFLbr/pbjpm//NV jEqkT98rySDvNFIPNbMRzogtVl24bvKuTWqlotnyGRyksHyrJZmGfKMGZ4k5lhkh9r6d JPULXemQSWJu7w9ZMrK03dHWLB8mwyu/lZuyc46cA6PcWwW7Llab+hdtARmCGEC4BA9w g8yZGPx5q3rmh0M2re6krW6+G4gihFBYj+/ACxo/CsJvT3Hsk98mFlusZrpdh1tylG9e XkpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Qb7IYOITp/fazeQts5rnDbdxZ1BId+poNibxKincG80=; fh=Rg+VGHUwN+YZEBnPqM0EVvdwDznNa3EeNKvPuWgLPF0=; b=Hja7+vs90ZW+C0ZvkYiCR4uq6KhzPc3HVOXiHqOn7LUM7GD8B21zUGRWuG28ZBjFpX m19ewJOSBGkH1VOCBkEJaAxyoncwht/j2doIWr7MQn9a2h10r2PhvbkGOdoXYmthcz6b G8Yhgg+o1uVfb1ooWGIzfOIBklYlP4I1Fkc/9tzrbryfabwSf88fUVrKYrofo8G0PSSf 9lyI48MQlge1h7EflbBULnC6A1R36C4R/afvkPjr6jbELrE2Dh5qgTOPEAXQE6Y4+f8n jUcAHGeu8A/9c8H9RxZkOCf2GfrIOgiQBstp40lL1SBRi9dEbNtfCG4jnRjVaMfZKPgS 2RGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id u10-20020a170903308a00b001c7361b71c9si743319plc.114.2023.09.27.21.00.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 21:00:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 93D5C809AFA6; Wed, 27 Sep 2023 20:42:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230141AbjI1Dlq (ORCPT + 99 others); Wed, 27 Sep 2023 23:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjI1Dll (ORCPT ); Wed, 27 Sep 2023 23:41:41 -0400 Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EBDB110A; Wed, 27 Sep 2023 20:41:37 -0700 (PDT) X-MailGates: (SIP:2,PASS,NONE)(compute_score:DELIVER,40,3) Received: from 192.168.10.46 by mg.richtek.com with MailGates ESMTPS Server V6.0(1978095:0:AUTH_RELAY) (envelope-from ) (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256/256); Thu, 28 Sep 2023 11:41:10 +0800 (CST) Received: from ex3.rt.l (192.168.10.46) by ex3.rt.l (192.168.10.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Thu, 28 Sep 2023 11:41:10 +0800 Received: from linuxcarl2.richtek.com (192.168.10.154) by ex3.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Thu, 28 Sep 2023 11:41:10 +0800 From: To: Mark Brown , Krzysztof Kozlowski CC: Conor Dooley , Rob Herring , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , ChiYuan Huang , Allen Lin , , , Subject: [PATCH 2/2] ASoC: codecs: rtq9128: Add TDM input source select Date: Thu, 28 Sep 2023 11:41:08 +0800 Message-ID: <1695872468-24433-3-git-send-email-cy_huang@richtek.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1695872468-24433-1-git-send-email-cy_huang@richtek.com> References: <1695872468-24433-1-git-send-email-cy_huang@richtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 27 Sep 2023 20:42:03 -0700 (PDT) From: ChiYuan Huang Pase the property to decide the TDM input source comes from 'DATA1' or 'DATA2 pin. Signed-off-by: ChiYuan Huang --- sound/soc/codecs/rtq9128.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/rtq9128.c b/sound/soc/codecs/rtq9128.c index 926b79ed8078..371d622c6214 100644 --- a/sound/soc/codecs/rtq9128.c +++ b/sound/soc/codecs/rtq9128.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -41,6 +42,7 @@ #define RTQ9128_CHSTAT_VAL_MASK GENMASK(1, 0) #define RTQ9128_DOLEN_MASK GENMASK(7, 6) +#define RTQ9128_TDMSRCIN_MASK GENMASK(5, 4) #define RTQ9128_AUDBIT_MASK GENMASK(5, 4) #define RTQ9128_AUDFMT_MASK GENMASK(3, 0) #define RTQ9128_MSMUTE_MASK BIT(0) @@ -59,6 +61,7 @@ struct rtq9128_data { struct gpio_desc *enable; int tdm_slots; int tdm_slot_width; + bool tdm_input_data2_select; }; struct rtq9128_init_reg { @@ -484,7 +487,7 @@ static int rtq9128_dai_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mas struct rtq9128_data *data = snd_soc_dai_get_drvdata(dai); struct snd_soc_component *comp = dai->component; struct device *dev = dai->dev; - unsigned int mask, start_loc; + unsigned int mask, start_loc, srcin_select; int i, frame_length, ret; dev_dbg(dev, "%s: slot %d slot_width %d, tx/rx mask 0x%x 0x%x\n", __func__, slots, @@ -530,6 +533,14 @@ static int rtq9128_dai_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mas } } + srcin_select = data->tdm_input_data2_select ? RTQ9128_TDMSRCIN_MASK : 0; + ret = snd_soc_component_update_bits(comp, RTQ9128_REG_SDO_SEL, RTQ9128_TDMSRCIN_MASK, + srcin_select); + if (ret < 0) { + dev_err(dev, "Failed to configure TDM source input select\n"); + return ret; + } + data->tdm_slots = slots; data->tdm_slot_width = slot_width; @@ -672,6 +683,9 @@ static int rtq9128_probe(struct i2c_client *i2c) else if (data->enable) usleep_range(10000, 11000); + data->tdm_input_data2_select = device_property_read_bool(dev, + "richtek,tdm-input-data2-select"); + i2c_set_clientdata(i2c, data); /* -- 2.34.1