From patchwork Tue May 17 05:48:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Laduranty X-Patchwork-Id: 573902 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 264FFC433EF for ; Tue, 17 May 2022 05:49:48 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 93EE315F2; Tue, 17 May 2022 07:48:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 93EE315F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1652766586; bh=DWn8KuHkh2JlcE0Zw68ge2ZpG8OSh1ip/umn9KImOYc=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=HOCW89BpeV32h/uHXwcVi4eC1VQ4sKAYD9Oq1MOlotVkfs39u5xRe25Tb2x71kIW8 a78RTPXHpQ1w5+O170J3/AmjxENGikaK46Ael18yVM4xcR6bqC08boT0bZq2qmi3RS el46pSIFgXhfaU7XLkwh26t8sn3M9E6KPfHAzBSw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0E058F801D8; Tue, 17 May 2022 07:48:56 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8B4FBF802DB; Tue, 17 May 2022 07:48:53 +0200 (CEST) Received: from 20.mo561.mail-out.ovh.net (20.mo561.mail-out.ovh.net [178.33.47.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 84130F800F0 for ; Tue, 17 May 2022 07:48:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 84130F800F0 Received: from player756.ha.ovh.net (unknown [10.111.208.240]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id 315C322141 for ; Tue, 17 May 2022 05:48:43 +0000 (UTC) Received: from mesotic.com (82-65-23-224.subs.proxad.net [82.65.23.224]) (Authenticated sender: dylan.laduranty@mesotic.com) by player756.ha.ovh.net (Postfix) with ESMTPSA id 7990F29BF20FE; Tue, 17 May 2022 05:48:40 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-102R0047b5d193b-9aec-4cd8-a974-774469e7491e, 1BCD3FF435E24440D4B99C59F4910DCA014FE84C) smtp.auth=dylan.laduranty@mesotic.com X-OVh-ClientIp: 82.65.23.224 From: Dylan Laduranty To: alsa-devel@alsa-project.org Subject: [PATCH 1/2 v3] ASoC: ADAU7118: add bindings for managing pins drive strength Date: Tue, 17 May 2022 07:48:08 +0200 Message-Id: <20220517054809.8244-1-dylan.laduranty@mesotic.com> X-Mailer: git-send-email 2.17.1 X-Ovh-Tracer-Id: 3979493222291066060 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrheeigddutddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffosedttdertdertddtnecuhfhrohhmpeffhihlrghnucfnrgguuhhrrghnthihuceougihlhgrnhdrlhgrughurhgrnhhthiesmhgvshhothhitgdrtghomheqnecuggftrfgrthhtvghrnheptedvhfffvddtjedtheevhfdvteevfeelkefgvdekfeetfefftdfggfefjeeltedunecukfhppedtrddtrddtrddtpdekvddrieehrddvfedrvddvgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepphhlrgihvghrjeehiedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpeguhihlrghnrdhlrgguuhhrrghnthihsehmvghsohhtihgtrdgtohhmpdhnsggprhgtphhtthhopedupdhrtghpthhtoheprghlshgrqdguvghvvghlsegrlhhsrgdqphhrohhjvggtthdrohhrgh Cc: Dylan Laduranty , nuno.sa@analog.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This allows users to change SDATA and both PDM clocks pins drive strength during device probing according to their need. Signed-off-by: Dylan Laduranty --- Changes since v2: Fixes commit description length sound/soc/codecs/adau7118.c | 62 ++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/adau7118.c b/sound/soc/codecs/adau7118.c index 841229dcbca1..18c1f246f911 100644 --- a/sound/soc/codecs/adau7118.c +++ b/sound/soc/codecs/adau7118.c @@ -29,6 +29,12 @@ FIELD_PREP(ADAU7118_LRCLK_BCLK_POL_MASK, x) #define ADAU7118_SPT_SLOT_MASK GENMASK(7, 4) #define ADAU7118_SPT_SLOT(x) FIELD_PREP(ADAU7118_SPT_SLOT_MASK, x) +#define ADAU7118_DS_PDM_CLK0_MASK GENMASK(1, 0) +#define ADAU7118_DS_PDM_CLK0(x) FIELD_PREP(ADAU7118_DS_PDM_CLK0_MASK, x) +#define ADAU7118_DS_PDM_CLK1_MASK GENMASK(3, 2) +#define ADAU7118_DS_PDM_CLK1(x) FIELD_PREP(ADAU7118_DS_PDM_CLK1_MASK, x) +#define ADAU7118_DS_SDATA_MASK GENMASK(5, 4) +#define ADAU7118_DS_SDATA(x) FIELD_PREP(ADAU7118_DS_SDATA_MASK, x) #define ADAU7118_FULL_SOFT_R_MASK BIT(1) #define ADAU7118_FULL_SOFT_R(x) FIELD_PREP(ADAU7118_FULL_SOFT_R_MASK, x) @@ -489,7 +495,7 @@ static int adau7118_regulator_setup(struct adau7118_data *st) static int adau7118_parset_dt(const struct adau7118_data *st) { int ret; - u32 dec_ratio = 0; + u32 val32 = 0; /* 4 inputs */ u32 clk_map[4], regval; @@ -497,9 +503,9 @@ static int adau7118_parset_dt(const struct adau7118_data *st) return 0; ret = device_property_read_u32(st->dev, "adi,decimation-ratio", - &dec_ratio); + &val32); if (!ret) { - switch (dec_ratio) { + switch (val32) { case 64: regval = ADAU7118_DEC_RATIO(0); break; @@ -510,7 +516,7 @@ static int adau7118_parset_dt(const struct adau7118_data *st) regval = ADAU7118_DEC_RATIO(2); break; default: - dev_err(st->dev, "Invalid dec ratio: %u", dec_ratio); + dev_err(st->dev, "Invalid dec ratio: %u", val32); return -EINVAL; } @@ -537,6 +543,54 @@ static int adau7118_parset_dt(const struct adau7118_data *st) return ret; } + ret = device_property_read_u32(st->dev, "adi,pdm-clk0-ds", + &val32); + if (!ret) { + if (val32 > 3) { + dev_err(st->dev, "Invalid pdm-clk0-ds: %u", val32); + return -EINVAL; + } + + ret = regmap_update_bits(st->map, + ADAU7118_REG_DRIVE_STRENGTH, + ADAU7118_DS_PDM_CLK0_MASK, + ADAU7118_DS_PDM_CLK0(val32)); + if (ret) + return ret; + } + + ret = device_property_read_u32(st->dev, "adi,pdm-clk1-ds", + &val32); + if (!ret) { + if (val32 > 3) { + dev_err(st->dev, "Invalid pdm-clk1-ds: %u", val32); + return -EINVAL; + } + + ret = regmap_update_bits(st->map, + ADAU7118_REG_DRIVE_STRENGTH, + ADAU7118_DS_PDM_CLK1_MASK, + ADAU7118_DS_PDM_CLK1(val32)); + if (ret) + return ret; + } + + ret = device_property_read_u32(st->dev, "adi,sdata-ds", + &val32); + if (!ret) { + if (val32 > 3) { + dev_err(st->dev, "Invalid sdata-ds: %u", val32); + return -EINVAL; + } + + ret = regmap_update_bits(st->map, + ADAU7118_REG_DRIVE_STRENGTH, + ADAU7118_DS_SDATA_MASK, + ADAU7118_DS_SDATA(val32)); + if (ret) + return ret; + } + return 0; } From patchwork Tue May 17 05:48:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Laduranty X-Patchwork-Id: 573453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9263BC433F5 for ; Tue, 17 May 2022 05:50:20 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id ACEDF1637; Tue, 17 May 2022 07:49:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ACEDF1637 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1652766618; bh=kz6HjQUF+iZH6y7yhFmVMAQ32EpSUEXXZpfPxyEmfr0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=a/If4MWjQ+O8W+cbbxrSZiR0FJGDk/xL9G9lEJZYuPunoT3pfLXq3qFU4841ptGWg PXCTub8P0L0/ACkBtHEIa1TlgphzSOpCbjY/5hOKIBfzw14fLevKK+5ayocXbMB9q7 tToyWrRgmzHoiPtqpW6QQXLhsvgo3juPoeweLKzw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D9B69F80310; Tue, 17 May 2022 07:49:02 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AEAF4F8047C; Tue, 17 May 2022 07:49:01 +0200 (CEST) Received: from 3.mo575.mail-out.ovh.net (3.mo575.mail-out.ovh.net [46.105.58.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 90A54F80423 for ; Tue, 17 May 2022 07:48:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 90A54F80423 Received: from player756.ha.ovh.net (unknown [10.109.146.173]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id D5BE0228B2 for ; Tue, 17 May 2022 05:48:53 +0000 (UTC) Received: from mesotic.com (82-65-23-224.subs.proxad.net [82.65.23.224]) (Authenticated sender: dylan.laduranty@mesotic.com) by player756.ha.ovh.net (Postfix) with ESMTPSA id 6DAEA29BF212E; Tue, 17 May 2022 05:48:50 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-102R004b51d044b-0542-43a3-ac60-e8677916cc89, 1BCD3FF435E24440D4B99C59F4910DCA014FE84C) smtp.auth=dylan.laduranty@mesotic.com X-OVh-ClientIp: 82.65.23.224 From: Dylan Laduranty To: alsa-devel@alsa-project.org Subject: [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries for pins drive strength Date: Tue, 17 May 2022 07:48:09 +0200 Message-Id: <20220517054809.8244-2-dylan.laduranty@mesotic.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220517054809.8244-1-dylan.laduranty@mesotic.com> References: <20220517054809.8244-1-dylan.laduranty@mesotic.com> X-Ovh-Tracer-Id: 3982589449486781644 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrheeigdellecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvvefufffkofgjfhestddtredtredttdenucfhrhhomhepffihlhgrnhcunfgrughurhgrnhhthicuoeguhihlrghnrdhlrgguuhhrrghnthihsehmvghsohhtihgtrdgtohhmqeenucggtffrrghtthgvrhhnpeegjeegjedthfelgfekgeekiefhveeludelteetudefheekkedthefghfekuddvgfenucfkpheptddrtddrtddrtddpkedvrdeihedrvdefrddvvdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejheeirdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepugihlhgrnhdrlhgrughurhgrnhhthiesmhgvshhothhitgdrtghomhdpnhgspghrtghpthhtohepuddprhgtphhtthhopegrlhhsrgdquggvvhgvlhesrghlshgrqdhprhhojhgvtghtrdhorhhg Cc: Dylan Laduranty , nuno.sa@analog.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Update driver doc with new entries for managing pins drive strength. Add a table to describe possible values for each entry. Signed-off-by: Dylan Laduranty --- Changes since v3: Add missing commit description message .../bindings/sound/adi,adau7118.yaml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/adi,adau7118.yaml b/Documentation/devicetree/bindings/sound/adi,adau7118.yaml index fb78967ee17b..226693ebd446 100644 --- a/Documentation/devicetree/bindings/sound/adi,adau7118.yaml +++ b/Documentation/devicetree/bindings/sound/adi,adau7118.yaml @@ -51,6 +51,42 @@ properties: maximum: 1 default: [0, 0, 1, 1] + adi,pdm-clk0-ds: + description: | + This property set the drive strength of PDM CLK0 output pad. + Possible values are: 0, 1, 2, 3 as per the following table: + 0 = 2.5 mA / 3.3V + 1 = 5 mA / 3.3V + 2 = 10 mA / 3.3V + 3 = 25 mA / 3.3V + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [3, 2, 1, 0] + default: 2 + + adi,pdm-clk1-ds: + description: | + This property set the drive strength of PDM CLK1 output pad. + Possible values are: 0, 1, 2, 3 as per the following table: + 0 = 2.5 mA / 3.3V + 1 = 5 mA / 3.3V + 2 = 10 mA / 3.3V + 3 = 25 mA / 3.3V + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [3, 2, 1, 0] + default: 2 + + adi,sdata-ds: + description: | + This property set the drive strength of SDATA output pad. + Possible values are: 0, 1, 2, 3 as per the following table: + 0 = 2.5 mA / 3.3V + 1 = 5 mA / 3.3V + 2 = 10 mA / 3.3V + 3 = 25 mA / 3.3V + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [3, 2, 1, 0] + default: 2 + required: - "#sound-dai-cells" - compatible @@ -73,6 +109,9 @@ examples: dvdd-supply = <&supply>; adi,pdm-clk-map = <1 1 0 0>; adi,decimation-ratio = <16>; + adi,pdm-clk0-ds = <3>; + adi,pdm-clk1-ds = <3>; + adi,sdata-ds = <3>; }; };