From patchwork Mon Jun 17 22:05:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 805123 Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CDF919146C; Mon, 17 Jun 2024 22:06:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718661963; cv=none; b=cG9LCoX5lQVhL7+ty/jdg9MX16PO2HU5JaS/K8SySFlK2V5ymfGjah825bol5g7xhFoZRm21Sk5Tsn40iudgWJ1YZffp7ArAUgTHZVivq3u6ONlXoc24a1gx4rBaqUsGjmn2iWKdcc4w0yn0X7EQLUDdUPGvyC+87/CkA8D9Vtg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718661963; c=relaxed/simple; bh=vSX80ON8QT7Jk17w76m3OpTB/4ybhhptsr9QuMGNPIQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=i5NvWgVDXuN/F1Uf4aez4S/FOqNlNegEHRBlia09f1+GVpFc584vXM8GZdrWUm5NhuMiIPES8FgFro8JFsEXFPmuzjvN/t78EXrWsQ8QB118mtgU3hSbu3SkB+sbp4toJptESsn19kcDjGWUKy8ELHbB9F7I3TKsV41VLjL4HVU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=esK0aLvb; arc=none smtp.client-ip=209.85.210.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="esK0aLvb" Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-6f8ffe1b65dso2273167a34.0; Mon, 17 Jun 2024 15:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718661961; x=1719266761; darn=vger.kernel.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=72c1oCxCl3E9fFtbjzZp2Yxwgd19L9zndmRoUlwxJeE=; b=esK0aLvbuvK0zuFQZuEuW1E9S84iI2NcFLc3bZOmZcv/WSggutgqq7Xi/eHdizfZvR 4Q/2KpcnPgdDQjk7ysqyOGz5VOEAjgvOlwf3fkTOM66OFKS8aQarUKozD8AuF3uJq/01 ZzQC00ttXRySQjqycntGwtbEhX1OScUzG1FfHVCqd1yfuPdVV9gAzwDIZebRg+bC8Mev TNwP2rctfat+C5Lzs7013G27/PaF8TDPECIqCrYOTbET4R/KptLpzX8nnWU5tG43MKzE MhyKnopBBwafyHUF/TbXwHAV5a9i92gVd3hVvcwy+9NrTsSVs+YzUjFDUoGo+qeaAu7O eNdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718661961; x=1719266761; 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=72c1oCxCl3E9fFtbjzZp2Yxwgd19L9zndmRoUlwxJeE=; b=WazS3zqUnDSl0E5KIPlPlzv01NIqurKY1RdBf0Rx3izUVKvZ5MWhwFF/yd3zHJQarl nO0VGe3Cnakh9YPRZoVk0KXk/tUyBXiPBRCDjjKB9GVgDaJ0IB/Xwue27+olqEjoKWNW LPJtDpirhnIbiSAgWeFg977Hj5xXtYH02yYwR8iKmhVKfVoYtBAlA3ngyTa66qTjv2Sx UCA5EJE6e0baI/kQwTrrJTq2M8E2wmd/8CCkOihEvmq7/n+zMpZ7Rlk2ygyrWGiejDQ8 NCkGD5TMb5r6woVkTtTwjToJ2amn3DOC3ZcYD87uljdOVI5AXqAAcRGB1Ojli2sL9sDG kqew== X-Forwarded-Encrypted: i=1; AJvYcCXijt8I5ZZ+WDR7SHn5CsdosfHal5gLAhj0gmeZ37OHkZ96KLIoYO5Gq/kXwnPx7M7Mdrid9iQmkluV9bD6Xb70iqbwP7MpD0zQinn8gsxCnbpMgSd6s2gW3rvIx47M61l12ha+lQ== X-Gm-Message-State: AOJu0YxOnDCYSpwmiFf21qSHDg33o7SEIpDUQbyc3Ydp7DQAE9NXSubU SiCo2FegQ6BswK/2s0ls/dfbDtp/MyKV/k4Wp5doWU9Ma72qhj7O X-Google-Smtp-Source: AGHT+IE9x7T2l+/foUb1Q9R5OJWa5Z1pPLXeYGeinTqk3kSXkdgHG61T0IPf6oTedgA4/lrD6wlwRA== X-Received: by 2002:a05:6830:349f:b0:6f9:9d6a:2c84 with SMTP id 46e09a7af769-6ff15cd3226mr625445a34.4.1718661961372; Mon, 17 Jun 2024 15:06:01 -0700 (PDT) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6fb5b1b0fa8sm1664232a34.28.2024.06.17.15.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 15:06:01 -0700 (PDT) From: Chris Morgan To: linux-sunxi@lists.linux.dev Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, broonie@kernel.org, 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, Chris Morgan Subject: [PATCH 1/8] dt-bindings: iio: adc: Add AXP717 compatible Date: Mon, 17 Jun 2024 17:05:28 -0500 Message-Id: <20240617220535.359021-2-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240617220535.359021-1-macroalpha82@gmail.com> References: <20240617220535.359021-1-macroalpha82@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chris Morgan Add compatible binding for the axp717. Signed-off-by: Chris Morgan --- .../bindings/iio/adc/x-powers,axp209-adc.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/adc/x-powers,axp209-adc.yaml b/Documentation/devicetree/bindings/iio/adc/x-powers,axp209-adc.yaml index d40689f233f2..267c74fa2d0c 100644 --- a/Documentation/devicetree/bindings/iio/adc/x-powers,axp209-adc.yaml +++ b/Documentation/devicetree/bindings/iio/adc/x-powers,axp209-adc.yaml @@ -37,6 +37,15 @@ description: | 3 | batt_dischrg_i 4 | ts_v + AXP717 + ------ + 0 | batt_v + 1 | ts_v + 2 | vbus_v + 3 | vsys_v + 4 | pmic_temp + 5 | batt_chrg_i + AXP813 ------ 0 | pmic_temp @@ -52,6 +61,7 @@ properties: oneOf: - const: x-powers,axp209-adc - const: x-powers,axp221-adc + - const: x-powers,axp717-adc - const: x-powers,axp813-adc - items: From patchwork Mon Jun 17 22:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 805122 Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B20A2199254; Mon, 17 Jun 2024 22:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718661965; cv=none; b=SbEm1nHNcP4F9aEHavXEu9lQyndR8cf37BX78/eWvtZcGpMjhoez8IfK/Q8LJ68AskkJUO/MHfJriQmTyzBWtZX9bAtB3MvKhbgcWkBRdo9K1uRFWHIcZ/x33WRtyB9cz81pdDpaXh+YUDw3EvUgHIyupIMdZFR7gE6U+jSxpgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718661965; c=relaxed/simple; bh=u4D8owzU03JtVL+E5P2c1MwoyOjbnAxavHybzY1+PB8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WkppP8MUOxzEwmFEMjI4zAEsS5eblGbxNAGA30l9ssDbdjJTmzWLSSbf7XFH+mOVwHEg7QQm9TYd9YCvAqTd4swKVvuK0E9mNwd7xURwDXF7kgNy51HMWcefatKlUnTaq2CbPvOFA1Ie1kejw6wVF17E2xMeGMR/zHjiDLF5nso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=c0/1wTe0; arc=none smtp.client-ip=209.85.210.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c0/1wTe0" Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-6fb840d8ffdso2304972a34.1; Mon, 17 Jun 2024 15:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718661963; x=1719266763; darn=vger.kernel.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=72y+9tHAatc4SLssayPtvrq36iX+xSvhsa+KDzNLInw=; b=c0/1wTe0LbC04a6jTMXhtJQpH74uh3wUIWWz2pQJ9IHix99XVpR7GPZJaWPQbCkrCu TCPX1rjKjTQuqw/Dc3X1KrP4uKxqQiro4HJXgE0JHdB24tbvoF2XELu9cK+Ho8j8H6FA ryIA3D9MPgScexf/ECC8kHO1b1RKuqih8gCo3/nCOFEwCMavID/xGJG2WgBhZbMACCuA barJADmiI2PG0LywFh+/MZj9W3shq6pASNQkU2U1MnIXqByTrjEZiqQ2xgxip7zPt1cI 3Prj0rfYvlPa+HNHPTDNQTUdVftxXBuGSL3P1GWxBrlxx8u5oonKZc6WBeux8lwTqKLQ B48A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718661963; x=1719266763; 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=72y+9tHAatc4SLssayPtvrq36iX+xSvhsa+KDzNLInw=; b=e1C0OPceCDoXOTOSDJYQmFd35JhEweOeNpRJxIlKje4/wOUpBK3vkARygGINtsCqOE t86h4UkEUmEnYCNlxPcggvEsujAqdfvZ3pB4CCCQSWtaQ8h/6oUrc2YPrwDyuFcuX5mC wY0R1h8g7+nWA0omtoa7GyO+sixUc4vKUOK0fG/Zg9W35lj3XI7sWAUY818zFohEEMMJ voe20hZrRz1faawNzSfH3GBoTLzxWSQPxSZXazMufEVgeH581s1LZbTYmClRy909tSya mcaGqot9VzXpVrSxC6I8guXhsQaf1lcugu1TNNcuPlIu0lUH6/BqVN18XIz5enFE8CS+ E3Ig== X-Forwarded-Encrypted: i=1; AJvYcCXz8jxVMEhG/6OY9NeDsJnEllkSZQZIyf5C0TdkmE0APigJP4tx1c1ngsOw9X5M4di0hsdJNWW4XVXDlichYa85GmWfQBWhWfet6X+z/E3vyrspPhlqkL3j5TnjlroqwN6zxIPcGg== X-Gm-Message-State: AOJu0Yyb/7XY0sDqGsAK7Wmw+sBdoslhaVAR6+i95kNWa0EbPf7XIgEv AMsxWtLaxAPHbgKvaqb9rJcrI/dFIX67u0be9tbUGqx6v7C/wSVf X-Google-Smtp-Source: AGHT+IEkIdSVBPwRxmz/C+oaPXire0Q9K/OttIwtYadST9Y56jqSPQuftFjwT3ICPganY+BWI4wfiw== X-Received: by 2002:a05:6870:14cd:b0:255:1bb8:8603 with SMTP id 586e51a60fabf-25842882a51mr12202205fac.3.1718661962789; Mon, 17 Jun 2024 15:06:02 -0700 (PDT) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6fb5b1b0fa8sm1664232a34.28.2024.06.17.15.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 15:06:02 -0700 (PDT) From: Chris Morgan To: linux-sunxi@lists.linux.dev Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, broonie@kernel.org, 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, Chris Morgan Subject: [PATCH 3/8] power: supply: axp20x_battery: add support for AXP717 Date: Mon, 17 Jun 2024 17:05:30 -0500 Message-Id: <20240617220535.359021-4-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240617220535.359021-1-macroalpha82@gmail.com> References: <20240617220535.359021-1-macroalpha82@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chris Morgan Add binding information for AXP717. Also, as the driver can read simple-battery parameters for the AXP717 and other batteries, define the simple-battery parameter. Signed-off-by: Chris Morgan --- .../power/supply/x-powers,axp20x-battery-power-supply.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml index e0b95ecbbebd..8d6b06117f6d 100644 --- a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml +++ b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml @@ -23,11 +23,18 @@ properties: - const: x-powers,axp202-battery-power-supply - const: x-powers,axp209-battery-power-supply - const: x-powers,axp221-battery-power-supply + - const: x-powers,axp717-battery-power-supply - items: - const: x-powers,axp803-battery-power-supply - const: x-powers,axp813-battery-power-supply - const: x-powers,axp813-battery-power-supply + monitored-battery: + description: | + Specifies the phandle of an optional simple-battery connected to + this gauge. + $ref: /schemas/types.yaml#/definitions/phandle + required: - compatible From patchwork Mon Jun 17 22:05:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 805121 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AC87199386; Mon, 17 Jun 2024 22:06:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718661967; cv=none; b=NaxLiAj3UHEeTOwaWSjHtphLi06nhfAdFaHNI1SUN77ttn3EyA7rTjnFzd2VknuaB/CLz13fPUgJxaspWxitOlLfhDlO77BLXShz6JfBE20240zXiS4u8Z0KbCILa3/VdXHdOnstzBk/aj+rjZJG9NuPaG4aYz3K4ZD5nW4H5JA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718661967; c=relaxed/simple; bh=H7witUJfXYif1uC/+Ilc28PC+kchqyv4s6rbsLsb+GU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nri9gbs0cnrNGgfpjqxUvf5n2KPCZWsmd0D/uYzCSpK/86q/ghqWVX4sL4zSbjZHs1efROVyV0anNuDLYF+5Oy7UBnc9fxaHCQ87rBFP75JvBP8RqGIdiV1NFJx+c9yNqIWF76dMl/y7UNYwg/l5LnF9l0bVvyJwpZRItSoioKM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NxpIbwai; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NxpIbwai" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-6fa0edb64bdso2639521a34.1; Mon, 17 Jun 2024 15:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718661964; x=1719266764; darn=vger.kernel.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=0RG0NXurL8KLRSgB9g5zxGanlIjXL38bCw5+6h0oSCE=; b=NxpIbwaiiePVqieM1/f8Sm3chnkiy8yq4obUwQP3IBRJx6UezqWMnmkK98F5Cyd6Mp /GDezQwVQyX6vui5uRE4zJ67pUbDsU3y4EXGBnREf2veD9O1KtupzDefVJHznlzNiexQ UaUeb31Q4IHxGvmPCT05GllUFgrUQWk30lUN34u8yO+Mu53gVcH9Idt6GNzEc9baUGat kyIEb/HF1sQz6IiLKOytvuRH+kFb11s1jLCKcZcTTeihlCtfcEj5fMHywSBSGUl5a01X XbEYcoyxj2rbAiFXxnKQQYtCqg+xE++OR+4vlHf2WZa6k9NNNnfIPgkMgrMhOjyXs7sC sJbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718661964; x=1719266764; 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=0RG0NXurL8KLRSgB9g5zxGanlIjXL38bCw5+6h0oSCE=; b=OnU3H7PTKfVG8wnXFnEsl/KlcHKsicYUcFSInv93cNgE2UWi6OehFbbS14xGqJ6Djc mAiJbDhGJmEpCxm7/cbVaL197ju6uiryn+LKdCfanIr9EQstGEwrQazdQZNosFEse7MJ FTxewwbC4WIfFYzqZHI7DkuxW5GERljeR539TDKft3SDBLVXiLeX3akU4wygwDJTYiT9 UEvIrQfwBNSxk0v4UV82MNfUwRxLitPJ1su7/cz5gXsIIpNXt0Roba20CYRd2RtRITUm zbfawar0n7lmRBibgDgdQyLv9LoJ/3Qey9SPQh+8e2l1Tx2LJz3IipXMShJ6WOEHR2KX 54vg== X-Forwarded-Encrypted: i=1; AJvYcCXwtBUInooBcJNu4RTb8Urj91VoqkHb0G+AfHovESu1lV4/Aknyk/zkyF489byRMZE5/LyYmQMBcThoR7CYixqhrjJYjhLOmbJbCUchX+pxRKPQWAQ/3koMw3JpqhwEb39rI2VtJw== X-Gm-Message-State: AOJu0Yxgf1i+YVaEO4nbA3WxMzR3qUrezJNC9Szxn2rZqYBGX8h+dIv3 MCUMXQDTK3dfV3DXlMCcrgCMIRrcPZ6FCGqfgIyshckXXjGFGEMW X-Google-Smtp-Source: AGHT+IGNEAT8W/zzHqVFKDVHsHRFvyQru922rkNFnEAYq7Ii5q5BtUsT/5Wn0LnTH4HsVeygU27CnA== X-Received: by 2002:a9d:7acf:0:b0:6f9:599a:b681 with SMTP id 46e09a7af769-6fb93784cdfmr11851575a34.17.1718661964410; Mon, 17 Jun 2024 15:06:04 -0700 (PDT) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6fb5b1b0fa8sm1664232a34.28.2024.06.17.15.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 15:06:03 -0700 (PDT) From: Chris Morgan To: linux-sunxi@lists.linux.dev Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, broonie@kernel.org, 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, Chris Morgan Subject: [PATCH 5/8] iio: adc: axp20x_adc: add support for AXP717 ADC Date: Mon, 17 Jun 2024 17:05:32 -0500 Message-Id: <20240617220535.359021-6-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240617220535.359021-1-macroalpha82@gmail.com> References: <20240617220535.359021-1-macroalpha82@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chris Morgan Add support for the AXP717 ADC. The AXP717 differs from other ADCs in this series by utilizing a 14 bit ADC for all channels (a full 16 bits with the first 2 digits reserved). It also differs by lacking a battery discharge current channel. Note that while the current charge channel itself is included in this driver for the AXP717 and listed in the datasheet, no scale or offset was given for this channel. For now no scale or offset is provided in this driver. Signed-off-by: Chris Morgan --- drivers/iio/adc/axp20x_adc.c | 167 +++++++++++++++++++++++++++++++++-- 1 file changed, 160 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c index d6c51b0f48e3..f35ba2c11e1b 100644 --- a/drivers/iio/adc/axp20x_adc.c +++ b/drivers/iio/adc/axp20x_adc.c @@ -5,6 +5,7 @@ * Quentin Schulz */ +#include #include #include #include @@ -27,6 +28,8 @@ #define AXP22X_ADC_EN1_MASK (GENMASK(7, 5) | BIT(0)) +#define AXP717_ADC_EN1_MASK GENMASK(5, 0) + #define AXP20X_GPIO10_IN_RANGE_GPIO0 BIT(0) #define AXP20X_GPIO10_IN_RANGE_GPIO1 BIT(1) @@ -35,6 +38,11 @@ #define AXP22X_ADC_RATE_HZ(x) ((ilog2((x) / 100) << 6) & AXP20X_ADC_RATE_MASK) +#define AXP717_ADC_DATA_TS 0x00 +#define AXP717_ADC_DATA_TEMP 0x01 + +#define AXP717_ADC_DATA_MASK 0x3fff + #define AXP813_V_I_ADC_RATE_MASK GENMASK(5, 4) #define AXP813_ADC_RATE_MASK (AXP20X_ADC_RATE_MASK | AXP813_V_I_ADC_RATE_MASK) #define AXP813_TS_GPIO0_ADC_RATE_HZ(x) AXP20X_ADC_RATE_HZ(x) @@ -98,6 +106,18 @@ enum axp22x_adc_channel_i { AXP22X_BATT_DISCHRG_I, }; +enum axp717_adc_channel_v { + AXP717_BATT_V = 0, + AXP717_TS_IN, + AXP717_VBUS_V, + AXP717_VSYS_V, + AXP717_DIE_TEMP_V, +}; + +enum axp717_adc_channel_i { + AXP717_BATT_CHRG_I = 5, +}; + enum axp813_adc_channel_v { AXP813_TS_IN = 0, AXP813_GPIO0_V, @@ -152,6 +172,22 @@ static struct iio_map axp22x_maps[] = { }, { /* sentinel */ } }; +static struct iio_map axp717_maps[] = { + { + .consumer_dev_name = "axp20x-usb-power-supply", + .consumer_channel = "vbus_v", + .adc_channel_label = "vbus_v", + }, { + .consumer_dev_name = "axp20x-battery-power-supply", + .consumer_channel = "batt_v", + .adc_channel_label = "batt_v", + }, { + .consumer_dev_name = "axp20x-battery-power-supply", + .consumer_channel = "batt_chrg_i", + .adc_channel_label = "batt_chrg_i", + }, +}; + /* * Channels are mapped by physical system. Their channels share the same index. * i.e. acin_i is in_current0_raw and acin_v is in_voltage0_raw. @@ -210,6 +246,25 @@ static const struct iio_chan_spec axp22x_adc_channels[] = { AXP22X_TS_ADC_H), }; +/* + * Scale and offset is unknown for temp, ts, and batt_chrg_i channels + * for now. Leaving scale and offset undefined for now. + */ +static const struct iio_chan_spec axp717_adc_channels[] = { + AXP20X_ADC_CHANNEL(AXP717_BATT_V, "batt_v", IIO_VOLTAGE, + AXP717_BATT_V_H), + AXP20X_ADC_CHANNEL(AXP717_TS_IN, "ts_v", IIO_VOLTAGE, + AXP717_ADC_DATA_H), + AXP20X_ADC_CHANNEL(AXP717_VBUS_V, "vbus_v", IIO_VOLTAGE, + AXP717_VBUS_V_H), + AXP20X_ADC_CHANNEL(AXP717_VSYS_V, "vsys_v", IIO_VOLTAGE, + AXP717_VSYS_V_H), + AXP20X_ADC_CHANNEL(AXP717_DIE_TEMP_V, "pmic_temp", IIO_TEMP, + AXP717_ADC_DATA_H), + AXP20X_ADC_CHANNEL(AXP717_BATT_CHRG_I, "batt_chrg_i", IIO_CURRENT, + AXP717_BATT_CHRG_I_H), +}; + static const struct iio_chan_spec axp813_adc_channels[] = { { .type = IIO_TEMP, @@ -269,6 +324,44 @@ static int axp22x_adc_raw(struct iio_dev *indio_dev, return IIO_VAL_INT; } +static int axp717_adc_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val) +{ + struct axp20x_adc_iio *info = iio_priv(indio_dev); + u8 bulk_reg[2]; + int ret; + + /* + * A generic "ADC data" channel is used for TS, tdie, vmid, + * and vbackup. This channel must both first be enabled and + * also selected before it can be read. + */ + switch (chan->channel) { + case AXP717_TS_IN: + regmap_write(info->regmap, AXP717_ADC_DATA_SEL, + AXP717_ADC_DATA_TS); + break; + case AXP717_DIE_TEMP_V: + regmap_write(info->regmap, AXP717_ADC_DATA_SEL, + AXP717_ADC_DATA_TEMP); + break; + + default: + break; + } + + /* + * All channels are 14 bits, with the first 2 bits on the high + * register reserved and the remaining bits as the ADC value. + */ + ret = regmap_bulk_read(info->regmap, chan->address, bulk_reg, 2); + if (ret < 0) + return ret; + + *val = get_unaligned_be16(bulk_reg) & AXP717_ADC_DATA_MASK; + return IIO_VAL_INT; +} + static int axp813_adc_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val) { @@ -425,6 +518,27 @@ static int axp22x_adc_scale(struct iio_chan_spec const *chan, int *val, } } +static int axp717_adc_scale(struct iio_chan_spec const *chan, int *val, + int *val2) +{ + switch (chan->type) { + case IIO_VOLTAGE: + *val = 1; + return IIO_VAL_INT; + + case IIO_CURRENT: + *val = 1; + return IIO_VAL_INT; + + case IIO_TEMP: + *val = 100; + return IIO_VAL_INT; + + default: + return -EINVAL; + } +} + static int axp813_adc_scale(struct iio_chan_spec const *chan, int *val, int *val2) { @@ -529,6 +643,22 @@ static int axp22x_read_raw(struct iio_dev *indio_dev, } } +static int axp717_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, + int *val2, long mask) +{ + switch (mask) { + case IIO_CHAN_INFO_SCALE: + return axp717_adc_scale(chan, val, val2); + + case IIO_CHAN_INFO_RAW: + return axp717_adc_raw(indio_dev, chan, val); + + default: + return -EINVAL; + } +} + static int axp813_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask) @@ -593,6 +723,10 @@ static const struct iio_info axp22x_adc_iio_info = { .read_raw = axp22x_read_raw, }; +static const struct iio_info axp717_adc_iio_info = { + .read_raw = axp717_read_raw, +}; + static const struct iio_info axp813_adc_iio_info = { .read_raw = axp813_read_raw, }; @@ -622,7 +756,9 @@ struct axp_data { const struct iio_info *iio_info; int num_channels; struct iio_chan_spec const *channels; + unsigned long adc_en1; unsigned long adc_en1_mask; + unsigned long adc_en2; unsigned long adc_en2_mask; int (*adc_rate)(struct axp20x_adc_iio *info, int rate); @@ -633,7 +769,9 @@ static const struct axp_data axp20x_data = { .iio_info = &axp20x_adc_iio_info, .num_channels = ARRAY_SIZE(axp20x_adc_channels), .channels = axp20x_adc_channels, + .adc_en1 = AXP20X_ADC_EN1, .adc_en1_mask = AXP20X_ADC_EN1_MASK, + .adc_en2 = AXP20X_ADC_EN2, .adc_en2_mask = AXP20X_ADC_EN2_MASK, .adc_rate = axp20x_adc_rate, .maps = axp20x_maps, @@ -643,15 +781,26 @@ static const struct axp_data axp22x_data = { .iio_info = &axp22x_adc_iio_info, .num_channels = ARRAY_SIZE(axp22x_adc_channels), .channels = axp22x_adc_channels, + .adc_en1 = AXP20X_ADC_EN1, .adc_en1_mask = AXP22X_ADC_EN1_MASK, .adc_rate = axp22x_adc_rate, .maps = axp22x_maps, }; +static const struct axp_data axp717_data = { + .iio_info = &axp717_adc_iio_info, + .num_channels = ARRAY_SIZE(axp717_adc_channels), + .channels = axp717_adc_channels, + .adc_en1 = AXP717_ADC_CH_EN_CONTROL, + .adc_en1_mask = AXP717_ADC_EN1_MASK, + .maps = axp717_maps, +}; + static const struct axp_data axp813_data = { .iio_info = &axp813_adc_iio_info, .num_channels = ARRAY_SIZE(axp813_adc_channels), .channels = axp813_adc_channels, + .adc_en1 = AXP20X_ADC_EN1, .adc_en1_mask = AXP22X_ADC_EN1_MASK, .adc_rate = axp813_adc_rate, .maps = axp22x_maps, @@ -660,6 +809,7 @@ static const struct axp_data axp813_data = { static const struct of_device_id axp20x_adc_of_match[] = { { .compatible = "x-powers,axp209-adc", .data = (void *)&axp20x_data, }, { .compatible = "x-powers,axp221-adc", .data = (void *)&axp22x_data, }, + { .compatible = "x-powers,axp717-adc", .data = (void *)&axp717_data, }, { .compatible = "x-powers,axp813-adc", .data = (void *)&axp813_data, }, { /* sentinel */ } }; @@ -668,6 +818,7 @@ MODULE_DEVICE_TABLE(of, axp20x_adc_of_match); static const struct platform_device_id axp20x_adc_id_match[] = { { .name = "axp20x-adc", .driver_data = (kernel_ulong_t)&axp20x_data, }, { .name = "axp22x-adc", .driver_data = (kernel_ulong_t)&axp22x_data, }, + { .name = "axp717-adc", .driver_data = (kernel_ulong_t)&axp717_data, }, { .name = "axp813-adc", .driver_data = (kernel_ulong_t)&axp813_data, }, { /* sentinel */ }, }; @@ -709,15 +860,17 @@ static int axp20x_probe(struct platform_device *pdev) indio_dev->channels = info->data->channels; /* Enable the ADCs on IP */ - regmap_write(info->regmap, AXP20X_ADC_EN1, info->data->adc_en1_mask); + regmap_write(info->regmap, info->data->adc_en1, + info->data->adc_en1_mask); if (info->data->adc_en2_mask) - regmap_update_bits(info->regmap, AXP20X_ADC_EN2, + regmap_update_bits(info->regmap, info->data->adc_en2, info->data->adc_en2_mask, info->data->adc_en2_mask); /* Configure ADCs rate */ - info->data->adc_rate(info, 100); + if (info->data->adc_rate) + info->data->adc_rate(info, 100); ret = iio_map_array_register(indio_dev, info->data->maps); if (ret < 0) { @@ -737,10 +890,10 @@ static int axp20x_probe(struct platform_device *pdev) iio_map_array_unregister(indio_dev); fail_map: - regmap_write(info->regmap, AXP20X_ADC_EN1, 0); + regmap_write(info->regmap, info->data->adc_en1, 0); if (info->data->adc_en2_mask) - regmap_write(info->regmap, AXP20X_ADC_EN2, 0); + regmap_write(info->regmap, info->data->adc_en2, 0); return ret; } @@ -753,10 +906,10 @@ static void axp20x_remove(struct platform_device *pdev) iio_device_unregister(indio_dev); iio_map_array_unregister(indio_dev); - regmap_write(info->regmap, AXP20X_ADC_EN1, 0); + regmap_write(info->regmap, info->data->adc_en1, 0); if (info->data->adc_en2_mask) - regmap_write(info->regmap, AXP20X_ADC_EN2, 0); + regmap_write(info->regmap, info->data->adc_en2, 0); } static struct platform_driver axp20x_adc_driver = { From patchwork Mon Jun 17 22:05:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 805120 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D351F199236; Mon, 17 Jun 2024 22:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718661969; cv=none; b=cisJwfEqIZKJxpGrmMaeFYAaDldoPKpACGeChG/URaVRk+zEcNwet15rj3Hiu7T+VV1Qm42+yu73WERbcBpBYgNrgc0m6wWOuJqhWTZCoQfkBYGI51baxTBjQvIeUTGTP8rqMXuOCLkKSmKJjyqfmhV8i4MvEThRtc6xyrXZyQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718661969; c=relaxed/simple; bh=j6RTuMiwhhPOe4aRhhv5nDakG1pInbsHkJ/5EckbV0k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WxDokYknitg4pjdfcMstdu1VqusqVCnpsToRUm7wF81ZzHBERG/9mSV/bmmeD1wYnyV0r7tKxs9Odc3Pk3fmGFWl9RZKcdXCVZnhhuTS5D6KYt3bnU+IWWIliLOIgFqLT2SQR3Ha4+SZLeXdFb+Opz/JGZtk9KscdY7MtqhSXRU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NFTavih8; arc=none smtp.client-ip=209.85.210.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NFTavih8" Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-6fa11ac8695so2745676a34.3; Mon, 17 Jun 2024 15:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718661967; x=1719266767; darn=vger.kernel.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=1BziCaw0KNoy52TFFrJE/sLYMOcgMiEW8rOGB9cWp6c=; b=NFTavih8sgTtR24vO82ehbltkanghN6iHYgLY29AQjBls9NUwi2L7ZHFsvTnFTwaFc EaAFxv0rY/8elmrv4u/59yEUBHpSTqO/WCtMhmF97DFkcFqBzSw2XQEZFainjmtFxRpQ SFlMbBgeiKuM4X8S9GCvBIkwMe3fPsUPuYkQTMKBW1sGQt2osWgPbuvPRyCjSJQv2Mn3 7pRKYacMckzGZzhzyhdaNu4pqnJ1BfSmHRyJJ1HoFM2w2TKPkHKCZKYzNwNHedTZi78A 6j6xyRT/r3rnHTCPdxxPqRBP9vTfct+7IkBGequnmkZ/DzIKf3etS68rYgiWuxamR/dc lY2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718661967; x=1719266767; 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=1BziCaw0KNoy52TFFrJE/sLYMOcgMiEW8rOGB9cWp6c=; b=LixS6Jp4OtNf8pFLqm1KOcdy4YDfxHSe+HgWoUbwblavDUTPnLVkbFkXze5hh9HVJd UcpCJga2Td/cBAm/TQfh3SA3kIPYE+X5QZ6ET87K3YexymZJY59Cy/i6PBgQOH8C3SLq 4Lmw6wXZYZbCeB0a4JgRVTbqrYOe1ycrfFliu33NIHo48n/AEQliN1RaN2WL1+97ZN02 WiG0yHvUn1WEu8iqx5heOyEe0cWFW2UqjYT7O+Fdqhd1n5xlicJkcRe5liOJbRKrEM1H J1QoQNxj7HgZDiNzZGGa/Gykns40Ie7QFwQe9jOudR/yzVfHzqTOJlc8w+3zP0jxseby sCsA== X-Forwarded-Encrypted: i=1; AJvYcCVyNcMhPIE0ucrntdlY7Ni0F77b3bJZ45S/SamIzQV3dq9GNvTDeKCl5mVnaY2P3JzSvDvhOMDVyia09l/c8MH/ZXs/2sQvcglWYdiEzOjHukkvCOQ/Ak0Yg/s2AW4x1Ikd4ujk+A== X-Gm-Message-State: AOJu0Yz0pDx3+qB+KY0Q9rAWrui4nM5vm2h1/cp1FSRBAVTcUPKiFRWA kD1Ss82pruSSwMWKN4yBkv7+NkXvxT/AW0YOYyJ5Zyz7v8xvMAb6 X-Google-Smtp-Source: AGHT+IEr69oVoQp6ZjahqW/ytJ1vFMjRMIerdktekBuGD6FU7Uh8MBILwqS78oEqXitRb7vFWx1GWw== X-Received: by 2002:a9d:66cd:0:b0:6f9:5b24:4668 with SMTP id 46e09a7af769-6fb9375ce9bmr11413893a34.10.1718661966945; Mon, 17 Jun 2024 15:06:06 -0700 (PDT) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6fb5b1b0fa8sm1664232a34.28.2024.06.17.15.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 15:06:06 -0700 (PDT) From: Chris Morgan To: linux-sunxi@lists.linux.dev Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, broonie@kernel.org, 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, Chris Morgan Subject: [PATCH 8/8] arm64: dts: allwinner: h700: Add charger for Anbernic RG35XX Date: Mon, 17 Jun 2024 17:05:35 -0500 Message-Id: <20240617220535.359021-9-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240617220535.359021-1-macroalpha82@gmail.com> References: <20240617220535.359021-1-macroalpha82@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chris Morgan Add the necessary nodes to the AXP717 to allow for monitoring the USB and battery charger. Signed-off-by: Chris Morgan --- .../sun50i-h700-anbernic-rg35xx-2024.dts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts index ee30584b6ad7..f15a5d193f7c 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts @@ -21,6 +21,12 @@ aliases { serial0 = &uart0; }; + battery: battery { + compatible = "simple-battery"; + constant-charge-current-max-microamp = <1024000>; + voltage-max-design-microvolt = <4200000>; + }; + chosen { stdout-path = "serial0:115200n8"; }; @@ -217,6 +223,16 @@ axp717: pmic@3a3 { vin3-supply = <®_vcc5v>; vin4-supply = <®_vcc5v>; + axp_adc: adc { + compatible = "x-powers,axp717-adc"; + #io-channel-cells = <1>; + }; + + battery_power: battery-power { + compatible = "x-powers,axp717-battery-power-supply"; + monitored-battery = <&battery>; + }; + regulators { reg_dcdc1: dcdc1 { regulator-always-on; @@ -307,6 +323,11 @@ reg_cpusldo: cpusldo { /* unused */ }; }; + + usb_power: usb-power { + compatible = "x-powers,axp717-usb-power-supply"; + input-current-limit-microamp = <1500000>; + }; }; };