From nobody Thu Sep 24 23:34:52 2026 Received: from mail-ed2-f31.google.com (mail-ed2-f31.google.com [74.125.228.95]) (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 CAA5A502D61 for ; Fri, 18 Sep 2026 13:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.95 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739814; cv=none; b=r2AbY3Jdbx2J47yVtT4maS36dME8e5Iqx9S7ZiCIEzLmjyHVMayhx0UbTbeoqMWu903b4D9KI+IkF0OjQ0dIf8mX2D/M85TzOW2kMhNR7ZdHTcd0VQ+NY+Je/q6bI1rF+GptDoo6+ox6Elw7pvOr6qlb/JeFFJaF8+vr4R2yoFA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739814; c=relaxed/simple; bh=IoXZ1reQlvpqJte8Azuyv4AEJ1+ZnvZqFWxjllzwkAs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZdBtrV8+xw/C4MJV/7FedmUgEFxLz0t3ra9XCpwv0HTsIK9jlobQhOlsSVA//F1lcJIj4j20D5hh87IABvtAOCfT+kHCtcdzpZEReTPnxKs4+ii4MxhUX1wsI7TcoRzvEH5McN4WCSuStr9bP5Re7yOD3IatZB+JIrcKVddUTcg= 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=eEs8QZdb; arc=none smtp.client-ip=74.125.228.95 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eEs8QZdb" Received: by mail-ed2-f31.google.com with SMTP id 4fb4d7f45d1cf-6aa053900f5so1295197a12.1 for ; Fri, 18 Sep 2026 06:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1789739809; x=1790344609; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=LsT9IFRHhiJUngj7BjrND4Gxc3zxhQTn9THAcGWlf5k=; b=eEs8QZdbFDOmLcKCF0Z9C7N+cJsNeMFlUNVYMRTctXa7lNkBhE7xxbPCNOsSwaV3m9 q0x+NzUyy/g3vpYzJwblOjvhwPSOyhINB6LXHKQPqSZi53WvssUUVy2HJ0yzvuuUpesl igPYrEG2/oiiYUKfFpgo3VjH63mPbXH1mXpaFkn/reobAT9g80rbN3I2dhlP6SRrHr+1 sC2GPyWOi0TY9IypRetw0csnffaz6SbB0Nv7Y/tsUspZzE2DZYkXlzGf0VRjc/ALksGW mZ3kRBjwVBpH7tL2Iva2iu2VbuMF+VEwU88WeRsSX46UVYTkVbL8fZRFWmBM5IxNswIV sx3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789739809; x=1790344609; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=LsT9IFRHhiJUngj7BjrND4Gxc3zxhQTn9THAcGWlf5k=; b=yu0QoaVGHwtxqSN8yKQA01Cv9s6xC3A4HQhVE42Yi6T0lvZmNcBREiWZFhu3WqzNJB 61NOdnXo9Drhb9MukE8b6//QZMBBKsbJXTjXUXDLMzJb0KiX0jFy3wbvCvDxJp6P6OR1 T51nSuvMuEoUP4uc2XtqG4luynWYT0rsiFKrDMDvy4uP7yBbbdW7sQxesJCuEqGZLHAK efcdef9yJPtdhIoU5kLZpHn9o9/RB5vxqrimMrhBnL7+VQF0fGsUPAtUxWsVYBz08zVN ihceNdcDWspVOYiRKhfIsHf6v4mdFqEnaXaHLaOpjjn4YPX0QiZs8V2SJGPV2Mi0q3cj +eWg== X-Forwarded-Encrypted: i=1; AKwUvByLGg863FY7Sl8vuplgSviN4xRmcSV5y03D0d+wR/J6LbbrlXaxinLtYvyp22IwgKsmOw3FLQ04wgJPX3s=@vger.kernel.org X-Gm-Message-State: AFuF++kxWTOXVtLC3KWEmC3MeH+4b4LHl7OmsSHuq0/lyhil9Qk9oNO3 ouQTHtwoJSCRlxFBi2LG6/nV61FvqIJcxYARSzv6IZHmvW01IMOrYD16sVB2WyAxIkQ= X-Gm-Gg: AYBFou3I1OxSRXParv9XhQkG8PvpETge692rthta3zRLyNLFodQDjkzG2KgxFLt4zwV M327ktC9WNCLBXb4ia6TmrSR38yx/WlSToWG3vN1e6BY1dYgktYI8Zkphwu7JauLsmOXTOzVlpL 3Wk6HtZuoTvWDFaPGKZzojYbjmcADU22/nJEOEDIR/pseoEFQCcFmiWwpN4xsq+y3ETVBKazphM wraDwaSMRlZEpxSaqCXTIgtJq3CCQRS+JdY+mhL/+Vm/XMPPHedHVbBNAKEcRFGzzI6mKzFXHqN loLXvzN/VMYBIQe5CR1HZG1ayxeqk3Zspr2gomWdqeW/mcmO+BdEDjnbaOizFEpIl22U1vVp5Ao TOD2a1F0/dPunetIsC+ECTrog88bBqOjQVwVMg49tYPSCsNH1pQm3kNAxqg90KQoQ1PqTeEvUAr x2pQEvdlPoD1pyfe7LXLAGOFh/dsAFt2fIw5k9V++Jc3GezzSrdxKNmfJE7yxtu6hldytkaBJT8 cjqiJ8YkQ== X-Received: by 2002:a05:6402:400a:b0:6a7:ee55:dcc9 with SMTP id 4fb4d7f45d1cf-6aa57861e81mr1539832a12.24.1789739808949; Fri, 18 Sep 2026 06:56:48 -0700 (PDT) Received: from [192.168.0.35] ([109.76.4.225]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6aa59730866sm915455a12.18.2026.09.18.06.56.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2026 06:56:48 -0700 (PDT) From: Bryan O'Donoghue Date: Fri, 18 Sep 2026 14:56:36 +0100 Subject: [PATCH v20 1/6] phy: core: Fix race-condition between _of_phy_get() and try_module_get() 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: quoted-printable Message-Id: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-1-dc244e124e71@linaro.org> References: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> In-Reply-To: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robert Foss , Todor Tomov , Mauro Carvalho Chehab , Konrad Dybcio , Vladimir Zapolskiy , Bryan O'Donoghue , Loic Poulain , Vinod Koul , Neil Armstrong , Greg Kroah-Hartman , Kishon Vijay Abraham I , Felipe Balbi , Manivannan Sadhasivam Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-phy@lists.infradead.org, Bryan O'Donoghue , Krzysztof Kozlowski , stable@vger.kernel.org, Manivannan Sadhasivam , Oleg Keri X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5454; i=bryan.odonoghue@linaro.org; h=from:subject:message-id; bh=IoXZ1reQlvpqJte8Azuyv4AEJ1+ZnvZqFWxjllzwkAs=; b=kA0DAAoBInE7s6GNyDoByyZiAGqtQxuhxTNWuBxqGuGf4V9voyix+7h2Kuf1dI47lzHHNmTBP okCMwQAAQoAHRYhBOaT+yqro23hF6tvtCJxO7Ohjcg6BQJqrUMbAAoJECJxO7Ohjcg6384P/2Eh 8FioUFRtKvwe+A5sax2BlOE4qxn9ftzFmOdVa4B2dygKtvtNV/+kvY5kVAtlP/JTiJFrDum9DD5 cK4rRdBM8uNLSTPE2NqXT64fJOsUoh6f7vNq7QFHV/VDbMQB1CTuVogQHt39lQC8N7uM+Cxl0NF qvhdMQLt6OdscwOFltQA9MtQasI1P6oF3OP+NZ28dEiKIznl+2eMWwxVJivnyYNdqoipXzc7++M B3S2pV3hM12q5Ue7u78V7mljnO8hpCIi3EtSE3qpL6Y/WS356g0vH5b1Sp3TOHLDOez9B+ClpGx 6ifC2wmhq9u1oNmMFPAsR+bVCfJJ0ABv3Pu4ARjzTM49iNTB9vzWrMIPMBEtovb658J/VueYMCA l8pr4Akln3NVS6hfymeXoUfDgoMuKb5eoR9gYW3/V12td55PlAs7VgKcBQdhuYj9VNcXEf/i2Ot 8+OYZld8Qajo022Xrab/ZFu4W3gFpkLKiMXBhMAWgYNOYcIP2/Q2jjaZfn+wkidvrfAuUwjCMQs R+XJ8bAKr8ypCM0iKtjmdFIqYN53SQYPZlLrGzlYxk37Mku2WSIyI1NRUtWCuqpxnOIh1jtz1A/ VtKAWUBCLe3pG0/atadTuCgu1KYwO1+B2nbsgc/gXo5UgeT590/Zbb5eDvkpFSEV9T8rD2kH0xJ vJm09 X-Developer-Key: i=bryan.odonoghue@linaro.org; a=openpgp; fpr=E693FB2AABA36DE117AB6FB422713BB3A18DC83A Sashiko asked during a patch review if the existing usage pattern had a race condition; specifically in of_phy_get() if it was possible between returning from _of_phy_get() and running try_module_get() that a module might be unbound leading to use-after-free. Looking at the code this appears to be so, there is no linkage between the phy and module under a synchronisation primitive. Using the phy_provider_mutex in phy_get() will ensure there is a link betwe= en the returned phy pointer and the module_get() bumping the module reference count. Amend phy_get(), of_phy_get() and devm_of_phy_get_by_index() to fix the same usage pattern. phy_provider_unregister() must take the phy_provider_mutex so amending phy_get()/of_phy_get() to take that same mutex guarantees there is no use-after-free. Fixes: ff764963479a1 ("drivers: phy: add generic PHY framework") Cc: stable@vger.kernel.org Reviewed-by: Manivannan Sadhasivam Reviewed-by: Loic Poulain Tested-by: Oleg Keri # Lenovo Yoga Slim 7x Gen 11 (Glym= ur) Signed-off-by: Bryan O'Donoghue --- drivers/phy/phy-core.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 21aaf2f76e53e..89addd732bff3 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -124,13 +124,13 @@ static struct phy *phy_find(struct device *dev, const= char *con_id) const char *dev_id =3D dev_name(dev); struct phy_lookup *p, *pl =3D NULL; =20 - mutex_lock(&phy_provider_mutex); + lockdep_assert_held(&phy_provider_mutex); + list_for_each_entry(p, &phys, node) if (!strcmp(p->dev_id, dev_id) && !strcmp(p->con_id, con_id)) { pl =3D p; break; } - mutex_unlock(&phy_provider_mutex); =20 return pl ? pl->phy : ERR_PTR(-ENODEV); } @@ -624,6 +624,8 @@ static struct phy *_of_phy_get(struct device_node *np, = int index) struct phy *phy =3D NULL; struct of_phandle_args args; =20 + lockdep_assert_held(&phy_provider_mutex); + ret =3D of_parse_phandle_with_args(np, "phys", "#phy-cells", index, &args); if (ret) @@ -635,11 +637,10 @@ static struct phy *_of_phy_get(struct device_node *np= , int index) goto out_put_node; } =20 - mutex_lock(&phy_provider_mutex); phy_provider =3D of_phy_provider_lookup(args.np); if (IS_ERR(phy_provider) || !try_module_get(phy_provider->owner)) { phy =3D ERR_PTR(-EPROBE_DEFER); - goto out_unlock; + goto out_put_node; } =20 if (!of_device_is_available(args.np)) { @@ -653,8 +654,6 @@ static struct phy *_of_phy_get(struct device_node *np, = int index) out_put_module: module_put(phy_provider->owner); =20 -out_unlock: - mutex_unlock(&phy_provider_mutex); out_put_node: of_node_put(args.np); =20 @@ -678,15 +677,21 @@ struct phy *of_phy_get(struct device_node *np, const = char *con_id) if (con_id) index =3D of_property_match_string(np, "phy-names", con_id); =20 + mutex_lock(&phy_provider_mutex); + phy =3D _of_phy_get(np, index); if (IS_ERR(phy)) - return phy; + goto out_unlock; =20 - if (!try_module_get(phy->ops->owner)) - return ERR_PTR(-EPROBE_DEFER); + if (!try_module_get(phy->ops->owner)) { + phy =3D ERR_PTR(-EPROBE_DEFER); + goto out_unlock; + } =20 get_device(&phy->dev); =20 +out_unlock: + mutex_unlock(&phy_provider_mutex); return phy; } EXPORT_SYMBOL_GPL(of_phy_get); @@ -786,6 +791,7 @@ struct phy *phy_get(struct device *dev, const char *str= ing) struct phy *phy; struct device_link *link; =20 + mutex_lock(&phy_provider_mutex); if (dev->of_node) { if (string) index =3D of_property_match_string(dev->of_node, "phy-names", @@ -796,15 +802,18 @@ struct phy *phy_get(struct device *dev, const char *s= tring) } else { if (string =3D=3D NULL) { dev_WARN(dev, "missing string\n"); - return ERR_PTR(-EINVAL); + phy =3D ERR_PTR(-EINVAL); + goto out_unlock; } phy =3D phy_find(dev, string); } if (IS_ERR(phy)) - return phy; + goto out_unlock; =20 - if (!try_module_get(phy->ops->owner)) - return ERR_PTR(-EPROBE_DEFER); + if (!try_module_get(phy->ops->owner)) { + phy =3D ERR_PTR(-EPROBE_DEFER); + goto out_unlock; + } =20 get_device(&phy->dev); =20 @@ -813,6 +822,8 @@ struct phy *phy_get(struct device *dev, const char *str= ing) dev_dbg(dev, "failed to create device link to %s\n", dev_name(phy->dev.parent)); =20 +out_unlock: + mutex_unlock(&phy_provider_mutex); return phy; } EXPORT_SYMBOL_GPL(phy_get); @@ -961,15 +972,17 @@ struct phy *devm_of_phy_get_by_index(struct device *d= ev, struct device_node *np, if (!ptr) return ERR_PTR(-ENOMEM); =20 + mutex_lock(&phy_provider_mutex); phy =3D _of_phy_get(np, index); if (IS_ERR(phy)) { devres_free(ptr); - return phy; + goto out_unlock; } =20 if (!try_module_get(phy->ops->owner)) { devres_free(ptr); - return ERR_PTR(-EPROBE_DEFER); + phy =3D ERR_PTR(-EPROBE_DEFER); + goto out_unlock; } =20 get_device(&phy->dev); @@ -982,6 +995,8 @@ struct phy *devm_of_phy_get_by_index(struct device *dev= , struct device_node *np, dev_dbg(dev, "failed to create device link to %s\n", dev_name(phy->dev.parent)); =20 +out_unlock: + mutex_unlock(&phy_provider_mutex); return phy; } EXPORT_SYMBOL_GPL(devm_of_phy_get_by_index); --=20 2.55.0 From nobody Thu Sep 24 23:34:52 2026 Received: from mail-ed2-f29.google.com (mail-ed2-f29.google.com [74.125.228.93]) (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 558D74FECFB for ; Fri, 18 Sep 2026 13:56:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739816; cv=none; b=fafYiNEX59eMrgaqrYot5uiPQuxwyRU5hg9ZGuU0UnWVoe2OUO+/DhpLw2aiN2Rb/0vWcYLThJ1Xw20PCpLO2WfnTqpnBQ3MrDEF17eZjM3YiHyY8WbYaUpN+WOU5MvaR4/e9TmDvFi2u3QDjcbCjMoxMhGkhBbnveDeJdzsiPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739816; c=relaxed/simple; bh=X+b9HWNkFpTSELC+pQKN2+ErKNjGyicH/BBE9Xjuc5Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dFj+LKupHMZtbiJOcGJpUD+dU9ucc1+2YUXOmYroaT8QZip7lZMLYpSpnAU3RmgOpLaKQMxMPkW2DNGxcKoEBPCYxXIkm/mW3Al1P6gzTIDBoQrqfBbkxyZX73qTAw59S3h+zqoNiKkeiTk12BMRDwR+/X+RlGw5ufQZPqGJQuk= 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=jGKPY8NP; arc=none smtp.client-ip=74.125.228.93 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jGKPY8NP" Received: by mail-ed2-f29.google.com with SMTP id 4fb4d7f45d1cf-6aa0ee64afdso884729a12.0 for ; Fri, 18 Sep 2026 06:56:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1789739811; x=1790344611; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=I0tAWo8cXsvcEAHoDAoVuGWldwoawSSoU2jMNY+PQMI=; b=jGKPY8NPy9SRi+erqXXno+cLDvAp1cGjgGpMlE/e+WwZOPJdm0NDvGnjlt+IfyJ5O3 EP+PtZaIfVzxKFSF0rGtsq0TeJhDAMBPFCIyJ3Cj9FBj8FObcZQXffign5d8pSd5bLFs HEe2lRzmBgsYP7nXFeugl+UCayF/OrvnVD0d3ONCCQt8VnlvID+84Uj9JfLiUPcNKi5/ uuZsp8hFPkWxTZTIUjxCGh5UV9/PgTolUtFuzuNDoSQNj3I1Ed6Sg4BDvnDoooTl8lcI g8WcGyny5z/l6nLwjGGxDc4fWTMncVA9g2YP9yFWjAY8/0ta+KT9mD+du83s4PiO//ib ysGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789739811; x=1790344611; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=I0tAWo8cXsvcEAHoDAoVuGWldwoawSSoU2jMNY+PQMI=; b=GmLnekwrYY5+FA8ZaB6AX9YJteuY6yb8ELtLS0yLvAXZbtBQIfE08qjqRaXE8hWyKJ jsCO9sD/jl66HPBtSTk4Uo6FOdeNHUZZ4VlMK63kDc8OEwiItASbDi6pwmaAyLBkb1oO O9slCDqryCZ0+7h4iLjpUQtC/7H5D0mSJf5g3thFO7Ogd+GdPPmDMOyRaWeGObyUrYm8 biPyHFpeXIDEmRWKgWV42UBlNJVHtrNCP/r/mKbwSz2ZIUHa035dKtb/mz25fbPYq3jP McJyrWtZbkZp5xodyE2/ldgEGqeyJxuBNUOijmWCcgyS9Qr04uLxGv8K/GFeVVu88k+m FfrQ== X-Forwarded-Encrypted: i=1; AKwUvBwRphkwOby2s2eZYfRa/XJkIEc1D1IZBxUwCAaug2Glvqu/bc3PeeIb/4l/lT9RiIuWleFNpjblLJy3PTM=@vger.kernel.org X-Gm-Message-State: AFuF++lFGXA+8C13nZpDsl7GKYwcc0La5OIxhsShRvjzaIKN4xMbPLtu zhH0Vwwt1i+LJyn/8uI7rp//37KKCM4GucMA+p8oYXguV7FtionvNcN4qeBa6N/ibI8= X-Gm-Gg: AYBFou0KVoIeI9MCRVKhnrXcegBVpjqrPLaT8F1rV+3wxYvNVXYBLlpDVh8wzjT7tMX dOZsNtCiO2eFPEfn/aaSMWQ8cEPKHQyRlOI70fC58/avRF2DZ+30J0EEaHrt0cxlRW9Gt+BOzN/ ZwCrW7Y8izeT9Yzo/OfTezpF36ZK7lq96axsKEos2XU7RC/PzDCHe2j+TpavS17Zpr9jBAN9viC ozhaL/7QsacPbwcqv+CAMbgj2B0b67apQfKjSOUn88wn5KRnCkz694RP+cMBR1KwlHTsembZFUu wWw0ThI9+DA7/MFbFwZaFiFl7sfCi4Lw1RIiavcNIx9nFGGNjBNY8cW0EYF95Rcw0bp1XXv83CA qhEgiQhgJcTdDjrkLSDl0O8whOQaLiKu+Nl53CfkDpPopHeURJElZYtMAYND4xrBZeNaCyPlBj2 ngfp3PCkidpkakkX3DnRrEPHhtVVRapSS9CmLkzCUqVDWknvIboW7M9kaSe/cipxKkzbRlxzMU1 2+YXX18SnTG3YZldaM= X-Received: by 2002:a05:6402:320a:b0:6aa:1cf5:6076 with SMTP id 4fb4d7f45d1cf-6aa577f4d79mr3531952a12.1.1789739810897; Fri, 18 Sep 2026 06:56:50 -0700 (PDT) Received: from [192.168.0.35] ([109.76.4.225]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6aa59730866sm915455a12.18.2026.09.18.06.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2026 06:56:50 -0700 (PDT) From: Bryan O'Donoghue Date: Fri, 18 Sep 2026 14:56:37 +0100 Subject: [PATCH v20 2/6] phy: core: Add phy_get_by_of_node() 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: quoted-printable Message-Id: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-2-dc244e124e71@linaro.org> References: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> In-Reply-To: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robert Foss , Todor Tomov , Mauro Carvalho Chehab , Konrad Dybcio , Vladimir Zapolskiy , Bryan O'Donoghue , Loic Poulain , Vinod Koul , Neil Armstrong , Greg Kroah-Hartman , Kishon Vijay Abraham I , Felipe Balbi , Manivannan Sadhasivam Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-phy@lists.infradead.org, Bryan O'Donoghue , Krzysztof Kozlowski X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4675; i=bryan.odonoghue@linaro.org; h=from:subject:message-id; bh=X+b9HWNkFpTSELC+pQKN2+ErKNjGyicH/BBE9Xjuc5Q=; b=owEBbQKS/ZANAwAKASJxO7Ohjcg6AcsmYgBqrUMbqFgCjhyQpekow1DUdmmicyQGC0P3oz5uu 7moYJGlheOJAjMEAAEKAB0WIQTmk/sqq6Nt4Rerb7QicTuzoY3IOgUCaq1DGwAKCRAicTuzoY3I OrJ/D/4wge7bDfnNEDFG4/o/jA8PUy3RPzymClxjXzIvlhLZqejrR5b7qxaEBTZmhlahQKYcgfT qz2XZQY0799xUctCfuGYodol59ufPT7BquJ/MqxOvO9p4//D2kcNWeUyC877Ipp9gjw6/eSquML VTU0VJOxESxVQmy/d58WzHTw529l+YxJD3+SobRA2wMNGmsyHP6pUC7mkLwyabwEED/HNl6G2Fx 3uDRo83VfSa16FCoD+mpm7JH79rYrjXqjbpFl5VLzPpCeE50ZeLFWL7/pPAEVi606AXZ9ogfdJh 6p2Ij6SP5JXZ/a3lLnH4NxciaBbuJHL28CJZUxYITZw4wAuNB16TSxvF4MglJ1C2F2BxVhdp30W kfb1YbtmBpFDhB8FuBPgxTxa43Og2ufZJ9IxGjdoJ+x2ci7+41EfMHDxhGzCEnHQHhvjBoOVEC4 /Da858uqeB9p8g1iGPg32wb5/aBjMzDQ1HfujU3x6vZT2KkYgq8WUbCufjxO3Gp4NrdWLY5jpib 3ZfDWRHa4wugCdMtnylvNiqYyoGY5I9Mk1QLu0/Dj8zAf6kXcE1IiTVTUS73jNkydkThIWl4Tul HwmvnLn/rph3jLWPQwTGWOYMJlBkclkgT25uxZS8+OnLSYmLVNVCALADqJ7vzJGtMREgvLotnoT Zi7ETVGmzOzA2Vg== X-Developer-Key: i=bryan.odonoghue@linaro.org; a=openpgp; fpr=E693FB2AABA36DE117AB6FB422713BB3A18DC83A Add new function phy_get_by_of_node() allowing lookup of a phy by device_node. Separates existing logic in _of_phy_get() into an internal helper method _of_phy_get_with_args() to allow for reuse in new method. Signed-off-by: Bryan O'Donoghue Reviewed-by: Manivannan Sadhasivam Reviewed-by: Neil Armstrong --- drivers/phy/phy-core.c | 83 ++++++++++++++++++++++++++++++++++++++-------= ---- include/linux/phy/phy.h | 6 ++++ 2 files changed, 71 insertions(+), 18 deletions(-) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 89addd732bff3..42c27a2b45159 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -606,6 +606,38 @@ int phy_validate(struct phy *phy, enum phy_mode mode, = int submode, } EXPORT_SYMBOL_GPL(phy_validate); =20 +/** + * _of_phy_get_with_args() - lookup and obtain a reference to a phy by of_= phandle_args + * @args: of_phandle_args to the phy + * + * Returns: the phy from the provider's of_xlate, -ENODEV if disabled, + * -EPROBE_DEFER if the provider is not yet registered. + */ +static struct phy *_of_phy_get_with_args(struct of_phandle_args *args) +{ + struct phy *phy; + struct phy_provider *phy_provider; + + lockdep_assert_held(&phy_provider_mutex); + + phy_provider =3D of_phy_provider_lookup(args->np); + if (IS_ERR(phy_provider) || !try_module_get(phy_provider->owner)) + return ERR_PTR(-EPROBE_DEFER); + + if (!of_device_is_available(args->np)) { + dev_warn(phy_provider->dev, "Requested PHY is disabled\n"); + phy =3D ERR_PTR(-ENODEV); + goto out_put_module; + } + + phy =3D phy_provider->of_xlate(phy_provider->dev, args); + +out_put_module: + module_put(phy_provider->owner); + + return phy; +} + /** * _of_phy_get() - lookup and obtain a reference to a phy by phandle * @np: device_node for which to get the phy @@ -620,8 +652,7 @@ EXPORT_SYMBOL_GPL(phy_validate); static struct phy *_of_phy_get(struct device_node *np, int index) { int ret; - struct phy_provider *phy_provider; - struct phy *phy =3D NULL; + struct phy *phy; struct of_phandle_args args; =20 lockdep_assert_held(&phy_provider_mutex); @@ -637,22 +668,7 @@ static struct phy *_of_phy_get(struct device_node *np,= int index) goto out_put_node; } =20 - phy_provider =3D of_phy_provider_lookup(args.np); - if (IS_ERR(phy_provider) || !try_module_get(phy_provider->owner)) { - phy =3D ERR_PTR(-EPROBE_DEFER); - goto out_put_node; - } - - if (!of_device_is_available(args.np)) { - dev_warn(phy_provider->dev, "Requested PHY is disabled\n"); - phy =3D ERR_PTR(-ENODEV); - goto out_put_module; - } - - phy =3D phy_provider->of_xlate(phy_provider->dev, &args); - -out_put_module: - module_put(phy_provider->owner); + phy =3D _of_phy_get_with_args(&args); =20 out_put_node: of_node_put(args.np); @@ -1001,6 +1017,37 @@ struct phy *devm_of_phy_get_by_index(struct device *= dev, struct device_node *np, } EXPORT_SYMBOL_GPL(devm_of_phy_get_by_index); =20 +/** + * phy_get_by_of_node() - lookup and obtain a reference to a phy by device= _node + * @np: node containing the phy + * + * Returns: the phy associated with the device node or ERR_PTR. + */ +struct phy *phy_get_by_of_node(struct device_node *np) +{ + struct of_phandle_args args =3D { .np =3D np, .args_count =3D 0 }; + struct phy *phy; + + mutex_lock(&phy_provider_mutex); + + phy =3D _of_phy_get_with_args(&args); + if (IS_ERR(phy)) + goto out_unlock; + + if (!try_module_get(phy->ops->owner)) { + phy =3D ERR_PTR(-EPROBE_DEFER); + goto out_unlock; + } + + get_device(&phy->dev); + +out_unlock: + mutex_unlock(&phy_provider_mutex); + + return phy; +} +EXPORT_SYMBOL_GPL(phy_get_by_of_node); + /** * phy_create() - create a new phy * @dev: device that is creating the new phy diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index ea47975e288ae..71c2e16397130 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -284,6 +284,7 @@ struct phy *devm_of_phy_optional_get(struct device *dev= , struct device_node *np, const char *con_id); struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_nod= e *np, int index); +struct phy *phy_get_by_of_node(struct device_node *np); void of_phy_put(struct phy *phy); void phy_put(struct device *dev, struct phy *phy); void devm_phy_put(struct device *dev, struct phy *phy); @@ -493,6 +494,11 @@ static inline struct phy *devm_of_phy_get_by_index(str= uct device *dev, return ERR_PTR(-ENOSYS); } =20 +static inline struct phy *phy_get_by_of_node(struct device_node *np) +{ + return ERR_PTR(-ENOSYS); +} + static inline void of_phy_put(struct phy *phy) { } --=20 2.55.0 From nobody Thu Sep 24 23:34:52 2026 Received: from mail-ed2-f12.google.com (mail-ed2-f12.google.com [74.125.228.76]) (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 6733C5038F7 for ; Fri, 18 Sep 2026 13:56:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739816; cv=none; b=dTku1w6IJAxja9knAh1mA1UrTfZISO8z2pYriQ5AZeJwLWfjSzWTqyhzGGpuBlERyAKyeDmJKsWnWMR8UPSDJkVhvi727TMJinA4z7KA8wBVc2EuTKuEuxC5pCLCw+V0beMQESd7+0FFWzIbKq7MZNziOFersPcEupaECXb/pMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739816; c=relaxed/simple; bh=U4KWrtkdrf8AbsEYFUaWO89GB+6jXI+2zX+mv1VyPB0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N1wess6rF7o/H2XGGob2PZe63R67k9MFlfYj6/MihSbwj0YMaK7XiGh0IHIEjtk6wxGbTXmzQWAz+OeFKsvP+U1kjraAXDryTktHBadMn7MhSP0ydyNV1IKbu6RYX+hY8LEkTB/afaDZO/hFqX8IxAh9z+LZht4OLcAj4RXdziI= 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=Dg5BngLp; arc=none smtp.client-ip=74.125.228.76 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Dg5BngLp" Received: by mail-ed2-f12.google.com with SMTP id 4fb4d7f45d1cf-6a9984f9adcso1273853a12.0 for ; Fri, 18 Sep 2026 06:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1789739812; x=1790344612; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=yWeQAK/2AvrW9g7LNaT13bKf+X/ruOu9J45YLkmVnXE=; b=Dg5BngLp0ASA7toWYgRMfl4l9MXdDljBotxXab7D+1r8zSRhNeHIlPyJ97O4FJT5mP 1qIkAVZwW0s4qMJsw09ru/oBkHEF3NTxYzZhfiLlVqCKAxc/YPgTBM/g29h4kQFZEWuw /N0dHjiWG4zTTot7xiRl5Up7/h7ATL/v+8F8+kp53MrJj+GoqnnQsYTu0olyNZZYh4lk W75lM8xFrkBKyki2ZfNj1KsoNCJTNIRChgD8Nd3QGffN+BzU7E2558cmJELm2BUefQJz XHPsxR5bZZ8Oao+snX8U1GSyBB8CMvm85cKVW4i+6x+ZRlWMF3HxuU+5cX81rLVcDmNv p6kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789739812; x=1790344612; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=yWeQAK/2AvrW9g7LNaT13bKf+X/ruOu9J45YLkmVnXE=; b=unygq6RB7budywY4zXvf+GTDYJeXAJw/ZLj73E8VbSQf27l/TjwbjiKtyY/W+hF6/i p0JVg51nO3N402VDjwg9lXAi7aKPvYRXC6JMxLyyvkFX8NDQvdT3Y3P840nSQQVl4oXw 4pTzteVA7p+eIs0E/M6ny325turgfOoRbsIaPxRQht79d9V64A1pjNCABJuoZpQLCi0U yfolq8JVIoc87FN0dsd/QBgAygao4J0vK5cNLRxGksB3a0kbzW2Fe+1vcFRrnrcDJ3Sf mKCdPEvjQJta1XcDBpqGwnQXVdK3z5m4Up2bSMgWo4/k02smK63p1rwC0IJhsZ6JNRMU tclQ== X-Forwarded-Encrypted: i=1; AKwUvBxcpH8kgkU2mtGOtne+ciKDF1uQg/wDlfBviQEuz+S5kIUyMj1fecVuEsiHSqIWsMkA67ktFShbvXz8GCM=@vger.kernel.org X-Gm-Message-State: AFuF++lasyuWVIx5v63OcuW+5gOVDrR4krXzTf4GElvc/YYcGTT1QEJE hfm03Zj4WMz1bFgwX43+zRK2ytsMLHZ6tp9UPFZCzVY0xWE0TyovtyHHGC5xlbgxI0U= X-Gm-Gg: AYBFou3GAU3IWO159XLeIfpwEczXs8uLQwkeFvHKKV3SbVB4rYrctEnghkhcG+QZhsN wuCBNdLhOvjMtJI1glXQ1/gM5ZCnpMQXlamK3LmijvsNGsz1b51U339dftdzvB/6gTr+qFM2pnT rPDXbIQHXUKiGlwm45ZPNnhegFE1UaWwNajKyKlD6kJffxtJkbyNXa2Su7kkHJFJ+ksIrTZiewW hDVgWGnWkr6r1Hq0690xKmo/BkeyMq9H8ojGU6c8cwQJN2rIqaAZUUKw2rETomRSRdxve8sNWvF bGdP29njmq7x1H6/wsLSTqNvuD6GtxwBfUJCroSTAMew7dTwqxLnvm9DBWcwuyT6+JGt52u8XXq dHmValExV1ox6YcPqNrT3ck4HpF8rMmKXBJeASofMQBJl2vPeMs73ZS0RyO2gsRLjZ0X12+LJ7a UE8/y3/oFvQ5yVW9Wy7SsoN+wu1iOIhwHT9K2FdSYci+yZrLk4R9fvYnXSlYRAwdpdFO9hP+eOJ KUDaGaM X-Received: by 2002:a05:6402:400a:b0:6a9:98dd:afd0 with SMTP id 4fb4d7f45d1cf-6aa569a1e28mr1580636a12.40.1789739812287; Fri, 18 Sep 2026 06:56:52 -0700 (PDT) Received: from [192.168.0.35] ([109.76.4.225]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6aa59730866sm915455a12.18.2026.09.18.06.56.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2026 06:56:51 -0700 (PDT) From: Bryan O'Donoghue Date: Fri, 18 Sep 2026 14:56:38 +0100 Subject: [PATCH v20 3/6] phy: core: Add devm_phy_get_by_of_node() 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: quoted-printable Message-Id: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-3-dc244e124e71@linaro.org> References: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> In-Reply-To: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robert Foss , Todor Tomov , Mauro Carvalho Chehab , Konrad Dybcio , Vladimir Zapolskiy , Bryan O'Donoghue , Loic Poulain , Vinod Koul , Neil Armstrong , Greg Kroah-Hartman , Kishon Vijay Abraham I , Felipe Balbi , Manivannan Sadhasivam Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-phy@lists.infradead.org, Bryan O'Donoghue , Krzysztof Kozlowski , Manivannan Sadhasivam X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2762; i=bryan.odonoghue@linaro.org; h=from:subject:message-id; bh=U4KWrtkdrf8AbsEYFUaWO89GB+6jXI+2zX+mv1VyPB0=; b=owEBbQKS/ZANAwAKASJxO7Ohjcg6AcsmYgBqrUMbBOYe0XufQ2avNCa6HRHZdYcePixEgjEVe BC7k+oLBkGJAjMEAAEKAB0WIQTmk/sqq6Nt4Rerb7QicTuzoY3IOgUCaq1DGwAKCRAicTuzoY3I Ojl9D/9AF6qr6+l61lUY+alwJ7Ou48uJiDa9f9SlzB4K5AcldLfJoBLHv4ZhTqGV3/dKuyxA6ks rKbLJdY8uTzCZvbi3B+4p6NO4bPxWNyePGDeHU3UDX3LFogG/q7AwtWJqmEbYKeW+TfrWrSDeFg 7BGdlal14Mnc9XfV81HB6tjy8NozxyfJwOT6mIUs+9ce6OGXmLIpUftSVh6xtRnVn1qxlVHK7+O RjFqQJ6w1AIscpGZnCZz30zoX4/mHFuCM3MSJ3bynV91746dtpbNOgmSCBIsuVq9aKi/iwWnKe+ bYLj48GbnZdS+HRbjJ7bDqnEIQJuiG7n46sz7+41cMe3j3+fDV5NcBOzUWsG0+tSGXrh5vbO7w6 qt/WT7knNXadlnm5wd/jMgGeESeuZaw6ysleq7sB8gg/iBUYHpd7mnXKhN0Yi6SJ6OW5LFeDi8M FKF5sNoDEqO0KbDGLM1EQFB+y7cdXdBNblny1zsMx6tenoN362XFlo/FHZG3LTAfno82VtYYDcI x7YrQxjELY5UWouIC7hXG3SY0PPP5Uj6V0IilF8FUGmM/NeZ3GU8SrYI8GH+eLNvvoQMHSJ/55K EMJkan7xGZWEGT0lpwx96IJaM0Qma/KroCyXzSp+ELdLmwehQMyv+bQp8R+Pv3zqHaR7ZyqVOEo CFEY2A3MGzWjBCw== X-Developer-Key: i=bryan.odonoghue@linaro.org; a=openpgp; fpr=E693FB2AABA36DE117AB6FB422713BB3A18DC83A Add a devm variant of phy_get_by_of_node() to allow for the familiar pattern of having devres automatically release resources on the driver's exit path. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Bryan O'Donoghue Reviewed-by: Neil Armstrong --- drivers/phy/phy-core.c | 34 ++++++++++++++++++++++++++++++++++ include/linux/phy/phy.h | 7 +++++++ 2 files changed, 41 insertions(+) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 42c27a2b45159..f0d2b50d1c76b 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -1048,6 +1048,40 @@ struct phy *phy_get_by_of_node(struct device_node *n= p) } EXPORT_SYMBOL_GPL(phy_get_by_of_node); =20 +/** + * devm_phy_get_by_of_node() - devm managed lookup and obtain phy referenc= e by device node + * @dev: device requesting the PHY + * @np: device_node of the PHY provider + * + * Returns: phy associated with the device_node or ERR_PTR. devres manages + * releasing resources. + */ +struct phy *devm_phy_get_by_of_node(struct device *dev, struct device_node= *np) +{ + struct phy **ptr, *phy; + struct device_link *link; + + ptr =3D devres_alloc(devm_phy_release, sizeof(*ptr), GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + phy =3D phy_get_by_of_node(np); + if (IS_ERR(phy)) { + devres_free(ptr); + return phy; + } + + *ptr =3D phy; + devres_add(dev, ptr); + link =3D device_link_add(dev, &phy->dev, DL_FLAG_STATELESS); + if (!link) + dev_dbg(dev, "failed to create device link to %s\n", + dev_name(phy->dev.parent)); + + return phy; +} +EXPORT_SYMBOL_GPL(devm_phy_get_by_of_node); + /** * phy_create() - create a new phy * @dev: device that is creating the new phy diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 71c2e16397130..14b924a88411f 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -285,6 +285,7 @@ struct phy *devm_of_phy_optional_get(struct device *dev= , struct device_node *np, struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_nod= e *np, int index); struct phy *phy_get_by_of_node(struct device_node *np); +struct phy *devm_phy_get_by_of_node(struct device *dev, struct device_node= *np); void of_phy_put(struct phy *phy); void phy_put(struct device *dev, struct phy *phy); void devm_phy_put(struct device *dev, struct phy *phy); @@ -499,6 +500,12 @@ static inline struct phy *phy_get_by_of_node(struct de= vice_node *np) return ERR_PTR(-ENOSYS); } =20 +static inline struct phy *devm_phy_get_by_of_node(struct device *dev, + struct device_node *np) +{ + return ERR_PTR(-ENOSYS); +} + static inline void of_phy_put(struct phy *phy) { } --=20 2.55.0 From nobody Thu Sep 24 23:34:52 2026 Received: from mail-ed2-f12.google.com (mail-ed2-f12.google.com [74.125.228.76]) (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 5549D503912 for ; Fri, 18 Sep 2026 13:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739817; cv=none; b=VWbAvsWkl3MIeVOxbxpiXE4VXJHCrq1p+6MCv2rEpcdegTUVaAfyPbkUK5mb71gq0ASUlCuBkFVvVCxof6JplRgKqHb6wiE4OUJk/zmsyWS0/eeI4q/HC5r0jP++9F4+T2DoUWn4p/hTr2Ogm/j068Z98IAKAEaD6IDow+PHJcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739817; c=relaxed/simple; bh=cyFgC+qXLx7TbLlb087AjFkU/0sOlZUcyZhxSpOGPTs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KXIP24MR7dIfY3lXXZqB/uOeGSdNk0ZOxvAWNOK7Zqokxt0TF8nn+2Te3PtIOakJgF1VBMyRUNJ9+T77m8rIJ+15oYTh16grdpj/Ge7lcnhDZQGI+PFUR5dGieXCa5SfYscxDyDmJyciGEQqzcSZFhRjRUtMG3puHMDF15s6OPY= 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=TZlvai9l; arc=none smtp.client-ip=74.125.228.76 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TZlvai9l" Received: by mail-ed2-f12.google.com with SMTP id 4fb4d7f45d1cf-6a605c198fdso1097199a12.2 for ; Fri, 18 Sep 2026 06:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1789739813; x=1790344613; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OrzoJsyfGQAwVoj4rnXSLGvbnlKoCkPzZFVe6L0WIsM=; b=TZlvai9l0KmM93xXYcdnSEXUh+7IdfHCLcvzVtSXzPTIM4MzZGIEOzHqRsDqbLBSGs lSEKnwjWLfhtfqezjv7OlfFfq/vUOQiYiQdPn20RQO/+Gww5MfUeNhD1BpSBTNHZagrE ExvubaOvZfPX2v0lpR9JKPCmQEjsmBmvZq0dqswmC7hNNybSs1R0pcmGwpKEnPqKO8qJ YqsMp0u+OeVJ3L5/boOY62m2XoMnYtjVQyr/2V0xtcgOJw+f8u05Nkofhtic92UZxDlD 6viF9h8uKFqdGoy1hivJICwJ3EwVrIBHOl6EFgMl02hxA6G2R7XRwPZ/yC32jB8hniOL +u9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789739813; x=1790344613; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=OrzoJsyfGQAwVoj4rnXSLGvbnlKoCkPzZFVe6L0WIsM=; b=b5zcxJrQA9recoCtT0/DnwfwztnsyxifHdaZCvANUATOMZviYztVo03seD7MDVPTr2 t24TKKkro+a0TmlP6cBzjBF2FDH+FkJzQPzNqzrddYjCAwXU/imyXt6LFCFtbXCrD6eo sLWPU7v72ZntRlopftairRUhfevWwRi/30fnR2wHMMq0IGYBagrn6cUy+eK9VYnNw1zz 5w8k0RA/X8/S71bVLcAPhPYguM4zGmXAUvjLu1bv6XNoa0oHnNHkgO5CaFrPHXfLHuq7 pYTRsy2SdRNCNnb9eO1bieW4iLrRCAmswqxXw0zoWS0ZzRqQ3CDS9+uHd6ET3Er9MAof JQiQ== X-Forwarded-Encrypted: i=1; AKwUvBx8HPX6OQfCnVU5Nael3warOceKJ9cmXw9a4n5CqGszBE7WASA6tmp30PYxqofpLxZiwt9BLJvbTg7BAkU=@vger.kernel.org X-Gm-Message-State: AFuF++nAmxej4DExswsrFDw9CK5+WLiBfNUI27/bsITlje+ykeVLiwfD OxjgppzswoAlvhI99d1XINpnohZ6bkw5vFwTJNzFTRixp8zYMbMa6FxxYKFSbLlTJOs= X-Gm-Gg: AYBFou1vPv8R/VqTjDPjQ7bvRGQwxZ78VTl1bzD+Z6D6jSKsS/lnYapmW9qPCSJkkSD DYD7VTOB72mfbjWztwXAheaCK834EFnMOLYcgOEa3bZ9ZM6Nxnzov8TlWKKTTsX6tOFISS5hdql kwM57c9GZXvyAAet6nOMpvUPpgpY7RiHWAG7hLoeDqy2RPTP9mJQG3DvsqDjkaQbCnaBOoYO8RK 8OyagWWEBY5JFuvwOm33hq8WUcrmTQumvrqaswSoZhA3WaogJiNSloM64DJJiGurvO+FvFXskc9 8mMNGPw3/mCqlpKx9k1cVZEt3y+cA58u5Jj1rZrgC4JOX4qI5MQtMb19IW2ndpQ/pthKWo+ot9m Y0KTWpfF5xMULeqYax79dRLmr3MP9rEMnMz8BzAIQKir/cXw+EuKpHNF4oCFV3sepaDvkm5fY/3 gyTY0yhm9oNIkmkfT3yOkXae32secgKpGltQPXJhrNhZeTu/z+/l48ny+ASgLY/MgulfycTez9x kuIZgAv X-Received: by 2002:a05:6402:4020:b0:6a9:f88d:b6e3 with SMTP id 4fb4d7f45d1cf-6aa52444ccdmr1676118a12.0.1789739813547; Fri, 18 Sep 2026 06:56:53 -0700 (PDT) Received: from [192.168.0.35] ([109.76.4.225]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6aa59730866sm915455a12.18.2026.09.18.06.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2026 06:56:53 -0700 (PDT) From: Bryan O'Donoghue Date: Fri, 18 Sep 2026 14:56:39 +0100 Subject: [PATCH v20 4/6] phy: core: Add missing kerneldoc colon in two locations 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: quoted-printable Message-Id: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-4-dc244e124e71@linaro.org> References: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> In-Reply-To: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robert Foss , Todor Tomov , Mauro Carvalho Chehab , Konrad Dybcio , Vladimir Zapolskiy , Bryan O'Donoghue , Loic Poulain , Vinod Koul , Neil Armstrong , Greg Kroah-Hartman , Kishon Vijay Abraham I , Felipe Balbi , Manivannan Sadhasivam Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-phy@lists.infradead.org, Bryan O'Donoghue , Krzysztof Kozlowski , Manivannan Sadhasivam X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1863; i=bryan.odonoghue@linaro.org; h=from:subject:message-id; bh=cyFgC+qXLx7TbLlb087AjFkU/0sOlZUcyZhxSpOGPTs=; b=owEBbQKS/ZANAwAKASJxO7Ohjcg6AcsmYgBqrUMcInVhLdyaudbJKlI64/7xCw8tGs/f8+uvK Tr4ZbtYz7WJAjMEAAEKAB0WIQTmk/sqq6Nt4Rerb7QicTuzoY3IOgUCaq1DHAAKCRAicTuzoY3I OujtEACYXwO198w8CrWRRdGcXNTIysDMDcAUvp1WCuv3mvY6fVpCxXIGF4CSCrfzLcFQr60bX2t //L21gFXW3rClTVpHxDa2/I7cBBZ9g1+k3k3lVMayQxOHFcOHCuFFlIrm9ZmaGln631MVSTJ0ws c9MrCNLCHA2sxIeBiTh/SaCsCDWRe6nAYIwCUSS7HZgKn+eqMhzh96iVZIlznfWdg8DPmoC+gD8 lMQEaw+I8SAnAgVtSVER8Q/iyhdRjEgTGH++Iqpo0M8aQXkDewl9gaSAOQz/p1G4sPKUl+c3beu VRWWObQfVqlJKSdbAz8IDjKHbtkKiF61eQ2LE5DZiI2DUmXHrbQ8DgaGmFLKMct8E1/0wU6zjKW eS2TOdAdvifqQfbtrsNxiNrTYd+aVaUaAHFlsYBBwX+gfDaQnyUIFPlsaeW/ON2EyFu9xwT+3P/ ltyfZ4TGmNVuhIKSBWMpabAjMkcpHbKtljsofWQsNJF5NJzwOxBYJ7rrrYQlbBwaixoUsZN0RPr pxsDiBOBPN5smxSysqmFNF+xPBA7GfEZr9SUAtdH13binQpUeNhdhHHKLZjKkUu2QQRwXpOXepT B8Qx7cu2Gy4pdLGzyQCLcWSLeA5Pi/mUNiliWh7A8mwInyO3VqPrbACzMIPZSNqT6W2ee8/8XUt Eoa+OjmpJX6fM+Q== X-Developer-Key: i=bryan.odonoghue@linaro.org; a=openpgp; fpr=E693FB2AABA36DE117AB6FB422713BB3A18DC83A Correct missing colon after Return in kernel doc. Suggested-by: Manivannan Sadhasivam Signed-off-by: Bryan O'Donoghue Reviewed-by: Manivannan Sadhasivam Reviewed-by: Neil Armstrong --- drivers/phy/phy-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index f0d2b50d1c76b..597e6b234f5ef 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -643,7 +643,7 @@ static struct phy *_of_phy_get_with_args(struct of_phan= dle_args *args) * @np: device_node for which to get the phy * @index: the index of the phy * - * Returns the phy associated with the given phandle value, + * Returns: the phy associated with the given phandle value, * after getting a refcount to it or -ENODEV if there is no such phy or * -EPROBE_DEFER if there is a phandle to the phy, but the device is * not yet loaded. This function uses of_xlate call back function provided @@ -681,7 +681,7 @@ static struct phy *_of_phy_get(struct device_node *np, = int index) * @np: device_node for which to get the phy * @con_id: name of the phy from device's point of view * - * Returns the phy driver, after getting a refcount to it; or + * Returns: the phy driver, after getting a refcount to it; or * -ENODEV if there is no such phy. The caller is responsible for * calling of_phy_put() to release that count. */ @@ -797,7 +797,7 @@ EXPORT_SYMBOL_GPL(of_phy_simple_xlate); * @string: the phy name as given in the dt data or the name of the contro= ller * port for non-dt case * - * Returns the phy driver, after getting a refcount to it; or + * Returns: the phy driver, after getting a refcount to it; or * -ENODEV if there is no such phy. The caller is responsible for * calling phy_put() to release that count. */ --=20 2.55.0 From nobody Thu Sep 24 23:34:52 2026 Received: from mail-ed2-f12.google.com (mail-ed2-f12.google.com [74.125.228.76]) (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 DF53E509F15 for ; Fri, 18 Sep 2026 13:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739821; cv=none; b=eMlIuR7TFis2vZjlykf5Rn6/jTH3zJdLebtTArgnrFsBA490SgmWvjHHDjNryLgZH6LFGI4osZtRSysSkCHG0GcEs3/GdCOSSCbzoknXewah7t3WHl6OTIbeq+pl2GVqazWEGLLKyPuyUir8tFNIRDMQCThrXcGWDD2nZCKkcfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739821; c=relaxed/simple; bh=eopvAjQ01yb1IyLZZpyIm48QeAZZDhneNNtfhHANU5s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dprTm88KKcLVaPWeh8JYdhSPTEVdphrXwcaC3XEHlF8Oo07kWad8d3AwSONCh/8ECmN9kBBq5oqtQDN8z5RCIE1fBICjOUeoaOZS4V8T0mKKJZMerBr5jCJaK/NHI6PrlMhs6W7Bk8EhepcVtfn4pW0GNZnw3U0ywX2kmHGo3ns= 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=Cw2STsHD; arc=none smtp.client-ip=74.125.228.76 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Cw2STsHD" Received: by mail-ed2-f12.google.com with SMTP id 4fb4d7f45d1cf-6a6063d7dc4so948062a12.3 for ; Fri, 18 Sep 2026 06:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1789739816; x=1790344616; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=FJ0eHLRrWjcjFrsq81/WIPIonI1Q+2AekbwbnU9QBl0=; b=Cw2STsHDVOGz2YccLQ89ZWqGo5ChyaNQSP6N+NOrp6n4Jm0UEvf2hPACKceeXVZu+M V8Qd2dik6PF3K8byA5depa65OdJxHMnhx+C0VsLjQAaBERO+Nnb/JvoxaurHnb7PZnXG BgzNgbZfxmQx+bm0IjN7FBN/6zo2PwNoEWX7GLB00lyE8GSV03wZ7R/eg6R4UtfJB/BP Hk1TQHsXWvxoFySg4RSG87esEFldPuPHE0/F6kQe2V1ceA7bgRUN6rNbOUipUQKti+G3 iKBLqfncFTA6rwD4LkRYrnG4GUUjSMvGCAju1Noirl4DrY8HAZ8rU4BVrp7Dlf5IWZR8 lzgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789739816; x=1790344616; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=FJ0eHLRrWjcjFrsq81/WIPIonI1Q+2AekbwbnU9QBl0=; b=pzXdRShGpAjHfhsyc64XjSxlJAHr5sH0uTJZ+YNY/iUnSfrf1BNJM1dVXjQ0H6fDUj MP8Su5Ht7Qk2jwUzTwFzNx2sHcd6f/HGuqoD3z8StLzcM4Qc79LQD6LGND8e6VZDWenA XUCUsl9KFjnJmgMMpBW9iNX7p3q6CLPRbZSvz6yU8KM+Ca39zlP3QZb8ts8TY/vQk2SZ W5CzHYVGyaS5+HlFlTc9HyIHGb3KrEMmaGP5QJWwrgSlwR1CkOBWZwhoT/ZoOw+iewvV H9Y2OsO22Y52r+JBL9pY91SsGpm9reM0CshdZQxdBirIUCwpRKtYVKIxcUMKK8G8iXKA Ktlg== X-Forwarded-Encrypted: i=1; AKwUvBxNbT6K21jq2YTN3mWrEBnAZvoXi5cOczox3T4LjXQBSwq7DoYIrFYh0WZFhdnib09xzXzEMyaMbqY02eg=@vger.kernel.org X-Gm-Message-State: AFuF++lwUjfqcCMuE8rhwKpsGiqwhi1mpeKvhj7dw4moWqwtvaYfGV4D 8w4jXimaLrHjG+dXUIj2wOvbGjJKy7cO6G0rh8+A7JPCW7BTXSl+c0mVXUD+7EiaBaI= X-Gm-Gg: AYBFou1XoSlPTexRCl9xYFxnBbFc3kztC1r9AUEvas8Pt72nE0xEe/JPo439LRjH86Q uD0Mkr4FDemHImnormXjB6K3hu7mmjGgyEsg+o6Lwakmy4UN+XOnCopJBFOTkVJ+yJ+USSmJH4n jJTJvQrhIy3zzC85AsDIYuBJbKSJbsnXxwlJjrQYN70MCZW4Dne0Uqji6prsiGLVbXqe4tH0HFE NuoMHFFPC2Ca2PUJmaZfQbu5rC9taproneanojAPEZpezlnx8hL1eBzUZdnYvCtsqwJGFY+OyMB k0fDu6a7agYwdYkCa+L0nx6XnYPghhUh3BxExcMpkXqMIQ7pqgsATNYVniYPkhOYpPEyWCV2n4Y y7HuXSKjrERG5ZPxLzMDwHHA0vPOmCodZnhaMymccs7ItvUL9XtmAWq8D7ARJT1MwrlLrymMAPh Ijzu9tcAtyYLG1qBrKhqht8rVR/w617gwcRZlhC81oImW+ytRMlXMRc2PbcmSXS5Jd5xmJmgcH4 Dobz2F+ X-Received: by 2002:a05:6402:21d4:b0:6a9:d0f0:69a0 with SMTP id 4fb4d7f45d1cf-6aa579860aemr3243203a12.11.1789739815683; Fri, 18 Sep 2026 06:56:55 -0700 (PDT) Received: from [192.168.0.35] ([109.76.4.225]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6aa59730866sm915455a12.18.2026.09.18.06.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2026 06:56:55 -0700 (PDT) From: Bryan O'Donoghue Date: Fri, 18 Sep 2026 14:56:40 +0100 Subject: [PATCH v20 5/6] media: qcom: camss: Add support for PHY API devices 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: quoted-printable Message-Id: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-5-dc244e124e71@linaro.org> References: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> In-Reply-To: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robert Foss , Todor Tomov , Mauro Carvalho Chehab , Konrad Dybcio , Vladimir Zapolskiy , Bryan O'Donoghue , Loic Poulain , Vinod Koul , Neil Armstrong , Greg Kroah-Hartman , Kishon Vijay Abraham I , Felipe Balbi , Manivannan Sadhasivam Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-phy@lists.infradead.org, Bryan O'Donoghue , Krzysztof Kozlowski , Manivannan Sadhasivam , Oleg Keri X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=17941; i=bryan.odonoghue@linaro.org; h=from:subject:message-id; bh=eopvAjQ01yb1IyLZZpyIm48QeAZZDhneNNtfhHANU5s=; b=owEBbQKS/ZANAwAKASJxO7Ohjcg6AcsmYgBqrUMcS0udwMx0/B3cJTBi6CyfjFUR+xGs5kxBY 063ir6TStuJAjMEAAEKAB0WIQTmk/sqq6Nt4Rerb7QicTuzoY3IOgUCaq1DHAAKCRAicTuzoY3I OtdBD/45oEXRNfi/vmOHzrc5nEDInLy1sTFkqnShLyuzpom/xpDN4y5P1LUlcOlQf0OeM38nTmv GDatEiaVK8XcK6eOJec8sP+uh6n2kwPSEATyh5JXpDdnE8nZqGi6k40YnMIwEYxp11dcwMce93N Tz6zTQBfPPeH/L6mIDiL4/BuKZrXwHoA2Z506erc4ehxF7rkheSJg4zSLpl2PABPkU1JIg4PasM RS8z4DjLivVF8C4oZzfYVG4hq6KWKZ/YD/tx6CO/Qpu0/gVicK0klmJ8ZSdDumzaXZVwvomw3Ml dU4fPC0tDHnqjIQKIVhEGmuZh8TWBeQUvFq1MEiaOUs7gLh+Yg/D8ZJk51bwiX+KZSIwbxmq+dg Etg732QsFJ2qsVyjHuDkLq+1tmhFtEiV+BgwR43Sb4kcGDVy6zFEYHmnnFzRjfT6c7c19McqCD+ pa/yj7E4tQippgCjt1Gt4RzqceLyqwB+v/kYe50m6HAbXv8Wm6+QxFD0wLsEokhbzMvQ/Bk8nGp BBUmAgXz/7VQFM3b4IRydK6wyon+K1YdwN0u2zBIiNLE6ZkO1eENYBi1ecwHzb4CrHX5nHTONoJ BGdyQrscnYHUunXQ/W05T7CpmwFfnjPkbLNLFA5tks0CE4vHWYWtjZp/JsLfYjTUNn+W0XzlmF1 B0Jy6Z/VeteMKpg== X-Developer-Key: i=bryan.odonoghue@linaro.org; a=openpgp; fpr=E693FB2AABA36DE117AB6FB422713BB3A18DC83A Add the ability to use a PHY pointer which interacts with the standard PHY API. In the first instance the code will try to use the new PHY interface. If no PHYs are present in the DT then the legacy method will be attempted. Acked-by: Manivannan Sadhasivam Tested-by: Oleg Keri # Lenovo Yoga Slim 7x Gen 11 (Glym= ur) Signed-off-by: Bryan O'Donoghue Reviewed-by: Loic Poulain --- drivers/media/platform/qcom/camss/Kconfig | 1 + drivers/media/platform/qcom/camss/camss-csiphy.c | 200 +++++++++++++++++++= ++-- drivers/media/platform/qcom/camss/camss-csiphy.h | 11 +- drivers/media/platform/qcom/camss/camss.c | 104 ++++++++++-- drivers/media/platform/qcom/camss/camss.h | 1 + 5 files changed, 285 insertions(+), 32 deletions(-) diff --git a/drivers/media/platform/qcom/camss/Kconfig b/drivers/media/plat= form/qcom/camss/Kconfig index 4eda48cb1adf0..1edc5e5a1829e 100644 --- a/drivers/media/platform/qcom/camss/Kconfig +++ b/drivers/media/platform/qcom/camss/Kconfig @@ -7,3 +7,4 @@ config VIDEO_QCOM_CAMSS select VIDEO_V4L2_SUBDEV_API select VIDEOBUF2_DMA_SG select V4L2_FWNODE + select PHY_QCOM_MIPI_CSI2 diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/med= ia/platform/qcom/camss/camss-csiphy.c index 539ac4888b608..aaed7d0309dd6 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include #include #include @@ -131,10 +133,10 @@ static u8 csiphy_get_bpp(const struct csiphy_format_i= nfo *formats, } =20 /* - * csiphy_set_clock_rates - Calculate and set clock rates on CSIPHY module + * csiphy_set_clock_rates_legacy - Calculate and set clock rates on CSIPHY= module * @csiphy: CSIPHY device */ -static int csiphy_set_clock_rates(struct csiphy_device *csiphy) +static int csiphy_set_clock_rates_legacy(struct csiphy_device *csiphy) { struct device *dev =3D csiphy->camss->dev; s64 link_freq; @@ -200,7 +202,7 @@ static int csiphy_set_clock_rates(struct csiphy_device = *csiphy) * * Return 0 on success or a negative error code otherwise */ -static int csiphy_set_power(struct v4l2_subdev *sd, int on) +static int csiphy_set_power_legacy(struct v4l2_subdev *sd, int on) { struct csiphy_device *csiphy =3D v4l2_get_subdevdata(sd); struct device *dev =3D csiphy->camss->dev; @@ -219,7 +221,7 @@ static int csiphy_set_power(struct v4l2_subdev *sd, int= on) return ret; } =20 - ret =3D csiphy_set_clock_rates(csiphy); + ret =3D csiphy_set_clock_rates_legacy(csiphy); if (ret < 0) { regulator_bulk_disable(csiphy->num_supplies, csiphy->supplies); @@ -254,7 +256,7 @@ static int csiphy_set_power(struct v4l2_subdev *sd, int= on) } =20 /* - * csiphy_stream_on - Enable streaming on CSIPHY module + * csiphy_stream_on_legacy - Enable streaming on CSIPHY module * @csiphy: CSIPHY device * * Helper function to enable streaming on CSIPHY module. @@ -262,7 +264,7 @@ static int csiphy_set_power(struct v4l2_subdev *sd, int= on) * * Return 0 on success or a negative error code otherwise */ -static int csiphy_stream_on(struct csiphy_device *csiphy) +static int csiphy_stream_on_legacy(struct csiphy_device *csiphy) { struct csiphy_config *cfg =3D &csiphy->cfg; s64 link_freq; @@ -306,11 +308,98 @@ static int csiphy_stream_on(struct csiphy_device *csi= phy) * * Helper function to disable streaming on CSIPHY module */ -static void csiphy_stream_off(struct csiphy_device *csiphy) +static void csiphy_stream_off_legacy(struct csiphy_device *csiphy) { csiphy->res->hw_ops->lanes_disable(csiphy, &csiphy->cfg); } =20 +/* + * csiphy_stream_on - Enable streaming on CSIPHY module + * @csiphy: CSIPHY device + * + * Helper function to enable streaming on CSIPHY module. + * Main configuration of CSIPHY module is also done here. + * + * Return 0 on success or a negative error code otherwise + */ +static int csiphy_stream_on(struct csiphy_device *csiphy) +{ + u8 bpp =3D csiphy_get_bpp(csiphy->res->formats->formats, csiphy->res->for= mats->nformats, + csiphy->fmt[MSM_CSIPHY_PAD_SINK].code); + struct csiphy_lanes_cfg *lncfg =3D &csiphy->cfg.csi2->lane_cfg; + struct phy_configure_opts_mipi_dphy *dphy_cfg; + union phy_configure_opts dphy_opts =3D { 0 }; + struct device *dev =3D csiphy->camss->dev; + u8 num_lanes =3D lncfg->num_data; + s64 link_freq; + int ret; + + dphy_cfg =3D &dphy_opts.mipi_dphy; + + link_freq =3D camss_get_link_freq(&csiphy->subdev.entity, bpp, num_lanes); + + if (link_freq <=3D 0) { + dev_err(dev, + "Cannot get CSI2 transmitter's link frequency\n"); + return -EINVAL; + } + + ret =3D phy_mipi_dphy_get_default_config_for_hsclk(link_freq, num_lanes, + dphy_cfg); + if (ret < 0) { + dev_err(dev, "Invalid config for link frequency %lld\n", + link_freq); + return ret; + } + + ret =3D phy_set_mode(csiphy->phy, PHY_MODE_MIPI_DPHY); + if (ret) { + dev_err(dev, "Failed to set phy mode\n"); + return ret; + } + + ret =3D phy_configure(csiphy->phy, &dphy_opts); + if (ret) { + dev_err(dev, "failed to configure MIPI D-PHY\n"); + goto error; + } + + return phy_power_on(csiphy->phy); + +error: + return ret; +} + +/* + * csiphy_stream_off - Disable streaming on CSIPHY module + * @csiphy: CSIPHY device + * + * Helper function to disable streaming on CSIPHY module + */ +static void csiphy_stream_off(struct csiphy_device *csiphy) +{ + phy_power_off(csiphy->phy); +} + +/* + * csiphy_set_stream - Enable/disable streaming on CSIPHY module + * @sd: CSIPHY V4L2 subdevice + * @enable: Requested streaming state + * + * Return 0 on success or a negative error code otherwise + */ +static int csiphy_set_stream_legacy(struct v4l2_subdev *sd, int enable) +{ + struct csiphy_device *csiphy =3D v4l2_get_subdevdata(sd); + int ret =3D 0; + + if (enable) + ret =3D csiphy_stream_on_legacy(csiphy); + else + csiphy_stream_off_legacy(csiphy); + + return ret; +} =20 /* * csiphy_set_stream - Enable/disable streaming on CSIPHY module @@ -572,16 +661,16 @@ csiphy_match_clock_name(const char *clock_name, const= char *format, ...) } =20 /* - * msm_csiphy_subdev_init - Initialize CSIPHY device structure and resourc= es + * msm_csiphy_subdev_init_legacy - Initialize CSIPHY device structure and = resources * @csiphy: CSIPHY device * @res: CSIPHY module resources table * @id: CSIPHY module id * * Return 0 on success or a negative error code otherwise */ -int msm_csiphy_subdev_init(struct camss *camss, - struct csiphy_device *csiphy, - const struct camss_subdev_resources *res, u8 id) +int msm_csiphy_subdev_init_legacy(struct camss *camss, + struct csiphy_device *csiphy, + const struct camss_subdev_resources *res, u8 id) { struct device *dev =3D camss->dev; struct platform_device *pdev =3D to_platform_device(dev); @@ -709,6 +798,54 @@ int msm_csiphy_subdev_init(struct camss *camss, return ret; } =20 +/* + * msm_csiphy_subdev_init - Initialize CSIPHY device structure and resourc= es + * @camss: CAMSS structure + * @port: DT port index + * + * Return 0 on success or absence of link, negative error code otherwise + */ +int msm_csiphy_subdev_init(struct camss *camss, u8 port) +{ + const struct camss_subdev_resources *res =3D &camss->res->csiphy_res[port= ]; + struct csiphy_device *csiphy =3D &camss->csiphy[port]; + struct device *dev =3D camss->dev; + struct device_node *ep, *remote; + int ret; + + ep =3D of_graph_get_endpoint_by_regs(dev->of_node, port, -1); + if (!ep) + return 0; + + remote =3D of_graph_get_remote_port_parent(ep); + of_node_put(ep); + if (!remote) + return 0; + + if (!of_device_is_available(remote)) { + of_node_put(remote); + return 0; + } + + csiphy->phy =3D devm_phy_get_by_of_node(dev, remote); + of_node_put(remote); + if (IS_ERR(csiphy->phy)) { + ret =3D PTR_ERR(csiphy->phy); + goto done; + } + + csiphy->camss =3D camss; + csiphy->id =3D res->csiphy.id; + csiphy->res =3D &res->csiphy; + + snprintf(csiphy->name, ARRAY_SIZE(csiphy->name), "csi%d", csiphy->id); + + return 0; + +done: + return ret; +} + /* * csiphy_link_setup - Setup CSIPHY connections * @entity: Pointer to media entity structure @@ -743,8 +880,12 @@ static int csiphy_link_setup(struct media_entity *enti= ty, return 0; } =20 -static const struct v4l2_subdev_core_ops csiphy_core_ops =3D { - .s_power =3D csiphy_set_power, +static const struct v4l2_subdev_core_ops csiphy_core_ops_legacy =3D { + .s_power =3D csiphy_set_power_legacy, +}; + +static const struct v4l2_subdev_video_ops csiphy_video_ops_legacy =3D { + .s_stream =3D csiphy_set_stream_legacy, }; =20 static const struct v4l2_subdev_video_ops csiphy_video_ops =3D { @@ -758,8 +899,13 @@ static const struct v4l2_subdev_pad_ops csiphy_pad_ops= =3D { .set_fmt =3D csiphy_set_format, }; =20 +static const struct v4l2_subdev_ops csiphy_v4l2_ops_legacy =3D { + .core =3D &csiphy_core_ops_legacy, + .video =3D &csiphy_video_ops_legacy, + .pad =3D &csiphy_pad_ops, +}; + static const struct v4l2_subdev_ops csiphy_v4l2_ops =3D { - .core =3D &csiphy_core_ops, .video =3D &csiphy_video_ops, .pad =3D &csiphy_pad_ops, }; @@ -785,10 +931,15 @@ int msm_csiphy_register_entity(struct csiphy_device *= csiphy, { struct v4l2_subdev *sd =3D &csiphy->subdev; struct media_pad *pads =3D csiphy->pads; - struct device *dev =3D csiphy->camss->dev; + struct camss *camss =3D csiphy->camss; + struct device *dev =3D camss->dev; int ret; =20 - v4l2_subdev_init(sd, &csiphy_v4l2_ops); + if (camss->legacy_phy) + v4l2_subdev_init(sd, &csiphy_v4l2_ops_legacy); + else + v4l2_subdev_init(sd, &csiphy_v4l2_ops); + sd->internal_ops =3D &csiphy_v4l2_internal_ops; sd->flags |=3D V4L2_SUBDEV_FL_HAS_DEVNODE; snprintf(sd->name, ARRAY_SIZE(sd->name), "%s%d", @@ -816,9 +967,22 @@ int msm_csiphy_register_entity(struct csiphy_device *c= siphy, ret =3D v4l2_device_register_subdev(v4l2_dev, sd); if (ret < 0) { dev_err(dev, "Failed to register subdev: %d\n", ret); - media_entity_cleanup(&sd->entity); + goto media_entity_err; + } + + if (!IS_ERR(csiphy->phy)) { + ret =3D phy_init(csiphy->phy); + if (ret) { + dev_err(dev, "%s init fail %d\n", csiphy->name, ret); + v4l2_device_unregister_subdev(sd); + goto media_entity_err; + } } =20 + return 0; + +media_entity_err: + media_entity_cleanup(&sd->entity); return ret; } =20 @@ -828,6 +992,8 @@ int msm_csiphy_register_entity(struct csiphy_device *cs= iphy, */ void msm_csiphy_unregister_entity(struct csiphy_device *csiphy) { + if (!IS_ERR(csiphy->phy)) + phy_exit(csiphy->phy); v4l2_device_unregister_subdev(&csiphy->subdev); media_entity_cleanup(&csiphy->subdev.entity); } diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/med= ia/platform/qcom/camss/camss-csiphy.h index 9d9657b82f748..7a357044b9fdb 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.h +++ b/drivers/media/platform/qcom/camss/camss-csiphy.h @@ -12,6 +12,7 @@ =20 #include #include +#include #include #include #include @@ -97,6 +98,7 @@ struct csiphy_device_regs { =20 struct csiphy_device { struct camss *camss; + struct phy *phy; u8 id; struct v4l2_subdev subdev; struct media_pad pads[MSM_CSIPHY_PADS_NUM]; @@ -104,6 +106,7 @@ struct csiphy_device { void __iomem *base_clk_mux; u32 irq; char irq_name[30]; + char name[16]; struct camss_clock *clock; bool *rate_set; int nclocks; @@ -118,9 +121,11 @@ struct csiphy_device { =20 struct camss_subdev_resources; =20 -int msm_csiphy_subdev_init(struct camss *camss, - struct csiphy_device *csiphy, - const struct camss_subdev_resources *res, u8 id); +int msm_csiphy_subdev_init_legacy(struct camss *camss, + struct csiphy_device *csiphy, + const struct camss_subdev_resources *res, u8 id); + +int msm_csiphy_subdev_init(struct camss *camss, u8 port); =20 int msm_csiphy_register_entity(struct csiphy_device *csiphy, struct v4l2_device *v4l2_dev); diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index 2123f6388e3d7..84097d82d99c9 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -4799,8 +4799,43 @@ static int camss_parse_ports(struct camss *camss) fwnode_graph_for_each_endpoint(fwnode, ep) { struct camss_async_subdev *csd; =20 - csd =3D v4l2_async_nf_add_fwnode_remote(&camss->notifier, ep, - typeof(*csd)); + if (!fwnode_device_is_available(ep)) + continue; + + if (camss->legacy_phy) { + csd =3D v4l2_async_nf_add_fwnode_remote(&camss->notifier, ep, + typeof(*csd)); + } else { + struct fwnode_handle *phy_out, *phy_node, *phy_in, *sensor_ep; + + phy_out =3D fwnode_graph_get_remote_endpoint(ep); + if (!phy_out) + continue; + + phy_node =3D fwnode_graph_get_port_parent(phy_out); + fwnode_handle_put(phy_out); + if (!phy_node) + continue; + + phy_in =3D fwnode_graph_get_endpoint_by_id(phy_node, 0, 0, 0); + fwnode_handle_put(phy_node); + if (!phy_in) + continue; + + sensor_ep =3D fwnode_graph_get_remote_endpoint(phy_in); + fwnode_handle_put(phy_in); + if (!sensor_ep) + continue; + + csd =3D v4l2_async_nf_add_fwnode(&camss->notifier, sensor_ep, + struct camss_async_subdev); + fwnode_handle_put(sensor_ep); + if (IS_ERR(csd)) { + ret =3D PTR_ERR(csd); + goto err_cleanup; + } + } + if (IS_ERR(csd)) { ret =3D PTR_ERR(csd); goto err_cleanup; @@ -4819,6 +4854,29 @@ static int camss_parse_ports(struct camss *camss) return ret; } =20 +static void camss_detect_legacy_phy(struct camss *camss) +{ + struct device_node *remote; + struct device_node *ep; + + camss->legacy_phy =3D true; + + /* Find first remote-endpoint and determine if its a PHY */ + for_each_endpoint_of_node(camss->dev->of_node, ep) { + remote =3D of_graph_get_remote_port_parent(ep); + if (!remote) + continue; + + camss->legacy_phy =3D !of_node_name_eq(remote, "phy"); + of_node_put(remote); + of_node_put(ep); + break; + } + + dev_dbg(camss->dev, "legacy phy mode %s\n", + camss->legacy_phy ? "true" : "false"); +} + /* * camss_init_subdevices - Initialize subdev structures and resources * @camss: CAMSS device @@ -4832,14 +4890,21 @@ static int camss_init_subdevices(struct camss *cams= s) unsigned int i; int ret; =20 + camss_detect_legacy_phy(camss); + for (i =3D 0; i < camss->res->csiphy_num; i++) { - ret =3D msm_csiphy_subdev_init(camss, &camss->csiphy[i], - &res->csiphy_res[i], - res->csiphy_res[i].csiphy.id); + if (!camss->legacy_phy) { + ret =3D msm_csiphy_subdev_init(camss, i); + } else { + ret =3D msm_csiphy_subdev_init_legacy(camss, + &camss->csiphy[i], + &res->csiphy_res[i], + res->csiphy_res[i].csiphy.id); + } + if (ret < 0) { - dev_err(camss->dev, - "Failed to init csiphy%d sub-device: %d\n", - i, ret); + dev_err(camss->dev, "csiphy %d init fail\n", + res->csiphy_res[i].csiphy.id); return ret; } } @@ -4917,6 +4982,11 @@ inline void camss_link_err(struct camss *camss, ret); } =20 +static inline bool csiphy_enabled(struct camss *camss, struct csiphy_devic= e *c) +{ + return camss->legacy_phy || c->phy; +} + /* * camss_link_entities - Register subdev nodes and create links * @camss: CAMSS device @@ -4930,6 +5000,9 @@ static int camss_link_entities(struct camss *camss) =20 for (i =3D 0; i < camss->res->csiphy_num; i++) { for (j =3D 0; j < camss->res->csid_num; j++) { + if (!csiphy_enabled(camss, &camss->csiphy[i])) + continue; + ret =3D media_create_pad_link(&camss->csiphy[i].subdev.entity, MSM_CSIPHY_PAD_SRC, &camss->csid[j].subdev.entity, @@ -5056,6 +5129,9 @@ static int camss_register_entities(struct camss *cams= s) int ret; =20 for (i =3D 0; i < camss->res->csiphy_num; i++) { + if (!csiphy_enabled(camss, &camss->csiphy[i])) + continue; + ret =3D msm_csiphy_register_entity(&camss->csiphy[i], &camss->v4l2_dev); if (ret < 0) { @@ -5131,8 +5207,10 @@ static int camss_register_entities(struct camss *cam= ss) =20 i =3D camss->res->csiphy_num; err_reg_csiphy: - for (i--; i >=3D 0; i--) - msm_csiphy_unregister_entity(&camss->csiphy[i]); + for (i--; i >=3D 0; i--) { + if (csiphy_enabled(camss, &camss->csiphy[i])) + msm_csiphy_unregister_entity(&camss->csiphy[i]); + } =20 return ret; } @@ -5147,8 +5225,10 @@ static void camss_unregister_entities(struct camss *= camss) { unsigned int i; =20 - for (i =3D 0; i < camss->res->csiphy_num; i++) - msm_csiphy_unregister_entity(&camss->csiphy[i]); + for (i =3D 0; i < camss->res->csiphy_num; i++) { + if (csiphy_enabled(camss, &camss->csiphy[i])) + msm_csiphy_unregister_entity(&camss->csiphy[i]); + } =20 if (camss->tpg) { for (i =3D 0; i < camss->res->tpg_num; i++) diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index 93d691c8ac63b..ba3d51d9c0bf8 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -138,6 +138,7 @@ struct camss { struct device_link *genpd_link; struct icc_path *icc_path[ICC_SM8250_COUNT]; const struct camss_resources *res; + bool legacy_phy; }; =20 struct camss_camera_interface { --=20 2.55.0 From nobody Thu Sep 24 23:34:52 2026 Received: from mail-ed2-f35.google.com (mail-ed2-f35.google.com [74.125.228.99]) (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 37332502D56 for ; Fri, 18 Sep 2026 13:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.99 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739821; cv=none; b=nBa8jfqTZqtU8toaEsXrEjz6iD7OnqYBJLqdfEqWlLU24wUdAv4GqVx7D4LJ18BxwA1mgRqeYVbnxPIp+2nIb5b6dLQYPYk8coWWVBmlmi1f1WYKeEweEizayjWTt0dc8yXN1wo3kCi/b5WZCFbaMkYUhXWFKCx1fpr2J1QFe4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789739821; c=relaxed/simple; bh=pqNWQgF8ClsJh5Yi5qQY7AdMdYAk6BCqiLyzGAJKIe0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RaP80ilhMqmagX7DGOT48KhRHN9OngsiVsP3JvJZ6P1AJVWTMzEUW3/aDZ2ENee0Sn1e37xEqO1wkZpR/HWYHh9jXFWBhUcJyeSRvUbhlSGaEKTG7G//ykyM88+ZQyaNDP0USQo7V7o7OW3Ve737DofpC2NwJE4wtMMpQlQD9yY= 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=oCfFSrah; arc=none smtp.client-ip=74.125.228.99 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oCfFSrah" Received: by mail-ed2-f35.google.com with SMTP id 4fb4d7f45d1cf-6a98dfb8002so1062044a12.2 for ; Fri, 18 Sep 2026 06:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1789739817; x=1790344617; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sVVY0F/3SoAAMbyWD2/7RYl6WppDgQD/EUsXpw6hsho=; b=oCfFSrahoPSR5pAJrOG+TtKbt/rvTJeF3BKJPfKv31E9zg2VIblpD6ZS4Oi/roIY30 bmqVdY5rTVj/DmfGYO0H/H4MPCZS4DBjo0f1hfsVpm7GJWE+QunpdbMX0O1WCAcxhXkV i10k05J39ajHtoDBXaGCyetZCZEft2nwv3uUBMCFUjE9LEJSYRq24oOFSPVWORZd92VY 8UORgflT5tNstFGjxsDsOGQBalidbl+dzDysX7gKvDIpVy2ggyzPQWoprQpdro/gSice x0kwyG0ND7DuHLcj3nQ0QAxrL3JuaRphXEpP7qx+UC8b82QScg8adBEUEJjc+9GEyFVn qMMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789739817; x=1790344617; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=sVVY0F/3SoAAMbyWD2/7RYl6WppDgQD/EUsXpw6hsho=; b=q4zW8+iB2oaHeYKAZBJFix5z69oCxmmkv030laJlp1NVOgO5HsuXIPXFjoog62AVI+ Hcl4DZRv8liG67EbSbe/smMATagFVQeGUaOvhSCkZuaR59UxCzYGgjdUy8sT9Svsr2Ij 5c9AEg9tuTY9keztSzyJ8p9InFKDQ3J+C8VqqR9L7JbaQF/TsEJPE2cUFfsRfJ0LhEWd jG9tD1uvWAlg3kRzWTifPGmIHUoFaE1AWgMVp0Z7ugXMYc9hKWzmF94YaVK2NtcDUoOu RTbh2n/dH3MGl1Kb+bcUwoj4ZOogmp/xmUbBGaM2Li78bngX0MV5kAKyxaShLbZBWbBM 4a8g== X-Forwarded-Encrypted: i=1; AKwUvBwG3+FMBqAwHpR/OCCkthU44YmI1w0KKYB6xU45h926QafnKOozYEs0YcShdEtxJpwo28JaviAyd6G47qw=@vger.kernel.org X-Gm-Message-State: AFuF++lgyqdBa13VstuDoIdpOLh8OmmUFNJRL9BrKLH/Y9JuS6EekfEY b+e7TQCN+gTyK6PlPtxTM21L3h5qbaGZU9KSrqwMzJfvhKs7SIf/XmmkmH7zvmOuaNo= X-Gm-Gg: AYBFou0vAppcQNg9MMpRiHcfzudprub6VWwkj2ZoXRZTQA0s6ySv5kTigTuEZZ2HWn+ N4K2ev5GADpALAIqD/XEPB6oFoVM9CgX2HJ/YLZUL17WjbvH+4/Xias/6PUC2Bj4x9FhSLAjGYN oNfrvA/qjK3WvMtutRS6mcfPKn4319QXimJ0LUaSCa7/QctrtlpXLYb/HLPOZaLGDtu/RwoNir5 0xN3qc1OPO2T9dR5fjSOtvphZBTe6AAh4t0LqgVUonf+yei51dSx4cik9z/JYtstTXievqHc73P VuDa6H3Li2yZA6hClTGQK0x5+znJ7Bk6Y7AZpy8+Wktmm2igRdE65kRgRnRFNu8sHXWKGKEBCEE q19YTEqoANwemIPZYJUtaljIxLFCJU9zQeI0kHpeYHC4bQT40cnifTp9cahVyE7uJTSyq/r3ym3 xsdX/QGYv/ke0dLUVEL2cqK7P+W7ltCsEcVVS1xk+UXM1xgp6UJHp4PQFyBCGrnuFYTL6lakRlG IWRWJ+M X-Received: by 2002:a05:6402:2112:b0:6a9:ab47:e08 with SMTP id 4fb4d7f45d1cf-6aa545f1e10mr1610240a12.0.1789739817032; Fri, 18 Sep 2026 06:56:57 -0700 (PDT) Received: from [192.168.0.35] ([109.76.4.225]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6aa59730866sm915455a12.18.2026.09.18.06.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2026 06:56:56 -0700 (PDT) From: Bryan O'Donoghue Date: Fri, 18 Sep 2026 14:56:41 +0100 Subject: [PATCH v20 6/6] media: qcom: camss: Use data-lanes starting at 1 for new CSIPHY mode 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: quoted-printable Message-Id: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-6-dc244e124e71@linaro.org> References: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> In-Reply-To: <20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-0-dc244e124e71@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robert Foss , Todor Tomov , Mauro Carvalho Chehab , Konrad Dybcio , Vladimir Zapolskiy , Bryan O'Donoghue , Loic Poulain , Vinod Koul , Neil Armstrong , Greg Kroah-Hartman , Kishon Vijay Abraham I , Felipe Balbi , Manivannan Sadhasivam Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-phy@lists.infradead.org, Bryan O'Donoghue , Krzysztof Kozlowski , Oleg Keri X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3176; i=bryan.odonoghue@linaro.org; h=from:subject:message-id; bh=pqNWQgF8ClsJh5Yi5qQY7AdMdYAk6BCqiLyzGAJKIe0=; b=owEBbQKS/ZANAwAKASJxO7Ohjcg6AcsmYgBqrUMcaIz3wyLlou3OxIUAqDc7LpQ0TclV6L5O6 W6PwUeeN9GJAjMEAAEKAB0WIQTmk/sqq6Nt4Rerb7QicTuzoY3IOgUCaq1DHAAKCRAicTuzoY3I OlrwEACgFIoqFiEREgBHed5k/+FwouGdl1N94FNwHz3Ju/kS9+7Go7eYTmPxlyEo2g66mlFzO6G mQ+CvwA5v0D00bg4MX4PSdFW1b907+AINo/KZB+DwNwrCmRwkK7MirL6oJ8b/MD1zUhrzkDX0D1 ICvThBsPaBjuYvsj3UmxIZbJoymwnHopj2s/KizRoxfraSr/RCn//zD4TJmFcdWWTox8JmJjOZP wWKHWl/x8YYb0x88Z2GALZkmPP/R92WPwO3lNJUjiOSv00lpumNW8NEjZRGd0XEbs66GMpAaimQ wBRj9mo5i4Q3c6OyuAJ93x4ay0UBLFK2P+SDn/7zn1X/SrRi5scbGLpKpppowv89oejqzKQtyuk 7yeglCJ/TqrwPk9nkMoJzHj15vut8RrGsvmZDOSgZnVg0IaPkrxJSWK6eUY8xfM2tqHRt2gmd37 r9Rq0U2c8kkp5Mk26c7g6/eNf8TUnAqBhiKjAzdx95HEx3psZWs3fENrTKKXKHFWAIeG5rCMh3q va4QLj2+Lhn5fxLr7DyUIX/AZfZxK90rzG2n8naIlvRfkesaF1vwJSljqM4RRmZeHKptaOs+UL6 7ADh2UwBCYYqKk0uhgVsPnN+X+6Tud40SQDRB2K0oPzTQWAmelVEcigHCgrQ4e3bNoIIoD0OWSi H572stIBMMlWv5Q== X-Developer-Key: i=bryan.odonoghue@linaro.org; a=openpgp; fpr=E693FB2AABA36DE117AB6FB422713BB3A18DC83A Introducing a dedicated CSIPHY driver community feedback was both to move to data-lanes starting at index 1 on the PHY side and also to match that indexing scheme in the CSI decoder - CSID. CSID consumes the data-lanes property to determine which CSID lanes to switch on. For indexes starting at 1 we need to amend the logic somewhere. The PHY side code normalises the input data to register level meanings so, replicate that logic on the CSID side. Introduce a simple flag to differentiate between legacy indexing @ 0 and new indexing @ 1. Existing bindings are not affected. Reviewed-by: Loic Poulain Tested-by: Oleg Keri # Lenovo Yoga Slim 7x Gen 11 (Glym= ur) Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csiphy.h | 1 + drivers/media/platform/qcom/camss/camss.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/med= ia/platform/qcom/camss/camss-csiphy.h index 7a357044b9fdb..8c3319f2ca1cf 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.h +++ b/drivers/media/platform/qcom/camss/camss-csiphy.h @@ -21,6 +21,7 @@ #define MSM_CSIPHY_PAD_SINK 0 #define MSM_CSIPHY_PAD_SRC 1 #define MSM_CSIPHY_PADS_NUM 2 +#define MSM_CSIPHY_MAX_DATA_LANE 4 =20 #define CSIPHY_GRP_ID 1 =20 diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index 84097d82d99c9..6f58e729eaceb 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -4742,7 +4742,8 @@ static const struct parent_dev_ops vfe_parent_dev_ops= =3D { */ static int camss_parse_endpoint_node(struct device *dev, struct fwnode_handle *ep, - struct camss_async_subdev *csd) + struct camss_async_subdev *csd, + u8 lane_base) { struct csiphy_lanes_cfg *lncfg =3D &csd->interface.csi2.lane_cfg; struct v4l2_mbus_config_mipi_csi2 *mipi_csi2; @@ -4777,7 +4778,14 @@ static int camss_parse_endpoint_node(struct device *= dev, return -ENOMEM; =20 for (i =3D 0; i < lncfg->num_data; i++) { - lncfg->data[i].pos =3D mipi_csi2->data_lanes[i]; + u8 lane =3D mipi_csi2->data_lanes[i]; + + if (lane < lane_base || lane - lane_base >=3D MSM_CSIPHY_MAX_DATA_LANE) { + dev_err(dev, "invalid data-lane %u\n", lane); + return -EINVAL; + } + + lncfg->data[i].pos =3D mipi_csi2->data_lanes[i] - lane_base; lncfg->data[i].pol =3D mipi_csi2->lane_polarities[i + 1]; } =20 @@ -4794,6 +4802,7 @@ static int camss_parse_ports(struct camss *camss) { struct device *dev =3D camss->dev; struct fwnode_handle *fwnode =3D dev_fwnode(dev), *ep; + u8 lane_base =3D camss->legacy_phy ? 0 : 1; int ret; =20 fwnode_graph_for_each_endpoint(fwnode, ep) { @@ -4841,7 +4850,7 @@ static int camss_parse_ports(struct camss *camss) goto err_cleanup; } =20 - ret =3D camss_parse_endpoint_node(dev, ep, csd); + ret =3D camss_parse_endpoint_node(dev, ep, csd, lane_base); if (ret < 0) goto err_cleanup; } --=20 2.55.0