Quoting Sam Ravnborg (2023-01-07 12:28:41) > On Thu, Jan 05, 2023 at 07:01:08PM -0800, Stephen Boyd wrote: > > The unprepare sequence has started to fail after moving to panel bridge > > code in the msm drm driver (commit 007ac0262b0d ("drm/msm/dsi: switch to > > DRM_PANEL_BRIDGE")). You'll see messages like this in the kernel logs: > > > > panel-boe-tv101wum-nl6 ae94000.dsi.0: failed to set panel off: -22 > > > > This is because boe_panel_enter_sleep_mode() needs an operating DSI link > > to set the panel into sleep mode. Performing those writes in the > > unprepare phase of bridge ops is too late, because the link has already > > been torn down by the DSI controller in post_disable, i.e. the PHY has > > been disabled, etc. See dsi_mgr_bridge_post_disable() for more details > > on the DSI . > > > > Split the unprepare function into a disable part and an unprepare part. > > For now, just the DSI writes to enter sleep mode are put in the disable > > function. This fixes the panel off routine and keeps the panel happy. > > > > My Wormdingler has an integrated touchscreen that stops responding to > > touch if the panel is only half disabled too. This patch fixes it. And > > finally, this saves power when the screen is off because without this > > fix the regulators for the panel are left enabled when nothing is being > > displayed on the screen. > > The pattern we use in several (but not all) panel drivers are that > errors in unprepare/disable are logged but the function do not skip > the remainder of the function. This is to avoid that we do not disable > power supplies etc. Ah that would have made it so I didn't see a problem. But I wonder if the panel gets borked if you don't disable it via DSI writes before yanking the power? > > For this case we could ask ourself if the display needs to enter sleep > mode right before we disable the regulator. But if the regulator is > fixed, so the disable has no effect, this seems OK. What do you mean by fixed? > > Please fix the unprepare to not jump out early, on top of or together > with the other fix. After this patch the unprepare only bails out early if the bool 'prepared' flag isn't set. Are you suggesting to get rid of that flag and unconditionally disable the regulators? Is it possible for the unprepare to be called multiple times without a balanced call to prepare?