From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72403C35671 for ; Sat, 22 Feb 2020 15:03:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 49A82206ED for ; Sat, 22 Feb 2020 15:03:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="r349IZiq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49A82206ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ECF8E6E94F; Sat, 22 Feb 2020 15:02:22 +0000 (UTC) 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 5F1C86E921 for ; Sat, 22 Feb 2020 15:02:15 +0000 (UTC) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0EEFA11FC; Sat, 22 Feb 2020 16:02:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1582383731; bh=/rw65ot1vwxa10pWm9rnmY5lC28GjJYSaZ6tmKx7avU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r349IZiq/j/AvR7SvZp1mc9ro+0oxH0krKgeEteex1PqHEnR7LJrm8C6zU50L7aXD RxKezwmky5j9NFLZ2eKMXUyqdhvZLiINvLFw72TLrwf/BmjTzlgDLFYh+zazsNmL5y XOly8XRA6MHw+H3sKmX4L5fEEq/yIzXNLFLL1EiE= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH v7 46/54] drm/omap: dpi: Reorder functions in sections Date: Sat, 22 Feb 2020 17:00:58 +0200 Message-Id: <20200222150106.22919-47-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200222150106.22919-1-laurent.pinchart@ideasonboard.com> References: <20200222150106.22919-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , Sam Ravnborg , Sebastian Reichel , Boris Brezillon Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Group functions based on their purpose and split them in sections to make the source code easier to navigate. No functional change is included. Signed-off-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen Tested-by: Sebastian Reichel Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/dss/dpi.c | 146 ++++++++++++++++-------------- 1 file changed, 79 insertions(+), 67 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c index f8354271ce6f..dccf81e4ce64 100644 --- a/drivers/gpu/drm/omapdrm/dss/dpi.c +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c @@ -48,6 +48,10 @@ static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev) return container_of(dssdev, struct dpi_data, output); } +/* ----------------------------------------------------------------------------- + * Clock Handling and PLL + */ + static enum dss_clk_source dpi_get_clk_src_dra7xx(struct dpi_data *dpi, enum omap_channel channel) { @@ -366,6 +370,62 @@ static void dpi_config_lcd_manager(struct dpi_data *dpi) dss_mgr_set_lcd_config(&dpi->output, &dpi->mgr_config); } +static int dpi_verify_pll(struct dss_pll *pll) +{ + int r; + + /* do initial setup with the PLL to see if it is operational */ + + r = dss_pll_enable(pll); + if (r) + return r; + + dss_pll_disable(pll); + + return 0; +} + +static void dpi_init_pll(struct dpi_data *dpi) +{ + struct dss_pll *pll; + + if (dpi->pll) + return; + + dpi->clk_src = dpi_get_clk_src(dpi); + + pll = dss_pll_find_by_src(dpi->dss, dpi->clk_src); + if (!pll) + return; + + if (dpi_verify_pll(pll)) { + DSSWARN("PLL not operational\n"); + return; + } + + dpi->pll = pll; +} + +/* ----------------------------------------------------------------------------- + * omap_dss_device Operations + */ + +static int dpi_connect(struct omap_dss_device *src, + struct omap_dss_device *dst) +{ + struct dpi_data *dpi = dpi_get_data_from_dssdev(dst); + + dpi_init_pll(dpi); + + return omapdss_device_connect(dst->dss, dst, dst->next); +} + +static void dpi_disconnect(struct omap_dss_device *src, + struct omap_dss_device *dst) +{ + omapdss_device_disconnect(dst, dst->next); +} + static void dpi_display_enable(struct omap_dss_device *dssdev) { struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev); @@ -446,20 +506,6 @@ static void dpi_display_disable(struct omap_dss_device *dssdev) mutex_unlock(&dpi->lock); } -static void dpi_set_timings(struct omap_dss_device *dssdev, - const struct drm_display_mode *mode) -{ - struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev); - - DSSDBG("dpi_set_timings\n"); - - mutex_lock(&dpi->lock); - - dpi->pixelclock = mode->clock * 1000; - - mutex_unlock(&dpi->lock); -} - static int dpi_check_timings(struct omap_dss_device *dssdev, struct drm_display_mode *mode) { @@ -500,41 +546,30 @@ static int dpi_check_timings(struct omap_dss_device *dssdev, return 0; } -static int dpi_verify_pll(struct dss_pll *pll) +static void dpi_set_timings(struct omap_dss_device *dssdev, + const struct drm_display_mode *mode) { - int r; + struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev); - /* do initial setup with the PLL to see if it is operational */ + DSSDBG("dpi_set_timings\n"); - r = dss_pll_enable(pll); - if (r) - return r; + mutex_lock(&dpi->lock); - dss_pll_disable(pll); + dpi->pixelclock = mode->clock * 1000; - return 0; + mutex_unlock(&dpi->lock); } -static void dpi_init_pll(struct dpi_data *dpi) -{ - struct dss_pll *pll; - - if (dpi->pll) - return; - - dpi->clk_src = dpi_get_clk_src(dpi); - - pll = dss_pll_find_by_src(dpi->dss, dpi->clk_src); - if (!pll) - return; +static const struct omap_dss_device_ops dpi_ops = { + .connect = dpi_connect, + .disconnect = dpi_disconnect, - if (dpi_verify_pll(pll)) { - DSSWARN("PLL not operational\n"); - return; - } + .enable = dpi_display_enable, + .disable = dpi_display_disable, - dpi->pll = pll; -} + .check_timings = dpi_check_timings, + .set_timings = dpi_set_timings, +}; /* * Return a hardcoded channel for the DPI output. This should work for @@ -572,33 +607,6 @@ static enum omap_channel dpi_get_channel(struct dpi_data *dpi) } } -static int dpi_connect(struct omap_dss_device *src, - struct omap_dss_device *dst) -{ - struct dpi_data *dpi = dpi_get_data_from_dssdev(dst); - - dpi_init_pll(dpi); - - return omapdss_device_connect(dst->dss, dst, dst->next); -} - -static void dpi_disconnect(struct omap_dss_device *src, - struct omap_dss_device *dst) -{ - omapdss_device_disconnect(dst, dst->next); -} - -static const struct omap_dss_device_ops dpi_ops = { - .connect = dpi_connect, - .disconnect = dpi_disconnect, - - .enable = dpi_display_enable, - .disable = dpi_display_disable, - - .check_timings = dpi_check_timings, - .set_timings = dpi_set_timings, -}; - static int dpi_init_output_port(struct dpi_data *dpi, struct device_node *port) { struct omap_dss_device *out = &dpi->output; @@ -647,6 +655,10 @@ static void dpi_uninit_output_port(struct device_node *port) omapdss_device_cleanup_output(out); } +/* ----------------------------------------------------------------------------- + * Initialisation and Cleanup + */ + static const struct soc_device_attribute dpi_soc_devices[] = { { .machine = "OMAP3[456]*" }, { .machine = "[AD]M37*" }, -- Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel