Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp332463lqp; Wed, 12 Jun 2024 02:59:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZkPbDi6PtJlze0YyIkHAbuLy8Kjrq/E5hVKVZY76zIhAh1WAy8qzphMCeFE8CdCXOPKinU6lyxw53a4JpuyFHxDmXuR3XMOaBd3tUQg== X-Google-Smtp-Source: AGHT+IE69/7i/vzdFAgXG2T7n2WprlkYrHNlqiTwF4wUxdKuYok000f/nHM/QBU8OMvhb3HCR93b X-Received: by 2002:a05:6214:311d:b0:6b0:91d4:5821 with SMTP id 6a1803df08f44-6b1a62a3efemr11513386d6.28.1718186395138; Wed, 12 Jun 2024 02:59:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718186395; cv=pass; d=google.com; s=arc-20160816; b=UAJxvbcw0paiGSAUFvaFWSkOIBJ7Qb+KdJ3+MphVaiOz22nLQac1Vi2bFC6jmt9wZZ L84hBMQY+6Tr6TMgUDp7nWtVkx/gTFGS+9CPHi8hMyonPVomHeEUGyAm3TLd0PLjT4VA CLVM4aRjfc5kMRo0w/RUIoenzseVw4cSjwi8uSo7iNRH4Vy14WwHu9w3wJhqeqzyAQSA bT/Heo2NAM7mry+I5KYSGalTOgbkHYtYZZi/aU0k15i7GpJstgM9im9KpJuWALUIj5/z vspgYSDLAz2j3GyEPH6lvt7TfA4S7eHo3OW3TWEJ8QUjrHT+7pkXjqqQLgHn/p7/yEev qb2A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=Xts/ri4+0emIXdmkFUBZxsB2Gm19lNPTdXZ/kDOdF3c=; fh=BkDoFPFM9W1SLS7sVseDdqqZiPcyZA8hwN+DAaKlwcA=; b=fqRmvGxSrjbsMCdO9uUc1gs/sGCCsKLxr3pwwELqgg7eCeRK42bokiucmFJr7rY0Y4 TC8V9vXezTEcYgvVWLAGZ1Fkc+vMZ07TRpkt/cX44khSRSEnhlGbSxC48jnuEksdWoqh UwioIrYj32/EA+vlqSOjc+QDQGnrj8upPkpuncpd/Zp47dF3L8OE7oxmDNn9Xosi0cQm qEi3Kz2hdE4A/Mua1yFoniqYK83eJL0+y1yoQZEAzV1F4YzxLtApLPGwS94If8e5m0xs xVu90NGFfIR8aP7tHL9J4qwxadyjBNqBmci6lqL/QapS9g7bjztco29y2uJBWqdGc7ll qt4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mpn2SCHB; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-211311-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211311-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b08c224af2si37392876d6.142.2024.06.12.02.59.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 02:59:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211311-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mpn2SCHB; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-211311-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211311-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C16FA1C21958 for ; Wed, 12 Jun 2024 09:59:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2614F16EBE5; Wed, 12 Jun 2024 09:59:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Mpn2SCHB" Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 CA67716DED4 for ; Wed, 12 Jun 2024 09:59:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718186378; cv=none; b=Gb/JRO20t6TBeJhaWLfuLpOPrJYcTV8aDBf9Ba4kz5A11twUjJjcqNeYHAokY3PgPJymNLCR3iU7wREcCXzhwmGERe+PHdZSPEi6XiZ0TJkJ45chpOqetDMRXHQflfLRqpC/SbgA8QJH9meRXdYVOM0OyVZP8iP0mdqw9DzkEiw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718186378; c=relaxed/simple; bh=eMuODGP7W4LxxOLv4JBF6KdKVN5A3gRCCuaax4uO73I=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=qiMDhgKXI30MSJoQ3qjk2AQwDPwVKF9fXXJ8W2SABVL/qQYGWKJN1Czg14CvK73Z7jriB2+qxDxk/0PKIleRKMTpywkmYBcYHaAp0Gx4wJBHWgYEWeBjiQJ9b7VCQh2hTHvEFUFN0eEvMcNLApMk4fPlJgMn6BFz4tQVdpVh0BA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Mpn2SCHB; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-52bbdc237f0so2625876e87.0 for ; Wed, 12 Jun 2024 02:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718186375; x=1718791175; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=Xts/ri4+0emIXdmkFUBZxsB2Gm19lNPTdXZ/kDOdF3c=; b=Mpn2SCHBu2qZuM7Ors2YnwSE3MlK5K012AuiDNrUPZCERHjcpC2+z/x+W/WW/Gij7N s5R6wK+kTw8DIdHdjWgzHo0DKhO8GiXMNOrzb0jMao4bm/sIo3/TTAqOpFKkAkMGuVOR 8VBuXOb92y1f9OlAYxyiRq+3NatHYUM08//D3P4DWjD3P9sESwZN6gOd6KK6qEapszHt blYvDyeIbfOawwa7YwgspgQx5It3zo9vZcEhJghFOU29UaO4UOkJzvzpFPcLSEgyFrq2 5iSlJ7bl313vwnlPIiUGY2oGqiLvvP2FMfwUO5+2jbxG43nOcrdaH02kVddJq58YD6nz lUUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718186375; x=1718791175; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Xts/ri4+0emIXdmkFUBZxsB2Gm19lNPTdXZ/kDOdF3c=; b=Ytvu4HJ5CGJ/saUJLOoZxpHiKxGnhMS7GndygjPrsK8J9KDOe1K+L9DTdmKIQ/IXjd otrG6N4jemRzI/BZozAnw2Evnd2lOI2JERC0qRN/OYOb2jv3sRdeXSrsgiaRKGzb38le Ultz79Q7ue9Jn2jAN4nvXmjIAEXs2e47N3QMiATxzrW7Ohkbaka+v+qVfZtGlQEPaF3C CLf6racO6aCIj0UN1sR4fliewkVm7YyXhplUxQp0nVNCw1/siOO8Zftu5tpVParw3juo 7eaF+SksT6sBUfFMeMjrNE4V9d968eEydeGxhKv9YDX/p9U0RX40PXkFEv1/wXBUyLhi IU6g== X-Forwarded-Encrypted: i=1; AJvYcCXfLxmuDntlkormiM2wsp7uBeEt/Sk976aGuWWTHwkXrSyT/i0n11qgaV+4Q0tZmelwH7gHsPBCY76Jn44m/TnhQVxCbtGuF7W93H6q X-Gm-Message-State: AOJu0YymN1v06Fu/R5avjf+bRwDTNM9S+9EmDT0fzt2b2q/jlugVHRcr her0RK+VXTVQcX8cINRp5jA8peNL4JIApynkVUTyJladMIBHwhjtNxvRyQrG+Dc= X-Received: by 2002:ac2:5582:0:b0:52c:9052:db7f with SMTP id 2adb3069b0e04-52c9a40520emr924558e87.56.1718186374895; Wed, 12 Jun 2024 02:59:34 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52c8907dae9sm1408095e87.129.2024.06.12.02.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 02:59:34 -0700 (PDT) From: Dmitry Baryshkov Subject: [PATCH v6 0/6] power: supply: Lenovo Yoga C630 EC Date: Wed, 12 Jun 2024 12:59:31 +0300 Message-Id: <20240612-yoga-ec-driver-v6-0-8e76ba060439@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAIRxaWYC/3XOzUrEMBSG4VsZsjYl/0ldeR/i4rRJ2qDTyEkJl qH3bjogjhSX3+J5z7mREjCFQp4vN4KhppLy0oZ5upBxhmUKNPm2iWBCMS0s3fIENIzUY6oBqTX R26i9h+BIQ58YYvq6B1/f2o6Yr3SdMcBPRjLBNNfCsb4TQkolDeXUX9OKWzcAbmV+z/XlIy2Au cs4Hdk5lTXjdn+zyiP+70dVUkalsNA7zT14/Zg6Xqrq0buTV82rCM5HgGAHc/L61xt2vq+b5zD 2HNigpPjr933/BnF1r7B0AQAA To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Bryan O'Donoghue , Heikki Krogerus , Greg Kroah-Hartman , Konrad Dybcio Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, Nikita Travkin , Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4716; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=eMuODGP7W4LxxOLv4JBF6KdKVN5A3gRCCuaax4uO73I=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmaXGFNd/hzHoo56I1fjpVq1NuqLinKlwZUa/wl uU33Ubc6YyJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZmlxhQAKCRCLPIo+Aiko 1WNsB/4puhimqcLUNR+1HNqt4pmQ1iKV+joscGjEBnKJaGRAPGnQTTgkVJi6fKLgA3CZ9ax94KI Pm5Fn7wrEcRUaauMkHB+va4KHZrJMZSoWycgfgvWzYBLLlYjhEevElD+4soJIKxK3B6QcZcFJHz eYKJX876lXUIkTlu2oOyOteSq0Ujn1P1lkBlZI+pQoptZUV5o8qG1TJpizHuSVDXUw1LoaodsjY meZbqIAhkznUIaAy1v+25dobPUl0xYzieqNkX4Dy1h1qk06DuJsql04MWGvquOc+Oju/VQ8YQTt WmAyEkSSMjmNqHbKFOp2+n3kI3HVU6cO7CpWy5lHaNcX40p5 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A This adds binding, driver and the DT support for the Lenovo Yoga C630 Embedded Controller, to provide battery information. Support for this EC was implemented by Bjorn, who later could not work on this driver. I've picked this patchset up and updated it following the pending review comments. DisplayPort support is still not a part of this patchset. It uses EC messages to provide AltMode information rather than implementing corresponding UCSI commands. However to have a cleaner uAPI story, the AltMode should be handled via the same Type-C port. Merge strategy: the driver bits depend on the platform/arm64 patch, which adds interface for the subdrivers. I'd either ask to get that patch merged to the immutable branch, which then can be picked up by power/supply and USB trees or, to make life simpler, ack merging all driver bits e.g. through USB subsystem (I'm biased here since I plan to send more cleanups for the UCSI subsystem, which would otherwise result in cross-subsystem conflicts). --- Changes in v6: - Use guard() instead of scoped_guard() (Ilpo) - Add a define for UCSI version register (Ilpo) - Added a check to prevent overflowing the address in reg16 read (Ilpo) - Link to v5: https://lore.kernel.org/r/20240607-yoga-ec-driver-v5-0-1ac91a0b4326@linaro.org Changes in v5: - Added missing article in the commit message (Bryan) - Changed yoga_c630_ec_ucsi_get_version() to explicitly set the register instead of just incrementing it (Bryan) - Dropped spurious debugging pr_info (Bryan) - Added missing includes all over the place (Ilpo) - Switched to scoped_guard() where it's suitable (Ilpo) - Defined register bits (Ilpo, Bryan) - Whitespace cleanup (Ilpo, Bryan) - Reworked yoga_c630_ucsi_notify() to use switch-case (Bryan) - Use ternary operators instead of if()s (Ilpo) - Switched power supply driver to use fwnode (Sebastian) - Fixed handling of the adapter's type vs usb_type (Sebastian) - Added SCOPE property to the battery (Sebastian) - Link to v4: https://lore.kernel.org/r/20240528-yoga-ec-driver-v4-0-4fa8dfaae7b6@linaro.org Changes in v4: - Moved bindings to platform/ to follow example of other Acer Aspire1 EC (Nikita Travkin) - Fixed dt validation for EC interrupt pin (Rob Herring) - Dropped separate 'scale' property (Oliver Neukum) - Link to v3: https://lore.kernel.org/r/20240527-yoga-ec-driver-v3-0-327a9851dad5@linaro.org Changes in v3: - Split the driver into core and power supply drivers, - Added UCSI driver part, handling USB connections, - Fixed Bjorn's address in DT bindings (Brian Masney) - Changed power-role for both ports to be "dual" per UCSI - Link to v2: https://lore.kernel.org/linux-arm-msm/20230205152809.2233436-1-dmitry.baryshkov@linaro.org/ Changes in v2: - Dropped DP support for now, as the bindings are in process of being discussed separately, - Merged dt patch into the same patchseries, - Removed the fixed serial number battery property, - Fixed indentation of dt bindings example, - Added property: reg and unevaluatedProperties to the connector bindings. - Link to v1: https://lore.kernel.org/linux-arm-msm/20220810035424.2796777-1-bjorn.andersson@linaro.org/ --- Bjorn Andersson (2): dt-bindings: platform: Add Lenovo Yoga C630 EC arm64: dts: qcom: c630: Add Embedded Controller node Dmitry Baryshkov (4): platform: arm64: add Lenovo Yoga C630 WOS EC driver usb: typec: ucsi: add Lenovo Yoga C630 glue driver power: supply: lenovo_yoga_c630_battery: add Lenovo C630 driver arm64: dts: qcom: sdm845: describe connections of USB/DP port .../bindings/platform/lenovo,yoga-c630-ec.yaml | 83 ++++ arch/arm64/boot/dts/qcom/sdm845.dtsi | 53 ++- .../boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 75 ++++ drivers/platform/arm64/Kconfig | 14 + drivers/platform/arm64/Makefile | 1 + drivers/platform/arm64/lenovo-yoga-c630.c | 290 ++++++++++++ drivers/power/supply/Kconfig | 9 + drivers/power/supply/Makefile | 1 + drivers/power/supply/lenovo_yoga_c630_battery.c | 500 +++++++++++++++++++++ drivers/usb/typec/ucsi/Kconfig | 9 + drivers/usb/typec/ucsi/Makefile | 1 + drivers/usb/typec/ucsi/ucsi_yoga_c630.c | 202 +++++++++ include/linux/platform_data/lenovo-yoga-c630.h | 44 ++ 13 files changed, 1281 insertions(+), 1 deletion(-) --- base-commit: 03d44168cbd7fc57d5de56a3730427db758fc7f6 change-id: 20240527-yoga-ec-driver-76fd7f5ddae8 Best regards, -- Dmitry Baryshkov