[PATCH v2 05/28] drm: omapdrm: Infer the OMAP version from the SoC family
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon May 8 11:32:40 UTC 2017
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 <laurent.pinchart at ideasonboard.com>
---
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 <http://www.gnu.org/licenses/>.
*/
+#include <linux/sys_soc.h>
#include <linux/wait.h>
#include <drm/drm_atomic.h>
@@ -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 <linux/module.h>
-#include <linux/platform_data/omap_drm.h>
#include <linux/types.h>
#include <linux/wait.h>
--
Regards,
Laurent Pinchart
More information about the dri-devel
mailing list