From nobody Thu Dec 25 06:46:24 2025 Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EE826EB5D for ; Mon, 22 Jan 2024 16:32:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705941157; cv=none; b=mvHA7HKPHif+EHhWTeNXLUXv9PJ0n4YIihqQgvlMY89Xjo3dRdrO2NT59O6n5hlSABmMcZkWfoSfG6xlA6g8OB9m/YkzKfaIUwZjrRqxRU6gPbD0gphkmC0mt6WAHctMiR8GiPCntBhV/AzT0/JHR4xLTQNIQA1cbJfHEd4eNYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705941157; c=relaxed/simple; bh=JhvObS4GQ8Qdgb5wl3GUWBFziCFrID5vp3TWqC6dgJs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mXYNSaunkumPAR++wEf6nPstdAb6gqfpC1gtUfAWAvOAEk1mxRFYU+UHWntH7SCb63fSRM1/IBOhN5F+Urn639FREdXW4bf5qtLOamVzdiBMMfQ+L8ychtkRg7nT6WMT0fYy8kmDPdl7L18EpiyYPXR8EK40m4jlUUWp5VWNnmE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=L7/FAapq; arc=none smtp.client-ip=95.215.58.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="L7/FAapq" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1705941154; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zOQVFSKw3j/viuJ1r9uwPrf0VlEptyybu7p5hJGtU4I=; b=L7/FAapq5/GA78moIR9tbDqaLl+KwawdazCvL79VK9uJYNJjZeHurgVE3jowYQvTiIOyFV GSBgDlmh2QUmpkYssS3+2mBzDVU7Ns2GYjvfvVs9cAaa+EBtpknfHqgWfkkT9sBJFoXNEz wcaIH5I6UVRBIFL9gZo/ycf5uHSXYKw= From: Sui Jingfeng To: David Airlie Cc: Neil Armstrong , Maxime Ripard , Thomas Zimmermann , Daniel Vetter , Laurent Pinchart , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH 2/5] drm/bridge: simple-bridge: Extend match support for non-DT based systems Date: Tue, 23 Jan 2024 00:32:17 +0800 Message-Id: <20240122163220.110788-3-sui.jingfeng@linux.dev> In-Reply-To: <20240122163220.110788-1-sui.jingfeng@linux.dev> References: <20240122163220.110788-1-sui.jingfeng@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Which is intended to be used on non-DT environment, where the simple-bridge platform device is created by either the display controller driver side or platform firmware subsystem. To avoid duplication and to keep consistent, we choose to reuse the OF match tables. Because the potentional user may not has a of_node attached, nor a ACPI match id. If this is the case, a software node string property can be provide to fill the niche. Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/bridge/simple-bridge.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridg= e/simple-bridge.c index cbe8e778d7c7..595f672745b9 100644 --- a/drivers/gpu/drm/bridge/simple-bridge.c +++ b/drivers/gpu/drm/bridge/simple-bridge.c @@ -166,6 +166,24 @@ static const struct drm_bridge_funcs simple_bridge_bri= dge_funcs =3D { .disable =3D simple_bridge_disable, }; =20 +static const void *simple_bridge_get_match_data(const struct device *dev) +{ + const struct of_device_id *matches =3D dev->driver->of_match_table; + + /* Try to get the match data by software node */ + while (matches) { + if (!matches->compatible[0]) + break; + + if (device_is_compatible(dev, matches->compatible)) + return matches->data; + + matches++; + } + + return NULL; +} + static int simple_bridge_probe(struct platform_device *pdev) { struct simple_bridge *sbridge; @@ -176,7 +194,10 @@ static int simple_bridge_probe(struct platform_device = *pdev) return -ENOMEM; platform_set_drvdata(pdev, sbridge); =20 - sbridge->info =3D of_device_get_match_data(&pdev->dev); + if (pdev->dev.of_node) + sbridge->info =3D of_device_get_match_data(&pdev->dev); + else + sbridge->info =3D simple_bridge_get_match_data(&pdev->dev); =20 /* Get the next bridge in the pipeline. */ remote =3D of_graph_get_remote_node(pdev->dev.of_node, 1, -1); @@ -309,3 +330,4 @@ module_platform_driver(simple_bridge_driver); MODULE_AUTHOR("Maxime Ripard "); MODULE_DESCRIPTION("Simple DRM bridge driver"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:simple-bridge"); --=20 2.25.1