From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.181 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796525107; b=LQbNe3rrlpqeDZZQJIlR9CMMVESNE4ezUe3YRy3vR9bF3CV9P3u7nruB+t1+J08B1FKG B4JOkNrFnMLv43AnAvlHL3y1X7T1h0Sa+It9WNazA2OkmAbPxoYnke3vr4jmp12BEutvM pPBTlSWzzLqXvIqzZXWHPq3y1Lo5htIiQs6G2wnJZSIFscsiro+Ev95j80LG5rskSEW8P g4k16eA8AV1rYpvI6AKMG9qdovJmLzBKxhVjOvuxbVUyXfhLtr2L/B0L0//TPeQi9NHRw DiPfS5KtDJ+V0T70Sna79+6G+ipFBBcgIZn8hnNUniuLbsZMojbhL8QFKRVIn56EwrQ== 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-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=4sCghO+ah2JutR1zHx/VXTxhVuGiWk6Y2HSDjwyg8Z00NIxVxPyVg/RU0gLRNl03+Qu3 H0HXv4PPldSWgiLI43OMmjc+lykRpCEsZXgRbrl+iYnPaBB98hBxdATiG+tA442+IVvX8 AHwnmJtO3tq7EN7ePQYSR2/yUM0RNguR6Ma6Hz7tXUsjcGb8TPohOB4tdHCfeV3DtIRTi PswjZWLPblNfFZG9xKRokNhgNa85BSthUDGYqvVRrcuwkXpzsfRTp3VS13eSZ3OPCa1OD gcr9x1ye5d4k2lOqZ3YZmHxmMEQzQkBvY5vjjDsSY8b1pNwr9GAI/u7iSqS9Y7QR+5A== 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.181 Received: from mail-dy1-f181.google.com (mail-dy1-f181.google.com [74.125.82.181]) (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 794DB606A322 for ; Sun, 6 Dec 2026 02:45:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 794DB606A322 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-f181.google.com with SMTP id 5a478bee46e88-386ab9ab619so3605398eec.1 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=HASTFJaH+eLxacRBcPAJRcselE3ZUE0pYKUQ074s12oefvORn7WHlOCjRkdmM1+QRj BjBDQiqVBwBOxuj2kLbFSbNgSaaF8v68PLHgSDcAvMGx/bO3Vgv26jhef77ziLCGUfk1 g5f7XNMMdexPkfgnQwogn2N29Xg8qTCjqH0hPQpYaclGvhTaQfJ+trDWuPwYhDq4EYxV kaatLhqC5cGX5ULISl/8AYqKyL+mJTnu4N8VS/ctTfTAlyPtLHLE9F12XKubJu8Pkyjd DMDW8Q96ecbzxngQTcYe0TziZkUBcpc7khUPNQGmPh1epJDkp1qzvqdx/frLTZZaf5JE ywug== X-Gm-Message-State: AB4q+uEWZK5+ZAckCNmA52kVeleoYzmKRqBHrvjQf7BjsvqxoDF2BsEc lvTsG+x6GIWEikKATRkDOsaXaqauTZuVNF1WVzMxfbHrHnHq/QCLJK6w X-Gm-Gg: AZFdTZcMvYy6x/ErS0cKX3+Gn7XtV0LWT9AgxyMTqokZSxcdQ+RSqJJW4ehKd3NHWiJ Sq4w6SZ0u8KFp0UoEBgTBtmMBDS6509k5E3o1XbHyQBFJf29IYjOyz4S80fyT1ylW8oWYyTxt9L Yqq/AbnQYjKxkL6nSidnBJwbSL9+AiQKSwz+hWtWICPsavnDoHI3HU/P9qLM9032M7KA7rwdG43 AS1QWuCDE1LDnFDM5/3YQnNHcD0/noD0VoMx1TLgwY/irZJp//2IgQlDJmgGT4XBzqFpGmZOlEv Nqj2TT0r3U367RUt6T9Z2ydyZNAL3fHb+zrnJP3N1/btIrPaiv9EXLKLeXaPrcR/0Nt+ygSnwzj vkmp9ICW479hJ9lYwGXiW8bjZoLRF7nJi82WQ9D1vYEH0ThLsM7y7RFm5ySbAhTovRbe4WhtmSX EF7XrtznbimQQ2NllnRKqtAQCFVVy/XchRr721OlnHod8aozqdkzPqWpq4H2fm4Qa4kqT8wNXM8 ukJSSIoo87NpQRfxvyKCMrM3ElBH7cHE3I521/BtNYq52VIdYCmw/41GHK1jjkjVs22Bq+nyGyi /6ECE45ynPjJEnpWWsAbLzkfyMm4gwfghiU5SR0cvDw8wwK8RPkXSUgr4QjuQb4VfwoOUmujKq0 YadyRM1nOHyLqkqXNbg9eniWziLTUHNxUvScsORN8h+eQ08dzLh7fKzHgakvX1T+yzw19FQwOPc 2Cig== 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-usb@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