From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.170 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796525107; b=oDkqRwH5gsXfsPchcElokb1mVyKK+JdhsGyBgobZ7M18UEuKu4aWpXmjCETdOBWcrtHZ 63wxYXNle3nwEoIUSQp1oY3ql1WrE5DYK66n6dIthawWkDWUlV9KK5uXEh6TiiDcuYjrp MQgzDzV46rlsXbdVnIkvVZE/20zFtyn+WCaJfINobwj7hZjKFgE/F5wT6U+5EmlJPSbt0 lh6xXTuuo06iR2DEWpN0o3OnxRrrTuG9b76ZG1G5It+taDG8n9pSLDvV9bJTMIYYu1CP1 /xfWeUffYv43rEpFsl3kiGIR+ZqYU0yhXmLFedbCKsyDMilWQID7H+50FYNGsUp8MmQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796525107; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=8Yy0lz3KmNJ83FWUp1yBEkbRTBtWXpsB0DdVCOOuX7k=; b=Byft+c5UBl4wWT6aUgPjVXAaI1C+blM7T5EGo59RTneGXOhgqB+tsqpZ7Jeh2GwxyHLq ZrWNq+pQw/62T+r9gPnrbo7XFdnnXcOc16IpHw3fnDn0hiQs0E8vLqt2qCORzzttaaBEv cQVXAL9oPHMVmfKApXOTRZPBmeoKBjIbMyd9rBgrSPfOoPRHgfVEdlmgHdh8AttWcRbAp Re3msiNKsQnbIYc3yUX6kPLZKDwIxaL8Vc9pHOUQE46l95S24HgnYM4miJeXUpWJzncpo Guj1QurvcQ7h/03Z5LtXmLz1hxbnUYQI3i2sFEboO4KyQo1GmnZLuS/iOFQaytdr4Uw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=apVLMVkZ; arc=none smtp.remote-ip=74.125.82.170 Received: from mail-dy1-f170.google.com (mail-dy1-f170.google.com [74.125.82.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8893D606A332 for ; Sun, 6 Dec 2026 02:45:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8893D606A332 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.a=rsa-sha256 header.s=20260707 header.b=apVLMVkZ Received: by mail-dy1-f170.google.com with SMTP id 5a478bee46e88-3866a784546so3056066eec.0 for ; Sat, 05 Dec 2026 18:45:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796525107; x=1797129907; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=8Yy0lz3KmNJ83FWUp1yBEkbRTBtWXpsB0DdVCOOuX7k=; b=apVLMVkZ6w30Xg8Fi9zHA+n/RdTOcz1XqV+2uZS5u/S+suR9TOLvp3ny6Bw2Bi6JlH xy4WY7e5qzHjx9J3R67WP+UMxXE/6Qp6nMit7OeCdEGb1hnZbZEtjIfvqM/ZANSJ22QB u+7WYS3OVyKwU1KBM3FBGKOQ54RMCooqXmx9VsBQ5nIIncJeVcBB3c7cgXup31brLYBW /vM6SBbTdSASZrNv8m3ftSLtyQARxhtKOziCvPQ9+BhA6itypA7vWigmcRu+KZSzuBhO waNVe3UnWNo3GFUmZx2hP7cA3dywxtqtvGqzz/unX0D6SvSxnZGQFvO69sYr6HXyuAUp zd9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796525107; x=1797129907; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=8Yy0lz3KmNJ83FWUp1yBEkbRTBtWXpsB0DdVCOOuX7k=; b=qJD1ggoEvvwyYlrCNKl4D+ctk7W1fJ6+/UqGz4hRfwUnz3ob4xARugowBlE6f0onB+ H6T0snyz3Anpt/Ex9ZxC1uhzGtMZ3duBahNzY8ILoDcy+0f4rsPpmPXvG59uIXuoDEXC WB8XKNENRWYLXLVm4EJgHNGiToERGNMrjlKGDR9x6GNpPI8y3jN7ukYLXbhOez19v8mM OlyiNK8jW/+YSyghY+100dyL2Q2Jt5z27clgPcKeYUCgdZX8K0ZJBeFY5KIBvmW9MPcD gh+2pzaJmQjFCE5K5rusvY56OgOW4lFhaxxXZaMzpJ/ztsgex193A0ef13Yk9kTn/7q/ bazA== X-Forwarded-Encrypted: i=1; AL+hErGSIeOzulQkLg2z1Pi6IzS72LX840JnHvAwo7bNV0NZco2ynx5UN1zJkA2wUgCq3BKSLFBM+6IzrFLwVQ0=@vger.kernel.org X-Gm-Message-State: AB4q+uHuIFxve/0kdA0qTjM33I7KrYSafJC1OU+Ebrc2JEA22xhYYGcL YxqOd6t4clTZ83t4jMJtM2bvVjuTgHt4hidXbOFRZHM6p3P1jAgd5maS X-Gm-Gg: AZFdTZcOgjYB4+qoLKTUV2icpw7T777vUxJt4jHt03KexQpLvNzndDVPClc34SM962B UpfqHuf4Wo8R0W0nDrCPm4oD4XDBePXnYAXc334cDot2qGw2JKxlM+eWYXWoqHQ7MLx3vgoWBqL 3GhtGIZLKI/a0TqNaV3mdoaicFPddx6Rao8bR5TbWUVhDvoVoHtfdpDbM/eBPlYkKLXlkkUDxq4 Qv8Zo48Y7brEOYBBJ3VxtvuD0fGZDWOUKB/PCn8cl7v00S3L6J0Vqs/ClF1WtpLRbr0cygbuvIQ W8QyXEboba9yfR8mel5GsjH0Mb2zCvFXvLEjiDtNT/+RYd4aqnBKcEVTePufkXty3Z9H1RRajcm iPx9jh7jVC5DzmmNmLU6PULRnuDvj4rPXyGOl1daDgkIgRjgM4OGplXCQwghNOlB1Mj7SDfVIL9 XuJwo1bsnQS3YjNYwl9EXulV958AxD1vHMgK6ean7Enzcg7AVlAn8UAHvZ9euzBwLKOVneyMuby GaKUq00Zbjc7lqIS2njafWdLF4M5a2rxQkPR6EUZTBbie0iGT0CiayrdSp0qbsMxUk5glJqCndH OXl2Jx3Fn7zVfkqabRABO5pWxMOjXZ0zZxN86l+yUS/FIMSBOvTqKweQS7SHsxoMSLj/AxMn80R 5hCrjTeE3jh4mBjooLHIGaAVdc/oGRrY/Gacw47u1C4Bxaav4PIO7qE5mxwonKXR/Pog1XTGQhA QVqQ== X-Received: by 2002:a05:693c:87d2:20b0:385:8aea:11bf with SMTP id 5a478bee46e88-38752191203mr6380222eec.41.1796525106529; Sat, 05 Dec 2026 18:45:06 -0800 (PST) Received: from ryzen.lan ([2601:644:8000:37f::e34]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3875218bd23sm25637026eec.8.2026.12.05.18.45.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Dec 2026 18:45:05 -0800 (PST) From: Rosen Penev To: Bastien Nocera , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 00/12] usb: apple-mfi-fastcharge: Fixes and cleanups Date: Sat, 5 Dec 2026 18:44:44 -0800 Message-ID: X-Mailer: git-send-email 2.56.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series fixes several problems in the Apple MFi fast-charge driver and modernizes it. Patches 1-6 convert the driver to devm resources, use pm_runtime_resume_and_get(), fix the usb_control_msg() error check and timeout, register the power supply as POWER_SUPPLY_TYPE_USB instead of BATTERY, constify the property array, and name the power supply after the USB topology (busnum-devpath) instead of the device number, which changes on every re-enumeration. Patches 4 and 6 change what userspace sees: the power supply type and its name. Patch 7 re-sends the fast-charge request on resume. A failure there is logged but not returned, since an error from a usb_device_driver's resume makes the USB core skip resuming the device's interfaces. Patch 8 adds a mutex held across the USB control transfer, so that concurrent writes to charge_type cannot leave the cached value different from what was last sent to the device. Patch 9 enables autosuspend. The device keeps charging at the fast-charge current while it is USB-suspended. Patches 10-12 are small cleanups. Tested on an iPhone (05ac:12a8) connected to an x86 host: - Fast/Trickle switch the current the phone reports for its USB charger between 2400 mA and 500 mA. Invalid values are rejected with -EINVAL. - Two writers sending opposite values plus a reader, for 3 rounds (about 670 writes): afterwards the cached value always matched what the phone reported. - With usbmuxd stopped and ipheth unbound, the phone autosuspends 2 s after its last use. It kept charging while suspended (34% to 43% in 433 s). Writes to charge_type wake the phone, and it suspends again afterwards. System suspend and unplugging during a write were not tested. Claude Code (Opus) was used to help prepare these patches. Rosen Penev (12): usb: apple-mfi-fastcharge: Convert to devm resources usb: apple-mfi-fastcharge: Use pm_runtime_resume_and_get() usb: apple-mfi-fastcharge: Fix usb_control_msg() return check and timeout usb: apple-mfi-fastcharge: Use POWER_SUPPLY_TYPE_USB instead of BATTERY usb: apple-mfi-fastcharge: Constify power_supply_property array usb: apple-mfi-fastcharge: Use topology-based device name usb: apple-mfi-fastcharge: Restore charge current on resume usb: apple-mfi-fastcharge: Serialize charge_type access with a mutex usb: apple-mfi-fastcharge: Configure runtime PM autosuspend usb: apple-mfi-fastcharge: Name the vendor power request usb: apple-mfi-fastcharge: Rename battery variables to psy usb: apple-mfi-fastcharge: Simplify match and property_is_writeable drivers/usb/misc/apple-mfi-fastcharge.c | 171 ++++++++++++------------ 1 file changed, 85 insertions(+), 86 deletions(-) base-commit: 29beb21c21ada7207692b2d69fc58dcd15dab6e9 -- 2.56.1