From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932372AbcEKQJt (ORCPT ); Wed, 11 May 2016 12:09:49 -0400 Received: from smtp.domeneshop.no ([194.63.252.55]:41620 "EHLO smtp.domeneshop.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932301AbcEKQJp (ORCPT ); Wed, 11 May 2016 12:09:45 -0400 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= To: dri-devel@lists.freedesktop.org Cc: daniel@ffwll.ch, linux-kernel@vger.kernel.org, =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Subject: [PATCH v2 5/6] drm/atomic: Add drm_atomic_helper_best_encoder() Date: Wed, 11 May 2016 18:09:21 +0200 Message-Id: <1462982962-10530-6-git-send-email-noralf@tronnes.org> X-Mailer: git-send-email 2.8.2 In-Reply-To: <1462982962-10530-1-git-send-email-noralf@tronnes.org> References: <1462982962-10530-1-git-send-email-noralf@tronnes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add (struct drm_connector_helper_funcs *)->best_encoder callback helper for connectors that support exactly 1 encoder, statically determined at driver init time. Signed-off-by: Noralf Trønnes --- drivers/gpu/drm/drm_atomic_helper.c | 17 +++++++++++++++++ include/drm/drm_atomic_helper.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 46a3201..43a0b3d 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2483,6 +2483,23 @@ backoff: EXPORT_SYMBOL(drm_atomic_helper_connector_dpms); /** + * drm_atomic_helper_best_encoder - Helper for &drm_connector_helper_funcs + * ->best_encoder callback + * @connector: Connector control structure + * + * This is a &drm_connector_helper_funcs ->best_encoder callback helper for + * connectors that support exactly 1 encoder, statically determined at driver + * init time. + */ +struct drm_encoder * +drm_atomic_helper_best_encoder(struct drm_connector *connector) +{ + WARN_ON(connector->encoder_ids[1]); + return drm_encoder_find(connector->dev, connector->encoder_ids[0]); +} +EXPORT_SYMBOL(drm_atomic_helper_best_encoder); + +/** * DOC: atomic state reset and initialization * * Both the drm core and the atomic helpers assume that there is always the full diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 0364287..ccca709 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -110,6 +110,8 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, uint32_t flags); int drm_atomic_helper_connector_dpms(struct drm_connector *connector, int mode); +struct drm_encoder * +drm_atomic_helper_best_encoder(struct drm_connector *connector); /* default implementations for state handling */ void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); -- 2.8.2