diff options
Diffstat (limited to 'drivers/video/imx-ipu-v3/imx-pd.c')
-rw-r--r-- | drivers/video/imx-ipu-v3/imx-pd.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/drivers/video/imx-ipu-v3/imx-pd.c b/drivers/video/imx-ipu-v3/imx-pd.c index 601be35880..d8b5f90a6c 100644 --- a/drivers/video/imx-ipu-v3/imx-pd.c +++ b/drivers/video/imx-ipu-v3/imx-pd.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * i.MX drm driver - parallel display implementation * * Copyright (C) 2016 Philippe Leduc - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. */ #include <common.h> @@ -27,8 +19,10 @@ #include "imx-ipu-v3.h" +#define IMX_PD_OUTPUT_PORT 1 + struct imx_pd { - struct device_d *dev; + struct device *dev; struct display_timings *timings; u32 bus_format; struct vpl vpl; @@ -39,7 +33,6 @@ static int imx_pd_ioctl(struct vpl *vpl, unsigned int port, { struct imx_pd *imx_pd = container_of(vpl, struct imx_pd, vpl); struct ipu_di_mode *mode; - struct display_timings *timings; switch (cmd) { case IMX_IPU_VPL_DI_MODE: @@ -50,22 +43,29 @@ static int imx_pd_ioctl(struct vpl *vpl, unsigned int port, return 0; case VPL_GET_VIDEOMODES: - timings = data; - - timings->num_modes = imx_pd->timings->num_modes; - timings->native_mode = imx_pd->timings->native_mode; - timings->modes = imx_pd->timings->modes; - timings->edid = NULL; - return 0; + if (imx_pd->timings) { + struct display_timings *timings = data; + + timings->num_modes = imx_pd->timings->num_modes; + timings->native_mode = imx_pd->timings->native_mode; + timings->modes = imx_pd->timings->modes; + timings->edid = NULL; + return 0; + } + break; } + if (!imx_pd->timings) + return vpl_ioctl(vpl, IMX_PD_OUTPUT_PORT, cmd, data); + return 0; } -static int imx_pd_probe(struct device_d *dev) +static int imx_pd_probe(struct device *dev) { - struct device_node *node = dev->device_node; + struct device_node *node = dev->of_node; struct imx_pd *imx_pd; + struct device_node *port; const char *fmt; int ret; @@ -88,8 +88,11 @@ static int imx_pd_probe(struct device_d *dev) imx_pd->timings = of_get_display_timings(node); if (!imx_pd->timings) { - dev_err(dev, "No display timings panel found\n"); - return -EINVAL; + port = of_graph_get_port_by_id(node, IMX_PD_OUTPUT_PORT); + if (!port) { + dev_err(dev, "Neither display timings in nor remote panel found in node\n"); + return -EINVAL; + } } imx_pd->vpl.node = node; @@ -105,8 +108,9 @@ static struct of_device_id imx_pd_dt_ids[] = { { .compatible = "fsl,imx-parallel-display", }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, imx_pd_dt_ids); -static struct driver_d imx_pd_driver = { +static struct driver imx_pd_driver = { .probe = imx_pd_probe, .of_compatible = imx_pd_dt_ids, .name = "imx-parallel-display", |