lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c66c084-5af6-43fb-a256-4746b2e00192@rock-chips.com>
Date: Sun, 18 Feb 2024 19:14:56 +0800
From: Andy Yan <andy.yan@...k-chips.com>
To: Ondřej Jirman <megi@....cz>, linux-kernel@...r.kernel.org
Cc: Sandy Huang <hjc@...k-chips.com>, Heiko Stübner
 <heiko@...ech.de>, Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
 Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
 David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
 "open list:DRM DRIVERS FOR ROCKCHIP" <dri-devel@...ts.freedesktop.org>,
 "moderated list:ARM/Rockchip SoC support"
 <linux-arm-kernel@...ts.infradead.org>,
 "open list:ARM/Rockchip SoC support" <linux-rockchip@...ts.infradead.org>
Subject: Re: [PATCH] drm: rockchip: Don't require MIPI DSI device when it's
 used for ISP

Hi,

On 2/18/24 02:39, Ondřej Jirman wrote:
> From: Ondrej Jirman <megi@....cz>
> 
> On RK3399 one MIPI DSI device can be alternatively used with the ISP1,
> to provide RX DPHY. When this is the case (ISP1 is enabled in device
> tree), probe success of DRM is tied to probe success of ISP1 connected
> camera sensor. This can fail if the user is able to killswitch the camera
> power, like on Pinephone Pro.
> 
> Detect use of MIPI DSI controller by ISP, and don't include it in
> component match list in that case.
> 

Isn't this supposed to be taken care of within the dts?
Since DPHY1 should exclusively used by MIPI DSI1 and ISP1, then if
a device want to use ISP1, the DSI1 should be disabled in dts.
> Signed-off-by: Ondrej Jirman <megi@....cz>
> ---
>   drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 47 +++++++++++++++++++++
>   1 file changed, 47 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index ab55d7132550..f47de94ad576 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -354,6 +354,43 @@ static void rockchip_drm_match_remove(struct device *dev)
>   		device_link_del(link);
>   }
>   
> +/*
> + * Check if ISP block linked to a mipi-dsi device via phys phandle is
> + * enabled in device tree.
> + */
> +static bool rockchip_drm_is_mipi1_and_used_by_isp(struct device *dev)
> +{
> +	struct device_node *np = NULL, *phy_np;
> +
> +	if (!of_device_is_compatible(dev->of_node, "rockchip,rk3399-mipi-dsi"))
> +		return false;
> +
> +	while (true) {
> +		np = of_find_compatible_node(np, NULL, "rockchip,rk3399-cif-isp");
> +		if (!np)
> +			break;
> +
> +		if (!of_device_is_available(np)) {
> +			of_node_put(np);
> +			continue;
> +		}
> +
> +		phy_np = of_parse_phandle(np, "phys", 0);
> +		if (!phy_np) {
> +			of_node_put(np);
> +			continue;
> +		}
> +
> +		of_node_put(phy_np);
> +		of_node_put(np);
> +
> +		if (phy_np == dev->of_node)
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
>   static struct component_match *rockchip_drm_match_add(struct device *dev)
>   {
>   	struct component_match *match = NULL;
> @@ -371,6 +408,16 @@ static struct component_match *rockchip_drm_match_add(struct device *dev)
>   			if (!d)
>   				break;
>   
> +			/*
> +			 * If mipi1 is connected to ISP, we don't want to wait for mipi1 component,
> +			 * because it will not be used by DRM anyway, to not tie success of camera
> +			 * driver probe to display pipeline initialization.
> +			 */
> +			if (rockchip_drm_is_mipi1_and_used_by_isp(d)) {
> +				dev_info(d, "used by ISP1, skipping from DRM\n");
> +				continue;
> +			}
> +
>   			device_link_add(dev, d, DL_FLAG_STATELESS);
>   			component_match_add(dev, &match, component_compare_dev, d);
>   		} while (true);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ