From: Douglas Anderson <dianders@chromium.org> To: dri-devel@lists.freedesktop.org, Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de>, Douglas Anderson <dianders@chromium.org>, linux-kernel@vger.kernel.org Subject: [RFC PATCH 04/10] drm/panel_helper: Introduce drm_panel_helper Date: Fri, 4 Aug 2023 14:06:07 -0700 [thread overview] Message-ID: <20230804140605.RFC.4.I930069a32baab6faf46d6b234f89613b5cec0f14@changeid> (raw) In-Reply-To: <20230804210644.1862287-1-dianders@chromium.org> The goal of this file is to contain helper functions for panel drivers to use. To start off with, let's add drm_panel_helper_shutdown() for use by panels that want to make sure they're powered off at shutdown/remove time if they happen to be powered on. The main goal of introducting this function is so that panel drivers don't need to track the enabled/prepared state themselves. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- If I've misunderstood and the drm_panel_helper_shutdown() should belong in some other file and we don't need to introduce a "helper" for this then please le me know. drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_panel_helper.c | 37 ++++++++++++++++++++++++++++++ include/drm/drm_panel_helper.h | 13 +++++++++++ 3 files changed, 51 insertions(+) create mode 100644 drivers/gpu/drm/drm_panel_helper.c create mode 100644 include/drm/drm_panel_helper.h diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 215e78e79125..e811f3d68235 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -118,6 +118,7 @@ drm_kms_helper-y := \ drm_gem_framebuffer_helper.o \ drm_kms_helper_common.o \ drm_modeset_helper.o \ + drm_panel_helper.o \ drm_plane_helper.o \ drm_probe_helper.o \ drm_rect.o \ diff --git a/drivers/gpu/drm/drm_panel_helper.c b/drivers/gpu/drm/drm_panel_helper.c new file mode 100644 index 000000000000..85a55b5731cf --- /dev/null +++ b/drivers/gpu/drm/drm_panel_helper.c @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2023 Google Inc. + */ + +#include <linux/dev_printk.h> + +#include <drm/drm_panel.h> +#include <drm/drm_panel_helper.h> + +/** + * drm_panel_helper_shutdown - helper for panels to use at shutdown time + * @panel: DRM panel + * + * Panels may call this function unconditionally at shutdown time to ensure + * that they are disabled and unprepared if necessary. + * + * As part of this function: + * - The backlight will be turned off, if it was on. + * - Any panel followers will be power sequenced. + */ +void drm_panel_helper_shutdown(struct drm_panel *panel) +{ + int ret; + + if (panel->enabled) { + ret = drm_panel_disable(panel); + if (ret) + dev_warn(panel->dev, "Error disabling panel %d\n", ret); + } + if (panel->prepared) { + ret = drm_panel_unprepare(panel); + if (ret) + dev_warn(panel->dev, "Error unpreparing panel %d\n", ret); + } +} +EXPORT_SYMBOL_GPL(drm_panel_helper_shutdown); diff --git a/include/drm/drm_panel_helper.h b/include/drm/drm_panel_helper.h new file mode 100644 index 000000000000..5621482053a9 --- /dev/null +++ b/include/drm/drm_panel_helper.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright 2023 Google Inc. + */ + +#ifndef DRM_PANEL_HELPER_H +#define DRM_PANEL_HELPER_H + +struct drm_panel; + +void drm_panel_helper_shutdown(struct drm_panel *panel); + +#endif /* DRM_PANEL_HELPER_H */ -- 2.41.0.585.gd2178a4bd4-goog
WARNING: multiple messages have this Message-ID (diff)
From: Douglas Anderson <dianders@chromium.org> To: dri-devel@lists.freedesktop.org, Maxime Ripard <mripard@kernel.org> Cc: Linus Walleij <linus.walleij@linaro.org>, Douglas Anderson <dianders@chromium.org>, Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@gmail.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Thomas Zimmermann <tzimmermann@suse.de>, linux-kernel@vger.kernel.org Subject: [RFC PATCH 04/10] drm/panel_helper: Introduce drm_panel_helper Date: Fri, 4 Aug 2023 14:06:07 -0700 [thread overview] Message-ID: <20230804140605.RFC.4.I930069a32baab6faf46d6b234f89613b5cec0f14@changeid> (raw) In-Reply-To: <20230804210644.1862287-1-dianders@chromium.org> The goal of this file is to contain helper functions for panel drivers to use. To start off with, let's add drm_panel_helper_shutdown() for use by panels that want to make sure they're powered off at shutdown/remove time if they happen to be powered on. The main goal of introducting this function is so that panel drivers don't need to track the enabled/prepared state themselves. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- If I've misunderstood and the drm_panel_helper_shutdown() should belong in some other file and we don't need to introduce a "helper" for this then please le me know. drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_panel_helper.c | 37 ++++++++++++++++++++++++++++++ include/drm/drm_panel_helper.h | 13 +++++++++++ 3 files changed, 51 insertions(+) create mode 100644 drivers/gpu/drm/drm_panel_helper.c create mode 100644 include/drm/drm_panel_helper.h diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 215e78e79125..e811f3d68235 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -118,6 +118,7 @@ drm_kms_helper-y := \ drm_gem_framebuffer_helper.o \ drm_kms_helper_common.o \ drm_modeset_helper.o \ + drm_panel_helper.o \ drm_plane_helper.o \ drm_probe_helper.o \ drm_rect.o \ diff --git a/drivers/gpu/drm/drm_panel_helper.c b/drivers/gpu/drm/drm_panel_helper.c new file mode 100644 index 000000000000..85a55b5731cf --- /dev/null +++ b/drivers/gpu/drm/drm_panel_helper.c @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2023 Google Inc. + */ + +#include <linux/dev_printk.h> + +#include <drm/drm_panel.h> +#include <drm/drm_panel_helper.h> + +/** + * drm_panel_helper_shutdown - helper for panels to use at shutdown time + * @panel: DRM panel + * + * Panels may call this function unconditionally at shutdown time to ensure + * that they are disabled and unprepared if necessary. + * + * As part of this function: + * - The backlight will be turned off, if it was on. + * - Any panel followers will be power sequenced. + */ +void drm_panel_helper_shutdown(struct drm_panel *panel) +{ + int ret; + + if (panel->enabled) { + ret = drm_panel_disable(panel); + if (ret) + dev_warn(panel->dev, "Error disabling panel %d\n", ret); + } + if (panel->prepared) { + ret = drm_panel_unprepare(panel); + if (ret) + dev_warn(panel->dev, "Error unpreparing panel %d\n", ret); + } +} +EXPORT_SYMBOL_GPL(drm_panel_helper_shutdown); diff --git a/include/drm/drm_panel_helper.h b/include/drm/drm_panel_helper.h new file mode 100644 index 000000000000..5621482053a9 --- /dev/null +++ b/include/drm/drm_panel_helper.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright 2023 Google Inc. + */ + +#ifndef DRM_PANEL_HELPER_H +#define DRM_PANEL_HELPER_H + +struct drm_panel; + +void drm_panel_helper_shutdown(struct drm_panel *panel); + +#endif /* DRM_PANEL_HELPER_H */ -- 2.41.0.585.gd2178a4bd4-goog
next prev parent reply other threads:[~2023-08-04 21:07 UTC|newest] Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-04 21:06 [RFC PATCH 00/10] drm/panel: Remove most store/double-check of prepared/enabled state Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-04 21:06 ` [RFC PATCH 01/10] drm/panel: Don't store+check prepared/enabled for simple cases Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-09-13 18:20 ` Doug Anderson 2023-09-13 18:20 ` Doug Anderson 2023-08-04 21:06 ` [RFC PATCH 02/10] drm/panel: s6e63m0: Don't store+check prepared/enabled Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-09-13 18:20 ` Doug Anderson 2023-09-13 18:20 ` Doug Anderson 2023-08-04 21:06 ` [RFC PATCH 03/10] drm/panel: otm8009a: Don't double check prepared/enabled Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-09-13 18:20 ` Doug Anderson 2023-09-13 18:20 ` Doug Anderson 2023-08-04 21:06 ` Douglas Anderson [this message] 2023-08-04 21:06 ` [RFC PATCH 04/10] drm/panel_helper: Introduce drm_panel_helper Douglas Anderson 2023-08-07 6:41 ` Maxime Ripard 2023-08-07 6:41 ` Maxime Ripard 2023-08-25 21:58 ` Doug Anderson 2023-08-25 21:58 ` Doug Anderson 2023-08-28 7:45 ` Maxime Ripard 2023-08-28 7:45 ` Maxime Ripard 2023-08-28 16:06 ` Doug Anderson 2023-08-28 16:06 ` Doug Anderson 2023-08-29 8:38 ` Maxime Ripard 2023-08-29 8:38 ` Maxime Ripard 2023-08-30 23:10 ` Doug Anderson 2023-08-30 23:10 ` Doug Anderson 2023-08-31 7:38 ` Maxime Ripard 2023-08-31 7:38 ` Maxime Ripard 2023-08-31 18:18 ` Doug Anderson 2023-08-31 18:18 ` Doug Anderson 2023-09-01 8:15 ` Maxime Ripard 2023-09-01 8:15 ` Maxime Ripard 2023-09-01 13:42 ` Doug Anderson 2023-09-01 13:42 ` Doug Anderson 2023-09-01 23:44 ` Doug Anderson 2023-09-01 23:44 ` Doug Anderson 2023-09-04 15:33 ` Maxime Ripard 2023-09-04 15:33 ` Maxime Ripard 2023-09-05 16:45 ` Doug Anderson 2023-09-05 16:45 ` Doug Anderson 2023-09-05 19:12 ` Doug Anderson 2023-09-05 19:12 ` Doug Anderson 2023-09-07 14:16 ` Maxime Ripard 2023-09-07 14:16 ` Maxime Ripard 2023-09-07 14:14 ` Maxime Ripard 2023-09-07 14:14 ` Maxime Ripard 2023-09-13 18:28 ` Doug Anderson 2023-09-13 18:28 ` Doug Anderson 2023-08-04 21:06 ` [RFC PATCH 05/10] drm/panel: Don't store+check prepared/enabled for panels needing shutdown Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-04 21:06 ` [RFC PATCH 06/10] drm/panel: Don't store+check prepared/enabled for panels disabled at shutdown Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-04 21:06 ` [RFC PATCH 07/10] drm/panel: st7703: Don't store+check prepared Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-04 21:06 ` [RFC PATCH 08/10] drm/panel: rm67191: Don't store+check enabled Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-04 21:06 ` [RFC PATCH 09/10] drm/panel: sony-acx565akm: Don't double-check enabled state in disable Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-04 21:06 ` [RFC PATCH 10/10] drm/panel: Update TODO list item for cleaning up prepared/enabled tracking Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-07 6:41 ` Maxime Ripard 2023-08-07 6:41 ` Maxime Ripard 2023-08-10 8:23 ` [RFC PATCH 00/10] drm/panel: Remove most store/double-check of prepared/enabled state Linus Walleij 2023-08-10 8:23 ` Linus Walleij 2023-09-05 19:15 ` Doug Anderson 2023-09-05 19:15 ` Doug Anderson
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230804140605.RFC.4.I930069a32baab6faf46d6b234f89613b5cec0f14@changeid \ --to=dianders@chromium.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mripard@kernel.org \ --cc=tzimmermann@suse.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.