From patchwork Mon May 8 11:32:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 9716021 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 29A8560364 for ; Mon, 8 May 2017 11:33:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FACA26530 for ; Mon, 8 May 2017 11:33:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1493B26861; Mon, 8 May 2017 11:33:29 +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 C2E9C26530 for ; Mon, 8 May 2017 11:33:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B6576E222; Mon, 8 May 2017 11:33:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from galahad.ideasonboard.com (galahad.ideasonboard.com [185.26.127.97]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D3676E219 for ; Mon, 8 May 2017 11:33:13 +0000 (UTC) Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 7294F20752; Mon, 8 May 2017 13:32:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1494243127; bh=kkAZyl3/QSZqmhMX/Mue/Ncu5OQ8f5yRuxfDZLXVD4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nPafXOzzRDPIHDqFDps5k9CPZO9fRfuOcJuRun9xyKCuzRc5WclA1xZ42EfPBxMcX 4O00SPrV1xleBc1SG6zydM6huFFENUur30ozozvs6+eAGS8ZgWLsk/9ix+XG+qx2hA ulWskwnwDKjAv3OT6PDTqJUs34GkhTRseYCYIQT4= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 05/28] drm: omapdrm: Infer the OMAP version from the SoC family Date: Mon, 8 May 2017 14:32:40 +0300 Message-Id: <20170508113303.27521-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170508113303.27521-1-laurent.pinchart@ideasonboard.com> References: <20170508113303.27521-1-laurent.pinchart@ideasonboard.com> Cc: Tomi Valkeinen X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The omapdrm exposes the SoC version to userspace through an integer that contains the OMAP model (e.g. 0x3430 for the OMAP3430). This is an unfortunate choice of userspace API as it's both conceptually wrong (userspace nowadays should use /sys/bus/soc/ for that purpose) and inaccurate as many models with different features are reported with the same version number. The only known user of this API is the xomap X11 driver. Even if it has been deprecated for some time we can't drop the kernel API yet. We can, however, infer the version number from the SoC family to avoid the need to pass the version number through platform data. Do this, which makes the omapdrm platform data not needed anymore, and ready to be removed. Signed-off-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 14 ++++++++++++-- drivers/gpu/drm/omapdrm/omap_drv.h | 1 - 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 3f2554235225..343301ed4741 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -17,6 +17,7 @@ * this program. If not, see . */ +#include #include #include @@ -753,9 +754,17 @@ static struct drm_driver omap_drm_driver = { .patchlevel = DRIVER_PATCHLEVEL, }; +static const struct soc_device_attribute dss_soc_devices[] = { + { .family = "OMAP3", .data = (void *)0x3430 }, + { .family = "OMAP4", .data = (void *)0x4430 }, + { .family = "OMAP5", .data = (void *)0x5430 }, + { .family = "DRA7", .data = (void *)0x0752 }, + { /* sentinel */ } +}; + static int pdev_probe(struct platform_device *pdev) { - struct omap_drm_platform_data *pdata = pdev->dev.platform_data; + const struct soc_device_attribute *soc; struct omap_drm_private *priv; struct drm_device *ddev; unsigned int i; @@ -779,7 +788,8 @@ static int pdev_probe(struct platform_device *pdev) goto err_disconnect_dssdevs; } - priv->omaprev = pdata->omaprev; + soc = soc_device_match(dss_soc_devices); + priv->omaprev = soc ? (unsigned int)soc->data : 0; priv->wq = alloc_ordered_workqueue("omapdrm", 0); init_waitqueue_head(&priv->commit.wait); diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index 65977982f15f..0351d017734e 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -21,7 +21,6 @@ #define __OMAP_DRV_H__ #include -#include #include #include