From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.181 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796354376; b=rtWRGlK3Hq4StPpo21yxy/x6NzfmOMie080fFfu7zDYt99kZvxHstTiF1YDS1iacSW57 RAW8YqoCzxPSV3yZxB83Pf4sFCSuuCkqpLr8p0iMGgznzleVrNmmUTsvsCOoCJJN/K95C sJQRjvwq0PM4aDzxxaa63DsCHvgfe+jNgJaNqMK/JEDgXmaHNAnD1YVF5GYZAEI/nSyVO De7yJ1l9W2JOcHMkCYagfqyr/nwShVgALAwigUItWD4xoC+xJ9Aff9zfTP2NYST08qP/q oT7wv9H3taN0FEeYZI9YSlGElPQEoE09+gp5kBQry6EaeVQfNUtDyErH9JKf0VOWoAQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796354376; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key; bh=3GHyJWNyeICtA8Pe9BnwQ9ahk1Tq0rG8/kOJyNyrpS8=; b=iI2RNQRKBUVk7pHOlCVtYIVTk0Nhd1bmnfjodg1ZqUjlmhzxQA1o2NtdpUOh6i5Bv7wj WEoxgFVsRzuR7SAlU2z7IGyx5X0UrAIuauAWTR5ICfOC5MIKaWVEw+dd12iSnEK4tJ1Ca Vlr6TE+hdTWqlmnodIP7zNaS2QDJcxQL72WT45KeCgTcOY6T3Fefx6AZJN8qSkhgT87yu jCiABPDtJnjutflNC3dEwzm9oUbIR93Z2SQ2vLKiN5cMXdpafxtX2Fzwe0Ims5+nqW0zq QElDyd2cUQx/sdZ+7SFEi/eYf0bHs0x6cJRGZAL/ZCGXUoJYDipNVfwaOxXZgJ92HLQ== 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=GMuT47se; arc=none smtp.remote-ip=209.85.210.181 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.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 BF7D0606A333 for ; Fri, 4 Dec 2026 03:19:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BF7D0606A333 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=GMuT47se Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-8bee140cdd7so24919b3a.2 for ; Thu, 03 Dec 2026 19:19:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796354375; x=1796959175; 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=3GHyJWNyeICtA8Pe9BnwQ9ahk1Tq0rG8/kOJyNyrpS8=; b=GMuT47sed/DbaMJTRGfHILATX4PDJNnAFYLjbK/YO0Fro0yBMeE0evMbqhjVahVZhv rkPjphHyNzC+h8BeJF0SYAO8qveSveIpCbwfp4qIcuhjygYcyZY+57dX4L976d+8fjlM X16WWGQBhX02SzeZwP3huI7zUAkbk0CSQrwWsyYK0jsThhY2alNCg6cYL6mWUWaQnSQy fFsVeMSrAfo9wQoVs8Gklb3BAFSCKkr7E9wsJrJ+LaIB7/bIvV5yNVA0SDj2EQNznGIB M3/vUysEcU7K1TvTk6i2jcKgVgASjdliO/IYhfEhlpQxB9TE2zbKlKHkzZMZOQFQ1ued eQEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796354375; x=1796959175; 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=3GHyJWNyeICtA8Pe9BnwQ9ahk1Tq0rG8/kOJyNyrpS8=; b=m7pYXg3fLs1p92iIw4JsOaKWlrWxp35HHpijplUMK9glrtpVGY3oX5x3wGVOthzKdl JT/oYZgb5bcFI5QpGGsrDGgPdGslWxAv+TFXo9lC431WSNp8S0UPCdyUPhxki7eAh95a UNNfXmt6Sgc7x7yvmmPY2V74YiYo0NvDo+g7Q0N7RRzX5kOL0XO4PsG2d1BrPLLZ7r4j KFNuzu1Wre+ZKO7Bh3ppU6cCOP79CCOQLjvo1FtUBG9z7PhnZo+KTL7bDq9yjgSB9doC rv5m+DtxQEPiqYFIgpyJLVvHA7SRjUKk14+fLM6vSvoMrNMLMo+Tp/AW4+IsW8bO1k1c Pu4w== X-Forwarded-Encrypted: i=1; AL+hErFIeJBSIyn/pnG/HUkhu6o4glfXg5tzvN87+EGGpe/+A5TIEwBVlCKve/QeIPyjvZNbxfeistZau/s0fk4=@vger.kernel.org X-Gm-Message-State: APuU4Z+rP15USI19Mm/u1ZS7ana7FgHZIypgg77IBfhEZT12cVjDEGde bIimCUmkFrQwfXJFG5nRqFO/gQCw1/TM434XjgbjQcwIs1AJVezFuNbD X-Gm-Gg: AZFdTZdwMeAMn7yfpbKqOUt+s7si7hxdtezK6v3AQl0+xmlkjir+ORflcdybNamJGcc VWVrbuAzZBa9WK4xa1nCZHP8irD8gsNZDrRXTpzah0SXaDdPAWJHt+2+3eXugkXEmYek6TFSUMi fDQMUQaKHAWrTxftn/+vw8vDl0hrJcfdxpSuTFEXgz0hj0P5kJh1bhbAxZyRj0CwaLRFJA3HB2p Z+8mT7Kwi+0Rsdqh0uMXLsbgwl6N+oSLb5sVOJorlf/3BKBRBvmr2vHcPumoLCcY1bVKYliSQSg 14ZC1MWr4jOAJjQFX2GFttkTmexVnZSlZXnuBvcthCsrVTbRxLSAyaLJtYb7ryI8Gsx0U9u6pTT OYC3Eh+7MVv2cvT6VBHtXbrQjZ7j6zX5QLxIfMzxxVm5lLp+sJXuAG6VlRFixBrnw0ETAk2ygrv a0RCZDpOS+jqqkkI1PZ7yTBIWnzpaWCnPM0J14WDXIqBIsAPbXeAeQA6cqRqrfJXZO+afL8p8FP k7JEpVmNMZeCD+hMgW6QQAV68ckL/NAHVeG8TOfikQcqFZrPLxFo1x0LtgnAepUoxtNFjlSPA3F FbjAJeuLYclOesdEBNStui9WcZ25gDkubV/nimA3rLmbGNWi5ChXQKJFRL6xhjwOwF+hh7FF3ql XThNJCoI82FuyTQjvzXw2 X-Received: by 2002:a17:903:1b0d:b0:2f0:3cbf:743d with SMTP id d9443c01a7336-2f1ba128fedmr9528315ad.4.1796354374665; Thu, 03 Dec 2026 19:19:34 -0800 (PST) Received: from [127.0.1.1] (211-23-39-77.hinet-ip.hinet.net. [211.23.39.77]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f1b791a308sm3316285ad.28.2026.12.03.19.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 19:19:34 -0800 (PST) From: Jason Yang Date: Fri, 04 Dec 2026 11:18:58 +0800 Subject: [PATCH v9 08/10] phy: rockchip-samsung-dcphy: Support the new phy-type and direction binding 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261204-dcphy-rx-v1-v9-8-fad1cfe7f536@gmail.com> References: <20261204-dcphy-rx-v1-v9-0-fad1cfe7f536@gmail.com> In-Reply-To: <20261204-dcphy-rx-v1-v9-0-fad1cfe7f536@gmail.com> To: Vinod Koul , Neil Armstrong , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Guochun Huang , Philipp Zabel Cc: Michael Riesch , Sebastian Reichel , Bryan O'Donoghue , Quentin Schulz , linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jason Yang X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796354337; l=3409; i=jason98166@gmail.com; s=20260721; h=from:subject:message-id; bh=AUaZkHQE+oIVR/HqA9GOtYpcsUI8tU79Ey4oHVifaMM=; b=YLKOrtpx7hc+PexVdn2Z/8F96OF6bZcs+LEbJCs9YUUm9QkHqYl14TaLfMX8P+u5RfZfYlKmg 6PA4x/aUN5IAtyc0Jc81UbYWoDfMVnw6OfwtLB3dF5dsfelsgQqr4kk X-Developer-Key: i=jason98166@gmail.com; a=ed25519; pk=xQmD001Q/ooHl39PxyQtusbUQmgbOsSfpFryRVWZ/k4= The binding now selects the PHY with the cell and the mode of the block with the phy-type property of the provider. Read phy-type in probe, D-PHY by default. of_xlate() returns the transmitter for PHY_DIRECTION_TX. The deprecated PHY_TYPE_DPHY and PHY_TYPE_CPHY select the transmitter as today, so existing DTs are unaffected. A phy-type other than D-PHY or C-PHY fails probe. A deprecated cell value that does not match phy-type gets a warning, and the transmitter then refuses to power on, as in C-PHY mode today. Signed-off-by: Jason Yang Reviewed-by: Michael Riesch Tested-by: Quentin Schulz # RK3588 Tiger CSI1 2-lane IMX219, CSI0 2-lane OV5675+DSI --- drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c | 32 ++++++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c b/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c index 7517cf4d4068..ee1c8f5219ae 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c @@ -309,6 +309,7 @@ struct samsung_mipi_dcphy { struct reset_control *grf_apb_rst; struct samsung_mipi_phy tx; u8 type; + bool legacy_mismatch; const struct samsung_mipi_dcphy_plat_data *pdata; }; @@ -1384,6 +1385,9 @@ static int samsung_mipi_dcphy_tx_power_on(struct phy *phy) { struct samsung_mipi_dcphy *samsung = phy_get_drvdata(phy); + if (samsung->legacy_mismatch) + return -EOPNOTSUPP; + switch (samsung->type) { case PHY_TYPE_DPHY: return samsung_mipi_dphy_tx_power_on(samsung); @@ -1557,13 +1561,21 @@ static struct phy *samsung_mipi_dcphy_xlate(struct device *dev, return ERR_PTR(-EINVAL); } - if (samsung->type != PHY_NONE && samsung->type != args->args[0]) - dev_warn(dev, "phy type select %d overwriting type %d\n", - args->args[0], samsung->type); - - samsung->type = args->args[0]; - - return samsung->tx.phy; + switch (args->args[0]) { + case PHY_DIRECTION_TX: + return samsung->tx.phy; + case PHY_TYPE_DPHY: + case PHY_TYPE_CPHY: + if (args->args[0] != samsung->type) { + dev_warn(dev, "unsupported phy cell %u with phy-type %u\n", + args->args[0], samsung->type); + samsung->legacy_mismatch = true; + } + return samsung->tx.phy; + default: + dev_err(dev, "invalid phy cell %u\n", args->args[0]); + return ERR_PTR(-EINVAL); + } } static int samsung_mipi_dcphy_probe(struct platform_device *pdev) @@ -1574,6 +1586,7 @@ static int samsung_mipi_dcphy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; struct resource *res; void __iomem *regs; + u32 type = PHY_TYPE_DPHY; int ret; samsung = devm_kzalloc(dev, sizeof(*samsung), GFP_KERNEL); @@ -1628,6 +1641,11 @@ static int samsung_mipi_dcphy_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(samsung->grf_apb_rst), "Failed to get system grf_apb_rst control\n"); + of_property_read_u32(np, "phy-type", &type); + if (type != PHY_TYPE_DPHY && type != PHY_TYPE_CPHY) + return dev_err_probe(dev, -EINVAL, "unsupported phy-type %u\n", type); + samsung->type = type; + ret = devm_pm_runtime_enable(dev); if (ret) return dev_err_probe(dev, ret, "Failed to enable runtime PM\n"); -- 2.43.0