Received: by 10.223.185.116 with SMTP id b49csp5441281wrg; Tue, 27 Feb 2018 13:26:21 -0800 (PST) X-Google-Smtp-Source: AH8x2243CS77yauOsYBsaW3eF6Vn23FwCWFqAbn40oBsiMSBE97pmgFQDZp1ZxOheovoZAvEoLlP X-Received: by 10.101.65.131 with SMTP id a3mr12166457pgq.270.1519766780968; Tue, 27 Feb 2018 13:26:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519766780; cv=none; d=google.com; s=arc-20160816; b=Bmm5RpNvuK7zY1yV3069nR4TG0anSJn/3l7678a7ym9YXMVc0EpK5uz3NVzujSFxwq 7O7kQA/mSjnbSByxHniOJLPcsyWonCLEOe9shNvjFhokf8fJwJdJAGjFo7RgeVsnBHmG XsQ4F0RG9W4Fr127kkO4w+97YdQmDDKJih9zcnjiNNEMhEtWDAaMcNdoi43QrTYEPdPm eYuTyHAK0buAbAAvjg/V9hmYbAHIxkzX4lAOUzPM63MWYR30y4ET8O789Fqd89MgoGNI dZ44Wy9hK+A/mbOxA5F4hs+KmmiGwBib9G8kUE2p97lOx6eHYFXt1uK8zN/N9mL8Ejm7 4uTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=jJV8t98wYgy/AWl7M15ZBd2wBcyebvMrFkPgyRVJzlU=; b=IsoI4krB5t180fUm4/Y9RbmUh3puiUWRiG71q0nI/wOY/xpV9mxewCs7NqKx9ZfaUR yXg0Ltm5429Cfo7S4Cz111kpVb+YB+a4pF9NxnkFY+Yy1+LlbiTQ8oF88Gb5Cdpa2Nl0 0KXQAcbnaQnBrq/OFQ+SfAnP4bB9YGAR4BqAyuJgUqQ+4d27Fx/gdvVcj9lZEUqL3adI DAXHM/3j6LBztoWFHwdtlytIJ+GGSwGxPzbQkn5HHfHSZzFLkjxRvEhpPnCuZprY9+nD DGAxHyUgMooeJCAA7kM5aQWnPkfM41CRg1pWFzGk3cSiXXdOdHyCrXxkrXQIMRLD/ay/ 9ReA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si52354pgo.153.2018.02.27.13.26.05; Tue, 27 Feb 2018 13:26:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751550AbeB0VZR (ORCPT + 99 others); Tue, 27 Feb 2018 16:25:17 -0500 Received: from mail.bootlin.com ([62.4.15.54]:39287 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751901AbeB0VZM (ORCPT ); Tue, 27 Feb 2018 16:25:12 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 325A9208C9; Tue, 27 Feb 2018 22:25:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from dell-desktop.home (vol75-h03-176-137-37-244.dsl.sta.abo.bbox.fr [176.137.37.244]) by mail.bootlin.com (Postfix) with ESMTPSA id 47FA62087A; Tue, 27 Feb 2018 22:24:59 +0100 (CET) From: =?UTF-8?q?Myl=C3=A8ne=20Josserand?= To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, perex@perex.cz, tiwai@suse.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mylene.josserand@bootlin.com, alexandre.belloni@bootlin.com, thomas.petazzoni@bootlin.com Subject: [PATCH v1 3/4] ASoC: codecs: pcm179x: Add reset gpio Date: Tue, 27 Feb 2018 22:24:32 +0100 Message-Id: <20180227212433.2189-4-mylene.josserand@bootlin.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180227212433.2189-1-mylene.josserand@bootlin.com> References: <20180227212433.2189-1-mylene.josserand@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a reset gpio to be able to reset this line at startup. Signed-off-by: Mylène Josserand --- sound/soc/codecs/pcm179x.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sound/soc/codecs/pcm179x.c b/sound/soc/codecs/pcm179x.c index 2285a51ff9e9..0242dfd67b53 100644 --- a/sound/soc/codecs/pcm179x.c +++ b/sound/soc/codecs/pcm179x.c @@ -22,6 +22,8 @@ #include #include +#include +#include #include #include #include @@ -106,6 +108,7 @@ struct pcm179x_private { struct regmap *regmap; unsigned int format; unsigned int rate; + int reset; }; static int pcm179x_set_dai_fmt(struct snd_soc_dai *codec_dai, @@ -381,6 +384,8 @@ int pcm179x_common_init(struct device *dev, struct regmap *regmap, enum pcm17xx_type type) { struct pcm179x_private *pcm179x; + struct device_node *np = dev->of_node; + int ret; pcm179x = devm_kzalloc(dev, sizeof(struct pcm179x_private), GFP_KERNEL); @@ -390,6 +395,21 @@ int pcm179x_common_init(struct device *dev, struct regmap *regmap, pcm179x->regmap = regmap; dev_set_drvdata(dev, pcm179x); + pcm179x->reset = of_get_named_gpio(np, "reset-gpios", 0); + if (gpio_is_valid(pcm179x->reset)) { + ret = devm_gpio_request_one(dev, pcm179x->reset, + GPIOF_OUT_INIT_LOW, + "pcm179x reset"); + if (ret) { + dev_err(dev, + "Failed to request GPIO %d as reset pin, error %d\n", + pcm179x->reset, ret); + return ret; + } + + gpio_set_value(pcm179x->reset, 1); + } + if (type == PCM1789) return devm_snd_soc_register_component(dev, &soc_component_dev_pcm1789, -- 2.11.0