RE: [PATCH v2] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs
Hi Philippe, From: Philippe CORNU Date: Thu, Jul 09, 2020 at 08:56:10 > > On 7/8/20 7:08 PM, Angelo Ribeiro wrote: > > Hi, > > > > Is this patch good to go? > > @dan...@ffwll.ch, @Philippe CORNU > > > > Was already tested by @Yannick FERTRE > > and @Adrian Pop > > on > > https://urldefense.com/v3/__https://lkml.org/lkml/2020/4/6/691__;!!A4F2R9G_pg!Kt4QZq004dTCJ3GJ6t6RIaJMBrP5tWWgTlboJo1ZICktSxRegGKtp1VxYM1i2PiM$ > > . > > > > Thanks, > > Angelo > > > > From: Yannick > > FERTRE > > Date: Wed, Jun 24, 2020 at 16:35:04 > > > >> Hello Angelo, > >> thanks for the patch. > >> Tested-by: Yannick Fertre > >> Tested OK on STM32MP1-DISCO, DSI v1.31 > >> > >> Best regards > >> > >> > >> On 4/6/20 3:49 PM, Angelo Ribeiro wrote: > >>> Add support for the video pattern generator (VPG) BER pattern mode and > >>> configuration in runtime. > >>> > >>> This enables using the debugfs interface to manipulate the VPG after > >>> the pipeline is set. > >>> Also, enables the usage of the VPG BER pattern. > >>> > >>> Changes in v2: > >>> - Added VID_MODE_VPG_MODE > >>> - Solved incompatible return type on __get and __set > >>> > >>> Reported-by: kbuild test robot > >>> Reported-by: Adrian Pop > >>> Cc: Gustavo Pimentel > >>> Cc: Joao Pinto > >>> Cc: Jose Abreu > >>> Signed-off-by: Angelo Ribeiro > >>> --- > >>>drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 98 > >>> --- > >>>1 file changed, 90 insertions(+), 8 deletions(-) > >>> > >>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > >>> b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > >>> index b18351b..9de3645 100644 > >>> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > >>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > >>> @@ -91,6 +91,7 @@ > >>>#define VID_MODE_TYPE_BURST0x2 > >>>#define VID_MODE_TYPE_MASK 0x3 > >>>#define VID_MODE_VPG_ENABLEBIT(16) > >>> +#define VID_MODE_VPG_MODEBIT(20) > >>>#define VID_MODE_VPG_HORIZONTALBIT(24) > >>> > >>>#define DSI_VID_PKT_SIZE 0x3c > >>> @@ -221,6 +222,21 @@ > >>>#define PHY_STATUS_TIMEOUT_US 1 > >>>#define CMD_PKT_STATUS_TIMEOUT_US 2 > >>> > >>> +#ifdef CONFIG_DEBUG_FS > >>> +#define VPG_DEFS(name, dsi) \ > >>> + ((void __force *)&((*dsi).vpg_defs.name)) > >>> + > >>> +#define REGISTER(name, mask, dsi) \ > >>> + { #name, VPG_DEFS(name, dsi), mask, dsi } > >>> + > >>> +struct debugfs_entries { > >>> + const char *name; > >>> + bool*reg; > >>> + u32 mask; > >>> + struct dw_mipi_dsi *dsi; > >>> +}; > >>> +#endif /* CONFIG_DEBUG_FS */ > >>> + > >>>struct dw_mipi_dsi { > >>> struct drm_bridge bridge; > >>> struct mipi_dsi_host dsi_host; > >>> @@ -238,9 +254,12 @@ struct dw_mipi_dsi { > >>> > >>>#ifdef CONFIG_DEBUG_FS > >>> struct dentry *debugfs; > >>> - > >>> - bool vpg; > >>> - bool vpg_horizontal; > >>> + struct debugfs_entries *debugfs_vpg; > >>> + struct { > >>> + bool vpg; > >>> + bool vpg_horizontal; > >>> + bool vpg_ber_pattern; > >>> + } vpg_defs; > >>>#endif /* CONFIG_DEBUG_FS */ > >>> > >>> struct dw_mipi_dsi *master; /* dual-dsi master ptr */ > >>> @@ -530,9 +549,11 @@ static void dw_mipi_dsi_video_mode_config(struct > >>> dw_mipi_dsi *dsi) > >>> val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS; > >>> > >>>#ifdef CONFIG_DEBUG_FS > >>> - if (dsi->vpg) { > >>> + if (dsi->vpg_defs.vpg) { > >>> val |= VID_MODE_VPG_ENABLE; > >>> - val |= dsi->vpg_horizontal ? VID_MODE_VPG_HOR
RE: [PATCH v2] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs
Hi, Is this patch good to go? @dan...@ffwll.ch, @Philippe CORNU Was already tested by @Yannick FERTRE and @Adrian Pop on https://lkml.org/lkml/2020/4/6/691 . Thanks, Angelo From: Yannick FERTRE Date: Wed, Jun 24, 2020 at 16:35:04 > Hello Angelo, > thanks for the patch. > Tested-by: Yannick Fertre > Tested OK on STM32MP1-DISCO, DSI v1.31 > > Best regards > > > On 4/6/20 3:49 PM, Angelo Ribeiro wrote: > > Add support for the video pattern generator (VPG) BER pattern mode and > > configuration in runtime. > > > > This enables using the debugfs interface to manipulate the VPG after > > the pipeline is set. > > Also, enables the usage of the VPG BER pattern. > > > > Changes in v2: > >- Added VID_MODE_VPG_MODE > >- Solved incompatible return type on __get and __set > > > > Reported-by: kbuild test robot > > Reported-by: Adrian Pop > > Cc: Gustavo Pimentel > > Cc: Joao Pinto > > Cc: Jose Abreu > > Signed-off-by: Angelo Ribeiro > > --- > > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 98 > > --- > > 1 file changed, 90 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > > b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > > index b18351b..9de3645 100644 > > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > > @@ -91,6 +91,7 @@ > > #define VID_MODE_TYPE_BURST 0x2 > > #define VID_MODE_TYPE_MASK0x3 > > #define VID_MODE_VPG_ENABLE BIT(16) > > +#define VID_MODE_VPG_MODE BIT(20) > > #define VID_MODE_VPG_HORIZONTAL BIT(24) > > > > #define DSI_VID_PKT_SIZE 0x3c > > @@ -221,6 +222,21 @@ > > #define PHY_STATUS_TIMEOUT_US 1 > > #define CMD_PKT_STATUS_TIMEOUT_US 2 > > > > +#ifdef CONFIG_DEBUG_FS > > +#define VPG_DEFS(name, dsi) \ > > + ((void __force *)&((*dsi).vpg_defs.name)) > > + > > +#define REGISTER(name, mask, dsi) \ > > + { #name, VPG_DEFS(name, dsi), mask, dsi } > > + > > +struct debugfs_entries { > > + const char *name; > > + bool*reg; > > + u32 mask; > > + struct dw_mipi_dsi *dsi; > > +}; > > +#endif /* CONFIG_DEBUG_FS */ > > + > > struct dw_mipi_dsi { > > struct drm_bridge bridge; > > struct mipi_dsi_host dsi_host; > > @@ -238,9 +254,12 @@ struct dw_mipi_dsi { > > > > #ifdef CONFIG_DEBUG_FS > > struct dentry *debugfs; > > - > > - bool vpg; > > - bool vpg_horizontal; > > + struct debugfs_entries *debugfs_vpg; > > + struct { > > + bool vpg; > > + bool vpg_horizontal; > > + bool vpg_ber_pattern; > > + } vpg_defs; > > #endif /* CONFIG_DEBUG_FS */ > > > > struct dw_mipi_dsi *master; /* dual-dsi master ptr */ > > @@ -530,9 +549,11 @@ static void dw_mipi_dsi_video_mode_config(struct > > dw_mipi_dsi *dsi) > > val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS; > > > > #ifdef CONFIG_DEBUG_FS > > - if (dsi->vpg) { > > + if (dsi->vpg_defs.vpg) { > > val |= VID_MODE_VPG_ENABLE; > > - val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0; > > + val |= dsi->vpg_defs.vpg_horizontal ? > > + VID_MODE_VPG_HORIZONTAL : 0; > > + val |= dsi->vpg_defs.vpg_ber_pattern ? VID_MODE_VPG_MODE : 0; > > } > > #endif /* CONFIG_DEBUG_FS */ > > > > @@ -961,6 +982,68 @@ static const struct drm_bridge_funcs > > dw_mipi_dsi_bridge_funcs = { > > > > #ifdef CONFIG_DEBUG_FS > > > > +int dw_mipi_dsi_debugfs_write(void *data, u64 val) > > +{ > > + struct debugfs_entries *vpg = data; > > + struct dw_mipi_dsi *dsi; > > + u32 mode_cfg; > > + > > + if (!vpg) > > + return -ENODEV; > > + > > + dsi = vpg->dsi; > > + > > + *vpg->reg = (bool)val; > > + > > + mode_cfg = dsi_read(dsi, DSI_VID_MODE_CFG); > > + > > + if (*vpg->reg) > > + mode_cfg |= vpg->mask; > > + else > > + mode_cfg &= ~vpg->mask; > > + > > + dsi_write(dsi, DSI_VID_MODE_CFG, mode_cfg); > > + > > + return 0; > > +}
RE: [PATCH v3 3/4] drm: ipk: Add extensions for DW MIPI DSI Host driver
From: Daniel Vetter Date: Tue, Apr 28, 2020 at 16:28:15 > On Mon, Apr 27, 2020 at 04:00:35PM +0200, Angelo Ribeiro wrote: > > Add Synopsys DesignWare IPK specific extensions for Synopsys DesignWare > > MIPI DSI Host driver. > > > > Cc: Maarten Lankhorst > > Cc: Maxime Ripard > > Cc: David Airlie > > Cc: Daniel Vetter > > Cc: Sam Ravnborg > > Cc: Gustavo Pimentel > > Cc: Joao Pinto > > Signed-off-by: Angelo Ribeiro > > I've dumped this on a pile of bridge drivers by now, but I don't think the > dw-mipi-dsi organization makes much sense. > > I think what we'd need is: > > - drm_encoder is handled by the drm_device driver, not by dw-mipi-dsi > drm_bridge driver > > - the glue code for the various soc specific implementations (like ipk > here) should be put behind the drm_bridge abstraction. Otherwise I'm not > really seeing why exactly dw-mipi-dsi is a bridge driver if it doesn't > work like a bridge driver > > - Probably we should put all these files into drm/bridge/dw-mipi-dsi/ > > - drm_device drivers should get at their bridges with one of the standard > of helpers we have in drm_bridge, not by directly calling into a bridge > drivers. > > I know that dw-hdmi is using the exact same code pattern, but we got to > stop this eventually or it becomes an unfixable mess. > -Daniel Hi Daniel, Sorry for the late answer. I understand what you stated and the conversion of this driver in a help library could be a good solution since you can use the DSI as bridge or as encoder, as your pipeline requires. Also most of the code implemented by each glue is essential PHY related, the development of a PHY driver could make this more clear. However, this needs a lot of work and consensus. Do you think that we can go ahead with this driver and do the rework later? I'm available and interested to help on this rework. Thanks, Angelo > > > --- > > Changes since v3: > > - Rearranged headers. > > --- > > drivers/gpu/drm/ipk/Kconfig | 9 + > > drivers/gpu/drm/ipk/Makefile | 2 + > > drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c | 557 > > ++ > > 3 files changed, 568 insertions(+) > > create mode 100644 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c > > > > diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig > > index 1f87444..49819e5 100644 > > --- a/drivers/gpu/drm/ipk/Kconfig > > +++ b/drivers/gpu/drm/ipk/Kconfig > > @@ -11,3 +11,12 @@ config DRM_IPK > > Enable support for the Synopsys DesignWare DRM DSI. > > To compile this driver as a module, choose M here: the module > > will be called ipk-drm. > > + > > +config DRM_IPK_DSI > > + tristate "Synopsys DesignWare IPK specific extensions for MIPI DSI" > > + depends on DRM_IPK > > + select DRM_DW_MIPI_DSI > > + help > > + Choose this option for Synopsys DesignWare IPK MIPI DSI support. > > + To compile this driver as a module, choose M here: the module > > + will be called dw-mipi-dsi-ipk. > > diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile > > index 6a1a911..f22d590 100644 > > --- a/drivers/gpu/drm/ipk/Makefile > > +++ b/drivers/gpu/drm/ipk/Makefile > > @@ -2,3 +2,5 @@ > > ipk-drm-y := dw-drv.o dw-vpg.o > > > > obj-$(CONFIG_DRM_IPK) += ipk-drm.o > > + > > +obj-$(CONFIG_DRM_IPK_DSI) += dw-mipi-dsi-ipk.o > > diff --git a/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c > > b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c > > new file mode 100644 > > index 000..f8ac4ca > > --- /dev/null > > +++ b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c > > @@ -0,0 +1,557 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates. > > + * Synopsys DesignWare MIPI DSI solution driver > > + * > > + * Author: Angelo Ribeiro > > + * Author: Luis Oliveira > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define DW_DPHY_LPCLK_CTRL 0x94 > > +#define DW_DPHY_RSTZ 0xA0 > > +#define DW_DPHY_IF_CFG 0xA4 > > +#define DW_DPHY_ULPS_CTRL 0xA8 > > +#define DW_DPHY_TX_TRIGGERS0xAC > > +#define DW_DPHY_STATUS 0xB0 > > +#define DW_DPHY_TST_CTRL0 0xB4 > > +#define DW_DPHY_TST_CTRL1 0xB8 > > +#defin
RE: [PATCH v3 4/4] MAINTAINERS: Add IPK MIPI DSI Host driver entry
From: Joe Perches Date: Mon, Apr 27, 2020 at 15:45:17 > On Mon, 2020-04-27 at 16:00 +0200, Angelo Ribeiro wrote: > > Creates entry for Synopsys DesignWare IPK DRM driver and > > adds myself as maintainer. > [] > > diff --git a/MAINTAINERS b/MAINTAINERS > [] > > @@ -5507,6 +5507,14 @@ T: git git://anongit.freedesktop.org/drm/drm-misc > > F: Documentation/devicetree/bindings/display/ste,mcde.txt > > F: drivers/gpu/drm/mcde/ > > > > +DRM DRIVER FOR SYNOPSYS DESIGNWARE IPK > > +M: Angelo Ribeiro > > +L: dri-devel@lists.freedesktop.org > > +S: Maintained > > +F: drivers/gpu/drm/ipk/ > > +F: Documentation/devicetree/bindings/display/ipk/ > > +T: git git://anongit.freedesktop.org/drm/drm-misc > > There is now a preferred order for the entries in a section. > > Please use: > > DRM DRIVER FOR SYNOPSYS DESIGNWARE IPK > M:Angelo Ribeiro > L:dri-devel@lists.freedesktop.org> > S:Maintained > T:git git://anongit.freedesktop.org/drm/drm-misc > F:Document > ation/devicetree/bindings/display/ipk/> > F:drivers/gpu/drm/ipk/ Hi Joe, Thanks for the review I will apply it. Angelo ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH v7 4/8] drm: imx: Add i.MX 6 MIPI DSI host platform driver
From: Daniel Vetter Date: Thu, Apr 30, 2020 at 14:58:41 > On Tue, Apr 28, 2020 at 10:08:04PM +0300, Adrian Ratiu wrote: > > Hi Daniel, > > > > On Tue, 28 Apr 2020, Daniel Vetter wrote: > > > On Wed, Apr 22, 2020 at 04:07:27AM +0300, Laurent Pinchart wrote: > > > > Hi Adrian, On Tue, Apr 21, 2020 at 07:16:06PM +0300, Adrian Ratiu > > > > wrote: > This adds support for the Synopsis DesignWare MIPI DSI > > > > v1.01 > host controller which is embedded in i.MX 6 SoCs. Based on > > > > > following patches, but updated/extended to work with existing > > > > > support found in the kernel: - drm: imx: Support Synopsys > > > > > DesignWare MIPI DSI host controller > Signed-off-by: Liu Ying > > > > > Cc: Fabio Estevam > > > > Cc: Enric Balletbo > Serra Reviewed-by: Emil > > > > Velikov > Tested-by: Adrian Pop > > > > > Tested-by: Arnaud Ferraris > > > > > Signed-off-by: Sjoerd Simons > > > > > Signed-off-by: Martyn Welch > > > > > Signed-off-by: Adrian Ratiu > > > > > --- Changes since v6: > - Replaced > > > > custom noop encoder with the simple drm encoder > (Enric) - Added > > > > CONFIG_DRM_IMX6_MIPI_DSI depends on > CONFIG_OF (Enric) - Dropped > > > > imx_mipi_dsi_register() because > now it only creates the dummy > > > > encoder which can easily be > done directly in imx_dsi_bind() > > > > > Changes since v5: > - Reword to remove unrelated device tree patch > > > > mention > (Fabio) - Move pllref_clk enable/disable to bind/unbind > > > > > (Ezequiel) - Fix freescale.com -> nxp.com email addresses > > > > > (Fabio) - Also added myself as module author (Fabio) - Use > > > > > DRM_DEV_* macros for consistency, print more error msg > Changes > > > > since v4: > - Split off driver-specific configuration of phy > > > > timings > due to new upstream API. - Move regmap infrastructure > > > > > logic to separate commit (Ezequiel) - Move dsi v1.01 layout > > > > > addition to a separate commit (Ezequiel) - Minor warnings > and > > > > driver name fixes > Changes since v3: > - Renamed platform driver > > > > to reflect it's i.MX6 > only. (Fabio) > Changes since v2: > - > > > > Fixed commit tags. (Emil) > Changes since v1: > - Moved register > > > > definitions & regmap initialization into > bridge module. Platform > > > > drivers get the regmap via > plat_data after calling the bridge > > > > probe. (Emil) > --- > drivers/gpu/drm/imx/Kconfig| 8 > > > > + > drivers/gpu/drm/imx/Makefile | 1 + > > > > > drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c | 391 > > > > > + 3 files changed, 400 insertions(+) > > > > > create mode 100644 drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c > diff > > > > --git a/drivers/gpu/drm/imx/Kconfig > b/drivers/gpu/drm/imx/Kconfig > > > > index > 207bf7409dfba..0dffc72df7922 100644 --- > > > > > a/drivers/gpu/drm/imx/Kconfig +++ > b/drivers/gpu/drm/imx/Kconfig @@ > > > > -39,3 +39,11 @@ config > DRM_IMX_HDMI > depends on DRM_IMX help > > > > Choose this if you want to use > HDMI on i.MX6. > + +config > > > > DRM_IMX6_MIPI_DSI + tristate "Freescale i.MX6 > DRM MIPI DSI" > > > > + select DRM_DW_MIPI_DSI +depends on > DRM_IMX + depends > > > > on OF > > > > + help +Choose this if you want > to use MIPI DSI on i.MX6. > > > > diff > > > > --git > a/drivers/gpu/drm/imx/Makefile > > > > b/drivers/gpu/drm/imx/Makefile > index 21cdcc2faabc8..9a7843c593478 > > > > 100644 --- > a/drivers/gpu/drm/imx/Makefile +++ > > > > > b/drivers/gpu/drm/imx/Makefile @@ -9,3 +9,4 @@ > > > > > obj-$(CONFIG_DRM_IMX_TVE) += imx-tve.o > obj-$(CONFIG_DRM_IMX_LDB) > > > > += imx-ldb.o > obj-$(CONFIG_DRM_IMX_HDMI) += dw_hdmi-imx.o > > > > > +obj-$(CONFIG_DRM_IMX6_MIPI_DSI) += dw_mipi_dsi-imx6.o diff > --git > > > > a/drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c > > > > > b/drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c new file mode 100644 > > > > > index 0..f8a0a4fe16e21 --- /dev/null +++ > > > > > b/drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c @@ -0,0 +1,391 @@ > +// > > > > SPDX-License-Identifier: GPL-2.0+ +/* + * i.MX6 drm > driver - MIPI > > > > DSI Host Controller + * + * Copyright (C) > 2011-2015 Freescale > > > > Semiconductor, Inc. + * Copyright (C) > 2019-2020 Collabora, Ltd. > > > > + */ + +#include > +#include > > > > +#include > +#include > > > > +#include > > > > > +#include +#include > +#include > > > > +#include > +#include > > > > > +#include +#include > > > > > +#include + +#include "imx-drm.h" > > > > + > +#define DSI_PWR_UP 0x04 +#define > RESET > > > > 0 +#define > > > > POWERUP > BIT(0) + +#define DSI_PHY_IF_CTRL 0x5c > > > > > +#define > > > > PHY_IF_CTRL_RESET 0x0 + +#define > DSI_PHY_TST_CTRL0 > > > > 0x64 +#define > > > > PHY_TESTCLK > BIT(1) +#define PHY_UNTESTCLK 0 > > > > +#define > > > > > PHY_TESTCLR BIT(0) +#define >
[PATCH v3 0/4] drm: Add support for IPK DSI Host Driver
Adds support for the display subsystem in the Synopsys DesignWare IPK devices. The display pipeline is limited and does not have access to memory, the validation is done using a VPG (Video Pattern Generator), as DPI stimulus for the DW MIPI DSI Host. A Synopsys DesignWare MIPI DSI Host v1.40 is used in the IPK device, that so far, is fully compatible with the driver dw-mipi-dsi. To activate the VPG use the sysfs pattern variable, assigning values from 0 (shutdown) to 4. The usage of the VPG and the Synopsys DesignWare MIPI DSI Host internal video generator is mutually exclusive. The submission of this driver aims to be used as a work base for the submission of enhancements over the Synopsys DesignWare MIPI DSI Host. Angelo Ribeiro (4): dt-bindings: display: Add IPK DSI subsystem bindings drm: ipk: Add DRM driver for DesignWare IPK DSI drm: ipk: Add extensions for DW MIPI DSI Host driver MAINTAINERS: Add IPK MIPI DSI Host driver entry .../bindings/display/snps,dw-ipk-dsi.yaml | 159 ++ .../bindings/display/snps,dw-ipk-vpg.yaml | 73 +++ MAINTAINERS| 8 + drivers/gpu/drm/Kconfig| 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/ipk/Kconfig| 22 + drivers/gpu/drm/ipk/Makefile | 6 + drivers/gpu/drm/ipk/dw-drv.c | 169 +++ drivers/gpu/drm/ipk/dw-ipk.h | 26 + drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c | 557 + drivers/gpu/drm/ipk/dw-vpg.c | 412 +++ drivers/gpu/drm/ipk/dw-vpg.h | 48 ++ 12 files changed, 1483 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-vpg.yaml create mode 100644 drivers/gpu/drm/ipk/Kconfig create mode 100644 drivers/gpu/drm/ipk/Makefile create mode 100644 drivers/gpu/drm/ipk/dw-drv.c create mode 100644 drivers/gpu/drm/ipk/dw-ipk.h create mode 100644 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c create mode 100644 drivers/gpu/drm/ipk/dw-vpg.c create mode 100644 drivers/gpu/drm/ipk/dw-vpg.h -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 1/4] dt-bindings: display: Add IPK DSI subsystem bindings
Add dt-bindings for Synopsys DesignWare MIPI DSI Host and VPG (Video Pattern Generator) support in the IPK display subsystem. The Synopsys DesignWare IPK display video pipeline is composed by a DSI controller (snps,dw-ipk-dsi) and a VPG (snps,dw-ipk-vpg) as DPI stimulus. Typically is used the Raspberry Pi (raspberrypi,7inch-touchscreen-panel) as DSI panel that requires a I2C controller (snps,designware-i2c). Reported-by: Rob Herring Cc: David Airlie Cc: Daniel Vetter Cc: Sam Ravnborg Cc: Rob Herring Cc: Mark Rutland Cc: Gustavo Pimentel Cc: Joao Pinto Signed-off-by: Angelo Ribeiro --- Changes since v3: - Fixed dt-binding breaking on `make dt_binding_check`. Changes since v2: - Fixed dt-bindings issues, see https://patchwork.ozlabs.org/patch/1260819/. --- .../bindings/display/snps,dw-ipk-dsi.yaml | 159 + .../bindings/display/snps,dw-ipk-vpg.yaml | 73 ++ 2 files changed, 232 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-vpg.yaml diff --git a/Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml b/Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml new file mode 100644 index 000..af4b775 --- /dev/null +++ b/Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml @@ -0,0 +1,159 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/snps,dw-ipk-dsi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys DesignWare IPK specific extensions for the Synopsys DSI host + controller. + +maintainers: + - Angelo Ribeiro + +description: | + The Synopsys DesignWare IPK DSI controller uses the Synopsys DesignWare MIPI + DSI host controller. + For more info refer to + Documentation/devicetree/bindings/display/bridge/dw_mipi_dsi.txt. + +properties: + '#address-cells': +const: 1 + + '#size-cells': +const: 0 + + compatible: +items: + - const: snps,dw-ipk-dsi + - const: snps,dw-mipi-dsi + + reg: +items: + - description: DW MIPI DSI Host registers + - description: DW MIPI DSI Phy test-chip registers +minItems: 2 + + reg-names: +items: + - const: dsi + - const: phy +minItems: 2 + + clocks: +items: + - description: Peripheral clock + - description: PLL clock + - description: Pixel clock +minItems: 2 + + clock-names: +items: + - const: pclk + - const: ref + - const: px_clk +minItems: 2 + + resets: +items: + - description: APB reset line +minItems: 1 + + reset-names: +items: + - const: apb +minItems: 1 + + ports: +type: object +description: | + A port node containging a DSI input and outuput port nodes as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt and + Documentation/devicetree/bindings/graph.txt. +properties: + port@0: +type: object +description: Input endpoint of the controller, connects to a DPI source. + + port@1: +type: object +description: Output endpoint of the controller, connects to a panel or + a bridge input port. + +required: + - port@0 + - port@1 + +additionalProperties: false + +required: + - "#address-cells" + - "#size-cells" + - compatible + - reg + - reg-names + - clocks + - clock-names + - resets + - reset-names + - ports + +examples: + - | +dsi1: dw-ipk-dsi@2000 { +compatible = "snps,dw-ipk-dsi"; +reg = <0x02000 0xfff>, <0x05000 0xfff>; +reg-names = "dsi", "phy"; +clocks = <_clk>, <_clk>; +clock-names = "pclk", "ref"; +resets = <_rst 1>; +reset-names = "apb"; + +#address-cells = <1>; +#size-cells = <0>; + +ports { +#address-cells = <1>; +#size-cells = <0>; + +port@0 { +reg = <0>; +dsi1_in: endpoint { +remote-endpoint = <_out>; +}; +}; + +port@1 { +reg = <1>; +dsi_out_port: endpoint { +remote-endpoint = <_dsi_port>; +}; +}; +}; +}; + +i2c: i2c@1000 { +compatible = "snps,designware-i2c"; +reg = <0x01000 0x100>; +clock-frequency = <40>; +clocks = <>; +interrupts = <0>; +resets = <_rst 0>; +reset-names = "i2c"; + +#address-cells = <1>; +#size-cells = <0>; + +
[PATCH v3 4/4] MAINTAINERS: Add IPK MIPI DSI Host driver entry
Creates entry for Synopsys DesignWare IPK DRM driver and adds myself as maintainer. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: Sam Ravnborg Cc: Gustavo Pimentel Cc: Joao Pinto Signed-off-by: Angelo Ribeiro --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index ad29107..9f4ee9c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5507,6 +5507,14 @@ T: git git://anongit.freedesktop.org/drm/drm-misc F: Documentation/devicetree/bindings/display/ste,mcde.txt F: drivers/gpu/drm/mcde/ +DRM DRIVER FOR SYNOPSYS DESIGNWARE IPK +M: Angelo Ribeiro +L: dri-devel@lists.freedesktop.org +S: Maintained +F: drivers/gpu/drm/ipk/ +F: Documentation/devicetree/bindings/display/ipk/ +T: git git://anongit.freedesktop.org/drm/drm-misc + DRM DRIVER FOR TDFX VIDEO CARDS S: Orphan / Obsolete F: drivers/gpu/drm/tdfx/ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 3/4] drm: ipk: Add extensions for DW MIPI DSI Host driver
Add Synopsys DesignWare IPK specific extensions for Synopsys DesignWare MIPI DSI Host driver. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: Sam Ravnborg Cc: Gustavo Pimentel Cc: Joao Pinto Signed-off-by: Angelo Ribeiro --- Changes since v3: - Rearranged headers. --- drivers/gpu/drm/ipk/Kconfig | 9 + drivers/gpu/drm/ipk/Makefile | 2 + drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c | 557 ++ 3 files changed, 568 insertions(+) create mode 100644 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig index 1f87444..49819e5 100644 --- a/drivers/gpu/drm/ipk/Kconfig +++ b/drivers/gpu/drm/ipk/Kconfig @@ -11,3 +11,12 @@ config DRM_IPK Enable support for the Synopsys DesignWare DRM DSI. To compile this driver as a module, choose M here: the module will be called ipk-drm. + +config DRM_IPK_DSI + tristate "Synopsys DesignWare IPK specific extensions for MIPI DSI" + depends on DRM_IPK + select DRM_DW_MIPI_DSI + help + Choose this option for Synopsys DesignWare IPK MIPI DSI support. + To compile this driver as a module, choose M here: the module + will be called dw-mipi-dsi-ipk. diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile index 6a1a911..f22d590 100644 --- a/drivers/gpu/drm/ipk/Makefile +++ b/drivers/gpu/drm/ipk/Makefile @@ -2,3 +2,5 @@ ipk-drm-y := dw-drv.o dw-vpg.o obj-$(CONFIG_DRM_IPK) += ipk-drm.o + +obj-$(CONFIG_DRM_IPK_DSI) += dw-mipi-dsi-ipk.o diff --git a/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c new file mode 100644 index 000..f8ac4ca --- /dev/null +++ b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c @@ -0,0 +1,557 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates. + * Synopsys DesignWare MIPI DSI solution driver + * + * Author: Angelo Ribeiro + * Author: Luis Oliveira + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#define DW_DPHY_LPCLK_CTRL 0x94 +#define DW_DPHY_RSTZ 0xA0 +#define DW_DPHY_IF_CFG 0xA4 +#define DW_DPHY_ULPS_CTRL 0xA8 +#define DW_DPHY_TX_TRIGGERS0xAC +#define DW_DPHY_STATUS 0xB0 +#define DW_DPHY_TST_CTRL0 0xB4 +#define DW_DPHY_TST_CTRL1 0xB8 +#define DW_GEN3_IF_TESTER 0x3c +#define DW_GEN3_IF_SOC_PLL 0x48 +#define DW_GEN3_IF_SOC_PLL_EN 0x4C + +#define DW_12BITS_DPHY_RDY_L0 0x507 +#define DW_12BITS_DPHY_RDY_L1 0x707 +#define DW_12BITS_DPHY_RDY_L2 0x907 +#define DW_12BITS_DPHY_RDY_L3 0xB07 + +#define DW_LANE_MIN_KBPS 8 +#define DW_LANE_MAX_KBPS 25 +#define DW_DPHY_DIV_UPPER_LIMIT8000 +#define DW_DPHY_DIV_LOWER_LIMIT2000 +#define DW_MIN_OUTPUT_FREQ 80 +#define DW_LPHS_TIM_TRANSIONS 0x40 + +enum dw_glueiftester { + GLUE_LOGIC = 0x4, + RX_PHY = 0x2, + TX_PHY = 0x1, + RESET = 0x0, +}; + +struct dw_range_dphy { + u32 freq; + u8 hs_freq_range; + u32 osc_freq_target; +} dw_range_gen3[] = { + { 80, 0x00, 0x3f }, { 90, 0x10, 0x3f }, { 100, 0x20, 0x3f }, + { 110, 0x30, 0x39 }, { 120, 0x01, 0x39 }, { 130, 0x11, 0x39 }, + { 140, 0x21, 0x39 }, { 150, 0x31, 0x39 }, { 160, 0x02, 0x39 }, + { 170, 0x12, 0x2f }, { 180, 0x22, 0x2f }, { 190, 0x32, 0x2f }, + { 205, 0x03, 0x2f }, { 220, 0x13, 0x29 }, { 235, 0x23, 0x29 }, + { 250, 0x33, 0x29 }, { 275, 0x04, 0x29 }, { 300, 0x14, 0x29 }, + { 325, 0x25, 0x29 }, { 350, 0x35, 0x1f }, { 400, 0x05, 0x1f }, + { 450, 0x16, 0x19 }, { 500, 0x26, 0x19 }, { 550, 0x37, 0x19 }, + { 600, 0x07, 0x19 }, { 650, 0x18, 0x19 }, { 700, 0x28, 0x0f }, + { 750, 0x39, 0x0f }, { 800, 0x09, 0x0f }, { 850, 0x19, 0x0f }, + { 900, 0x29, 0x09 }, { 950, 0x3a, 0x09 }, { 1000, 0x0a, 0x09 }, + { 1050, 0x1a, 0x09 }, { 1100, 0x2a, 0x09 }, { 1150, 0x3b, 0x09 }, + { 1200, 0x0b, 0x09 }, { 1250, 0x1b, 0x09 }, { 1300, 0x2b, 0x09 }, + { 1350, 0x3c, 0x03 }, { 1400, 0x0c, 0x03 }, { 1450, 0x1c, 0x03 }, + { 1500, 0x2c, 0x03 }, { 1550, 0x3d, 0x03 }, { 1600, 0x0d, 0x03 }, + { 1650, 0x1d, 0x03 }, { 1700, 0x2e, 0x03 }, { 1750, 0x3e, 0x03 }, + { 1800, 0x0e, 0x03 }, { 1850, 0x1e, 0x03 }, { 1900, 0x2f, 0x03 }, + { 1950, 0x3f, 0x03 }, { 2000, 0x0f, 0x03 }, { 2050, 0x40, 0x03 }, + { 2100, 0x41, 0x03 }, { 2150, 0x42, 0x03 }, { 2200, 0x43, 0x03 }, + { 2250, 0x44, 0x03 }, { 2300, 0x45, 0x01 }, { 2350, 0x46, 0x01 }, + { 2400, 0x47, 0x01 }, { 2450, 0x48, 0x01 }, { 2500, 0x49, 0x01 } +}; + +struct dw_dsi_ipk { + void __iomem *base; + void __iomem *base_phy; + struct clk *pllref_clk; + struct dw_mipi_dsi *dsi; + u32 lane_min_kbps; + u32 lane_max_kbps; + int range; +
[PATCH v3 2/4] drm: ipk: Add DRM driver for DesignWare IPK DSI
Add support for Synopsys DesignWare VPG (Video Pattern Generator) and DRM driver for Synopsys DesignWare DSI Host IPK solution. This patch has to be applied on top of Daniel Vetter's implementation - devm_drm_dev_alloc https://patchwork.freedesktop.org/patch/359897/ . Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: Sam Ravnborg Cc: Gustavo Pimentel Cc: Joao Pinto Signed-off-by: Angelo Ribeiro --- Changes since v3: - Changed Makefile to use '+=' instead of '\'. - Rearranged headers. - Replaced drm_mode_config_init by drmm_mode_config_init. - Droped DRM legacy functions. - Replaced DRM_xxx by drm_xxx. - Changed load function to devm_drm_dev_alloc. - Implemented pipeline as a drm_simple_display_pipe. --- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/ipk/Kconfig | 13 ++ drivers/gpu/drm/ipk/Makefile | 4 + drivers/gpu/drm/ipk/dw-drv.c | 169 ++ drivers/gpu/drm/ipk/dw-ipk.h | 26 +++ drivers/gpu/drm/ipk/dw-vpg.c | 412 +++ drivers/gpu/drm/ipk/dw-vpg.h | 48 + 8 files changed, 675 insertions(+) create mode 100644 drivers/gpu/drm/ipk/Kconfig create mode 100644 drivers/gpu/drm/ipk/Makefile create mode 100644 drivers/gpu/drm/ipk/dw-drv.c create mode 100644 drivers/gpu/drm/ipk/dw-ipk.h create mode 100644 drivers/gpu/drm/ipk/dw-vpg.c create mode 100644 drivers/gpu/drm/ipk/dw-vpg.h diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 4359497..29ea1d1 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -388,6 +388,8 @@ source "drivers/gpu/drm/mcde/Kconfig" source "drivers/gpu/drm/tidss/Kconfig" +source "drivers/gpu/drm/ipk/Kconfig" + # Keep legacy drivers last menuconfig DRM_LEGACY diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index f34d08c..b15f2ea 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -124,3 +124,4 @@ obj-$(CONFIG_DRM_PANFROST) += panfrost/ obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/ obj-$(CONFIG_DRM_MCDE) += mcde/ obj-$(CONFIG_DRM_TIDSS) += tidss/ +obj-$(CONFIG_DRM_IPK) += ipk/ diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig new file mode 100644 index 000..1f87444 --- /dev/null +++ b/drivers/gpu/drm/ipk/Kconfig @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-only +config DRM_IPK + tristate "DRM Support for Synopsys DesignWare IPK DSI" + depends on DRM + select DRM_KMS_HELPER + select DRM_GEM_CMA_HELPER + select DRM_KMS_CMA_HELPER + select DRM_PANEL_BRIDGE + select VIDEOMODE_HELPERS + help + Enable support for the Synopsys DesignWare DRM DSI. + To compile this driver as a module, choose M here: the module + will be called ipk-drm. diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile new file mode 100644 index 000..6a1a911 --- /dev/null +++ b/drivers/gpu/drm/ipk/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only +ipk-drm-y := dw-drv.o dw-vpg.o + +obj-$(CONFIG_DRM_IPK) += ipk-drm.o diff --git a/drivers/gpu/drm/ipk/dw-drv.c b/drivers/gpu/drm/ipk/dw-drv.c new file mode 100644 index 000..5ff6cbf --- /dev/null +++ b/drivers/gpu/drm/ipk/dw-drv.c @@ -0,0 +1,169 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates. + * Synopsys DesignWare MIPI DSI DRM driver + * + * Author: Angelo Ribeiro + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "dw-ipk.h" +#include "dw-vpg.h" + +static const struct drm_mode_config_funcs dw_ipk_drm_modecfg_funcs = { + .fb_create = drm_gem_fb_create_with_dirty, + .atomic_check = drm_atomic_helper_check, + .atomic_commit = drm_atomic_helper_commit, +}; + +static int dw_ipk_load(struct drm_device *drm) +{ + int ret; + + ret = drmm_mode_config_init(drm); + if (ret) + return ret; + + drm->mode_config.min_width = 0; + drm->mode_config.min_height = 0; + + /* To handle orientation */ + drm->mode_config.max_width = 2048; + drm->mode_config.max_height = 2048; + + drm->mode_config.funcs = _ipk_drm_modecfg_funcs; + + /* TODO +* Optional framebuffer memory resources allocation +*/ + + ret = vpg_load(drm); + if (ret) + return ret; + + /* Calls all the crtc's, encoder's and connector's reset */ + drm_mode_config_reset(drm); + + return ret; +} + +static void dw_ipk_unload(struct drm_device *drm) +{ + drm_dbg(drm, "\n"); + vpg_unload(drm); +} + +DEFINE_DRM_GEM_CMA_FOPS(ipk_drm_driver_fops); + +static int dw_ipk_gem_cma_dumb_create(struct drm_file *file, + struct drm
RE: [PATCH v4] dt-bindings: display: dw_mipi_dsi.txt: convert to yaml
Hi Adrian, From: Adrian Ratiu Date: Thu, Apr 23, 2020 at 11:00:58 > This converts the Synopsis MIPI DSI binding documentation to yaml and > should be quite straightforward. I've added a missing ref clk and also > added Philippe as maintainer b/c he's the original txt author following > the algorithm provided in Message-ID 20200420175909.ga5...@ravnborg.org. > > Cc: Philippe CORNU > Cc: devicet...@vger.kernel.org > Suggested-by: Laurent Pinchart > Reviewed-by: Rob Herring > Signed-off-by: Adrian Ratiu > --- > Changes in v4: > - Dropped panel patternProperties (Rob) > > Changes in v3: > - Added ports property and its children which are required (Laurent) > - Sorted required list alphabetically > > Changes in v2: > - Removed unnecessary descriptions and maxItems (Rob) > - Changed maintainers entry / dropped Mark (Rob) > - Added dsi-controller.yaml ref (Rob) > --- > .../bindings/display/bridge/dw_mipi_dsi.txt | 32 - > .../display/bridge/snps,dw-mipi-dsi.yaml | 68 +++ > 2 files changed, 68 insertions(+), 32 deletions(-) > delete mode 100644 > Documentation/devicetree/bindings/display/bridge/dw_mipi_dsi.txt > create mode 100644 > Documentation/devicetree/bindings/display/bridge/snps,dw-mipi-dsi.yaml > > diff --git a/Documentation/devicetree/bindings/display/bridge/dw_mipi_dsi.txt > b/Documentation/devicetree/bindings/display/bridge/dw_mipi_dsi.txt > deleted file mode 100644 > index b13adf30b8d3b..0 > --- a/Documentation/devicetree/bindings/display/bridge/dw_mipi_dsi.txt > +++ /dev/null > @@ -1,32 +0,0 @@ > -Synopsys DesignWare MIPI DSI host controller > - > - > -This document defines device tree properties for the Synopsys DesignWare MIPI > -DSI host controller. It doesn't constitue a device tree binding specification > -by itself but is meant to be referenced by platform-specific device tree > -bindings. > - > -When referenced from platform device tree bindings the properties defined in > -this document are defined as follows. The platform device tree bindings are > -responsible for defining whether each optional property is used or not. > - > -- reg: Memory mapped base address and length of the DesignWare MIPI DSI > - host controller registers. (mandatory) > - > -- clocks: References to all the clocks specified in the clock-names property > - as specified in [1]. (mandatory) > - > -- clock-names: > - - "pclk" is the peripheral clock for either AHB and APB. (mandatory) > - - "px_clk" is the pixel clock for the DPI/RGB input. (optional) > - > -- resets: References to all the resets specified in the reset-names property > - as specified in [2]. (optional) > - > -- reset-names: string reset name, must be "apb" if used. (optional) > - > -- panel or bridge node: see [3]. (mandatory) > - > -[1] Documentation/devicetree/bindings/clock/clock-bindings.txt > -[2] Documentation/devicetree/bindings/reset/reset.txt > -[3] Documentation/devicetree/bindings/display/mipi-dsi-bus.txt > diff --git > a/Documentation/devicetree/bindings/display/bridge/snps,dw-mipi-dsi.yaml > b/Documentation/devicetree/bindings/display/bridge/snps,dw-mipi-dsi.yaml > new file mode 100644 > index 0..012aa8e7cb8cd > --- /dev/null > +++ b/Documentation/devicetree/bindings/display/bridge/snps,dw-mipi-dsi.yaml > @@ -0,0 +1,68 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: > https://urldefense.com/v3/__http://devicetree.org/schemas/display/bridge/snps,dw-mipi-dsi.yaml*__;Iw!!A4F2R9G_pg!Pn0TP0h4QkEcILgH_xBqMjSM4dJxlyU3iCvF4FSbmdQOSIV309ngWu8EKCpP901d$ > > +$schema: > https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!A4F2R9G_pg!Pn0TP0h4QkEcILgH_xBqMjSM4dJxlyU3iCvF4FSbmdQOSIV309ngWu8EKPfhyNgW$ > > + > +title: Synopsys DesignWare MIPI DSI host controller > + > +maintainers: > + - Philippe CORNU > + > +description: | > + This document defines device tree properties for the Synopsys DesignWare > MIPI > + DSI host controller. It doesn't constitue a device tree binding > specification > + by itself but is meant to be referenced by platform-specific device tree > + bindings. > + > + When referenced from platform device tree bindings the properties defined > in > + this document are defined as follows. The platform device tree bindings are > + responsible for defining whether each property is required or optional. > + > +allOf: > + - $ref: ../dsi-controller.yaml# > + > +properties: > + reg: > +maxItems: 1 > + > + clocks: > +items: > + - description: Module clock > + - description: DSI bus clock for either AHB and APB > + - description: Pixel clock for the DPI/RGB input > +minItems: 2 > + > + clock-names: > +items: > + - const: ref > + - const: pclk > + - const: px_clk > +minItems: 2 > + > + resets: > +maxItems: 1 > + > + reset-names: > +const: apb > + > + ports: > +type:
RE: [PATCH v2 2/4] drm: ipk: Add DRM driver for DesignWare IPK DSI
Hi Daniel, From: Daniel Vetter Date: Tue, Apr 07, 2020 at 09:13:33 > On Mon, Apr 06, 2020 at 03:24:12PM +0200, Angelo Ribeiro wrote: > > Add support for Synopsys DesignWare VPG (Video Pattern Generator) and > > DRM driver for Synopsys DesignWare DSI Host IPK solution. > > > > Cc: Maarten Lankhorst > > Cc: Maxime Ripard > > Cc: David Airlie > > Cc: Daniel Vetter > > Cc: Gustavo Pimentel > > Cc: Joao Pinto > > Signed-off-by: Angelo Ribeiro > > --- > > drivers/gpu/drm/Kconfig | 2 + > > drivers/gpu/drm/Makefile | 1 + > > drivers/gpu/drm/ipk/Kconfig | 13 + > > drivers/gpu/drm/ipk/Makefile | 6 + > > drivers/gpu/drm/ipk/dw-drv.c | 189 +++ > > drivers/gpu/drm/ipk/dw-ipk.h | 30 +++ > > drivers/gpu/drm/ipk/dw-vpg.c | 559 > > +++ > > drivers/gpu/drm/ipk/dw-vpg.h | 55 + > > 8 files changed, 855 insertions(+) > > create mode 100644 drivers/gpu/drm/ipk/Kconfig > > create mode 100644 drivers/gpu/drm/ipk/Makefile > > create mode 100644 drivers/gpu/drm/ipk/dw-drv.c > > create mode 100644 drivers/gpu/drm/ipk/dw-ipk.h > > create mode 100644 drivers/gpu/drm/ipk/dw-vpg.c > > create mode 100644 drivers/gpu/drm/ipk/dw-vpg.h > > > > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig > > index 4359497..29ea1d1 100644 > > --- a/drivers/gpu/drm/Kconfig > > +++ b/drivers/gpu/drm/Kconfig > > @@ -388,6 +388,8 @@ source "drivers/gpu/drm/mcde/Kconfig" > > > > source "drivers/gpu/drm/tidss/Kconfig" > > > > +source "drivers/gpu/drm/ipk/Kconfig" > > + > > # Keep legacy drivers last > > > > menuconfig DRM_LEGACY > > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile > > index 183c600..5bcc1c1 100644 > > --- a/drivers/gpu/drm/Makefile > > +++ b/drivers/gpu/drm/Makefile > > @@ -125,3 +125,4 @@ obj-$(CONFIG_DRM_PANFROST) += panfrost/ > > obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/ > > obj-$(CONFIG_DRM_MCDE) += mcde/ > > obj-$(CONFIG_DRM_TIDSS) += tidss/ > > +obj-$(CONFIG_DRM_IPK) += ipk/ > > diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig > > new file mode 100644 > > index 000..1f87444 > > --- /dev/null > > +++ b/drivers/gpu/drm/ipk/Kconfig > > @@ -0,0 +1,13 @@ > > +# SPDX-License-Identifier: GPL-2.0-only > > +config DRM_IPK > > + tristate "DRM Support for Synopsys DesignWare IPK DSI" > > + depends on DRM > > + select DRM_KMS_HELPER > > + select DRM_GEM_CMA_HELPER > > + select DRM_KMS_CMA_HELPER > > + select DRM_PANEL_BRIDGE > > + select VIDEOMODE_HELPERS > > + help > > + Enable support for the Synopsys DesignWare DRM DSI. > > + To compile this driver as a module, choose M here: the module > > + will be called ipk-drm. > > diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile > > new file mode 100644 > > index 000..51d2774 > > --- /dev/null > > +++ b/drivers/gpu/drm/ipk/Makefile > > @@ -0,0 +1,6 @@ > > +# SPDX-License-Identifier: GPL-2.0-only > > +ipk-drm-y := \ > > + dw-drv.o \ > > + dw-vpg.o > > + > > +obj-$(CONFIG_DRM_IPK) += ipk-drm.o > > diff --git a/drivers/gpu/drm/ipk/dw-drv.c b/drivers/gpu/drm/ipk/dw-drv.c > > new file mode 100644 > > index 000..6205f1c > > --- /dev/null > > +++ b/drivers/gpu/drm/ipk/dw-drv.c > > @@ -0,0 +1,189 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates. > > + * Synopsys DesignWare MIPI DSI DRM driver > > + * > > + * Author: Angelo Ribeiro > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include "dw-ipk.h" > > +#include "dw-vpg.h" > > + > > +static const struct drm_mode_config_funcs dw_ipk_drm_modecfg_funcs = { > > + .fb_create = drm_gem_fb_create_with_dirty, > > + .atomic_check = drm_atomic_helper_check, > > + .atomic_commit = drm_atomic_helper_commit, > > +}; > > + > > +static int dw_ipk_load(struct drm_device *drm) > > +{ > > + int ret; > > + > > + drm_mode_config_init(drm); > > + > > + drm->mode_config.min_width =
RE: [PATCH v2 3/4] drm: ipk: Add extensions for DW MIPI DSI Host driver
Hi Sam, Thanks for your revision Angelo From: Sam Ravnborg Date: Tue, Apr 07, 2020 at 18:51:59 > Hi Angelo. > > One nit below. > > Sam > > On Mon, Apr 06, 2020 at 03:24:13PM +0200, Angelo Ribeiro wrote: > > Add Synopsys DesignWare IPK specific extensions for Synopsys DesignWare > > MIPI DSI Host driver. > > > > Cc: Maarten Lankhorst > > Cc: Maxime Ripard > > Cc: David Airlie > > Cc: Daniel Vetter > > Cc: Gustavo Pimentel > > Cc: Joao Pinto > > Signed-off-by: Angelo Ribeiro > > --- > > drivers/gpu/drm/ipk/Kconfig | 9 + > > drivers/gpu/drm/ipk/Makefile | 2 + > > drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c | 556 > > ++ > > 3 files changed, 567 insertions(+) > > create mode 100644 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c > > > > diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig > > index 1f87444..49819e5 100644 > > --- a/drivers/gpu/drm/ipk/Kconfig > > +++ b/drivers/gpu/drm/ipk/Kconfig > > @@ -11,3 +11,12 @@ config DRM_IPK > > Enable support for the Synopsys DesignWare DRM DSI. > > To compile this driver as a module, choose M here: the module > > will be called ipk-drm. > > + > > +config DRM_IPK_DSI > > + tristate "Synopsys DesignWare IPK specific extensions for MIPI DSI" > > + depends on DRM_IPK > > + select DRM_DW_MIPI_DSI > > + help > > + Choose this option for Synopsys DesignWare IPK MIPI DSI support. > > + To compile this driver as a module, choose M here: the module > > + will be called dw-mipi-dsi-ipk. > > diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile > > index 51d2774..c80503f 100644 > > --- a/drivers/gpu/drm/ipk/Makefile > > +++ b/drivers/gpu/drm/ipk/Makefile > > @@ -4,3 +4,5 @@ ipk-drm-y := \ > > dw-vpg.o > > > > obj-$(CONFIG_DRM_IPK) += ipk-drm.o > > + > > +obj-$(CONFIG_DRM_IPK_DSI) += dw-mipi-dsi-ipk.o > > diff --git a/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c > > b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c > > new file mode 100644 > > index 000..070eccb > > --- /dev/null > > +++ b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c > > @@ -0,0 +1,556 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates. > > + * Synopsys DesignWare MIPI DSI solution driver > > + * > > + * Author: Angelo Ribeiro > > + * Author: Luis Oliveira > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > Same rant as in previous mail about include file. > > > Rest of the driver looked good while quickly browsing the code. > > Sam ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH v2] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs
Hi Adrian, > -Original Message- > From: Adrian Pop > Sent: Tuesday, April 7, 2020 7:58 AM > To: Angelo Ribeiro > Cc: yannick.fer...@st.com; philippe.co...@st.com; > benjamin.gaign...@st.com; airl...@linux.ie; Daniel Vetter > ; mcoquelin.st...@gmail.com; alexandre.tor...@st.com; > dri-devel@lists.freedesktop.org; linux-st...@st-md-mailman.stormreply.com; > linux-arm-ker...@lists.infradead.org; linux-ker...@vger.kernel.org; > Gustavo Pimentel ; Joao Pinto ; > Jose Abreu > Subject: Re: [PATCH v2] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config > through debugfs > > Tested-by: Adrian Pop > Tested OK on STM32F769i-DISCO, DSI v1.30, on next-20200406. > > On Mon, Apr 6, 2020 at 8:45 PM Adrian Pop wrote: > > > > Hello Angelo, > > > > Tested OK on STM32F769i-DISCO, DSI v1.30, on next-20200406. I guess > > there is no horizontal for BER. Yes, there is no horizontal for BER. Thank you for testing the patch. > > > > Regards, > > Adrian > > > > On Mon, Apr 6, 2020 at 4:49 PM Angelo Ribeiro > > wrote: > > > > > > Add support for the video pattern generator (VPG) BER pattern mode and > > > configuration in runtime. > > > > > > This enables using the debugfs interface to manipulate the VPG after > > > the pipeline is set. > > > Also, enables the usage of the VPG BER pattern. > > > > > > Changes in v2: > > > - Added VID_MODE_VPG_MODE > > > - Solved incompatible return type on __get and __set > > > > > > Reported-by: kbuild test robot > > > Reported-by: Adrian Pop > > > Cc: Gustavo Pimentel > > > Cc: Joao Pinto > > > Cc: Jose Abreu > > > Signed-off-by: Angelo Ribeiro > > > --- > > > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 98 > --- > > > 1 file changed, 90 insertions(+), 8 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > > > index b18351b..9de3645 100644 > > > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > > > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > > > @@ -91,6 +91,7 @@ > > > #define VID_MODE_TYPE_BURST0x2 > > > #define VID_MODE_TYPE_MASK 0x3 > > > #define VID_MODE_VPG_ENABLEBIT(16) > > > +#define VID_MODE_VPG_MODE BIT(20) > > > #define VID_MODE_VPG_HORIZONTALBIT(24) > > > > > > #define DSI_VID_PKT_SIZE 0x3c > > > @@ -221,6 +222,21 @@ > > > #define PHY_STATUS_TIMEOUT_US 1 > > > #define CMD_PKT_STATUS_TIMEOUT_US 2 > > > > > > +#ifdef CONFIG_DEBUG_FS > > > +#define VPG_DEFS(name, dsi) \ > > > + ((void __force *)&((*dsi).vpg_defs.name)) > > > + > > > +#define REGISTER(name, mask, dsi) \ > > > + { #name, VPG_DEFS(name, dsi), mask, dsi } > > > + > > > +struct debugfs_entries { > > > + const char *name; > > > + bool*reg; > > > + u32 mask; > > > + struct dw_mipi_dsi *dsi; > > > +}; > > > +#endif /* CONFIG_DEBUG_FS */ > > > + > > > struct dw_mipi_dsi { > > > struct drm_bridge bridge; > > > struct mipi_dsi_host dsi_host; > > > @@ -238,9 +254,12 @@ struct dw_mipi_dsi { > > > > > > #ifdef CONFIG_DEBUG_FS > > > struct dentry *debugfs; > > > - > > > - bool vpg; > > > - bool vpg_horizontal; > > > + struct debugfs_entries *debugfs_vpg; > > > + struct { > > > + bool vpg; > > > + bool vpg_horizontal; > > > + bool vpg_ber_pattern; > > > + } vpg_defs; > > > #endif /* CONFIG_DEBUG_FS */ > > > > > > struct dw_mipi_dsi *master; /* dual-dsi master ptr */ > > > @@ -530,9 +549,11 @@ static void dw_mipi_dsi_video_mode_config(struct > dw_mipi_dsi *dsi) > > > val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS; > > > > > > #ifdef CONFIG_DEBUG_FS > > > - if (dsi->vpg) { > > > + if (dsi->vpg_defs.vpg) { > > > val |= VID_MODE_VPG_ENABLE; > > > - val |= dsi->vpg_horizontal ? VID_MO
RE: [PATCH] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs
Hi Adrian, You are right! Thanks for the help, Angelo Ribeiro From: Adrian Pop Date: Sat, Apr 04, 2020 at 11:56:11 > Hello Angelo, > > I get a compile error: error: ‘VID_MODE_VPG_MODE’ undeclared. I am > quite new to the mailing list, maybe I misapplied the patch. > > Regards, > Adrian > > > On Fri, Apr 3, 2020 at 6:37 PM Angelo Ribeiro > wrote: > > > > Add support for the video pattern generator (VPG) BER pattern mode and > > configuration in runtime. > > > > This enables using the debugfs interface to manipulate the VPG after > > the pipeline is set. > > Also, enables the usage of the VPG BER pattern. > > > > Cc: Gustavo Pimentel > > Cc: Joao Pinto > > Cc: Jose Abreu > > Signed-off-by: Angelo Ribeiro > > --- > > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 97 > > --- > > 1 file changed, 89 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > > b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > > index b18351b..512c922 100644 > > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > > @@ -221,6 +221,21 @@ > > #define PHY_STATUS_TIMEOUT_US 1 > > #define CMD_PKT_STATUS_TIMEOUT_US 2 > > > > +#ifdef CONFIG_DEBUG_FS > > +#define VPG_DEFS(name, dsi) \ > > + ((void __force *)&((*dsi).vpg_defs.name)) > > + > > +#define REGISTER(name, mask, dsi) \ > > + { #name, VPG_DEFS(name, dsi), mask, dsi } > > + > > +struct debugfs_entries { > > + const char *name; > > + bool*reg; > > + u32 mask; > > + struct dw_mipi_dsi *dsi; > > +}; > > +#endif /* CONFIG_DEBUG_FS */ > > + > > struct dw_mipi_dsi { > > struct drm_bridge bridge; > > struct mipi_dsi_host dsi_host; > > @@ -238,9 +253,12 @@ struct dw_mipi_dsi { > > > > #ifdef CONFIG_DEBUG_FS > > struct dentry *debugfs; > > - > > - bool vpg; > > - bool vpg_horizontal; > > + struct debugfs_entries *debugfs_vpg; > > + struct { > > + bool vpg; > > + bool vpg_horizontal; > > + bool vpg_ber_pattern; > > + } vpg_defs; > > #endif /* CONFIG_DEBUG_FS */ > > > > struct dw_mipi_dsi *master; /* dual-dsi master ptr */ > > @@ -530,9 +548,11 @@ static void dw_mipi_dsi_video_mode_config(struct > > dw_mipi_dsi *dsi) > > val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS; > > > > #ifdef CONFIG_DEBUG_FS > > - if (dsi->vpg) { > > + if (dsi->vpg_defs.vpg) { > > val |= VID_MODE_VPG_ENABLE; > > - val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0; > > + val |= dsi->vpg_defs.vpg_horizontal ? > > + VID_MODE_VPG_HORIZONTAL : 0; > > + val |= dsi->vpg_defs.vpg_ber_pattern ? VID_MODE_VPG_MODE : > > 0; > > } > > #endif /* CONFIG_DEBUG_FS */ > > > > @@ -961,6 +981,68 @@ static const struct drm_bridge_funcs > > dw_mipi_dsi_bridge_funcs = { > > > > #ifdef CONFIG_DEBUG_FS > > > > +ssize_t dw_mipi_dsi_debugfs_write(void *data, u64 val) > > +{ > > + struct debugfs_entries *vpg = data; > > + struct dw_mipi_dsi *dsi; > > + u32 mode_cfg; > > + > > + if (!vpg) > > + return -ENODEV; > > + > > + dsi = vpg->dsi; > > + > > + *vpg->reg = (bool)val; > > + > > + mode_cfg = dsi_read(dsi, DSI_VID_MODE_CFG); > > + > > + if (*vpg->reg) > > + mode_cfg |= vpg->mask; > > + else > > + mode_cfg &= ~vpg->mask; > > + > > + dsi_write(dsi, DSI_VID_MODE_CFG, mode_cfg); > > + > > + return 0; > > +} > > + > > +ssize_t dw_mipi_dsi_debugfs_show(void *data, u64 *val) > > +{ > > + struct debugfs_entries *vpg = data; > > + > > + if (!vpg) > > + return -ENODEV; > > + > > + *val = *vpg->reg; > > + > > + return 0; > > +} > > + > > +DEFINE_DEBUGFS_ATTRIBUTE(fops_x32, dw_mipi_dsi_debugfs_show, > > +dw_mipi_dsi_debugfs_write, "%llu\n"); &g
[PATCH v2 2/4] drm: ipk: Add DRM driver for DesignWare IPK DSI
Add support for Synopsys DesignWare VPG (Video Pattern Generator) and DRM driver for Synopsys DesignWare DSI Host IPK solution. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: Gustavo Pimentel Cc: Joao Pinto Signed-off-by: Angelo Ribeiro --- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/ipk/Kconfig | 13 + drivers/gpu/drm/ipk/Makefile | 6 + drivers/gpu/drm/ipk/dw-drv.c | 189 +++ drivers/gpu/drm/ipk/dw-ipk.h | 30 +++ drivers/gpu/drm/ipk/dw-vpg.c | 559 +++ drivers/gpu/drm/ipk/dw-vpg.h | 55 + 8 files changed, 855 insertions(+) create mode 100644 drivers/gpu/drm/ipk/Kconfig create mode 100644 drivers/gpu/drm/ipk/Makefile create mode 100644 drivers/gpu/drm/ipk/dw-drv.c create mode 100644 drivers/gpu/drm/ipk/dw-ipk.h create mode 100644 drivers/gpu/drm/ipk/dw-vpg.c create mode 100644 drivers/gpu/drm/ipk/dw-vpg.h diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 4359497..29ea1d1 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -388,6 +388,8 @@ source "drivers/gpu/drm/mcde/Kconfig" source "drivers/gpu/drm/tidss/Kconfig" +source "drivers/gpu/drm/ipk/Kconfig" + # Keep legacy drivers last menuconfig DRM_LEGACY diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 183c600..5bcc1c1 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -125,3 +125,4 @@ obj-$(CONFIG_DRM_PANFROST) += panfrost/ obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/ obj-$(CONFIG_DRM_MCDE) += mcde/ obj-$(CONFIG_DRM_TIDSS) += tidss/ +obj-$(CONFIG_DRM_IPK) += ipk/ diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig new file mode 100644 index 000..1f87444 --- /dev/null +++ b/drivers/gpu/drm/ipk/Kconfig @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-only +config DRM_IPK + tristate "DRM Support for Synopsys DesignWare IPK DSI" + depends on DRM + select DRM_KMS_HELPER + select DRM_GEM_CMA_HELPER + select DRM_KMS_CMA_HELPER + select DRM_PANEL_BRIDGE + select VIDEOMODE_HELPERS + help + Enable support for the Synopsys DesignWare DRM DSI. + To compile this driver as a module, choose M here: the module + will be called ipk-drm. diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile new file mode 100644 index 000..51d2774 --- /dev/null +++ b/drivers/gpu/drm/ipk/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +ipk-drm-y := \ + dw-drv.o \ + dw-vpg.o + +obj-$(CONFIG_DRM_IPK) += ipk-drm.o diff --git a/drivers/gpu/drm/ipk/dw-drv.c b/drivers/gpu/drm/ipk/dw-drv.c new file mode 100644 index 000..6205f1c --- /dev/null +++ b/drivers/gpu/drm/ipk/dw-drv.c @@ -0,0 +1,189 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates. + * Synopsys DesignWare MIPI DSI DRM driver + * + * Author: Angelo Ribeiro + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dw-ipk.h" +#include "dw-vpg.h" + +static const struct drm_mode_config_funcs dw_ipk_drm_modecfg_funcs = { + .fb_create = drm_gem_fb_create_with_dirty, + .atomic_check = drm_atomic_helper_check, + .atomic_commit = drm_atomic_helper_commit, +}; + +static int dw_ipk_load(struct drm_device *drm) +{ + int ret; + + drm_mode_config_init(drm); + + drm->mode_config.min_width = 0; + drm->mode_config.min_height = 0; + + /* To handle orientation */ + drm->mode_config.max_width = 2048; + drm->mode_config.max_height = 2048; + + drm->mode_config.funcs = _ipk_drm_modecfg_funcs; + + /* TODO +* Optional framebuffer memory resources allocation +*/ + + ret = vpg_load(drm); + if (ret) + return ret; + + /* Calls all the crtc's, encoder's and connector's reset */ + drm_mode_config_reset(drm); + + /* Initialize and enable output polling */ + drm_kms_helper_poll_init(drm); + + return ret; +} + +static void dw_ipk_unload(struct drm_device *drm) +{ + DRM_DEBUG_DRIVER("\n"); + + drm_kms_helper_poll_fini(drm); + vpg_unload(drm); +} + +DEFINE_DRM_GEM_CMA_FOPS(ipk_drm_driver_fops); + +static int ipk_gem_cma_dumb_create(struct drm_file *file, + struct drm_device *dev, + struct drm_mode_create_dumb *args) +{ + unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8); + int err; + + /* +* In order to optimize data transfer, pitch is aligned on +* 128 bytes, height is aligned on 4 bytes +*/ + args->pitch = roundup(min_pitch, 128); +
[PATCH v2 0/4] drm: Add support for IPK DSI Host Driver
This patch series adds support for the display subsystem in the Synopsys DesignWare IPK devices. The display pipeline is limited and does not have access to memory, the validation is done using a VPG (Video Pattern Generator), as DPI stimulus for the DW MIPI DSI Host. A Synopsys DesignWare MIPI DSI Host v1.40 is used in the IPK device, that so far, is fully compatible with the driver dw-mipi-dsi. To activate the VPG use the sysfs pattern variable, assigning values from 0 (shutdown) to 4. The usage of the VPG and the Synopsys DesignWare MIPI DSI Host internal video generator is mutually exclusive. The submission of this driver aims to be used as a work base for the submission of enhancements over the Synopsys DesignWare MIPI DSI Host. Changes in v2: - Fixed dt-bindings issues, see https://patchwork.ozlabs.org/patch/1260819/. Angelo Ribeiro (4): dt-bindings: display: Add IPK DSI subsystem bindings drm: ipk: Add DRM driver for DesignWare IPK DSI drm: ipk: Add extensions for DW MIPI DSI Host driver MAINTAINERS: Add IPK MIPI DSI Host driver entry .../bindings/display/snps,dw-ipk-dsi.yaml | 162 ++ .../bindings/display/snps,dw-ipk-vpg.yaml | 75 +++ MAINTAINERS| 8 + drivers/gpu/drm/Kconfig| 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/ipk/Kconfig| 22 + drivers/gpu/drm/ipk/Makefile | 8 + drivers/gpu/drm/ipk/dw-drv.c | 189 +++ drivers/gpu/drm/ipk/dw-ipk.h | 30 ++ drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c | 556 drivers/gpu/drm/ipk/dw-vpg.c | 559 + drivers/gpu/drm/ipk/dw-vpg.h | 55 ++ 12 files changed, 1667 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-vpg.yaml create mode 100644 drivers/gpu/drm/ipk/Kconfig create mode 100644 drivers/gpu/drm/ipk/Makefile create mode 100644 drivers/gpu/drm/ipk/dw-drv.c create mode 100644 drivers/gpu/drm/ipk/dw-ipk.h create mode 100644 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c create mode 100644 drivers/gpu/drm/ipk/dw-vpg.c create mode 100644 drivers/gpu/drm/ipk/dw-vpg.h -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 3/4] drm: ipk: Add extensions for DW MIPI DSI Host driver
Add Synopsys DesignWare IPK specific extensions for Synopsys DesignWare MIPI DSI Host driver. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: Gustavo Pimentel Cc: Joao Pinto Signed-off-by: Angelo Ribeiro --- drivers/gpu/drm/ipk/Kconfig | 9 + drivers/gpu/drm/ipk/Makefile | 2 + drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c | 556 ++ 3 files changed, 567 insertions(+) create mode 100644 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig index 1f87444..49819e5 100644 --- a/drivers/gpu/drm/ipk/Kconfig +++ b/drivers/gpu/drm/ipk/Kconfig @@ -11,3 +11,12 @@ config DRM_IPK Enable support for the Synopsys DesignWare DRM DSI. To compile this driver as a module, choose M here: the module will be called ipk-drm. + +config DRM_IPK_DSI + tristate "Synopsys DesignWare IPK specific extensions for MIPI DSI" + depends on DRM_IPK + select DRM_DW_MIPI_DSI + help + Choose this option for Synopsys DesignWare IPK MIPI DSI support. + To compile this driver as a module, choose M here: the module + will be called dw-mipi-dsi-ipk. diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile index 51d2774..c80503f 100644 --- a/drivers/gpu/drm/ipk/Makefile +++ b/drivers/gpu/drm/ipk/Makefile @@ -4,3 +4,5 @@ ipk-drm-y := \ dw-vpg.o obj-$(CONFIG_DRM_IPK) += ipk-drm.o + +obj-$(CONFIG_DRM_IPK_DSI) += dw-mipi-dsi-ipk.o diff --git a/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c new file mode 100644 index 000..070eccb --- /dev/null +++ b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c @@ -0,0 +1,556 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates. + * Synopsys DesignWare MIPI DSI solution driver + * + * Author: Angelo Ribeiro + * Author: Luis Oliveira + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define DW_DPHY_LPCLK_CTRL 0x94 +#define DW_DPHY_RSTZ 0xA0 +#define DW_DPHY_IF_CFG 0xA4 +#define DW_DPHY_ULPS_CTRL 0xA8 +#define DW_DPHY_TX_TRIGGERS0xAC +#define DW_DPHY_STATUS 0xB0 +#define DW_DPHY_TST_CTRL0 0xB4 +#define DW_DPHY_TST_CTRL1 0xB8 +#define DW_GEN3_IF_TESTER 0x3c +#define DW_GEN3_IF_SOC_PLL 0x48 +#define DW_GEN3_IF_SOC_PLL_EN 0x4C + +#define DW_12BITS_DPHY_RDY_L0 0x507 +#define DW_12BITS_DPHY_RDY_L1 0x707 +#define DW_12BITS_DPHY_RDY_L2 0x907 +#define DW_12BITS_DPHY_RDY_L3 0xB07 + +#define DW_LANE_MIN_KBPS 8 +#define DW_LANE_MAX_KBPS 25 +#define DW_DPHY_DIV_UPPER_LIMIT8000 +#define DW_DPHY_DIV_LOWER_LIMIT2000 +#define DW_MIN_OUTPUT_FREQ 80 +#define DW_LPHS_TIM_TRANSIONS 0x40 + +enum dw_glueiftester { + GLUE_LOGIC = 0x4, + RX_PHY = 0x2, + TX_PHY = 0x1, + RESET = 0x0, +}; + +struct dw_range_dphy { + u32 freq; + u8 hs_freq_range; + u32 osc_freq_target; +} dw_range_gen3[] = { + { 80, 0x00, 0x3f }, { 90, 0x10, 0x3f }, { 100, 0x20, 0x3f }, + { 110, 0x30, 0x39 }, { 120, 0x01, 0x39 }, { 130, 0x11, 0x39 }, + { 140, 0x21, 0x39 }, { 150, 0x31, 0x39 }, { 160, 0x02, 0x39 }, + { 170, 0x12, 0x2f }, { 180, 0x22, 0x2f }, { 190, 0x32, 0x2f }, + { 205, 0x03, 0x2f }, { 220, 0x13, 0x29 }, { 235, 0x23, 0x29 }, + { 250, 0x33, 0x29 }, { 275, 0x04, 0x29 }, { 300, 0x14, 0x29 }, + { 325, 0x25, 0x29 }, { 350, 0x35, 0x1f }, { 400, 0x05, 0x1f }, + { 450, 0x16, 0x19 }, { 500, 0x26, 0x19 }, { 550, 0x37, 0x19 }, + { 600, 0x07, 0x19 }, { 650, 0x18, 0x19 }, { 700, 0x28, 0x0f }, + { 750, 0x39, 0x0f }, { 800, 0x09, 0x0f }, { 850, 0x19, 0x0f }, + { 900, 0x29, 0x09 }, { 950, 0x3a, 0x09 }, { 1000, 0x0a, 0x09 }, + { 1050, 0x1a, 0x09 }, { 1100, 0x2a, 0x09 }, { 1150, 0x3b, 0x09 }, + { 1200, 0x0b, 0x09 }, { 1250, 0x1b, 0x09 }, { 1300, 0x2b, 0x09 }, + { 1350, 0x3c, 0x03 }, { 1400, 0x0c, 0x03 }, { 1450, 0x1c, 0x03 }, + { 1500, 0x2c, 0x03 }, { 1550, 0x3d, 0x03 }, { 1600, 0x0d, 0x03 }, + { 1650, 0x1d, 0x03 }, { 1700, 0x2e, 0x03 }, { 1750, 0x3e, 0x03 }, + { 1800, 0x0e, 0x03 }, { 1850, 0x1e, 0x03 }, { 1900, 0x2f, 0x03 }, + { 1950, 0x3f, 0x03 }, { 2000, 0x0f, 0x03 }, { 2050, 0x40, 0x03 }, + { 2100, 0x41, 0x03 }, { 2150, 0x42, 0x03 }, { 2200, 0x43, 0x03 }, + { 2250, 0x44, 0x03 }, { 2300, 0x45, 0x01 }, { 2350, 0x46, 0x01 }, + { 2400, 0x47, 0x01 }, { 2450, 0x48, 0x01 }, { 2500, 0x49, 0x01 } +}; + +struct dw_dsi_ipk { + void __iomem *base; + void __iomem *base_phy; + struct clk *pllref_clk; + struct dw_mipi_dsi *dsi; + u32 lane_min_kbps; + u32 lane_max_kbps; + int range; + int in_div; + int loop_div; +}; + +#define dw_mipi_dsi_to_dw_dsi_
[PATCH v2 1/4] dt-bindings: display: Add IPK DSI subsystem bindings
Add dt-bindings for Synopsys DesignWare MIPI DSI Host and VPG (Video Pattern Generator) support in the IPK display subsystem. The Synopsys DesignWare IPK display video pipeline is composed by a DSI controller (snps,dw-ipk-dsi) and a VPG (snps,dw-ipk-vpg) as DPI stimulus. Typically is used the Raspberry Pi (raspberrypi,7inch-touchscreen-panel) as DSI panel that requires a I2C controller (snps,designware-i2c). Reported-by: Rob Herring Cc: David Airlie Cc: Daniel Vetter Cc: Rob Herring Cc: Mark Rutland Cc: Gustavo Pimentel Cc: Joao Pinto Signed-off-by: Angelo Ribeiro --- .../bindings/display/snps,dw-ipk-dsi.yaml | 162 + .../bindings/display/snps,dw-ipk-vpg.yaml | 75 ++ 2 files changed, 237 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-vpg.yaml diff --git a/Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml b/Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml new file mode 100644 index 000..92b313c --- /dev/null +++ b/Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml @@ -0,0 +1,162 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/snps,dw-ipk-dsi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys DesignWare IPK specific extensions for the Synopsys DSI host + controller. + +maintainers: + - Angelo Ribeiro + +description: + The Synopsys DesignWare IPK DSI controller uses the Synopsys DesignWare MIPI + DSI host controller. + For more info please refer to + Documentation/devicetree/bindings/display/bridge/dw_mipi_dsi.txt. + +properties: + compatible: +const: snps,dw-ipk-dsi + + reg: +minItems: 2 +items: + - description: DW MIPI DSI Host registers + - description: DW Phy registers + + reg-names: +items: + - const: dsi + - const: phy + + clocks: +minItems: 2 +maxItems: 3 +items: + - description: Peripheral clock + - description: PLL clock + - description: Pixel clock + + clock-names: +items: + - const: pclk + - const: ref + - const: px_clk + + resets: +minItems: 1 +items: + - description: APB reset line + + reset-names: +items: + - const: apb + + ports: +type: object +description: + A port node as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt and + Documentation/devicetree/bindings/graph.txt. +properties: + port@0: +type: object +description: + Input endpoint of the controller, connects to a DPI source. + + port@1: +type: object +description: + Output endpoint of the controller, connects to a panel or a bridge + input port. + +patternProperties: + "^(panel|panel-dsi)@[0-9]$": +type: object +description: + A node containing the panel or bridge description as defined in + Documentation/devicetree/bindings/display/mipi-dsi-bus.txt. +properties: + port: +type: object +description: + Panel or bridge port node connected to the DSI output port (port@1). + + "#address-cells": +const: 1 + + "#size-cells": +const: 0 + +required: + - "#address-cells" + - "#size-cells" + - compatible + - reg + - reg-names + - clocks + - clock-names + - reset + - reset-names + - ports + +additionalProperties: false + +examples: + - | +dsi1: dw-ipk-dsi@0x02000 { +compatible = "snps,dw-ipk-dsi"; +reg = <0x02000 0xfff>, <0x05000 0xfff>; +reg-names = "dsi", "phy"; +clocks = <_clk>, <_clk>; +clock-names = "pclk", "ref"; +resets = <_rst 1>; +reset-names = "apb"; + +#address-cells = <1>; +#size-cells = <0>; + +ports { +#address-cells = <1>; +#size-cells = <0>; + +port@0 { +reg = <0>; +dsi1_in: endpoint@0 { +remote-endpoint = <_out>; +}; +}; + +port@1 { +reg = <1>; +dsi_out_port: endpoint { +remote-endpoint = <_dsi_port>; +}; +}; +}; +}; + +i2c@0x01000 { +compatible = "snps,designware-i2c"; +reg = <0x01000 0x100>; +clock-frequency = <40>; +clocks = <>; +interrupts = <0>; +resets = <_rst 0>; +reset-names = "i2c"; + +lcd@45 { +compatible = "raspberrypi,7inch-touchscreen-panel"; +reg = <0x45>; +
[PATCH v2 4/4] MAINTAINERS: Add IPK MIPI DSI Host driver entry
Creates entry for Synopsys DesignWare IPK MIPI DSI host driver and adds myself as maintainer. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: Gustavo Pimentel Cc: Joao Pinto Signed-off-by: Angelo Ribeiro --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index aff76a7..ffc678e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5445,6 +5445,14 @@ S: Maintained F: drivers/gpu/drm/mcde/ F: Documentation/devicetree/bindings/display/ste,mcde.txt +DRM DRIVER FOR SYNOPSYS DESIGNWARE IPK +M: Angelo Ribeiro +L: dri-devel@lists.freedesktop.org +S: Maintained +F: drivers/gpu/drm/ipk/ +F: Documentation/devicetree/bindings/display/ipk/ +T: git git://anongit.freedesktop.org/drm/drm-misc + DRM DRIVER FOR TDFX VIDEO CARDS S: Orphan / Obsolete F: drivers/gpu/drm/tdfx/ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs
Add support for the video pattern generator (VPG) BER pattern mode and configuration in runtime. This enables using the debugfs interface to manipulate the VPG after the pipeline is set. Also, enables the usage of the VPG BER pattern. Changes in v2: - Added VID_MODE_VPG_MODE - Solved incompatible return type on __get and __set Reported-by: kbuild test robot Reported-by: Adrian Pop Cc: Gustavo Pimentel Cc: Joao Pinto Cc: Jose Abreu Signed-off-by: Angelo Ribeiro --- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 98 --- 1 file changed, 90 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index b18351b..9de3645 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -91,6 +91,7 @@ #define VID_MODE_TYPE_BURST0x2 #define VID_MODE_TYPE_MASK 0x3 #define VID_MODE_VPG_ENABLEBIT(16) +#define VID_MODE_VPG_MODE BIT(20) #define VID_MODE_VPG_HORIZONTALBIT(24) #define DSI_VID_PKT_SIZE 0x3c @@ -221,6 +222,21 @@ #define PHY_STATUS_TIMEOUT_US 1 #define CMD_PKT_STATUS_TIMEOUT_US 2 +#ifdef CONFIG_DEBUG_FS +#define VPG_DEFS(name, dsi) \ + ((void __force *)&((*dsi).vpg_defs.name)) + +#define REGISTER(name, mask, dsi) \ + { #name, VPG_DEFS(name, dsi), mask, dsi } + +struct debugfs_entries { + const char *name; + bool*reg; + u32 mask; + struct dw_mipi_dsi *dsi; +}; +#endif /* CONFIG_DEBUG_FS */ + struct dw_mipi_dsi { struct drm_bridge bridge; struct mipi_dsi_host dsi_host; @@ -238,9 +254,12 @@ struct dw_mipi_dsi { #ifdef CONFIG_DEBUG_FS struct dentry *debugfs; - - bool vpg; - bool vpg_horizontal; + struct debugfs_entries *debugfs_vpg; + struct { + bool vpg; + bool vpg_horizontal; + bool vpg_ber_pattern; + } vpg_defs; #endif /* CONFIG_DEBUG_FS */ struct dw_mipi_dsi *master; /* dual-dsi master ptr */ @@ -530,9 +549,11 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi) val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS; #ifdef CONFIG_DEBUG_FS - if (dsi->vpg) { + if (dsi->vpg_defs.vpg) { val |= VID_MODE_VPG_ENABLE; - val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0; + val |= dsi->vpg_defs.vpg_horizontal ? + VID_MODE_VPG_HORIZONTAL : 0; + val |= dsi->vpg_defs.vpg_ber_pattern ? VID_MODE_VPG_MODE : 0; } #endif /* CONFIG_DEBUG_FS */ @@ -961,6 +982,68 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { #ifdef CONFIG_DEBUG_FS +int dw_mipi_dsi_debugfs_write(void *data, u64 val) +{ + struct debugfs_entries *vpg = data; + struct dw_mipi_dsi *dsi; + u32 mode_cfg; + + if (!vpg) + return -ENODEV; + + dsi = vpg->dsi; + + *vpg->reg = (bool)val; + + mode_cfg = dsi_read(dsi, DSI_VID_MODE_CFG); + + if (*vpg->reg) + mode_cfg |= vpg->mask; + else + mode_cfg &= ~vpg->mask; + + dsi_write(dsi, DSI_VID_MODE_CFG, mode_cfg); + + return 0; +} + +int dw_mipi_dsi_debugfs_show(void *data, u64 *val) +{ + struct debugfs_entries *vpg = data; + + if (!vpg) + return -ENODEV; + + *val = *vpg->reg; + + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(fops_x32, dw_mipi_dsi_debugfs_show, +dw_mipi_dsi_debugfs_write, "%llu\n"); + +static void debugfs_create_files(void *data) +{ + struct dw_mipi_dsi *dsi = data; + struct debugfs_entries debugfs[] = { + REGISTER(vpg, VID_MODE_VPG_ENABLE, dsi), + REGISTER(vpg_horizontal, VID_MODE_VPG_HORIZONTAL, dsi), + REGISTER(vpg_ber_pattern, VID_MODE_VPG_MODE, dsi), + }; + int i; + + dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL); + if (!dsi->debugfs_vpg) + return; + + memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs)); + + for (i = 0; i < ARRAY_SIZE(debugfs); i++) + debugfs_create_file(dsi->debugfs_vpg[i].name, 0644, + dsi->debugfs, >debugfs_vpg[i], + _x32); +} + static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) { dsi->debugfs = debugfs_create_dir(dev_name(dsi->dev), NULL); @@ -969,14 +1052,13 @@ static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) return; } - debugfs_create_bool("vpg", 066
[PATCH] drm/bridge: dw-mipi-dsi.c: remove unused header file
dw-mipi-dsi does not use any definition from drm_probe_helper. Coverity output: Event unnecessary_header: Including .../include/drm/drm_probe_helper.h does not provide any needed symbols. Cc: Gustavo Pimentel Cc: Joao Pinto Cc: Jose Abreu Signed-off-by: Angelo Ribeiro --- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 024acad..582635d 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -27,7 +27,6 @@ #include #include #include -#include #define HWVER_131 0x31333100 /* IP version 1.31 */ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs
Add support for the video pattern generator (VPG) BER pattern mode and configuration in runtime. This enables using the debugfs interface to manipulate the VPG after the pipeline is set. Also, enables the usage of the VPG BER pattern. Cc: Gustavo Pimentel Cc: Joao Pinto Cc: Jose Abreu Signed-off-by: Angelo Ribeiro --- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 97 --- 1 file changed, 89 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index b18351b..512c922 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -221,6 +221,21 @@ #define PHY_STATUS_TIMEOUT_US 1 #define CMD_PKT_STATUS_TIMEOUT_US 2 +#ifdef CONFIG_DEBUG_FS +#define VPG_DEFS(name, dsi) \ + ((void __force *)&((*dsi).vpg_defs.name)) + +#define REGISTER(name, mask, dsi) \ + { #name, VPG_DEFS(name, dsi), mask, dsi } + +struct debugfs_entries { + const char *name; + bool*reg; + u32 mask; + struct dw_mipi_dsi *dsi; +}; +#endif /* CONFIG_DEBUG_FS */ + struct dw_mipi_dsi { struct drm_bridge bridge; struct mipi_dsi_host dsi_host; @@ -238,9 +253,12 @@ struct dw_mipi_dsi { #ifdef CONFIG_DEBUG_FS struct dentry *debugfs; - - bool vpg; - bool vpg_horizontal; + struct debugfs_entries *debugfs_vpg; + struct { + bool vpg; + bool vpg_horizontal; + bool vpg_ber_pattern; + } vpg_defs; #endif /* CONFIG_DEBUG_FS */ struct dw_mipi_dsi *master; /* dual-dsi master ptr */ @@ -530,9 +548,11 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi) val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS; #ifdef CONFIG_DEBUG_FS - if (dsi->vpg) { + if (dsi->vpg_defs.vpg) { val |= VID_MODE_VPG_ENABLE; - val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0; + val |= dsi->vpg_defs.vpg_horizontal ? + VID_MODE_VPG_HORIZONTAL : 0; + val |= dsi->vpg_defs.vpg_ber_pattern ? VID_MODE_VPG_MODE : 0; } #endif /* CONFIG_DEBUG_FS */ @@ -961,6 +981,68 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { #ifdef CONFIG_DEBUG_FS +ssize_t dw_mipi_dsi_debugfs_write(void *data, u64 val) +{ + struct debugfs_entries *vpg = data; + struct dw_mipi_dsi *dsi; + u32 mode_cfg; + + if (!vpg) + return -ENODEV; + + dsi = vpg->dsi; + + *vpg->reg = (bool)val; + + mode_cfg = dsi_read(dsi, DSI_VID_MODE_CFG); + + if (*vpg->reg) + mode_cfg |= vpg->mask; + else + mode_cfg &= ~vpg->mask; + + dsi_write(dsi, DSI_VID_MODE_CFG, mode_cfg); + + return 0; +} + +ssize_t dw_mipi_dsi_debugfs_show(void *data, u64 *val) +{ + struct debugfs_entries *vpg = data; + + if (!vpg) + return -ENODEV; + + *val = *vpg->reg; + + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(fops_x32, dw_mipi_dsi_debugfs_show, +dw_mipi_dsi_debugfs_write, "%llu\n"); + +static void debugfs_create_files(void *data) +{ + struct dw_mipi_dsi *dsi = data; + struct debugfs_entries debugfs[] = { + REGISTER(vpg, VID_MODE_VPG_ENABLE, dsi), + REGISTER(vpg_horizontal, VID_MODE_VPG_HORIZONTAL, dsi), + REGISTER(vpg_ber_pattern, VID_MODE_VPG_MODE, dsi), + }; + int i; + + dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL); + if (!dsi->debugfs_vpg) + return; + + memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs)); + + for (i = 0; i < ARRAY_SIZE(debugfs); i++) + debugfs_create_file(dsi->debugfs_vpg[i].name, 0644, + dsi->debugfs, >debugfs_vpg[i], + _x32); +} + static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) { dsi->debugfs = debugfs_create_dir(dev_name(dsi->dev), NULL); @@ -969,14 +1051,13 @@ static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) return; } - debugfs_create_bool("vpg", 0660, dsi->debugfs, >vpg); - debugfs_create_bool("vpg_horizontal", 0660, dsi->debugfs, - >vpg_horizontal); + debugfs_create_files(dsi); } static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi) { debugfs_remove_recursive(dsi->debugfs); + kfree(dsi->debugfs_vpg); } #else -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 3/4] drm: ipk: Add extensions for DW MIPI DSI Host driver
Add Synopsys DesignWare IPK specific extensions for Synopsys DesignWare MIPI DSI Host driver. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: Gustavo Pimentel Cc: Joao Pinto Signed-off-by: Angelo Ribeiro --- drivers/gpu/drm/ipk/Kconfig | 9 + drivers/gpu/drm/ipk/Makefile | 2 + drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c | 556 ++ 3 files changed, 567 insertions(+) create mode 100644 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig index 1f87444..49819e5 100644 --- a/drivers/gpu/drm/ipk/Kconfig +++ b/drivers/gpu/drm/ipk/Kconfig @@ -11,3 +11,12 @@ config DRM_IPK Enable support for the Synopsys DesignWare DRM DSI. To compile this driver as a module, choose M here: the module will be called ipk-drm. + +config DRM_IPK_DSI + tristate "Synopsys DesignWare IPK specific extensions for MIPI DSI" + depends on DRM_IPK + select DRM_DW_MIPI_DSI + help + Choose this option for Synopsys DesignWare IPK MIPI DSI support. + To compile this driver as a module, choose M here: the module + will be called dw-mipi-dsi-ipk. diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile index 51d2774..c80503f 100644 --- a/drivers/gpu/drm/ipk/Makefile +++ b/drivers/gpu/drm/ipk/Makefile @@ -4,3 +4,5 @@ ipk-drm-y := \ dw-vpg.o obj-$(CONFIG_DRM_IPK) += ipk-drm.o + +obj-$(CONFIG_DRM_IPK_DSI) += dw-mipi-dsi-ipk.o diff --git a/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c new file mode 100644 index 000..070eccb --- /dev/null +++ b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c @@ -0,0 +1,556 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates. + * Synopsys DesignWare MIPI DSI solution driver + * + * Author: Angelo Ribeiro + * Author: Luis Oliveira + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define DW_DPHY_LPCLK_CTRL 0x94 +#define DW_DPHY_RSTZ 0xA0 +#define DW_DPHY_IF_CFG 0xA4 +#define DW_DPHY_ULPS_CTRL 0xA8 +#define DW_DPHY_TX_TRIGGERS0xAC +#define DW_DPHY_STATUS 0xB0 +#define DW_DPHY_TST_CTRL0 0xB4 +#define DW_DPHY_TST_CTRL1 0xB8 +#define DW_GEN3_IF_TESTER 0x3c +#define DW_GEN3_IF_SOC_PLL 0x48 +#define DW_GEN3_IF_SOC_PLL_EN 0x4C + +#define DW_12BITS_DPHY_RDY_L0 0x507 +#define DW_12BITS_DPHY_RDY_L1 0x707 +#define DW_12BITS_DPHY_RDY_L2 0x907 +#define DW_12BITS_DPHY_RDY_L3 0xB07 + +#define DW_LANE_MIN_KBPS 8 +#define DW_LANE_MAX_KBPS 25 +#define DW_DPHY_DIV_UPPER_LIMIT8000 +#define DW_DPHY_DIV_LOWER_LIMIT2000 +#define DW_MIN_OUTPUT_FREQ 80 +#define DW_LPHS_TIM_TRANSIONS 0x40 + +enum dw_glueiftester { + GLUE_LOGIC = 0x4, + RX_PHY = 0x2, + TX_PHY = 0x1, + RESET = 0x0, +}; + +struct dw_range_dphy { + u32 freq; + u8 hs_freq_range; + u32 osc_freq_target; +} dw_range_gen3[] = { + { 80, 0x00, 0x3f }, { 90, 0x10, 0x3f }, { 100, 0x20, 0x3f }, + { 110, 0x30, 0x39 }, { 120, 0x01, 0x39 }, { 130, 0x11, 0x39 }, + { 140, 0x21, 0x39 }, { 150, 0x31, 0x39 }, { 160, 0x02, 0x39 }, + { 170, 0x12, 0x2f }, { 180, 0x22, 0x2f }, { 190, 0x32, 0x2f }, + { 205, 0x03, 0x2f }, { 220, 0x13, 0x29 }, { 235, 0x23, 0x29 }, + { 250, 0x33, 0x29 }, { 275, 0x04, 0x29 }, { 300, 0x14, 0x29 }, + { 325, 0x25, 0x29 }, { 350, 0x35, 0x1f }, { 400, 0x05, 0x1f }, + { 450, 0x16, 0x19 }, { 500, 0x26, 0x19 }, { 550, 0x37, 0x19 }, + { 600, 0x07, 0x19 }, { 650, 0x18, 0x19 }, { 700, 0x28, 0x0f }, + { 750, 0x39, 0x0f }, { 800, 0x09, 0x0f }, { 850, 0x19, 0x0f }, + { 900, 0x29, 0x09 }, { 950, 0x3a, 0x09 }, { 1000, 0x0a, 0x09 }, + { 1050, 0x1a, 0x09 }, { 1100, 0x2a, 0x09 }, { 1150, 0x3b, 0x09 }, + { 1200, 0x0b, 0x09 }, { 1250, 0x1b, 0x09 }, { 1300, 0x2b, 0x09 }, + { 1350, 0x3c, 0x03 }, { 1400, 0x0c, 0x03 }, { 1450, 0x1c, 0x03 }, + { 1500, 0x2c, 0x03 }, { 1550, 0x3d, 0x03 }, { 1600, 0x0d, 0x03 }, + { 1650, 0x1d, 0x03 }, { 1700, 0x2e, 0x03 }, { 1750, 0x3e, 0x03 }, + { 1800, 0x0e, 0x03 }, { 1850, 0x1e, 0x03 }, { 1900, 0x2f, 0x03 }, + { 1950, 0x3f, 0x03 }, { 2000, 0x0f, 0x03 }, { 2050, 0x40, 0x03 }, + { 2100, 0x41, 0x03 }, { 2150, 0x42, 0x03 }, { 2200, 0x43, 0x03 }, + { 2250, 0x44, 0x03 }, { 2300, 0x45, 0x01 }, { 2350, 0x46, 0x01 }, + { 2400, 0x47, 0x01 }, { 2450, 0x48, 0x01 }, { 2500, 0x49, 0x01 } +}; + +struct dw_dsi_ipk { + void __iomem *base; + void __iomem *base_phy; + struct clk *pllref_clk; + struct dw_mipi_dsi *dsi; + u32 lane_min_kbps; + u32 lane_max_kbps; + int range; + int in_div; + int loop_div; +}; + +#define dw_mipi_dsi_to_dw_dsi_
[PATCH 1/4] dt-bindings: display: Add IPK DSI subsystem bindings
Add dt-bindings for Synopsys DesignWare MIPI DSI Host and VPG (Video Pattern Generator) support in the IPK display subsystem. The Synopsys DesignWare IPK display video pipeline is composed by a DSI controller (snps,dw-ipk-dsi) and a VPG (snps,dw-ipk-vpg) as DPI stimulus. Typically is used the Raspberry Pi (raspberrypi,7inch-touchscreen-panel) as DSI panel that requires a I2C controller (snps,designware-i2c). Cc: David Airlie Cc: Daniel Vetter Cc: Rob Herring Cc: Mark Rutland Signed-off-by: Angelo Ribeiro --- .../bindings/display/snps,dw-ipk-dsi.yaml | 163 + .../bindings/display/snps,dw-ipk-vpg.yaml | 77 ++ 2 files changed, 240 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-vpg.yaml diff --git a/Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml b/Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml new file mode 100644 index 000..75e65ec --- /dev/null +++ b/Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml @@ -0,0 +1,163 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/snps,dw-ipk-dsi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys DesignWare IPK specific extensions for the Synopsys DSI host + controller. + +maintainers: + - Angelo Ribeiro + +description: + The Synopsys DesignWare IPK DSI controller uses the Synopsys DesignWare MIPI + DSI host controller. + For more info please refer to + Documentation/devicetree/bindings/display/bridge/dw_mipi_dsi.txt. + +properties: + compatible: +const: snps,dw-ipk-dsi + + reg: +minItems: 2 +maxItems: 2 +items: + - description: DW MIPI DSI Host registers + - description: DW Phy registers + + reg-names: +items: + - const: dsi + - const: phy + + clocks: +minItems: 2 +maxItems: 3 +items: + - description: Peripheral clock + - description: PLL clock + - description: Pixel clock + + clock-names: +items: + - const: pclk + - const: ref + - const: px_clk + + resets: +maxItems: 1 +items: + - description: APB reset line + + reset-names: +items: + - const: apb + + ports: +type: object +description: + A port node as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt and + Documentation/devicetree/bindings/graph.txt. +properties: + port@0: +type: object +description: + Input endpoint of the controller, connects to a DPI source. + + port@1: +type: object +description: + Output endpoint of the controller, connects to a panel or a bridge + input port. + +patternProperties: + "^(panel|panel-dsi)@[0-9]$": +type: object +description: + A node containing the panel or bridge description as defined in + Documentation/devicetree/bindings/display/mipi-dsi-bus.txt. +properties: + port: +type: object +description: + Panel or bridge port node connected to the DSI output port (port@1). + + "#address-cells": +const: 1 + + "#size-cells": +const: 0 + +required: + - "#address-cells" + - "#size-cells" + - compatible + - reg + - reg-names + - clocks + - clock-names + - reset + - reset-names + - ports + +additionalProperties: false + +examples: + - | +dsi1: dw-ipk-dsi@0x02000 { +compatible = "snps,dw-ipk-dsi"; +reg = <0x02000 0xfff>, <0x05000 0xfff>; +reg-names = "dsi", "phy"; +clocks = <_clk>, <_clk>; +clock-names = "pclk", "ref"; +resets = <_rst 1>; +reset-names = "apb"; + +#address-cells = <1>; +#size-cells = <0>; + +ports { +#address-cells = <1>; +#size-cells = <0>; + +port@0 { +reg = <0>; +dsi1_in: endpoint@0 { +remote-endpoint = <_out>; +}; +}; + +port@1 { +reg = <1>; +dsi_out_port: endpoint { +remote-endpoint = <_dsi_port>; +}; +}; +}; +}; + +i2c@0x01000 { +compatible = "snps,designware-i2c"; +reg = <0x01000 0x100>; +clock-frequency = <40>; +clocks = <>; +interrupts = <0>; +resets = <_rst 0>; +reset-names = "i2c"; + +lcd@45 { +compatible = "raspberrypi,7inch-touchscreen-panel"; +reg = <0x45>; + +port { +panel_ds
[PATCH 0/4] drm: Add support for IPK DSI Host Driver
This patch series adds support for the display subsystem in the Synopsys DesignWare IPK devices. The display pipeline is limited and does not have access to memory, the validation is done using a VPG (Video Pattern Generator), as DPI stimulus for the DW MIPI DSI Host. A Synopsys DesignWare MIPI DSI Host v1.40 is used in the IPK device, that so far, is fully compatible with the driver dw-mipi-dsi. To activate the VPG use the sysfs pattern variable, assigning values from 0 (shutdown) to 4. The usage of the VPG and the Synopsys DesignWare MIPI DSI Host internal video generator is mutually exclusive. The submission of this driver aims to be used as a work base for the submission of enhancements over the Synopsys DesignWare MIPI DSI Host. Angelo Ribeiro (4): dt-bindings: display: Add IPK DSI subsystem bindings drm: ipk: Add DRM driver for DesignWare IPK DSI drm: ipk: Add extensions for DW MIPI DSI Host driver MAINTAINERS: Add IPK MIPI DSI Host driver entry .../bindings/display/snps,dw-ipk-dsi.yaml | 163 ++ .../bindings/display/snps,dw-ipk-vpg.yaml | 77 +++ MAINTAINERS| 8 + drivers/gpu/drm/Kconfig| 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/ipk/Kconfig| 22 + drivers/gpu/drm/ipk/Makefile | 8 + drivers/gpu/drm/ipk/dw-drv.c | 189 +++ drivers/gpu/drm/ipk/dw-ipk.h | 30 ++ drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c | 556 drivers/gpu/drm/ipk/dw-vpg.c | 559 + drivers/gpu/drm/ipk/dw-vpg.h | 55 ++ 12 files changed, 1670 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-dsi.yaml create mode 100644 Documentation/devicetree/bindings/display/snps,dw-ipk-vpg.yaml create mode 100644 drivers/gpu/drm/ipk/Kconfig create mode 100644 drivers/gpu/drm/ipk/Makefile create mode 100644 drivers/gpu/drm/ipk/dw-drv.c create mode 100644 drivers/gpu/drm/ipk/dw-ipk.h create mode 100644 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c create mode 100644 drivers/gpu/drm/ipk/dw-vpg.c create mode 100644 drivers/gpu/drm/ipk/dw-vpg.h -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/4] drm: ipk: Add DRM driver for DesignWare IPK DSI
Add support for Synopsys DesignWare VPG (Video Pattern Generator) and DRM driver for Synopsys DesignWare DSI Host IPK solution. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: Gustavo Pimentel Cc: Joao Pinto Signed-off-by: Angelo Ribeiro --- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/ipk/Kconfig | 13 + drivers/gpu/drm/ipk/Makefile | 6 + drivers/gpu/drm/ipk/dw-drv.c | 189 +++ drivers/gpu/drm/ipk/dw-ipk.h | 30 +++ drivers/gpu/drm/ipk/dw-vpg.c | 559 +++ drivers/gpu/drm/ipk/dw-vpg.h | 55 + 8 files changed, 855 insertions(+) create mode 100644 drivers/gpu/drm/ipk/Kconfig create mode 100644 drivers/gpu/drm/ipk/Makefile create mode 100644 drivers/gpu/drm/ipk/dw-drv.c create mode 100644 drivers/gpu/drm/ipk/dw-ipk.h create mode 100644 drivers/gpu/drm/ipk/dw-vpg.c create mode 100644 drivers/gpu/drm/ipk/dw-vpg.h diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 4359497..29ea1d1 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -388,6 +388,8 @@ source "drivers/gpu/drm/mcde/Kconfig" source "drivers/gpu/drm/tidss/Kconfig" +source "drivers/gpu/drm/ipk/Kconfig" + # Keep legacy drivers last menuconfig DRM_LEGACY diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 7f72ef5..c5afb63 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -124,3 +124,4 @@ obj-$(CONFIG_DRM_PANFROST) += panfrost/ obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/ obj-$(CONFIG_DRM_MCDE) += mcde/ obj-$(CONFIG_DRM_TIDSS) += tidss/ +obj-$(CONFIG_DRM_IPK) += ipk/ diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig new file mode 100644 index 000..1f87444 --- /dev/null +++ b/drivers/gpu/drm/ipk/Kconfig @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-only +config DRM_IPK + tristate "DRM Support for Synopsys DesignWare IPK DSI" + depends on DRM + select DRM_KMS_HELPER + select DRM_GEM_CMA_HELPER + select DRM_KMS_CMA_HELPER + select DRM_PANEL_BRIDGE + select VIDEOMODE_HELPERS + help + Enable support for the Synopsys DesignWare DRM DSI. + To compile this driver as a module, choose M here: the module + will be called ipk-drm. diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile new file mode 100644 index 000..51d2774 --- /dev/null +++ b/drivers/gpu/drm/ipk/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +ipk-drm-y := \ + dw-drv.o \ + dw-vpg.o + +obj-$(CONFIG_DRM_IPK) += ipk-drm.o diff --git a/drivers/gpu/drm/ipk/dw-drv.c b/drivers/gpu/drm/ipk/dw-drv.c new file mode 100644 index 000..6205f1c --- /dev/null +++ b/drivers/gpu/drm/ipk/dw-drv.c @@ -0,0 +1,189 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates. + * Synopsys DesignWare MIPI DSI DRM driver + * + * Author: Angelo Ribeiro + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dw-ipk.h" +#include "dw-vpg.h" + +static const struct drm_mode_config_funcs dw_ipk_drm_modecfg_funcs = { + .fb_create = drm_gem_fb_create_with_dirty, + .atomic_check = drm_atomic_helper_check, + .atomic_commit = drm_atomic_helper_commit, +}; + +static int dw_ipk_load(struct drm_device *drm) +{ + int ret; + + drm_mode_config_init(drm); + + drm->mode_config.min_width = 0; + drm->mode_config.min_height = 0; + + /* To handle orientation */ + drm->mode_config.max_width = 2048; + drm->mode_config.max_height = 2048; + + drm->mode_config.funcs = _ipk_drm_modecfg_funcs; + + /* TODO +* Optional framebuffer memory resources allocation +*/ + + ret = vpg_load(drm); + if (ret) + return ret; + + /* Calls all the crtc's, encoder's and connector's reset */ + drm_mode_config_reset(drm); + + /* Initialize and enable output polling */ + drm_kms_helper_poll_init(drm); + + return ret; +} + +static void dw_ipk_unload(struct drm_device *drm) +{ + DRM_DEBUG_DRIVER("\n"); + + drm_kms_helper_poll_fini(drm); + vpg_unload(drm); +} + +DEFINE_DRM_GEM_CMA_FOPS(ipk_drm_driver_fops); + +static int ipk_gem_cma_dumb_create(struct drm_file *file, + struct drm_device *dev, + struct drm_mode_create_dumb *args) +{ + unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8); + int err; + + /* +* In order to optimize data transfer, pitch is aligned on +* 128 bytes, height is aligned on 4 bytes +*/ + args->pitch = roundup(min_pitch, 128); +
[PATCH 4/4] MAINTAINERS: Add IPK MIPI DSI Host driver entry
Creates entry for Synopsys DesignWare IPK MIPI DSI host driver and adds myself as maintainer. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: Gustavo Pimentel Cc: Joao Pinto Signed-off-by: Angelo Ribeiro --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 19eea09..3de4365 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5445,6 +5445,14 @@ S: Maintained F: drivers/gpu/drm/mcde/ F: Documentation/devicetree/bindings/display/ste,mcde.txt +DRM DRIVER FOR SYNOPSYS DESIGNWARE IPK +M: Angelo Ribeiro +L: dri-devel@lists.freedesktop.org +S: Maintained +F: drivers/gpu/drm/ipk/ +F: Documentation/devicetree/bindings/display/ipk/ +T: git git://anongit.freedesktop.org/drm/drm-misc + DRM DRIVER FOR TDFX VIDEO CARDS S: Orphan / Obsolete F: drivers/gpu/drm/tdfx/ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH] drm/bridge/synopsys: dsi: read status error during transfer
t; len; j++) > buf[i + j] = val >> (8 * j); > @@ -473,6 +535,7 @@ static ssize_t dw_mipi_dsi_host_transfer(struct > mipi_dsi_host *host, > struct dw_mipi_dsi *dsi = host_to_dsi(host); > struct mipi_dsi_packet packet; > int ret, nb_bytes; > + int retry = 3; > > ret = mipi_dsi_create_packet(, msg); > if (ret) { > @@ -484,24 +547,32 @@ static ssize_t dw_mipi_dsi_host_transfer(struct > mipi_dsi_host *host, > if (dsi->slave) > dw_mipi_message_config(dsi->slave, msg); > > - ret = dw_mipi_dsi_write(dsi, ); > - if (ret) > - return ret; > - if (dsi->slave) { > - ret = dw_mipi_dsi_write(dsi->slave, ); > + while (retry--) { > + ret = dw_mipi_dsi_write(dsi, ); > if (ret) > - return ret; > - } > + continue; > > - if (msg->rx_buf && msg->rx_len) { > - ret = dw_mipi_dsi_read(dsi, msg); > - if (ret) > - return ret; > - nb_bytes = msg->rx_len; > - } else { > - nb_bytes = packet.size; > + if (dsi->slave) { > + ret = dw_mipi_dsi_write(dsi->slave, ); > + if (ret) > + continue; > + } > + > + if (msg->rx_buf && msg->rx_len) { > + ret = dw_mipi_dsi_read(dsi, msg); > + if (ret) > + continue; > + nb_bytes = msg->rx_len; > + > + } else { > + nb_bytes = packet.size; > + } > + break; > } > > + if (ret) > + return ret; > + > return nb_bytes; > } > > -- > 2.7.4 Angelo Ribeiro Software Engineer, Synopsys, Inc. angelo.ribe...@synopsys.com Work: (+351)220 977 109 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_dri-2Ddevel=DwIGaQ=DPL6_X_6JkXFx7AXWqB0tg=qo_6hx-85FdiWxFnlP_7O-HosW3LyWP6_23ipK8AVDE=6HesTnV8KBATeAUwGjP83TkzKbOxOqUYz3WSV3Q6u9g=TSaHlviW61V_jSga9_rAicgdZRnvyIll7JR8Uncj53s= ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel