Re: [PATCH v3 2/3] drm: bridge: add it66121 driver
On 14/04/2021 19:35, Paul Cercueil wrote: > Hi Neil, > > Le mer. 14 avril 2021 à 8:17, Neil Armstrong a > écrit : >> Hi, >> >> Le 13/04/2021 à 22:56, Paul Cercueil a écrit : >>> Hi Neil, >>> >>> I get build failures locally: >>> >>> drivers/gpu/drm/bridge/ite-it66121.c: In function ‘it66121_hw_reset’: >>> drivers/gpu/drm/bridge/ite-it66121.c:242:2: error: implicit declaration of >>> function ‘gpiod_set_value’ [-Werror=implicit-function-declaration] >>> 242 | gpiod_set_value(ctx->gpio_reset, 1); >>> | ^~~ >>> drivers/gpu/drm/bridge/ite-it66121.c: In function ‘it66121_probe’: >>> drivers/gpu/drm/bridge/ite-it66121.c:1016:16: error: implicit declaration >>> of function ‘FIELD_GET’; did you mean ‘FOLL_GET’? >>> [-Werror=implicit-function-declaration] >>> 1016 | revision_id = FIELD_GET(IT66121_REVISION_MASK, device_ids[1]); >>> | ^ >>> | FOLL_GET >>> >>> Nothing difficult to fix, but the includes should be added nonetheless. >> >> Exact, I got the CI build failures, I'll fix these for v4. >> >> Were you able to test on your setup ? >> The v2 always forced DDR mode, with this v3, I also switch to normal 24input >> mode, but totally untested. > > It triggers a warning: > > [ 277.870247] WARNING: CPU: 0 PID: 310 at drivers/gpu/drm/drm_bridge.c:892 > drm_atomic_bridge_chain_check+0x304/0x324 > [ 277.870290] Modules linked in: > [ 277.870306] CPU: 0 PID: 310 Comm: modetest Tainted: G W > 5.12.0-rc7-opendingux-00121-g828a3020b5d3 #371 > [ 277.870322] Stack : 83f62580 80163b58 0004 b1f39d7e > 83581a9c 80ab42b0 > [ 277.870367] 808a 808a 835c82f0 808a0dab 80ab42b0 0001 > 83581a48 b1f39d7e > [ 277.870412] 807e9030 00b8 835818fc > 7875676e > [ 277.870456] 3130302d 80abaa43 80abaa9f 672d3132 808a 8000 > 0009 037c > [ 277.870500] 82a2d0f8 83043b80 fffc > 2098 80ab > [ 277.870544] ... > [ 277.870556] Call Trace: > [ 277.870560] [<80109010>] show_stack+0x40/0x128 > [ 277.870588] [<80123350>] __warn+0xe0/0x154 > [ 277.870608] [<80123428>] warn_slowpath_fmt+0x64/0xb8 > [ 277.870625] [<80504e70>] drm_atomic_bridge_chain_check+0x304/0x324 > [ 277.870642] [<804e3244>] drm_atomic_helper_check_modeset+0x9f4/0xc58 > [ 277.870667] [<804e4338>] drm_atomic_helper_check+0x20/0xa8 > [ 277.870685] [<80503644>] drm_atomic_check_only+0x538/0x98c > [ 277.870700] [<80503ab4>] drm_atomic_commit+0x1c/0x70 > [ 277.870716] [<8051c3e4>] drm_mode_atomic_ioctl+0x920/0xb44 > [ 277.870736] [<804f033c>] drm_ioctl+0x20c/0x3d8 > [ 277.870754] [<80283658>] sys_ioctl+0x358/0x860 > [ 277.870772] [<801107ec>] syscall_common+0x34/0x58 > > [ 277.870795] ---[ end trace e973f3b21c63aa1d ]--- Will fix this, Neil > > That causes my atomic commit to fail, so I can't test it further. > > Cheers, > -Paul > >> Thanks, >> Neil >> >>> >>> Cheers, >>> -Paul >>> >>> >>> Le lun. 12 avril 2021 à 17:46, Neil Armstrong a >>> écrit : From: Phong LE This commit is a simple driver for bridge HMDI it66121. The input format is RBG and there is no color conversion. Audio, HDCP and CEC are not supported yet. Signed-off-by: Phong LE Signed-off-by: Neil Armstrong --- drivers/gpu/drm/bridge/Kconfig | 8 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/ite-it66121.c | 1081 ++ 3 files changed, 1090 insertions(+) create mode 100644 drivers/gpu/drm/bridge/ite-it66121.c diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index e4110d6ca7b3..6915c38fa459 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -74,6 +74,14 @@ config DRM_LONTIUM_LT9611UXC HDMI signals Please say Y if you have such hardware. +config DRM_ITE_IT66121 + tristate "ITE IT66121 HDMI bridge" + depends on OF + select DRM_KMS_HELPER + select REGMAP_I2C + help + Support for ITE IT66121 HDMI bridge. + config DRM_LVDS_CODEC tristate "Transparent LVDS encoders and decoders support" depends on OF diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index 86e7acc76f8d..4f725753117c 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -24,6 +24,7 @@ obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o obj-$(CONFIG_DRM_TI_TPD12S015) += ti-tpd12s015.o obj-$(CONFIG_DRM_NWL_MIPI_DSI) += nwl-dsi.o +obj-$(CONFIG_DRM_ITE_IT66121) += ite-it66121.o obj-y += analogix/ obj-y += cadence/ diff --git a/drivers/gpu/drm/bridge/it
Re: [PATCH v3 2/3] drm: bridge: add it66121 driver
Hi Neil, Le mer. 14 avril 2021 à 8:17, Neil Armstrong a écrit : Hi, Le 13/04/2021 à 22:56, Paul Cercueil a écrit : Hi Neil, I get build failures locally: drivers/gpu/drm/bridge/ite-it66121.c: In function ‘it66121_hw_reset’: drivers/gpu/drm/bridge/ite-it66121.c:242:2: error: implicit declaration of function ‘gpiod_set_value’ [-Werror=implicit-function-declaration] 242 | gpiod_set_value(ctx->gpio_reset, 1); | ^~~ drivers/gpu/drm/bridge/ite-it66121.c: In function ‘it66121_probe’: drivers/gpu/drm/bridge/ite-it66121.c:1016:16: error: implicit declaration of function ‘FIELD_GET’; did you mean ‘FOLL_GET’? [-Werror=implicit-function-declaration] 1016 | revision_id = FIELD_GET(IT66121_REVISION_MASK, device_ids[1]); | ^ | FOLL_GET Nothing difficult to fix, but the includes should be added nonetheless. Exact, I got the CI build failures, I'll fix these for v4. Were you able to test on your setup ? The v2 always forced DDR mode, with this v3, I also switch to normal 24input mode, but totally untested. It triggers a warning: [ 277.870247] WARNING: CPU: 0 PID: 310 at drivers/gpu/drm/drm_bridge.c:892 drm_atomic_bridge_chain_check+0x304/0x324 [ 277.870290] Modules linked in: [ 277.870306] CPU: 0 PID: 310 Comm: modetest Tainted: GW 5.12.0-rc7-opendingux-00121-g828a3020b5d3 #371 [ 277.870322] Stack : 83f62580 80163b58 0004 b1f39d7e 83581a9c 80ab42b0 [ 277.870367] 808a 808a 835c82f0 808a0dab 80ab42b0 0001 83581a48 b1f39d7e [ 277.870412] 807e9030 00b8 835818fc 7875676e [ 277.870456] 3130302d 80abaa43 80abaa9f 672d3132 808a 8000 0009 037c [ 277.870500] 82a2d0f8 83043b80 fffc 2098 80ab [ 277.870544] ... [ 277.870556] Call Trace: [ 277.870560] [<80109010>] show_stack+0x40/0x128 [ 277.870588] [<80123350>] __warn+0xe0/0x154 [ 277.870608] [<80123428>] warn_slowpath_fmt+0x64/0xb8 [ 277.870625] [<80504e70>] drm_atomic_bridge_chain_check+0x304/0x324 [ 277.870642] [<804e3244>] drm_atomic_helper_check_modeset+0x9f4/0xc58 [ 277.870667] [<804e4338>] drm_atomic_helper_check+0x20/0xa8 [ 277.870685] [<80503644>] drm_atomic_check_only+0x538/0x98c [ 277.870700] [<80503ab4>] drm_atomic_commit+0x1c/0x70 [ 277.870716] [<8051c3e4>] drm_mode_atomic_ioctl+0x920/0xb44 [ 277.870736] [<804f033c>] drm_ioctl+0x20c/0x3d8 [ 277.870754] [<80283658>] sys_ioctl+0x358/0x860 [ 277.870772] [<801107ec>] syscall_common+0x34/0x58 [ 277.870795] ---[ end trace e973f3b21c63aa1d ]--- That causes my atomic commit to fail, so I can't test it further. Cheers, -Paul Thanks, Neil Cheers, -Paul Le lun. 12 avril 2021 à 17:46, Neil Armstrong a écrit : From: Phong LE This commit is a simple driver for bridge HMDI it66121. The input format is RBG and there is no color conversion. Audio, HDCP and CEC are not supported yet. Signed-off-by: Phong LE Signed-off-by: Neil Armstrong --- drivers/gpu/drm/bridge/Kconfig |8 + drivers/gpu/drm/bridge/Makefile |1 + drivers/gpu/drm/bridge/ite-it66121.c | 1081 ++ 3 files changed, 1090 insertions(+) create mode 100644 drivers/gpu/drm/bridge/ite-it66121.c diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index e4110d6ca7b3..6915c38fa459 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -74,6 +74,14 @@ config DRM_LONTIUM_LT9611UXC HDMI signals Please say Y if you have such hardware. +config DRM_ITE_IT66121 +tristate "ITE IT66121 HDMI bridge" +depends on OF +select DRM_KMS_HELPER +select REGMAP_I2C +help + Support for ITE IT66121 HDMI bridge. + config DRM_LVDS_CODEC tristate "Transparent LVDS encoders and decoders support" depends on OF diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index 86e7acc76f8d..4f725753117c 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -24,6 +24,7 @@ obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o obj-$(CONFIG_DRM_TI_TPD12S015) += ti-tpd12s015.o obj-$(CONFIG_DRM_NWL_MIPI_DSI) += nwl-dsi.o +obj-$(CONFIG_DRM_ITE_IT66121) += ite-it66121.o obj-y += analogix/ obj-y += cadence/ diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c new file mode 100644 index ..73af49b29dfa --- /dev/null +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -0,0 +1,1081 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2020 BayLibre, SAS + * Author: Phong LE + * Copyright (C) 2018-2019, Artem Mygaiev + * Copyright (C) 2017, Fresco Logic, Incorporated. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#in
Re: [PATCH v3 2/3] drm: bridge: add it66121 driver
On 14/04/2021 10:16, Laurent Pinchart wrote: > Hi Neil, > > On Wed, Apr 14, 2021 at 10:08:46AM +0200, Neil Armstrong wrote: >> On 14/04/2021 10:06, Robert Foss wrote: >>> On Wed, 14 Apr 2021 at 08:13, Neil Armstrong >>> wrote: Le 13/04/2021 à 22:21, Robert Foss a écrit : > Hey Neil & Phong, > > Thanks for submitting this series! > >> + >> +static const struct drm_bridge_funcs it66121_bridge_funcs = { >> + .attach = it66121_bridge_attach, >> + .enable = it66121_bridge_enable, >> + .disable = it66121_bridge_disable, >> + .mode_set = it66121_bridge_mode_set, >> + .mode_valid = it66121_bridge_mode_valid, >> + .detect = it66121_bridge_detect, >> + .get_edid = it66121_bridge_get_edid, >> + .atomic_get_output_bus_fmts = >> it66121_bridge_atomic_get_output_bus_fmts, >> + .atomic_get_input_bus_fmts = >> it66121_bridge_atomic_get_input_bus_fmts, >> +}; > > I would like to see an implementation of HPD, since it is supported by > the hardware[1] (and required by the documentation). IRQ status bit 0 > seems to be the responsible for notifying us about hot plug detection > events. It's implemented in the IRQ handler with the IT66121_INT_STATUS1_HPD_STATUS event. >>> >>> I didn't even get that far :) >>> >>> Either way, the HPD support should be exposed in drm_bridge_funcs >>> (.hpd_enable, .hpd_disable (and possibly .hpd_notify)) and >>> drm_bridge.ops (DRM_BRIDGE_OP_HPD). >> >> Indeed I forgot these calls in the NO_CONNECTOR implementation... > > For new bridges, you should no implement connector creation, only the > DRM_BRIDGE_ATTACH_NO_CONNECTOR case should be supported. > Right, time to make a clean bridge-only implementation then ! Thanks for your feedbacks, Neil
Re: [PATCH v3 2/3] drm: bridge: add it66121 driver
Hi Neil, On Wed, Apr 14, 2021 at 10:08:46AM +0200, Neil Armstrong wrote: > On 14/04/2021 10:06, Robert Foss wrote: > > On Wed, 14 Apr 2021 at 08:13, Neil Armstrong > > wrote: > >> Le 13/04/2021 à 22:21, Robert Foss a écrit : > >>> Hey Neil & Phong, > >>> > >>> Thanks for submitting this series! > >>> > + > +static const struct drm_bridge_funcs it66121_bridge_funcs = { > + .attach = it66121_bridge_attach, > + .enable = it66121_bridge_enable, > + .disable = it66121_bridge_disable, > + .mode_set = it66121_bridge_mode_set, > + .mode_valid = it66121_bridge_mode_valid, > + .detect = it66121_bridge_detect, > + .get_edid = it66121_bridge_get_edid, > + .atomic_get_output_bus_fmts = > it66121_bridge_atomic_get_output_bus_fmts, > + .atomic_get_input_bus_fmts = > it66121_bridge_atomic_get_input_bus_fmts, > +}; > >>> > >>> I would like to see an implementation of HPD, since it is supported by > >>> the hardware[1] (and required by the documentation). IRQ status bit 0 > >>> seems to be the responsible for notifying us about hot plug detection > >>> events. > >> > >> It's implemented in the IRQ handler with the > >> IT66121_INT_STATUS1_HPD_STATUS event. > > > > I didn't even get that far :) > > > > Either way, the HPD support should be exposed in drm_bridge_funcs > > (.hpd_enable, .hpd_disable (and possibly .hpd_notify)) and > > drm_bridge.ops (DRM_BRIDGE_OP_HPD). > > Indeed I forgot these calls in the NO_CONNECTOR implementation... For new bridges, you should no implement connector creation, only the DRM_BRIDGE_ATTACH_NO_CONNECTOR case should be supported. -- Regards, Laurent Pinchart
Re: [PATCH v3 2/3] drm: bridge: add it66121 driver
Le mer. 14 avril 2021 à 8:17, Neil Armstrong a écrit : Hi, Le 13/04/2021 à 22:56, Paul Cercueil a écrit : Hi Neil, I get build failures locally: drivers/gpu/drm/bridge/ite-it66121.c: In function ‘it66121_hw_reset’: drivers/gpu/drm/bridge/ite-it66121.c:242:2: error: implicit declaration of function ‘gpiod_set_value’ [-Werror=implicit-function-declaration] 242 | gpiod_set_value(ctx->gpio_reset, 1); | ^~~ drivers/gpu/drm/bridge/ite-it66121.c: In function ‘it66121_probe’: drivers/gpu/drm/bridge/ite-it66121.c:1016:16: error: implicit declaration of function ‘FIELD_GET’; did you mean ‘FOLL_GET’? [-Werror=implicit-function-declaration] 1016 | revision_id = FIELD_GET(IT66121_REVISION_MASK, device_ids[1]); | ^ | FOLL_GET Nothing difficult to fix, but the includes should be added nonetheless. Exact, I got the CI build failures, I'll fix these for v4. Were you able to test on your setup ? The v2 always forced DDR mode, with this v3, I also switch to normal 24input mode, but totally untested. I will try to find some time today to test after work. -Paul Thanks, Neil Cheers, -Paul Le lun. 12 avril 2021 à 17:46, Neil Armstrong a écrit : From: Phong LE This commit is a simple driver for bridge HMDI it66121. The input format is RBG and there is no color conversion. Audio, HDCP and CEC are not supported yet. Signed-off-by: Phong LE Signed-off-by: Neil Armstrong --- drivers/gpu/drm/bridge/Kconfig |8 + drivers/gpu/drm/bridge/Makefile |1 + drivers/gpu/drm/bridge/ite-it66121.c | 1081 ++ 3 files changed, 1090 insertions(+) create mode 100644 drivers/gpu/drm/bridge/ite-it66121.c diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index e4110d6ca7b3..6915c38fa459 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -74,6 +74,14 @@ config DRM_LONTIUM_LT9611UXC HDMI signals Please say Y if you have such hardware. +config DRM_ITE_IT66121 +tristate "ITE IT66121 HDMI bridge" +depends on OF +select DRM_KMS_HELPER +select REGMAP_I2C +help + Support for ITE IT66121 HDMI bridge. + config DRM_LVDS_CODEC tristate "Transparent LVDS encoders and decoders support" depends on OF diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index 86e7acc76f8d..4f725753117c 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -24,6 +24,7 @@ obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o obj-$(CONFIG_DRM_TI_TPD12S015) += ti-tpd12s015.o obj-$(CONFIG_DRM_NWL_MIPI_DSI) += nwl-dsi.o +obj-$(CONFIG_DRM_ITE_IT66121) += ite-it66121.o obj-y += analogix/ obj-y += cadence/ diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c new file mode 100644 index ..73af49b29dfa --- /dev/null +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -0,0 +1,1081 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2020 BayLibre, SAS + * Author: Phong LE + * Copyright (C) 2018-2019, Artem Mygaiev + * Copyright (C) 2017, Fresco Logic, Incorporated. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define IT66121_VENDOR_ID0_REG0x00 +#define IT66121_VENDOR_ID1_REG0x01 +#define IT66121_DEVICE_ID0_REG0x02 +#define IT66121_DEVICE_ID1_REG0x03 + +#define IT66121_VENDOR_ID00x54 +#define IT66121_VENDOR_ID10x49 +#define IT66121_DEVICE_ID00x12 +#define IT66121_DEVICE_ID10x06 +#define IT66121_REVISION_MASKGENMASK(7, 4) +#define IT66121_DEVICE_ID1_MASKGENMASK(3, 0) + +#define IT66121_MASTER_SEL_REG0x10 +#define IT66121_MASTER_SEL_HOSTBIT(0) + +#define IT66121_AFE_DRV_REG0x61 +#define IT66121_AFE_DRV_RSTBIT(4) +#define IT66121_AFE_DRV_PWDBIT(5) + +#define IT66121_INPUT_MODE_REG0x70 +#define IT66121_INPUT_MODE_RGB(0 << 6) +#define IT66121_INPUT_MODE_YUV422BIT(6) +#define IT66121_INPUT_MODE_YUV444(2 << 6) +#define IT66121_INPUT_MODE_CCIR656BIT(4) +#define IT66121_INPUT_MODE_SYNCEMBBIT(3) +#define IT66121_INPUT_MODE_DDRBIT(2) + +#define IT66121_INPUT_CSC_REG0x72 +#define IT66121_INPUT_CSC_ENDITHERBIT(7) +#define IT66121_INPUT_CSC_ENUDFILTERBIT(6) +#define IT66121_INPUT_CSC_DNFREE_GOBIT(5) +#define IT66121_INPUT_CSC_RGB_TO_YUV0x02 +#define IT66121_INPUT_CSC_YUV_TO_RGB0x03 +#define IT66121_INPUT_CSC_NO_CONV0x00 + +#define IT66121_AFE_XP_REG
Re: [PATCH v3 2/3] drm: bridge: add it66121 driver
On 14/04/2021 10:06, Robert Foss wrote: > On Wed, 14 Apr 2021 at 08:13, Neil Armstrong wrote: >> >> Hi Rob, >> >> Le 13/04/2021 à 22:21, Robert Foss a écrit : >>> Hey Neil & Phong, >>> >>> Thanks for submitting this series! >>> + +static const struct drm_bridge_funcs it66121_bridge_funcs = { + .attach = it66121_bridge_attach, + .enable = it66121_bridge_enable, + .disable = it66121_bridge_disable, + .mode_set = it66121_bridge_mode_set, + .mode_valid = it66121_bridge_mode_valid, + .detect = it66121_bridge_detect, + .get_edid = it66121_bridge_get_edid, + .atomic_get_output_bus_fmts = it66121_bridge_atomic_get_output_bus_fmts, + .atomic_get_input_bus_fmts = it66121_bridge_atomic_get_input_bus_fmts, +}; >>> >>> I would like to see an implementation of HPD, since it is supported by >>> the hardware[1] (and required by the documentation). IRQ status bit 0 >>> seems to be the responsible for notifying us about hot plug detection >>> events. >> >> It's implemented in the IRQ handler with the IT66121_INT_STATUS1_HPD_STATUS >> event. >> > > I didn't even get that far :) > > Either way, the HPD support should be exposed in drm_bridge_funcs > (.hpd_enable, .hpd_disable (and possibly .hpd_notify)) and > drm_bridge.ops (DRM_BRIDGE_OP_HPD). > Indeed I forgot these calls in the NO_CONNECTOR implementation... Neil
Re: [PATCH v3 2/3] drm: bridge: add it66121 driver
On Wed, 14 Apr 2021 at 08:13, Neil Armstrong wrote: > > Hi Rob, > > Le 13/04/2021 à 22:21, Robert Foss a écrit : > > Hey Neil & Phong, > > > > Thanks for submitting this series! > > > >> + > >> +static const struct drm_bridge_funcs it66121_bridge_funcs = { > >> + .attach = it66121_bridge_attach, > >> + .enable = it66121_bridge_enable, > >> + .disable = it66121_bridge_disable, > >> + .mode_set = it66121_bridge_mode_set, > >> + .mode_valid = it66121_bridge_mode_valid, > >> + .detect = it66121_bridge_detect, > >> + .get_edid = it66121_bridge_get_edid, > >> + .atomic_get_output_bus_fmts = > >> it66121_bridge_atomic_get_output_bus_fmts, > >> + .atomic_get_input_bus_fmts = > >> it66121_bridge_atomic_get_input_bus_fmts, > >> +}; > > > > I would like to see an implementation of HPD, since it is supported by > > the hardware[1] (and required by the documentation). IRQ status bit 0 > > seems to be the responsible for notifying us about hot plug detection > > events. > > It's implemented in the IRQ handler with the IT66121_INT_STATUS1_HPD_STATUS > event. > I didn't even get that far :) Either way, the HPD support should be exposed in drm_bridge_funcs (.hpd_enable, .hpd_disable (and possibly .hpd_notify)) and drm_bridge.ops (DRM_BRIDGE_OP_HPD).
Re: [PATCH v3 2/3] drm: bridge: add it66121 driver
Hi, Le 13/04/2021 à 22:56, Paul Cercueil a écrit : > Hi Neil, > > I get build failures locally: > > drivers/gpu/drm/bridge/ite-it66121.c: In function ‘it66121_hw_reset’: > drivers/gpu/drm/bridge/ite-it66121.c:242:2: error: implicit declaration of > function ‘gpiod_set_value’ [-Werror=implicit-function-declaration] > 242 | gpiod_set_value(ctx->gpio_reset, 1); > | ^~~ > drivers/gpu/drm/bridge/ite-it66121.c: In function ‘it66121_probe’: > drivers/gpu/drm/bridge/ite-it66121.c:1016:16: error: implicit declaration of > function ‘FIELD_GET’; did you mean ‘FOLL_GET’? > [-Werror=implicit-function-declaration] > 1016 | revision_id = FIELD_GET(IT66121_REVISION_MASK, device_ids[1]); > | ^ > | FOLL_GET > > Nothing difficult to fix, but the includes should be added nonetheless. Exact, I got the CI build failures, I'll fix these for v4. Were you able to test on your setup ? The v2 always forced DDR mode, with this v3, I also switch to normal 24input mode, but totally untested. Thanks, Neil > > Cheers, > -Paul > > > Le lun. 12 avril 2021 à 17:46, Neil Armstrong a > écrit : >> From: Phong LE >> >> This commit is a simple driver for bridge HMDI it66121. >> The input format is RBG and there is no color conversion. >> Audio, HDCP and CEC are not supported yet. >> >> Signed-off-by: Phong LE >> Signed-off-by: Neil Armstrong >> --- >> drivers/gpu/drm/bridge/Kconfig | 8 + >> drivers/gpu/drm/bridge/Makefile | 1 + >> drivers/gpu/drm/bridge/ite-it66121.c | 1081 ++ >> 3 files changed, 1090 insertions(+) >> create mode 100644 drivers/gpu/drm/bridge/ite-it66121.c >> >> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig >> index e4110d6ca7b3..6915c38fa459 100644 >> --- a/drivers/gpu/drm/bridge/Kconfig >> +++ b/drivers/gpu/drm/bridge/Kconfig >> @@ -74,6 +74,14 @@ config DRM_LONTIUM_LT9611UXC >> HDMI signals >> Please say Y if you have such hardware. >> >> +config DRM_ITE_IT66121 >> + tristate "ITE IT66121 HDMI bridge" >> + depends on OF >> + select DRM_KMS_HELPER >> + select REGMAP_I2C >> + help >> + Support for ITE IT66121 HDMI bridge. >> + >> config DRM_LVDS_CODEC >> tristate "Transparent LVDS encoders and decoders support" >> depends on OF >> diff --git a/drivers/gpu/drm/bridge/Makefile >> b/drivers/gpu/drm/bridge/Makefile >> index 86e7acc76f8d..4f725753117c 100644 >> --- a/drivers/gpu/drm/bridge/Makefile >> +++ b/drivers/gpu/drm/bridge/Makefile >> @@ -24,6 +24,7 @@ obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o >> obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o >> obj-$(CONFIG_DRM_TI_TPD12S015) += ti-tpd12s015.o >> obj-$(CONFIG_DRM_NWL_MIPI_DSI) += nwl-dsi.o >> +obj-$(CONFIG_DRM_ITE_IT66121) += ite-it66121.o >> >> obj-y += analogix/ >> obj-y += cadence/ >> diff --git a/drivers/gpu/drm/bridge/ite-it66121.c >> b/drivers/gpu/drm/bridge/ite-it66121.c >> new file mode 100644 >> index ..73af49b29dfa >> --- /dev/null >> +++ b/drivers/gpu/drm/bridge/ite-it66121.c >> @@ -0,0 +1,1081 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + * Copyright (C) 2020 BayLibre, SAS >> + * Author: Phong LE >> + * Copyright (C) 2018-2019, Artem Mygaiev >> + * Copyright (C) 2017, Fresco Logic, Incorporated. >> + * >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#define IT66121_VENDOR_ID0_REG 0x00 >> +#define IT66121_VENDOR_ID1_REG 0x01 >> +#define IT66121_DEVICE_ID0_REG 0x02 >> +#define IT66121_DEVICE_ID1_REG 0x03 >> + >> +#define IT66121_VENDOR_ID0 0x54 >> +#define IT66121_VENDOR_ID1 0x49 >> +#define IT66121_DEVICE_ID0 0x12 >> +#define IT66121_DEVICE_ID1 0x06 >> +#define IT66121_REVISION_MASK GENMASK(7, 4) >> +#define IT66121_DEVICE_ID1_MASK GENMASK(3, 0) >> + >> +#define IT66121_MASTER_SEL_REG 0x10 >> +#define IT66121_MASTER_SEL_HOST BIT(0) >> + >> +#define IT66121_AFE_DRV_REG 0x61 >> +#define IT66121_AFE_DRV_RST BIT(4) >> +#define IT66121_AFE_DRV_PWD BIT(5) >> + >> +#define IT66121_INPUT_MODE_REG 0x70 >> +#define IT66121_INPUT_MODE_RGB (0 << 6) >> +#define IT66121_INPUT_MODE_YUV422 BIT(6) >> +#define IT66121_INPUT_MODE_YUV444 (2 << 6) >> +#define IT66121_INPUT_MODE_CCIR656 BIT(4) >> +#define IT66121_INPUT_MODE_SYNCEMB BIT(3) >> +#define IT66121_INPUT_MODE_DDR BIT(2) >> + >> +#define IT66121_INPUT_CSC_REG 0x72 >> +#define IT66121_INPUT_CSC_ENDITHER BIT(7) >> +#define IT66121_INPUT_CSC_ENUDFILTER BIT(6) >> +#define IT66121_INPUT_CSC_DNFREE_GO BIT(5) >> +#define IT66121_INPUT_CSC_RGB_TO_YUV 0x02 >> +#define IT
Re: [PATCH v3 2/3] drm: bridge: add it66121 driver
Hi Rob, Le 13/04/2021 à 22:21, Robert Foss a écrit : > Hey Neil & Phong, > > Thanks for submitting this series! > >> + >> +static const struct drm_bridge_funcs it66121_bridge_funcs = { >> + .attach = it66121_bridge_attach, >> + .enable = it66121_bridge_enable, >> + .disable = it66121_bridge_disable, >> + .mode_set = it66121_bridge_mode_set, >> + .mode_valid = it66121_bridge_mode_valid, >> + .detect = it66121_bridge_detect, >> + .get_edid = it66121_bridge_get_edid, >> + .atomic_get_output_bus_fmts = >> it66121_bridge_atomic_get_output_bus_fmts, >> + .atomic_get_input_bus_fmts = >> it66121_bridge_atomic_get_input_bus_fmts, >> +}; > > I would like to see an implementation of HPD, since it is supported by > the hardware[1] (and required by the documentation). IRQ status bit 0 > seems to be the responsible for notifying us about hot plug detection > events. It's implemented in the IRQ handler with the IT66121_INT_STATUS1_HPD_STATUS event. Neil > > [1] https://rockchip.fr/radxa/IT66121_Programming_Guide.v1.05.pdf > > > Rob. >
Re: [PATCH v3 2/3] drm: bridge: add it66121 driver
Hi Neil, I get build failures locally: drivers/gpu/drm/bridge/ite-it66121.c: In function ‘it66121_hw_reset’: drivers/gpu/drm/bridge/ite-it66121.c:242:2: error: implicit declaration of function ‘gpiod_set_value’ [-Werror=implicit-function-declaration] 242 | gpiod_set_value(ctx->gpio_reset, 1); | ^~~ drivers/gpu/drm/bridge/ite-it66121.c: In function ‘it66121_probe’: drivers/gpu/drm/bridge/ite-it66121.c:1016:16: error: implicit declaration of function ‘FIELD_GET’; did you mean ‘FOLL_GET’? [-Werror=implicit-function-declaration] 1016 | revision_id = FIELD_GET(IT66121_REVISION_MASK, device_ids[1]); | ^ | FOLL_GET Nothing difficult to fix, but the includes should be added nonetheless. Cheers, -Paul Le lun. 12 avril 2021 à 17:46, Neil Armstrong a écrit : From: Phong LE This commit is a simple driver for bridge HMDI it66121. The input format is RBG and there is no color conversion. Audio, HDCP and CEC are not supported yet. Signed-off-by: Phong LE Signed-off-by: Neil Armstrong --- drivers/gpu/drm/bridge/Kconfig |8 + drivers/gpu/drm/bridge/Makefile |1 + drivers/gpu/drm/bridge/ite-it66121.c | 1081 ++ 3 files changed, 1090 insertions(+) create mode 100644 drivers/gpu/drm/bridge/ite-it66121.c diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index e4110d6ca7b3..6915c38fa459 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -74,6 +74,14 @@ config DRM_LONTIUM_LT9611UXC HDMI signals Please say Y if you have such hardware. +config DRM_ITE_IT66121 + tristate "ITE IT66121 HDMI bridge" + depends on OF + select DRM_KMS_HELPER + select REGMAP_I2C + help + Support for ITE IT66121 HDMI bridge. + config DRM_LVDS_CODEC tristate "Transparent LVDS encoders and decoders support" depends on OF diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index 86e7acc76f8d..4f725753117c 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -24,6 +24,7 @@ obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o obj-$(CONFIG_DRM_TI_TPD12S015) += ti-tpd12s015.o obj-$(CONFIG_DRM_NWL_MIPI_DSI) += nwl-dsi.o +obj-$(CONFIG_DRM_ITE_IT66121) += ite-it66121.o obj-y += analogix/ obj-y += cadence/ diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c new file mode 100644 index ..73af49b29dfa --- /dev/null +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -0,0 +1,1081 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2020 BayLibre, SAS + * Author: Phong LE + * Copyright (C) 2018-2019, Artem Mygaiev + * Copyright (C) 2017, Fresco Logic, Incorporated. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define IT66121_VENDOR_ID0_REG 0x00 +#define IT66121_VENDOR_ID1_REG 0x01 +#define IT66121_DEVICE_ID0_REG 0x02 +#define IT66121_DEVICE_ID1_REG 0x03 + +#define IT66121_VENDOR_ID0 0x54 +#define IT66121_VENDOR_ID1 0x49 +#define IT66121_DEVICE_ID0 0x12 +#define IT66121_DEVICE_ID1 0x06 +#define IT66121_REVISION_MASK GENMASK(7, 4) +#define IT66121_DEVICE_ID1_MASKGENMASK(3, 0) + +#define IT66121_MASTER_SEL_REG 0x10 +#define IT66121_MASTER_SEL_HOSTBIT(0) + +#define IT66121_AFE_DRV_REG0x61 +#define IT66121_AFE_DRV_RSTBIT(4) +#define IT66121_AFE_DRV_PWDBIT(5) + +#define IT66121_INPUT_MODE_REG 0x70 +#define IT66121_INPUT_MODE_RGB (0 << 6) +#define IT66121_INPUT_MODE_YUV422 BIT(6) +#define IT66121_INPUT_MODE_YUV444 (2 << 6) +#define IT66121_INPUT_MODE_CCIR656 BIT(4) +#define IT66121_INPUT_MODE_SYNCEMB BIT(3) +#define IT66121_INPUT_MODE_DDR BIT(2) + +#define IT66121_INPUT_CSC_REG 0x72 +#define IT66121_INPUT_CSC_ENDITHER BIT(7) +#define IT66121_INPUT_CSC_ENUDFILTER BIT(6) +#define IT66121_INPUT_CSC_DNFREE_GOBIT(5) +#define IT66121_INPUT_CSC_RGB_TO_YUV 0x02 +#define IT66121_INPUT_CSC_YUV_TO_RGB 0x03 +#define IT66121_INPUT_CSC_NO_CONV 0x00 + +#define IT66121_AFE_XP_REG 0x62 +#define IT66121_AFE_XP_GAINBIT BIT(7) +#define IT66121_AFE_XP_PWDPLL BIT(6) +#define IT66121_AFE_XP_ENI BIT(5) +#define IT66121_AFE_XP_ENO BIT(4) +#define IT66121_AFE_XP_RESETB BIT(3) +#define IT6612
Re: [PATCH v3 2/3] drm: bridge: add it66121 driver
Hey Neil & Phong, Thanks for submitting this series! > + > +static const struct drm_bridge_funcs it66121_bridge_funcs = { > + .attach = it66121_bridge_attach, > + .enable = it66121_bridge_enable, > + .disable = it66121_bridge_disable, > + .mode_set = it66121_bridge_mode_set, > + .mode_valid = it66121_bridge_mode_valid, > + .detect = it66121_bridge_detect, > + .get_edid = it66121_bridge_get_edid, > + .atomic_get_output_bus_fmts = > it66121_bridge_atomic_get_output_bus_fmts, > + .atomic_get_input_bus_fmts = it66121_bridge_atomic_get_input_bus_fmts, > +}; I would like to see an implementation of HPD, since it is supported by the hardware[1] (and required by the documentation). IRQ status bit 0 seems to be the responsible for notifying us about hot plug detection events. [1] https://rockchip.fr/radxa/IT66121_Programming_Guide.v1.05.pdf Rob.
[PATCH v3 2/3] drm: bridge: add it66121 driver
From: Phong LE This commit is a simple driver for bridge HMDI it66121. The input format is RBG and there is no color conversion. Audio, HDCP and CEC are not supported yet. Signed-off-by: Phong LE Signed-off-by: Neil Armstrong --- drivers/gpu/drm/bridge/Kconfig |8 + drivers/gpu/drm/bridge/Makefile |1 + drivers/gpu/drm/bridge/ite-it66121.c | 1081 ++ 3 files changed, 1090 insertions(+) create mode 100644 drivers/gpu/drm/bridge/ite-it66121.c diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index e4110d6ca7b3..6915c38fa459 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -74,6 +74,14 @@ config DRM_LONTIUM_LT9611UXC HDMI signals Please say Y if you have such hardware. +config DRM_ITE_IT66121 + tristate "ITE IT66121 HDMI bridge" + depends on OF + select DRM_KMS_HELPER + select REGMAP_I2C + help + Support for ITE IT66121 HDMI bridge. + config DRM_LVDS_CODEC tristate "Transparent LVDS encoders and decoders support" depends on OF diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index 86e7acc76f8d..4f725753117c 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -24,6 +24,7 @@ obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o obj-$(CONFIG_DRM_TI_TPD12S015) += ti-tpd12s015.o obj-$(CONFIG_DRM_NWL_MIPI_DSI) += nwl-dsi.o +obj-$(CONFIG_DRM_ITE_IT66121) += ite-it66121.o obj-y += analogix/ obj-y += cadence/ diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c new file mode 100644 index ..73af49b29dfa --- /dev/null +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -0,0 +1,1081 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2020 BayLibre, SAS + * Author: Phong LE + * Copyright (C) 2018-2019, Artem Mygaiev + * Copyright (C) 2017, Fresco Logic, Incorporated. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define IT66121_VENDOR_ID0_REG 0x00 +#define IT66121_VENDOR_ID1_REG 0x01 +#define IT66121_DEVICE_ID0_REG 0x02 +#define IT66121_DEVICE_ID1_REG 0x03 + +#define IT66121_VENDOR_ID0 0x54 +#define IT66121_VENDOR_ID1 0x49 +#define IT66121_DEVICE_ID0 0x12 +#define IT66121_DEVICE_ID1 0x06 +#define IT66121_REVISION_MASK GENMASK(7, 4) +#define IT66121_DEVICE_ID1_MASKGENMASK(3, 0) + +#define IT66121_MASTER_SEL_REG 0x10 +#define IT66121_MASTER_SEL_HOSTBIT(0) + +#define IT66121_AFE_DRV_REG0x61 +#define IT66121_AFE_DRV_RSTBIT(4) +#define IT66121_AFE_DRV_PWDBIT(5) + +#define IT66121_INPUT_MODE_REG 0x70 +#define IT66121_INPUT_MODE_RGB (0 << 6) +#define IT66121_INPUT_MODE_YUV422 BIT(6) +#define IT66121_INPUT_MODE_YUV444 (2 << 6) +#define IT66121_INPUT_MODE_CCIR656 BIT(4) +#define IT66121_INPUT_MODE_SYNCEMB BIT(3) +#define IT66121_INPUT_MODE_DDR BIT(2) + +#define IT66121_INPUT_CSC_REG 0x72 +#define IT66121_INPUT_CSC_ENDITHER BIT(7) +#define IT66121_INPUT_CSC_ENUDFILTER BIT(6) +#define IT66121_INPUT_CSC_DNFREE_GOBIT(5) +#define IT66121_INPUT_CSC_RGB_TO_YUV 0x02 +#define IT66121_INPUT_CSC_YUV_TO_RGB 0x03 +#define IT66121_INPUT_CSC_NO_CONV 0x00 + +#define IT66121_AFE_XP_REG 0x62 +#define IT66121_AFE_XP_GAINBIT BIT(7) +#define IT66121_AFE_XP_PWDPLL BIT(6) +#define IT66121_AFE_XP_ENI BIT(5) +#define IT66121_AFE_XP_ENO BIT(4) +#define IT66121_AFE_XP_RESETB BIT(3) +#define IT66121_AFE_XP_PWDIBIT(2) + +#define IT66121_AFE_IP_REG 0x64 +#define IT66121_AFE_IP_GAINBIT BIT(7) +#define IT66121_AFE_IP_PWDPLL BIT(6) +#define IT66121_AFE_IP_CKSEL_05(0 << 4) +#define IT66121_AFE_IP_CKSEL_1 BIT(4) +#define IT66121_AFE_IP_CKSEL_2 (2 << 4) +#define IT66121_AFE_IP_CKSEL_2OR4 (3 << 4) +#define IT66121_AFE_IP_ER0 BIT(3) +#define IT66121_AFE_IP_RESETB BIT(2) +#define IT66121_AFE_IP_ENC BIT(1) +#define IT66121_AFE_IP_EC1 BIT(0) + +#define IT66121_AFE_XP_EC1_REG 0x68 +#define IT66121_AFE_XP_EC1_LOWCLK BIT(4) + +#define IT66121_SW_RST_REG