From patchwork Sun Jul 7 18:19:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11034239 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF287138B for ; Sun, 7 Jul 2019 18:31:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E7B82817F for ; Sun, 7 Jul 2019 18:31:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92EA12835B; Sun, 7 Jul 2019 18:31:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 29FD92817F for ; Sun, 7 Jul 2019 18:31:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 69E6F89B7D; Sun, 7 Jul 2019 18:31:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF0BB89B7D for ; Sun, 7 Jul 2019 18:31:49 +0000 (UTC) Received: from pendragon.nordic-sky.finnair.com (unknown [38.98.37.142]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EF428CC; Sun, 7 Jul 2019 20:31:29 +0200 (CEST) From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH 32/60] drm/omap: dss: Make omap_dss_device_ops optional Date: Sun, 7 Jul 2019 21:19:09 +0300 Message-Id: <20190707181937.6250-29-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190707181937.6250-1-laurent.pinchart@ideasonboard.com> References: <20190707180852.5512-1-laurent.pinchart@ideasonboard.com> <20190707181937.6250-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1562524308; bh=vDanzeO8iheuuFdHb5TrxiglaykkNsxNaylDYUqzK74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RApM3F3S8WSHlhhhWKUjLH4E1mGsJogn8Vj7DeNDjp6v54TYS4d9PsQ1PCVROOljK v3OBBpjPijZo362Mzu0ozDy6wfEnegoWstZncxHiS+vLd8W8hpkEClCcAAsuv5jZCi dfAYvADbQXX2inc9dhzKHlXZk05ZzuKE28kboDQ8= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxime Ripard , Sebastian Reichel , Tomi Valkeinen , Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP As part of the move to drm_bridge ops for some of the internal encoders will be removed. Make them optional in the driver to ease the transition. Signed-off-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/base.c | 21 ++++++++++++--------- drivers/gpu/drm/omapdrm/dss/dss.c | 3 ++- drivers/gpu/drm/omapdrm/omap_connector.c | 2 +- drivers/gpu/drm/omapdrm/omap_encoder.c | 12 +++++++----- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c index 80d48936d177..2db3bd2f19db 100644 --- a/drivers/gpu/drm/omapdrm/dss/base.c +++ b/drivers/gpu/drm/omapdrm/dss/base.c @@ -195,10 +195,12 @@ int omapdss_device_connect(struct dss_device *dss, dst->dss = dss; - ret = dst->ops->connect(src, dst); - if (ret < 0) { - dst->dss = NULL; - return ret; + if (dst->ops && dst->ops->connect) { + ret = dst->ops->connect(src, dst); + if (ret < 0) { + dst->dss = NULL; + return ret; + } } return 0; @@ -226,7 +228,8 @@ void omapdss_device_disconnect(struct omap_dss_device *src, WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED); - dst->ops->disconnect(src, dst); + if (dst->ops && dst->ops->disconnect) + dst->ops->disconnect(src, dst); dst->dss = NULL; } EXPORT_SYMBOL_GPL(omapdss_device_disconnect); @@ -238,7 +241,7 @@ void omapdss_device_pre_enable(struct omap_dss_device *dssdev) omapdss_device_pre_enable(dssdev->next); - if (dssdev->ops->pre_enable) + if (dssdev->ops && dssdev->ops->pre_enable) dssdev->ops->pre_enable(dssdev); } EXPORT_SYMBOL_GPL(omapdss_device_pre_enable); @@ -248,7 +251,7 @@ void omapdss_device_enable(struct omap_dss_device *dssdev) if (!dssdev) return; - if (dssdev->ops->enable) + if (dssdev->ops && dssdev->ops->enable) dssdev->ops->enable(dssdev); omapdss_device_enable(dssdev->next); @@ -264,7 +267,7 @@ void omapdss_device_disable(struct omap_dss_device *dssdev) omapdss_device_disable(dssdev->next); - if (dssdev->ops->disable) + if (dssdev->ops && dssdev->ops->disable) dssdev->ops->disable(dssdev); } EXPORT_SYMBOL_GPL(omapdss_device_disable); @@ -274,7 +277,7 @@ void omapdss_device_post_disable(struct omap_dss_device *dssdev) if (!dssdev) return; - if (dssdev->ops->post_disable) + if (dssdev->ops && dssdev->ops->post_disable) dssdev->ops->post_disable(dssdev); omapdss_device_post_disable(dssdev->next); diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c index 55e68863ef15..a5cf15b7e630 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1561,7 +1561,8 @@ static void dss_shutdown(struct platform_device *pdev) DSSDBG("shutdown\n"); for_each_dss_output(dssdev) { - if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) + if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE && + dssdev->ops && dssdev->ops->disable) dssdev->ops->disable(dssdev); } } diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c index 3d1f740037c8..3f913c8cf344 100644 --- a/drivers/gpu/drm/omapdrm/omap_connector.c +++ b/drivers/gpu/drm/omapdrm/omap_connector.c @@ -239,7 +239,7 @@ enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev, drm_mode_copy(adjusted_mode, mode); for (; dssdev; dssdev = dssdev->next) { - if (!dssdev->ops->check_timings) + if (!dssdev->ops || !dssdev->ops->check_timings) continue; ret = dssdev->ops->check_timings(dssdev, adjusted_mode); diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c index 510888413068..fa4e00e65f9d 100644 --- a/drivers/gpu/drm/omapdrm/omap_encoder.c +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c @@ -87,10 +87,10 @@ static void omap_encoder_hdmi_mode_set(struct drm_connector *connector, struct omap_dss_device *dssdev = omap_encoder->output; bool hdmi_mode = connector->display_info.is_hdmi; - if (dssdev->ops->hdmi.set_hdmi_mode) + if (dssdev->ops && dssdev->ops->hdmi.set_hdmi_mode) dssdev->ops->hdmi.set_hdmi_mode(dssdev, hdmi_mode); - if (hdmi_mode && dssdev->ops->hdmi.set_infoframe) { + if (hdmi_mode && dssdev->ops && dssdev->ops->hdmi.set_infoframe) { struct hdmi_avi_infoframe avi; int r; @@ -148,7 +148,7 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder, dss_mgr_set_timings(output, &vm); for (dssdev = output; dssdev; dssdev = dssdev->next) { - if (dssdev->ops->set_timings) + if (dssdev->ops && dssdev->ops->set_timings) dssdev->ops->set_timings(dssdev, adjusted_mode); } @@ -177,7 +177,8 @@ static void omap_encoder_disable(struct drm_encoder *encoder) * flow where the pipeline output controls the encoder. */ if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) { - dssdev->ops->disable(dssdev); + if (dssdev->ops && dssdev->ops->disable) + dssdev->ops->disable(dssdev); dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } @@ -205,7 +206,8 @@ static void omap_encoder_enable(struct drm_encoder *encoder) * flow where the pipeline output controls the encoder. */ if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) { - dssdev->ops->enable(dssdev); + if (dssdev->ops && dssdev->ops->enable) + dssdev->ops->enable(dssdev); dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; }