From patchwork Fri Feb 16 11:25:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 10224483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5C015603EE for ; Fri, 16 Feb 2018 11:25:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F9282948E for ; Fri, 16 Feb 2018 11:25:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4430329490; Fri, 16 Feb 2018 11:25:32 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 C19782948E for ; Fri, 16 Feb 2018 11:25:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 094B96E61A; Fri, 16 Feb 2018 11:25:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0731D6E009 for ; Fri, 16 Feb 2018 11:25:18 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1GBPGdG009111; Fri, 16 Feb 2018 05:25:16 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518780316; bh=eKew4K6dJLAiTt0RxVbDur8qHWh50BfqM7rEhz/bcgU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=pJTrCNodXWDrdUemXUvaKAdG23XxqZh5T4to/gAvenh948nepAiDqJaNCDvSBbzvH /1eTwvO4kyfFmSrqRhtlTd56lu3bSHRl9C97Mg060Ihb541bx77ZGt0CbWyca/mle4 xQDq/u+c/FYOIxt/l/cp/9rYWZAZO7ZGl/5NEXsQ= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1GBPGlL003429; Fri, 16 Feb 2018 05:25:16 -0600 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Fri, 16 Feb 2018 05:25:15 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Fri, 16 Feb 2018 05:25:15 -0600 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1GBPCid028841; Fri, 16 Feb 2018 05:25:14 -0600 From: Jyri Sarha To: , , Subject: [PATCH RFC 1/9] drm/omap: Update omapdss API to allow alternative DSS implementations Date: Fri, 16 Feb 2018 13:25:02 +0200 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP After this patch OMAP_DSS_BASE module is not including any OMAP2_DSS headers, only the API omapdss.h. "sturct dss_data", the piece of the data structure needed for base.c is defined in omapdss.h and added as a member to struct dss_device, and later to struct dss6_device. The patch is still a bit hackish. The struct dispc_device declaration is currently shared between alternative dss implementations, with different internal definitions. It should be relatively simple to use a similar struct dispc_data as struct dss_data is for dss_device, move some common parts - maybe the dispc_ops itself - there and find the private data with container_of macro. Also the contents of struct dss_data in side dss_device is currently redundant. These should be easy enough to fix, if we decide to take this route. Signed-off-by: Jyri Sarha --- drivers/gpu/drm/omapdrm/dss/base.c | 11 +++++------ drivers/gpu/drm/omapdrm/dss/dispc.c | 4 ++++ drivers/gpu/drm/omapdrm/dss/dss.c | 2 +- drivers/gpu/drm/omapdrm/dss/dss.h | 2 ++ drivers/gpu/drm/omapdrm/dss/omapdss.h | 13 +++++++++---- drivers/gpu/drm/omapdrm/omap_drv.h | 2 +- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c index 99e8cb8..42442f3 100644 --- a/drivers/gpu/drm/omapdrm/dss/base.c +++ b/drivers/gpu/drm/omapdrm/dss/base.c @@ -19,10 +19,9 @@ #include #include -#include "dss.h" #include "omapdss.h" -static struct dss_device *dss_device; +static struct dss_data *dss_device; static struct list_head omapdss_comp_list; @@ -32,25 +31,25 @@ struct omapdss_comp_node { bool dss_core_component; }; -struct dss_device *omapdss_get_dss(void) +struct dss_data *omapdss_get_dss(void) { return dss_device; } EXPORT_SYMBOL(omapdss_get_dss); -void omapdss_set_dss(struct dss_device *dss) +void omapdss_set_dss(struct dss_data *dss) { dss_device = dss; } EXPORT_SYMBOL(omapdss_set_dss); -struct dispc_device *dispc_get_dispc(struct dss_device *dss) +struct dispc_device *dispc_get_dispc(struct dss_data *dss) { return dss->dispc; } EXPORT_SYMBOL(dispc_get_dispc); -const struct dispc_ops *dispc_get_ops(struct dss_device *dss) +const struct dispc_ops *dispc_get_ops(struct dss_data *dss) { return dss->dispc_ops; } diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index ce470b5..338490d 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -4791,6 +4791,10 @@ static int dispc_bind(struct device *dev, struct device *master, void *data) dispc->debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs, dispc); + // XXX get rid of the above redundant data members + dss->data.dispc = dss->dispc; + dss->data.dispc_ops = dss->dispc_ops; + return 0; err_runtime_get: diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c index 4a08bd1..5752328 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1326,7 +1326,7 @@ static int dss_bind(struct device *dev) pm_set_vt_switch(0); omapdss_gather_components(dev); - omapdss_set_dss(dss); + omapdss_set_dss(&dss->data); return 0; } diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h index 6f6fd3d..434262a 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.h +++ b/drivers/gpu/drm/omapdrm/dss/dss.h @@ -273,6 +273,8 @@ struct dss_device { struct dss_pll *video1_pll; struct dss_pll *video2_pll; + struct dss_data data; + // XXX these are redundant, use data instead struct dispc_device *dispc; const struct dispc_ops *dispc_ops; }; diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index a4f71e0..1299dd6 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -589,8 +589,13 @@ struct omap_dss_driver { const struct hdmi_avi_infoframe *avi); }; -struct dss_device *omapdss_get_dss(void); -void omapdss_set_dss(struct dss_device *dss); +struct dss_data { + const struct dispc_ops *dispc_ops; + struct dispc_device *dispc; +}; + +struct dss_data *omapdss_get_dss(void); +void omapdss_set_dss(struct dss_data *dss); static inline bool omapdss_is_initialized(void) { return !!omapdss_get_dss(); @@ -749,8 +754,8 @@ struct dispc_ops { enum omap_plane_id plane); }; -struct dispc_device *dispc_get_dispc(struct dss_device *dss); -const struct dispc_ops *dispc_get_ops(struct dss_device *dss); +struct dispc_device *dispc_get_dispc(struct dss_data *dss); +const struct dispc_ops *dispc_get_ops(struct dss_data *dss); bool omapdss_component_is_display(struct device_node *node); bool omapdss_component_is_output(struct device_node *node); diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index 6eaee4d..3b7ec7e 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -50,7 +50,7 @@ struct omap_drm_private { struct device *dev; u32 omaprev; - struct dss_device *dss; + struct dss_data *dss; struct dispc_device *dispc; const struct dispc_ops *dispc_ops;