Re: [PATCH v4 04/15] drm/bridge: tc358764: add drm_panel_bridge support
Hi Laurent, On 03.09.2020 11:59, Laurent Pinchart wrote: > Hi Andrzej, > > On Thu, Sep 03, 2020 at 11:40:58AM +0200, Andrzej Hajda wrote: >> On 26.07.2020 22:33, Sam Ravnborg wrote: >>> Prepare the tc358764 bridge driver for use in a chained setup by >>> replacing direct use of drm_panel with drm_panel_bridge support. >>> >>> The bridge panel will use the connector type reported by the panel, >>> where the connector for this driver hardcodes DRM_MODE_CONNECTOR_LVDS. >>> >>> The tc358764 did not any additional info the the connector so the >>> connector creation is passed to the bridge panel driver. >>> >>> v3: >>> - Merge with patch to make connector creation optional to avoid >>> creating two connectors (Laurent) >>> - Pass connector creation to bridge panel, as this bridge driver >>> did not add any extra info to the connector. >>> - Set bridge.type to DRM_MODE_CONNECTOR_LVDS. >>> >>> v2: >>> - Use PTR_ERR_OR_ZERO() (kbuild test robot) >>> >>> Signed-off-by: Sam Ravnborg >>> Cc: Laurent Pinchart >>> Cc: kbuild test robot >>> Cc: Andrzej Hajda >>> Cc: Neil Armstrong >>> Cc: Jonas Karlman >>> Cc: Jernej Skrabec >>> --- >>>drivers/gpu/drm/bridge/tc358764.c | 107 +- >>>1 file changed, 16 insertions(+), 91 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/bridge/tc358764.c >>> b/drivers/gpu/drm/bridge/tc358764.c >>> index a277739fab58..fdde4cfdc724 100644 >>> --- a/drivers/gpu/drm/bridge/tc358764.c >>> +++ b/drivers/gpu/drm/bridge/tc358764.c >>> @@ -153,10 +153,9 @@ static const char * const tc358764_supplies[] = { >>>struct tc358764 { >>> struct device *dev; >>> struct drm_bridge bridge; >>> - struct drm_connector connector; >>> struct regulator_bulk_data supplies[ARRAY_SIZE(tc358764_supplies)]; >>> struct gpio_desc *gpio_reset; >>> - struct drm_panel *panel; >>> + struct drm_bridge *panel_bridge; >>> int error; >>>}; >>> >>> @@ -210,12 +209,6 @@ static inline struct tc358764 >>> *bridge_to_tc358764(struct drm_bridge *bridge) >>> return container_of(bridge, struct tc358764, bridge); >>>} >>> >>> -static inline >>> -struct tc358764 *connector_to_tc358764(struct drm_connector *connector) >>> -{ >>> - return container_of(connector, struct tc358764, connector); >>> -} >>> - >>>static int tc358764_init(struct tc358764 *ctx) >>>{ >>> u32 v = 0; >>> @@ -278,43 +271,11 @@ static void tc358764_reset(struct tc358764 *ctx) >>> usleep_range(1000, 2000); >>>} >>> >>> -static int tc358764_get_modes(struct drm_connector *connector) >>> -{ >>> - struct tc358764 *ctx = connector_to_tc358764(connector); >>> - >>> - return drm_panel_get_modes(ctx->panel, connector); >>> -} >>> - >>> -static const >>> -struct drm_connector_helper_funcs tc358764_connector_helper_funcs = { >>> - .get_modes = tc358764_get_modes, >>> -}; >>> - >>> -static const struct drm_connector_funcs tc358764_connector_funcs = { >>> - .fill_modes = drm_helper_probe_single_connector_modes, >>> - .destroy = drm_connector_cleanup, >>> - .reset = drm_atomic_helper_connector_reset, >>> - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, >>> - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, >>> -}; >>> - >>> -static void tc358764_disable(struct drm_bridge *bridge) >>> -{ >>> - struct tc358764 *ctx = bridge_to_tc358764(bridge); >>> - int ret = drm_panel_disable(bridge_to_tc358764(bridge)->panel); >>> - >>> - if (ret < 0) >>> - dev_err(ctx->dev, "error disabling panel (%d)\n", ret); >>> -} >>> - >>>static void tc358764_post_disable(struct drm_bridge *bridge) >>>{ >>> struct tc358764 *ctx = bridge_to_tc358764(bridge); >>> int ret; >>> >>> - ret = drm_panel_unprepare(ctx->panel); >>> - if (ret < 0) >>> - dev_err(ctx->dev, "error unpreparing panel (%d)\n", ret); >> >> Using this bridge_panel thing you reverse order of hw >> initialization/de-initialization, this is incorrect. >> >> For example: >> >> - panel_unprepare should be called before tc35* turn off, >> >> - panel_prepare should be called after tc35* on. >> >> This is why I avoid the whole "bridge chaining" - it enforces ridiculous >> order of initialization. >> >> >>> tc358764_reset(ctx); >>> usleep_range(1, 15000); >>> ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); >>> @@ -335,70 +296,28 @@ static void tc358764_pre_enable(struct drm_bridge >>> *bridge) >>> ret = tc358764_init(ctx); >>> if (ret < 0) >>> dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); >>> - ret = drm_panel_prepare(ctx->panel); >>> - if (ret < 0) >>> - dev_err(ctx->dev, "error preparing panel (%d)\n", ret); >>> -} >>> - >>> -static void tc358764_enable(struct drm_bridge *bridge) >>> -{ >>> - struct tc358764 *ctx = bridge_to_tc358764(bridge); >>> - int ret = drm_panel_enable(ctx->panel); >>> - >>> - if (ret
Re: [PATCH v4 04/15] drm/bridge: tc358764: add drm_panel_bridge support
Hi Andrzej, On Thu, Sep 03, 2020 at 11:40:58AM +0200, Andrzej Hajda wrote: > On 26.07.2020 22:33, Sam Ravnborg wrote: > > Prepare the tc358764 bridge driver for use in a chained setup by > > replacing direct use of drm_panel with drm_panel_bridge support. > > > > The bridge panel will use the connector type reported by the panel, > > where the connector for this driver hardcodes DRM_MODE_CONNECTOR_LVDS. > > > > The tc358764 did not any additional info the the connector so the > > connector creation is passed to the bridge panel driver. > > > > v3: > >- Merge with patch to make connector creation optional to avoid > > creating two connectors (Laurent) > >- Pass connector creation to bridge panel, as this bridge driver > > did not add any extra info to the connector. > >- Set bridge.type to DRM_MODE_CONNECTOR_LVDS. > > > > v2: > >- Use PTR_ERR_OR_ZERO() (kbuild test robot) > > > > Signed-off-by: Sam Ravnborg > > Cc: Laurent Pinchart > > Cc: kbuild test robot > > Cc: Andrzej Hajda > > Cc: Neil Armstrong > > Cc: Jonas Karlman > > Cc: Jernej Skrabec > > --- > > drivers/gpu/drm/bridge/tc358764.c | 107 +- > > 1 file changed, 16 insertions(+), 91 deletions(-) > > > > diff --git a/drivers/gpu/drm/bridge/tc358764.c > > b/drivers/gpu/drm/bridge/tc358764.c > > index a277739fab58..fdde4cfdc724 100644 > > --- a/drivers/gpu/drm/bridge/tc358764.c > > +++ b/drivers/gpu/drm/bridge/tc358764.c > > @@ -153,10 +153,9 @@ static const char * const tc358764_supplies[] = { > > struct tc358764 { > > struct device *dev; > > struct drm_bridge bridge; > > - struct drm_connector connector; > > struct regulator_bulk_data supplies[ARRAY_SIZE(tc358764_supplies)]; > > struct gpio_desc *gpio_reset; > > - struct drm_panel *panel; > > + struct drm_bridge *panel_bridge; > > int error; > > }; > > > > @@ -210,12 +209,6 @@ static inline struct tc358764 > > *bridge_to_tc358764(struct drm_bridge *bridge) > > return container_of(bridge, struct tc358764, bridge); > > } > > > > -static inline > > -struct tc358764 *connector_to_tc358764(struct drm_connector *connector) > > -{ > > - return container_of(connector, struct tc358764, connector); > > -} > > - > > static int tc358764_init(struct tc358764 *ctx) > > { > > u32 v = 0; > > @@ -278,43 +271,11 @@ static void tc358764_reset(struct tc358764 *ctx) > > usleep_range(1000, 2000); > > } > > > > -static int tc358764_get_modes(struct drm_connector *connector) > > -{ > > - struct tc358764 *ctx = connector_to_tc358764(connector); > > - > > - return drm_panel_get_modes(ctx->panel, connector); > > -} > > - > > -static const > > -struct drm_connector_helper_funcs tc358764_connector_helper_funcs = { > > - .get_modes = tc358764_get_modes, > > -}; > > - > > -static const struct drm_connector_funcs tc358764_connector_funcs = { > > - .fill_modes = drm_helper_probe_single_connector_modes, > > - .destroy = drm_connector_cleanup, > > - .reset = drm_atomic_helper_connector_reset, > > - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, > > - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, > > -}; > > - > > -static void tc358764_disable(struct drm_bridge *bridge) > > -{ > > - struct tc358764 *ctx = bridge_to_tc358764(bridge); > > - int ret = drm_panel_disable(bridge_to_tc358764(bridge)->panel); > > - > > - if (ret < 0) > > - dev_err(ctx->dev, "error disabling panel (%d)\n", ret); > > -} > > - > > static void tc358764_post_disable(struct drm_bridge *bridge) > > { > > struct tc358764 *ctx = bridge_to_tc358764(bridge); > > int ret; > > > > - ret = drm_panel_unprepare(ctx->panel); > > - if (ret < 0) > > - dev_err(ctx->dev, "error unpreparing panel (%d)\n", ret); > > > Using this bridge_panel thing you reverse order of hw > initialization/de-initialization, this is incorrect. > > For example: > > - panel_unprepare should be called before tc35* turn off, > > - panel_prepare should be called after tc35* on. > > This is why I avoid the whole "bridge chaining" - it enforces ridiculous > order of initialization. > > > > tc358764_reset(ctx); > > usleep_range(1, 15000); > > ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); > > @@ -335,70 +296,28 @@ static void tc358764_pre_enable(struct drm_bridge > > *bridge) > > ret = tc358764_init(ctx); > > if (ret < 0) > > dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); > > - ret = drm_panel_prepare(ctx->panel); > > - if (ret < 0) > > - dev_err(ctx->dev, "error preparing panel (%d)\n", ret); > > -} > > - > > -static void tc358764_enable(struct drm_bridge *bridge) > > -{ > > - struct tc358764 *ctx = bridge_to_tc358764(bridge); > > - int ret = drm_panel_enable(ctx->panel); > > - > > - if (ret < 0) > > - dev_err(ctx->dev, "error enabling panel (%d)\n", ret); > > } >
Re: [PATCH v4 04/15] drm/bridge: tc358764: add drm_panel_bridge support
On 26.07.2020 22:33, Sam Ravnborg wrote: > Prepare the tc358764 bridge driver for use in a chained setup by > replacing direct use of drm_panel with drm_panel_bridge support. > > The bridge panel will use the connector type reported by the panel, > where the connector for this driver hardcodes DRM_MODE_CONNECTOR_LVDS. > > The tc358764 did not any additional info the the connector so the > connector creation is passed to the bridge panel driver. > > v3: >- Merge with patch to make connector creation optional to avoid > creating two connectors (Laurent) >- Pass connector creation to bridge panel, as this bridge driver > did not add any extra info to the connector. >- Set bridge.type to DRM_MODE_CONNECTOR_LVDS. > > v2: >- Use PTR_ERR_OR_ZERO() (kbuild test robot) > > Signed-off-by: Sam Ravnborg > Cc: Laurent Pinchart > Cc: kbuild test robot > Cc: Andrzej Hajda > Cc: Neil Armstrong > Cc: Jonas Karlman > Cc: Jernej Skrabec > --- > drivers/gpu/drm/bridge/tc358764.c | 107 +- > 1 file changed, 16 insertions(+), 91 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358764.c > b/drivers/gpu/drm/bridge/tc358764.c > index a277739fab58..fdde4cfdc724 100644 > --- a/drivers/gpu/drm/bridge/tc358764.c > +++ b/drivers/gpu/drm/bridge/tc358764.c > @@ -153,10 +153,9 @@ static const char * const tc358764_supplies[] = { > struct tc358764 { > struct device *dev; > struct drm_bridge bridge; > - struct drm_connector connector; > struct regulator_bulk_data supplies[ARRAY_SIZE(tc358764_supplies)]; > struct gpio_desc *gpio_reset; > - struct drm_panel *panel; > + struct drm_bridge *panel_bridge; > int error; > }; > > @@ -210,12 +209,6 @@ static inline struct tc358764 *bridge_to_tc358764(struct > drm_bridge *bridge) > return container_of(bridge, struct tc358764, bridge); > } > > -static inline > -struct tc358764 *connector_to_tc358764(struct drm_connector *connector) > -{ > - return container_of(connector, struct tc358764, connector); > -} > - > static int tc358764_init(struct tc358764 *ctx) > { > u32 v = 0; > @@ -278,43 +271,11 @@ static void tc358764_reset(struct tc358764 *ctx) > usleep_range(1000, 2000); > } > > -static int tc358764_get_modes(struct drm_connector *connector) > -{ > - struct tc358764 *ctx = connector_to_tc358764(connector); > - > - return drm_panel_get_modes(ctx->panel, connector); > -} > - > -static const > -struct drm_connector_helper_funcs tc358764_connector_helper_funcs = { > - .get_modes = tc358764_get_modes, > -}; > - > -static const struct drm_connector_funcs tc358764_connector_funcs = { > - .fill_modes = drm_helper_probe_single_connector_modes, > - .destroy = drm_connector_cleanup, > - .reset = drm_atomic_helper_connector_reset, > - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, > - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, > -}; > - > -static void tc358764_disable(struct drm_bridge *bridge) > -{ > - struct tc358764 *ctx = bridge_to_tc358764(bridge); > - int ret = drm_panel_disable(bridge_to_tc358764(bridge)->panel); > - > - if (ret < 0) > - dev_err(ctx->dev, "error disabling panel (%d)\n", ret); > -} > - > static void tc358764_post_disable(struct drm_bridge *bridge) > { > struct tc358764 *ctx = bridge_to_tc358764(bridge); > int ret; > > - ret = drm_panel_unprepare(ctx->panel); > - if (ret < 0) > - dev_err(ctx->dev, "error unpreparing panel (%d)\n", ret); Using this bridge_panel thing you reverse order of hw initialization/de-initialization, this is incorrect. For example: - panel_unprepare should be called before tc35* turn off, - panel_prepare should be called after tc35* on. This is why I avoid the whole "bridge chaining" - it enforces ridiculous order of initialization. > tc358764_reset(ctx); > usleep_range(1, 15000); > ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); > @@ -335,70 +296,28 @@ static void tc358764_pre_enable(struct drm_bridge > *bridge) > ret = tc358764_init(ctx); > if (ret < 0) > dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); > - ret = drm_panel_prepare(ctx->panel); > - if (ret < 0) > - dev_err(ctx->dev, "error preparing panel (%d)\n", ret); > -} > - > -static void tc358764_enable(struct drm_bridge *bridge) > -{ > - struct tc358764 *ctx = bridge_to_tc358764(bridge); > - int ret = drm_panel_enable(ctx->panel); > - > - if (ret < 0) > - dev_err(ctx->dev, "error enabling panel (%d)\n", ret); > } > > static int tc358764_attach(struct drm_bridge *bridge, > enum drm_bridge_attach_flags flags) > -{ > - struct tc358764 *ctx = bridge_to_tc358764(bridge); > - struct drm_device *drm = bridge->dev; > - int ret; > - > - if (
Re: [PATCH v4 04/15] drm/bridge: tc358764: add drm_panel_bridge support
Hi Sam, Thank you for the patch. On Sun, Jul 26, 2020 at 10:33:13PM +0200, Sam Ravnborg wrote: > Prepare the tc358764 bridge driver for use in a chained setup by > replacing direct use of drm_panel with drm_panel_bridge support. > > The bridge panel will use the connector type reported by the panel, > where the connector for this driver hardcodes DRM_MODE_CONNECTOR_LVDS. > > The tc358764 did not any additional info the the connector so the Did you mean s/did not any/did not add any/ ? s/the the/to the/ > connector creation is passed to the bridge panel driver. > > v3: > - Merge with patch to make connector creation optional to avoid > creating two connectors (Laurent) > - Pass connector creation to bridge panel, as this bridge driver > did not add any extra info to the connector. > - Set bridge.type to DRM_MODE_CONNECTOR_LVDS. > > v2: > - Use PTR_ERR_OR_ZERO() (kbuild test robot) > > Signed-off-by: Sam Ravnborg > Cc: Laurent Pinchart > Cc: kbuild test robot > Cc: Andrzej Hajda > Cc: Neil Armstrong > Cc: Jonas Karlman > Cc: Jernej Skrabec > --- > drivers/gpu/drm/bridge/tc358764.c | 107 +- > 1 file changed, 16 insertions(+), 91 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358764.c > b/drivers/gpu/drm/bridge/tc358764.c > index a277739fab58..fdde4cfdc724 100644 > --- a/drivers/gpu/drm/bridge/tc358764.c > +++ b/drivers/gpu/drm/bridge/tc358764.c > @@ -153,10 +153,9 @@ static const char * const tc358764_supplies[] = { > struct tc358764 { > struct device *dev; > struct drm_bridge bridge; > - struct drm_connector connector; > struct regulator_bulk_data supplies[ARRAY_SIZE(tc358764_supplies)]; > struct gpio_desc *gpio_reset; > - struct drm_panel *panel; > + struct drm_bridge *panel_bridge; > int error; > }; > > @@ -210,12 +209,6 @@ static inline struct tc358764 *bridge_to_tc358764(struct > drm_bridge *bridge) > return container_of(bridge, struct tc358764, bridge); > } > > -static inline > -struct tc358764 *connector_to_tc358764(struct drm_connector *connector) > -{ > - return container_of(connector, struct tc358764, connector); > -} > - > static int tc358764_init(struct tc358764 *ctx) > { > u32 v = 0; > @@ -278,43 +271,11 @@ static void tc358764_reset(struct tc358764 *ctx) > usleep_range(1000, 2000); > } > > -static int tc358764_get_modes(struct drm_connector *connector) > -{ > - struct tc358764 *ctx = connector_to_tc358764(connector); > - > - return drm_panel_get_modes(ctx->panel, connector); > -} > - > -static const > -struct drm_connector_helper_funcs tc358764_connector_helper_funcs = { > - .get_modes = tc358764_get_modes, > -}; > - > -static const struct drm_connector_funcs tc358764_connector_funcs = { > - .fill_modes = drm_helper_probe_single_connector_modes, > - .destroy = drm_connector_cleanup, > - .reset = drm_atomic_helper_connector_reset, > - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, > - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, > -}; > - > -static void tc358764_disable(struct drm_bridge *bridge) > -{ > - struct tc358764 *ctx = bridge_to_tc358764(bridge); > - int ret = drm_panel_disable(bridge_to_tc358764(bridge)->panel); > - > - if (ret < 0) > - dev_err(ctx->dev, "error disabling panel (%d)\n", ret); > -} > - > static void tc358764_post_disable(struct drm_bridge *bridge) > { > struct tc358764 *ctx = bridge_to_tc358764(bridge); > int ret; > > - ret = drm_panel_unprepare(ctx->panel); > - if (ret < 0) > - dev_err(ctx->dev, "error unpreparing panel (%d)\n", ret); > tc358764_reset(ctx); > usleep_range(1, 15000); > ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); > @@ -335,70 +296,28 @@ static void tc358764_pre_enable(struct drm_bridge > *bridge) > ret = tc358764_init(ctx); > if (ret < 0) > dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); > - ret = drm_panel_prepare(ctx->panel); > - if (ret < 0) > - dev_err(ctx->dev, "error preparing panel (%d)\n", ret); > -} > - > -static void tc358764_enable(struct drm_bridge *bridge) > -{ > - struct tc358764 *ctx = bridge_to_tc358764(bridge); > - int ret = drm_panel_enable(ctx->panel); > - > - if (ret < 0) > - dev_err(ctx->dev, "error enabling panel (%d)\n", ret); > } > > static int tc358764_attach(struct drm_bridge *bridge, > enum drm_bridge_attach_flags flags) > -{ > - struct tc358764 *ctx = bridge_to_tc358764(bridge); > - struct drm_device *drm = bridge->dev; > - int ret; > - > - if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { > - DRM_ERROR("Fix bridge driver to make connector optional!"); > - return -EINVAL; > - } > - > - ctx->connector.polled = DRM_CONNECTOR_POLL_HPD; > - ret
[PATCH v4 04/15] drm/bridge: tc358764: add drm_panel_bridge support
Prepare the tc358764 bridge driver for use in a chained setup by replacing direct use of drm_panel with drm_panel_bridge support. The bridge panel will use the connector type reported by the panel, where the connector for this driver hardcodes DRM_MODE_CONNECTOR_LVDS. The tc358764 did not any additional info the the connector so the connector creation is passed to the bridge panel driver. v3: - Merge with patch to make connector creation optional to avoid creating two connectors (Laurent) - Pass connector creation to bridge panel, as this bridge driver did not add any extra info to the connector. - Set bridge.type to DRM_MODE_CONNECTOR_LVDS. v2: - Use PTR_ERR_OR_ZERO() (kbuild test robot) Signed-off-by: Sam Ravnborg Cc: Laurent Pinchart Cc: kbuild test robot Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Jonas Karlman Cc: Jernej Skrabec --- drivers/gpu/drm/bridge/tc358764.c | 107 +- 1 file changed, 16 insertions(+), 91 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358764.c b/drivers/gpu/drm/bridge/tc358764.c index a277739fab58..fdde4cfdc724 100644 --- a/drivers/gpu/drm/bridge/tc358764.c +++ b/drivers/gpu/drm/bridge/tc358764.c @@ -153,10 +153,9 @@ static const char * const tc358764_supplies[] = { struct tc358764 { struct device *dev; struct drm_bridge bridge; - struct drm_connector connector; struct regulator_bulk_data supplies[ARRAY_SIZE(tc358764_supplies)]; struct gpio_desc *gpio_reset; - struct drm_panel *panel; + struct drm_bridge *panel_bridge; int error; }; @@ -210,12 +209,6 @@ static inline struct tc358764 *bridge_to_tc358764(struct drm_bridge *bridge) return container_of(bridge, struct tc358764, bridge); } -static inline -struct tc358764 *connector_to_tc358764(struct drm_connector *connector) -{ - return container_of(connector, struct tc358764, connector); -} - static int tc358764_init(struct tc358764 *ctx) { u32 v = 0; @@ -278,43 +271,11 @@ static void tc358764_reset(struct tc358764 *ctx) usleep_range(1000, 2000); } -static int tc358764_get_modes(struct drm_connector *connector) -{ - struct tc358764 *ctx = connector_to_tc358764(connector); - - return drm_panel_get_modes(ctx->panel, connector); -} - -static const -struct drm_connector_helper_funcs tc358764_connector_helper_funcs = { - .get_modes = tc358764_get_modes, -}; - -static const struct drm_connector_funcs tc358764_connector_funcs = { - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = drm_connector_cleanup, - .reset = drm_atomic_helper_connector_reset, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -}; - -static void tc358764_disable(struct drm_bridge *bridge) -{ - struct tc358764 *ctx = bridge_to_tc358764(bridge); - int ret = drm_panel_disable(bridge_to_tc358764(bridge)->panel); - - if (ret < 0) - dev_err(ctx->dev, "error disabling panel (%d)\n", ret); -} - static void tc358764_post_disable(struct drm_bridge *bridge) { struct tc358764 *ctx = bridge_to_tc358764(bridge); int ret; - ret = drm_panel_unprepare(ctx->panel); - if (ret < 0) - dev_err(ctx->dev, "error unpreparing panel (%d)\n", ret); tc358764_reset(ctx); usleep_range(1, 15000); ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); @@ -335,70 +296,28 @@ static void tc358764_pre_enable(struct drm_bridge *bridge) ret = tc358764_init(ctx); if (ret < 0) dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); - ret = drm_panel_prepare(ctx->panel); - if (ret < 0) - dev_err(ctx->dev, "error preparing panel (%d)\n", ret); -} - -static void tc358764_enable(struct drm_bridge *bridge) -{ - struct tc358764 *ctx = bridge_to_tc358764(bridge); - int ret = drm_panel_enable(ctx->panel); - - if (ret < 0) - dev_err(ctx->dev, "error enabling panel (%d)\n", ret); } static int tc358764_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) -{ - struct tc358764 *ctx = bridge_to_tc358764(bridge); - struct drm_device *drm = bridge->dev; - int ret; - - if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { - DRM_ERROR("Fix bridge driver to make connector optional!"); - return -EINVAL; - } - - ctx->connector.polled = DRM_CONNECTOR_POLL_HPD; - ret = drm_connector_init(drm, &ctx->connector, -&tc358764_connector_funcs, -DRM_MODE_CONNECTOR_LVDS); - if (ret) { - DRM_ERROR("Failed to initialize connector\n"); - return ret; - } - - drm_connector_helper_add(&ctx->connector, -