aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/sun4i (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-04-20Merge tag 'sunxi-drm-for-4.12' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into drm-nextDave Airlie14-107/+163
Allwinner DRM changes for 4.12 Not any functional changes, but a lot of preliminary rework in order to support multiple display pipelines. * tag 'sunxi-drm-for-4.12' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux: (26 commits) MAINTAINERS: Add sun4i-drm git repo drm/sun4i: Pass pointer for underlying backend into layer init drm/sun4i: Pass pointers for associated backend and tcon into crtc init drm/sun4i: tv: Get tcon and backend pointers from associated crtc drm/sun4i: Use embedded tcon pointer to get the tcon's output port node drm/sun4i: Fix tcon channel 0 comment about backporch = backporch + hsync drm/sun4i: Fix TCON clock and regmap initialization sequence drm/sun4i: Grab reserved memory region drm/sun4i: Add backend and tcon pointers to sun4i_crtc drm/sun4i: Add backend pointer to sun4i_layer drm/sun4i: rgb: Pass tcon pointer when initializing RGB encoder drm/sun4i: tv: Switch to drm_of_find_possible_crtcs drm/sun4i: Drop hardcoded .possible_crtcs values from layers drm/sun4i: Drop primary layer pointer from sun4i_drv drm/sun4i: Initialize crtc from tcon bind function drm/sun4i: Move layers from sun4i_drv to sun4i_crtc drm/sun4i: Add end of list element for sun4i_layers_init's returned list drm/sun4i: Set drm_crtc.port to the underlying TCON's output port node drm/sun4i: Make sunxi_rgb2yuv_coef constant drm/sun4i: Make sun4i_crtc_init return ERR_PTR style error codes ...
2017-04-06drm: convert drivers to use drm_of_find_panel_or_bridgeRob Herring2-90/+11
Similar to the previous commit, convert drivers open coding OF graph parsing to use drm_of_find_panel_or_bridge instead. This changes some error messages to debug messages (in the graph core). Graph connections are often "no connects" depending on the particular board, so we want to avoid spurious messages. Plus the kernel is not a DT validator. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Archit Taneja <architt@codeaurora.org> Tested-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> [seanpaul dropped rockchip changes since they're now obsolete] Signed-off-by: Sean Paul <seanpaul@chromium.org>
2017-03-14drm: Create DEFINE_DRM_GEM_CMA_FOPS and roll it out to driversDaniel Vetter1-11/+1
Less code ftw. This converts all drivers except the tinydrm helper module. That one needs more work, since it gets the THIS_MODULE reference from tinydrm.ko instead of the actual driver module like it should. Probably needs a similar trick like I used here with generating the entire struct with a macro. Cc: Noralf Trønnes <noralf@tronnes.org> Reviewed-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170308141257.12119-24-daniel.vetter@ffwll.ch
2017-03-09drm/sun4i: Pass pointer for underlying backend into layer initChen-Yu Tsai3-9/+9
sun4i_layer only controls the backend hardware block of the display pipeline. Pass pointers to the underlying backend in the layer init function, instead of trying to fetch it from the drm_device structure. This avoids the headache of trying to figure out which device the layers actually belong to. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-09drm/sun4i: Pass pointers for associated backend and tcon into crtc initChen-Yu Tsai3-6/+9
sun4i_crtc controls the backend and tcon hardware blocks of the display pipeline. Pass pointers to the underlying devices into the crtc init function, instead of trying to fetch them from the drm_device structure. This avoids the headache of trying to figure out which devices the crtc is actually associated with. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-09drm/sun4i: tv: Get tcon and backend pointers from associated crtcChen-Yu Tsai1-8/+11
The drm_encoder structure provides us with a pointer to the crtc currently tied to the encoder. Subsequently we can extract the tcon and backend pointers from our crtc structure, instead of getting it directly from the sun4i_drv structure. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-09drm/sun4i: Use embedded tcon pointer to get the tcon's output port nodeChen-Yu Tsai1-1/+1
A pointer to the underlying tcon of the crtc was added to the sun4i_crtc structure in "drm/sun4i: Add backend and tcon pointers to sun4i_crtc". However the crtc init function was still using the copy from sun4i_drv to set drm_crtc.port. This was an oversight when the patches were reordered. Switch to using the embedded tcon pointer to get the tcon's ouptut port and assign it to drm_crtc.port. This makes it possible to remove the usage of sun4i_drv completely in subsequent patches. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-09drm/sun4i: Fix tcon channel 0 comment about backporch = backporch + hsyncChen-Yu Tsai1-2/+2
The backporch programmed into the tcon registers is actually the backporch + hsync length from the display timings, as indicated in the interface timing diagrams found in the user manual of the A31 and A33 SoCs. The comments for channel 0 mistakenly describe the discrepancy as TCON backporch = frontporch + hsync. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-09drm/sun4i: Fix TCON clock and regmap initialization sequenceChen-Yu Tsai1-7/+15
The TCON driver calls sun4i_tcon_init_regmap and sun4i_tcon_init_clocks in its bind function. The former creates a regmap and writes to several register to clear its configuration to a known default. The latter initializes various clocks. This includes enabling the bus clock for register access and creating the dotclock. In order for the first step's writes to work, the bus clock must be enabled which is done in the second step. but the dotclock's ops use the regmap created in the first step. Rearrange the function calls such that the clocks are initialized before the regmap, and split out the dot clock creation to after the regmap is initialized. Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support") Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Grab reserved memory regionMaxime Ripard1-1/+11
Allow to provide an optional memory region to allocate from for our DRM driver. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Add backend and tcon pointers to sun4i_crtcChen-Yu Tsai2-12/+9
sun4i_crtc controls the backend and tcon hardware blocks of the display pipeline. Instead of doing so through the master drm structure, leave pointers to the corresponding backend and tcon in itself. Also drop the drm_device pointer, since it is no longer needed. The next step forward would be to pass the pointers in through sun4i_crtc_init as parameters. This would make it easier to support multiple display pipelines layer on. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Add backend pointer to sun4i_layerChen-Yu Tsai2-5/+4
sun4i_layer only controls the backend hardware block of the display pipeline. Instead of getting a pointer to the underlying backend through the drm_device structure, leave one in itself. Also drop the drm_device pointer, since it is no longer needed. The next step forward would be to pass the pointer in through sun4i_layers_init as a parameter. This would make it easier to support multiple display pipelines layer on. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: rgb: Pass tcon pointer when initializing RGB encoderChen-Yu Tsai3-20/+11
The RGB encoder represents channel 0 of the TCON. Instead of fetching the pointer to its TCON from the main sun4i_drv structure, pass it in as part of the init call, save it, and use it directly in the encoder and connector callbacks. We can also drop the otherwise unused sun4i_drv pointer. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: tv: Switch to drm_of_find_possible_crtcsChen-Yu Tsai1-1/+7
Now that the crtcs have their .port field set properly, we can use drm_of_find_possible_crtcs to find the connected crtcs, instead of hardcoding the first crtc as usable. The new code also defers binding when the upstream crtc hasn't been registered yet. This makes it easier to support multiple tcons/crtcs. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Drop hardcoded .possible_crtcs values from layersChen-Yu Tsai3-2/+13
To support multiple display pipelines, we would have multiple crtcs, with one or more planes bound to them. Obviously having hardcoded values for the drm_plane .possible_crtcs field is not going to work. For primary and cursor planes, the value is set by drm_crtc_init_with_planes. We just need to set it for overlay planes. We also fix the value set for the RGB encoder, by referencing the crtc set in sun4i_drv. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Drop primary layer pointer from sun4i_drvChen-Yu Tsai3-8/+21
The current layer init code keeps a pointer to the primary plane layer in sun4i_drv. When we eventually support multiple display pipelines, this would force us to keep track of primary planes for all crtcs. And these pointers only get used at bind time. Instead, have the crtc init code iterate through the returned layers to find the primary and cursor layers. And drop the pointer from the sun4i_drv structure. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Initialize crtc from tcon bind functionChen-Yu Tsai5-13/+13
The tcon provides part of the functionality of the crtc, and also provides the device node for the output port of the crtc. To be able to use drm_of_find_possible_crtcs(), all crtc must be initialized before any downstream encoders. The other part of the crtc is the display backend. The Rockchip DRM driver does this by first binding all vops, which is their crtc, and this step also creates the crtc objects. Then all remaining hardware components are bound. With the Allwinner display pipeline, we have multiple components comprising the crtc, and varying depths of the display pipeline. Since components are added with a depth first search of the of_graph, we can initialize the crtc object within the tcon bind function. Since the backend precedes the tcon, and the backends cannot be muxed or switched around, we can be sure that the associated backend is already initialized. This patch also moves the crtc pointer from the main drm_device data to the tcon device data. Besides the crtc callbacks, the crtc structure is only used within the tcon driver to signal vblank events from its interrupt handler. As the crtc and layer bits are now called from the tcon bits, we must move them from the sun4i-drm module to the sun4i-tcon module to avoid circular dependencies between the two modules. This is because sun4i-drm also calls into sun4i-tcon. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Move layers from sun4i_drv to sun4i_crtcChen-Yu Tsai4-11/+10
This patch moves the sun4i_layers_init call from sun4i_drv_bind to sun4i_crtc_init, and the layers pointer from struct sun4i_drv to struct sun4i_crtc. The layers are bound to a specific crtc, and they are not directly used once initiated. They are used through their included drm_plane structures. Moving the layers into the crtc facilitates binding them to the crtc explicitly, by setting the corresponding bit in their .possible_crtcs fields right after the crtc is initialized. This is done in a later patch. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Add end of list element for sun4i_layers_init's returned listChen-Yu Tsai1-1/+1
The number of defined planes in sun4i_layer is unknown to other parts of the sun4i drm driver. Since the return value of sun4i_layers_init is a list of layers, make it return 1 more empty layer as an end of list guard value. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Set drm_crtc.port to the underlying TCON's output port nodeChen-Yu Tsai1-0/+5
The way drm_of_find_possible_crtcs works is it tries to match the remote-endpoint of the given node's various endpoints to all the crtc's .port field. Thus we need to set drm_crtc.port to the output port node of the underlying TCON. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Make sunxi_rgb2yuv_coef constantChen-Yu Tsai1-1/+1
sunxi_rgb2yuv_coef is a table of RGB-to-YUV conversion coefficients. They are programmed into the hardware, and can be declared constant. Reported-by: Priit Laes <plaes@plaes.org> Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Make sun4i_crtc_init return ERR_PTR style error codesChen-Yu Tsai2-4/+4
sun4i_crtc_init can fail for a number of reasons. Instead of returning a NULL pointer when it fails, pass back the encountered error using ERR_PTR. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Save newly created layer in layers array in sun4i_layers_initChen-Yu Tsai1-0/+1
sun4i_layers_init allocates an array to store pointers to newly created layers returned by sun4i_layer_init_one(), but fails to actually store them. But it actually returns the empty array to unsuspecting users. Save the pointers in the array, so that they may be used later. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Drop useless assignment in sun4i_layers_initChen-Yu Tsai1-1/+1
The assignment found in the main loop in sun4i_layers_init: struct sun4i_layer *layer = layers[i]; is useless as it gets overwritten by the next line: layer = sun4i_layer_init_one(drm, plane); Drop the assignment. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Fix kcalloc element size in sun4i_layers_initChen-Yu Tsai1-1/+1
In sun4i_layers_init we are allocating an array of pointers to struct sun4i_layer: layers = devm_kcalloc(drm->dev, ARRAY_SIZE(sun4i_backend_planes), sizeof(**layers), GFP_KERNEL); The element size should be the size of an individual element of the array. Change it to sizeof(*layers) to avoid wasting a lot of memory. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Check return value of drm_vblank_initChen-Yu Tsai1-1/+5
drm_vblank_init can fail due to insufficient memory. Ignoring the error and proceeding may cause the kernel to dereference an invalid pointer when vblank is enabled. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Fix up error path cleanup for master bind functionChen-Yu Tsai1-5/+11
The master bind function calls numerous drm functions which initialize underlying structures. It also tries to bind the various components of the display pipeline, some of which may add additional drm objects. This patch adds proper cleanup functions in the error path of the master bind function. This requires the patch "drm/sun4i: Move drm_mode_config_cleanup call to main driver", which splits out drm_mode_config_cleanup from sun4i_framebuffer_free so we can call it separately. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-03-07drm/sun4i: Move drm_mode_config_cleanup call to main driverChen-Yu Tsai2-1/+1
drm_mode_config_cleanup is the complement of drm_mode_config_init, which is called in the bind function of sun4i_drv. drm_mode_config_cleanup should be put in the unbind function to match. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-02-09drm: sun4i: use vblank hooks in struct drm_crtc_funcsShawn Guo2-27/+24
The vblank hooks in struct drm_driver are deprecated and only meant for legacy drivers. For modern drivers with DRIVER_MODESET flag, the hooks in struct drm_crtc_funcs should be used instead. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Link: http://patchwork.freedesktop.org/patch/msgid/1486458995-31018-20-git-send-email-shawnguo@kernel.org
2017-02-07drm: remove drm_vblank_no_hw_counter assignment from driver codeShawn Guo1-1/+0
Core code already makes drm_driver.get_vblank_counter hook optional by letting drm_vblank_no_hw_counter be the default implementation for the function hook. So the drm_vblank_no_hw_counter assignment in the driver code becomes redundant and can be removed now. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Cc: Alexey Brodkin <abrodkin@synopsys.com> Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Mali DP Maintainers <malidp@foss.arm.com> Cc: Russell King <linux@armlinux.org.uk> Cc: Boris Brezillon <boris.brezillon@free-electrons.com> Cc: Inki Dae <inki.dae@samsung.com> Cc: Stefan Agner <stefan@agner.ch> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: CK Hu <ck.hu@mediatek.com> Cc: Neil Armstrong <narmstrong@baylibre.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Marek Vasut <marex@denx.de> Cc: Ben Skeggs <bskeggs@redhat.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Mark Yao <mark.yao@rock-chips.com> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Jyri Sarha <jsarha@ti.com> Cc: Eric Anholt <eric@anholt.net> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Alexey Brodkin <abrodkin@synopsys.com> Acked-by: Liviu Dudau <liviu.dudau@arm.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1486458995-31018-3-git-send-email-shawnguo@kernel.org
2017-02-02drm: Rely on mode_config data for fb_helper initializationGabriel Krisman Bertazi1-3/+1
Instead of receiving the num_crts as a parameter, we can read it directly from the mode_config structure. I audited the drivers that invoke this helper and I believe all of them initialize the mode_config struct accordingly, prior to calling the fb_helper. I used the following coccinelle hack to make this transformation, except for the function headers and comment updates. The first and second rules are split because I couldn't find a way to remove the unused temporary variables at the same time I removed the parameter. // <smpl> @r@ expression A,B,D,E; identifier C; @@ ( - drm_fb_helper_init(A,B,C,D) + drm_fb_helper_init(A,B,D) | - drm_fbdev_cma_init_with_funcs(A,B,C,D,E) + drm_fbdev_cma_init_with_funcs(A,B,D,E) | - drm_fbdev_cma_init(A,B,C,D) + drm_fbdev_cma_init(A,B,D) ) @@ expression A,B,C,D,E; @@ ( - drm_fb_helper_init(A,B,C,D) + drm_fb_helper_init(A,B,D) | - drm_fbdev_cma_init_with_funcs(A,B,C,D,E) + drm_fbdev_cma_init_with_funcs(A,B,D,E) | - drm_fbdev_cma_init(A,B,C,D) + drm_fbdev_cma_init(A,B,D) ) @@ identifier r.C; type T; expression V; @@ - T C; <... when != C - C = V; ...> // </smpl> Changes since v1: - Rebased on top of the tip of drm-misc-next. - Remove mention to sti since a proper fix got merged. Suggested-by: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20170202162640.27261-1-krisman@collabora.co.uk
2017-02-01Merge tag 'sunxi-drm-for-4.11' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into drm-nextDave Airlie1-1/+1
Allwinner DRM changes for 4.11 Just one minor fix. * tag 'sunxi-drm-for-4.11' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux: drm/sun4i: Fix a return value in case of error
2017-01-02drm/sun4i: Fix a return value in case of errorChristophe JAILLET1-1/+1
If 'sun4i_backend_drm_format_to_layer()' does not return 0, then 'val' is left unmodified. As it is not initialized either, the return value can be anything. It is likely that returning the error code was expected here. As the only caller of 'sun4i_backend_update_layer_formats()' does not check the return value, this fix is purely theorical. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2016-12-18drm: bridge: Link encoder and bridge in core codeLaurent Pinchart1-8/+5
Instead of linking encoders and bridges in every driver (and getting it wrong half of the time, as many drivers forget to set the drm_bridge encoder pointer), do so in core code. The drm_bridge_attach() function needs the encoder and optional previous bridge to perform that task, update all the callers. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Stefan Agner <stefan@agner.ch> # For DCU Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> # For atmel-hlcdc Acked-by: Vincent Abriou <vincent.abriou@st.com> # For STI Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> # For sun4i Acked-by: Xinliang Liu <z.liuxinliang@hisilicon.com> # For hisilicon Acked-by: Jyri Sarha <jsarha@ti.com> # For tilcdc Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Archit Taneja <architt@codeaurora.org> Link: http://patchwork.freedesktop.org/patch/msgid/1481709550-29226-4-git-send-email-laurent.pinchart+renesas@ideasonboard.com
2016-12-15drm: Nuke fb->pixel_formatVille Syrjälä1-1/+2
Replace uses of fb->pixel_format with fb->format->format. Less duplicated information is a good thing. Note that coccinelle failed to eliminate the "/* fourcc format */" comment from drm_framebuffer.h, so I had to do that part manually. @@ struct drm_framebuffer *FB; expression E; @@ drm_helper_mode_fill_fb_struct(...) { ... - FB->pixel_format = E; ... } @@ struct drm_framebuffer *FB; expression E; @@ i9xx_get_initial_plane_config(...) { ... - FB->pixel_format = E; ... } @@ struct drm_framebuffer *FB; expression E; @@ ironlake_get_initial_plane_config(...) { ... - FB->pixel_format = E; ... } @@ struct drm_framebuffer *FB; expression E; @@ skylake_get_initial_plane_config(...) { ... - FB->pixel_format = E; ... } @@ struct drm_framebuffer *a; struct drm_framebuffer b; @@ ( - a->pixel_format + a->format->format | - b.pixel_format + b.format->format ) @@ struct drm_plane_state *a; struct drm_plane_state b; @@ ( - a->fb->pixel_format + a->fb->format->format | - b.fb->pixel_format + b.fb->format->format ) @@ struct drm_crtc *CRTC; @@ ( - CRTC->primary->fb->pixel_format + CRTC->primary->fb->format->format | - CRTC->primary->state->fb->pixel_format + CRTC->primary->state->fb->format->format ) @@ struct drm_mode_set *set; @@ ( - set->fb->pixel_format + set->fb->format->format | - set->crtc->primary->fb->pixel_format + set->crtc->primary->fb->format->format ) @@ @@ struct drm_framebuffer { ... - uint32_t pixel_format; ... }; v2: Fix commit message (Laurent) Rebase due to earlier removal of many fb->pixel_format uses, including the 'fb->format = drm_format_info(fb->format->format);' snafu v3: Adjusted the semantic patch a bit and regenerated due to code changes Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1) Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: http://patchwork.freedesktop.org/patch/msgid/1481751175-18463-1-git-send-email-ville.syrjala@linux.intel.com
2016-12-15drm: Replace drm_format_plane_cpp() with fb->format->cpp[]Ville Syrjälä1-1/+1
Replace drm_format_plane_cpp(fb->pixel_format) with just fb->format->cpp[]. Avoids the expensive format info lookup. @@ struct drm_framebuffer *a; struct drm_framebuffer b; expression E; @@ ( - drm_format_plane_cpp(a->pixel_format, E) + a->format->cpp[E] | - drm_format_plane_cpp(b.pixel_format, E) + b.format->cpp[E] ) @@ struct drm_plane_state *a; struct drm_plane_state b; expression E; @@ ( - drm_format_plane_cpp(a->fb->pixel_format, E) + a->fb->format->cpp[E] | - drm_format_plane_cpp(b.fb->pixel_format, E) + b.fb->format->cpp[E] ) @@ struct drm_framebuffer *a; identifier T; expression E; @@ T = a->pixel_format <+... - drm_format_plane_cpp(T, E) + a->format->cpp[E] ...+> @@ struct drm_framebuffer b; identifier T; expression E; @@ T = b.pixel_format <+... - drm_format_plane_cpp(T, E) + b.format->cpp[E] ...+> v2: Rerun spatch due to code changes Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: http://patchwork.freedesktop.org/patch/msgid/1481751057-18123-1-git-send-email-ville.syrjala@linux.intel.com
2016-12-06Merge remote-tracking branch 'airlied/drm-next' into drm-misc-nextDaniel Vetter2-14/+10
Backmerge v4.9-rc8 to get at commit e94bd1736f1f60e916a85a80c0b0ebeaae36cce5 Author: Michel Dänzer <michel.daenzer@amd.com> Date: Wed Nov 30 17:30:01 2016 +0900 drm: Don't call drm_for_each_crtc with a non-KMS driver so I can apply Michel's follow-up patch. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-12-05Backmerge tag 'v4.9-rc8' into drm-nextDave Airlie2-14/+10
Linux 4.9-rc8 Daniel requested this so we could apply some follow on fixes cleanly to -next.
2016-12-01drm: Make the connector .detect() callback optionalLaurent Pinchart2-14/+0
Many drivers (21 to be exact) create connectors that are always connected (for instance to an LVDS or DSI panel). Instead of forcing them to implement a dummy .detect() handler, make the callback optional and consider the connector as always connected in that case. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Jyri Sarha <jsarha@ti.com> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Vincent Abriou <vincent.abriou@st.com> Acked-by: Alexey Brodkin <abrodkin@synopsys.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> [seanpaul fixed small conflict in rcar-du/rcar_du_lvdscon.c] Signed-off-by: Sean Paul <seanpaul@chromium.org>
2016-11-17Merge tag 'drm-misc-next-2016-11-16' of git://anongit.freedesktop.org/git/drm-misc into drm-nextDave Airlie4-4/+4
Another pile of misc: - Explicit fencing for atomic! Big thanks to Gustavo, Sean, Rob 3x, Brian and anyone else I've forgotten to make this happen. - roll out fbdev helper ops to drivers (Stefan Christ) - last bits of drm_crtc split-up&kerneldoc - some drm_irq.c crtc functions cleanup - prepare_fb helper for cma, works correctly with explicit fencing (Marek Vasut) - misc small patches all over * tag 'drm-misc-next-2016-11-16' of git://anongit.freedesktop.org/git/drm-misc: (51 commits) drm/fence: add out-fences support drm/fence: add fence timeline to drm_crtc drm/fence: add in-fences support drm/bridge: analogix_dp: return error if transfer none byte drm: drm_irq.h header cleanup drm/irq: Unexport drm_vblank_on/off drm/irq: Unexport drm_vblank_count drm/irq: Make drm_vblank_pre/post_modeset internal drm/nouveau: Use drm_crtc_vblank_off/on drm/amdgpu: Use drm_crtc_vblank_on/off for dce6 drm/color: document NULL values and default settings better drm: Drop externs from drm_crtc.h drm: Move tile group code into drm_connector.c drm: Extract drm_mode_config.[hc] Revert "drm: Add aspect ratio parsing in DRM layer" Revert "drm: Add and handle new aspect ratios in DRM layer" drm/print: Move kerneldoc next to definition drm: Consolidate dumb buffer docs drm: Clean up kerneldoc for struct drm_driver drm: Extract drm_drv.h ...
2016-11-16Merge tag 'sunxi-drm-for-4.10' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into drm-nextDave Airlie6-19/+69
sun4i-drm changes for 4.10 Support for the Allwinner A31 SoC display engine using the sun4i-drm driver. * tag 'sunxi-drm-for-4.10' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux: drm/sun4i: Add a few formats drm/sun4i: Add compatible strings for A31/A31s display pipelines drm/sun4i: Add compatible string for A31/A31s TCON (timing controller) drm/sun4i: tcon: Move SoC specific quirks to a DT matched data structure drm/sun4i: sun6i-drc: Support DRC on A31 and A31s
2016-11-13drm/sun4i: constify component_ops structuresJulia Lawall4-4/+4
These component_ops structures are only used as the second argument to component_add and component_del, which are declared as const, so the structures can be declared as const as well. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct component_ops i@p = { ... }; @ok1@ identifier r.i; expression e1; position p; @@ component_add(e1,&i@p) @ok2@ identifier r.i; expression e1; position p; @@ component_del(e1, &i@p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct component_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct component_ops i = { ... }; // </smpl> The result of the size command before the change is (arm): text data bss dec hex filename 5266 236 8 5510 1586 sun4i_backend.o 6393 236 8 6637 19ed sun4i_tcon.o 3700 368 8 4076 fec sun4i_tv.o 1668 108 0 1776 6f0 sun6i_drc.o and after the change: text data bss dec hex filename 5274 228 8 5510 1586 sun4i_backend.o 6401 228 8 6637 19ed sun4i_tcon.o 3708 360 8 4076 fec sun4i_tv.o 1676 100 0 1776 6f0 sun6i_drc.o Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1478971198-3659-1-git-send-email-Julia.Lawall@lip6.fr
2016-11-07drm/sun4i: Propagate error to the callerChristophe JAILLET1-1/+1
If 'sun4i_layers_init()' returns an error, propagate it instead of returning -EINVAL unconditionally. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2016-11-02drm/sun4i: Add a few formatsMaxime Ripard2-0/+26
The planes can do more than what was previously exposed. Add support for them. Since we still have the issue that the primary plane cannot have any alpha component, we will expose only the non-alpha formats in the primary formats, and the alpha formats will be exposed in the overlays. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org>
2016-11-02drm/sun4i: Fix error handlingChristophe JAILLET1-1/+1
'sun4i_layers_init()' returns an error pointer in case of error, not NULL. So test it with IS_ERR. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2016-11-02drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefsJani Nikula1-2/+0
If we define drm_compat_ioctl NULL on CONFIG_COMPAT=n, we don't have to check for the config everywhere. Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Sean Paul <seanpaul@chromium.org> Link: http://patchwork.freedesktop.org/patch/msgid/1478014844-27454-1-git-send-email-jani.nikula@intel.com
2016-10-25drm: convert DT component matching to component_match_add_release()Russell King1-1/+2
Convert DT component matching to use component_match_add_release(). Acked-by: Jyri Sarha <jsarha@ti.com> Reviewed-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Sean Paul <seanpaul@chromium.org> Link: http://patchwork.freedesktop.org/patch/msgid/E1bwo6l-0005Io-Q1@rmk-PC.armlinux.org.uk
2016-10-20drm/sun4i: Add compatible strings for A31/A31s display pipelinesChen-Yu Tsai2-0/+4
The A31's display pipeline has 2 frontends, 2 backends, and 2 TCONs. It also has new display enhancement blocks, such as the DRC (Dynamic Range Controller), the DEU (Display Enhancement Unit), and the CMU (Color Management Unit). It supports HDMI, MIPI DSI, and 2 LCD/LVDS channels. The A31s display pipeline is almost the same, just without MIPI DSI. Only the TCON seems to be different, due to the missing mux for MIPI DSI. Add compatible strings for both of them. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2016-10-20drm/sun4i: Add compatible string for A31/A31s TCON (timing controller)Chen-Yu Tsai2-0/+12
The A31 TCON has mux controls for how TCON outputs are routed to the HDMI and MIPI DSI blocks. Since the A31s does not have MIPI DSI, it only has a mux for the HDMI controller input. This patch only adds support for the compatible strings. Actual support for the mux controls should be added with HDMI and MIPI DSI support. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2016-10-20drm/sun4i: tcon: Move SoC specific quirks to a DT matched data structureChen-Yu Tsai2-19/+25
We already have some differences between the 2 supported SoCs. More will be added as we support other SoCs. To avoid bloating the probe function with even more conditionals, move the quirks to a separate data structure that's tied to the compatible string. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>