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: 128542 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp453486ljc; Fri, 16 Feb 2018 03:25:31 -0800 (PST) X-Google-Smtp-Source: AH8x224RMVAT0FPog01wV1MEoG+ruC9pCBSVLrgBV+uqtnSUlzl06V5DCOKDKgeag8mkh51DOXGh X-Received: by 2002:a17:902:ad05:: with SMTP id i5-v6mr5730562plr.139.1518780331607; Fri, 16 Feb 2018 03:25:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518780331; cv=none; d=google.com; s=arc-20160816; b=qx8YlbwAoIq+62XPlwwMLU/7eyoiyq4B2Qd6GG5rMNcd17LCEVitGd1qaLnvz2cw1P K3TVoc4TYvBKTRJaANVjixElNipRMZ5+8TPDyF4UXL70meXzqogaVUJEgfMZQPDeGMw4 WLTvCw3Y6wnYb8xQBDZTmK2s9krc8ecDfNZAeYepxwYJwthYRy68TVF6+nIsaXbdj57u jD4SzTcGX5F/AqMN12NZP/twQiXP9dOW83HXuyPehgd+KHGGjTIpbhafQ/i9CxsDEgHh W9zqp9EbhaCYKRFjLXSgKkcIs8/INTpsDmxOStBTfGm/Eog3kZzTgUKfmx6DEz5h76ku VdLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=pQ5mt1OKKIY860HuvEV7Cb59uvIGVRvy0DTE3UYwE0k=; b=RRrYE8hhwhgI70pXxOVuuappibYGxy/jZpXx0qn/wh2wFtJW02B9DT9FtPaTtotvko uOD4M8UcOjvfOvVeEqP2atLWa0a2dLBuptAViOy3p0m6ahbEtwOmWBLNN/BLSgAN1xEB oI65okB/jtk3MR8W990NP0c19F+i88BmyQdlP37Er+guxlxYd80hpYs8/vOif90isIaq HiT78XOmiX5uxJHvcswiWcR5exqSxRHr+iHSHuovFRtiW8IaN6S/M/ZXuyeKwt3etvWX SMLsdTNA7uSwVTMdZmGDq/yW5VmhxHyQzJurrokDEiypYh/w2QdhiZe8GPUiDIcWJE+L KIbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=pJTrCNod; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id n4si1309281pgp.369.2018.02.16.03.25.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Feb 2018 03:25:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=pJTrCNod; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com 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" 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;