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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CDEBC433F5 for ; Mon, 25 Oct 2021 00:38:38 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 353F660F9C for ; Mon, 25 Oct 2021 00:38:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 353F660F9C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 72B15834E0; Mon, 25 Oct 2021 02:38:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id EE438834E0; Mon, 25 Oct 2021 02:38:30 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 61BE583458 for ; Mon, 25 Oct 2021 02:38:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B26A7D6E; Sun, 24 Oct 2021 17:38:24 -0700 (PDT) Received: from slackpad.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 640103F70D; Sun, 24 Oct 2021 17:38:23 -0700 (PDT) Date: Mon, 25 Oct 2021 01:38:19 +0100 From: Andre Przywara To: Samuel Holland Cc: u-boot@lists.denx.de, Jaehoon Chung , Jagan Teki , Igor Opaniuk , Jernej Skrabec , Stephan Gerhold , Tim Harvey Subject: Re: [PATCH 2/4] include: axp_pmic: Include headers for all variants Message-ID: <20211025013819.24c0e220@slackpad.fritz.box> In-Reply-To: <20210822231807.3330-3-samuel@sholland.org> References: <20210822231807.3330-1-samuel@sholland.org> <20210822231807.3330-3-samuel@sholland.org> Organization: Arm Ltd. X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Sun, 22 Aug 2021 18:18:04 -0500 Samuel Holland wrote: > A single DM-based driver should be able to support some feature for > several PMIC variants where the interface is the same. For example, > all PMIC variants use the same register bit to trigger poweroff. > > However, currently only definitions for a single PMIC are available at > a time. This requires drivers to use #ifdefs and different indentifiers > for each variant they support. > > Let's simplify this by making register definitions for all variants > available from the header. Then no preprocessor conditions are needed; > the driver can use the register definition from any variant that > supports the relevant feature. > > An exception is the GPIO-related definitions, which do not use unique > identifiers. So for now, keep them like before. They will be cleaned up > along with the GPIO driver. > > Signed-off-by: Samuel Holland Reviewed-by: Andre Przywara Cheers, Andre > --- > > include/axp152.h | 2 ++ > include/axp209.h | 2 ++ > include/axp221.h | 2 ++ > include/axp809.h | 2 ++ > include/axp818.h | 2 ++ > include/axp_pmic.h | 12 ------------ > 6 files changed, 10 insertions(+), 12 deletions(-) > > diff --git a/include/axp152.h b/include/axp152.h > index c81f172502c..10d845fec42 100644 > --- a/include/axp152.h > +++ b/include/axp152.h > @@ -15,6 +15,7 @@ enum axp152_reg { > #define AXP152_POWEROFF (1 << 7) > > /* For axp_gpio.c */ > +#ifdef CONFIG_AXP152_POWER > #define AXP_GPIO0_CTRL 0x90 > #define AXP_GPIO1_CTRL 0x91 > #define AXP_GPIO2_CTRL 0x92 > @@ -24,3 +25,4 @@ enum axp152_reg { > #define AXP_GPIO_CTRL_INPUT 0x02 /* Input */ > #define AXP_GPIO_STATE 0x97 > #define AXP_GPIO_STATE_OFFSET 0 > +#endif > diff --git a/include/axp209.h b/include/axp209.h > index f4f1b2fe56d..30399a8d621 100644 > --- a/include/axp209.h > +++ b/include/axp209.h > @@ -74,6 +74,7 @@ enum axp209_reg { > #define AXP209_POWEROFF BIT(7) > > /* For axp_gpio.c */ > +#ifdef CONFIG_AXP209_POWER > #define AXP_POWER_STATUS 0x00 > #define AXP_POWER_STATUS_VBUS_PRESENT BIT(5) > #define AXP_GPIO0_CTRL 0x90 > @@ -84,3 +85,4 @@ enum axp209_reg { > #define AXP_GPIO_CTRL_INPUT 0x02 /* Input */ > #define AXP_GPIO_STATE 0x94 > #define AXP_GPIO_STATE_OFFSET 4 > +#endif > diff --git a/include/axp221.h b/include/axp221.h > index caffb910f4b..a02e9b4f645 100644 > --- a/include/axp221.h > +++ b/include/axp221.h > @@ -50,6 +50,7 @@ > #define AXP221_SID 0x20 > > /* For axp_gpio.c */ > +#ifdef CONFIG_AXP221_POWER > #define AXP_POWER_STATUS 0x00 > #define AXP_POWER_STATUS_VBUS_PRESENT (1 << 5) > #define AXP_VBUS_IPSOUT 0x30 > @@ -63,3 +64,4 @@ > #define AXP_GPIO_CTRL_INPUT 0x02 /* Input */ > #define AXP_GPIO_STATE 0x94 > #define AXP_GPIO_STATE_OFFSET 0 > +#endif > diff --git a/include/axp809.h b/include/axp809.h > index 86b29253306..430dbef622b 100644 > --- a/include/axp809.h > +++ b/include/axp809.h > @@ -44,6 +44,7 @@ > #define AXP809_SHUTDOWN_POWEROFF (1 << 7) > > /* For axp_gpio.c */ > +#ifdef CONFIG_AXP809_POWER > #define AXP_POWER_STATUS 0x00 > #define AXP_POWER_STATUS_VBUS_PRESENT (1 << 5) > #define AXP_VBUS_IPSOUT 0x30 > @@ -57,3 +58,4 @@ > #define AXP_GPIO_CTRL_INPUT 0x02 /* Input */ > #define AXP_GPIO_STATE 0x94 > #define AXP_GPIO_STATE_OFFSET 0 > +#endif > diff --git a/include/axp818.h b/include/axp818.h > index b16fe0b1527..8bac6b67ca2 100644 > --- a/include/axp818.h > +++ b/include/axp818.h > @@ -58,6 +58,7 @@ > #define AXP818_SHUTDOWN_POWEROFF (1 << 7) > > /* For axp_gpio.c */ > +#ifdef CONFIG_AXP818_POWER > #define AXP_POWER_STATUS 0x00 > #define AXP_POWER_STATUS_VBUS_PRESENT (1 << 5) > #define AXP_VBUS_IPSOUT 0x30 > @@ -71,3 +72,4 @@ > #define AXP_GPIO_CTRL_INPUT 0x02 /* Input */ > #define AXP_GPIO_STATE 0x94 > #define AXP_GPIO_STATE_OFFSET 0 > +#endif > diff --git a/include/axp_pmic.h b/include/axp_pmic.h > index 2eab18937bc..01ebba63479 100644 > --- a/include/axp_pmic.h > +++ b/include/axp_pmic.h > @@ -9,24 +9,12 @@ > > #include > > -#ifdef CONFIG_AXP152_POWER > #include > -#endif > -#ifdef CONFIG_AXP209_POWER > #include > -#endif > -#ifdef CONFIG_AXP221_POWER > #include > -#endif > -#ifdef CONFIG_AXP305_POWER > #include > -#endif > -#ifdef CONFIG_AXP809_POWER > #include > -#endif > -#ifdef CONFIG_AXP818_POWER > #include > -#endif > > #define AXP_PMIC_MODE_REG 0x3e > #define AXP_PMIC_MODE_I2C 0x00