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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B7D8C433F5 for ; Fri, 8 Oct 2021 05:20:05 +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 8E13161073 for ; Fri, 8 Oct 2021 05:20:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8E13161073 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sholland.org 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 B8A48834EB; Fri, 8 Oct 2021 07:18:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="QWUFNpZi"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="mNwmK8xZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 27121834B5; Fri, 8 Oct 2021 07:18:17 +0200 (CEST) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5A335833AE for ; Fri, 8 Oct 2021 07:17:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=samuel@sholland.org Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 7CE2C580DA4; Fri, 8 Oct 2021 01:17:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 08 Oct 2021 01:17:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=RSHFN2c+teIWB nrJzpSAWXPH7bjjPlGDbze2q0XHCms=; b=QWUFNpZiQrIYSvx1cComUHbOuieIb L6SGQHx0el9Mh8kHMCmb11qEEj6z9fCQBdWcyaPmDv7UtU1TTeuSbKKp6GIup1PA T0MkePVR7ozhzUj/w4K+zsKEOwG8RBi7DHTq89jCPSbDzQSzv/mlry27h7GRJS4f 6GRtx5gVkY7Y/OWe6a0RStA1o7fgrnif2UkhGvkXmPf6vhjacQLdrhagplDvswZo cjmLOQAnRlxwo/e4KYu8IE4AxJutanfw6cp9qSSe+F2GoI/n/vqJdky5VT3V3BSs yGy2PZH2ctUN6ueWM4BWON64Sm2b4dw7zstMvgfmBgLHqgllWx3OjhqNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=RSHFN2c+teIWBnrJzpSAWXPH7bjjPlGDbze2q0XHCms=; b=mNwmK8xZ 1YnCIKp1Q8YOJpKTw64Ajvdm/0Moj/ZdNDZ4ndDGcDpn1CKHIoKghe03Bm65wPy8 DsRdRiAfflWM439cZ19brRTJlbblkBVZUD6VYMsmWXjrptk+aVfZ8GxNWJJyejE1 D3zuOF7WrozgxuIrEwgmFcB3Gtfggu6Uw+rVjaNUwZce80Ih8vFLgQQSnMkMo2To J5HIs/gRyKWRPZyimS2dnNo21xxNFHdszw1TSm9BmFd/Ft9xWujmcR1pngSXa+e5 PqhDqu+m2O56S0FVkqOWtLTQKxTun2ipIwNM/dlEgZQ4Xs5D0bMe4pqPCAfGGfkH k0JxTnaOqZbZrA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudelledgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Oct 2021 01:17:35 -0400 (EDT) From: Samuel Holland To: u-boot@lists.denx.de, Jagan Teki , Andre Przywara Cc: Jaehoon Chung , Heiko Schocher , Samuel Holland , Anatolij Gustschin , Arnaud Ferraris , Bharat Gooty , Igor Opaniuk , Jernej Skrabec , Minkyu Kang , Rayagonda Kokatanur , Simon Glass , Stephan Gerhold , Tim Harvey , Tom Rini Subject: [PATCH v2 03/12] power: pmic: Add a driver for X-Powers AXP PMICs Date: Fri, 8 Oct 2021 00:17:16 -0500 Message-Id: <20211008051725.29401-4-samuel@sholland.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211008051725.29401-1-samuel@sholland.org> References: <20211008051725.29401-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 These PMICs provide some combination of battery charger, fuel gauge, GPIOs, regulators, and VBUS routing. These functions are represented as child nodes in the device tree. Add the minimal driver needed to probe these child devices and provide the DM_PMIC ops. Enable the driver by default for SoCs that normally pair with a PMIC. Signed-off-by: Samuel Holland --- Changes in v2: - Replace axp_pmic_bind() with `.bind = dm_scan_fdt_dev` drivers/power/pmic/Kconfig | 14 ++++++++++++++ drivers/power/pmic/Makefile | 1 + drivers/power/pmic/axp.c | 38 +++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 drivers/power/pmic/axp.c diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig index e8a04325f85..fcb517f1044 100644 --- a/drivers/power/pmic/Kconfig +++ b/drivers/power/pmic/Kconfig @@ -63,6 +63,20 @@ config PMIC_ACT8846 functions. It uses an I2C interface and is designed for use with tablets and smartphones. +config PMIC_AXP + bool "Enable Driver Model for X-Powers AXP PMICs" + depends on DM_I2C + help + This config enables driver-model PMIC uclass features for + X-Powers AXP152, AXP2xx, and AXP8xx PMICs. + +config SPL_PMIC_AXP + bool "Enable Driver Model for X-Powers AXP PMICs in SPL" + depends on SPL_DM_I2C && SPL_DM_PMIC + help + This config enables driver-model PMIC uclass features in the SPL for + X-Powers AXP152, AXP2xx, and AXP8xx PMICs. + config DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC" help diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile index 5250eac12f2..e1922df00f8 100644 --- a/drivers/power/pmic/Makefile +++ b/drivers/power/pmic/Makefile @@ -18,6 +18,7 @@ obj-$(CONFIG_DM_PMIC_SANDBOX) += sandbox.o i2c_pmic_emul.o obj-$(CONFIG_PMIC_AB8500) += ab8500.o obj-$(CONFIG_PMIC_ACT8846) += act8846.o obj-$(CONFIG_PMIC_AS3722) += as3722.o as3722_gpio.o +obj-$(CONFIG_$(SPL_)PMIC_AXP) += axp.o obj-$(CONFIG_PMIC_MAX8997) += max8997.o obj-$(CONFIG_PMIC_PM8916) += pm8916.o obj-$(CONFIG_$(SPL_TPL_)PMIC_RK8XX) += rk8xx.o diff --git a/drivers/power/pmic/axp.c b/drivers/power/pmic/axp.c new file mode 100644 index 00000000000..74c94bdb47b --- /dev/null +++ b/drivers/power/pmic/axp.c @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include +#include +#include + +static int axp_pmic_reg_count(struct udevice *dev) +{ + /* TODO: Get the specific value from driver data. */ + return 0x100; +} + +static struct dm_pmic_ops axp_pmic_ops = { + .reg_count = axp_pmic_reg_count, + .read = dm_i2c_read, + .write = dm_i2c_write, +}; + +static const struct udevice_id axp_pmic_ids[] = { + { .compatible = "x-powers,axp152" }, + { .compatible = "x-powers,axp202" }, + { .compatible = "x-powers,axp209" }, + { .compatible = "x-powers,axp221" }, + { .compatible = "x-powers,axp223" }, + { .compatible = "x-powers,axp803" }, + { .compatible = "x-powers,axp806" }, + { .compatible = "x-powers,axp809" }, + { .compatible = "x-powers,axp813" }, + { } +}; + +U_BOOT_DRIVER(axp_pmic) = { + .name = "axp_pmic", + .id = UCLASS_PMIC, + .of_match = axp_pmic_ids, + .bind = dm_scan_fdt_dev, + .ops = &axp_pmic_ops, +}; -- 2.32.0