From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C51CCC43216 for ; Sun, 29 Aug 2021 17:07:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 869D160F6C for ; Sun, 29 Aug 2021 17:07:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235720AbhH2RI3 (ORCPT ); Sun, 29 Aug 2021 13:08:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231183AbhH2RIY (ORCPT ); Sun, 29 Aug 2021 13:08:24 -0400 Received: from dnyon.com (unknown [IPv6:2001:ba0:1800:12f::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D9C6C061575; Sun, 29 Aug 2021 10:07:32 -0700 (PDT) Received: from dnyon.com (45.74.222.87.dynamic.jazztel.es [87.222.74.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dnyon.com (Postfix) with ESMTPSA id C29BC4044F; Sun, 29 Aug 2021 17:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dnyon.com; s=mail; t=1630256851; bh=5QaN/XpQgIgjf/BOnDZmch+mx9yG/wxC151DFF3SAUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MrLu3+qxwhyaRPX9mSVtQxPmegsKs/jpGx1YZ0agQiYw9gcOJUvW71vdfIPyK59t1 ulXVPPP/U+IKLGf/rET7tVINIajX2pjkxIH3N0WYwCAebDRJ8bNn+F/zj+dBce2/Wz tk7DREGoMnMNUrNflfVXor7z3oYpWHIrPGnneGAZD7F2+YdzIEv9y0TckG1jkUAeUs jTCUtIfcTcR03xmisZw37opixzo2BYjFtju2HbLxxeDeHHGrJpvXD24t7NSPI6nBSE PVz7zNhXk0DEzP26wGNSTCywQj/gxEDs0vT4tcYyTXDaQ/NGigry+8EdVWp4l/xIqH w8fPt9qtQbDVw== From: Alejandro Tafalla To: Liam Girdwood , Mark Brown , alsa-devel@alsa-project.org Cc: Alejandro Tafalla , Rob Herring , Jaroslav Kysela , Takashi Iwai , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 1/2] ASoC: max98927: Handle reset gpio when probing i2c Date: Sun, 29 Aug 2021 19:00:16 +0200 Message-Id: <20210829170019.384632-2-atafalla@dnyon.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210829170019.384632-1-atafalla@dnyon.com> References: <20210829170019.384632-1-atafalla@dnyon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Drive the reset gpio if defined in the DTS node. Signed-off-by: Alejandro Tafalla --- sound/soc/codecs/max98927.c | 16 ++++++++++++++++ sound/soc/codecs/max98927.h | 1 + 2 files changed, 17 insertions(+) diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index 8b206ee77709..dacf64c4cdf7 100644 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -898,6 +898,22 @@ static int max98927_i2c_probe(struct i2c_client *i2c, return ret; } + max98927->reset_gpio + = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(max98927->reset_gpio)) { + ret = PTR_ERR(max98927->reset_gpio); + dev_err(&i2c->dev, + "Failed to request GPIO reset pin, error %d\n", ret); + return ret; + } + + if (max98927->reset_gpio) { + gpiod_set_value_cansleep(max98927->reset_gpio, 0); + usleep_range(5, 10) + gpiod_set_value_cansleep(max98927->reset_gpio, 1); + usleep_range(1, 5) + } + /* Check Revision ID */ ret = regmap_read(max98927->regmap, MAX98927_R01FF_REV_ID, ®); diff --git a/sound/soc/codecs/max98927.h b/sound/soc/codecs/max98927.h index 05f495db914d..5c04bf38e24a 100644 --- a/sound/soc/codecs/max98927.h +++ b/sound/soc/codecs/max98927.h @@ -255,6 +255,7 @@ struct max98927_priv { struct regmap *regmap; struct snd_soc_component *component; struct max98927_pdata *pdata; + struct gpio_desc *reset_gpio; unsigned int spk_gain; unsigned int sysclk; unsigned int v_l_slot; -- 2.32.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20994C432BE for ; Sun, 29 Aug 2021 17:09:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6FF6760F38 for ; Sun, 29 Aug 2021 17:09:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6FF6760F38 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dnyon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org 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 E139C16DA; Sun, 29 Aug 2021 19:08:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E139C16DA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1630256959; bh=5QaN/XpQgIgjf/BOnDZmch+mx9yG/wxC151DFF3SAUw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pBIezoqHE259RGwacI4uVYt8sX1LA6+KqgJngc4ytbdTCoHCdagMheYPXDSrc2Kir NSjucqIMq1TX6riQjylToPdn51jpTy5q+iNXgZ8d1hkv+ka9H6ALbOc2dhLYbGQxe8 kJlMZuBkQwTFr6r+XJ/kjpJGOT5nuUtoQkJFJGbA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 95A21F804CF; Sun, 29 Aug 2021 19:07:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5F83CF80290; Sun, 29 Aug 2021 19:07:49 +0200 (CEST) Received: from dnyon.com (dnyon.com [82.223.165.189]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D86ABF80269 for ; Sun, 29 Aug 2021 19:07:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D86ABF80269 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=dnyon.com header.i=@dnyon.com header.b="MrLu3+qx" Received: from dnyon.com (45.74.222.87.dynamic.jazztel.es [87.222.74.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dnyon.com (Postfix) with ESMTPSA id C29BC4044F; Sun, 29 Aug 2021 17:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dnyon.com; s=mail; t=1630256851; bh=5QaN/XpQgIgjf/BOnDZmch+mx9yG/wxC151DFF3SAUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MrLu3+qxwhyaRPX9mSVtQxPmegsKs/jpGx1YZ0agQiYw9gcOJUvW71vdfIPyK59t1 ulXVPPP/U+IKLGf/rET7tVINIajX2pjkxIH3N0WYwCAebDRJ8bNn+F/zj+dBce2/Wz tk7DREGoMnMNUrNflfVXor7z3oYpWHIrPGnneGAZD7F2+YdzIEv9y0TckG1jkUAeUs jTCUtIfcTcR03xmisZw37opixzo2BYjFtju2HbLxxeDeHHGrJpvXD24t7NSPI6nBSE PVz7zNhXk0DEzP26wGNSTCywQj/gxEDs0vT4tcYyTXDaQ/NGigry+8EdVWp4l/xIqH w8fPt9qtQbDVw== From: Alejandro Tafalla To: Liam Girdwood , Mark Brown , alsa-devel@alsa-project.org Subject: [PATCH RESEND 1/2] ASoC: max98927: Handle reset gpio when probing i2c Date: Sun, 29 Aug 2021 19:00:16 +0200 Message-Id: <20210829170019.384632-2-atafalla@dnyon.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210829170019.384632-1-atafalla@dnyon.com> References: <20210829170019.384632-1-atafalla@dnyon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Takashi Iwai , Rob Herring , Alejandro Tafalla 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" Drive the reset gpio if defined in the DTS node. Signed-off-by: Alejandro Tafalla --- sound/soc/codecs/max98927.c | 16 ++++++++++++++++ sound/soc/codecs/max98927.h | 1 + 2 files changed, 17 insertions(+) diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index 8b206ee77709..dacf64c4cdf7 100644 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -898,6 +898,22 @@ static int max98927_i2c_probe(struct i2c_client *i2c, return ret; } + max98927->reset_gpio + = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(max98927->reset_gpio)) { + ret = PTR_ERR(max98927->reset_gpio); + dev_err(&i2c->dev, + "Failed to request GPIO reset pin, error %d\n", ret); + return ret; + } + + if (max98927->reset_gpio) { + gpiod_set_value_cansleep(max98927->reset_gpio, 0); + usleep_range(5, 10) + gpiod_set_value_cansleep(max98927->reset_gpio, 1); + usleep_range(1, 5) + } + /* Check Revision ID */ ret = regmap_read(max98927->regmap, MAX98927_R01FF_REV_ID, ®); diff --git a/sound/soc/codecs/max98927.h b/sound/soc/codecs/max98927.h index 05f495db914d..5c04bf38e24a 100644 --- a/sound/soc/codecs/max98927.h +++ b/sound/soc/codecs/max98927.h @@ -255,6 +255,7 @@ struct max98927_priv { struct regmap *regmap; struct snd_soc_component *component; struct max98927_pdata *pdata; + struct gpio_desc *reset_gpio; unsigned int spk_gain; unsigned int sysclk; unsigned int v_l_slot; -- 2.32.0