From patchwork Fri Aug 2 19:20:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 13751898 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D568DC3DA7F for ; Fri, 2 Aug 2024 19:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=QvMGvJoG9kOmjhl8+GRwEU8yfqrtre7GVJ2bwQWQCa4=; b=GR1VpeofdVI71TbrOBILRhlHov D2tFyzg9snhCc2y5xXpooTcA085cG08WA8OrVdgQVvG6wWLQz8SR3S6Jh0mQypBlsrWmWpB7kVJq+ 5ZXVzl5Ca35gcv6olPub6tRWpBxMimfgbrenCX/1N4sXWy8xvsgO2bEiXjW4pGH3uycTOUpbKv1ku gi5zE0JVzZWpR+va/kEXlRqVHezbhE4LCAu4RFQqgkgMCkf0rUybNrZm/fUj0XfHaqwdzbsTSXJei Vu5EKNk79YS5xNtQFc4yvAQVQlGl6+N+9V5y2J5DhP+WlBZqW5n+lVZQ+ahAmwPD9sn6ezDO7IJpx nHznO6eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZxs2-00000009qeo-3nU8; Fri, 02 Aug 2024 19:23:22 +0000 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZxrX-00000009qWb-0UDV for linux-arm-kernel@lists.infradead.org; Fri, 02 Aug 2024 19:22:52 +0000 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3db1eb76702so5454094b6e.0 for ; Fri, 02 Aug 2024 12:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722626569; x=1723231369; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QvMGvJoG9kOmjhl8+GRwEU8yfqrtre7GVJ2bwQWQCa4=; b=kSy5TQcYI+OPAuXL+GJwTFBjobhh1F8CnUt0vuwypg84jRMbUdcnncjW931cG9VFKT EP2E3785GyvkJbjR/jpF7+ifHI+x2bom0Boa7iZ7iPMH7yWXyRlmvwyZ9gh/U+VkZpTl 3H1qPg5gauAIQrY1tSsQPnyuW0jNtFTmO6o1v1ja9pUnT1PRQtPi3/TSE2zjS2PFHPdU ntAmkgziF+wi5bPw8QC2r9Pc3Gx684PGMX1OwMx0ahhU0hUVsbdQBbVvubueaaj5PT6c uUH2zWUtc8onBOZcoxm+RSMVyIP3eK+4TZPFuKDxboHQjK/pTD/sKgx/tI62/lfUJ5Yg go1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722626569; x=1723231369; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QvMGvJoG9kOmjhl8+GRwEU8yfqrtre7GVJ2bwQWQCa4=; b=Wm6YYBvozdzpW2tCU5zvE3CzeGOAJFHXpBScniZy09DHRBEW+T90IDuRKG1jhUktGn iUTlR95AMXEu/jE82j8vw1W3iKo+FPtD8WLAWrFwcyPtHzDx5MJ18QPgHVTCuWOO4Op5 cwHbtRP2I0kW0pRh+zD2ikUgc8QHGOAcNJmqGvk/NQcQ5yXeTw+NC+LBm7RyYxlI73wV VmimO+Q4v0TjIQI3zjndrYTh4tsVp4hnlZVYuBKP3EHlGWna3ezcsw3mG9PcDhmH86CN O2Nmt4UgikPJsCFUZZFRY4+N1us1g0t+vJYU2A8GaamY0zPetvV9H5i5mrQ5CtCWTvo+ wHzg== X-Forwarded-Encrypted: i=1; AJvYcCV/Xzl+6G5TJdLoAnvk7ZO5QcDfMKRb0HGbYmM2hD04H4JvGmPvCQoY66MIz20Voazad+xJolSdXcCIUsbQ9ZwpNleL+ZjIM7QHFlESQKRuKkvJ/Qo= X-Gm-Message-State: AOJu0YzAqA1j0ew1ogtV56ozpe1Dhr9NpsCbm46V1GY2jA/7u3dtzzQV gReK2isqnSpbGca/ToMCFqELWirk9aDQDj1Sd+DBq4LR5zc2UlkJ X-Google-Smtp-Source: AGHT+IE97Nhw575gDhtEqYkjlJLadE6szPpld+kIQm5cznFCVLtAkB1/xcfs0mJhHPLUrFXlBjqmiw== X-Received: by 2002:a05:6808:bc6:b0:3da:a48b:d1e6 with SMTP id 5614622812f47-3db5580a11amr6332227b6e.16.1722626569544; Fri, 02 Aug 2024 12:22:49 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:fb0:1bcf::54]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db563b7065sm584592b6e.46.2024.08.02.12.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 12:22:49 -0700 (PDT) From: Chris Morgan To: linux-sunxi@lists.linux.dev Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, quentin.schulz@free-electrons.com, mripard@kernel.org, tgamblin@baylibre.com, aidanmacdonald.0x0@gmail.com, u.kleine-koenig@pengutronix.de, lee@kernel.org, samuel@sholland.org, jernej.skrabec@gmail.com, sre@kernel.org, wens@csie.org, conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org, lars@metafoo.de, jic23@kernel.org, Chris Morgan Subject: [PATCH V2 00/15] Add Battery and USB Supply for AXP717 Date: Fri, 2 Aug 2024 14:20:11 -0500 Message-Id: <20240802192026.446344-1-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240802_122251_184930_36DC5A2F X-CRM114-Status: GOOD ( 15.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Chris Morgan Add support for monitoring the USB charger and battery charger on the AXP717 PMIC. This required some driver refactoring of the axp20x USB and battery charger as the AXP717 is somewhat different but can still benefit from some common elements. Note that as of now the charging current now value may be incorrect as the scale and offsets were not documented in the datasheet. I suspect the scale is 1 and the offset is somewhere around 450mA though. Changes from V1: - Refactored against mainline to remove BOOST pre-requisite. - Corrected commit subjects for DT bindings. - Split refactoring and AXP717 support into different patches. - Added IRQ for VBUS over voltage. There appears to be a bug with the VBUS fault IRQ because it is assigned IRQ num 0. - Corrected battery driver to report POWER_SUPPLY_PROP_VOLTAGE_MIN and POWER_SUPPLY_PROP_VOLTAGE_MAX instead of *_DESIGN. Chris Morgan (15): iio: adc: axp20x_adc: Add adc_en1 and adc_en1 to axp_data power: supply: axp20x_battery: Remove design from min and max voltage power: supply: axp20x_battery: Make iio and battery config per device power: supply: axp20x_usb_power: Make VBUS and IIO config per device dt-bindings: power: supply: axp20x: Add input-current-limit-microamp power: supply: axp20x_usb_power: add input-current-limit-microamp dt-bindings: power: supply: axp20x-battery: Add monitored-battery dt-bindings: iio: adc: Add AXP717 compatible dt-bindings: power: supply: axp20x: Add AXP717 compatible dt-bindings: power: supply: axp20x: Add AXP717 compatible mfd: axp20x: Add ADC, BAT, and USB cells for AXP717 iio: adc: axp20x_adc: add support for AXP717 ADC power: supply: axp20x_usb_power: Add support for AXP717 power: supply: axp20x_battery: add support for AXP717 arm64: dts: allwinner: h700: Add charger for Anbernic RG35XX .../bindings/iio/adc/x-powers,axp209-adc.yaml | 12 + .../x-powers,axp20x-battery-power-supply.yaml | 7 + .../x-powers,axp20x-usb-power-supply.yaml | 6 + .../sun50i-h700-anbernic-rg35xx-2024.dts | 21 + drivers/iio/adc/axp20x_adc.c | 182 +++++- drivers/mfd/axp20x.c | 25 +- drivers/power/supply/axp20x_battery.c | 597 ++++++++++++++++-- drivers/power/supply/axp20x_usb_power.c | 353 ++++++++++- include/linux/mfd/axp20x.h | 27 + 9 files changed, 1132 insertions(+), 98 deletions(-)