[{"id":1763218,"web_url":"http://patchwork.ozlabs.org/comment/1763218/","msgid":"<20170905110800.r6e2dh2nj76ycfc7@phenom.ffwll.local>","list_archive_url":null,"date":"2017-09-05T11:08:00","subject":"Re: [PATCHv7 3/3] ARM:drm ivip Intel FPGA Video and Image Processing\n\tSuite","submitter":{"id":1959,"url":"http://patchwork.ozlabs.org/api/people/1959/","name":"Daniel Vetter","email":"daniel@ffwll.ch"},"content":"On Tue, Sep 05, 2017 at 03:12:32PM +0800, Hean-Loong, Ong wrote:\n> From: Ong Hean Loong <hean.loong.ong@intel.com>\n> \n> Driver for Intel FPGA Video and Image Processing Suite Frame Buffer II.\n> The driver only supports the Intel Arria10 devkit and its variants.\n> This driver can be either loaded staticlly or in modules.\n> The OF device tree binding is located at:\n> Documentation/devicetree/bindings/display/altr,vip-fb2.txt\n> \n> Signed-off-by: Ong Hean Loong <hean.loong.ong@intel.com>\n> ---\n> V7:\n> *Fix Comments. Fix indentation in Makefile\n> \n> V6:\n> *Fix Comments. Commit comments need to be discriptive\n> \n> V5:\n> *Fix Comments. Remove dem_kfree and bits per symbol\n> \n> V4:\n> *No fixes.\n> \n> V3:\n> *Changes to fixing drm_simple_pipe\n> *Used drm_fb_cma_get_gem_addr\n> \n> V2:\n> *Adding drm_simple_display_pipe_init\n> \n> ---\n> ---\n>  drivers/gpu/drm/Kconfig               |   2 +\n>  drivers/gpu/drm/Makefile              |   1 +\n>  drivers/gpu/drm/ivip/Kconfig          |  14 +++\n>  drivers/gpu/drm/ivip/Makefile         |   9 ++\n>  drivers/gpu/drm/ivip/intel_vip_conn.c |  96 +++++++++++++++++\n>  drivers/gpu/drm/ivip/intel_vip_core.c | 162 ++++++++++++++++++++++++++++\n>  drivers/gpu/drm/ivip/intel_vip_drv.h  |  52 +++++++++\n>  drivers/gpu/drm/ivip/intel_vip_of.c   | 194 ++++++++++++++++++++++++++++++++++\n>  8 files changed, 530 insertions(+)\n>  create mode 100644 drivers/gpu/drm/ivip/Kconfig\n>  create mode 100644 drivers/gpu/drm/ivip/Makefile\n>  create mode 100644 drivers/gpu/drm/ivip/intel_vip_conn.c\n>  create mode 100644 drivers/gpu/drm/ivip/intel_vip_core.c\n>  create mode 100644 drivers/gpu/drm/ivip/intel_vip_drv.h\n>  create mode 100644 drivers/gpu/drm/ivip/intel_vip_of.c\n> \n> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig\n> index 83cb2a8..38a184d 100644\n> --- a/drivers/gpu/drm/Kconfig\n> +++ b/drivers/gpu/drm/Kconfig\n> @@ -195,6 +195,8 @@ source \"drivers/gpu/drm/nouveau/Kconfig\"\n>  \n>  source \"drivers/gpu/drm/i915/Kconfig\"\n>  \n> +source \"drivers/gpu/drm/ivip/Kconfig\"\n> +\n>  config DRM_VGEM\n>  \ttristate \"Virtual GEM provider\"\n>  \tdepends on DRM\n> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile\n> index 24a066e..4162a0e 100644\n> --- a/drivers/gpu/drm/Makefile\n> +++ b/drivers/gpu/drm/Makefile\n> @@ -58,6 +58,7 @@ obj-$(CONFIG_DRM_AMDGPU)+= amd/amdgpu/\n>  obj-$(CONFIG_DRM_MGA)\t+= mga/\n>  obj-$(CONFIG_DRM_I810)\t+= i810/\n>  obj-$(CONFIG_DRM_I915)\t+= i915/\n> +obj-$(CONFIG_DRM_IVIP) += ivip/\n>  obj-$(CONFIG_DRM_MGAG200) += mgag200/\n>  obj-$(CONFIG_DRM_VC4)  += vc4/\n>  obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus/\n> diff --git a/drivers/gpu/drm/ivip/Kconfig b/drivers/gpu/drm/ivip/Kconfig\n> new file mode 100644\n> index 0000000..bf2d995\n> --- /dev/null\n> +++ b/drivers/gpu/drm/ivip/Kconfig\n> @@ -0,0 +1,14 @@\n> +config DRM_IVIP\n> +        tristate \"Intel FGPA Video and Image Processing\"\n> +        depends on DRM && OF\n> +        select DRM_GEM_CMA_HELPER\n> +        select DRM_KMS_HELPER\n> +        select DRM_KMS_FB_HELPER\n> +        select DRM_KMS_CMA_HELPER\n> +        help\n> +\t\t  Choose this option if you have an Intel FPGA Arria 10 system\n> +\t\t  and above with an Intel Display Port IP. This does not support\n> +\t\t  legacy Intel FPGA Cyclone V display port. Currently only single\n> +\t\t  frame buffer is supported. Note that ACPI and X_86 architecture\n> +\t\t  is not supported for Arria10. If M is selected the module will be\n> +\t\t  called ivip.\n> diff --git a/drivers/gpu/drm/ivip/Makefile b/drivers/gpu/drm/ivip/Makefile\n> new file mode 100644\n> index 0000000..cc55b04\n> --- /dev/null\n> +++ b/drivers/gpu/drm/ivip/Makefile\n> @@ -0,0 +1,9 @@\n> +#\n> +# Makefile for the drm device driver.  This driver provides support for the\n> +# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.\n> +\n> +ccflags-y := -Iinclude/drm\n> +\n> +obj-$(CONFIG_DRM_IVIP) += ivip.o\n> +ivip-objs := intel_vip_of.o intel_vip_core.o \\\n> +\tintel_vip_conn.o\n> diff --git a/drivers/gpu/drm/ivip/intel_vip_conn.c b/drivers/gpu/drm/ivip/intel_vip_conn.c\n> new file mode 100644\n> index 0000000..c88df23\n> --- /dev/null\n> +++ b/drivers/gpu/drm/ivip/intel_vip_conn.c\n> @@ -0,0 +1,96 @@\n> +/*\n> + * intel_vip_conn.c -- Intel Video and Image Processing(VIP)\n> + * Frame Buffer II driver\n> + *\n> + * This driver supports the Intel VIP Frame Reader component.\n> + * More info on the hardware can be found in the Intel Video\n> + * and Image Processing Suite User Guide at this address\n> + * http://www.altera.com/literature/ug/ug_vip.pdf.\n> + *\n> + * This program is free software; you can redistribute it and/or modify it\n> + * under the terms and conditions of the GNU General Public License,\n> + * version 2, as published by the Free Software Foundation.\n> + *\n> + * This program is distributed in the hope it will be useful, but WITHOUT\n> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\n> + * more details.\n> + *\n> + * Authors:\n> + * Ong, Hean-Loong <hean.loong.ong@intel.com>\n> + *\n> + */\n> +\n> +#include <linux/init.h>\n> +#include <linux/kernel.h>\n> +#include <drm/drm_atomic_helper.h>\n> +#include <drm/drm_crtc_helper.h>\n> +#include <drm/drm_encoder_slave.h>\n> +#include <drm/drm_plane_helper.h>\n> +\n> +static enum drm_connector_status\n> +intelvipfb_drm_connector_detect(struct drm_connector *connector, bool force)\n> +{\n> +\treturn connector_status_connected;\n> +}\n> +\n> +static void intelvipfb_drm_connector_destroy(struct drm_connector *connector)\n> +{\n> +\tdrm_connector_unregister(connector);\n> +\tdrm_connector_cleanup(connector);\n> +}\n> +\n> +static const struct drm_connector_funcs intelvipfb_drm_connector_funcs = {\n> +\t.dpms = drm_atomic_helper_connector_dpms,\n> +\t.reset = drm_atomic_helper_connector_reset,\n> +\t.detect = intelvipfb_drm_connector_detect,\n> +\t.fill_modes = drm_helper_probe_single_connector_modes,\n> +\t.destroy = intelvipfb_drm_connector_destroy,\n> +\t.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,\n> +\t.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,\n> +};\n> +\n> +static int intelvipfb_drm_connector_get_modes(struct drm_connector *connector)\n> +{\n> +\tstruct drm_device *drm = connector->dev;\n> +\tint count;\n> +\n> +\tcount = drm_add_modes_noedid(connector, drm->mode_config.max_width,\n> +\t\t\tdrm->mode_config.max_height);\n> +\tdrm_set_preferred_mode(connector, drm->mode_config.max_width,\n> +\t\t\tdrm->mode_config.max_height);\n> +\treturn count;\n> +}\n> +\n> +static const struct drm_connector_helper_funcs\n> +intelvipfb_drm_connector_helper_funcs = {\n> +\t.get_modes = intelvipfb_drm_connector_get_modes,\n> +};\n> +\n> +struct drm_connector *\n> +intelvipfb_conn_setup(struct drm_device *drm)\n> +{\n> +\tstruct drm_connector *conn;\n> +\tint ret;\n> +\n> +\tconn = devm_kzalloc(drm->dev, sizeof(*conn), GFP_KERNEL);\n> +\tif (IS_ERR(conn))\n> +\t\treturn NULL;\n> +\n> +\tret = drm_connector_init(drm, conn, &intelvipfb_drm_connector_funcs,\n> +\t\t\tDRM_MODE_CONNECTOR_DisplayPort);\n> +\tif (ret < 0) {\n> +\t\tdev_err(drm->dev, \"failed to initialize drm connector\\n\");\n> +\t\tret = -ENOMEM;\n> +\t\tgoto error_connector_cleanup;\n> +\t}\n> +\n> +\tdrm_connector_helper_add(conn, &intelvipfb_drm_connector_helper_funcs);\n> +\n> +\treturn conn;\n> +\n> +error_connector_cleanup:\n> +\tdrm_connector_cleanup(conn);\n> +\n> +\treturn NULL;\n> +}\n> diff --git a/drivers/gpu/drm/ivip/intel_vip_core.c b/drivers/gpu/drm/ivip/intel_vip_core.c\n> new file mode 100644\n> index 0000000..6b43c13\n> --- /dev/null\n> +++ b/drivers/gpu/drm/ivip/intel_vip_core.c\n> @@ -0,0 +1,162 @@\n> +/*\n> + * intel_vip_core.c -- Intel Video and Image Processing(VIP)\n> + * Frame Buffer II driver\n> + *\n> + * This driver supports the Intel VIP Frame Reader component.\n> + * More info on the hardware can be found in the Intel Video\n> + * and Image Processing Suite User Guide at this address\n> + * http://www.altera.com/literature/ug/ug_vip.pdf.\n> + *\n> + * This program is free software; you can redistribute it and/or modify it\n> + * under the terms and conditions of the GNU General Public License,\n> + * version 2, as published by the Free Software Foundation.\n> + *\n> + * This program is distributed in the hope it will be useful, but WITHOUT\n> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\n> + * more details.\n> + *\n> + * Authors:\n> + * Ong, Hean-Loong <hean.loong.ong@intel.com>\n> + *\n> + */\n> +\n> +#include <drm/drmP.h>\n> +#include <drm/drm_atomic.h>\n> +#include <drm/drm_atomic_helper.h>\n> +#include <drm/drm_crtc_helper.h>\n> +#include <drm/drm_fb_helper.h>\n> +#include <drm/drm_fb_cma_helper.h>\n> +#include <drm/drm_gem_cma_helper.h>\n> +#include <drm/drm_plane_helper.h>\n> +#include <drm/drm_simple_kms_helper.h>\n> +\n> +#include <linux/init.h>\n> +#include <linux/kernel.h>\n> +#include <linux/module.h>\n> +\n> +#include \"intel_vip_drv.h\"\n> +\n> +static void intelvipfb_enable(struct drm_simple_display_pipe *pipe,\n> +\t       struct drm_crtc_state *crtc_state)\n> +{\n> +\t/*\n> +\t * The frameinfo variable has to correspond to the size of the VIP Suite\n> +\t * Frame Reader register 7 which will determine the maximum size used\n> +\t * in this frameinfo\n> +\t */\n> +\n> +\tu32 frameinfo;\n> +\tstruct intelvipfb_priv *priv = pipe->plane.dev->dev_private;\n> +\tvoid __iomem *base = priv->base;\n> +\tstruct drm_plane_state *state = pipe->plane.state;\n> +\tdma_addr_t addr;\n> +\n> +\taddr = drm_fb_cma_get_gem_addr(state->fb, state, 0);\n> +\n> +\tdev_info(pipe->plane.dev->dev, \"Address 0x%x\\n\", addr);\n> +\n> +\tframeinfo =\n> +\t\treadl(base + INTELVIPFB_FRAME_READER) & 0x00ffffff;\n> +\twritel(frameinfo, base + INTELVIPFB_FRAME_INFO);\n> +\twritel(addr, base + INTELVIPFB_FRAME_START);\n> +\t/* Finally set the control register to 1 to start streaming */\n> +\twritel(1, base + INTELVIPFB_CONTROL);\n> +}\n> +\n> +static void intelvipfb_disable(struct drm_simple_display_pipe *pipe)\n> +{\n> +\tstruct intelvipfb_priv *priv = pipe->plane.dev->dev_private;\n> +\tvoid __iomem *base = priv->base;\n> +\t/* set the control register to 0 to stop streaming */\n> +\twritel(0, base + INTELVIPFB_CONTROL);\n> +}\n> +\n> +static const struct drm_mode_config_funcs intelvipfb_mode_config_funcs = {\n> +\t.fb_create = drm_fb_cma_create,\n> +\t.atomic_check = drm_atomic_helper_check,\n> +\t.atomic_commit = drm_atomic_helper_commit,\n> +};\n> +\n> +static void intelvipfb_setup_mode_config(struct drm_device *drm)\n> +{\n> +\tdrm_mode_config_init(drm);\n> +\tdrm->mode_config.funcs = &intelvipfb_mode_config_funcs;\n> +}\n> +\n> +static int intelvipfb_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,\n> +\t\t\t\t\tstruct drm_plane_state *plane_state)\n> +{\n> +\treturn drm_fb_cma_prepare_fb(&pipe->plane, plane_state);\n> +}\n> +\n> +\n> +static struct drm_simple_display_pipe_funcs fbpriv_funcs = {\n> +\t.prepare_fb = intelvipfb_pipe_prepare_fb,\n> +\t.enable = intelvipfb_enable,\n> +\t.disable = intelvipfb_disable\n> +};\n> +\n> +int intelvipfb_probe(struct device *dev)\n> +{\n> +\tint retval;\n> +\tstruct drm_device *drm;\n> +\tstruct intelvipfb_priv *fbpriv = dev_get_drvdata(dev);\n> +\tstruct drm_connector *connector;\n> +\tu32 formats[] = {DRM_FORMAT_XRGB8888};\n> +\n> +\tdrm = fbpriv->drm;\n> +\n> +\tdrm->dev_private = fbpriv;\n> +\n> +\tintelvipfb_setup_mode_config(drm);\n> +\n> +\tconnector = intelvipfb_conn_setup(drm);\n> +\tif (!connector) {\n> +\t\tdev_err(drm->dev, \"Connector setup failed\\n\");\n> +\t\tgoto err_mode_config;\n> +\t}\n> +\n> +\tretval = drm_simple_display_pipe_init(drm, &fbpriv->pipe,\n> +\t\t\t&fbpriv_funcs, formats,\n> +\t\t\tARRAY_SIZE(formats), connector);\n> +\tif (retval < 0) {\n> +\t\tdev_err(drm->dev, \"Cannot setup simple display pipe\\n\");\n> +\t\tgoto err_mode_config;\n> +\t}\n> +\n> +\tfbpriv->fbcma = drm_fbdev_cma_init(drm,\n> +\t\t\tdrm->mode_config.preferred_depth,\n> +\t\t\tdrm->mode_config.num_connector);\n> +\n> +\tdrm_mode_config_reset(drm);\n\nThe call to config_reset should be after the call to fbdev_cma_init. This\nwill blow if you enable the fbdev/fbcon stuff, and fbcon picks your\ndriver as the console driver (I suspect you didn't enable one of theset\n.kconfig settings).\n\nOtherwise lgtm, with the above fixed up:\n\nAcked-by: Daniel Vetter <daniel.vetter@ffwll.ch>\n\nAnother one, since there's not entry for MAINTAINERS: How do you plan to\nmaintain this driver?\n-Daniel\n\n> +\n> +\tdrm_dev_register(drm, 0);\n> +\n> +\treturn retval;\n> +\n> +err_mode_config:\n> +\n> +\tdrm_mode_config_cleanup(drm);\n> +\treturn -ENODEV;\n> +}\n> +\n> +int intelvipfb_remove(struct device *dev)\n> +{\n> +\tstruct intelvipfb_priv *fbpriv = dev_get_drvdata(dev);\n> +\tstruct drm_device *drm =  fbpriv->drm;\n> +\n> +\tdrm_dev_unregister(drm);\n> +\n> +\tif (fbpriv->fbcma)\n> +\t\tdrm_fbdev_cma_fini(fbpriv->fbcma);\n> +\n> +\tdrm_mode_config_cleanup(drm);\n> +\tdrm_dev_unref(drm);\n> +\n> +\treturn 0;\n> +}\n> +\n> +MODULE_AUTHOR(\"Ong, Hean-Loong <hean.loong.ong@intel.com>\");\n> +MODULE_DESCRIPTION(\"Intel VIP Frame Buffer II driver\");\n> +MODULE_LICENSE(\"GPL v2\");\n> diff --git a/drivers/gpu/drm/ivip/intel_vip_drv.h b/drivers/gpu/drm/ivip/intel_vip_drv.h\n> new file mode 100644\n> index 0000000..0a3555d\n> --- /dev/null\n> +++ b/drivers/gpu/drm/ivip/intel_vip_drv.h\n> @@ -0,0 +1,52 @@\n> +/*\n> + * Copyright (C) 2017 Intel Corporation.\n> + *\n> + * Intel Video and Image Processing(VIP) Frame Buffer II driver.\n> + *\n> + * This program is free software; you can redistribute it and/or modify it\n> + * under the terms and conditions of the GNU General Public License,\n> + * version 2, as published by the Free Software Foundation.\n> + *\n> + * This program is distributed in the hope it will be useful, but WITHOUT\n> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\n> + * more details.\n> + *\n> + * You should have received a copy of the GNU General Public License along with\n> + * this program.  If not, see <http://www.gnu.org/licenses/>.\n> + *\n> + * Authors:\n> + * Ong, Hean-Loong <hean.loong.ong@intel.com>\n> + *\n> + */\n> +#ifndef _INTEL_VIP_DRV_H\n> +#define _INTEL_VIP_DRV_H\n> +\n> +#define DRIVER_NAME    \"intelvipfb\"\n> +#define BYTES_PER_PIXEL\t 4\n> +#define CRTC_NUM\t        1\n> +#define CONN_NUM\t        1\n> +\n> +/* control registers */\n> +#define INTELVIPFB_CONTROL\t      0\n> +#define INTELVIPFB_STATUS\t       0x4\n> +#define INTELVIPFB_INTERRUPT\t    0x8\n> +#define INTELVIPFB_FRAME_COUNTER\t0xC\n> +#define INTELVIPFB_FRAME_DROP\t   0x10\n> +#define INTELVIPFB_FRAME_INFO\t   0x14\n> +#define INTELVIPFB_FRAME_START\t  0x18\n> +#define INTELVIPFB_FRAME_READER\t         0x1C\n> +\n> +int intelvipfb_probe(struct device *dev);\n> +int intelvipfb_remove(struct device *dev);\n> +int intelvipfb_setup_crtc(struct drm_device *drm);\n> +struct drm_connector *intelvipfb_conn_setup(struct drm_device *drm);\n> +\n> +struct intelvipfb_priv {\n> +\tstruct drm_simple_display_pipe pipe;\n> +\tstruct drm_fbdev_cma *fbcma;\n> +\tstruct drm_device *drm;\n> +\tvoid    __iomem *base;\n> +};\n> +\n> +#endif\n> diff --git a/drivers/gpu/drm/ivip/intel_vip_of.c b/drivers/gpu/drm/ivip/intel_vip_of.c\n> new file mode 100644\n> index 0000000..b46f789\n> --- /dev/null\n> +++ b/drivers/gpu/drm/ivip/intel_vip_of.c\n> @@ -0,0 +1,194 @@\n> +/*\n> + * intel_vip_of.c -- Intel Video and Image Processing(VIP)\n> + * Frame Buffer II driver\n> + *\n> + * This driver supports the Intel VIP Frame Reader component.\n> + * More info on the hardware can be found in the Intel Video\n> + * and Image Processing Suite User Guide at this address\n> + * http://www.altera.com/literature/ug/ug_vip.pdf.\n> + *\n> + * This program is free software; you can redistribute it and/or modify it\n> + * under the terms and conditions of the GNU General Public License,\n> + * version 2, as published by the Free Software Foundation.\n> + *\n> + * This program is distributed in the hope it will be useful, but WITHOUT\n> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\n> + * more details.\n> + *\n> + * Authors:\n> + * Ong, Hean-Loong <hean.loong.ong@intel.com>\n> + *\n> + */\n> +#include <drm/drm_fb_helper.h>\n> +#include <drm/drm_fb_cma_helper.h>\n> +#include <drm/drm_gem_cma_helper.h>\n> +#include <drm/drm_of.h>\n> +#include <drm/drm_simple_kms_helper.h>\n> +\n> +#include <linux/component.h>\n> +#include <linux/init.h>\n> +#include <linux/kernel.h>\n> +#include <linux/module.h>\n> +#include <linux/platform_device.h>\n> +\n> +#include \"intel_vip_drv.h\"\n> +\n> +DEFINE_DRM_GEM_CMA_FOPS(drm_fops);\n> +\n> +static void intelvipfb_lastclose(struct drm_device *drm)\n> +{\n> +\tstruct intelvipfb_priv *priv = drm->dev_private;\n> +\n> +\tdrm_fbdev_cma_restore_mode(priv->fbcma);\n> +}\n> +\n> +static struct drm_driver intelvipfb_drm = {\n> +\t.driver_features =\n> +\t\t\tDRIVER_MODESET | DRIVER_GEM |\n> +\t\t\tDRIVER_PRIME | DRIVER_ATOMIC,\n> +\t.gem_free_object_unlocked = drm_gem_cma_free_object,\n> +\t.gem_vm_ops = &drm_gem_cma_vm_ops,\n> +\t.dumb_create = drm_gem_cma_dumb_create,\n> +\t.dumb_map_offset = drm_gem_cma_dumb_map_offset,\n> +\t.dumb_destroy = drm_gem_dumb_destroy,\n> +\t.prime_handle_to_fd = drm_gem_prime_handle_to_fd,\n> +\t.prime_fd_to_handle = drm_gem_prime_fd_to_handle,\n> +\t.gem_prime_export = drm_gem_prime_export,\n> +\t.gem_prime_import = drm_gem_prime_import,\n> +\t.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,\n> +\t.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,\n> +\t.gem_prime_vmap = drm_gem_cma_prime_vmap,\n> +\t.gem_prime_vunmap = drm_gem_cma_prime_vunmap,\n> +\t.gem_prime_mmap = drm_gem_cma_prime_mmap,\n> +\t.lastclose = intelvipfb_lastclose,\n> +\t.name = DRIVER_NAME,\n> +\t.date = \"20170729\",\n> +\t.desc = \"Intel FPGA VIP SUITE\",\n> +\t.major = 1,\n> +\t.minor = 0,\n> +\t.ioctls = NULL,\n> +\t.patchlevel = 0,\n> +\t.fops = &drm_fops,\n> +};\n> +\n> +/*\n> + * Setting up information derived from OF Device Tree Nodes\n> + * max-width, max-height, bits per pixel, memory port width\n> + */\n> +\n> +static int intelvipfb_drm_setup(struct device *dev,\n> +\t\t\t\t\tstruct intelvipfb_priv *fbpriv)\n> +{\n> +\tstruct drm_device *drm = fbpriv->drm;\n> +\tstruct device_node *np = dev->of_node;\n> +\tint mem_word_width;\n> +\tint max_h, max_w;\n> +\tint ret;\n> +\n> +\tret = of_property_read_u32(np, \"altr,max-width\", &max_w);\n> +\tif (ret) {\n> +\t\tdev_err(dev,\n> +\t\t\t\"Missing required parameter 'altr,max-width'\");\n> +\t\treturn ret;\n> +\t}\n> +\n> +\tret = of_property_read_u32(np, \"altr,max-height\", &max_h);\n> +\tif (ret) {\n> +\t\tdev_err(dev,\n> +\t\t\t\"Missing required parameter 'altr,max-height'\");\n> +\t\treturn ret;\n> +\t}\n> +\n> +\tret = of_property_read_u32(np, \"altr,mem-port-width\", &mem_word_width);\n> +\tif (ret) {\n> +\t\tdev_err(dev, \"Missing required parameter 'altr,mem-port-width '\");\n> +\t\treturn ret;\n> +\t}\n> +\n> +\tif (!(mem_word_width >= 32 && mem_word_width % 32 == 0)) {\n> +\t\tdev_err(dev,\n> +\t\t\t\"mem-word-width is set to %i. must be >= 32 and multiple of 32.\",\n> +\t\t\t mem_word_width);\n> +\t\treturn -ENODEV;\n> +\t}\n> +\n> +\tdrm->mode_config.min_width = 640;\n> +\tdrm->mode_config.min_height = 480;\n> +\tdrm->mode_config.max_width = max_w;\n> +\tdrm->mode_config.max_height = max_h;\n> +\tdrm->mode_config.preferred_depth = 32;\n> +\n> +\treturn 0;\n> +}\n> +\n> +static int intelvipfb_of_probe(struct platform_device *pdev)\n> +{\n> +\tint retval;\n> +\tstruct resource *reg_res;\n> +\tstruct intelvipfb_priv *fbpriv;\n> +\tstruct device *dev = &pdev->dev;\n> +\tstruct drm_device *drm;\n> +\n> +\tfbpriv = devm_kzalloc(dev, sizeof(*fbpriv), GFP_KERNEL);\n> +\tif (!fbpriv)\n> +\t\treturn -ENOMEM;\n> +\n> +\t/*setup DRM */\n> +\tdrm = drm_dev_alloc(&intelvipfb_drm, dev);\n> +\tif (IS_ERR(drm))\n> +\t\treturn PTR_ERR(drm);\n> +\n> +\tretval = dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(32));\n> +\tif (retval)\n> +\t\treturn -ENODEV;\n> +\n> +\tfbpriv->drm = drm;\n> +\n> +\treg_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n> +\tif (!reg_res)\n> +\t\treturn -ENOMEM;\n> +\n> +\tfbpriv->base = devm_ioremap_resource(dev, reg_res);\n> +\n> +\tif (IS_ERR(fbpriv->base)) {\n> +\t\tdev_err(dev, \"devm_ioremap_resource failed\\n\");\n> +\t\tretval = PTR_ERR(fbpriv->base);\n> +\t\treturn -ENOMEM;\n> +\t}\n> +\n> +\tintelvipfb_drm_setup(dev, fbpriv);\n> +\n> +\tdev_set_drvdata(dev, fbpriv);\n> +\n> +\treturn intelvipfb_probe(dev);\n> +}\n> +\n> +static int intelvipfb_of_remove(struct platform_device *pdev)\n> +{\n> +\treturn intelvipfb_remove(&pdev->dev);\n> +}\n> +\n> +/*\n> + * The name vip-frame-buffer-2.0 is derived from\n> + * http://www.altera.com/literature/ug/ug_vip.pdf\n> + * frame buffer IP cores section 14\n> + */\n> +\n> +static const struct of_device_id intelvipfb_of_match[] = {\n> +\t{ .compatible = \"altr,vip-frame-buffer-2.0\" },\n> +\t{},\n> +};\n> +\n> +MODULE_DEVICE_TABLE(of, intelvipfb_of_match);\n> +\n> +static struct platform_driver intelvipfb_driver = {\n> +\t.probe = intelvipfb_of_probe,\n> +\t.remove = intelvipfb_of_remove,\n> +\t.driver = {\n> +\t\t.name = DRIVER_NAME,\n> +\t\t.of_match_table = intelvipfb_of_match,\n> +\t},\n> +};\n> +\n> +module_platform_driver(intelvipfb_driver);\n> -- \n> 2.7.4\n> \n> _______________________________________________\n> dri-devel mailing list\n> dri-devel@lists.freedesktop.org\n> https://lists.freedesktop.org/mailman/listinfo/dri-devel","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ffwll.ch header.i=@ffwll.ch header.b=\"X8KsP4hh\";\n\tdkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmkTq4Pmvz9s83\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 21:08:15 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751138AbdIELIM (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 5 Sep 2017 07:08:12 -0400","from mail-wm0-f51.google.com ([74.125.82.51]:36734 \"EHLO\n\tmail-wm0-f51.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751325AbdIELIG (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Tue, 5 Sep 2017 07:08:06 -0400","by mail-wm0-f51.google.com with SMTP id i145so17617695wmf.1\n\tfor <devicetree@vger.kernel.org>;\n\tTue, 05 Sep 2017 04:08:05 -0700 (PDT)","from phenom.ffwll.local ([2a02:168:5635:0:39d2:f87e:2033:9f6])\n\tby smtp.gmail.com with ESMTPSA id\n\tg31sm123759edc.44.2017.09.05.04.08.02\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 05 Sep 2017 04:08:03 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; \n\th=sender:date:from:to:cc:subject:message-id:mail-followup-to\n\t:references:mime-version:content-disposition:in-reply-to:user-agent; \n\tbh=/meD2fSUE6HgCgQw70W2xAxNDelKU/g4zchqrUqhWtY=;\n\tb=X8KsP4hhozG3xQdFeEAKovo2C1Wdf7qeesKRWhAgKPwmVMZx50RmAQT71oyYLx7dVq\n\tgItRFOZMOQkScr0IUsDlCnEwmc6y+1CxEW17BQp8dvQDSXmDhnnmOrLombmVla3M8LY6\n\t7V+qsz8hOej7546adO4ChUOIXOzM9F98Oa6dk=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:date:from:to:cc:subject:message-id\n\t:mail-followup-to:references:mime-version:content-disposition\n\t:in-reply-to:user-agent;\n\tbh=/meD2fSUE6HgCgQw70W2xAxNDelKU/g4zchqrUqhWtY=;\n\tb=iwQeQkVW4q/BZpfMvfkwN1jFP8KDPf+nBecEYMvAqOuPOqFsgJ+cfi1Oj79udAPPcX\n\tggRumlNOKk0PA46rSTnj+gB0TxpClvWl3EjlCsTFjXwHYL74Csom+qI2hH5RayhXPKt+\n\troDwFuL71/C6b1tSYfpho8PLnxIPc7eN/R1RXPN5EqMbstvTzLVgiki3mOZBqgNt3hXR\n\tNj9G7xM9Pv7z1+xdlYPb28pqr3iuJ/q03O8+vh5uW4P9kJ6DcJ/z2oPkWDUKQj9Uwz5J\n\ttR+LwQXuMhjUAiznsgVcZK00IFrsP7WEXzBZ9+w/ON4Q5/CbYyhSWYKtAsBy+5OO49uu\n\tWXFQ==","X-Gm-Message-State":"AHPjjUi1Mrc15uLUu2QBlEc/Dsai9NGa9+yqovHC/SHqpK6wpolhF1l1\n\tlooyc7XzEgwDe9BK","X-Google-Smtp-Source":"ADKCNb6LNFit7iwne9pKmsGvGbgYgml3czC4boetBrINZ1lrWtwwnwcvS38rKSpvN81Z8N4Go2h0Kw==","X-Received":"by 10.80.192.5 with SMTP id r5mr2911826edb.37.1504609684005;\n\tTue, 05 Sep 2017 04:08:04 -0700 (PDT)","Date":"Tue, 5 Sep 2017 13:08:00 +0200","From":"Daniel Vetter <daniel@ffwll.ch>","To":"\"Hean-Loong, Ong\" <hean.loong.ong@intel.com>","Cc":"Rob Herring <robh+dt@kernel.org>, Dinh Nguyen <dinguyen@kernel.org>,\n\tDaniel Vetter <daniel.vetter@intel.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tRandy Dunlap <rdunlap@infradead.org>,\n\tdevicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,\n\tlinux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org","Subject":"Re: [PATCHv7 3/3] ARM:drm ivip Intel FPGA Video and Image Processing\n\tSuite","Message-ID":"<20170905110800.r6e2dh2nj76ycfc7@phenom.ffwll.local>","Mail-Followup-To":"\"Hean-Loong, Ong\" <hean.loong.ong@intel.com>,\n\tRob Herring <robh+dt@kernel.org>, Dinh Nguyen <dinguyen@kernel.org>, \n\tDaniel Vetter <daniel.vetter@intel.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tRandy Dunlap <rdunlap@infradead.org>, devicetree@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,\n\tlinux-arm-kernel@lists.infradead.org","References":"<1504595552-9209-1-git-send-email-hean.loong.ong@intel.com>\n\t<1504595552-9209-4-git-send-email-hean.loong.ong@intel.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<1504595552-9209-4-git-send-email-hean.loong.ong@intel.com>","X-Operating-System":"Linux phenom 4.12.0-1-amd64 ","User-Agent":"NeoMutt/20170609 (1.8.3)","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}}]