Message ID | 20191202193359.703709-1-adrian.ratiu@collabora.com |
---|---|
Headers | show |
Series | Genericize DW MIPI DSI bridge and add i.MX 6 driver | expand |
Hi Adrian, And sorry for this late reply. Your patches look good and we ("stm guys") understand that v1.01 is very different to v1.30/31. We are doing our best to review & test your patches and we will go back to you asap. Many thanks, Philippe :-) On 12/2/19 8:33 PM, Adrian Ratiu wrote: > Having a generic Synopsis DesignWare MIPI-DSI host controller bridge > driver is a very good idea, however the current implementation has > hardcoded quite a lot of the register layouts used by the two supported > SoC vendors, STM and Rockchip, which use IP cores v1.30 and v1.31. > > This makes it hard to support other SoC vendors like the FSL/NXP i.MX 6 > which use older v1.01 cores or future versions because, based on history, > layout changes should also be expected in new DSI versions / SoCs. > > This patch series converts the bridge and platform drivers to access > registers via generic regmap APIs and allows each platform driver to > configure its register layout via struct reg_fields, then adds support > for the host controller found on i.MX 6. > > I only have i.MX hardware with MIPI-DSI panel and relevant documentation > available for testing so I'll really appreciate it if someone could test > the series on Rockchip and STM... eyeballing register fields could only > get me so far, so sorry in advance for any breakage! > > Many thanks to Boris Brezillon <boris.brezillon@collabora.com> for > suggesting the regmap solution and to Liu Ying <Ying.Liu@freescale.com> > for doing the initial i.MX platform driver implementation. > > This series applies on top of latest linux-next tree, next-20191202. > > v3 -> v4: > * Added commmit message to dt-binding patch (Neil) > * Converted the dt-binding to yaml dt-schema format (Neil) > * Small DT node + driver fixes (Rob) > * Renamed platform driver to reflect it's only for i.MX v6 (Fabio) > * Added small panel example to the host controller DT binding > > v2 -> v3: > * Added const declarations to dw-mipi-dsi.c structs (Emil) > * Fixed Reviewed-by tags and cc'd some more relevant ML (Emil) > > v1 -> v2: > * Moved register definitions & regmap initialization into bridge > module. Platform drivers get the regmap via plat_data after calling > the bridge probe (Emil). > > Adrian Ratiu (4): > drm: bridge: dw_mipi_dsi: access registers via a regmap > drm: bridge: dw_mipi_dsi: abstract register access using reg_fields > drm: imx: Add i.MX 6 MIPI DSI host driver > dt-bindings: display: add i.MX6 MIPI DSI host controller doc > > .../display/imx/fsl,mipi-dsi-imx6.yaml | 136 ++++ > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 699 +++++++++++++----- > drivers/gpu/drm/imx/Kconfig | 7 + > drivers/gpu/drm/imx/Makefile | 1 + > drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c | 378 ++++++++++ > .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 17 +- > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 34 +- > include/drm/bridge/dw_mipi_dsi.h | 2 +- > 8 files changed, 1067 insertions(+), 207 deletions(-) > create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml > create mode 100644 drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c >
On Mon, 02 Dec 2019, Adrian Ratiu <adrian.ratiu@collabora.com> wrote: > Having a generic Synopsis DesignWare MIPI-DSI host controller > bridge driver is a very good idea, however the current > implementation has hardcoded quite a lot of the register layouts > used by the two supported SoC vendors, STM and Rockchip, which > use IP cores v1.30 and v1.31. > > This makes it hard to support other SoC vendors like the FSL/NXP > i.MX 6 which use older v1.01 cores or future versions because, > based on history, layout changes should also be expected in new > DSI versions / SoCs. > > This patch series converts the bridge and platform drivers to > access registers via generic regmap APIs and allows each > platform driver to configure its register layout via struct > reg_fields, then adds support for the host controller found on > i.MX 6. > > I only have i.MX hardware with MIPI-DSI panel and relevant > documentation available for testing so I'll really appreciate it > if someone could test the series on Rockchip and > STM... eyeballing register fields could only get me so far, so > sorry in advance for any breakage! > > Many thanks to Boris Brezillon <boris.brezillon@collabora.com> > for suggesting the regmap solution and to Liu Ying > <Ying.Liu@freescale.com> for doing the initial i.MX platform > driver implementation. > > This series applies on top of latest linux-next tree, > next-20191202. > > v3 -> v4: > * Added commmit message to dt-binding patch (Neil) * Converted > the dt-binding to yaml dt-schema format (Neil) * Small DT node > + driver fixes (Rob) * Renamed platform driver to reflect it's > only for i.MX v6 (Fabio) * Added small panel example to the > host controller DT binding > > v2 -> v3: > * Added const declarations to dw-mipi-dsi.c structs (Emil) * > Fixed Reviewed-by tags and cc'd some more relevant ML (Emil) > > v1 -> v2: > * Moved register definitions & regmap initialization into > bridge module. Platform drivers get the regmap via plat_data > after calling the bridge probe (Emil). I've been told I forgot to explicitly CC some of the maintainers, sorry about that! Added a few more persons to CC. > > Adrian Ratiu (4): > drm: bridge: dw_mipi_dsi: access registers via a regmap > drm: bridge: dw_mipi_dsi: abstract register access using reg_fields > drm: imx: Add i.MX 6 MIPI DSI host driver > dt-bindings: display: add i.MX6 MIPI DSI host controller doc > > .../display/imx/fsl,mipi-dsi-imx6.yaml | 136 ++++ > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 699 +++++++++++++----- > drivers/gpu/drm/imx/Kconfig | 7 + > drivers/gpu/drm/imx/Makefile | 1 + > drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c | 378 ++++++++++ > .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 17 +- > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 34 +- > include/drm/bridge/dw_mipi_dsi.h | 2 +- > 8 files changed, 1067 insertions(+), 207 deletions(-) > create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml > create mode 100644 drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c > > -- > 2.24.0 > > _______________________________________________ > Linux-stm32 mailing list > Linux-stm32@st-md-mailman.stormreply.com > https://st-md-mailman.stormreply.com/mailman/listinfo/linux-stm32
On Fri, 06 Dec 2019, Philippe CORNU <philippe.cornu@st.com> wrote: > Hi Adrian, > > And sorry for this late reply. Your patches look good and we > ("stm guys") understand that v1.01 is very different to > v1.30/31. > > We are doing our best to review & test your patches and we will > go back to you asap. Many thanks, Philippe :-) Hi Philippe, Thank you for taking the time to test this, I really appreciate it. Adrian > > > On 12/2/19 8:33 PM, Adrian Ratiu wrote: >> Having a generic Synopsis DesignWare MIPI-DSI host controller bridge >> driver is a very good idea, however the current implementation has >> hardcoded quite a lot of the register layouts used by the two supported >> SoC vendors, STM and Rockchip, which use IP cores v1.30 and v1.31. >> >> This makes it hard to support other SoC vendors like the FSL/NXP i.MX 6 >> which use older v1.01 cores or future versions because, based on history, >> layout changes should also be expected in new DSI versions / SoCs. >> >> This patch series converts the bridge and platform drivers to access >> registers via generic regmap APIs and allows each platform driver to >> configure its register layout via struct reg_fields, then adds support >> for the host controller found on i.MX 6. >> >> I only have i.MX hardware with MIPI-DSI panel and relevant documentation >> available for testing so I'll really appreciate it if someone could test >> the series on Rockchip and STM... eyeballing register fields could only >> get me so far, so sorry in advance for any breakage! >> >> Many thanks to Boris Brezillon <boris.brezillon@collabora.com> for >> suggesting the regmap solution and to Liu Ying <Ying.Liu@freescale.com> >> for doing the initial i.MX platform driver implementation. >> >> This series applies on top of latest linux-next tree, next-20191202. >> >> v3 -> v4: >> * Added commmit message to dt-binding patch (Neil) >> * Converted the dt-binding to yaml dt-schema format (Neil) >> * Small DT node + driver fixes (Rob) >> * Renamed platform driver to reflect it's only for i.MX v6 (Fabio) >> * Added small panel example to the host controller DT binding >> >> v2 -> v3: >> * Added const declarations to dw-mipi-dsi.c structs (Emil) >> * Fixed Reviewed-by tags and cc'd some more relevant ML (Emil) >> >> v1 -> v2: >> * Moved register definitions & regmap initialization into bridge >> module. Platform drivers get the regmap via plat_data after calling >> the bridge probe (Emil). >> >> Adrian Ratiu (4): >> drm: bridge: dw_mipi_dsi: access registers via a regmap >> drm: bridge: dw_mipi_dsi: abstract register access using reg_fields >> drm: imx: Add i.MX 6 MIPI DSI host driver >> dt-bindings: display: add i.MX6 MIPI DSI host controller doc >> >> .../display/imx/fsl,mipi-dsi-imx6.yaml | 136 ++++ >> drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 699 +++++++++++++----- >> drivers/gpu/drm/imx/Kconfig | 7 + >> drivers/gpu/drm/imx/Makefile | 1 + >> drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c | 378 ++++++++++ >> .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 17 +- >> drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 34 +- >> include/drm/bridge/dw_mipi_dsi.h | 2 +- >> 8 files changed, 1067 insertions(+), 207 deletions(-) >> create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml >> create mode 100644 drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c >>
Hi Adrian, Thanks for the patch. This is nice consolidation work. I'm Ccing Heiko for the Rockchip part. See below for some comments. On Mon, 2019-12-02 at 21:33 +0200, AdrianAdrian Ratiu wrote: > Convert the common bridge code and the two rockchip & stm drivers > which currently use it to the regmap API in anticipation for further > changes to make it more generic and add older DSI host controller > support as found on i.mx6 based devices. > > The regmap becomes an internal state of the bridge. No functional > changes other than requiring the platform drivers to use the > pre-configured regmap supplied by the bridge after its probe() call > instead of ioremp'ing the registers themselves. > > In subsequent commits the bridge will become able to detect the > DSI host core version and init the regmap with different register > layouts. The platform drivers will continue to use the regmap without > modifications or worrying about the specific layout in use (in other > words the layout is abstracted away via the regmap). > > Suggested-by: Boris Brezillon <boris.brezillon@collabora.com> > Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> > Reviewed-by: Emil Velikov <emil.velikov@collabora.com> > Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com> > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 215 ++++++++++-------- > .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 17 +- At least for Rockchip, I'd rather see this done in two steps: first some regmap infrastructure introduced, and then in a follow-up patch, the rockchip driver moved to it. It's safer, and better from a bisection POV, and from a first look it seems doable. > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 34 ++- It would be good to do try the same for STM. It's also simpler to review that way. > include/drm/bridge/dw_mipi_dsi.h | 2 +- > 4 files changed, 145 insertions(+), 123 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index b6e793bb653c..6cb57807f3f9 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -15,6 +15,7 @@ > #include <linux/module.h> > #include <linux/of_device.h> > #include <linux/pm_runtime.h> > +#include <linux/regmap.h> > #include <linux/reset.h> > > #include <video/mipi_display.h> > @@ -226,7 +227,7 @@ struct dw_mipi_dsi { > struct mipi_dsi_host dsi_host; > struct drm_bridge *panel_bridge; > struct device *dev; > - void __iomem *base; > + struct regmap *regs; > You have the regmap here... > > struct clk *pclk; > [..] > @@ -954,7 +952,6 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) > } > > dsi->dev = dev; > - dsi->pdata.base = dsi->base; > dsi->pdata.max_data_lanes = dsi->cdata->max_data_lanes; > dsi->pdata.phy_ops = &dw_mipi_dsi_rockchip_phy_ops; > dsi->pdata.host_ops = &dw_mipi_dsi_rockchip_host_ops; > @@ -970,6 +967,8 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) > goto err_clkdisable; > } > > + dsi->regs = dsi->pdata.regs; > + ... and this goes for both STM and Rockchip: I don't think you need neither the struct dw_mipi_dsi_plat_data.regs nor the structdw_mipi_dsi_{rockchip, stm}.regs. You should be able to just access the regmap via the struct dw_mipi_dsi. [..] > > err_dsi_probe: > @@ -474,7 +472,7 @@ static struct platform_driver dw_mipi_dsi_stm_driver = { > .remove = dw_mipi_dsi_stm_remove, > .driver = { > .of_match_table = dw_mipi_dsi_stm_dt_ids, > - .name = "stm32-display-dsi", > + .name = DRIVER_NAME, Unrelated change, please drop it. > .pm = &dw_mipi_dsi_stm_pm_ops, > }, > }; Thanks, Ezequiel