From patchwork Tue Jan 23 14:13:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 765219 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 330B9C47DDB for ; Tue, 23 Jan 2024 14:14:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8A20D74C; Tue, 23 Jan 2024 15:14:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8A20D74C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1706019276; bh=GaifTXwjrtPwYGxIjA7saixKCJ2NePne3qXb4RkB2PA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=KY4itlx+8Xc8A/JDWvBGsjx1dwaRvroSBNxOWCSYEaD8n2tlS/fd1LGh2VNoWX+64 dHcoyy7jQpXDHsynThO6lGAz0F8sa3iLTEl8pIyva5ucLOUxORmE50Olu0i9QIGuvm x6g3zUnjhmI6P6AQs7hvAHjthODwfbyXZUTFlJic= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E4321F805A9; Tue, 23 Jan 2024 15:13:55 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id D369BF805BD; Tue, 23 Jan 2024 15:13:54 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E66D7F80494; Tue, 23 Jan 2024 15:13:48 +0100 (CET) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5BA1CF8025F for ; Tue, 23 Jan 2024 15:13:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5BA1CF8025F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=uydqCbAt Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-33921b95dddso2126862f8f.1 for ; Tue, 23 Jan 2024 06:13:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706019218; x=1706624018; darn=alsa-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bb9ozaaEJGm3+iYRaS/Eou91hz/HW8vlq47gXO46/QQ=; b=uydqCbAt4npHkXIhAZ6vS8UbYfqRumvsY2uqLGl5GZ/R9H9d83si9GSISmSmrHStqh jnbJ4qvrVb3HVzym/gE9Qsg4PDz5+6utt9nJnVTN7bFdd22o8GGEPLgiCmWMW9K6emDn sT7ecnK6d/w/QWtyJcpZUxd89XuKrOTO86KVh6Avl0nFIoBHD1fybbBqBLl98Qp3aqL3 J1vxG2TzVkvpqmQJn+FNoIrtDJGC1m9taic+bvVY/v3Yl27e/0jNdJ+ischY4t2x205P voxb/1vPP6IKyAwSUEafygIF1BduKF2FOzuEePXRBzA0RbZpT3qaPwARN/PNFjlCg7Zk 77Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706019218; x=1706624018; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bb9ozaaEJGm3+iYRaS/Eou91hz/HW8vlq47gXO46/QQ=; b=VpbiE/DWvyFsYYjXSVdSkXE1DA4zZDUOa5vN0h02onGdvtRPLIGWC0cXrL+wZUE9FF lfB3YCLfYwQzVIIhMPy5ikziYF4y8fap1aepqfcMF76iatF+S7mXC1NLNRY6zefOFBDc 18SJUztPNCWOZupKUhdBds8yDgVRYYaCKCAhamHZkfz6TWHOxvyp0RvBrUQNurc+et1A XZoGP2DYYe/ee+dg5kwa+HQ5WEL4cIClY0waYV4Gnrt1AqIACjuW7bUBF1ecKBLpkk1H IPJKCEKXRdU1EZxnh2XEMbsIlWv5ijjrI8o+SLXkBxC2DkkYGY5WmqCuqE6sDdH9Wcz/ RAyw== X-Gm-Message-State: AOJu0YzsX/sVsxWM2FI6bamVjysjs2cmxxKnbY3iFBDz0Y1WLRdCcxWq nisXXQ924ZDH3pFoGsH0dm/CD7S+hQ/ot3ggBWd2Mqv2haWYsYSVosnYk1ESb0U= X-Google-Smtp-Source: AGHT+IGTxU9A6hZE3T/GfJ3iQs+U7hHMUT7YMZ5antPynbwk/2dJ9MwRblLpOb1YR4bjPYZyBsdj2g== X-Received: by 2002:a5d:5602:0:b0:337:c097:db99 with SMTP id l2-20020a5d5602000000b00337c097db99mr3351685wrv.21.1706019218190; Tue, 23 Jan 2024 06:13:38 -0800 (PST) Received: from krzk-bin.. ([178.197.215.66]) by smtp.gmail.com with ESMTPSA id r8-20020adfe688000000b00337d97338b0sm12132298wrm.76.2024.01.23.06.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 06:13:37 -0800 (PST) From: Krzysztof Kozlowski To: Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , "Rafael J. Wysocki" , Viresh Kumar , Frank Rowand , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH v4 2/6] cpufreq: do not open-code of_phandle_args_equal() Date: Tue, 23 Jan 2024 15:13:07 +0100 Message-Id: <20240123141311.220505-3-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123141311.220505-1-krzysztof.kozlowski@linaro.org> References: <20240123141311.220505-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Message-ID-Hash: FSS3GTTHFAAAPHUSC7EJOYQI4WKJS27C X-Message-ID-Hash: FSS3GTTHFAAAPHUSC7EJOYQI4WKJS27C X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Use newly added of_phandle_args_equal() helper to compare two of_phandle_args. Signed-off-by: Krzysztof Kozlowski Acked-by: Viresh Kumar --- Depends on previous of change. --- include/linux/cpufreq.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index afda5f24d3dd..3cd06dafb04b 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -1149,8 +1149,7 @@ static inline int of_perf_domain_get_sharing_cpumask(int pcpu, const char *list_ if (ret < 0) continue; - if (pargs->np == args.np && pargs->args_count == args.args_count && - !memcmp(pargs->args, args.args, sizeof(args.args[0]) * args.args_count)) + if (of_phandle_args_equal(pargs, &args)) cpumask_set_cpu(cpu, cpumask); of_node_put(args.np); From patchwork Tue Jan 23 14:13:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 765217 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 1FC7DC47258 for ; Tue, 23 Jan 2024 14:15:54 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 70C397F1; Tue, 23 Jan 2024 15:15:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 70C397F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1706019352; bh=NVwcdnW8A7XQhpx5K/4jQMW8pILNh3MbaRAEeStWSEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=CEQvZcJt+c3w3W0mYhqrHJ57uglhdy27g4cS+StY7yqNZ+sqUfNb30BHBd5Eb91kE xJ6BAP/fDAz1N0PzDiM1NyqD/hKZWpP7din6PPXzIzWP5RM0q39qQ5WDl2380Ra1Tk ov8xMfth1BQW5ii9OHs3452nNUpU19ftU2ufM2i0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C2066F80685; Tue, 23 Jan 2024 15:14:09 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id CAB73F80681; Tue, 23 Jan 2024 15:14:08 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 36DAAF80601; Tue, 23 Jan 2024 15:14:02 +0100 (CET) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7CDF6F8028D for ; Tue, 23 Jan 2024 15:13:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7CDF6F8028D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=onHUqish Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3394446205dso556438f8f.1 for ; Tue, 23 Jan 2024 06:13:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706019221; x=1706624021; darn=alsa-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hZ+XlfeIIIA0X9gDeF4vw53ttOCM6tywn9BtgTzvNSE=; b=onHUqish2mJ5/HFIcNFdyXwx2RC0yhIYqAQvt1JGOURrSy+gyAfF8O1Coa4ud1JS1V odH6O+w8WLOUHSe+4MkKpWzXdK1DxB7rJWEOZ4caxjkW6rBiBQmsEOv04x6Jj1PE7Q5r 4K3SUIQY0V9vXQyi2q9KrsZ4U5bNs7EjiVef5F/BTyBgGLP410w6FDNGYhN+d4WAVeUp sYdoRwHlWiidp88kOU6g9fz8jgejtCetITZPoFFV6D0jJYk/aD6+4m6Fuc7toxTcko4j XrLpDG2O6j68xUD2d6g9JOh4Qc8yAq5PtimDfK9AnyX3VprZ0NQVo/dC2CbTUKzI7KA1 h1Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706019221; x=1706624021; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hZ+XlfeIIIA0X9gDeF4vw53ttOCM6tywn9BtgTzvNSE=; b=UYTiW1i9JJQdLajujtb831b7QGJzPxPviizoJ8pTvDnmGL2pYjj452WLI4ji6TbHcY 0f5wMq028wva52BrFIJGkZeN2HEA96MEA+oUGVprXWsGPIxkwjpuJELUGHsbAAfkk3Jz HIBa66nT2PozWthAf1XJTygzA3LS+8QK8fdaPJfS1675Qo/WWO8JeI7fml54jCo89Pym qlMUMFGL61PnlJcYxyEpaiuYVe/K0yLvg7fOWscYZ4Hm2cNLti4UhmbWU3qA4IE50AF/ OxGLOqqfD5tL6odL4Ifa7pHAXO4Ol0vDNVg1cMBzJZyJ5rbmuB9w1PN71SiD1LPccLfm EaZw== X-Gm-Message-State: AOJu0YyTrILOHrw7YHHaB38/cane3VQdknl24v8ff/IRsl7oJ1f732q0 iX2dIkPdRqCV+itSD/8Jh8GVDtKgeDwY6n9SpkqOo2ExKTyj6j8obzLVnmpFSmY= X-Google-Smtp-Source: AGHT+IFJFWPu76S6gHvdSkY1vfHWoNhHpVQG3bfuyj+J1jZ0/kt862RTki/VH3/oeUqsKjwwEp2BRA== X-Received: by 2002:a5d:5886:0:b0:337:9b43:bb4e with SMTP id n6-20020a5d5886000000b003379b43bb4emr4085614wrf.74.1706019220784; Tue, 23 Jan 2024 06:13:40 -0800 (PST) Received: from krzk-bin.. ([178.197.215.66]) by smtp.gmail.com with ESMTPSA id r8-20020adfe688000000b00337d97338b0sm12132298wrm.76.2024.01.23.06.13.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 06:13:40 -0800 (PST) From: Krzysztof Kozlowski To: Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , "Rafael J. Wysocki" , Viresh Kumar , Frank Rowand , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Krzysztof Kozlowski , Bartosz Golaszewski , Chris Packham , Sean Anderson , Bartosz Golaszewski Subject: [PATCH v4 3/6] reset: gpio: Add GPIO-based reset controller Date: Tue, 23 Jan 2024 15:13:08 +0100 Message-Id: <20240123141311.220505-4-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123141311.220505-1-krzysztof.kozlowski@linaro.org> References: <20240123141311.220505-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Message-ID-Hash: SJUI4NSROMADGAWZJ2O7REJRCHBLILM2 X-Message-ID-Hash: SJUI4NSROMADGAWZJ2O7REJRCHBLILM2 X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add a simple driver to control GPIO-based resets using the reset controller API for the cases when the GPIOs are shared and reset should be coordinated. The driver is expected to be used by reset core framework for ad-hoc reset controllers. Cc: Bartosz Golaszewski Cc: Chris Packham Cc: Sean Anderson Reviewed-by: Bartosz Golaszewski Signed-off-by: Krzysztof Kozlowski --- MAINTAINERS | 5 ++ drivers/reset/Kconfig | 9 +++ drivers/reset/Makefile | 1 + drivers/reset/reset-gpio.c | 119 +++++++++++++++++++++++++++++++++++++ 4 files changed, 134 insertions(+) create mode 100644 drivers/reset/reset-gpio.c diff --git a/MAINTAINERS b/MAINTAINERS index ddc5e1049921..91d45c6bade7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8905,6 +8905,11 @@ F: Documentation/i2c/muxes/i2c-mux-gpio.rst F: drivers/i2c/muxes/i2c-mux-gpio.c F: include/linux/platform_data/i2c-mux-gpio.h +GENERIC GPIO RESET DRIVER +M: Krzysztof Kozlowski +S: Maintained +F: drivers/reset/reset-gpio.c + GENERIC HDLC (WAN) DRIVERS M: Krzysztof Halasa S: Maintained diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index ccd59ddd7610..bb1b5a326eb7 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -66,6 +66,15 @@ config RESET_BRCMSTB_RESCAL This enables the RESCAL reset controller for SATA, PCIe0, or PCIe1 on BCM7216. +config RESET_GPIO + tristate "GPIO reset controller" + help + This enables a generic reset controller for resets attached via + GPIOs. Typically for OF platforms this driver expects "reset-gpios" + property. + + If compiled as module, it will be called reset-gpio. + config RESET_HSDK bool "Synopsys HSDK Reset Driver" depends on HAS_IOMEM diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index 8270da8a4baa..fd8b49fa46fc 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o obj-$(CONFIG_RESET_BRCMSTB) += reset-brcmstb.o obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o +obj-$(CONFIG_RESET_GPIO) += reset-gpio.o obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o obj-$(CONFIG_RESET_IMX7) += reset-imx7.o obj-$(CONFIG_RESET_INTEL_GW) += reset-intel-gw.o diff --git a/drivers/reset/reset-gpio.c b/drivers/reset/reset-gpio.c new file mode 100644 index 000000000000..2290b25b6703 --- /dev/null +++ b/drivers/reset/reset-gpio.c @@ -0,0 +1,119 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include +#include +#include +#include +#include + +struct reset_gpio_priv { + struct reset_controller_dev rc; + struct gpio_desc *reset; +}; + +static inline struct reset_gpio_priv +*rc_to_reset_gpio(struct reset_controller_dev *rc) +{ + return container_of(rc, struct reset_gpio_priv, rc); +} + +static int reset_gpio_assert(struct reset_controller_dev *rc, unsigned long id) +{ + struct reset_gpio_priv *priv = rc_to_reset_gpio(rc); + + gpiod_set_value_cansleep(priv->reset, 1); + + return 0; +} + +static int reset_gpio_deassert(struct reset_controller_dev *rc, + unsigned long id) +{ + struct reset_gpio_priv *priv = rc_to_reset_gpio(rc); + + gpiod_set_value_cansleep(priv->reset, 0); + + return 0; +} + +static int reset_gpio_status(struct reset_controller_dev *rc, unsigned long id) +{ + struct reset_gpio_priv *priv = rc_to_reset_gpio(rc); + + return gpiod_get_value_cansleep(priv->reset); +} + +static const struct reset_control_ops reset_gpio_ops = { + .assert = reset_gpio_assert, + .deassert = reset_gpio_deassert, + .status = reset_gpio_status, +}; + +static int reset_gpio_of_xlate(struct reset_controller_dev *rcdev, + const struct of_phandle_args *reset_spec) +{ + return reset_spec->args[0]; +} + +static void reset_gpio_of_node_put(void *data) +{ + of_node_put(data); +} + +static int reset_gpio_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct of_phandle_args *platdata = dev_get_platdata(dev); + struct reset_gpio_priv *priv; + int ret; + + if (!platdata) + return -EINVAL; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + platform_set_drvdata(pdev, &priv->rc); + + priv->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(priv->reset)) + return dev_err_probe(dev, PTR_ERR(priv->reset), + "Could not get reset gpios\n"); + + priv->rc.ops = &reset_gpio_ops; + priv->rc.owner = THIS_MODULE; + priv->rc.dev = dev; + priv->rc.of_args = platdata; + ret = devm_add_action_or_reset(dev, reset_gpio_of_node_put, + priv->rc.of_node); + if (ret) + return ret; + + /* Cells to match GPIO specifier, but it's not really used */ + priv->rc.of_reset_n_cells = 2; + priv->rc.of_xlate = reset_gpio_of_xlate; + priv->rc.nr_resets = 1; + + return devm_reset_controller_register(dev, &priv->rc); +} + +static const struct platform_device_id reset_gpio_ids[] = { + { .name = "reset-gpio", }, + {} +}; +MODULE_DEVICE_TABLE(platform, reset_gpio_ids); + +static struct platform_driver reset_gpio_driver = { + .probe = reset_gpio_probe, + .id_table = reset_gpio_ids, + .driver = { + .name = "reset-gpio", + }, +}; +module_platform_driver(reset_gpio_driver); + +MODULE_AUTHOR("Krzysztof Kozlowski "); +MODULE_DESCRIPTION("Generic GPIO reset driver"); +MODULE_LICENSE("GPL"); From patchwork Tue Jan 23 14:13:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 765218 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 A6F44C47DDB for ; Tue, 23 Jan 2024 14:15:20 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9B1BEE68; Tue, 23 Jan 2024 15:15:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9B1BEE68 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1706019318; bh=oMxlIYU8lOKLFt0TEL5h53mUDoaj/hO9QDpO+Y17nsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=HGT5epXI/6k+xFk03sBeuGa7zKxEUa5rA2JK9ALs6gh3c8Mb3YHem+S5ck2cbN3iY MaNRLRxUxY4qEhYOrtU9q9908Mu6C5ltm9LL9YV9KhQ1VT/jquAcWb3Mdux19HTaSG 6orgckVhR0e+T3swKB8Fn/mkbX7l08NMcGsTFccI= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3EFF4F80623; Tue, 23 Jan 2024 15:14:03 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id B34E9F80618; Tue, 23 Jan 2024 15:14:02 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3C682F8057B; Tue, 23 Jan 2024 15:13:53 +0100 (CET) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D323EF80149 for ; Tue, 23 Jan 2024 15:13:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D323EF80149 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=uTBhya6G Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-337d99f9cdfso3862336f8f.0 for ; Tue, 23 Jan 2024 06:13:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706019226; x=1706624026; darn=alsa-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qG0lQDgeayG/ZAaWGjl028iUARha7B2YZJgs2y6qJ/U=; b=uTBhya6GFfbuWhN1DGsgqfq2JjRTSTKVc3TAWrDncxTaKRkw+kA6BYBNymuBVWNj1P 7QfqiFm7CswyolaBVeDIVugOXptvWm/3Oj4rePm4fwcM83+JmNfHIS0hE52NO/XnrLsH QLcJbgJTTjYe6iPsUgqBFoqyLy8keDako8qbpeMy6wdU+/Xj7rzc4U2mw4sYoUc0YdXv av6MXpKyIe2/nuy48CWA/PV5nfp/8K071VgAwcYuMm4xadyRNrusyAC6RIpnjf+I80Kd zddBuBWNY7MJZmqIryBHXD4jgKOzYkdtl2TrJeWqLhHAb6Z/nl2m2uSDZVm7zLNQwk3g x0Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706019226; x=1706624026; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qG0lQDgeayG/ZAaWGjl028iUARha7B2YZJgs2y6qJ/U=; b=urHnMt8GbbY4v8ztvp8l3TJH660Jb9nBQyXBvpX0GyxS6ypTUa/gptY2twGi2pKSBg 9IMuELRzORlMCrxfns3sqdOVAV0KCJHEYmF21CFqu36PU03ySmTWN05mBSrYtQ6KmJAG AOyojSnJ0HqTYtOsUGk8OmB8Pp+PS3W64KoX7MD3vWCxkePdK2skB5MB4jpEKNPy4NKd goDxB4Hna4nPTx3+stZjGrazA74/W+X1Nn1Q5P1avXUzIPyZ798KOYN3uzzSacJg7HbB Rr0pJBsUaLWtpM7hg45jP3XSsX/STqRNN1tl1zqnESofcmZt7pjfSC33IxfeR+SRCevB 4OWA== X-Gm-Message-State: AOJu0YxdUY6/9m+OqI2tYJUk56sXfuUCyH639zTYCDA+p2d2Vtf/Knyk I3u+n2hz6MssmUq7dc3QsGNFODVj1OWkT5z1IDTrYvA2X/0Ntk2l4tVlebeN28c= X-Google-Smtp-Source: AGHT+IHqKV7UxmdKdHe6zjaK7RBNZnRE3p6gqEa/c3ykA6FNDvoSpVZjiP8ZtDmiAEKBeFc7P6DV7A== X-Received: by 2002:a05:6000:100a:b0:337:c81e:cdb0 with SMTP id a10-20020a056000100a00b00337c81ecdb0mr2955862wrx.104.1706019226510; Tue, 23 Jan 2024 06:13:46 -0800 (PST) Received: from krzk-bin.. ([178.197.215.66]) by smtp.gmail.com with ESMTPSA id r8-20020adfe688000000b00337d97338b0sm12132298wrm.76.2024.01.23.06.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 06:13:46 -0800 (PST) From: Krzysztof Kozlowski To: Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , "Rafael J. Wysocki" , Viresh Kumar , Frank Rowand , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Krzysztof Kozlowski , Bartosz Golaszewski , Sean Anderson , Rob Herring Subject: [PATCH v4 5/6] ASoC: dt-bindings: qcom,wsa8840: Add reset-gpios for shared line Date: Tue, 23 Jan 2024 15:13:10 +0100 Message-Id: <20240123141311.220505-6-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123141311.220505-1-krzysztof.kozlowski@linaro.org> References: <20240123141311.220505-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Message-ID-Hash: L2WCB34BTJSFNQNBZQQ5ZYDBMUZ2QCDL X-Message-ID-Hash: L2WCB34BTJSFNQNBZQQ5ZYDBMUZ2QCDL X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On newer Qualcomm platforms, like X1E80100-CRD, the WSA884x speakers share SD_N GPIOs between two speakers, thus a coordinated assertion is needed. Linux supports handling shared GPIO lines through "reset-gpios" property, thus allow specifying either powerdown or reset GPIOs (these are the same). Cc: Bartosz Golaszewski Cc: Sean Anderson Acked-by: Rob Herring Signed-off-by: Krzysztof Kozlowski --- If previous patches are fine, then this commit is independent and could be taken via ASoC. --- .../devicetree/bindings/sound/qcom,wsa8840.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml b/Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml index d717017b0fdb..22798d22d981 100644 --- a/Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml +++ b/Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml @@ -28,6 +28,10 @@ properties: description: Powerdown/Shutdown line to use (pin SD_N) maxItems: 1 + reset-gpios: + description: Powerdown/Shutdown line to use (pin SD_N) + maxItems: 1 + '#sound-dai-cells': const: 0 @@ -37,11 +41,16 @@ properties: required: - compatible - reg - - powerdown-gpios - '#sound-dai-cells' - vdd-1p8-supply - vdd-io-supply +oneOf: + - required: + - powerdown-gpios + - required: + - reset-gpios + unevaluatedProperties: false examples: