[PATCH 8/8] drm/msm/dp: Support external GPIO HPD with 3rd pinctrl chip

Krzysztof Kozlowski krzk at kernel.org
Fri Nov 29 08:21:08 UTC 2024


On 29/11/2024 08:57, Xiangxu Yin wrote:
>  
> +	if (of_find_property(pdev->dev.of_node, "dp-hpd-gpio", NULL)) {
> +		dp->ext_gpio = true;
> +		dp->gpio_num = of_get_named_gpio(pdev->dev.of_node, "dp-hpd-gpio", 0);
> +		if (dp->gpio_num < 0) {
> +			dev_err(&pdev->dev, "Failed to get gpio:%d\n", dp->gpio_num);
> +			return dp->gpio_num;
> +		}
> +
> +		if (!gpio_is_valid(dp->gpio_num)) {
> +			DRM_ERROR("gpio(%d) invalid\n", dp->gpio_num);
> +			return -EINVAL;
> +		}
> +
> +		rc = gpio_request(dp->gpio_num, "dp-hpd-gpio");
This is not how you request GPIOs. All this code is just wrong. See
Gpiolib API description/document. Or any other driver using GPIOs.

Best regards,
Krzysztof


More information about the dri-devel mailing list