[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52747ddcdae8c1445b6bed00acec03da0806b068.camel@mediatek.com>
Date: Thu, 30 Jun 2022 10:29:27 +0800
From: CK Hu <ck.hu@...iatek.com>
To: Bo-Chen Chen <rex-bc.chen@...iatek.com>, <chunkuang.hu@...nel.org>,
<p.zabel@...gutronix.de>, <daniel@...ll.ch>, <robh+dt@...nel.org>,
<krzysztof.kozlowski+dt@...aro.org>, <mripard@...nel.org>,
<tzimmermann@...e.de>, <matthias.bgg@...il.com>, <deller@....de>,
<airlied@...ux.ie>
CC: <msp@...libre.com>, <granquet@...libre.com>,
<jitao.shi@...iatek.com>, <wenst@...omium.org>,
<angelogioacchino.delregno@...labora.com>,
<dri-devel@...ts.freedesktop.org>,
<linux-mediatek@...ts.infradead.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-fbdev@...r.kernel.org>,
<Project_Global_Chrome_Upstream_Group@...iatek.com>
Subject: Re: [PATCH v12 05/10] drm/mediatek: Add MT8195 Embedded DisplayPort
driver
Hi, Bo-Chen:
On Mon, 2022-06-27 at 16:03 +0800, Bo-Chen Chen wrote:
> From: Markus Schneider-Pargmann <msp@...libre.com>
>
> This patch adds a embedded displayport driver for the MediaTek mt8195
> SoC.
>
> It supports the MT8195, the embedded DisplayPort units. It offers
> DisplayPort 1.4 with up to 4 lanes.
>
> The driver creates a child device for the phy. The child device will
> never exist without the parent being active. As they are sharing a
> register range, the parent passes a regmap pointer to the child so
> that
> both can work with the same register range. The phy driver sets
> device
> data that is read by the parent to get the phy device that can be
> used
> to control the phy properties.
>
> This driver is based on an initial version by
> Jitao shi <jitao.shi@...iatek.com>
>
> Signed-off-by: Markus Schneider-Pargmann <msp@...libre.com>
> Signed-off-by: Guillaume Ranquet <granquet@...libre.com>
> [Bo-Chen: Cleanup the drivers and modify comments from reviewers]
> Signed-off-by: Bo-Chen Chen <rex-bc.chen@...iatek.com>
> ---
[snip]
> +
> +static int mtk_dp_dt_parse(struct mtk_dp *mtk_dp,
> + struct platform_device *pdev)
> +{
> + struct device_node *of_node = pdev->dev.of_node;
> + struct device *dev = &pdev->dev;
> + int ret = 0;
> + void __iomem *base;
> + u32 linkrate;
> + int len;
> +
> + base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(base))
> + return PTR_ERR(base);
> +
> + mtk_dp->regs = devm_regmap_init_mmio(dev, base,
> &mtk_dp_regmap_config);
> + if (IS_ERR(mtk_dp->regs))
> + return PTR_ERR(mtk_dp->regs);
> +
> + len = of_property_count_elems_of_size(of_node,
> + "data-lanes",
> sizeof(u32));
> + if (len < 0 || len > 4 || len == 3) {
> + dev_err(dev, "invalid data lane size: %d\n", len);
> + return -EINVAL;
> + }
> +
> + mtk_dp->max_lanes = len;
> +
> + ret = device_property_read_u32(dev, "max-linkrate-mhz",
> &linkrate);
> + if (ret) {
> + dev_err(dev, "failed to read max linkrate: %d\n", ret);
> + return ret;
> + }
> +
> + switch (linkrate) {
> + case 8100: /* 8.1G */
> + mtk_dp->max_linkrate = DP_LINK_BW_8_1;
> + break;
> + case 5400: /* 5.4G */
> + mtk_dp->max_linkrate = DP_LINK_BW_5_4;
> + break;
> + case 2700: /* 2.7G */
> + mtk_dp->max_linkrate = DP_LINK_BW_2_7;
> + break;
> + case 1620: /* 1.62G */
> + mtk_dp->max_linkrate = DP_LINK_BW_1_62;
> + break;
> + default:
> + dev_err(dev, "invalid linkrate: %d\n", linkrate);
> + return -EINVAL;
> + }
Use drm_dp_link_rate_to_bw_code() instead of self-implementation.
Regards,
CK
> +
> + return 0;
> +}
> +
Powered by blists - more mailing lists