[PATCH v4 09/10] drm/vs: Innosilicon HDMI support
Krzysztof Kozlowski
krzk at kernel.org
Tue May 21 02:31:43 PDT 2024
On 21/05/2024 12:58, keith wrote:
> add inno hdmi driver which binds to vs display controller
> and this driver uses the commom api from the inno hdmi
>
> Signed-off-by: keith <keith.zhao at starfivetech.com>
> ---
...
> +static int starfive_hdmi_bind(struct device *dev, struct device *master,
> + void *data)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct drm_device *drm = dev_get_drvdata(master);
> + struct stf_inno_hdmi *stf_hdmi;
> + struct inno_hdmi *hdmi;
> + struct resource *iores;
> +
> + int ret;
> + unsigned long long rate;
> +
> + stf_hdmi = drmm_simple_encoder_alloc(drm, struct stf_inno_hdmi,
> + encoder, DRM_MODE_ENCODER_TMDS);
> + hdmi = &stf_hdmi->inno_hdmi;
> +
> + hdmi->dev = dev;
> + hdmi->plat_data = (struct inno_hdmi_plat_data *)of_device_get_match_data(dev);
> +
> + iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + hdmi->regs = devm_ioremap_resource(dev, iores);
There's a helper combining these two.
> + if (IS_ERR(hdmi->regs))
> + return PTR_ERR(hdmi->regs);
> +
> + ret = starfive_hdmi_get_clk_rst(dev, stf_hdmi);
> + if (ret < 0)
> + return ret;
> +
> + ret = starfive_hdmi_enable_clk_rst(dev, stf_hdmi);
> + if (ret)
> + return ret;
> +
> + rate = clk_get_rate(stf_hdmi->clk_hdmi[CLK_SYS].clk);
> + inno_hdmi_i2c_init(hdmi, rate);
> +
> + ret = inno_hdmi_bind(drm, hdmi, &stf_hdmi->encoder);
> + if (ret)
> + goto err_disable_clk;
> +
> + dev_set_drvdata(dev, stf_hdmi);
> +
> + return 0;
> +
Best regards,
Krzysztof
More information about the linux-arm-kernel
mailing list