Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2126185pxt; Sun, 8 Aug 2021 12:29:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziEzAwlcCmw+kELePKCk8YHkagxYjXxvN5dDn20sVbTJwDiZxjAu1a1Ah19dK/5DGhQCTs X-Received: by 2002:a92:cacd:: with SMTP id m13mr314003ilq.256.1628450950899; Sun, 08 Aug 2021 12:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628450950; cv=none; d=google.com; s=arc-20160816; b=vgsF4Rl/2/RIpT3wQbpFDsCxZP3I0osyQ/0Q33YaP4bT6O4kT1T9w4B094cpLwUg/F nkVOCU8HBGpsQ/1IJyG5J7Tac+sGX1UwkgOeX5qOzbQBnbgVcQ3YSjSHNAfbQcWJ7uc9 de4NbNcawACIro9QUjH165kBuoPOn/pHKAoL9meZgBNLUDouby5YXHk5IJZ/fCSDFDBV +NywrL8gFElOj4l9Tp7GVL1IJ9tGW+ddB8mV3la5y+KXlbG/876EaYxtS+guBYMbzrHd K1JIXBzFtugdEiWCUK1rJ4EOa0wWfAN2YANMptWAgNbF7TD0PEymxg+6Ut5bJ9xIMb92 9m6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=ca5agvdpH47UdCKutw4aqDEPuxfWFoDVxh4n8DsPct0=; b=j+fY3deXUfCGdu4jNTpQnPsvvLLzSl7Ayf5ft4bQz8Ki0frShgZ3rnNOb7TPBBT6AZ XBuy1VHeTvkHa/NJf3J9NPuXUQ+KbTYXgwGQRvd2SljpA2SaV3UqD9N9XJZLDHwJ5Ijl TxzEUOqmDqnjIvxQHB99v9rZMbvLQ4jPYtLvplIMUxJ6gTDQhwEXIQkmu2kbU1DUFTmV FsnvZGjQcX4wn+Qs4U6+cRM4rNWvFsdSrMDiogmMf5rv+b+x5tb4p8UWvYpYbeQyAni9 1T2lAkFZe5b04/LK7veLzx6F9lNSiU79NPO2fuU/cnKwZvRAqRoof7O+IvZAL4aVauAJ U5XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b="VX7k/543"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si15802997iow.19.2021.08.08.12.28.59; Sun, 08 Aug 2021 12:29:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b="VX7k/543"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232209AbhHHS5x (ORCPT + 99 others); Sun, 8 Aug 2021 14:57:53 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([81.169.146.166]:10359 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbhHHS5t (ORCPT ); Sun, 8 Aug 2021 14:57:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1628449030; s=strato-dkim-0002; d=goldelico.com; h=To:References:Message-Id:Cc:Date:In-Reply-To:From:Subject:Cc:Date: From:Subject:Sender; bh=ca5agvdpH47UdCKutw4aqDEPuxfWFoDVxh4n8DsPct0=; b=VX7k/543evno7uHfXmssrcvxRqoWNpGrKxq+mXHqZgu/A0naeV0s/6xbydh1ZeykcY Qedapxi0lWv9mRVpF8O0gXmff+rmGQkLD/tJq5O4LA3r3wvUfjBxFVrQG2zMCmcsimMe rDGnH4+vVtdm1P/5GuTVRXc7Ntpg5itmDcA1ntOvirJtawPpnjCOsAN9Y5j8BLM9SKHC bGhhxFzgyJxxLuJU2ELJCu0IkZJJCAY5uHtWwyFcldPXkadxzQ9VPl9sKCCJ860GxqBa IvennLik8/35M+Gr0t5ThhFVNIWH8x5gL5308P8dssomAbPFXNffNxzqRLbhd9w8/w2K NXew== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMgPgp8VKxflSZ1P34KBj4Qpw9iZeHWElw43u3mM=" X-RZG-CLASS-ID: mo00 Received: from imac.fritz.box by smtp.strato.de (RZmta 47.31.0 DYNA|AUTH) with ESMTPSA id Q02727x78Iv9GaV (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Sun, 8 Aug 2021 20:57:09 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: [PATCH 8/8] drm/ingenic: Attach bridge chain to encoders From: "H. Nikolaus Schaller" In-Reply-To: <20210808134526.119198-9-paul@crapouillou.net> Date: Sun, 8 Aug 2021 20:57:09 +0200 Cc: David Airlie , Daniel Vetter , Paul Boddie , list@opendingux.net, Sam Ravnborg , linux-mips , dri-devel , linux-kernel , Discussions about the Letux Kernel Content-Transfer-Encoding: quoted-printable Message-Id: <2AEC5953-FE54-4DD5-88B7-783C4D9E23B2@goldelico.com> References: <20210808134526.119198-1-paul@crapouillou.net> <20210808134526.119198-9-paul@crapouillou.net> To: Paul Cercueil X-Mailer: Apple Mail (2.3445.104.21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, all other patches apply cleanly but this one fails on top of v5.14-rc4. What base are you using? BR and thanks, Nikolaus > Am 08.08.2021 um 15:45 schrieb Paul Cercueil : >=20 > Attach a top-level bridge to each encoder, which will be used for > negociating the bus format and flags. >=20 > All the bridges are now attached with DRM_BRIDGE_ATTACH_NO_CONNECTOR. >=20 > Signed-off-by: Paul Cercueil > --- > drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 92 +++++++++++++++++------ > 1 file changed, 70 insertions(+), 22 deletions(-) >=20 > diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c = b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c > index 7ae48ead3ab6..09d5dd298078 100644 > --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c > +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c > @@ -21,6 +21,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -107,6 +108,19 @@ struct ingenic_drm { > struct drm_private_obj private_obj; > }; >=20 > +struct ingenic_drm_bridge { > + struct drm_encoder encoder; > + struct drm_bridge bridge, *next_bridge; > + > + struct drm_bus_cfg bus_cfg; > +}; > + > +static inline struct ingenic_drm_bridge * > +to_ingenic_drm_bridge(struct drm_encoder *encoder) > +{ > + return container_of(encoder, struct ingenic_drm_bridge, = encoder); > +} > + > static inline struct ingenic_drm_private_state * > to_ingenic_drm_priv_state(struct drm_private_state *state) > { > @@ -679,11 +693,10 @@ static void = ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder, > { > struct ingenic_drm *priv =3D drm_device_get_priv(encoder->dev); > struct drm_display_mode *mode =3D &crtc_state->adjusted_mode; > - struct drm_connector *conn =3D conn_state->connector; > - struct drm_display_info *info =3D &conn->display_info; > + struct ingenic_drm_bridge *bridge =3D = to_ingenic_drm_bridge(encoder); > unsigned int cfg, rgbcfg =3D 0; >=20 > - priv->panel_is_sharp =3D info->bus_flags & = DRM_BUS_FLAG_SHARP_SIGNALS; > + priv->panel_is_sharp =3D bridge->bus_cfg.flags & = DRM_BUS_FLAG_SHARP_SIGNALS; >=20 > if (priv->panel_is_sharp) { > cfg =3D JZ_LCD_CFG_MODE_SPECIAL_TFT_1 | = JZ_LCD_CFG_REV_POLARITY; > @@ -696,19 +709,19 @@ static void = ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder, > cfg |=3D JZ_LCD_CFG_HSYNC_ACTIVE_LOW; > if (mode->flags & DRM_MODE_FLAG_NVSYNC) > cfg |=3D JZ_LCD_CFG_VSYNC_ACTIVE_LOW; > - if (info->bus_flags & DRM_BUS_FLAG_DE_LOW) > + if (bridge->bus_cfg.flags & DRM_BUS_FLAG_DE_LOW) > cfg |=3D JZ_LCD_CFG_DE_ACTIVE_LOW; > - if (info->bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE) > + if (bridge->bus_cfg.flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE) > cfg |=3D JZ_LCD_CFG_PCLK_FALLING_EDGE; >=20 > if (!priv->panel_is_sharp) { > - if (conn->connector_type =3D=3D DRM_MODE_CONNECTOR_TV) { > + if (conn_state->connector->connector_type =3D=3D = DRM_MODE_CONNECTOR_TV) { > if (mode->flags & DRM_MODE_FLAG_INTERLACE) > cfg |=3D JZ_LCD_CFG_MODE_TV_OUT_I; > else > cfg |=3D JZ_LCD_CFG_MODE_TV_OUT_P; > } else { > - switch (*info->bus_formats) { > + switch (bridge->bus_cfg.format) { > case MEDIA_BUS_FMT_RGB565_1X16: > cfg |=3D JZ_LCD_CFG_MODE_GENERIC_16BIT; > break; > @@ -734,20 +747,29 @@ static void = ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder, > regmap_write(priv->map, JZ_REG_LCD_RGBC, rgbcfg); > } >=20 > -static int ingenic_drm_encoder_atomic_check(struct drm_encoder = *encoder, > - struct drm_crtc_state = *crtc_state, > - struct drm_connector_state = *conn_state) > +static int ingenic_drm_bridge_attach(struct drm_bridge *bridge, > + enum drm_bridge_attach_flags flags) > +{ > + struct ingenic_drm_bridge *ib =3D = to_ingenic_drm_bridge(bridge->encoder); > + > + return drm_bridge_attach(bridge->encoder, ib->next_bridge, > + &ib->bridge, flags); > +} > + > +static int ingenic_drm_bridge_atomic_check(struct drm_bridge *bridge, > + struct drm_bridge_state = *bridge_state, > + struct drm_crtc_state = *crtc_state, > + struct drm_connector_state = *conn_state) > { > - struct drm_display_info *info =3D = &conn_state->connector->display_info; > struct drm_display_mode *mode =3D &crtc_state->adjusted_mode; > + struct ingenic_drm_bridge *ib =3D = to_ingenic_drm_bridge(bridge->encoder); >=20 > - if (info->num_bus_formats !=3D 1) > - return -EINVAL; > + ib->bus_cfg =3D bridge_state->output_bus_cfg; >=20 > if (conn_state->connector->connector_type =3D=3D = DRM_MODE_CONNECTOR_TV) > return 0; >=20 > - switch (*info->bus_formats) { > + switch (bridge_state->output_bus_cfg.format) { > case MEDIA_BUS_FMT_RGB888_3X8: > case MEDIA_BUS_FMT_RGB888_3X8_DELTA: > /* > @@ -911,8 +933,16 @@ static const struct drm_crtc_helper_funcs = ingenic_drm_crtc_helper_funcs =3D { > }; >=20 > static const struct drm_encoder_helper_funcs = ingenic_drm_encoder_helper_funcs =3D { > - .atomic_mode_set =3D ingenic_drm_encoder_atomic_mode_set, > - .atomic_check =3D ingenic_drm_encoder_atomic_check, > + .atomic_mode_set =3D ingenic_drm_encoder_atomic_mode_set, > +}; > + > +static const struct drm_bridge_funcs ingenic_drm_bridge_funcs =3D { > + .attach =3D ingenic_drm_bridge_attach, > + .atomic_check =3D ingenic_drm_bridge_atomic_check, > + .atomic_reset =3D drm_atomic_helper_bridge_reset, > + .atomic_duplicate_state =3D = drm_atomic_helper_bridge_duplicate_state, > + .atomic_destroy_state =3D = drm_atomic_helper_bridge_destroy_state, > + .atomic_get_input_bus_fmts =3D = drm_atomic_helper_bridge_propagate_bus_fmt, > }; >=20 > static const struct drm_mode_config_funcs = ingenic_drm_mode_config_funcs =3D { > @@ -958,7 +988,9 @@ static int ingenic_drm_bind(struct device *dev, = bool has_components) > struct drm_plane *primary; > struct drm_bridge *bridge; > struct drm_panel *panel; > + struct drm_connector *connector; > struct drm_encoder *encoder; > + struct ingenic_drm_bridge *ib; > struct drm_device *drm; > void __iomem *base; > long parent_rate; > @@ -1146,20 +1178,36 @@ static int ingenic_drm_bind(struct device = *dev, bool has_components) > bridge =3D devm_drm_panel_bridge_add_typed(dev, = panel, > = DRM_MODE_CONNECTOR_DPI); >=20 > - encoder =3D drmm_plain_encoder_alloc(drm, NULL, = DRM_MODE_ENCODER_DPI, NULL); > - if (IS_ERR(encoder)) { > - ret =3D PTR_ERR(encoder); > + ib =3D drmm_encoder_alloc(drm, struct = ingenic_drm_bridge, encoder, > + NULL, DRM_MODE_ENCODER_DPI, = NULL); > + if (IS_ERR(ib)) { > + ret =3D PTR_ERR(ib); > dev_err(dev, "Failed to init encoder: %d\n", = ret); > return ret; > } >=20 > - encoder->possible_crtcs =3D 1; > + encoder =3D &ib->encoder; > + encoder->possible_crtcs =3D drm_crtc_mask(&priv->crtc); >=20 > drm_encoder_helper_add(encoder, = &ingenic_drm_encoder_helper_funcs); >=20 > - ret =3D drm_bridge_attach(encoder, bridge, NULL, 0); > - if (ret) > + ib->bridge.funcs =3D &ingenic_drm_bridge_funcs; > + ib->next_bridge =3D bridge; > + > + ret =3D drm_bridge_attach(encoder, &ib->bridge, NULL, > + DRM_BRIDGE_ATTACH_NO_CONNECTOR); > + if (ret) { > + dev_err(dev, "Unable to attach bridge\n"); > return ret; > + } > + > + connector =3D drm_bridge_connector_init(drm, encoder); > + if (IS_ERR(connector)) { > + dev_err(dev, "Unable to init connector\n"); > + return PTR_ERR(connector); > + } > + > + drm_connector_attach_encoder(connector, encoder); > } >=20 > drm_for_each_encoder(encoder, drm) { > --=20 > 2.30.2 >=20