[PATCH v2 2/2] drm/bridge: tc358767: Add DPI to eDP bridge driver
Hi, On 07/12/2016 10:51 PM, Philipp Zabel wrote: > From: Andrey Gusakov > > Add a drm_bridge driver for the Toshiba TC358767 DPI/DSI to > eDP/DP bridge. Currently only DPI input with 24-bit RGB is > supported. > > Signed-off-by: Andrey Gusakov > Signed-off-by: Philipp Zabel > --- > Changes since v1: > - Replaced the regmap_read_poll_timeout macro with a function. > - Rebased on top of SiI902x driver merge to avoid Makefile/Kconfig > conflicts. > - Fixed tc_pxl_pll_en as requested: removed unnecessary checks, whitespace > and comment improvements. > - Switched to atomic connector funcs. > - Moved the output port to port at 2. > --- > drivers/gpu/drm/bridge/Kconfig|8 + > drivers/gpu/drm/bridge/Makefile |1 + > drivers/gpu/drm/bridge/tc358767.c | 1421 > + > 3 files changed, 1430 insertions(+) > create mode 100644 drivers/gpu/drm/bridge/tc358767.c > > diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig > index a1419214..ebcad29 100644 > --- a/drivers/gpu/drm/bridge/Kconfig > +++ b/drivers/gpu/drm/bridge/Kconfig > @@ -58,6 +58,14 @@ config DRM_SII902X > ---help--- > Silicon Image sii902x bridge chip driver. > > +config DRM_TOSHIBA_TC358767 > + tristate "Toshiba TC358767 eDP bridge" Can we add a 'depends on OF ' here, or wrap around the 'tc->bridge.of_node' access with a CONFIG_OF check? It currently breaks build for non-OF platforms. > + select DRM_KMS_HELPER > + select REGMAP_I2C > + select DRM_PANEL > + ---help--- > + Toshiba TC358767 eDP bridge chip driver. > + > source "drivers/gpu/drm/bridge/analogix/Kconfig" > > endmenu > diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile > index bfec9f8..42b853a 100644 > --- a/drivers/gpu/drm/bridge/Makefile > +++ b/drivers/gpu/drm/bridge/Makefile > @@ -6,4 +6,5 @@ obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o > obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o > obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o > obj-$(CONFIG_DRM_SII902X) += sii902x.o > +obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o > obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/ > diff --git a/drivers/gpu/drm/bridge/tc358767.c > b/drivers/gpu/drm/bridge/tc358767.c > new file mode 100644 > index 000..f1e3a4b > --- /dev/null > +++ b/drivers/gpu/drm/bridge/tc358767.c > @@ -0,0 +1,1421 @@ > +/* > + * tc358767 eDP bridge driver > + * > + * Copyright (C) 2016 CogentEmbedded Inc > + * Author: Andrey Gusakov > + * > + * Copyright (C) 2016 Pengutronix, Philipp Zabel > + * > + * Initially based on: drivers/gpu/drm/i2c/tda998x_drv.c > + * > + * Copyright (C) 2012 Texas Instruments > + * Author: Rob Clark > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +/* Registers */ > + > +/* Display Parallel Interface */ > +#define DPIPXLFMT0x0440 > +#define VS_POL_ACTIVE_LOW(1 << 10) > +#define HS_POL_ACTIVE_LOW(1 << 9) > +#define DE_POL_ACTIVE_HIGH (0 << 8) > +#define SUB_CFG_TYPE_CONFIG1 (0 << 2) /* LSB aligned */ > +#define SUB_CFG_TYPE_CONFIG2 (1 << 2) /* Loosely Packed */ > +#define SUB_CFG_TYPE_CONFIG3 (2 << 2) /* LSB aligned 8-bit */ > +#define DPI_BPP_RGB888 (0 << 0) > +#define DPI_BPP_RGB666 (1 << 0) > +#define DPI_BPP_RGB565 (2 << 0) > + > +/* Video Path */ > +#define VPCTRL0 0x0450 > +#define OPXLFMT_RGB666 (0 << 8) > +#define OPXLFMT_RGB888 (1 << 8) > +#define FRMSYNC_DISABLED (0 << 4) /* Video Timing Gen Disabled */ > +#define FRMSYNC_ENABLED (1 << 4) /* Video Timing Gen > Enabled */ > +#define MSF_DISABLED (0 << 0) /* Magic Square FRC disabled */ > +#define MSF_ENABLED (1 << 0) /* Magic Square FRC enabled */ > +#define HTIM01 0x0454 > +#define HTIM02 0x0458 > +#define VTIM01 0x045c > +#define VTIM02 0x0460 > +#define VFUEN0 0x0464 > +#define VFUENBIT(0) /* Video Frame Timing > Upload */ > + > +/* System */ > +#define TC_IDREG
[PATCH v2 2/2] drm/bridge: tc358767: Add DPI to eDP bridge driver
Hi Archit, Am Mittwoch, den 13.07.2016, 11:25 +0530 schrieb Archit Taneja: [...] > > diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig > > index a1419214..ebcad29 100644 > > --- a/drivers/gpu/drm/bridge/Kconfig > > +++ b/drivers/gpu/drm/bridge/Kconfig > > @@ -58,6 +58,14 @@ config DRM_SII902X > > ---help--- > > Silicon Image sii902x bridge chip driver. > > > > +config DRM_TOSHIBA_TC358767 > > + tristate "Toshiba TC358767 eDP bridge" > > Can we add a 'depends on OF ' here, or wrap around the > 'tc->bridge.of_node' access with a CONFIG_OF check? It currently > breaks build for non-OF platforms. Done. [...] > > + int test_pattern; > > This still doesn't seem to be initialized. Didn't we want this > to be a module param? If we're not sure yet, it would be fine > just to set tc->test_pattern explicitly to 0 and add a comment. And done, sorry I forgot this. Now that I have added the module parameter, I have and actually tested the test pattern code and noticed that I also have to set the pixel clock rate. I'll send a new version shortly. regards Philipp
[PATCH v2 2/2] drm/bridge: tc358767: Add DPI to eDP bridge driver
From: Andrey GusakovAdd a drm_bridge driver for the Toshiba TC358767 DPI/DSI to eDP/DP bridge. Currently only DPI input with 24-bit RGB is supported. Signed-off-by: Andrey Gusakov Signed-off-by: Philipp Zabel --- Changes since v1: - Replaced the regmap_read_poll_timeout macro with a function. - Rebased on top of SiI902x driver merge to avoid Makefile/Kconfig conflicts. - Fixed tc_pxl_pll_en as requested: removed unnecessary checks, whitespace and comment improvements. - Switched to atomic connector funcs. - Moved the output port to port at 2. --- drivers/gpu/drm/bridge/Kconfig|8 + drivers/gpu/drm/bridge/Makefile |1 + drivers/gpu/drm/bridge/tc358767.c | 1421 + 3 files changed, 1430 insertions(+) create mode 100644 drivers/gpu/drm/bridge/tc358767.c diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index a1419214..ebcad29 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -58,6 +58,14 @@ config DRM_SII902X ---help--- Silicon Image sii902x bridge chip driver. +config DRM_TOSHIBA_TC358767 + tristate "Toshiba TC358767 eDP bridge" + select DRM_KMS_HELPER + select REGMAP_I2C + select DRM_PANEL + ---help--- + Toshiba TC358767 eDP bridge chip driver. + source "drivers/gpu/drm/bridge/analogix/Kconfig" endmenu diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index bfec9f8..42b853a 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -6,4 +6,5 @@ obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o obj-$(CONFIG_DRM_SII902X) += sii902x.o +obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/ diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c new file mode 100644 index 000..f1e3a4b --- /dev/null +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -0,0 +1,1421 @@ +/* + * tc358767 eDP bridge driver + * + * Copyright (C) 2016 CogentEmbedded Inc + * Author: Andrey Gusakov + * + * Copyright (C) 2016 Pengutronix, Philipp Zabel + * + * Initially based on: drivers/gpu/drm/i2c/tda998x_drv.c + * + * Copyright (C) 2012 Texas Instruments + * Author: Rob Clark + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* Registers */ + +/* Display Parallel Interface */ +#define DPIPXLFMT 0x0440 +#define VS_POL_ACTIVE_LOW (1 << 10) +#define HS_POL_ACTIVE_LOW (1 << 9) +#define DE_POL_ACTIVE_HIGH (0 << 8) +#define SUB_CFG_TYPE_CONFIG1 (0 << 2) /* LSB aligned */ +#define SUB_CFG_TYPE_CONFIG2 (1 << 2) /* Loosely Packed */ +#define SUB_CFG_TYPE_CONFIG3 (2 << 2) /* LSB aligned 8-bit */ +#define DPI_BPP_RGB888 (0 << 0) +#define DPI_BPP_RGB666 (1 << 0) +#define DPI_BPP_RGB565 (2 << 0) + +/* Video Path */ +#define VPCTRL00x0450 +#define OPXLFMT_RGB666 (0 << 8) +#define OPXLFMT_RGB888 (1 << 8) +#define FRMSYNC_DISABLED (0 << 4) /* Video Timing Gen Disabled */ +#define FRMSYNC_ENABLED(1 << 4) /* Video Timing Gen Enabled */ +#define MSF_DISABLED (0 << 0) /* Magic Square FRC disabled */ +#define MSF_ENABLED(1 << 0) /* Magic Square FRC enabled */ +#define HTIM01 0x0454 +#define HTIM02 0x0458 +#define VTIM01 0x045c +#define VTIM02 0x0460 +#define VFUEN0 0x0464 +#define VFUEN BIT(0) /* Video Frame Timing Upload */ + +/* System */ +#define TC_IDREG 0x0500 +#define SYSCTRL0x0510 +#define DP0_AUDSRC_NO_INPUT(0 << 3) +#define DP0_AUDSRC_I2S_RX (1 << 3) +#define DP0_VIDSRC_NO_INPUT(0 << 0) +#define DP0_VIDSRC_DSI_RX (1 << 0) +#define DP0_VIDSRC_DPI_RX (2 << 0) +#define DP0_VIDSRC_COLOR_BAR (3 << 0) + +/* Control */ +#define DP0CTL 0x0600 +#define VID_MN_GEN BIT(6) /* Auto-generate