Message ID | 20220901044149.16782-5-rex-bc.chen@mediatek.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | Add MT8195 DisplayPort driver | expand |
Hi, Bo-Chen: On Thu, 2022-09-01 at 12:41 +0800, Bo-Chen Chen wrote: > The bridge types of eDP and DP are different. We add device data to > this driver and add bridge_type to the device data to define them. Reviewed-by: CK Hu <ck.hu@mediatek.com> > > Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com> > --- > drivers/gpu/drm/mediatek/mtk_dp.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c > b/drivers/gpu/drm/mediatek/mtk_dp.c > index e2ec9b02b1aa..2696c1ac1a47 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dp.c > +++ b/drivers/gpu/drm/mediatek/mtk_dp.c > @@ -101,6 +101,7 @@ struct mtk_dp { > struct drm_device *drm_dev; > struct drm_dp_aux aux; > > + const struct mtk_dp_data *data; > struct mtk_dp_info info; > struct mtk_dp_train_info train_info; > > @@ -109,6 +110,9 @@ struct mtk_dp { > struct regmap *regs; > }; > > +struct mtk_dp_data { > + int bridge_type; > +}; > static const struct mtk_dp_efuse_fmt > mtk_dp_efuse_data[MTK_DP_CAL_MAX] = { > [MTK_DP_CAL_GLB_BIAS_TRIM] = { > .idx = 3, > @@ -1871,6 +1875,7 @@ static int mtk_dp_probe(struct platform_device > *pdev) > return -ENOMEM; > > mtk_dp->dev = dev; > + mtk_dp->data = (struct mtk_dp_data > *)of_device_get_match_data(dev); > > irq_num = platform_get_irq(pdev, 0); > if (irq_num < 0) > @@ -1925,7 +1930,7 @@ static int mtk_dp_probe(struct platform_device > *pdev) > > mtk_dp->bridge.ops = > DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | > DRM_BRIDGE_OP_HPD; > - mtk_dp->bridge.type = DRM_MODE_CONNECTOR_eDP; > + mtk_dp->bridge.type = mtk_dp->data->bridge_type; > > drm_bridge_add(&mtk_dp->bridge); > > @@ -1974,8 +1979,15 @@ static int mtk_dp_resume(struct device *dev) > > static SIMPLE_DEV_PM_OPS(mtk_dp_pm_ops, mtk_dp_suspend, > mtk_dp_resume); > > +static const struct mtk_dp_data mt8195_edp_data = { > + .bridge_type = DRM_MODE_CONNECTOR_eDP, > +}; > + > static const struct of_device_id mtk_dp_of_match[] = { > - { .compatible = "mediatek,mt8195-edp-tx" }, > + { > + .compatible = "mediatek,mt8195-edp-tx", > + .data = &mt8195_edp_data, > + }, > {}, > }; > MODULE_DEVICE_TABLE(of, mtk_dp_of_match);
diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index e2ec9b02b1aa..2696c1ac1a47 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -101,6 +101,7 @@ struct mtk_dp { struct drm_device *drm_dev; struct drm_dp_aux aux; + const struct mtk_dp_data *data; struct mtk_dp_info info; struct mtk_dp_train_info train_info; @@ -109,6 +110,9 @@ struct mtk_dp { struct regmap *regs; }; +struct mtk_dp_data { + int bridge_type; +}; static const struct mtk_dp_efuse_fmt mtk_dp_efuse_data[MTK_DP_CAL_MAX] = { [MTK_DP_CAL_GLB_BIAS_TRIM] = { .idx = 3, @@ -1871,6 +1875,7 @@ static int mtk_dp_probe(struct platform_device *pdev) return -ENOMEM; mtk_dp->dev = dev; + mtk_dp->data = (struct mtk_dp_data *)of_device_get_match_data(dev); irq_num = platform_get_irq(pdev, 0); if (irq_num < 0) @@ -1925,7 +1930,7 @@ static int mtk_dp_probe(struct platform_device *pdev) mtk_dp->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD; - mtk_dp->bridge.type = DRM_MODE_CONNECTOR_eDP; + mtk_dp->bridge.type = mtk_dp->data->bridge_type; drm_bridge_add(&mtk_dp->bridge); @@ -1974,8 +1979,15 @@ static int mtk_dp_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(mtk_dp_pm_ops, mtk_dp_suspend, mtk_dp_resume); +static const struct mtk_dp_data mt8195_edp_data = { + .bridge_type = DRM_MODE_CONNECTOR_eDP, +}; + static const struct of_device_id mtk_dp_of_match[] = { - { .compatible = "mediatek,mt8195-edp-tx" }, + { + .compatible = "mediatek,mt8195-edp-tx", + .data = &mt8195_edp_data, + }, {}, }; MODULE_DEVICE_TABLE(of, mtk_dp_of_match);
The bridge types of eDP and DP are different. We add device data to this driver and add bridge_type to the device data to define them. Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com> --- drivers/gpu/drm/mediatek/mtk_dp.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)