From patchwork Thu Sep 15 11:39:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Astrid Rost X-Patchwork-Id: 12977274 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 56C7CECAAD3 for ; Thu, 15 Sep 2022 11:41:01 +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 427391939; Thu, 15 Sep 2022 13:40:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 427391939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663242059; bh=+tiwKSI8wJPhwpcL8eMs7X0lCz075KLEzmhzNRFB6Uw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=fS/nhr/2knv5+juQ0rTcSHOkq7Cfls//jVGHN2Wu29U0GEUl8mHz6VvKHOci7R6J2 PdgOTP8vxKDg0wdFD1Q3v23j6Qb3O7MA/WpXDZy2WpKm0zOL1OXOSxRkrhuRJDFOyv 2pbBRT29YaswO6iHdqlTPzU2tiCSwEQmuy0v9QNo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 13546F800FE; Thu, 15 Sep 2022 13:40:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 68697F80482; Thu, 15 Sep 2022 13:40:06 +0200 (CEST) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) (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 285F4F8013D for ; Thu, 15 Sep 2022 13:39:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 285F4F8013D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=axis.com header.i=@axis.com header.b="Qry1vXnc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1663242002; x=1694778002; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q7H5ypMruUoIfTG08+A5et2lb9798ejAy9cXwmsde80=; b=Qry1vXncCz/eEyoZ3NzxA+xmb4K9IbIlK5yCJ3ZQWxdryskdvBaBd7tM EdAOLo3cwVz0sBUEkhyUmMK0jrIsAlU0juo3yvw+UxCg2JrQQuM8DP21X 8xug3AogMxJ5CCc7TrdkM9H6btfHuIR6A9aqra0z/eb0FXJJ1jQeNQGrd i0ZqrTHHqB6wZfDILzvgylaYMcGzrnA9VSbjVzU+uwstZmEr3+Q9a8BBN bm3IlDIYMnPcVUDT7QU9LaDbDFNbBySCxYmgBhPUVD9yt1rsGjM1EcPF5 6lrDLKG14TKntmiZlZXzbbFJn9ULXAaJJAj6xrH6g5wYwyJZn2nOoKFCO g==; From: Astrid Rost To: Mark Brown , Liam Girdwood , Krzysztof Kozlowski , Dylan Reid , Rob Herring Subject: [PATCH v2 1/3] dt-bindings: sound: ts3a227e: convert to yaml Date: Thu, 15 Sep 2022 13:39:53 +0200 Message-ID: <20220915113955.22521-2-astrid.rost@axis.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220915113955.22521-1-astrid.rost@axis.com> References: <20220915113955.22521-1-astrid.rost@axis.com> MIME-Version: 1.0 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Astrid Rost , linux-kernel@vger.kernel.org, kernel@axis.c, Astrid Rost 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" Convert from ts3a227e.txt to yaml. Signed-off-by: Astrid Rost --- .../devicetree/bindings/sound/ts3a227e.txt | 30 -------- .../devicetree/bindings/sound/ts3a227e.yaml | 69 +++++++++++++++++++ 2 files changed, 69 insertions(+), 30 deletions(-) delete mode 100644 Documentation/devicetree/bindings/sound/ts3a227e.txt create mode 100644 Documentation/devicetree/bindings/sound/ts3a227e.yaml diff --git a/Documentation/devicetree/bindings/sound/ts3a227e.txt b/Documentation/devicetree/bindings/sound/ts3a227e.txt deleted file mode 100644 index 21ab45bc7e8f..000000000000 --- a/Documentation/devicetree/bindings/sound/ts3a227e.txt +++ /dev/null @@ -1,30 +0,0 @@ -Texas Instruments TS3A227E -Autonomous Audio Accessory Detection and Configuration Switch - -The TS3A227E detect headsets of 3-ring and 4-ring standards and -switches automatically to route the microphone correctly. It also -handles key press detection in accordance with the Android audio -headset specification v1.0. - -Required properties: - - - compatible: Should contain "ti,ts3a227e". - - reg: The i2c address. Should contain <0x3b>. - - interrupts: Interrupt number for /INT pin from the 227e - -Optional properies: - - ti,micbias: Intended MICBIAS voltage (datasheet section 9.6.7). - Select 0/1/2/3/4/5/6/7 to specify MICBIAS voltage - 2.1V/2.2V/2.3V/2.4V/2.5V/2.6V/2.7V/2.8V - Default value is "1" (2.2V). - -Examples: - - i2c { - ts3a227e@3b { - compatible = "ti,ts3a227e"; - reg = <0x3b>; - interrupt-parent = <&gpio>; - interrupts = <3 IRQ_TYPE_LEVEL_LOW>; - }; - }; diff --git a/Documentation/devicetree/bindings/sound/ts3a227e.yaml b/Documentation/devicetree/bindings/sound/ts3a227e.yaml new file mode 100644 index 000000000000..3512b1f1e32b --- /dev/null +++ b/Documentation/devicetree/bindings/sound/ts3a227e.yaml @@ -0,0 +1,69 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/sound/ts3a227e.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Texas Instruments TS3A227E + Autonomous Audio Accessory Detection and Configuration Switch + +maintainers: + - Dylan Reid + +description: | + The TS3A227E detect headsets of 3-ring and 4-ring standards and + switches automatically to route the microphone correctly. It also + handles key press detection in accordance with the Android audio + headset specification v1.0. + +properties: + compatible: + enum: + - ti,ts3a227e + + reg: + description: I2C address of the device. + const: 0x3b + + interrupts: + maxItems: 1 + description: | + Interrupt number for /INT pin from the ts3a227e. + + ti,micbias: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Intended MICBIAS voltage (datasheet section 9.6.7). + enum: + - 0 # 2.1 V + - 1 # 2.2 V + - 2 # 2.3 V + - 3 # 2.4 V + - 4 # 2.5 V + - 5 # 2.6 V + - 6 # 2.7 V + - 7 # 2.8 V + default: 2 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include + #include + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + codec: ts3a227e@3b { + compatible = "ti,ts3a227e"; + reg = <0x3b>; + interrupt-parent = <&gpio1>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; + }; + }; + +... From patchwork Thu Sep 15 11:39:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Astrid Rost X-Patchwork-Id: 12977277 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 E6C67ECAAD3 for ; Thu, 15 Sep 2022 11:42:00 +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 C97EF1A16; Thu, 15 Sep 2022 13:41:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C97EF1A16 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663242117; bh=5d4rtyVY1b+OQfdduXscPUQN8jtr+jjh9L3gDOUzvGo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=q/6daHcgZhMnuHviay63+g3CYSXxzHfwZXeSIb357E+GhTsDs/9KYCah2Unx7H60c PdMh7LeWgeejKb0yrP/dgtb5wHkFyHSc77zLI4mzTMeu5w5C0AQNbtO8CriKEbHyQM eedsdUGzB2lbVqY0lVUv1iSzO6AUQhYyTnHoEmYk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 01334F80537; Thu, 15 Sep 2022 13:40:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C2853F80536; Thu, 15 Sep 2022 13:40:11 +0200 (CEST) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) (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 82D19F80238 for ; Thu, 15 Sep 2022 13:40:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 82D19F80238 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=axis.com header.i=@axis.com header.b="OUjhnCQP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1663242003; x=1694778003; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wnFQ1tb35qKbaGfqR/2XMvWyIaJYai8tjzpmbu59XnM=; b=OUjhnCQPb9nOjAtciJPwYITINgID3hs2P/zTFV7oqGaSzRLKkOYPDWjN oNwsbTOv7crwpkDfSe6MC9cAhjmxSm8SkKD8gCPFPo7zsGQ7bbq8SPTLk Vk14zUBSwt62PCDDVcjpQ71XKU7SMg7QAnI1f2lrgxLlxNljv/A3hvdYv zWaLsNFqvWXT8/kTWJ2krTHc9ry9h2aWSdIlF2WEbvgmH2iTDY7CAeY9Z pXK0f02qRptYlezwXGvfz/TrBqldLFKu4I51vRlo+isKbl41Bz1/srVct EWUNSWEJLamPV4QS61gbG4HiKoPIBkrEM/AaBZ4hzqHGdxehte4RZ8bpm w==; From: Astrid Rost To: Mark Brown , Liam Girdwood , Krzysztof Kozlowski , Dylan Reid , Rob Herring Subject: [PATCH v2 2/3] dt-bindings: sound: ts3a227e: add control of debounce times Date: Thu, 15 Sep 2022 13:39:54 +0200 Message-ID: <20220915113955.22521-3-astrid.rost@axis.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220915113955.22521-1-astrid.rost@axis.com> References: <20220915113955.22521-1-astrid.rost@axis.com> MIME-Version: 1.0 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Astrid Rost , linux-kernel@vger.kernel.org, kernel@axis.c, Astrid Rost 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" Add devicetree parameters to control the insertion, release and press debounce times. Signed-off-by: Astrid Rost --- .../devicetree/bindings/sound/ts3a227e.yaml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/ts3a227e.yaml b/Documentation/devicetree/bindings/sound/ts3a227e.yaml index 3512b1f1e32b..8c27f298733a 100644 --- a/Documentation/devicetree/bindings/sound/ts3a227e.yaml +++ b/Documentation/devicetree/bindings/sound/ts3a227e.yaml @@ -44,6 +44,35 @@ properties: - 7 # 2.8 V default: 2 + ti,debounce-release-ms: + description: key release debounce time in ms (datasheet section 9.6.7). + enum: + - 0 # 0 ms (0) + - 20 # 20 ms (1) + default: 20 + + ti,debounce-press-ms: + description: key press debounce time in ms (datasheet section 9.6.7). + enum: + - 2 # 2 ms (0) + - 40 # 40 ms (1) + - 80 # 80 ms (2) + - 120 # 120 ms (3) + default: 80 + + ti,debounce-insertion-ms: + description: headset insertion debounce time in ms (datasheet section 9.6.5). + enum: + - 2 # 2 ms (0) + - 30 # 30 ms (1) + - 60 # 60 ms (2) + - 90 # 90 ms (3) + - 120 # 120 ms (4) + - 150 # 150 ms (5) + - 1000 # 1 s (6) + - 2000 # 2 s (7) + default: 90 + required: - compatible - reg From patchwork Thu Sep 15 11:39:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Astrid Rost X-Patchwork-Id: 12977276 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 8E9E6ECAAA1 for ; Thu, 15 Sep 2022 11:41:53 +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 2707E194A; Thu, 15 Sep 2022 13:41:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2707E194A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663242110; bh=Lfx6i53+RiO5+QzyUxtTXrjQmGmvvKs2PPjMKY51PfE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=nM4bMW8GMgDccSuEgWj0X5EnMZFwSWAKxD6YPAhuAh3I/NxkfrnlNQu/oz4M+iW/V I5NrkmAnE+NW8oYw+ix8ZEknW0O/wCG2R0+sd0q29Ij1YTb/xhh8irOKE4nbpwUZtl RA3BwKyyVI6AkgklOxh3HkfVwDtOOGPF3uL0ThPo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 59058F800B5; Thu, 15 Sep 2022 13:40:13 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C60D5F80535; Thu, 15 Sep 2022 13:40:11 +0200 (CEST) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) (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 37B35F8027D for ; Thu, 15 Sep 2022 13:40:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 37B35F8027D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=axis.com header.i=@axis.com header.b="Kx4Ef/2u" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1663242004; x=1694778004; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fWT8qRbiWNa5/mbcYWo86wQNVuPvppjS+ANHTTdMVNE=; b=Kx4Ef/2usLPJy8U9d3wAmR7bwFDPA5vW2riuzfNTpJPA8Djv23roDQ3m AKO1QkwqGWmnDB5WoeH1OQnvfTR4LLYGIqj0DtyLseDPyQFv7OhrWx38+ A0RJyHidY++4yVuQJemqXfGXLipG5nHdYFS4asFK6fwTIZ9nKmquo7Om9 j6Di/13Zb4rGeAFwURLjmmcIZqyw9YjRFl9ABTtOcNNoKzG1jDFie4wH7 O6g4AZpsLAcRKlO1wJQhRrPSP3lmz580fidu5kjH04NQx8bnmKzdfkgrM RjiwFxZynoU+ssid5uIoWQ8Ed8hbULZoU3QcNnsZODKsylJKi3JtnTMDh w==; From: Astrid Rost To: Mark Brown , Liam Girdwood , Krzysztof Kozlowski , Dylan Reid , Jaroslav Kysela , Takashi Iwai Subject: [PATCH v2 3/3] ASoC: ts3a227e: add parameters to control debounce times Date: Thu, 15 Sep 2022 13:39:55 +0200 Message-ID: <20220915113955.22521-4-astrid.rost@axis.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220915113955.22521-1-astrid.rost@axis.com> References: <20220915113955.22521-1-astrid.rost@axis.com> MIME-Version: 1.0 Cc: Astrid Rost , kernel@axis.c, Astrid Rost , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Add devicetree parameters to control the insert, release and press debounce times. Signed-off-by: Astrid Rost --- sound/soc/codecs/ts3a227e.c | 58 +++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/ts3a227e.c b/sound/soc/codecs/ts3a227e.c index d8ab0810fceb..f2d1367c46ca 100644 --- a/sound/soc/codecs/ts3a227e.c +++ b/sound/soc/codecs/ts3a227e.c @@ -78,12 +78,20 @@ static const int ts3a227e_buttons[] = { #define ADC_COMPLETE_INT_DISABLE 0x04 #define INTB_DISABLE 0x08 +/* TS3A227E_REG_SETTING_1 0x4 */ +#define DEBOUNCE_INSERTION_SETTING_SFT (0) +#define DEBOUNCE_INSERTION_SETTING_MASK (0x7 << DEBOUNCE_PRESS_SETTING_SFT) + /* TS3A227E_REG_SETTING_2 0x05 */ #define KP_ENABLE 0x04 /* TS3A227E_REG_SETTING_3 0x06 */ -#define MICBIAS_SETTING_SFT (3) +#define MICBIAS_SETTING_SFT 3 #define MICBIAS_SETTING_MASK (0x7 << MICBIAS_SETTING_SFT) +#define DEBOUNCE_RELEASE_SETTING_SFT 2 +#define DEBOUNCE_RELEASE_SETTING_MASK (0x1 << DEBOUNCE_RELEASE_SETTING_SFT) +#define DEBOUNCE_PRESS_SETTING_SFT 0 +#define DEBOUNCE_PRESS_SETTING_MASK (0x3 << DEBOUNCE_PRESS_SETTING_SFT) /* TS3A227E_REG_ACCESSORY_STATUS 0x0b */ #define TYPE_3_POLE 0x01 @@ -136,7 +144,7 @@ static bool ts3a227e_volatile_reg(struct device *dev, unsigned int reg) { switch (reg) { case TS3A227E_REG_INTERRUPT ... TS3A227E_REG_INTERRUPT_DISABLE: - case TS3A227E_REG_SETTING_2: + case TS3A227E_REG_SETTING_1 ... TS3A227E_REG_SETTING_2: case TS3A227E_REG_SWITCH_STATUS_1 ... TS3A227E_REG_ADC_OUTPUT: return true; default: @@ -269,14 +277,52 @@ static const struct regmap_config ts3a227e_regmap_config = { static int ts3a227e_parse_device_property(struct ts3a227e *ts3a227e, struct device *dev) { - u32 micbias; + u32 value; + u32 value_ms; + u32 setting3_value = 0; + u32 setting3_mask = 0; int err; - err = device_property_read_u32(dev, "ti,micbias", &micbias); + err = device_property_read_u32(dev, "ti,micbias", &value); + if (!err) { + setting3_mask = MICBIAS_SETTING_MASK; + setting3_value = + (value << MICBIAS_SETTING_SFT) & MICBIAS_SETTING_MASK; + } + + err = device_property_read_u32(dev, "ti,debounce-release-ms", &value_ms); if (!err) { + value = (value_ms > 10); + setting3_mask |= DEBOUNCE_RELEASE_SETTING_MASK; + setting3_value |= (value << DEBOUNCE_RELEASE_SETTING_SFT) & + DEBOUNCE_RELEASE_SETTING_MASK; + } + + err = device_property_read_u32(dev, "ti,debounce-press-ms", &value_ms); + if (!err) { + value = (value_ms + 20) / 40; + if (value > 3) + value = 3; + setting3_mask |= DEBOUNCE_PRESS_SETTING_MASK; + setting3_value |= (value << DEBOUNCE_PRESS_SETTING_SFT) & + DEBOUNCE_PRESS_SETTING_MASK; + } + + if (setting3_mask) regmap_update_bits(ts3a227e->regmap, TS3A227E_REG_SETTING_3, - MICBIAS_SETTING_MASK, - (micbias & 0x07) << MICBIAS_SETTING_SFT); + setting3_mask, setting3_value); + + err = device_property_read_u32(dev, "ti,debounce-insertion-ms", &value_ms); + if (!err) { + if (value_ms < 165) + value = (value_ms + 15) / 30; + else if (value_ms < 1500) + value = 6; + else + value = 7; + regmap_update_bits(ts3a227e->regmap, TS3A227E_REG_SETTING_1, + DEBOUNCE_INSERTION_SETTING_MASK, (value << DEBOUNCE_INSERTION_SETTING_SFT) + & DEBOUNCE_INSERTION_SETTING_MASK); } return 0;