Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3494308pxb; Mon, 30 Aug 2021 03:49:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzffmriisNuXZYcjQljMfnsbHe4biI2ub4/jJSA6prGKytG2HyNwtiAMz37D9VfSy/te22W X-Received: by 2002:a5d:9e09:: with SMTP id h9mr17895064ioh.164.1630320549453; Mon, 30 Aug 2021 03:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630320549; cv=none; d=google.com; s=arc-20160816; b=f7+S2628Y9qPOPbkHUjDtFe2F+GMAOdS4LiV0bGbyqqnokuRkXInYz/zEvIqmon3As SGiNnBOGJJ5eFU96Dqt1NLqx+NMBpmpv668izmGKoITt1ZkO0vGty/jWghF9e81tJpd6 Kjq9LkDIg7cQc6TpsfplsDv5T32zG5Ctg3GHEymQauAziuBg6sUEZzGgojsY5R58Xw1g hVHECfadXchbFxtcSiFTUzzHEIt5TCs88Bx5Bf00bmhC3EGfYBp8PzCTYkwnx6DyvMwS ACItDhsge5e+nZsZ57ZmXLwNO/ywk1l0QFA3U8fjDXPuozbvc4bbOCznnKurqVvj9Q9t gD2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=A09LSDtEY5SmffjGC/hd4Di2ejbKzPyVF1fSrVR4y9o=; b=r+MnkV+3bzeSZfGyGOA6eUSZF83eeI2W1qaChQ2WC8CuZf2iFukS4xRMSyqmgK0Iyb XfpoyXMhzAHXaFd441BHKFm5Kejnxy6GyiLyXl1beuRe1qm9iEzylxvrga60S4dAUMoW JMhCxdHoz6vg7oTs8QF6Gdm/hsuLZVNulz25B/0jSdfX7xiLwcwav8ZGdcCr0NB05I0n Bb7ueYDyeljELeslUmtYLGDo+b7xVTJaX1khQ+Zt4eZ2QA3ySrItaZMorYYfyuh6bQWO S/0mGUd6AiNq/CJIgcYlBSyCFhLEPaKcGL3kPkZZ29q/GselhFSRn2+WU+0D9KK2i86S xI0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dnyon.com header.s=mail header.b=E2mfoS8g; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si14195945jao.24.2021.08.30.03.48.58; Mon, 30 Aug 2021 03:49:09 -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=@dnyon.com header.s=mail header.b=E2mfoS8g; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236394AbhH3KtL (ORCPT + 99 others); Mon, 30 Aug 2021 06:49:11 -0400 Received: from dnyon.com ([82.223.165.189]:56220 "EHLO dnyon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236380AbhH3KtJ (ORCPT ); Mon, 30 Aug 2021 06:49:09 -0400 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 AB0E24044F; Mon, 30 Aug 2021 10:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dnyon.com; s=mail; t=1630320493; bh=t0sArD8RpMG3ILMbA97+7fmkKdN7C7bsh9csIcYpttI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E2mfoS8gdyXLMY3r3u7GbvheW78qI8B1nzDUjXmhyEVsryiiC0Ut2aNmCVEmtO9H8 9JRtwr4Pv+TBI1yW+afpkD5Mk9hYSv27yOW1FKFx67TpfLueJ4w6trEHgDZC3z8UN5 HKtNoOWxnQYVBREwEPkICzIm5qniIlWFVrWUAXw4J53Snuj0oxBu1E8MZBoQTmx55M ESmErt0iP7kZVDWM41eiz9SSKtZqpkPnL5wGVIqteCpz/01oK+ssFA5oQhbMJoHl2O sI9yuam5L1We5TKRgHj79dBF22C3224EgYymHieHlSB9k+8I+n+9/bIuwPdl5u0Vci Uatywb8bjuQrA== From: Alejandro Tafalla To: Liam Girdwood , Mark Brown , Andy Shevchenko , 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 v2 1/2] ASoC: max98927: Handle reset gpio when probing i2c Date: Mon, 30 Aug 2021 12:44:23 +0200 Message-Id: <20210830104426.487246-2-atafalla@dnyon.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210830104426.487246-1-atafalla@dnyon.com> References: <20210830104426.487246-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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index 8b206ee77709..84a159de4b26 100644 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -868,6 +868,7 @@ static int max98927_i2c_probe(struct i2c_client *i2c, int ret = 0, value; int reg = 0; struct max98927_priv *max98927 = NULL; + struct gpio_desc *reset_gpio; max98927 = devm_kzalloc(&i2c->dev, sizeof(*max98927), GFP_KERNEL); @@ -898,6 +899,20 @@ static int max98927_i2c_probe(struct i2c_client *i2c, return ret; } + reset_gpio + = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(reset_gpio)) { + ret = PTR_ERR(reset_gpio); + return dev_err_probe(&i2c->dev, ret, + "failed to request GPIO reset pin"); + } + + if (reset_gpio) { + usleep_range(8000, 10000); + gpiod_set_value_cansleep(reset_gpio, 1); + usleep_range(1000, 5000); + } + /* Check Revision ID */ ret = regmap_read(max98927->regmap, MAX98927_R01FF_REV_ID, ®); -- 2.32.0