Re: [PATCH 0/3] Simplify panel bridge cleanup
Hi Benjamin, and many thanks for this cleanup patchset. Reviewed-by: Philippe Cornu Tested-by: Philippe Cornu Philippe :-) On 09/29/2017 02:59 PM, Benjamin Gaignard wrote: > The goal of this series is to simplify driver code when they need to clean up > a previously allocated panel bridge. > Few drivers have "is_panel_bridge" flag to be able to distinguish a > drm_panel_bridge from "simple" drm_bridge. > To remove this flag I propose to > - let drm_panel_bridge_remove() check if the bridge provided in parameter is >really a drm_panel_bridge. > - add drm_of_panel_bridge_remove() to remove a bridge given DT port and >endpoint > Finally that allow to remove drm_bridge structure and "is_panel_bridge" flag > from stm driver internal structure. > > Benjamin Gaignard (3): >drm/bridge: make drm_panel_bridge_remove more robust >drm/drm_of: add drm_of_panel_bridge_remove function >drm/stm: ltdc: remove bridge from driver internal structure > > drivers/gpu/drm/bridge/panel.c | 10 +- > drivers/gpu/drm/drm_of.c | 33 + > drivers/gpu/drm/stm/ltdc.c | 16 +--- > drivers/gpu/drm/stm/ltdc.h | 2 -- > include/drm/drm_of.h | 8 > 5 files changed, 55 insertions(+), 14 deletions(-) > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/arm: Replace instances of drm_dev_unref with drm_dev_put.
Hi Srishti, On Fri, Sep 29, 2017 at 03:30:40PM +0530, Srishti Sharma wrote: > Replace drm_dev_unref with drm_dev_put as it is more consistent > with kernel coding style. Done using the following semantic > patch by coccinelle. Thanks for the patch! Acked-by: Liviu Dudau I'm going to pull this patch into the mali-dp tree next week when I'm preparing an update of that tree. Best regards, Liviu > > @r@ > expression e; > @@ > > -drm_dev_unref(); > +drm_dev_put(); > > Signed-off-by: Srishti Sharma > --- > drivers/gpu/drm/arm/hdlcd_drv.c | 4 ++-- > drivers/gpu/drm/arm/malidp_drv.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c > index f9bda7b..1a96462 100644 > --- a/drivers/gpu/drm/arm/hdlcd_drv.c > +++ b/drivers/gpu/drm/arm/hdlcd_drv.c > @@ -353,7 +353,7 @@ static int hdlcd_drm_bind(struct device *dev) > err_free: > drm_mode_config_cleanup(drm); > dev_set_drvdata(dev, NULL); > - drm_dev_unref(drm); > + drm_dev_put(drm); > > return ret; > } > @@ -378,7 +378,7 @@ static void hdlcd_drm_unbind(struct device *dev) > pm_runtime_disable(drm->dev); > of_reserved_mem_device_release(drm->dev); > drm_mode_config_cleanup(drm); > - drm_dev_unref(drm); > + drm_dev_put(drm); > drm->dev_private = NULL; > dev_set_drvdata(dev, NULL); > } > diff --git a/drivers/gpu/drm/arm/malidp_drv.c > b/drivers/gpu/drm/arm/malidp_drv.c > index 7ae94a1..1b92f41 100644 > --- a/drivers/gpu/drm/arm/malidp_drv.c > +++ b/drivers/gpu/drm/arm/malidp_drv.c > @@ -665,7 +665,7 @@ static int malidp_bind(struct device *dev) > malidp_runtime_pm_suspend(dev); > drm->dev_private = NULL; > dev_set_drvdata(dev, NULL); > - drm_dev_unref(drm); > + drm_dev_put(drm); > alloc_fail: > of_reserved_mem_device_release(dev); > > @@ -698,7 +698,7 @@ static void malidp_unbind(struct device *dev) > malidp_runtime_pm_suspend(dev); > drm->dev_private = NULL; > dev_set_drvdata(dev, NULL); > - drm_dev_unref(drm); > + drm_dev_put(drm); > of_reserved_mem_device_release(dev); > } > > -- > 2.7.4 > -- | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --- ¯\_(ツ)_/¯ ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 0/3] drm/tinydrm: drm_of_find_backlight helper
This patchset introduces some changes such as move tinydrm_of_find_backlight to drm_of.c and rename it to drm_of_find_backlight for better organizational structure. Changes in v4: - Remove "devices like tinydrm" from the function comments. - Made devm_drm_of_find_backlight_release an internal function. - Add dummy versions of drm_of_backlight functions. Meghana Madhyastha (3): drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c drm/tinydrm: Add devres versions of drm_of_find_backlight drm/tinydrm: Add the dummy versions of drm_of_find_backlight functions drivers/gpu/drm/drm_of.c | 91 ++ drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 --- drivers/gpu/drm/tinydrm/mi0283qt.c | 3 +- include/drm/drm_of.h | 15 + include/drm/tinydrm/tinydrm-helpers.h | 1 - 5 files changed, 108 insertions(+), 42 deletions(-) -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 2/3] drm/tinydrm: Add devres versions of drm_of_find_backlight
Add devm_drm_of_find_backlight and the corresponding release function because some drivers such as tinydrm use devres versions of functions for requiring device resources. Signed-off-by: Meghana Madhyastha --- Changes in v4: -Made the release function an internal static function. -Removed specific reference to tinydrm in the function comments. drivers/gpu/drm/drm_of.c | 47 ++ drivers/gpu/drm/tinydrm/mi0283qt.c | 2 +- include/drm/drm_of.h | 1 + 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index d878d3a..cd80dfc 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -304,3 +304,50 @@ struct backlight_device *drm_of_find_backlight(struct device *dev) return backlight; } EXPORT_SYMBOL(drm_of_find_backlight); + +/** + * devm_drm_of_find_backlight_release - Release backlight device + * @dev: Device + * + * This is the release function corresponding to the devm_drm_of_find_backlight. + * Each devres entry is associated with a release function. + */ +static void devm_drm_of_find_backlight_release(void *data) +{ + put_device(data); +} + +/** + * devm_drm_of_find_backlight - Find backlight device in device-tree + * devres version of the function + * @dev: Device + * + * This is the devres version of the function drm_of_find_backlight. + * Some drivers use devres versions of functions for + * requiring device resources. + * + * Returns: + * NULL if there's no backlight property. + * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device + * is found. + * If the backlight device is found, a pointer to the structure is returned. + */ +struct backlight_device *devm_drm_of_find_backlight(struct device *dev) +{ + struct backlight_device *backlight; + int ret; + + backlight = drm_of_find_backlight(dev); + if (IS_ERR_OR_NULL(backlight)) + return backlight; + + ret = devm_add_action(dev, devm_drm_of_find_backlight_release, + &backlight->dev); + if (ret) { + put_device(&backlight->dev); + return ERR_PTR(ret); + } + + return backlight; +} +EXPORT_SYMBOL(devm_drm_of_find_backlight); diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c index 5e3d635..d37f658 100644 --- a/drivers/gpu/drm/tinydrm/mi0283qt.c +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c @@ -190,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi) if (IS_ERR(mipi->regulator)) return PTR_ERR(mipi->regulator); - mipi->backlight = drm_of_find_backlight(dev); + mipi->backlight = devm_drm_of_find_backlight(dev); if (IS_ERR(mipi->backlight)) return PTR_ERR(mipi->backlight); diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index e8fba5b..b2d6e0c 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -30,6 +30,7 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, struct drm_panel **panel, struct drm_bridge **bridge); struct backlight_device *drm_of_find_backlight(struct device *dev); +struct backlight_device *devm_drm_of_find_backlight(struct device *dev); #else static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, struct device_node *port) -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 3/3] drm/tinydrm: Add the dummy versions of drm_of_find_backlight functions
Add the dummy versions (function definition returning -EINVAL) of drm_of_find_backlight and devm_drm_of_find_backlight in the #else part of the conditional directive in drm_of.h. This is needed for drivers where CONFIG_OF is optional. Signed-off-by: Meghana Madhyastha --- Changes in v4: -This commit was not present in the previous versions. include/drm/drm_of.h | 13 + 1 file changed, 13 insertions(+) diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index b2d6e0c..b11d55b 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -60,6 +60,7 @@ static inline int drm_of_encoder_active_endpoint(struct device_node *node, { return -EINVAL; } + static inline int drm_of_find_panel_or_bridge(const struct device_node *np, int port, int endpoint, struct drm_panel **panel, @@ -67,6 +68,18 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np, { return -EINVAL; } + +static inline struct backlight_device *drm_of_find_backlight( + struct device *dev); +{ + return -EINVAL; +} + +static inline struct backlight_device *devm_drm_of_find_backlight( + struct device *dev); +{ + return -EINVAL; +} #endif static inline int drm_of_encoder_active_endpoint_id(struct device_node *node, -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 1/3] drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
Rename tinydrm_of_find_backlight to drm_of_find_backlight and move it into drm_of.c from tinydrm-helpers.c. This is because other drivers in the drm subsystem might need to call this function. In that case and otherwise, it is better from an organizational point of view to move it into drm_of.c along with the other _of.c functions. Signed-off-by: Meghana Madhyastha --- Changes in v4: -None drivers/gpu/drm/drm_of.c | 44 ++ drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 --- drivers/gpu/drm/tinydrm/mi0283qt.c | 3 +- include/drm/drm_of.h | 1 + include/drm/tinydrm/tinydrm-helpers.h | 1 - 5 files changed, 47 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 8dafbdf..d878d3a 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -260,3 +261,46 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, return ret; } EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); + +/** + * drm_of_find_backlight - Find backlight device in device-tree + * @dev: Device + * + * This function looks for a DT node pointed to by a property named 'backlight' + * and uses of_find_backlight_by_node() to get the backlight device. + * Additionally if the brightness property is zero, it is set to + * max_brightness. + * + * Note: It is the responsibility of the caller to call put_device() when + * releasing the resource. + * + * Returns: + * NULL if there's no backlight property. + * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device + * is found. + * If the backlight device is found, a pointer to the structure is returned. + */ +struct backlight_device *drm_of_find_backlight(struct device *dev) +{ + struct backlight_device *backlight; + struct device_node *np; + + np = of_parse_phandle(dev->of_node, "backlight", 0); + if (!np) + return NULL; + + backlight = of_find_backlight_by_node(np); + of_node_put(np); + + if (!backlight) + return ERR_PTR(-EPROBE_DEFER); + + if (!backlight->props.brightness) { + backlight->props.brightness = backlight->props.max_brightness; + DRM_DEBUG_KMS("Backlight brightness set to %d\n", + backlight->props.brightness); + } + + return backlight; +} +EXPORT_SYMBOL(drm_of_find_backlight); diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c index bd6cce0..cd4c6a5 100644 --- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c @@ -237,46 +237,6 @@ void tinydrm_xrgb_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, EXPORT_SYMBOL(tinydrm_xrgb_to_gray8); /** - * tinydrm_of_find_backlight - Find backlight device in device-tree - * @dev: Device - * - * This function looks for a DT node pointed to by a property named 'backlight' - * and uses of_find_backlight_by_node() to get the backlight device. - * Additionally if the brightness property is zero, it is set to - * max_brightness. - * - * Returns: - * NULL if there's no backlight property. - * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device - * is found. - * If the backlight device is found, a pointer to the structure is returned. - */ -struct backlight_device *tinydrm_of_find_backlight(struct device *dev) -{ - struct backlight_device *backlight; - struct device_node *np; - - np = of_parse_phandle(dev->of_node, "backlight", 0); - if (!np) - return NULL; - - backlight = of_find_backlight_by_node(np); - of_node_put(np); - - if (!backlight) - return ERR_PTR(-EPROBE_DEFER); - - if (!backlight->props.brightness) { - backlight->props.brightness = backlight->props.max_brightness; - DRM_DEBUG_KMS("Backlight brightness set to %d\n", - backlight->props.brightness); - } - - return backlight; -} -EXPORT_SYMBOL(tinydrm_of_find_backlight); - -/** * tinydrm_enable_backlight - Enable backlight helper * @backlight: Backlight device * diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c index 7e5bb7d..5e3d635 100644 --- a/drivers/gpu/drm/tinydrm/mi0283qt.c +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -189,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi) if (IS_ERR(mipi->regulator)) return PTR_ERR(mipi->regulator); - mipi->backlight = tinydrm_of_find_backlight(dev); + mipi->backlight = drm_of_find_backlight(dev); if (IS_ERR(mipi->backlight))
Re: [PATCH v3 1/2] drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
Den 29.09.2017 16.13, skrev Meghana Madhyastha: On Fri, Sep 29, 2017 at 02:33:12PM +0200, Noralf Trønnes wrote: Den 29.09.2017 14.20, skrev Meghana Madhyastha: On Fri, Sep 29, 2017 at 02:10:31PM +0200, Noralf Trønnes wrote: Den 29.09.2017 05.22, skrev Meghana Madhyastha: On Thu, Sep 28, 2017 at 06:02:27PM +0200, Noralf Trønnes wrote: Den 28.09.2017 16.08, skrev Daniel Vetter: On Thu, Sep 28, 2017 at 02:44:34PM +0530, Meghana Madhyastha wrote: Rename tinydrm_of_find_backlight to drm_of_find_backlight and move it into drm_of.c from tinydrm-helpers.c. This is because other drivers in the drm subsystem might need to call this function. In that case and otherwise, it is better from an organizational point of view to move it into drm_of.c along with the other _of.c functions. Signed-off-by: Meghana Madhyastha --- Changes in v3: -Change it back to a single patch from two patches in v2 drivers/gpu/drm/drm_of.c | 44 ++ drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 --- drivers/gpu/drm/tinydrm/mi0283qt.c | 3 +- include/drm/drm_of.h | 1 + include/drm/tinydrm/tinydrm-helpers.h | 1 - 5 files changed, 47 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 8dafbdf..d878d3a 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -260,3 +261,46 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, return ret; } EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); + +/** + * drm_of_find_backlight - Find backlight device in device-tree + * @dev: Device + * + * This function looks for a DT node pointed to by a property named 'backlight' + * and uses of_find_backlight_by_node() to get the backlight device. + * Additionally if the brightness property is zero, it is set to + * max_brightness. + * + * Note: It is the responsibility of the caller to call put_device() when + * releasing the resource. + * + * Returns: + * NULL if there's no backlight property. + * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device + * is found. + * If the backlight device is found, a pointer to the structure is returned. + */ +struct backlight_device *drm_of_find_backlight(struct device *dev) +{ + struct backlight_device *backlight; + struct device_node *np; + + np = of_parse_phandle(dev->of_node, "backlight", 0); + if (!np) + return NULL; + + backlight = of_find_backlight_by_node(np); + of_node_put(np); + + if (!backlight) + return ERR_PTR(-EPROBE_DEFER); + + if (!backlight->props.brightness) { + backlight->props.brightness = backlight->props.max_brightness; + DRM_DEBUG_KMS("Backlight brightness set to %d\n", + backlight->props.brightness); + } + + return backlight; +} +EXPORT_SYMBOL(drm_of_find_backlight); Another problem I discovered when trying to compile this, is that if DRM is builtin and LCD_CLASS_DEVICE is a module: drivers/gpu/drm/drm_of.c:292: undefined reference to `of_find_backlight_by_node' I see that I solved this in tinydrm by just selecting BACKLIGHT_LCD_SUPPORT and LCD_CLASS_DEVICE. I'm not aware of a way to force LCD_CLASS_DEVICE to be builtin if DRM is builtin. Arnd fixed a similar type of dependecy in the repaper driver by forcing repaper to be a module if necessary. To be honest, I don't know why his fix works: https://github.com/torvalds/linux/commit/8312a3fe84b96e30a010fa20f933606d976ac002 I didn't quite understand how we could use this fix for the current case. Isn't this specific to the repaper driver dependency ? This is the solution Daniel mentions: menuconfig DRM tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA + depends on (LCD_CLASS_DEVICE || LCD_CLASS_DEVICE=n) I had tried this but it resulted in a recursive dependencies error. What's the error? Could this have something to do with tinydrm selecting backlight and depending on DRM? Noralf. Looks like a case of circular dependencies. The exact error is this: scripts/kconfig/mconf Kconfig drivers/gpu/drm/Kconfig:7:error: recursive dependency detected! For a resolution refer to Documentation/kbuild/kconfig-language.txt subsection "Kconfig recursive dependency limitations" drivers/gpu/drm/Kconfig:7: symbol DRM depends on LCD_CLASS_DEVICE For a resolution refer to Documentation/kbuild/kconfig-language.txt subsection "Kconfig recursive dependency limitations" drivers/video/backlight/Kconfig:16: symbol LCD_CLASS_DEVICE is selected by FB_CLPS711X For a resolution refer to Documentation/kbuild/kconfig-language.txt subsection "Kconfig recursive dependency limitatio
Re: [pull] radeon, amdgpu, ttm drm-next-4.15
On 26/09/17 10:31 PM, Alex Deucher wrote: > Hi Dave, > > First feature pull for 4.15. Highlights: > - Per VM BO support > - Lots of powerplay cleanups > - Powerplay support for CI > - pasid mgr for kfd > - interrupt infrastructure for recoverable page faults > - SR-IOV fixes > - initial GPU reset for vega10 > - prime mmap support > - ttm page table debugging improvements > - lots of bug fixes > > The following changes since commit 7846b12fe0b5feab5446d892f41b5140c1419109: > > Merge branch 'drm-vmwgfx-next' of > git://people.freedesktop.org/~syeh/repos_linux into drm-next (2017-08-29 > 10:38:14 +1000) > > are available in the git repository at: > > git://people.freedesktop.org/~agd5f/linux drm-next-4.15 > > for you to fetch changes up to 6f87a895709eecc1542fe947e349364ad061ac00: > > drm/amdgpu: clarify license in amdgpu_trace_points.c (2017-09-26 15:14:37 > -0400) [...] > Michel Dänzer (2): > amdgpu: Only destroy fbdev framebuffer if it was initialized > radeon: Only destroy fbdev framebuffer if it was initialized These should go to 4.14. Otherwise, at least amdgpu can't be unloaded in 4.14 as long as it hasn't initialized fbdev (e.g. when there are no displays connected). -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[radeon-alex:amd-staging-drm-next 1152/1167] drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c:175:30: warning: 'hwmgr' may be used uninitialized in this function
tree: git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next head: 99f6288635ceb793ea79c787d83ee64a95b46cd4 commit: 6a1f70848ca224e9fa74dfc72c05a0f9c8711b98 [1152/1167] drm/amd/powerplay: refine code in amd_powerplay.c config: ia64-allmodconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 6.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 6a1f70848ca224e9fa74dfc72c05a0f9c8711b98 # save the attached .config to linux build tree make.cross ARCH=ia64 Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c: In function 'pp_hw_init': >> drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c:175:30: warning: >> 'hwmgr' may be used uninitialized in this function [-Wmaybe-uninitialized] cgs_notify_dpm_enabled(hwmgr->device, false); ^~ vim +/hwmgr +175 drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c 145 146 static int pp_hw_init(void *handle) 147 { 148 int ret = 0; 149 struct pp_instance *pp_handle = (struct pp_instance *)handle; 150 struct pp_hwmgr *hwmgr; 151 152 ret = pp_check(pp_handle); 153 154 if (ret >= 0) { 155 hwmgr = pp_handle->hwmgr; 156 157 if (hwmgr->smumgr_funcs->start_smu == NULL) 158 return -EINVAL; 159 160 if(hwmgr->smumgr_funcs->start_smu(pp_handle->hwmgr)) { 161 pr_err("smc start failed\n"); 162 hwmgr->smumgr_funcs->smu_fini(pp_handle->hwmgr); 163 return -EINVAL;; 164 } 165 if (ret == PP_DPM_DISABLED) 166 goto exit; 167 } 168 169 ret = hwmgr_hw_init(pp_handle); 170 if (ret) 171 goto exit; 172 return 0; 173 exit: 174 pp_handle->pm_en = 0; > 175 cgs_notify_dpm_enabled(hwmgr->device, false); 176 return 0; 177 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 99553] Tracker bug for runnning OpenCL applications on Clover
https://bugs.freedesktop.org/show_bug.cgi?id=99553 Bug 99553 depends on bug 99856, which changed state. Bug 99856 Summary: OpenCL Hello world returns "unsupported call to function get_local_size" https://bugs.freedesktop.org/show_bug.cgi?id=99856 What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 92248] [KBL/SKL/BYT/BXT/GLK] igt/kms_plane_scaling fail
https://bugs.freedesktop.org/show_bug.cgi?id=92248 --- Comment #43 from Hector Velazquez --- This test are failing on CFL-S-1 QA Tests List: igt@kms_plane_scaling Output . . . DEBUG (kms_plane_scaling:2699) igt-core-INFO: IGT-Version: 1.19-g2885b10 (x86_64) (Linux: 4.14.0-rc2-drm-tip-ww39-commit-85932e1+ x86_64) (kms_plane_scaling:2699) igt-core-DEBUG: Test requirement passed: !igt_run_in_simulation() (kms_plane_scaling:2699) drmtest-DEBUG: Test requirement passed: !(fd<0) (kms_plane_scaling:2699) igt-debugfs-DEBUG: Opening debugfs directory '/sys/kernel/debug/dri/0' (kms_plane_scaling:2699) igt-debugfs-DEBUG: Opening debugfs directory '/sys/kernel/debug/dri/0' (kms_plane_scaling:2699) igt-kms-DEBUG: display: init { (kms_plane_scaling:2699) igt-kms-DEBUG: Setting Broadcast RGB mode on connector 48 to 1 (kms_plane_scaling:2699) igt-kms-DEBUG: Setting Broadcast RGB mode on connector 56 to 1 (kms_plane_scaling:2699) igt-kms-DEBUG: Setting Broadcast RGB mode on connector 61 to 1 (kms_plane_scaling:2699) igt-kms-DEBUG: Setting Broadcast RGB mode on connector 65 to 1 (kms_plane_scaling:2699) igt-kms-DEBUG: Setting Broadcast RGB mode on connector 68 to 1 (kms_plane_scaling:2699) igt-kms-DEBUG: Setting Broadcast RGB mode on connector 72 to 1 (kms_plane_scaling:2699) igt-kms-DEBUG: display: } (kms_plane_scaling:2699) DEBUG: Test requirement passed: d->num_scalers (kms_plane_scaling:2699) igt-kms-DEBUG: display: eDP-1: set_pipe(A) (kms_plane_scaling:2699) igt-kms-DEBUG: Setting Broadcast RGB mode on connector 48 to 1 (kms_plane_scaling:2699) igt-kms-DEBUG: display: eDP-1: Selecting pipe A (kms_plane_scaling:2699) igt-fb-DEBUG: igt_create_fb_with_bo_size(width=1920, height=1080, format=0x34325258, tiling=0x101, size=0) (kms_plane_scaling:2699) drmtest-DEBUG: Test requirement passed: is_i915_device(fd) && has_known_intel_chipset(fd) (kms_plane_scaling:2699) igt-fb-DEBUG: igt_create_fb_with_bo_size(handle=1, pitch=7680) (kms_plane_scaling:2699) igt-fb-DEBUG: igt_create_fb_with_bo_size(width=1920, height=1080, format=0x34325258, tiling=0x101, size=0) (kms_plane_scaling:2699) drmtest-DEBUG: Test requirement passed: is_i915_device(fd) && has_known_intel_chipset(fd) (kms_plane_scaling:2699) igt-fb-DEBUG: igt_create_fb_with_bo_size(handle=2, pitch=7680) (kms_plane_scaling:2699) igt-kms-DEBUG: display: eDP-1: set_pipe(A) (kms_plane_scaling:2699) igt-kms-DEBUG: Setting Broadcast RGB mode on connector 48 to 1 (kms_plane_scaling:2699) igt-kms-DEBUG: display: eDP-1: Selecting pipe A (kms_plane_scaling:2699) igt-debugfs-DEBUG: Opening debugfs directory '/sys/kernel/debug/dri/0' (kms_plane_scaling:2699) igt-debugfs-DEBUG: Using generic frame CRC ABI (kms_plane_scaling:2699) igt-fb-DEBUG: igt_create_fb_with_bo_size(width=1920, height=1080, format=0x34325258, tiling=0x101, size=0) (kms_plane_scaling:2699) drmtest-DEBUG: Test requirement passed: is_i915_device(fd) && has_known_intel_chipset(fd) (kms_plane_scaling:2699) igt-fb-DEBUG: igt_create_fb_with_bo_size(handle=3, pitch=7680) (kms_plane_scaling:2699) igt-kms-DEBUG: Test requirement passed: plane_idx >= 0 && plane_idx < pipe->n_planes (kms_plane_scaling:2699) igt-kms-DEBUG: display: A.0: plane_set_fb(84) (kms_plane_scaling:2699) igt-kms-DEBUG: display: A.1: plane_set_fb(84) (kms_plane_scaling:2699) igt-kms-DEBUG: display: commit { (kms_plane_scaling:2699) igt-kms-DEBUG: display: SetPlane A.0, fb 84, src = (0, 0) 1920x1080 dst = (0, 0) 1920x1080 (kms_plane_scaling:2699) igt-kms-DEBUG: display: SetPlane A.1, fb 84, src = (0, 0) 1920x1080 dst = (0, 0) 1920x1080 (kms_plane_scaling:2699) igt-kms-DEBUG: display: SetPlane pipe A, plane 2, disabling (kms_plane_scaling:2699) igt-kms-DEBUG: display: SetPlane pipe B, plane 0, disabling (kms_plane_scaling:2699) igt-kms-DEBUG: display: SetPlane pipe B, plane 1, disabling (kms_plane_scaling:2699) igt-kms-DEBUG: display: SetPlane pipe B, plane 2, disabling (kms_plane_scaling:2699) igt-kms-DEBUG: display: } (kms_plane_scaling:2699) igt-kms-DEBUG: display: A.2: plane_set_fb(76) (kms_plane_scaling:2699) igt-kms-DEBUG: display: A.2: fb_set_position(100,100) (kms_plane_scaling:2699) igt-kms-DEBUG: display: A.2: fb_set_size(1720x880) (kms_plane_scaling:2699) igt-kms-DEBUG: display: A.2: plane_set_position(100,100) (kms_plane_scaling:2699) igt-kms-DEBUG: display: A.2: plane_set_size (1720x880) (kms_plane_scaling:2699) igt-kms-DEBUG: display: commit { (kms_plane_scaling:2699) igt-kms-DEBUG: display: SetPlane A.2, fb 76, src = (100, 100) 1720x880 dst = (100, 100) 1720x880 (kms_plane_scaling:2699) igt-kms-CRITICAL: Test assertion failure function igt_drm_plane_commit, file igt_kms.c:2245: (kms_plane_scaling:2699) igt-kms-CRITICAL: Failed assertion: ret == 0 (kms_plane_scaling:2699) igt-kms-CRITICAL: Last errno: 22, Invalid argument (kms_plane_scaling:2699) igt-kms-CRITICA
Re: [PATCH][drm-next] drm/radeon: make functions alloc_pasid and free_pasid static
On Thu, Sep 28, 2017 at 9:46 AM, Colin King wrote: > From: Colin Ian King > > The functions alloc_pasid and free_pasid are local to the > source and do not need to be in global scope, so make them static. > > Cleans up sparse warnings: > warning: symbol 'alloc_pasid' was not declared. Should it be static? > warning: symbol 'free_pasid' was not declared. Should it be static? > > Signed-off-by: Colin Ian King Applied. thanks! Alex > --- > drivers/gpu/drm/radeon/radeon_kfd.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_kfd.c > b/drivers/gpu/drm/radeon/radeon_kfd.c > index a2ac8ac0930d..385b4d76956d 100644 > --- a/drivers/gpu/drm/radeon/radeon_kfd.c > +++ b/drivers/gpu/drm/radeon/radeon_kfd.c > @@ -352,7 +352,7 @@ static uint32_t get_max_engine_clock_in_mhz(struct > kgd_dev *kgd) > */ > static DEFINE_IDA(pasid_ida); > > -int alloc_pasid(unsigned int bits) > +static int alloc_pasid(unsigned int bits) > { > int pasid = -EINVAL; > > @@ -367,7 +367,7 @@ int alloc_pasid(unsigned int bits) > return pasid; > } > > -void free_pasid(unsigned int pasid) > +static void free_pasid(unsigned int pasid) > { > ida_simple_remove(&pasid_ida, pasid); > } > -- > 2.14.1 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
Hi Meghana, [auto build test ERROR on drm/drm-next] [also build test ERROR on v4.14-rc2 next-20170929] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Meghana-Madhyastha/drm-tinydrm-Move-tinydrm_of_find_backlight-into-drm_of-c/20170930-052310 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: x86_64-randconfig-x017-201739 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All error/warnings (new ones prefixed by >>): drivers/gpu//drm/tinydrm/mi0283qt.c: In function 'mi0283qt_probe': >> drivers/gpu//drm/tinydrm/mi0283qt.c:192:20: error: implicit declaration of >> function 'drm_of_find_backlight' [-Werror=implicit-function-declaration] mipi->backlight = drm_of_find_backlight(dev); ^ >> drivers/gpu//drm/tinydrm/mi0283qt.c:192:18: warning: assignment makes >> pointer from integer without a cast [-Wint-conversion] mipi->backlight = drm_of_find_backlight(dev); ^ cc1: some warnings being treated as errors vim +/drm_of_find_backlight +192 drivers/gpu//drm/tinydrm/mi0283qt.c 163 164 static int mi0283qt_probe(struct spi_device *spi) 165 { 166 struct device *dev = &spi->dev; 167 struct mipi_dbi *mipi; 168 struct gpio_desc *dc; 169 u32 rotation = 0; 170 int ret; 171 172 mipi = devm_kzalloc(dev, sizeof(*mipi), GFP_KERNEL); 173 if (!mipi) 174 return -ENOMEM; 175 176 mipi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); 177 if (IS_ERR(mipi->reset)) { 178 dev_err(dev, "Failed to get gpio 'reset'\n"); 179 return PTR_ERR(mipi->reset); 180 } 181 182 dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW); 183 if (IS_ERR(dc)) { 184 dev_err(dev, "Failed to get gpio 'dc'\n"); 185 return PTR_ERR(dc); 186 } 187 188 mipi->regulator = devm_regulator_get(dev, "power"); 189 if (IS_ERR(mipi->regulator)) 190 return PTR_ERR(mipi->regulator); 191 > 192 mipi->backlight = drm_of_find_backlight(dev); 193 if (IS_ERR(mipi->backlight)) 194 return PTR_ERR(mipi->backlight); 195 196 device_property_read_u32(dev, "rotation", &rotation); 197 198 ret = mipi_dbi_spi_init(spi, mipi, dc); 199 if (ret) 200 return ret; 201 202 ret = mipi_dbi_init(&spi->dev, mipi, &mi0283qt_pipe_funcs, 203 &mi0283qt_driver, &mi0283qt_mode, rotation); 204 if (ret) 205 return ret; 206 207 ret = mi0283qt_init(mipi); 208 if (ret) 209 return ret; 210 211 /* use devres to fini after drm unregister (drv->remove is before) */ 212 ret = devm_add_action(dev, mi0283qt_fini, mipi); 213 if (ret) { 214 mi0283qt_fini(mipi); 215 return ret; 216 } 217 218 spi_set_drvdata(spi, mipi); 219 220 return devm_tinydrm_register(&mipi->tinydrm); 221 } 222 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 3/3] drm/tinydrm: Add devres versions of drm_of_find_backlight
Hi Meghana, [auto build test ERROR on drm/drm-next] [also build test ERROR on v4.14-rc2 next-20170929] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Meghana-Madhyastha/drm-tinydrm-Move-tinydrm_of_find_backlight-into-drm_of-c/20170930-055009 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: i386-randconfig-x071-201739 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): In file included from drivers/gpu//drm/drm_of.c:11:0: include/drm/drm_of.h: In function 'devm_drm_of_find_backlight': >> include/drm/drm_of.h:73:1: error: expected '=', ',', ';', 'asm' or >> '__attribute__' before 'static' static inline int drm_of_encoder_active_endpoint_id(struct device_node *node, ^~ >> include/drm/drm_of.h:85:1: error: expected '=', ',', ';', 'asm' or >> '__attribute__' before '{' token { ^ >> drivers/gpu//drm/drm_of.c:14:1: error: expected '=', ',', ';', 'asm' or >> '__attribute__' before '{' token { ^ drivers/gpu//drm/drm_of.c:28:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token { ^ drivers/gpu//drm/drm_of.c:55:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token { ^ >> drivers/gpu//drm/drm_of.c:73:42: error: expected declaration specifiers >> before ';' token EXPORT_SYMBOL(drm_of_find_possible_crtcs); ^ drivers/gpu//drm/drm_of.c:86:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token { ^ drivers/gpu//drm/drm_of.c:91:46: error: expected declaration specifiers before ';' token EXPORT_SYMBOL_GPL(drm_of_component_match_add); ^ drivers/gpu//drm/drm_of.c:109:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token { ^ drivers/gpu//drm/drm_of.c:179:38: error: expected declaration specifiers before ';' token EXPORT_SYMBOL(drm_of_component_probe); ^ drivers/gpu//drm/drm_of.c:192:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token { ^ drivers/gpu//drm/drm_of.c:213:50: error: expected declaration specifiers before ';' token EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint); ^ drivers/gpu//drm/drm_of.c:231:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token { ^ drivers/gpu//drm/drm_of.c:263:47: error: expected declaration specifiers before ';' token EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); ^ drivers/gpu//drm/drm_of.c:284:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token { ^ drivers/gpu//drm/drm_of.c:306:37: error: expected declaration specifiers before ';' token EXPORT_SYMBOL(drm_of_find_backlight); ^ drivers/gpu//drm/drm_of.c:324:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token { ^ drivers/gpu//drm/drm_of.c:341:42: error: expected declaration specifiers before ';' token EXPORT_SYMBOL(devm_drm_of_find_backlight); ^ drivers/gpu//drm/drm_of.c:350:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token { ^ >> drivers/gpu//drm/drm_of.c:353:1: error: expected '{' at end of input EXPORT_SYMBOL(devm_drm_of_find_backlight_release) ^ >> drivers/gpu//drm/drm_of.c:353:1: warning: control reaches end of non-void >> function [-Wreturn-type] EXPORT_SYMBOL(devm_drm_of_find_backlight_release) ^ -- In file included from drivers/gpu//drm/bridge/tc358767.c:38:0: include/drm/drm_of.h: In function 'devm_drm_of_find_backlight
Re: [PATCH v2 3/3] drm/tinydrm: Add devres versions of drm_of_find_backlight
Hi Meghana, [auto build test ERROR on drm/drm-next] [also build test ERROR on v4.14-rc2 next-20170929] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Meghana-Madhyastha/drm-tinydrm-Move-tinydrm_of_find_backlight-into-drm_of-c/20170930-055009 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: i386-randconfig-x073-201739 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): drivers/gpu//drm/i2c/tda998x_drv.c:1721:10: error: 'tda998x_bind' undeclared (first use in this function) .bind = tda998x_bind, ^~~~ drivers/gpu//drm/i2c/tda998x_drv.c:1722:12: error: 'tda998x_unbind' undeclared (first use in this function) .unbind = tda998x_unbind, ^~ drivers/gpu//drm/i2c/tda998x_drv.c:1727:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token { ^ drivers/gpu//drm/i2c/tda998x_drv.c:1736:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token { ^ drivers/gpu//drm/i2c/tda998x_drv.c:1742:34: error: storage class specified for parameter 'tda998x_dt_ids' static const struct of_device_id tda998x_dt_ids[] = { ^~ drivers/gpu//drm/i2c/tda998x_drv.c:1742:21: error: parameter 'tda998x_dt_ids' is initialized static const struct of_device_id tda998x_dt_ids[] = { ^~~~ drivers/gpu//drm/i2c/tda998x_drv.c:1743:2: warning: braces around scalar initializer { .compatible = "nxp,tda998x", }, ^ drivers/gpu//drm/i2c/tda998x_drv.c:1743:2: note: (near initialization for 'tda998x_dt_ids') drivers/gpu//drm/i2c/tda998x_drv.c:1743:4: error: field name not in record or union initializer { .compatible = "nxp,tda998x", }, ^ drivers/gpu//drm/i2c/tda998x_drv.c:1743:4: note: (near initialization for 'tda998x_dt_ids') drivers/gpu//drm/i2c/tda998x_drv.c:1743:18: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] { .compatible = "nxp,tda998x", }, ^ drivers/gpu//drm/i2c/tda998x_drv.c:1743:18: note: (near initialization for 'tda998x_dt_ids') drivers/gpu//drm/i2c/tda998x_drv.c:1744:2: warning: braces around scalar initializer { } ^ drivers/gpu//drm/i2c/tda998x_drv.c:1744:2: note: (near initialization for 'tda998x_dt_ids') drivers/gpu//drm/i2c/tda998x_drv.c:1744:2: error: empty scalar initializer drivers/gpu//drm/i2c/tda998x_drv.c:1744:2: note: (near initialization for 'tda998x_dt_ids') drivers/gpu//drm/i2c/tda998x_drv.c:1744:2: warning: excess elements in scalar initializer drivers/gpu//drm/i2c/tda998x_drv.c:1744:2: note: (near initialization for 'tda998x_dt_ids') drivers/gpu//drm/i2c/tda998x_drv.c:1746:40: error: expected declaration specifiers before ';' token MODULE_DEVICE_TABLE(of, tda998x_dt_ids); ^ drivers/gpu//drm/i2c/tda998x_drv.c:1749:35: error: storage class specified for parameter 'tda998x_ids' static const struct i2c_device_id tda998x_ids[] = { ^~~ drivers/gpu//drm/i2c/tda998x_drv.c:1749:21: error: parameter 'tda998x_ids' is initialized static const struct i2c_device_id tda998x_ids[] = { ^ drivers/gpu//drm/i2c/tda998x_drv.c:1750:2: warning: braces around scalar initializer { "tda998x", 0 }, ^ drivers/gpu//drm/i2c/tda998x_drv.c:1750:2: note: (near initialization for 'tda998x_ids') drivers/gpu//drm/i2c/tda998x_drv.c:1750:4: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] { "tda998x", 0 }, ^ drivers/gpu//drm/i2c/tda998x_drv.c:1750:4: note: (near initialization for 'tda998x_ids') drivers/gpu//drm/i2c/tda998x_drv.c:1750:15: warning: excess elements in scalar initializer { "tda998x", 0 }, ^ drivers/gpu//drm/i2c/tda998x_drv.c:1750:15: note: (near initialization for 'tda998x_ids') drivers/gpu//drm/i2c/tda998x_drv.c:1751:2: warning: braces around scalar initializer { } ^ drivers/gpu//drm/i2c/tda998x_drv.c:1751:2: note: (near initialization for 'tda998x_ids') drivers/gpu//drm/i2c/tda998x_drv.c:1751:2: error: empty scalar initializer drivers/gpu//drm/i2c/tda
[PATCH] amdgpu: Add deadlock detection test suit.
From: Andrey Grodzovsky Adding initial tests for locks detection when SW scheduler FIFO is full. The test works by submitting a batch of identical commands which make the CP stall waiting for condition to become true. The condition is later satisfied form a helper thread. Other events that happen during this time might create deadlock situations. One such example is GPU reset triggered by this stall when amdgpu_lockup_timeout != 0. Change-Id: Ifc3a571481a85c947b107680cf17f59187180fe0 Signed-off-by: Andrey Grodzovsky --- tests/amdgpu/Makefile.am | 6 +- tests/amdgpu/amdgpu_test.c| 6 ++ tests/amdgpu/amdgpu_test.h| 15 +++ tests/amdgpu/deadlock_tests.c | 244 ++ 4 files changed, 269 insertions(+), 2 deletions(-) create mode 100644 tests/amdgpu/deadlock_tests.c diff --git a/tests/amdgpu/Makefile.am b/tests/amdgpu/Makefile.am index 9c02fd6..8700c4d 100644 --- a/tests/amdgpu/Makefile.am +++ b/tests/amdgpu/Makefile.am @@ -1,7 +1,8 @@ AM_CFLAGS = \ -I $(top_srcdir)/include/drm \ -I $(top_srcdir)/amdgpu \ - -I $(top_srcdir) + -I $(top_srcdir) \ + -pthread LDADD = $(top_builddir)/libdrm.la \ $(top_builddir)/amdgpu/libdrm_amdgpu.la \ @@ -29,4 +30,5 @@ amdgpu_test_SOURCES = \ frame.h \ uvd_enc_tests.c \ vcn_tests.c \ - uve_ib.h + uve_ib.h \ + deadlock_tests.c diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c index cd6b826..9925503 100644 --- a/tests/amdgpu/amdgpu_test.c +++ b/tests/amdgpu/amdgpu_test.c @@ -97,6 +97,12 @@ static CU_SuiteInfo suites[] = { .pCleanupFunc = suite_uvd_enc_tests_clean, .pTests = uvd_enc_tests, }, + { + .pName = "Deadlock Tests", + .pInitFunc = suite_deadlock_tests_init, + .pCleanupFunc = suite_deadlock_tests_clean, + .pTests = deadlock_tests, + }, CU_SUITE_INFO_NULL, }; diff --git a/tests/amdgpu/amdgpu_test.h b/tests/amdgpu/amdgpu_test.h index d0b61ba..ece93f4 100644 --- a/tests/amdgpu/amdgpu_test.h +++ b/tests/amdgpu/amdgpu_test.h @@ -135,6 +135,21 @@ int suite_uvd_enc_tests_clean(); extern CU_TestInfo uvd_enc_tests[]; /** + * Initialize deadlock test suite + */ +int suite_deadlock_tests_init(); + +/** + * Deinitialize deadlock test suite + */ +int suite_deadlock_tests_clean(); + +/** + * Tests in uvd enc test suite + */ +extern CU_TestInfo deadlock_tests[]; + +/** * Helper functions */ static inline amdgpu_bo_handle gpu_mem_alloc( diff --git a/tests/amdgpu/deadlock_tests.c b/tests/amdgpu/deadlock_tests.c new file mode 100644 index 000..992d191 --- /dev/null +++ b/tests/amdgpu/deadlock_tests.c @@ -0,0 +1,244 @@ +/* + * Copyright 2014 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#ifdef HAVE_ALLOCA_H +# include +#endif + +#include "CUnit/Basic.h" + +#include "amdgpu_test.h" +#include "amdgpu_drm.h" + +#include + + +/* + * This defines the delay in MS after which memory location designated for + * compression against reference value is written to, unblocking command + * processor + */ +#define WRITE_MEM_ADDRESS_DELAY_MS 2 + +#definePACKET_TYPE33 + +#define PACKET3(op, n) ((PACKET_TYPE3 << 30) | \ +(((op) & 0xFF) << 8) | \ +((n) & 0x3FFF) << 16) + +#definePACKET3_WAIT_REG_MEM0x3C +#defineWAIT_REG_MEM_FUNCTION(x)((x) << 0) + /* 0 - always +* 1 - < +* 2 - <= +* 3 - == +* 4 - != +* 5 - >= +* 6 - > +*/ +#defineWAIT_REG_MEM_MEM_
Re: [PATCH v3 1/2] drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
Hi Meghana, [auto build test ERROR on drm/drm-next] [also build test ERROR on v4.14-rc2 next-20170929] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Meghana-Madhyastha/drm-tinydrm-drm_of_find_backlight-helper/20170930-063127 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: arm-sunxi_defconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=arm All errors (new ones prefixed by >>): drivers/gpu/drm/drm_of.o: In function `drm_of_find_backlight': >> drm_of.c:(.text+0x3bc): undefined reference to `of_find_backlight_by_node' --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create
My mean is like the attached, I revert part of yours. Regards, David zhou On 2017年09月29日 22:15, Marek Olšák wrote: On Fri, Sep 29, 2017 at 4:13 PM, Marek Olšák wrote: On Fri, Sep 29, 2017 at 4:44 AM, Chunming Zhou wrote: On 2017年09月13日 04:42, Marek Olšák wrote: From: Marek Olšák For amdgpu. drm_syncobj_create is renamed to drm_syncobj_create_as_handle, and new helpers drm_syncobj_create and drm_syncobj_get_handle are added. Signed-off-by: Marek Olšák --- drivers/gpu/drm/drm_syncobj.c | 49 +++ include/drm/drm_syncobj.h | 4 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 0422b8c..0bb1741 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -262,8 +262,14 @@ void drm_syncobj_free(struct kref *kref) } EXPORT_SYMBOL(drm_syncobj_free); -static int drm_syncobj_create(struct drm_file *file_private, - u32 *handle, uint32_t flags) You can add a new parameter for passing dma fence, then in patch3, you can directly use it for AMDGPU_FENCE_TO HANDLE_GET_SYNCOBJ. otherwise the set looks good to me. Sorry I just pushed this. Actually, you commented on a deleted line. The function already has dma_fence among the parameters. Marek >From a34c466f4a8617c18bf191d83bff3a3382166b00 Mon Sep 17 00:00:00 2001 From: Chunming Zhou Date: Sat, 30 Sep 2017 09:53:53 +0800 Subject: [PATCH] drm: Don't split drm_syncobj_create Change-Id: Icc6e4d8e94236675d6267d211e53698834d29869 Signed-off-by: Chunming Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 + drivers/gpu/drm/drm_syncobj.c | 42 +- include/drm/drm_syncobj.h | 7 +++--- 3 files changed, 10 insertions(+), 45 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index ab83dfc..882becc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1351,14 +1351,10 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data, switch (info->in.what) { case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ: - r = drm_syncobj_create(&syncobj, 0, fence); + r = drm_syncobj_create(filp, fence, &info->out.handle, 0); dma_fence_put(fence); if (r) return r; - r = drm_syncobj_get_handle(filp, syncobj, &info->out.handle); - drm_syncobj_put(syncobj); - return r; - case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD: r = drm_syncobj_create(&syncobj, 0, fence); dma_fence_put(fence); diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 62adc7a..28e1463 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -268,8 +268,9 @@ EXPORT_SYMBOL(drm_syncobj_free); * @flags: DRM_SYNCOBJ_* flags * @fence: if non-NULL, the syncobj will represent this fence */ -int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, - struct dma_fence *fence) +int drm_syncobj_create(struct drm_file *file_private, + struct dma_fence *fence, + u32 *handle, uint32_t flags) { int ret; struct drm_syncobj *syncobj; @@ -293,22 +294,6 @@ int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, if (fence) drm_syncobj_replace_fence(syncobj, fence); - *out_syncobj = syncobj; - return 0; -} -EXPORT_SYMBOL(drm_syncobj_create); - -/** - * drm_syncobj_get_handle - get a handle from a syncobj - */ -int drm_syncobj_get_handle(struct drm_file *file_private, - struct drm_syncobj *syncobj, u32 *handle) -{ - int ret; - - /* take a reference to put in the idr */ - drm_syncobj_get(syncobj); - idr_preload(GFP_KERNEL); spin_lock(&file_private->syncobj_table_lock); ret = idr_alloc(&file_private->syncobj_idr, syncobj, 1, 0, GFP_NOWAIT); @@ -324,22 +309,7 @@ int drm_syncobj_get_handle(struct drm_file *file_private, *handle = ret; return 0; } -EXPORT_SYMBOL(drm_syncobj_get_handle); - -static int drm_syncobj_create_as_handle(struct drm_file *file_private, - u32 *handle, uint32_t flags) -{ - int ret; - struct drm_syncobj *syncobj; - - ret = drm_syncobj_create(&syncobj, flags, NULL); - if (ret) - return ret; - - ret = drm_syncobj_get_handle(file_private, syncobj, handle); - drm_syncobj_put(syncobj); - return ret; -} +EXPORT_SYMBOL(drm_syncobj_create); static int drm_syncobj_destroy(struct drm_file *file_private, u32 handle) @@ -568,8 +538,8 @@ drm_syncobj_create_ioctl(struct drm_device *dev, void *data, if (args->flags & ~DRM_SYNCOBJ_CREATE_SIGNALED) return -EINVAL; - return drm_syncobj_create_as_handle(file_private, - &args->handle, args->flags); + return drm_syncobj_create(file_private, NULL, + &args->handle, args->flags); } int diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index 43e2f38..4e3025e 100644 --- a/include/drm/drm_syncobj.h +++ b/include/dr
RE: [amd-staging-drm-next] regression - no fan info (sensors) on RX580
Yes, caused by the commit e37a7b4088da ("drm/amd/powerplay: tidy up ret checks in amd_powerplay.c") Replace error when split patches. Have sent the fix patch. Please review. Best Regards Rex -Original Message- From: Alex Deucher [mailto:alexdeuc...@gmail.com] Sent: Friday, September 29, 2017 10:11 PM To: Dieter Nützel; Zhu, Rex Cc: amd-devel; DRI Devel; Wentland, Harry; Michel Dänzer Subject: Re: [amd-staging-drm-next] regression - no fan info (sensors) on RX580 Rex, probably related to the recent cleanups in powerplay. On Fri, Sep 29, 2017 at 10:09 AM, Dieter Nützel wrote: > Hello all, > > since latest update > > 1d7da702e70d3c27408a3bb312c71d6be9f7bebe > drm/amd/powerplay: fix spelling mistake: "dividable" -> "divisible" > > I didn't get fan info with my RX580 (Polaris21) any longer. > > Worked with this commit: > > 786df0b89fe5a0b405d4de0a1ce03003c0743ec3 > drm/amd/display: fix pflip irq registor for raven > > Sorry, I do not have full time for bisect, because we are on way to > our vacation. > > Maybe in the evening (only a few commits). > > Greetings, > Dieter ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 2/3] drm/tinydrm: Add devres versions of drm_of_find_backlight
Hi Meghana, [auto build test ERROR on drm/drm-next] [also build test ERROR on v4.14-rc2 next-20170929] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Meghana-Madhyastha/drm-tinydrm-drm_of_find_backlight-helper/20170930-122931 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: x86_64-randconfig-x017-201739 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 Note: the linux-review/Meghana-Madhyastha/drm-tinydrm-drm_of_find_backlight-helper/20170930-122931 HEAD 4dc8fd20ad41e923832dc78cf4d8e7f98c0fedb9 builds fine. It only hurts bisectibility. All errors (new ones prefixed by >>): drivers/gpu/drm/tinydrm/mi0283qt.c: In function 'mi0283qt_probe': >> drivers/gpu/drm/tinydrm/mi0283qt.c:192:20: error: implicit declaration of >> function 'devm_drm_of_find_backlight' [-Werror=implicit-function-declaration] mipi->backlight = devm_drm_of_find_backlight(dev); ^~ drivers/gpu/drm/tinydrm/mi0283qt.c:192:18: warning: assignment makes pointer from integer without a cast [-Wint-conversion] mipi->backlight = devm_drm_of_find_backlight(dev); ^ cc1: some warnings being treated as errors vim +/devm_drm_of_find_backlight +192 drivers/gpu/drm/tinydrm/mi0283qt.c 163 164 static int mi0283qt_probe(struct spi_device *spi) 165 { 166 struct device *dev = &spi->dev; 167 struct mipi_dbi *mipi; 168 struct gpio_desc *dc; 169 u32 rotation = 0; 170 int ret; 171 172 mipi = devm_kzalloc(dev, sizeof(*mipi), GFP_KERNEL); 173 if (!mipi) 174 return -ENOMEM; 175 176 mipi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); 177 if (IS_ERR(mipi->reset)) { 178 dev_err(dev, "Failed to get gpio 'reset'\n"); 179 return PTR_ERR(mipi->reset); 180 } 181 182 dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW); 183 if (IS_ERR(dc)) { 184 dev_err(dev, "Failed to get gpio 'dc'\n"); 185 return PTR_ERR(dc); 186 } 187 188 mipi->regulator = devm_regulator_get(dev, "power"); 189 if (IS_ERR(mipi->regulator)) 190 return PTR_ERR(mipi->regulator); 191 > 192 mipi->backlight = devm_drm_of_find_backlight(dev); 193 if (IS_ERR(mipi->backlight)) 194 return PTR_ERR(mipi->backlight); 195 196 device_property_read_u32(dev, "rotation", &rotation); 197 198 ret = mipi_dbi_spi_init(spi, mipi, dc); 199 if (ret) 200 return ret; 201 202 ret = mipi_dbi_init(&spi->dev, mipi, &mi0283qt_pipe_funcs, 203 &mi0283qt_driver, &mi0283qt_mode, rotation); 204 if (ret) 205 return ret; 206 207 ret = mi0283qt_init(mipi); 208 if (ret) 209 return ret; 210 211 /* use devres to fini after drm unregister (drv->remove is before) */ 212 ret = devm_add_action(dev, mi0283qt_fini, mipi); 213 if (ret) { 214 mi0283qt_fini(mipi); 215 return ret; 216 } 217 218 spi_set_drvdata(spi, mipi); 219 220 return devm_tinydrm_register(&mipi->tinydrm); 221 } 222 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 3/3] drm/tinydrm: Add the dummy versions of drm_of_find_backlight functions
Hi Meghana, [auto build test WARNING on drm/drm-next] [also build test WARNING on v4.14-rc2 next-20170929] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Meghana-Madhyastha/drm-tinydrm-drm_of_find_backlight-helper/20170930-122931 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: x86_64-randconfig-x017-201739 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): In file included from drivers/gpu//drm/tinydrm/mi0283qt.c:15:0: include/drm/drm_of.h:74:1: error: expected identifier or '(' before '{' token { ^ include/drm/drm_of.h:80:1: error: expected identifier or '(' before '{' token { ^ include/drm/drm_of.h:72:40: warning: 'drm_of_find_backlight' declared 'static' but never defined [-Wunused-function] static inline struct backlight_device *drm_of_find_backlight( ^ >> include/drm/drm_of.h:78:40: warning: 'devm_drm_of_find_backlight' used but >> never defined static inline struct backlight_device *devm_drm_of_find_backlight( ^~ vim +/devm_drm_of_find_backlight +78 include/drm/drm_of.h 71 72 static inline struct backlight_device *drm_of_find_backlight( 73 struct device *dev); > 74 { 75 return -EINVAL; 76 } 77 > 78 static inline struct backlight_device *devm_drm_of_find_backlight( 79 struct device *dev); 80 { 81 return -EINVAL; 82 } 83 #endif 84 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 3/8] drm/etnaviv: iommuv1: fold pagetable alloc and free into caller
Hi Lucas, [auto build test WARNING on drm/drm-next] [also build test WARNING on v4.14-rc2 next-20170929] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Lucas-Stach/drm-etnaviv-remove-iommu-fault-handler/20170930-080416 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: arm-allmodconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=arm Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): drivers/gpu/drm/etnaviv/etnaviv_iommu.c: In function 'etnaviv_iommuv1_domain_alloc': >> drivers/gpu/drm/etnaviv/etnaviv_iommu.c:208:5: warning: 'ret' may be used >> uninitialized in this function [-Wmaybe-uninitialized] if (ret) ^ vim +/ret +208 drivers/gpu/drm/etnaviv/etnaviv_iommu.c a8c21a54 The etnaviv authors 2015-12-03 189 dd34bb96 Lucas Stach 2016-08-16 190 struct iommu_domain *etnaviv_iommuv1_domain_alloc(struct etnaviv_gpu *gpu) a8c21a54 The etnaviv authors 2015-12-03 191 { a8c21a54 The etnaviv authors 2015-12-03 192struct etnaviv_iommu_domain *etnaviv_domain; a8c21a54 The etnaviv authors 2015-12-03 193int ret; a8c21a54 The etnaviv authors 2015-12-03 194 a8c21a54 The etnaviv authors 2015-12-03 195etnaviv_domain = kzalloc(sizeof(*etnaviv_domain), GFP_KERNEL); a8c21a54 The etnaviv authors 2015-12-03 196if (!etnaviv_domain) a8c21a54 The etnaviv authors 2015-12-03 197return NULL; a8c21a54 The etnaviv authors 2015-12-03 198 a8c21a54 The etnaviv authors 2015-12-03 199etnaviv_domain->dev = gpu->dev; a8c21a54 The etnaviv authors 2015-12-03 200 a8c21a54 The etnaviv authors 2015-12-03 201etnaviv_domain->domain.type = __IOMMU_DOMAIN_PAGING; a8c21a54 The etnaviv authors 2015-12-03 202etnaviv_domain->domain.ops = &etnaviv_iommu_ops.ops; 13c34fe5 Lucas Stach 2016-06-13 203 etnaviv_domain->domain.pgsize_bitmap = SZ_4K; a8c21a54 The etnaviv authors 2015-12-03 204 etnaviv_domain->domain.geometry.aperture_start = GPU_MEM_START; a8c21a54 The etnaviv authors 2015-12-03 205 etnaviv_domain->domain.geometry.aperture_end = GPU_MEM_START + PT_ENTRIES * SZ_4K - 1; a8c21a54 The etnaviv authors 2015-12-03 206 a8c21a54 The etnaviv authors 2015-12-03 207ret = __etnaviv_iommu_init(etnaviv_domain); a8c21a54 The etnaviv authors 2015-12-03 @208if (ret) :: The code at line 208 was first introduced by commit :: a8c21a5451d831e67b7a6fb910f9ca8bc7b43554 drm/etnaviv: add initial etnaviv DRM driver :: TO: The etnaviv authors :: CC: Lucas Stach --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [linux-sunxi] Re: [PATCH v3 04/14] drm/sun4i: tcon: Add support for demuxing TCON output on A31
On Sat, Sep 30, 2017 at 1:35 PM, Julian Calaby wrote: > Hi Chen-Yu, > > On Fri, Sep 29, 2017 at 8:22 PM, Chen-Yu Tsai wrote: >> On Fri, Sep 29, 2017 at 6:20 PM, Maxime Ripard >> wrote: >>> On Fri, Sep 29, 2017 at 08:22:56AM +, Chen-Yu Tsai wrote: On systems with 2 TCONs such as the A31, it is possible to demux the output of the TCONs to one encoder. Add support for this for the A31. Signed-off-by: Chen-Yu Tsai --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 38 ++ 1 file changed, 38 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 7bf51abaee97..c949309d4285 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -112,6 +112,21 @@ void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable) } EXPORT_SYMBOL(sun4i_tcon_enable_vblank); +static struct sun4i_tcon *sun4i_get_first_tcon(struct drm_device *drm) >>> >>> Would that make sense to make it a bit more generic, and pass the id >>> to look for as an argument? >> >> The reason to look for TCON0 explicitly is to access the muxing registers, >> which >> are only available in TCON0. Other than that, there's nothing else >> shared between >> the two TCONs. So there's no particular reason to look for TCON1 explicitly. > > In that case: in the bizarre case where we're trying to use this mux > type and there is no TCON0, shouldn't we fail? It gives out a big warning, indicating something is wrong. If TCON0 is not found it is most likely your device tree is broken. There's nothing more the driver can do. Are you suggesting to return NULL in this case, and also do error handling in the callers? > (Also, the code doesn't make sense if we have some TCON1 and TCON2 in > that order as it'll return TCON2) I'm guessing you want it to return NULL. ChenYu ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/amdgpu: replace dev_* with DRM_DEV_* equivalents
This patch was generated using the following cocci script: @@ @@ ( - dev_info + DRM_DEV_INFO (...) | - dev_err + DRM_DEV_ERROR (...) | - dev_dbg + DRM_DEV_DEBUG (...) ) Signed-off-by: Aishwarya Pant --- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 10 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 46 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 12 drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c | 4 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 12 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 14 - drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c| 12 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 12 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 8 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 10 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/cik.c| 2 +- drivers/gpu/drm/amd/amdgpu/cik_ih.c | 2 +- drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/cz_ih.c | 2 +- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 4 +-- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 20 ++--- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 20 ++--- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 12 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 16 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 10 +++ drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 2 +- drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 +-- drivers/gpu/drm/amd/amdgpu/si_dma.c | 4 +-- drivers/gpu/drm/amd/amdgpu/si_ih.c | 2 +- drivers/gpu/drm/amd/amdgpu/soc15.c | 2 +- drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/vi.c | 2 +- 50 files changed, 168 insertions(+), 168 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c index a52795d..c59b701 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c @@ -245,7 +245,7 @@ static struct device *get_mfd_cell_dev(const char *device_name, int r) snprintf(auto_dev_name, sizeof(auto_dev_name), "%s.%d.auto", device_name, r); dev = bus_find_device_by_name(&platform_bus_type, NULL, auto_dev_name); - dev_info(dev, "device %s added to pm domain\n", auto_dev_name); + DRM_DEV_INFO(dev, "device %s added to pm domain\n", auto_dev_name); return dev; } @@ -394,7 +394,7 @@ static int acp_hw_init(void *handle) dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev); if (r) { - dev_err(dev, "Failed to add dev to genpd\n"); + DRM_DEV_ERROR(dev, "Failed to add dev to genpd\n"); return r; } } @@ -425,7 +425,7 @@ static int acp_hw_fini(void *handle) ret = pm_genpd_remove_device(&adev->acp.acp_genpd->gpd, dev); /* If removal fails, dont giveup and try rest */ if (ret) - dev_err(dev, "remove dev from genpd failed\n"); + DRM_DEV_ERROR(dev, "remove dev from genpd failed\n"); } kfree(adev->acp.acp_genpd); } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c index 5432af3..ad1a19f2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c @@ -85,7 +85,7 @@ void amdgpu_amdkfd_device_probe(struct amdgpu
[PATCH v2] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()
Replace instances of drm_framebuffer_reference/unreference() with *_get/put() suffixes and drm_dev_unref with *_put() suffix because get/put is shorter and consistent with the kernel use of *_get/put suffixes. Done with following coccinelle semantic patch @@ expression ex; @@ ( -drm_framebuffer_unreference(ex); +drm_framebuffer_put(ex); | -drm_dev_unref(ex); +drm_dev_put(ex); | -drm_framebuffer_reference(ex); +drm_framebuffer_get(ex); ) Signed-off-by: Harsha Sharma --- Changes in v2: -Added coccinelle patch in log message -cc to all driver-specific mailing lists drivers/gpu/drm/i915/i915_pci.c| 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +- drivers/gpu/drm/i915/intel_fbdev.c | 4 ++-- drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c | 2 +- drivers/gpu/drm/i915/selftests/i915_gem_evict.c| 2 +- drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 2 +- drivers/gpu/drm/i915/selftests/i915_gem_object.c | 2 +- drivers/gpu/drm/i915/selftests/i915_gem_request.c | 2 +- drivers/gpu/drm/i915/selftests/i915_vma.c | 2 +- drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c index 09d97e0..2f106cc 100644 --- a/drivers/gpu/drm/i915/i915_pci.c +++ b/drivers/gpu/drm/i915/i915_pci.c @@ -510,7 +510,7 @@ static void i915_pci_remove(struct pci_dev *pdev) struct drm_device *dev = pci_get_drvdata(pdev); i915_driver_unload(dev); - drm_dev_unref(dev); + drm_dev_put(dev); } static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index f172755..92f8304 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2856,7 +2856,7 @@ static int skl_format_to_fourcc(int format, bool rgb_order, bool alpha) if (intel_plane_ggtt_offset(state) == plane_config->base) { fb = c->primary->fb; - drm_framebuffer_reference(fb); + drm_framebuffer_get(fb); goto valid_fb; } } @@ -2887,7 +2887,7 @@ static int skl_format_to_fourcc(int format, bool rgb_order, bool alpha) intel_crtc->pipe, PTR_ERR(intel_state->vma)); intel_state->vma = NULL; - drm_framebuffer_unreference(fb); + drm_framebuffer_put(fb); return; } @@ -2908,7 +2908,7 @@ static int skl_format_to_fourcc(int format, bool rgb_order, bool alpha) if (i915_gem_object_is_tiled(obj)) dev_priv->preserve_bios_swizzle = true; - drm_framebuffer_reference(fb); + drm_framebuffer_get(fb); primary->fb = primary->state->fb = fb; primary->crtc = primary->state->crtc = &intel_crtc->base; @@ -9847,7 +9847,7 @@ struct drm_framebuffer * if (obj->base.size < mode->vdisplay * fb->pitches[0]) return NULL; - drm_framebuffer_reference(fb); + drm_framebuffer_get(fb); return fb; #else return NULL; @@ -10028,7 +10028,7 @@ int intel_get_load_detect_pipe(struct drm_connector *connector, if (ret) goto fail; - drm_framebuffer_unreference(fb); + drm_framebuffer_put(fb); ret = drm_atomic_set_mode_for_crtc(&crtc_state->base, mode); if (ret) diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 262e75c..1ff7149 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -189,7 +189,7 @@ static int intelfb_create(struct drm_fb_helper *helper, " releasing it\n", intel_fb->base.width, intel_fb->base.height, sizes->fb_width, sizes->fb_height); - drm_framebuffer_unreference(&intel_fb->base); + drm_framebuffer_put(&intel_fb->base); intel_fb = ifbdev->fb = NULL; } if (!intel_fb || WARN_ON(!intel_fb->obj)) { @@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8; ifbdev->fb = fb; - drm_framebuffer_reference(&ifbdev->fb->base); + drm_framebuffer_put(&ifbdev->fb->base); /* Final pass to check if any active pipes don't have fbs */ for_each_crtc(dev, crtc) { diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c index 89dc25a..a7055b1 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c @@ -389,7 +389,7 @@ int i915_gem_dmabuf_mock_selftests(void)
Re: [PATCH] drm/cma: correctly handle non-zero offset for mmap
On Thu, 2017-09-28 at 10:29 +0200, Daniel Vetter wrote: > On Thu, Sep 28, 2017 at 10:23 AM, Liviu Dudau > wrote: > > Hi Daniel, > > > > On Thu, Sep 28, 2017 at 09:40:35AM +0200, Daniel Vetter wrote: > > > On Wed, Sep 27, 2017 at 4:01 PM, Steven Price > > om> wrote: > > > > From: Tu Vuong > > > > > > > > When a CMA GEM object is exported via DRM PRIME it should be > > > > possible > > > > to mmap the object using an offset. However > > > > drm_gem_cma_mmap_obj always > > > > zeroed vm_pgoff. > > > > > > No, at least no one ever had run into this. Pretty much all > > > drivers > > > work like this. > > > > Can you be a bit more specific with "work like this"? You mean all > > drivers expect mmap-ed calles to have zero offset or the fact that > > they > > all zero vm_pgoff therefore ignore the offset? > > Iirc some drivers even outright reject the mmap if it's not aligned > to > the full obj. The mmap directly on the GEM object should behave as you say, however if user space has used the PRIME ioctl to export the object to a dma_buf object then surely it should behave like any other dma_buf object? The problem here is that the dma_buf object might be handed off to another piece of code which has no idea where it has come from and expects to be able to map with an offset (as it would be able to if the dma_buf had come from another driver). > > > > Fix this by moving the zeroing of vm_pgoff to drm_gem_cma_mmap > > > > (which > > > > is only used for non-PRIME mmap) and correct the size parameter > > > > in the > > > > call to dma_mmap_wc as the offset may not be non-zero. > > > > > > Since this is an uabi change we need the corresponding patch to > > > upstream open source userspace. Reviewed and all that and ready > > > for > > > acceptance. See > > > > If ignoring the offset is considered uabi, then I agree. Otherwise > > it > > looks to me more like a fix, rather than an uabi change. > > > > Maybe we should have first a patch warning when vm_pgoff is not > > zero so > > that we can find out how many in the userspace use that? > > Not sure warning is a good idea, because it still means we get to > audit everything. Might as well go ahead an reject it with -EINVAL, > and make sure that's consistent across drivers. But that's all work, > so what exactly is the use-case you have and want to do sub-mmapping > for? Once we have that it's much easier to discuss what to do, > instead > of abstraction discussions without the full stack at hand. This was initially discovered with the Mali Midgard driver. It uses sub-mmapping when there are multiple 'frames' within one buffer (e.g. using a display driver that only supports panning around a single pre- allocated buffer). It may also make sense in some cases for the likes of glReadPixels if the region specified is small and in a subset of the pages. Currently there's no way the caller of mmap can find out that the offset has been ignored. One option would be to "fix" this by simply rejecting attempts to mmap with an offset (return -EINVAL). However I do feel this is a useful feature as it avoids the need to mmap a large region when the caller knows only a small part of it will be needed. I don't believe this is a uabi change as such because the current functionality is "useless" - although obviously it is possible that some driver is feeding garbage in to the offset and happens to work because of the current implementation. Unless any user space drivers have bugs of this sort there wouldn't be any need to change them (and they would already be broken with other dma_buf exporters). Thanks, Steven > Thanks, Daniel > > > Best regards, > > Liviu > > > > > > > > https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#open-sourc > > > e-userspace-requirements > > > > > > > Signed-off-by: Tu Vuong > > > > Signed-off-by: Steven Price > > > > Reviewed-by: Brian Starkey > > > > CC: Brian Starkey > > > > CC: Liviu Dudau > > > > > > Thanks, Daniel > > > > > > > --- > > > > drivers/gpu/drm/drm_gem_cma_helper.c | 13 - > > > > 1 file changed, 8 insertions(+), 5 deletions(-) > > > > > > > > diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c > > > > b/drivers/gpu/drm/drm_gem_cma_helper.c > > > > index 373e33f22be4..25828b33c5be 100644 > > > > --- a/drivers/gpu/drm/drm_gem_cma_helper.c > > > > +++ b/drivers/gpu/drm/drm_gem_cma_helper.c > > > > @@ -276,15 +276,12 @@ static int drm_gem_cma_mmap_obj(struct > > > > drm_gem_cma_object *cma_obj, > > > > int ret; > > > > > > > > /* > > > > -* Clear the VM_PFNMAP flag that was set by > > > > drm_gem_mmap(), and set the > > > > -* vm_pgoff (used as a fake buffer offset by DRM) to 0 > > > > as we want to map > > > > -* the whole buffer. > > > > +* Clear the VM_PFNMAP flag that was set by > > > > drm_gem_mmap() > > > > */ > > > > vma->vm_flags &= ~VM_PFNMAP; > > > > - vma->vm_pgoff = 0; > > > > > > > > ret = dma_mmap_wc(cma_o
[PATCH] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()
Replace instances of drm_framebuffer_reference/unreference() with *_get/put() suffixes and drm_dev_unref with *_put() suffix because get/put is shorter and consistent with the kernel use of *_get/put suffixes . Signed-off-by: Harsha Sharma --- drivers/gpu/drm/i915/i915_pci.c| 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +- drivers/gpu/drm/i915/intel_fbdev.c | 4 ++-- drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c | 2 +- drivers/gpu/drm/i915/selftests/i915_gem_evict.c| 2 +- drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 2 +- drivers/gpu/drm/i915/selftests/i915_gem_object.c | 2 +- drivers/gpu/drm/i915/selftests/i915_gem_request.c | 2 +- drivers/gpu/drm/i915/selftests/i915_vma.c | 2 +- drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c index 09d97e0..2f106cc 100644 --- a/drivers/gpu/drm/i915/i915_pci.c +++ b/drivers/gpu/drm/i915/i915_pci.c @@ -510,7 +510,7 @@ static void i915_pci_remove(struct pci_dev *pdev) struct drm_device *dev = pci_get_drvdata(pdev); i915_driver_unload(dev); - drm_dev_unref(dev); + drm_dev_put(dev); } static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index f172755..92f8304 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2856,7 +2856,7 @@ static int skl_format_to_fourcc(int format, bool rgb_order, bool alpha) if (intel_plane_ggtt_offset(state) == plane_config->base) { fb = c->primary->fb; - drm_framebuffer_reference(fb); + drm_framebuffer_get(fb); goto valid_fb; } } @@ -2887,7 +2887,7 @@ static int skl_format_to_fourcc(int format, bool rgb_order, bool alpha) intel_crtc->pipe, PTR_ERR(intel_state->vma)); intel_state->vma = NULL; - drm_framebuffer_unreference(fb); + drm_framebuffer_put(fb); return; } @@ -2908,7 +2908,7 @@ static int skl_format_to_fourcc(int format, bool rgb_order, bool alpha) if (i915_gem_object_is_tiled(obj)) dev_priv->preserve_bios_swizzle = true; - drm_framebuffer_reference(fb); + drm_framebuffer_get(fb); primary->fb = primary->state->fb = fb; primary->crtc = primary->state->crtc = &intel_crtc->base; @@ -9847,7 +9847,7 @@ struct drm_framebuffer * if (obj->base.size < mode->vdisplay * fb->pitches[0]) return NULL; - drm_framebuffer_reference(fb); + drm_framebuffer_get(fb); return fb; #else return NULL; @@ -10028,7 +10028,7 @@ int intel_get_load_detect_pipe(struct drm_connector *connector, if (ret) goto fail; - drm_framebuffer_unreference(fb); + drm_framebuffer_put(fb); ret = drm_atomic_set_mode_for_crtc(&crtc_state->base, mode); if (ret) diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 262e75c..1ff7149 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -189,7 +189,7 @@ static int intelfb_create(struct drm_fb_helper *helper, " releasing it\n", intel_fb->base.width, intel_fb->base.height, sizes->fb_width, sizes->fb_height); - drm_framebuffer_unreference(&intel_fb->base); + drm_framebuffer_put(&intel_fb->base); intel_fb = ifbdev->fb = NULL; } if (!intel_fb || WARN_ON(!intel_fb->obj)) { @@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8; ifbdev->fb = fb; - drm_framebuffer_reference(&ifbdev->fb->base); + drm_framebuffer_put(&ifbdev->fb->base); /* Final pass to check if any active pipes don't have fbs */ for_each_crtc(dev, crtc) { diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c index 89dc25a..a7055b1 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c @@ -389,7 +389,7 @@ int i915_gem_dmabuf_mock_selftests(void) err = i915_subtests(tests, i915); - drm_dev_unref(&i915->drm); + drm_dev_put(&i915->drm); return err; } diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c index 5ea3732..75764fd 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c +++ b/drivers/gpu/d
Re: [PATCH v3 1/2] drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
On Thu, Sep 28, 2017 at 06:02:27PM +0200, Noralf Trønnes wrote: > > Den 28.09.2017 16.08, skrev Daniel Vetter: > > On Thu, Sep 28, 2017 at 02:44:34PM +0530, Meghana Madhyastha wrote: > > > Rename tinydrm_of_find_backlight to drm_of_find_backlight > > > and move it into drm_of.c from tinydrm-helpers.c. This is > > > because other drivers in the drm subsystem might need to call > > > this function. In that case and otherwise, it is better from > > > an organizational point of view to move it into drm_of.c along > > > with the other _of.c functions. > > > > > > Signed-off-by: Meghana Madhyastha > > > --- > > > Changes in v3: > > > -Change it back to a single patch from two patches in v2 > > > > > > drivers/gpu/drm/drm_of.c | 44 > > > ++ > > > drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 > > > --- > > > drivers/gpu/drm/tinydrm/mi0283qt.c | 3 +- > > > include/drm/drm_of.h | 1 + > > > include/drm/tinydrm/tinydrm-helpers.h | 1 - > > > 5 files changed, 47 insertions(+), 42 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c > > > index 8dafbdf..d878d3a 100644 > > > --- a/drivers/gpu/drm/drm_of.c > > > +++ b/drivers/gpu/drm/drm_of.c > > > @@ -1,6 +1,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -260,3 +261,46 @@ int drm_of_find_panel_or_bridge(const struct > > > device_node *np, > > > return ret; > > > } > > > EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); > > > + > > > +/** > > > + * drm_of_find_backlight - Find backlight device in device-tree > > > + * @dev: Device > > > + * > > > + * This function looks for a DT node pointed to by a property named > > > 'backlight' > > > + * and uses of_find_backlight_by_node() to get the backlight device. > > > + * Additionally if the brightness property is zero, it is set to > > > + * max_brightness. > > > + * > > > + * Note: It is the responsibility of the caller to call put_device() when > > > + * releasing the resource. > > > + * > > > + * Returns: > > > + * NULL if there's no backlight property. > > > + * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight > > > device > > > + * is found. > > > + * If the backlight device is found, a pointer to the structure is > > > returned. > > > + */ > > > +struct backlight_device *drm_of_find_backlight(struct device *dev) > > > +{ > > > + struct backlight_device *backlight; > > > + struct device_node *np; > > > + > > > + np = of_parse_phandle(dev->of_node, "backlight", 0); > > > + if (!np) > > > + return NULL; > > > + > > > + backlight = of_find_backlight_by_node(np); > > > + of_node_put(np); > > > + > > > + if (!backlight) > > > + return ERR_PTR(-EPROBE_DEFER); > > > + > > > + if (!backlight->props.brightness) { > > > + backlight->props.brightness = backlight->props.max_brightness; > > > + DRM_DEBUG_KMS("Backlight brightness set to %d\n", > > > + backlight->props.brightness); > > > + } > > > + > > > + return backlight; > > > +} > > > +EXPORT_SYMBOL(drm_of_find_backlight); > > > diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c > > > b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c > > > index bd6cce0..cd4c6a5 100644 > > > --- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c > > > +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c > > > @@ -237,46 +237,6 @@ void tinydrm_xrgb_to_gray8(u8 *dst, void *vaddr, > > > struct drm_framebuffer *fb, > > > EXPORT_SYMBOL(tinydrm_xrgb_to_gray8); > > > /** > > > - * tinydrm_of_find_backlight - Find backlight device in device-tree > > > - * @dev: Device > > > - * > > > - * This function looks for a DT node pointed to by a property named > > > 'backlight' > > > - * and uses of_find_backlight_by_node() to get the backlight device. > > > - * Additionally if the brightness property is zero, it is set to > > > - * max_brightness. > > > - * > > > - * Returns: > > > - * NULL if there's no backlight property. > > > - * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight > > > device > > > - * is found. > > > - * If the backlight device is found, a pointer to the structure is > > > returned. > > > - */ > > > -struct backlight_device *tinydrm_of_find_backlight(struct device *dev) > > > -{ > > > - struct backlight_device *backlight; > > > - struct device_node *np; > > > - > > > - np = of_parse_phandle(dev->of_node, "backlight", 0); > > > - if (!np) > > > - return NULL; > > > - > > > - backlight = of_find_backlight_by_node(np); > > > - of_node_put(np); > > > - > > > - if (!backlight) > > > - return ERR_PTR(-EPROBE_DEFER); > > > - > > > - if (!backlight->props.brightness) { > > > - backlight->props.brightness = backlight->props.max_brightness; > > > - DRM_DEBUG_KMS("Backlight br
Re: [PATCH 2/2] drm/i915: Add module parameter to en-/disable hw color correction.
On Fri, Sep 29, 2017 at 08:57:47AM +0200, Mario Kleiner wrote: > On 09/26/2017 07:05 AM, Daniel Vetter wrote: > > On Fri, Sep 15, 2017 at 05:48:25PM +0200, Mario Kleiner wrote: > > > The new module parameter enable_hw_color_correction defaults to > > > true, to retain the current behaviour. If set to false, it will > > > disable all hardware color correction, like gamma/degamma and > > > csc. > > > > > > This is useful for debugging gamma table / csc precision problems, > > > and to ensure unmodified pixel passthrough from framebuffer to > > > outputs, e.g., for scientific applications which critically depend > > > on perfect pixel passthrough. While i hope this switch generally > > > won't be needed, it provides extra peace-of-mind - an "airbag" for > > > color correction trouble. > > > > > > Tested on Ironlake, IvyBridge, Haswell, Skylake. > > > > > > One unexpected result during testing was that while this works on > > > all tested gpu's with a 8 bpc XR24 framebuffer as primary plane, > > > if a 10 bpc XR30 fb is active, then hw gamma tables seem to get > > > automatically bypassed on at least the tested IvyBridge and later > > > (but not on the tested Ironlake), regardless of hw programming, > > > at least for the legacy 256->8 bit luts and the 1024->10 bit > > > precision luts. However, the type of selected - but bypassed - > > > hw gamma table still determines output precision, ie. even an > > > auto-bypassed legacy 256 slot 8 bit lut in XR30 fb mode still > > > restricts the effective output precision to 8 bit, while an > > > auto-bypassed precision lut doesn't restrict precision. > > > > Instead of a modparam I think the right thing to fix here is the driver > > setup. Enabling the legacy gamma table is indeed documented to restrict > > the pipe to 8bpc (the 2 additional bits for 10bpc are just padded). > > > > Having driver options for "pls give me non-broken behaviour" doesn't make > > any sense to me. > > -Daniel > > > > Hi Daniel, > > this isn't meant as a permanent solution, but as a debugging aid, and as the > equivalent of an air-bag in a car. You hope you won't need it, but it is > good to have. In the past it would have been very handy for me to have a > master-switch for this, debugging problems on users machines related to > "pixels don't appear on the outputs as specified in the OpenGL rendering > code". When looking over the docs for color correction i just realized the > hardware has an easy way to disable this part of the pipeline, so i thought > this could make debugging so much easier - at least for me. I had the > impression that many current i915 module parameters are of this nature. We really don't like the proliferation of module debug options. The only time we are unhappily ok with them is if the hw just doesn't work as documented, or we have some other issue that just doesn't make much sense and results in random issues. PSR not working, rc6 not working, that kind of stuff. But this here is just a case of "not yet fully implemented", there's really no need for users out there in the field to be able to change stuff without changing code to help us diagnos an issue we don't yet understand. The only one who needs this right now is you, for helping develop proper 10+bit gamma support, but I don't see how that would be useful to anyone else. On the issue itself: What I mean is that when there's no gamma table we should properly bypass all the lut stuff automatically, to preserve the full bits. Kinda as an interim improvement for your use-case, since it sounds very much like you want both higher bit depth and gamma tables. > The debug switch also provides a temporary workaround on production systems > if a problem is related to color correction, not meant as a permanent > solution. Many of my users are challenged already by the fact that Linux is > not macOS, and editing a config file or installing a prebuilt kernel from a > .dpkg is already borderline rocket science for them, that's why those module > parameters would be nice to have. > > My actual plan is to implement true 10 bit -> 12 bit gamma table support, > hopefully still for the 4.15 kernel. > > I have experimental patches for using the precision luts with 1024 slots and > 10 bit output width, ie. 10 bit in -> 10 bit out on Ironlake and later. I'll > send those out in their hacky state just for reference. > > However the better plan i have in mind is to extend the code so that if (we > are in single-lut mode (DEGAMMA_LUT == 0)) AND (the userspace provided input > lut is monotonically increasing) we switch from the dual 512 slot 10 bit > luts to the 512 slot 12 bit lut. This would also be applicable to the 256 > slot legacy gamma tables, which are always single-lut and can be upsampled > from 256 slots to 512 slots. > > The reason is that the dual-512 slot luts are not good enough to handle a 10 > bit framebuffer. As far as i read the PRMs, a 10 bit fb value would simply > get truncated to 9 bits to select
[git pull] drm fixes
Hi Linus, Regular fixes pull, some amdkfd, amdgpu, etnaviv, sun4i, qxl, tegra fixes. I've got an outstanding pull for i915 but it wasn't on an rc2 base so I wanted to ship these out first, I might get to it before rc3 or I might not. Dave. The following changes since commit e19b205be43d11bff638cad4487008c48d21c103: Linux 4.14-rc2 (2017-09-24 16:38:56 -0700) are available in the git repository at: git://people.freedesktop.org/~airlied/linux tags/drm-fixes-for-v4.14-rc3 for you to fetch changes up to 2b702e72e33bbdec0764cfb6e1dd00fe1142ae55: Merge tag 'drm-misc-fixes-2017-09-28-1' of git://anongit.freedesktop.org/git/drm-misc into drm-fixes (2017-09-29 17:11:04 +1000) qxl, tegra, misc, amd, etnaviv fixes Alex Deucher (1): drm/radeon: disable hard reset in hibernate for APUs Colin Ian King (1): drm/amdkfd: check for null dev to avoid a null pointer dereference Dave Airlie (4): Merge tag 'drm-amdkfd-fixes-2017-09-24' of git://people.freedesktop.org/~gabbayo/linux into drm-fixes Merge branch 'etnaviv/fixes' of https://git.pengutronix.de/git/lst/linux into drm-fixes Merge branch 'drm-fixes-4.14' of git://people.freedesktop.org/~agd5f/linux into drm-fixes Merge tag 'drm-misc-fixes-2017-09-28-1' of git://anongit.freedesktop.org/git/drm-misc into drm-fixes Felix Kuehling (2): drm/amdkfd: Fix incorrect destroy_mqd parameter drm/amdkfd: Print event limit messages only once per process Gerd Hoffmann (2): qxl: fix primary surface handling qxl: fix framebuffer unpinning Hans Verkuil (1): drm/sun4i: cec: Enable back CEC-pin framework Jean Delvare (1): drm/amdgpu: revert tile table update for oland Lucas Stach (2): etnaviv: fix submit error path etnaviv: fix gem object list corruption Sean Paul (1): Merge remote-tracking branch 'origin/master' into drm-misc-fixes Thierry Reding (1): drm/tegra: trace: Fix path to include Yong Zhao (1): drm/amdkfd: Fix kernel-queue wrapping bugs drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 189 +- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 + drivers/gpu/drm/amd/amdkfd/kfd_events.c | 5 +- drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 20 ++- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + drivers/gpu/drm/etnaviv/etnaviv_gem.c | 3 + drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 6 +- drivers/gpu/drm/qxl/qxl_display.c | 41 +++--- drivers/gpu/drm/radeon/radeon_device.c| 2 +- drivers/gpu/drm/sun4i/Kconfig | 2 +- drivers/gpu/drm/sun4i/sun4i_hdmi.h| 2 +- drivers/gpu/drm/tegra/trace.h | 2 +- 12 files changed, 245 insertions(+), 30 deletions(-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/armada: Remove unused #include
On Wed, Sep 27, 2017 at 01:38:46AM -0600, Haneen Mohammed wrote: > Remove drmP.h as it is not needed anymore since nothing it > defines is used in these files. > > Signed-off-by: Haneen Mohammed Applied, thanks. -Daniel > --- > drivers/gpu/drm/armada/armada_510.c | 1 - > drivers/gpu/drm/armada/armada_drv.c | 1 - > drivers/gpu/drm/armada/armada_fb.c| 1 - > drivers/gpu/drm/armada/armada_fbdev.c | 1 - > drivers/gpu/drm/armada/armada_gem.c | 1 - > 5 files changed, 5 deletions(-) > > diff --git a/drivers/gpu/drm/armada/armada_510.c > b/drivers/gpu/drm/armada/armada_510.c > index ad3d2eb..41a784f 100644 > --- a/drivers/gpu/drm/armada/armada_510.c > +++ b/drivers/gpu/drm/armada/armada_510.c > @@ -9,7 +9,6 @@ > */ > #include > #include > -#include > #include > #include "armada_crtc.h" > #include "armada_drm.h" > diff --git a/drivers/gpu/drm/armada/armada_drv.c > b/drivers/gpu/drm/armada/armada_drv.c > index c993bcc..17bb675 100644 > --- a/drivers/gpu/drm/armada/armada_drv.c > +++ b/drivers/gpu/drm/armada/armada_drv.c > @@ -9,7 +9,6 @@ > #include > #include > #include > -#include > #include > #include > #include "armada_crtc.h" > diff --git a/drivers/gpu/drm/armada/armada_fb.c > b/drivers/gpu/drm/armada/armada_fb.c > index 51839c1..a38d5a0 100644 > --- a/drivers/gpu/drm/armada/armada_fb.c > +++ b/drivers/gpu/drm/armada/armada_fb.c > @@ -5,7 +5,6 @@ > * it under the terms of the GNU General Public License version 2 as > * published by the Free Software Foundation. > */ > -#include > #include > #include > #include "armada_drm.h" > diff --git a/drivers/gpu/drm/armada/armada_fbdev.c > b/drivers/gpu/drm/armada/armada_fbdev.c > index cf6bad1..a2ce83f 100644 > --- a/drivers/gpu/drm/armada/armada_fbdev.c > +++ b/drivers/gpu/drm/armada/armada_fbdev.c > @@ -10,7 +10,6 @@ > #include > #include > > -#include > #include > #include "armada_crtc.h" > #include "armada_drm.h" > diff --git a/drivers/gpu/drm/armada/armada_gem.c > b/drivers/gpu/drm/armada/armada_gem.c > index 49d40aa..190280e 100644 > --- a/drivers/gpu/drm/armada/armada_gem.c > +++ b/drivers/gpu/drm/armada/armada_gem.c > @@ -8,7 +8,6 @@ > #include > #include > #include > -#include > #include "armada_drm.h" > #include "armada_gem.h" > #include > -- > 2.7.4 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Outreachy kernel] Re: [PATCH] drm/tinydrm: Replace dev_error with DRM_DEV_ERROR
On Mon, Sep 25, 2017 at 06:21:19PM +0200, Noralf Trønnes wrote: > > Den 23.09.2017 11.10, skrev Harsha Sharma: > > Convert instances of dev_error to DRM_DEV_ERROR as we have > > DRM_DEV_ERROR variants of drm print macros. > > > > Signed-off-by: Harsha Sharma > > --- > > drivers/gpu/drm/tinydrm/mi0283qt.c | 8 > > drivers/gpu/drm/tinydrm/repaper.c | 26 +- > > drivers/gpu/drm/tinydrm/st7586.c | 6 +++--- > > 3 files changed, 20 insertions(+), 20 deletions(-) > > > > diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c > > b/drivers/gpu/drm/tinydrm/mi0283qt.c > > index 7e5bb7d..7dded50 100644 > > --- a/drivers/gpu/drm/tinydrm/mi0283qt.c > > +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c > > @@ -31,7 +31,7 @@ static int mi0283qt_init(struct mipi_dbi *mipi) > > ret = regulator_enable(mipi->regulator); > > if (ret) { > > - dev_err(dev, "Failed to enable regulator %d\n", ret); > > + DRM_DEV_ERROR(dev, "Failed to enable regulator %d\n", ret); > > return ret; > > } > > @@ -42,7 +42,7 @@ static int mi0283qt_init(struct mipi_dbi *mipi) > > mipi_dbi_hw_reset(mipi); > > ret = mipi_dbi_command(mipi, MIPI_DCS_SOFT_RESET); > > if (ret) { > > - dev_err(dev, "Error sending command %d\n", ret); > > + DRM_DEV_ERROR(dev, "Error sending command %d\n", ret); > > regulator_disable(mipi->regulator); > > return ret; > > } > > @@ -175,13 +175,13 @@ static int mi0283qt_probe(struct spi_device *spi) > > mipi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); > > if (IS_ERR(mipi->reset)) { > > - dev_err(dev, "Failed to get gpio 'reset'\n"); > > + DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n"); > > return PTR_ERR(mipi->reset); > > } > > dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW); > > if (IS_ERR(dc)) { > > - dev_err(dev, "Failed to get gpio 'dc'\n"); > > + DRM_DEV_ERROR(dev, "Failed to get gpio 'dc'\n"); > > return PTR_ERR(dc); > > } > > diff --git a/drivers/gpu/drm/tinydrm/repaper.c > > b/drivers/gpu/drm/tinydrm/repaper.c > > index 30dc97b..bd152bb 100644 > > --- a/drivers/gpu/drm/tinydrm/repaper.c > > +++ b/drivers/gpu/drm/tinydrm/repaper.c > > @@ -473,7 +473,7 @@ static void repaper_get_temperature(struct repaper_epd > > *epd) > > ret = thermal_zone_get_temp(epd->thermal, &temperature); > > if (ret) { > > - dev_err(&epd->spi->dev, "Failed to get temperature (%d)\n", > > + DRM_DEV_ERROR(&epd->spi->dev, "Failed to get temperature > > (%d)\n", > > ret); > > Please fix these alignment issues, or maybe just put it all on one line: > > CHECK: Alignment should match open parenthesis > #59: FILE: drivers/gpu/drm/tinydrm/repaper.c:477: > + DRM_DEV_ERROR(&epd->spi->dev, "Failed to get temperature > (%d)\n", > ret); > > CHECK: Alignment should match open parenthesis > #152: FILE: drivers/gpu/drm/tinydrm/repaper.c:995: > + DRM_DEV_ERROR(dev, "Failed to get thermal zone: > %s\n", > thermal_zone); > > With that changed you can add to your next version: > Reviewed-by: Noralf Trønnes I couldn't find v2 of this one here ... -Daniel > > > return; > > } > > @@ -629,7 +629,7 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb, > > mutex_unlock(&tdev->dirty_lock); > > if (ret) > > - dev_err(fb->dev->dev, "Failed to update display (%d)\n", ret); > > + DRM_DEV_ERROR(fb->dev->dev, "Failed to update display (%d)\n", > > ret); > > kfree(buf); > > return ret; > > @@ -703,7 +703,7 @@ static void repaper_pipe_enable(struct > > drm_simple_display_pipe *pipe, > > } > > if (!i) { > > - dev_err(dev, "timeout waiting for panel to become ready.\n"); > > + DRM_DEV_ERROR(dev, "timeout waiting for panel to become > > ready.\n"); > > power_off(epd); > > return; > > } > > @@ -725,9 +725,9 @@ static void repaper_pipe_enable(struct > > drm_simple_display_pipe *pipe, > > ret = repaper_read_val(spi, 0x0f); > > if (ret < 0 || !(ret & 0x80)) { > > if (ret < 0) > > - dev_err(dev, "failed to read chip (%d)\n", ret); > > + DRM_DEV_ERROR(dev, "failed to read chip (%d)\n", ret); > > else > > - dev_err(dev, "panel is reported broken\n"); > > + DRM_DEV_ERROR(dev, "panel is reported broken\n"); > > power_off(epd); > > return; > > } > > @@ -767,7 +767,7 @@ static void repaper_pipe_enable(struct > > drm_simple_display_pipe *pipe, > > /* check DC/DC */ > > ret = repaper_read_val(spi, 0x0f); > > if (ret < 0) { > > - dev_err(dev, "failed to read chip (%d)\n", ret); > > + DR
[PATCH v2 2/9] drm/exynos: ipp: Add IPP v2 framework
This patch adds Exynos IPP v2 subsystem and userspace API. New userspace API is focused ONLY on memory-to-memory image processing. The two remainging IPP operation modes (framebuffer writeback and local-path output with image processing) can be implemented using standard DRM features: writeback connectors and additional DRM planes with scaling features. V2 IPP userspace API is not compatible with old IPP ioctls. This is a significant change, but the old IPP subsystem in mainline Linux kernel was partially disfunctional anyway and not used in any open-source project. V2 IPP userspace API is based on stateless approach, which much better fits to memory-to-memory image processing model. It also provides support for all image formats, which are both already defined in DRM API and supported by the existing IPP hardware modules. The API consists of the following ioctls: - DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES: to enumerate all available image processing modules, - DRM_IOCTL_EXYNOS_IPP_GET_CAPS: to query capabilities and supported image formats of given IPP module, - DRM_IOCTL_EXYNOS_IPP_GET_LIMITS: to query hardware limitiations for selected image format of given IPP module, - DRM_IOCTL_EXYNOS_IPP_COMMIT: to perform operation described by the provided structures (source and destination buffers, operation rectangle, transformation, etc). The proposed userspace API is extensible. In the future more advanced image processing operations can be defined to support for example blending. Userspace API is fully functional also on DRM render nodes, so it is not limited to the root/privileged client. Internal driver API also has been completely rewritten. New IPP core performs all possible input validation, checks and object life-time control. The drivers can focus only on writing configuration to hardware registers. Stateless nature of DRM_IOCTL_EXYNOS_IPP_COMMIT ioctl simplifies the driver API. Minimal driver needs to provide a single callback for starting processing and an array with supported image formats. Signed-off-by: Marek Szyprowski Tested-by: Hoegeun Kwon --- drivers/gpu/drm/exynos/Kconfig | 3 + drivers/gpu/drm/exynos/Makefile | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 9 + drivers/gpu/drm/exynos/exynos_drm_ipp.c | 894 drivers/gpu/drm/exynos/exynos_drm_ipp.h | 191 +++ include/uapi/drm/exynos_drm.h | 238 + 6 files changed, 1336 insertions(+) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.h diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 88cff0e039b6..2e097a81df12 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -94,6 +94,9 @@ config DRM_EXYNOS_G2D help Choose this option if you want to use Exynos G2D for DRM. +config DRM_EXYNOS_IPP + bool + config DRM_EXYNOS_FIMC bool "FIMC" depends on BROKEN && MFD_SYSCON diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile index 09bb002c9555..f663490e949d 100644 --- a/drivers/gpu/drm/exynos/Makefile +++ b/drivers/gpu/drm/exynos/Makefile @@ -17,6 +17,7 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_MIXER) += exynos_mixer.o exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI)+= exynos_hdmi.o exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI)+= exynos_drm_vidi.o exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o +exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMC)+= exynos_drm_fimc.o exynosdrm-$(CONFIG_DRM_EXYNOS_ROTATOR) += exynos_drm_rotator.o exynosdrm-$(CONFIG_DRM_EXYNOS_GSC) += exynos_drm_gsc.o diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 2fc5d3c01390..de4cce258a5b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -26,6 +26,7 @@ #include "exynos_drm_fb.h" #include "exynos_drm_gem.h" #include "exynos_drm_plane.h" +#include "exynos_drm_ipp.h" #include "exynos_drm_vidi.h" #include "exynos_drm_g2d.h" #include "exynos_drm_iommu.h" @@ -114,6 +115,14 @@ static void exynos_drm_lastclose(struct drm_device *dev) DRM_AUTH | DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(EXYNOS_G2D_EXEC, exynos_g2d_exec_ioctl, DRM_AUTH | DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(EXYNOS_IPP_GET_RESOURCES, exynos_drm_ipp_get_res_ioctl, + DRM_AUTH | DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(EXYNOS_IPP_GET_CAPS, exynos_drm_ipp_get_caps_ioctl, + DRM_AUTH | DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(EXYNOS_IPP_GET_LIMITS, exynos_drm_ipp_get_limits_ioctl, + DRM_AUTH | DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(EXYNOS_IPP_COMMIT, exynos_drm_ipp_commit_ioctl, + DRM_AUTH | DRM_RENDER_ALLOW), }; static const struct f
[PATCH v2 9/9] ARM: dts: exynos: Add mem-2-mem Scaler devices
From: Andrzej Pietrasiewicz There are 3 scaler devices in Exynos5420 SoCs, all are a part of MSCL power domain. MSCL power domain and SYSMMU controllers (two per each scaler device) have been already added to exynos5420.dtsi earlier, so bind them to newly added devices. Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Marek Szyprowski --- arch/arm/boot/dts/exynos5420.dtsi | 35 +++ 1 file changed, 35 insertions(+) diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi index 88e5d6d3f901..7894045bd91b 100644 --- a/arch/arm/boot/dts/exynos5420.dtsi +++ b/arch/arm/boot/dts/exynos5420.dtsi @@ -678,6 +678,35 @@ iommus = <&sysmmu_gscl1>; }; + scaler_0: scaler@1280 { + compatible = "samsung,exynos5420-scaler"; + reg = <0x1280 0x1294>; + interrupts = <0 220 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clock CLK_MSCL0>; + clock-names = "mscl"; + power-domains = <&msc_pd>; + iommus = <&sysmmu_scaler0r>, <&sysmmu_scaler0w>; + }; + + scaler_1: scaler@1281 { + compatible = "samsung,exynos5420-scaler"; + reg = <0x1281 0x1294>; + interrupts = <0 221 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clock CLK_MSCL1>; + clock-names = "mscl"; + power-domains = <&msc_pd>; + iommus = <&sysmmu_scaler1r>, <&sysmmu_scaler1w>; + }; + scaler_2: scaler@1282 { + compatible = "samsung,exynos5420-scaler"; + reg = <0x1282 0x1294>; + interrupts = <0 222 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clock CLK_MSCL2>; + clock-names = "mscl"; + power-domains = <&msc_pd>; + iommus = <&sysmmu_scaler2r>, <&sysmmu_scaler2w>; + }; + jpeg_0: jpeg@11F5 { compatible = "samsung,exynos5420-jpeg"; reg = <0x11F5 0x1000>; @@ -812,6 +841,7 @@ interrupts = <22 4>; clock-names = "sysmmu", "master"; clocks = <&clock CLK_SMMU_MSCL0>, <&clock CLK_MSCL0>; + power-domains = <&msc_pd>; #iommu-cells = <0>; }; @@ -821,6 +851,7 @@ interrupts = ; clock-names = "sysmmu", "master"; clocks = <&clock CLK_SMMU_MSCL1>, <&clock CLK_MSCL1>; + power-domains = <&msc_pd>; #iommu-cells = <0>; }; @@ -830,6 +861,7 @@ interrupts = ; clock-names = "sysmmu", "master"; clocks = <&clock CLK_SMMU_MSCL2>, <&clock CLK_MSCL2>; + power-domains = <&msc_pd>; #iommu-cells = <0>; }; @@ -840,6 +872,7 @@ interrupts = <27 2>; clock-names = "sysmmu", "master"; clocks = <&clock CLK_SMMU_MSCL0>, <&clock CLK_MSCL0>; + power-domains = <&msc_pd>; #iommu-cells = <0>; }; @@ -850,6 +883,7 @@ interrupts = <22 6>; clock-names = "sysmmu", "master"; clocks = <&clock CLK_SMMU_MSCL1>, <&clock CLK_MSCL1>; + power-domains = <&msc_pd>; #iommu-cells = <0>; }; @@ -860,6 +894,7 @@ interrupts = <19 6>; clock-names = "sysmmu", "master"; clocks = <&clock CLK_SMMU_MSCL2>, <&clock CLK_MSCL2>; + power-domains = <&msc_pd>; #iommu-cells = <0>; }; -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 3/9] drm/exynos: rotator: Convert driver to IPP v2 core API
This patch adapts Exynos DRM rotator driver to new IPP v2 core API. The side effect of this conversion is a switch to driver component API to register properly in the Exynos DRM core. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/Kconfig | 2 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 + drivers/gpu/drm/exynos/exynos_drm_rotator.c | 735 +++- drivers/gpu/drm/exynos/exynos_drm_rotator.h | 19 - 4 files changed, 172 insertions(+), 585 deletions(-) delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_rotator.h diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 2e097a81df12..c10c9ca0d8b4 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -105,7 +105,7 @@ config DRM_EXYNOS_FIMC config DRM_EXYNOS_ROTATOR bool "Rotator" - depends on BROKEN + select DRM_EXYNOS_IPP help Choose this option if you want to use Exynos Rotator for DRM. diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index de4cce258a5b..3ade2b0ad15d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -257,6 +257,7 @@ struct exynos_drm_driver_info { DRV_PTR(fimc_driver, CONFIG_DRM_EXYNOS_FIMC), }, { DRV_PTR(rotator_driver, CONFIG_DRM_EXYNOS_ROTATOR), + DRM_COMPONENT_DRIVER }, { DRV_PTR(gsc_driver, CONFIG_DRM_EXYNOS_GSC), }, { diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index 79282a820ecc..f478073d6c37 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include @@ -22,29 +23,16 @@ #include #include "regs-rotator.h" #include "exynos_drm_drv.h" +#include "exynos_drm_iommu.h" #include "exynos_drm_ipp.h" /* * Rotator supports image crop/rotator and input/output DMA operations. * input DMA reads image data from the memory. * output DMA writes image data to memory. - * - * M2M operation : supports crop/scale/rotation/csc so on. - * Memory > Rotator H/W > Memory. - */ - -/* - * TODO - * 1. check suspend/resume api if needed. - * 2. need to check use case platform_device_id. - * 3. check src/dst size with, height. - * 4. need to add supported list in prop_list. */ -#define get_rot_context(dev) platform_get_drvdata(to_platform_device(dev)) -#define get_ctx_from_ippdrv(ippdrv)container_of(ippdrv,\ - struct rot_context, ippdrv); -#define rot_read(offset) readl(rot->regs + (offset)) +#define rot_read(offset) readl(rot->regs + (offset)) #define rot_write(cfg, offset) writel(cfg, rot->regs + (offset)) enum rot_irq_status { @@ -53,53 +41,21 @@ enum rot_irq_status { }; /* - * A structure of limitation. - * - * @min_w: minimum width. - * @min_h: minimum height. - * @max_w: maximum width. - * @max_h: maximum height. - * @align: align size. - */ -struct rot_limit { - u32 min_w; - u32 min_h; - u32 max_w; - u32 max_h; - u32 align; -}; - -/* - * A structure of limitation table. - * - * @ycbcr420_2p: case of YUV. - * @rgb888: case of RGB. - */ -struct rot_limit_table { - struct rot_limitycbcr420_2p; - struct rot_limitrgb888; -}; - -/* * A structure of rotator context. * @ippdrv: prepare initialization using ippdrv. - * @regs_res: register resources. * @regs: memory mapped io registers. * @clock: rotator gate clock. * @limit_tbl: limitation of rotator. * @irq: irq number. - * @cur_buf_id: current operation buffer id. - * @suspended: suspended state. */ struct rot_context { - struct exynos_drm_ippdrvippdrv; - struct resource *regs_res; + struct exynos_drm_ipp ipp; + struct drm_device *drm_dev; + struct device *dev; void __iomem*regs; struct clk *clock; - struct rot_limit_table *limit_tbl; - int irq; - int cur_buf_id[EXYNOS_DRM_OPS_MAX]; - boolsuspended; + const struct exynos_drm_ipp_formats *formats; + struct exynos_drm_ipp_task *task; }; static void rotator_reg_set_irq(struct rot_context *rot, bool enable) @@ -114,15 +70,6 @@ static void rotator_reg_set_irq(struct rot_context *rot, bool enable) rot_write(val, ROT_CONFIG); } -static u32 rotator_reg_get_fmt(struct rot_context *rot) -{ - u32 val = rot_read(ROT_CONTROL); - - val &= ROT_CONTROL_FMT_MASK; - - return val; -} - static enum rot_irq_status rotator_reg_get_irq_status(struct rot_context *rot) { u32 val = rot_read(ROT_STATUS); @@ -138,9 +85,6 @@ static enum rot_irq_status rotator_reg_get_irq_status(struct rot_context *rot) static irqreturn_
[PATCH v2 0/9] Exynos DRM: rewrite IPP subsystem and userspace API
Dear all, This patchset performs complete rewrite of Exynos DRM IPP subsystem and its userspace API. Why such rewrite is needed? Exynos DRM IPP API is over-engineered in general, but not really extensible on the other side. It is also buggy, with significant design flaws: - Userspace API covers memory-2-memory picture operations together with CRTC writeback and duplicating features, which belongs to video plane. - Lack of support of the all required image formats (for example NV12 Samsung-tiled cannot be used due to lack of pixel format modifier support). - Userspace API designed only to mimic hardware behaviour, not easy to understand. - Lack of proper input validation in the core, drivers also didn't do that correctly, so it was possible to set incorrect parameters and easil trigger IOMMU fault or memory trash. - Drivers were partially disfunctional or supported only a subset of modes. Due to the above limitations and issues the Exynos DRM IPP API was not used by any of the open-source projects. I assume that it is safe to remove this broken API without any damage to open-source community. All remaining users (mainly Tizen project related) will be updated to the new version. This patchset changes Exynos DRM IPP subsystem to something useful. The userspace API is much simpler, state-less and easy to understand. Also the code of the core and driver is significantly smaller and easier to understand. Patches were tested on Exynos4412 based Odroid U3 and Exynos5422 Odroid XU3 boards, on top of Linux next-20170928 kernel. Best regards Marek Szyprowski Samsung R&D Institute Poland Changelog: v2: - fixed minor issues pointed by other developers: * fixed possible null pointer dereferrence (Tobias) * changed limits_size to limits_count (Tobias) * renamed struct exynos_drm_ipp_format to drm_exynos_ipp_format (Andrzej) * added proper return value from exynos_drm_ipp_get_res_ioctl when no IPP driver is present (Andrzej) * properly aligned all uapi structures to be 32/64 bit safe (Emil) * properly initialize all strucutres - added new Exynos Scaler driver from Andrzej Pietrasiewicz v1: https://www.spinics.net/lists/linux-samsung-soc/msg60492.html - initial version of IPP v2 My previous works in this area: "[RFC v2 0/2] Exynos DRM: add Picture Processor extension" https://www.spinics.net/lists/dri-devel/msg140669.html - removed usage of DRM objects and properties - replaced them with simple list of parameters with predefined IDs "[RFC 0/4] Exynos DRM: add Picture Processor extension" https://www.spinics.net/lists/linux-samsung-soc/msg59323.html - moved this feature from DRM core to Exynos DRM driver - changed name from framebuffer processor to picture processor - simplified code to cover only things needed by Exynos drivers - implemented simple fifo task scheduler - cleaned up rotator driver conversion (removed IPP remainings) "[RFC 0/2] New feature: Framebuffer processors" https://www.spinics.net/lists/linux-samsung-soc/msg54810.html - generic approach implemented in DRM core, rejected Patch summary: Andrzej Pietrasiewicz (3): drm/exynos: Add driver for Exynos Scaler module drivers: clk: samsung: Fix m2m scaler clock on Exynos542x ARM: dts: exynos: Add mem-2-mem Scaler devices Marek Szyprowski (6): drm/exynos: ipp: Remove Exynos DRM IPP subsystem drm/exynos: ipp: Add IPP v2 framework drm/exynos: rotator: Convert driver to IPP v2 core API drm/exynos: gsc: Convert driver to IPP v2 core API drm/exynos: Add generic support for devices shared with V4L2 subsystem drm/exynos: fimc: Convert driver to IPP v2 core API .../devicetree/bindings/gpu/samsung-scaler.txt | 25 + arch/arm/boot/dts/exynos5420.dtsi | 35 + drivers/clk/samsung/clk-exynos5420.c |2 +- drivers/gpu/drm/exynos/Kconfig | 18 +- drivers/gpu/drm/exynos/Makefile|1 + drivers/gpu/drm/exynos/exynos_drm_drv.c| 36 +- drivers/gpu/drm/exynos/exynos_drm_drv.h|5 +- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 893 +++- drivers/gpu/drm/exynos/exynos_drm_fimc.h | 23 - drivers/gpu/drm/exynos/exynos_drm_gsc.c| 853 ++-- drivers/gpu/drm/exynos/exynos_drm_gsc.h| 24 - drivers/gpu/drm/exynos/exynos_drm_ipp.c| 2240 ++-- drivers/gpu/drm/exynos/exynos_drm_ipp.h| 357 ++-- drivers/gpu/drm/exynos/exynos_drm_rotator.c| 735 ++- drivers/gpu/drm/exynos/exynos_drm_rotator.h| 19 - drivers/gpu/drm/exynos/exynos_drm_scaler.c | 675 ++ drivers/gpu/drm/exynos/regs-scaler.h | 426 include/uapi/drm/exynos_drm.h | 326 +-- 18 files changed, 2818 insertions(+), 3875 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpu/samsung-scaler.txt delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.h delete mode 100644 d
[PATCH v2 7/9] drm/exynos: Add driver for Exynos Scaler module
From: Andrzej Pietrasiewicz Exynos Scaler is a hardware module, which processes graphic data fetched from memory and transfers the resultant dato another memory buffer. Graphics data can be up/down-scaled, rotated, flipped and converted color space. Scaler hardware modules are a part of Exynos5420 and newer Exynos SoCs. Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Marek Szyprowski --- .../devicetree/bindings/gpu/samsung-scaler.txt | 25 + drivers/gpu/drm/exynos/Kconfig | 6 + drivers/gpu/drm/exynos/Makefile| 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c| 3 + drivers/gpu/drm/exynos/exynos_drm_drv.h| 1 + drivers/gpu/drm/exynos/exynos_drm_ipp.h| 4 + drivers/gpu/drm/exynos/exynos_drm_scaler.c | 675 + drivers/gpu/drm/exynos/regs-scaler.h | 426 + 8 files changed, 1141 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpu/samsung-scaler.txt create mode 100644 drivers/gpu/drm/exynos/exynos_drm_scaler.c create mode 100644 drivers/gpu/drm/exynos/regs-scaler.h diff --git a/Documentation/devicetree/bindings/gpu/samsung-scaler.txt b/Documentation/devicetree/bindings/gpu/samsung-scaler.txt new file mode 100644 index ..25a7823e57bc --- /dev/null +++ b/Documentation/devicetree/bindings/gpu/samsung-scaler.txt @@ -0,0 +1,25 @@ +* Samsung Exynos Image Scaler + +Required properties: + - compatible : value should be one of the following: + (a) "samsung,exynos5420-scaler" for Scaler IP in Exynos5420 + + - reg : Physical base address of the IP registers and length of memory + mapped region. + + - interrupts : Interrupt specifier for scaler interrupt, according to format +specific to interrupt parent. + + - clocks : Clock specifier for scaler clock, according to generic clock +bindings. (See Documentation/devicetree/bindings/clock/exynos*.txt) + + - clock-names : Names of clocks. For exynos scaler, it should be "mscl". + +Example: + scaler@1280 { + compatible = "samsung,exynos5420-scaler"; + reg = <0x1280 0x1294>; + interrupts = <0 220 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clock CLK_MSCL0>; + clock-names = "mscl"; + }; diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 4a4582202e60..bbad35a19d57 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -110,6 +110,12 @@ config DRM_EXYNOS_ROTATOR help Choose this option if you want to use Exynos Rotator for DRM. +config DRM_EXYNOS_SCALER + bool "Scaler" + select DRM_EXYNOS_IPP + help + Choose this option if you want to use Exynos Scaler for DRM. + config DRM_EXYNOS_GSC bool "GScaler" depends on ARCH_EXYNOS5 && VIDEO_SAMSUNG_EXYNOS_GSC=n diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile index f663490e949d..aa84472ac093 100644 --- a/drivers/gpu/drm/exynos/Makefile +++ b/drivers/gpu/drm/exynos/Makefile @@ -20,6 +20,7 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_G2D)+= exynos_drm_g2d.o exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMC)+= exynos_drm_fimc.o exynosdrm-$(CONFIG_DRM_EXYNOS_ROTATOR) += exynos_drm_rotator.o +exynosdrm-$(CONFIG_DRM_EXYNOS_SCALER) += exynos_drm_scaler.o exynosdrm-$(CONFIG_DRM_EXYNOS_GSC) += exynos_drm_gsc.o exynosdrm-$(CONFIG_DRM_EXYNOS_MIC) += exynos_drm_mic.o diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 4afeffa024f3..b2582ae993ff 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -261,6 +261,9 @@ struct exynos_drm_driver_info { DRV_PTR(rotator_driver, CONFIG_DRM_EXYNOS_ROTATOR), DRM_COMPONENT_DRIVER }, { + DRV_PTR(scaler_driver, CONFIG_DRM_EXYNOS_SCALER), + DRM_COMPONENT_DRIVER + }, { DRV_PTR(gsc_driver, CONFIG_DRM_EXYNOS_GSC), DRM_COMPONENT_DRIVER }, { diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 8b3b31d35168..8dc8537f4fd1 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -293,6 +293,7 @@ int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, extern struct platform_driver g2d_driver; extern struct platform_driver fimc_driver; extern struct platform_driver rotator_driver; +extern struct platform_driver scaler_driver; extern struct platform_driver gsc_driver; extern struct platform_driver mic_driver; #endif diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.h b/drivers/gpu/drm/exynos/exynos_drm_ipp.h index 9085b7699609..199eb2006410 100644 --- a/drivers/gpu/drm/exynos/exynos_
[PATCH v2 6/9] drm/exynos: fimc: Convert driver to IPP v2 core API
This patch adapts Exynos DRM rotator driver to new IPP v2 core API. The side effect of this conversion is a switch to driver component API to register properly in the Exynos DRM core. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/Kconfig | 3 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 + drivers/gpu/drm/exynos/exynos_drm_fimc.c | 893 +-- drivers/gpu/drm/exynos/exynos_drm_fimc.h | 23 - 4 files changed, 250 insertions(+), 670 deletions(-) delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.h diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 4bb9edb00601..4a4582202e60 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -99,7 +99,8 @@ config DRM_EXYNOS_IPP config DRM_EXYNOS_FIMC bool "FIMC" - depends on BROKEN && MFD_SYSCON + depends on MFD_SYSCON + select DRM_EXYNOS_IPP help Choose this option if you want to use Exynos FIMC for DRM. diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 60ae6ae06eb2..4afeffa024f3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -256,6 +256,7 @@ struct exynos_drm_driver_info { DRV_PTR(g2d_driver, CONFIG_DRM_EXYNOS_G2D), }, { DRV_PTR(fimc_driver, CONFIG_DRM_EXYNOS_FIMC), + DRM_COMPONENT_DRIVER | DRM_SHARED_DEVICE, }, { DRV_PTR(rotator_driver, CONFIG_DRM_EXYNOS_ROTATOR), DRM_COMPONENT_DRIVER diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 5b18b5c5fdf2..f38268bb8148 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c @@ -12,6 +12,7 @@ * */ #include +#include #include #include #include @@ -24,8 +25,9 @@ #include #include "regs-fimc.h" #include "exynos_drm_drv.h" +#include "exynos_drm_iommu.h" #include "exynos_drm_ipp.h" -#include "exynos_drm_fimc.h" + /* * FIMC stands for Fully Interactive Mobile Camera and @@ -33,23 +35,6 @@ * input DMA reads image data from the memory. * output DMA writes image data to memory. * FIMC supports image rotation and image effect functions. - * - * M2M operation : supports crop/scale/rotation/csc so on. - * Memory > FIMC H/W > Memory. - * Writeback operation : supports cloned screen with FIMD. - * FIMD > FIMC H/W > Memory. - * Output operation : supports direct display using local path. - * Memory > FIMC H/W > FIMD. - */ - -/* - * TODO - * 1. check suspend/resume api if needed. - * 2. need to check use case platform_device_id. - * 3. check src/dst size with, height. - * 4. added check_prepare api for right register. - * 5. need to add supported list in prop_list. - * 6. check prescaler/scaler optimization. */ #define FIMC_MAX_DEVS 4 @@ -59,29 +44,18 @@ #define FIMC_BUF_STOP 1 #define FIMC_BUF_START 2 #define FIMC_WIDTH_ITU_709 1280 -#define FIMC_REFRESH_MAX 60 -#define FIMC_REFRESH_MIN 12 #define FIMC_CROP_MAX 8192 #define FIMC_CROP_MIN 32 #define FIMC_SCALE_MAX 4224 #define FIMC_SCALE_MIN 32 #define get_fimc_context(dev) platform_get_drvdata(to_platform_device(dev)) -#define get_ctx_from_ippdrv(ippdrv)container_of(ippdrv,\ - struct fimc_context, ippdrv); -enum fimc_wb { - FIMC_WB_NONE, - FIMC_WB_A, - FIMC_WB_B, -}; enum { FIMC_CLK_LCLK, FIMC_CLK_GATE, FIMC_CLK_WB_A, FIMC_CLK_WB_B, - FIMC_CLK_MUX, - FIMC_CLK_PARENT, FIMC_CLKS_MAX }; @@ -90,8 +64,6 @@ enum { [FIMC_CLK_GATE] = "fimc", [FIMC_CLK_WB_A] = "pxl_async0", [FIMC_CLK_WB_B] = "pxl_async1", - [FIMC_CLK_MUX]= "mux", - [FIMC_CLK_PARENT] = "parent", }; #define FIMC_DEFAULT_LCLK_FREQUENCY 13300UL @@ -141,13 +113,10 @@ struct fimc_capability { /* * A structure of fimc context. * - * @ippdrv: prepare initialization using ippdrv. * @regs_res: register resources. * @regs: memory mapped io registers. * @lock: locking of operations. * @clocks: fimc clocks. - * @clk_frequency: LCLK clock frequency. - * @sysreg: handle to SYSREG block regmap. * @sc: scaler infomations. * @pol: porarity of writeback. * @id: fimc id. @@ -155,13 +124,15 @@ struct fimc_capability { * @suspended: qos operations. */ struct fimc_context { - struct exynos_drm_ippdrvippdrv; + struct exynos_drm_ipp ipp; + struct drm_device *drm_dev; + struct device *dev; + struct exynos_drm_ipp_task *task; + struct resource *regs_res; void __iomem*regs; spinlock_t lock; struct clk *clocks[FIMC_CLKS_MAX]; - u32 clk_frequency; - struct regmap *sysreg; struct fimc_scaler
[PATCH v2 8/9] drivers: clk: samsung: Fix m2m scaler clock on Exynos542x
From: Andrzej Pietrasiewicz TOP "aclk400_mscl" clock should be kept enabled all the time to allow proper access to power management control for MSC power domain and devices that are a part of it. This change is required for scaler to work properly after domain power on/off sequence. Fixes: 318fa46cc60d ("clk/samsung: exynos542x: mark some clocks as critical") Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Marek Szyprowski --- drivers/clk/samsung/clk-exynos5420.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 25601967d1cd..038701a2af4c 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -998,7 +998,7 @@ static void __init exynos5420_clk_sleep_init(void) {} GATE(0, "aclk400_isp", "mout_user_aclk400_isp", GATE_BUS_TOP, 16, 0, 0), GATE(0, "aclk400_mscl", "mout_user_aclk400_mscl", - GATE_BUS_TOP, 17, 0, 0), + GATE_BUS_TOP, 17, CLK_IS_CRITICAL, 0), GATE(0, "aclk200_disp1", "mout_user_aclk200_disp1", GATE_BUS_TOP, 18, CLK_IS_CRITICAL, 0), GATE(CLK_SCLK_MPHY_IXTAL24, "sclk_mphy_ixtal24", "mphy_refclk_ixtal24", -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 4/9] drm/exynos: gsc: Convert driver to IPP v2 core API
This patch adapts Exynos DRM rotator driver to new IPP v2 core API. The side effect of this conversion is a switch to driver component API to register properly in the Exynos DRM core. Signed-off-by: Marek Szyprowski Tested-by: Hoegeun Kwon --- drivers/gpu/drm/exynos/Kconfig | 3 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 + drivers/gpu/drm/exynos/exynos_drm_gsc.c | 853 drivers/gpu/drm/exynos/exynos_drm_gsc.h | 24 - 4 files changed, 198 insertions(+), 683 deletions(-) delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_gsc.h diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index c10c9ca0d8b4..4bb9edb00601 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -111,7 +111,8 @@ config DRM_EXYNOS_ROTATOR config DRM_EXYNOS_GSC bool "GScaler" - depends on BROKEN && ARCH_EXYNOS5 && VIDEO_SAMSUNG_EXYNOS_GSC=n + depends on ARCH_EXYNOS5 && VIDEO_SAMSUNG_EXYNOS_GSC=n + select DRM_EXYNOS_IPP help Choose this option if you want to use Exynos GSC for DRM. diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 3ade2b0ad15d..cac0d84385d3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -260,6 +260,7 @@ struct exynos_drm_driver_info { DRM_COMPONENT_DRIVER }, { DRV_PTR(gsc_driver, CONFIG_DRM_EXYNOS_GSC), + DRM_COMPONENT_DRIVER }, { &exynos_drm_platform_driver, DRM_VIRTUAL_DEVICE diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 0506b2b17ac1..1293441a4212 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c @@ -12,6 +12,7 @@ * */ #include +#include #include #include #include @@ -22,8 +23,8 @@ #include #include "regs-gsc.h" #include "exynos_drm_drv.h" +#include "exynos_drm_iommu.h" #include "exynos_drm_ipp.h" -#include "exynos_drm_gsc.h" /* * GSC stands for General SCaler and @@ -31,26 +32,9 @@ * input DMA reads image data from the memory. * output DMA writes image data to memory. * GSC supports image rotation and image effect functions. - * - * M2M operation : supports crop/scale/rotation/csc so on. - * Memory > GSC H/W > Memory. - * Writeback operation : supports cloned screen with FIMD. - * FIMD > GSC H/W > Memory. - * Output operation : supports direct display using local path. - * Memory > GSC H/W > FIMD, Mixer. */ -/* - * TODO - * 1. check suspend/resume api if needed. - * 2. need to check use case platform_device_id. - * 3. check src/dst size with, height. - * 4. added check_prepare api for right register. - * 5. need to add supported list in prop_list. - * 6. check prescaler/scaler optimization. - */ -#define GSC_MAX_DEVS 4 #define GSC_MAX_SRC4 #define GSC_MAX_DST16 #define GSC_RESET_TIMEOUT 50 @@ -65,8 +49,6 @@ #define GSC_SC_DOWN_RATIO_4_8 131072 #define GSC_SC_DOWN_RATIO_3_8 174762 #define GSC_SC_DOWN_RATIO_2_8 262144 -#define GSC_REFRESH_MIN12 -#define GSC_REFRESH_MAX60 #define GSC_CROP_MAX 8192 #define GSC_CROP_MIN 32 #define GSC_SCALE_MAX 4224 @@ -79,8 +61,6 @@ #define GSC_COEF_DEPTH 3 #define get_gsc_context(dev) platform_get_drvdata(to_platform_device(dev)) -#define get_ctx_from_ippdrv(ippdrv)container_of(ippdrv,\ - struct gsc_context, ippdrv); #define gsc_read(offset) readl(ctx->regs + (offset)) #define gsc_write(cfg, offset) writel(cfg, ctx->regs + (offset)) @@ -124,7 +104,6 @@ struct gsc_capability { /* * A structure of gsc context. * - * @ippdrv: prepare initialization using ippdrv. * @regs_res: register resources. * @regs: memory mapped io registers. * @sysreg: handle to SYSREG block regmap. @@ -137,11 +116,14 @@ struct gsc_capability { * @suspended: qos operations. */ struct gsc_context { - struct exynos_drm_ippdrvippdrv; + struct exynos_drm_ipp ipp; + struct drm_device *drm_dev; + struct device *dev; + struct exynos_drm_ipp_task *task; + struct resource *regs_res; void __iomem*regs; struct regmap *sysreg; - struct mutexlock; struct clk *gsc_clk; struct gsc_scaler sc; int id; @@ -438,25 +420,6 @@ static int gsc_sw_reset(struct gsc_context *ctx) return 0; } -static void gsc_set_gscblk_fimd_wb(struct gsc_context *ctx, bool enable) -{ - unsigned int gscblk_cfg; - - if (!ctx->sysreg) - return; - - regmap_read(ctx->sysreg, SYSREG_GSCBLK_CFG1, &gscblk_cfg); - - if (enable) - gscblk_cfg |= GSC_BLK_DISP1WB_DEST(ctx->id) | - G
[PATCH v2 1/9] drm/exynos: ipp: Remove Exynos DRM IPP subsystem
Exynos IPP will be rewritten, so remove current IPP core code and mark existing drivers as BROKEN. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/Kconfig | 11 +- drivers/gpu/drm/exynos/Makefile |1 - drivers/gpu/drm/exynos/exynos_drm_drv.c | 12 - drivers/gpu/drm/exynos/exynos_drm_drv.h |2 - drivers/gpu/drm/exynos/exynos_drm_ipp.c | 1806 --- drivers/gpu/drm/exynos/exynos_drm_ipp.h | 252 - include/uapi/drm/exynos_drm.h | 192 +--- 7 files changed, 4 insertions(+), 2272 deletions(-) delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.c delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.h diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 305dc3d4ff77..88cff0e039b6 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -94,26 +94,21 @@ config DRM_EXYNOS_G2D help Choose this option if you want to use Exynos G2D for DRM. -config DRM_EXYNOS_IPP - bool "Image Post Processor" - help - Choose this option if you want to use IPP feature for DRM. - config DRM_EXYNOS_FIMC bool "FIMC" - depends on DRM_EXYNOS_IPP && MFD_SYSCON + depends on BROKEN && MFD_SYSCON help Choose this option if you want to use Exynos FIMC for DRM. config DRM_EXYNOS_ROTATOR bool "Rotator" - depends on DRM_EXYNOS_IPP + depends on BROKEN help Choose this option if you want to use Exynos Rotator for DRM. config DRM_EXYNOS_GSC bool "GScaler" - depends on DRM_EXYNOS_IPP && ARCH_EXYNOS5 && VIDEO_SAMSUNG_EXYNOS_GSC=n + depends on BROKEN && ARCH_EXYNOS5 && VIDEO_SAMSUNG_EXYNOS_GSC=n help Choose this option if you want to use Exynos GSC for DRM. diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile index f663490e949d..09bb002c9555 100644 --- a/drivers/gpu/drm/exynos/Makefile +++ b/drivers/gpu/drm/exynos/Makefile @@ -17,7 +17,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_MIXER) += exynos_mixer.o exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI)+= exynos_hdmi.o exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI)+= exynos_drm_vidi.o exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o -exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMC)+= exynos_drm_fimc.o exynosdrm-$(CONFIG_DRM_EXYNOS_ROTATOR) += exynos_drm_rotator.o exynosdrm-$(CONFIG_DRM_EXYNOS_GSC) += exynos_drm_gsc.o diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index e651a58c18cf..2fc5d3c01390 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -28,7 +28,6 @@ #include "exynos_drm_plane.h" #include "exynos_drm_vidi.h" #include "exynos_drm_g2d.h" -#include "exynos_drm_ipp.h" #include "exynos_drm_iommu.h" #define DRIVER_NAME"exynos" @@ -115,14 +114,6 @@ static void exynos_drm_lastclose(struct drm_device *dev) DRM_AUTH | DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(EXYNOS_G2D_EXEC, exynos_g2d_exec_ioctl, DRM_AUTH | DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(EXYNOS_IPP_GET_PROPERTY, exynos_drm_ipp_get_property, - DRM_AUTH | DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(EXYNOS_IPP_SET_PROPERTY, exynos_drm_ipp_set_property, - DRM_AUTH | DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(EXYNOS_IPP_QUEUE_BUF, exynos_drm_ipp_queue_buf, - DRM_AUTH | DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(EXYNOS_IPP_CMD_CTRL, exynos_drm_ipp_cmd_ctrl, - DRM_AUTH | DRM_RENDER_ALLOW), }; static const struct file_operations exynos_drm_driver_fops = { @@ -260,9 +251,6 @@ struct exynos_drm_driver_info { }, { DRV_PTR(gsc_driver, CONFIG_DRM_EXYNOS_GSC), }, { - DRV_PTR(ipp_driver, CONFIG_DRM_EXYNOS_IPP), - DRM_VIRTUAL_DEVICE - }, { &exynos_drm_platform_driver, DRM_VIRTUAL_DEVICE } diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index f8bae4cb4823..b47f810d64d2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -185,7 +185,6 @@ struct exynos_drm_g2d_private { struct drm_exynos_file_private { struct exynos_drm_g2d_private *g2d_priv; - struct device *ipp_dev; }; /* @@ -293,6 +292,5 @@ int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, extern struct platform_driver fimc_driver; extern struct platform_driver rotator_driver; extern struct platform_driver gsc_driver; -extern struct platform_driver ipp_driver; extern struct platform_driver mic_driver; #endif diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_d
[PATCH v2 5/9] drm/exynos: Add generic support for devices shared with V4L2 subsystem
Some hardware modules, like FIMC in Exynos4 series are shared between V4L2 (camera support) and DRM (memory-to-memory processing) subsystems. This patch provides a simple check to let such drivers to be used in the driver components framework. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 17 - drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index cac0d84385d3..60ae6ae06eb2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -216,6 +216,7 @@ struct exynos_drm_driver_info { #define DRM_COMPONENT_DRIVER BIT(0) /* supports component framework */ #define DRM_VIRTUAL_DEVICE BIT(1) /* create virtual platform device */ #define DRM_DMA_DEVICE BIT(2) /* can be used for dma allocations */ +#define DRM_SHARED_DEVICE BIT(3) /* devices shared with V4L2 subsystem */ #define DRV_PTR(drv, cond) (IS_ENABLED(cond) ? &drv : NULL) @@ -267,6 +268,17 @@ struct exynos_drm_driver_info { } }; +int exynos_drm_check_shared_device(struct device *dev) +{ + /* +* Exynos DRM drivers handle only devices that support +* the LCD Writeback data path, rest is handled by V4L2 driver +*/ + if (!of_property_read_bool(dev->of_node, "samsung,lcd-wb")) + return -ENODEV; + return 0; +} + static int compare_dev(struct device *dev, void *data) { return dev == (struct device *)data; @@ -288,7 +300,10 @@ static struct component_match *exynos_drm_match_add(struct device *dev) &info->driver->driver, (void *)platform_bus_type.match))) { put_device(p); - component_match_add(dev, &match, compare_dev, d); + + if (!(info->flags & DRM_SHARED_DEVICE) || + exynos_drm_check_shared_device(d) == 0) + component_match_add(dev, &match, compare_dev, d); p = d; } put_device(p); diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index b47f810d64d2..8b3b31d35168 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -275,6 +275,8 @@ static inline int exynos_dpi_bind(struct drm_device *dev, } #endif +int exynos_drm_check_shared_device(struct device *dev); + int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, bool nonblock); int exynos_atomic_check(struct drm_device *dev, struct drm_atomic_state *state); -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 00/14] drm/sun4i: hdmi: Support HDMI controller on A31
Hi everyone, This is v3 of my A31 HDMI support series. Changes since v2: - TCON muxing moved into functions for each platform, with pointers to them in the TCON quirks structure. - CCU "hdmi-ddc" clock renamed to "ddc". - Added Maxime's acks. Changes since v1: - Core changes to sun4i-drm to support two display pipelines have been merged into drm-misc and thus dropped from this version - Reworked DDC variant support onto new exposed I2C interface bits. - Reworked DDC variant support to use regmap_fields. - Patches to add variant support to various (TMDS, DDC, HDMI controller) sub-blocks have been merged into one patch. This series adds support for the HDMI controller found on Allwinner A31/A31s SoCs. It builds upon Maxime's work that added support for the HDMI controller on the Allwinner A10s SoC. The HDMI controllers in the older generation Allwinner SoCs is very similar. The A10/A10s/A20 all have the same hardware block, with the A10 having slightly different initial configuration values. The A31's variant splits out the DDC parent clock, has different formulas for the DDC and TMDS clocks, and a different register layout for the DDC block. Also, it does not expose the CEC pins outside of the SoC, which is unfortunate. Patch 1 exports the 2x outputs of the two video PLLs. These feed the TMDS clock directly. Patch 2 renames the A31 CCU's DDC clock, so that it doesn't conflict with the DDC clock in the HDMI block. Patch 3 moves the existing TCON muxing code for the A13 into a separate function, pointed to by by function pointer in the quirks structure. The existing sun4i_tcon_set_mux() function calls the function pointer if it is set. Patch 4 adds support for the TCON demuxing feature on the A31. This is needed if the user wants to output through HDMI from the second display pipeline. Patch 5 adds proper error path cleanup to the HDMI driver. Patch 6 adds a regmap for the HDMI driver, to be used in a subsequent patch. Patch 7 allows the HDMI TMDS clock to use the second PLL as its parent, in case the first PLL is driving an incompatible dot clock. Patch 8 adds the A31 HDMI controller variant to the device tree binding. Patch 9 adds an iopoll-like polling macro for regmap_field. This is used in the next patch within the DDC part to poll for reset and I/O completion. Patch 10 adds support for different variants of the HDMI controller hardware, with the differences mentioned in the beginning of this letter. Patch 11 adds defines for the A31 specific DDC register offsets. Patch 12 adds support for the A31's HDMI controller variant. Patch 13 adds a device node for the HDMI controller on the A31. Patch 14 enable HDMI video output on three boards that I have. I also had simultaneous output on both display pipelines on the SinA31s, one with an LCD panel and the other using HDMI. After boot, both screens showed a proper console. The HDMI screen had higher resolution, so the console was limited to the upper left corner. Note that this series does not deal with conflicting pixel clocks. Assuming everyone is happy with the patches, I propose the following: 1. We sunxi maintainers will take the clk and dts patches through our tree with minimal but proper cross references. 2. Mark can either take the regmap patch on an immutable branch, which we then merge into drm-misc before applying the drm/sun4i patches, or give his Ack for us to merge that patch through drm-misc. As I still don't have a freedesktop.org account [1] to access drm-misc, Maxime will have to apply the patches for me. Regards ChenYu [1] https://bugs.freedesktop.org/show_bug.cgi?id=102920 Chen-Yu Tsai (14): clk: sunxi-ng: sun6i: Export video PLLs clk: sunxi-ng: sun6i: Rename HDMI DDC clock to avoid name collision drm/sun4i: tcon: Add variant callback for TCON output muxing drm/sun4i: tcon: Add support for demuxing TCON output on A31 drm/sun4i: hdmi: Disable clks in bind function error path and unbind function drm/sun4i: hdmi: create a regmap for later use drm/sun4i: hdmi: Allow using second PLL as TMDS clk parent dt-bindings: display: sun4i: Add binding for A31 HDMI controller regmap: add iopoll-like polling macro for regmap_field drm/sun4i: hdmi: Add support for controller hardware variants drm/sun4i: hdmi: Add A31 specific DDC register definitions drm/sun4i: hdmi: Add support for A31's HDMI controller ARM: dts: sun6i: Add device node for HDMI controller ARM: dts: sun6i: Enable HDMI support on some A31/A31s devices .../bindings/display/sunxi/sun4i-drm.txt | 3 + arch/arm/boot/dts/sun6i-a31-hummingbird.dts| 21 ++ arch/arm/boot/dts/sun6i-a31.dtsi | 55 + arch/arm/boot/dts/sun6i-a31s-primo81.dts | 25 +++ arch/arm/boot/dts/sun6i-a31s-sina31s.dts | 25 +++ drivers/clk/sunxi-ng/ccu-sun6i-a31.c | 2 +- drivers/clk/sunxi-ng/
[PATCH v3 11/14] drm/sun4i: hdmi: Add A31 specific DDC register definitions
The DDC block for the HDMI controller is different on the A31. This patch adds the register definitions. Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_hdmi.h | 31 +++ 1 file changed, 31 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h b/drivers/gpu/drm/sun4i/sun4i_hdmi.h index b1124a8f9f05..da4ea9efc6fa 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h @@ -153,6 +153,37 @@ #define SUN4I_HDMI_DDC_FIFO_SIZE 16 +/* A31 specific */ +#define SUN6I_HDMI_DDC_CTRL_REG0x500 +#define SUN6I_HDMI_DDC_CTRL_RESET BIT(31) +#define SUN6I_HDMI_DDC_CTRL_START_CMD BIT(27) +#define SUN6I_HDMI_DDC_CTRL_SDA_ENABLE BIT(6) +#define SUN6I_HDMI_DDC_CTRL_SCL_ENABLE BIT(4) +#define SUN6I_HDMI_DDC_CTRL_ENABLE BIT(0) + +#define SUN6I_HDMI_DDC_CMD_REG 0x508 +#define SUN6I_HDMI_DDC_CMD_BYTE_COUNT(count) ((count) << 16) +/* command types in lower 3 bits are the same as sun4i */ + +#define SUN6I_HDMI_DDC_ADDR_REG0x50c +#define SUN6I_HDMI_DDC_ADDR_SEGMENT(seg) (((seg) & 0xff) << 24) +#define SUN6I_HDMI_DDC_ADDR_EDDC(addr) (((addr) & 0xff) << 16) +#define SUN6I_HDMI_DDC_ADDR_OFFSET(off)(((off) & 0xff) << 8) +#define SUN6I_HDMI_DDC_ADDR_SLAVE(addr)(((addr) & 0xff) << 1) + +#define SUN6I_HDMI_DDC_INT_STATUS_REG 0x514 +#define SUN6I_HDMI_DDC_INT_STATUS_TIMEOUT BIT(8) +/* lower 8 bits are the same as sun4i */ + +#define SUN6I_HDMI_DDC_FIFO_CTRL_REG 0x518 +#define SUN6I_HDMI_DDC_FIFO_CTRL_CLEAR BIT(15) +/* lower 9 bits are the same as sun4i */ + +#define SUN6I_HDMI_DDC_CLK_REG 0x520 +/* DDC CLK bit fields are the same, but the formula is not */ + +#define SUN6I_HDMI_DDC_FIFO_DATA_REG 0x580 + enum sun4i_hdmi_pkt_type { SUN4I_HDMI_PKT_AVI = 2, SUN4I_HDMI_PKT_END = 15, -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 14/14] ARM: dts: sun6i: Enable HDMI support on some A31/A31s devices
All the A31/A31s devices I own have some kind of HDMI connector wired to the dedicated HDMI pins on the SoC: - A31 Hummingbird (standard HDMI connector, display already enabled) - Sinlinx SinA31s (standard HDMI connector) - MSI Primo81 tablet (micro HDMI connector) Enable the display pipeline (if needed) and HDMI output for them. Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun6i-a31-hummingbird.dts | 21 + arch/arm/boot/dts/sun6i-a31s-primo81.dts| 25 + arch/arm/boot/dts/sun6i-a31s-sina31s.dts| 25 + 3 files changed, 71 insertions(+) diff --git a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts index 9ecb5f0b3f83..19e382a11297 100644 --- a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts +++ b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts @@ -62,6 +62,17 @@ stdout-path = "serial0:115200n8"; }; + hdmi-connector { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + vga-connector { compatible = "vga-connector"; @@ -162,6 +173,16 @@ }; }; +&hdmi { + status = "okay"; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + &i2c0 { pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; diff --git a/arch/arm/boot/dts/sun6i-a31s-primo81.dts b/arch/arm/boot/dts/sun6i-a31s-primo81.dts index 4c10123509c4..0cdb38ab3377 100644 --- a/arch/arm/boot/dts/sun6i-a31s-primo81.dts +++ b/arch/arm/boot/dts/sun6i-a31s-primo81.dts @@ -52,17 +52,42 @@ / { model = "MSI Primo81 tablet"; compatible = "msi,primo81", "allwinner,sun6i-a31s"; + + hdmi-connector { + compatible = "hdmi-connector"; + type = "c"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; }; &cpu0 { cpu-supply = <®_dcdc3>; }; +&de { + status = "okay"; +}; + &ehci0 { /* rtl8188etv wifi is connected here */ status = "okay"; }; +&hdmi { + status = "okay"; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + &i2c0 { /* pull-ups and device VDDIO use AXP221 DLDO3 */ pinctrl-names = "default"; diff --git a/arch/arm/boot/dts/sun6i-a31s-sina31s.dts b/arch/arm/boot/dts/sun6i-a31s-sina31s.dts index b3d98222bd81..298476485bb4 100644 --- a/arch/arm/boot/dts/sun6i-a31s-sina31s.dts +++ b/arch/arm/boot/dts/sun6i-a31s-sina31s.dts @@ -53,6 +53,17 @@ stdout-path = "serial0:115200n8"; }; + hdmi-connector { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + leds { compatible = "gpio-leds"; pinctrl-names = "default"; @@ -90,6 +101,10 @@ status = "okay"; }; +&de { + status = "okay"; +}; + &ehci0 { /* USB 2.0 4 port hub IC */ status = "okay"; @@ -112,6 +127,16 @@ }; }; +&hdmi { + status = "okay"; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + &ir { pinctrl-names = "default"; pinctrl-0 = <&ir_pins_a>; -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 05/14] drm/sun4i: hdmi: Disable clks in bind function error path and unbind function
The HDMI driver enables the bus and mod clocks in the bind function, but does not disable them if it then bails our due to any errors. Neither does it disable the clocks in the unbind function. Fix this by adding a proper error path to the bind function, and clk_disable_unprepare calls to the unbind function. Also rename the err_cleanup_connector label to err_cleanup_encoder, since it is the encoder that gets cleaned up. Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support") Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 9ea6cd5a1370..3cf1a6932fac 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -302,26 +302,29 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, hdmi->mod_clk = devm_clk_get(dev, "mod"); if (IS_ERR(hdmi->mod_clk)) { dev_err(dev, "Couldn't get the HDMI mod clock\n"); - return PTR_ERR(hdmi->mod_clk); + ret = PTR_ERR(hdmi->mod_clk); + goto err_disable_bus_clk; } clk_prepare_enable(hdmi->mod_clk); hdmi->pll0_clk = devm_clk_get(dev, "pll-0"); if (IS_ERR(hdmi->pll0_clk)) { dev_err(dev, "Couldn't get the HDMI PLL 0 clock\n"); - return PTR_ERR(hdmi->pll0_clk); + ret = PTR_ERR(hdmi->pll0_clk); + goto err_disable_mod_clk; } hdmi->pll1_clk = devm_clk_get(dev, "pll-1"); if (IS_ERR(hdmi->pll1_clk)) { dev_err(dev, "Couldn't get the HDMI PLL 1 clock\n"); - return PTR_ERR(hdmi->pll1_clk); + ret = PTR_ERR(hdmi->pll1_clk); + goto err_disable_mod_clk; } ret = sun4i_tmds_create(hdmi); if (ret) { dev_err(dev, "Couldn't create the TMDS clock\n"); - return ret; + goto err_disable_mod_clk; } writel(SUN4I_HDMI_CTRL_ENABLE, hdmi->base + SUN4I_HDMI_CTRL_REG); @@ -362,7 +365,7 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, ret = sun4i_hdmi_i2c_create(dev, hdmi); if (ret) { dev_err(dev, "Couldn't create the HDMI I2C adapter\n"); - return ret; + goto err_disable_mod_clk; } drm_encoder_helper_add(&hdmi->encoder, @@ -422,6 +425,10 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, drm_encoder_cleanup(&hdmi->encoder); err_del_i2c_adapter: i2c_del_adapter(hdmi->i2c); +err_disable_mod_clk: + clk_disable_unprepare(hdmi->mod_clk); +err_disable_bus_clk: + clk_disable_unprepare(hdmi->bus_clk); return ret; } @@ -434,6 +441,8 @@ static void sun4i_hdmi_unbind(struct device *dev, struct device *master, drm_connector_cleanup(&hdmi->connector); drm_encoder_cleanup(&hdmi->encoder); i2c_del_adapter(hdmi->i2c); + clk_disable_unprepare(hdmi->mod_clk); + clk_disable_unprepare(hdmi->bus_clk); } static const struct component_ops sun4i_hdmi_ops = { -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 12/14] drm/sun4i: hdmi: Add support for A31's HDMI controller
The HDMI controller found in the A31 SoCs is slightly different from the one already supported, which is found in the A10s: - Need different initial values for the PLL related registers - Different behavior of the DDC and TMDS clocks - Different register layout for the DDC portion - Separate DDC parent clock This patch adds support for it. Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_hdmi.h | 3 ++ drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 58 ++ 2 files changed, 61 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h b/drivers/gpu/drm/sun4i/sun4i_hdmi.h index da4ea9efc6fa..186624de9b60 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h @@ -59,10 +59,13 @@ #define SUN4I_HDMI_PAD_CTRL0_TXEN BIT(23) #define SUN4I_HDMI_PAD_CTRL1_REG 0x204 +#define SUN4I_HDMI_PAD_CTRL1_UNKNOWN BIT(24) /* set on A31 */ #define SUN4I_HDMI_PAD_CTRL1_AMP_OPT BIT(23) #define SUN4I_HDMI_PAD_CTRL1_AMPCK_OPT BIT(22) #define SUN4I_HDMI_PAD_CTRL1_EMP_OPT BIT(20) #define SUN4I_HDMI_PAD_CTRL1_EMPCK_OPT BIT(19) +#define SUN4I_HDMI_PAD_CTRL1_PWSCK BIT(18) +#define SUN4I_HDMI_PAD_CTRL1_PWSDT BIT(17) #define SUN4I_HDMI_PAD_CTRL1_REG_DEN BIT(15) #define SUN4I_HDMI_PAD_CTRL1_REG_DENCK BIT(14) #define SUN4I_HDMI_PAD_CTRL1_REG_EMP(n)(((n) & 7) << 10) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 114cbe60b3e6..027b5608dbe6 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -324,6 +324,63 @@ static const struct sun4i_hdmi_variant sun5i_variant = { .ddc_fifo_has_dir = true, }; +static const struct sun4i_hdmi_variant sun6i_variant = { + .has_ddc_parent_clk = true, + .has_reset_control = true, + .pad_ctrl0_init_val = 0xff | + SUN4I_HDMI_PAD_CTRL0_TXEN | + SUN4I_HDMI_PAD_CTRL0_CKEN | + SUN4I_HDMI_PAD_CTRL0_PWENG | + SUN4I_HDMI_PAD_CTRL0_PWEND | + SUN4I_HDMI_PAD_CTRL0_PWENC | + SUN4I_HDMI_PAD_CTRL0_LDODEN | + SUN4I_HDMI_PAD_CTRL0_LDOCEN, + .pad_ctrl1_init_val = SUN4I_HDMI_PAD_CTRL1_REG_AMP(6) | + SUN4I_HDMI_PAD_CTRL1_REG_EMP(4) | + SUN4I_HDMI_PAD_CTRL1_REG_DENCK | + SUN4I_HDMI_PAD_CTRL1_REG_DEN | + SUN4I_HDMI_PAD_CTRL1_EMPCK_OPT | + SUN4I_HDMI_PAD_CTRL1_EMP_OPT | + SUN4I_HDMI_PAD_CTRL1_PWSDT | + SUN4I_HDMI_PAD_CTRL1_PWSCK | + SUN4I_HDMI_PAD_CTRL1_AMPCK_OPT | + SUN4I_HDMI_PAD_CTRL1_AMP_OPT | + SUN4I_HDMI_PAD_CTRL1_UNKNOWN, + .pll_ctrl_init_val = SUN4I_HDMI_PLL_CTRL_VCO_S(8) | + SUN4I_HDMI_PLL_CTRL_CS(3) | + SUN4I_HDMI_PLL_CTRL_CP_S(10) | + SUN4I_HDMI_PLL_CTRL_S(4) | + SUN4I_HDMI_PLL_CTRL_VCO_GAIN(4) | + SUN4I_HDMI_PLL_CTRL_SDIV2 | + SUN4I_HDMI_PLL_CTRL_LDO2_EN | + SUN4I_HDMI_PLL_CTRL_LDO1_EN | + SUN4I_HDMI_PLL_CTRL_HV_IS_33 | + SUN4I_HDMI_PLL_CTRL_PLL_EN, + + .ddc_clk_reg= REG_FIELD(SUN6I_HDMI_DDC_CLK_REG, 0, 6), + .ddc_clk_pre_divider= 1, + .ddc_clk_m_offset = 2, + + .tmds_clk_div_offset= 1, + + .field_ddc_en = REG_FIELD(SUN6I_HDMI_DDC_CTRL_REG, 0, 0), + .field_ddc_start= REG_FIELD(SUN6I_HDMI_DDC_CTRL_REG, 27, 27), + .field_ddc_reset= REG_FIELD(SUN6I_HDMI_DDC_CTRL_REG, 31, 31), + .field_ddc_addr_reg = REG_FIELD(SUN6I_HDMI_DDC_ADDR_REG, 1, 31), + .field_ddc_slave_addr = REG_FIELD(SUN6I_HDMI_DDC_ADDR_REG, 1, 7), + .field_ddc_int_status = REG_FIELD(SUN6I_HDMI_DDC_INT_STATUS_REG, 0, 8), + .field_ddc_fifo_clear = REG_FIELD(SUN6I_HDMI_DDC_FIFO_CTRL_REG, 18, 18), + .field_ddc_fifo_rx_thres = REG_FIELD(SUN6I_HDMI_DDC_FIFO_CTRL_REG, 4, 7), + .field_ddc_fifo_tx_thres = REG_FIELD(SUN6I_HDMI_DDC_FIFO_CTRL_REG, 0, 3), + .field_ddc_byte_count = REG_FIELD(SUN6I_HDMI_DDC_CMD_REG, 16, 25), + .field_ddc_cmd = REG_FIELD(SUN6I_HDMI_DDC_CMD_REG, 0, 2), + .field_ddc_sda_en = REG_FIELD(SUN6I_HDMI_DDC_CTRL_REG, 6, 6), + .field_ddc_sck_en
[PATCH v3 08/14] dt-bindings: display: sun4i: Add binding for A31 HDMI controller
The HDMI controller in the A31 SoC is slightly different from the earlier version. In addition to the TMDS clock and DDC controls, this version now takes a second DDC clock input. Add a compatible string for it, and add the DDC clock input to the list of clocks required. Signed-off-by: Chen-Yu Tsai Acked-by: Rob Herring --- Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt index 92441086caba..46df3b78ae9e 100644 --- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt +++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt @@ -41,14 +41,17 @@ CEC. It is one end of the pipeline. Required properties: - compatible: value must be one of: * allwinner,sun5i-a10s-hdmi +* allwinner,sun6i-a31-hdmi - reg: base address and size of memory-mapped region - interrupts: interrupt associated to this IP - clocks: phandles to the clocks feeding the HDMI encoder * ahb: the HDMI interface clock * mod: the HDMI module clock +* ddc: the HDMI ddc clock (A31 only) * pll-0: the first video PLL * pll-1: the second video PLL - clock-names: the clock names mentioned above + - resets: phandle to the reset control for the HDMI encoder (A31 only) - dmas: phandles to the DMA channels used by the HDMI encoder * ddc-tx: The channel for DDC transmission * ddc-rx: The channel for DDC reception -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 04/14] drm/sun4i: tcon: Add support for demuxing TCON output on A31
On systems with 2 TCONs such as the A31, it is possible to demux the output of the TCONs to one encoder. Add support for this for the A31. Signed-off-by: Chen-Yu Tsai --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 38 ++ 1 file changed, 38 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 7bf51abaee97..c949309d4285 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -112,6 +112,21 @@ void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable) } EXPORT_SYMBOL(sun4i_tcon_enable_vblank); +static struct sun4i_tcon *sun4i_get_first_tcon(struct drm_device *drm) +{ + struct sun4i_drv *drv = drm->dev_private; + struct sun4i_tcon *tcon; + + list_for_each_entry(tcon, &drv->tcon_list, list) + if (tcon->id == 0) + return tcon; + + dev_warn(drm->dev, +"TCON0 not found, display output muxing may not work\n"); + + return tcon; +} + void sun4i_tcon_set_mux(struct sun4i_tcon *tcon, int channel, struct drm_encoder *encoder) { @@ -777,6 +792,28 @@ static int sun5i_a13_tcon_set_mux(struct sun4i_tcon *tcon, return regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, val); } +static int sun6i_tcon_set_mux(struct sun4i_tcon *tcon, + struct drm_encoder *encoder) +{ + struct sun4i_tcon *tcon0 = sun4i_get_first_tcon(encoder->dev); + u32 shift; + + switch (encoder->encoder_type) { + case DRM_MODE_ENCODER_TMDS: + /* HDMI */ + shift = 8; + break; + default: + /* TODO A31 has MIPI DSI but A31s does not */ + return -EINVAL; + } + + regmap_update_bits(tcon0->regs, SUN4I_TCON_MUX_CTRL_REG, + 0x3 << shift, tcon->id << shift); + + return 0; +} + static const struct sun4i_tcon_quirks sun5i_a13_quirks = { .has_unknown_mux= true, .has_channel_1 = true, @@ -786,6 +823,7 @@ static const struct sun4i_tcon_quirks sun5i_a13_quirks = { static const struct sun4i_tcon_quirks sun6i_a31_quirks = { .has_channel_1 = true, .needs_de_be_mux= true, + .set_mux= sun6i_tcon_set_mux, }; static const struct sun4i_tcon_quirks sun6i_a31s_quirks = { -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 02/14] clk: sunxi-ng: sun6i: Rename HDMI DDC clock to avoid name collision
The HDMI DDC clock found in the CCU is the parent of the actual DDC clock within the HDMI controller. That clock is also named "hdmi-ddc". Rename the one in the CCU to "ddc". This makes more sense than renaming the one in the HDMI controller to something else. Fixes: c6e6c96d8fa6 ("clk: sunxi-ng: Add A31/A31s clocks") Signed-off-by: Chen-Yu Tsai --- drivers/clk/sunxi-ng/ccu-sun6i-a31.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c index 8af434815fba..241fb13f1c06 100644 --- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c +++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c @@ -608,7 +608,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", lcd_ch1_parents, 0x150, 0, 4, 24, 2, BIT(31), CLK_SET_RATE_PARENT); -static SUNXI_CCU_GATE(hdmi_ddc_clk, "hdmi-ddc", "osc24M", 0x150, BIT(30), 0); +static SUNXI_CCU_GATE(hdmi_ddc_clk, "ddc", "osc24M", 0x150, BIT(30), 0); static SUNXI_CCU_GATE(ps_clk, "ps", "lcd1-ch1", 0x140, BIT(31), 0); -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 07/14] drm/sun4i: hdmi: Allow using second PLL as TMDS clk parent
On SoCs with two display pipelines, it is possible that the two pipelines are active at the same time, with potentially incompatible dot clocks. Let the HDMI encoder's TMDS clock go through all of its parents when calculating possible clock rates. This allows usage of the second video PLL as its parent. Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 53 - 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c index 5cf2527bffc8..e8d4c311b80d 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c @@ -67,11 +67,11 @@ static unsigned long sun4i_tmds_calc_divider(unsigned long rate, static int sun4i_tmds_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) { - struct clk_hw *parent; + struct clk_hw *parent = NULL; unsigned long best_parent = 0; unsigned long rate = req->rate; int best_div = 1, best_half = 1; - int i, j; + int i, j, p; /* * We only consider PLL3, since the TCON is very likely to be @@ -79,32 +79,37 @@ static int sun4i_tmds_determine_rate(struct clk_hw *hw, * clock, so we should not need to do anything. */ - parent = clk_hw_get_parent_by_index(hw, 0); - if (!parent) - return -EINVAL; - - for (i = 1; i < 3; i++) { - for (j = 1; j < 16; j++) { - unsigned long ideal = rate * i * j; - unsigned long rounded; - - rounded = clk_hw_round_rate(parent, ideal); - - if (rounded == ideal) { - best_parent = rounded; - best_half = i; - best_div = j; - goto out; - } - - if (abs(rate - rounded / i) < - abs(rate - best_parent / best_div)) { - best_parent = rounded; - best_div = i; + for (p = 0; p < clk_hw_get_num_parents(hw); p++) { + parent = clk_hw_get_parent_by_index(hw, p); + if (!parent) + continue; + + for (i = 1; i < 3; i++) { + for (j = 1; j < 16; j++) { + unsigned long ideal = rate * i * j; + unsigned long rounded; + + rounded = clk_hw_round_rate(parent, ideal); + + if (rounded == ideal) { + best_parent = rounded; + best_half = i; + best_div = j; + goto out; + } + + if (abs(rate - rounded / i) < + abs(rate - best_parent / best_div)) { + best_parent = rounded; + best_div = i; + } } } } + if (!parent) + return -EINVAL; + out: req->rate = best_parent / best_half / best_div; req->best_parent_rate = best_parent; -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 01/14] clk: sunxi-ng: sun6i: Export video PLLs
The 2x outputs of the 2 video PLL clocks are directly used by the HDMI controller block. Export them so they can be referenced in the device tree. Fixes: c6e6c96d8fa6 ("clk: sunxi-ng: Add A31/A31s clocks") Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- drivers/clk/sunxi-ng/ccu-sun6i-a31.h | 8 ++-- include/dt-bindings/clock/sun6i-a31-ccu.h | 4 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.h b/drivers/clk/sunxi-ng/ccu-sun6i-a31.h index 4e434011e9e7..27e6ad4133ab 100644 --- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.h +++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.h @@ -27,7 +27,9 @@ #define CLK_PLL_AUDIO_4X 4 #define CLK_PLL_AUDIO_8X 5 #define CLK_PLL_VIDEO0 6 -#define CLK_PLL_VIDEO0_2X 7 + +/* The PLL_VIDEO0_2X clock is exported */ + #define CLK_PLL_VE 8 #define CLK_PLL_DDR9 @@ -35,7 +37,9 @@ #define CLK_PLL_PERIPH_2X 11 #define CLK_PLL_VIDEO1 12 -#define CLK_PLL_VIDEO1_2X 13 + +/* The PLL_VIDEO1_2X clock is exported */ + #define CLK_PLL_GPU14 #define CLK_PLL_MIPI 15 #define CLK_PLL9 16 diff --git a/include/dt-bindings/clock/sun6i-a31-ccu.h b/include/dt-bindings/clock/sun6i-a31-ccu.h index 4482530fb6f5..c5d13340184a 100644 --- a/include/dt-bindings/clock/sun6i-a31-ccu.h +++ b/include/dt-bindings/clock/sun6i-a31-ccu.h @@ -43,8 +43,12 @@ #ifndef _DT_BINDINGS_CLK_SUN6I_A31_H_ #define _DT_BINDINGS_CLK_SUN6I_A31_H_ +#define CLK_PLL_VIDEO0_2X 7 + #define CLK_PLL_PERIPH 10 +#define CLK_PLL_VIDEO1_2X 13 + #define CLK_CPU18 #define CLK_AHB1_MIPIDSI 23 -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 06/14] drm/sun4i: hdmi: create a regmap for later use
The HDMI driver is written with readl/writel I/O to the registers. However, to support the A31 variant, which has a different layout for the DDC registers, it was recommended to use regfields to have a cleaner implementation. To use regfields, we need to create an underlying regmap. This patch only adds the regmap. It does not convert the existing driver accesses to use regmap. Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_hdmi.h | 1 + drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 15 +++ 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h b/drivers/gpu/drm/sun4i/sun4i_hdmi.h index 1457750988da..b95512ec8eb6 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h @@ -163,6 +163,7 @@ struct sun4i_hdmi { struct device *dev; void __iomem*base; + struct regmap *regmap; /* Parent clocks */ struct clk *bus_clk; diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 3cf1a6932fac..5ab811cda00e 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "sun4i_backend.h" #include "sun4i_crtc.h" @@ -267,6 +268,13 @@ static const struct cec_pin_ops sun4i_hdmi_cec_pin_ops = { }; #endif +static const struct regmap_config sun4i_hdmi_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + .max_register = 0x580, +}; + static int sun4i_hdmi_bind(struct device *dev, struct device *master, void *data) { @@ -321,6 +329,13 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, goto err_disable_mod_clk; } + hdmi->regmap = devm_regmap_init_mmio(dev, hdmi->base, +&sun4i_hdmi_regmap_config); + if (IS_ERR(hdmi->regmap)) { + dev_err(dev, "Couldn't create HDMI encoder regmap\n"); + return PTR_ERR(hdmi->regmap); + } + ret = sun4i_tmds_create(hdmi); if (ret) { dev_err(dev, "Couldn't create the TMDS clock\n"); -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 10/14] drm/sun4i: hdmi: Add support for controller hardware variants
The HDMI controller found in earlier Allwinner SoCs have slight differences between the A10, A10s, and the A31: - Need different initial values for the PLL related registers - Different behavior of the DDC and TMDS clocks - Different register layout for the DDC portion - Separate DDC parent clock on the A31 - Explicit reset control For the A31, the HDMI TMDS clock has a different value offset for the divider. The HDMI DDC block is different from the one in the other SoCs. As far as the DDC clock goes, it has no pre-divider, as it is clocked from a slower parent clock, not the TMDS clock. The divider offset from the register value is different. And the clock control register is at a different offset. A new variant data structure is created to store pointers to the above functions, structures, and the different initial values. Another flag notates whether there is a separate DDC parent clock. If not, the TMDS clock is passed to the DDC clock create function, as before. Regmap fields are used to deal with the different register layout of the DDC block. Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_hdmi.h | 72 + drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c | 38 +++-- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 112 +++--- drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c | 227 drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 17 ++- 5 files changed, 369 insertions(+), 97 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h b/drivers/gpu/drm/sun4i/sun4i_hdmi.h index b95512ec8eb6..b1124a8f9f05 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h @@ -14,6 +14,7 @@ #include #include +#include #include @@ -157,6 +158,55 @@ enum sun4i_hdmi_pkt_type { SUN4I_HDMI_PKT_END = 15, }; +struct sun4i_hdmi_variant { + bool has_ddc_parent_clk; + bool has_reset_control; + + u32 pad_ctrl0_init_val; + u32 pad_ctrl1_init_val; + u32 pll_ctrl_init_val; + + struct reg_field ddc_clk_reg; + u8 ddc_clk_pre_divider; + u8 ddc_clk_m_offset; + + u8 tmds_clk_div_offset; + + /* Register fields for I2C adapter */ + struct reg_fieldfield_ddc_en; + struct reg_fieldfield_ddc_start; + struct reg_fieldfield_ddc_reset; + struct reg_fieldfield_ddc_addr_reg; + struct reg_fieldfield_ddc_slave_addr; + struct reg_fieldfield_ddc_int_mask; + struct reg_fieldfield_ddc_int_status; + struct reg_fieldfield_ddc_fifo_clear; + struct reg_fieldfield_ddc_fifo_rx_thres; + struct reg_fieldfield_ddc_fifo_tx_thres; + struct reg_fieldfield_ddc_byte_count; + struct reg_fieldfield_ddc_cmd; + struct reg_fieldfield_ddc_sda_en; + struct reg_fieldfield_ddc_sck_en; + + /* DDC FIFO register offset */ + u32 ddc_fifo_reg; + + /* +* DDC FIFO threshold boundary conditions +* +* This is used to cope with the threshold boundary condition +* being slightly different on sun5i and sun6i. +* +* On sun5i the threshold is exclusive, i.e. does not include, +* the value of the threshold. ( > for RX; < for TX ) +* On sun6i the threshold is inclusive, i.e. includes, the +* value of the threshold. ( >= for RX; <= for TX ) +*/ + boolddc_fifo_thres_incl; + + boolddc_fifo_has_dir; +}; + struct sun4i_hdmi { struct drm_connectorconnector; struct drm_encoder encoder; @@ -165,9 +215,13 @@ struct sun4i_hdmi { void __iomem*base; struct regmap *regmap; + /* Reset control */ + struct reset_control*reset; + /* Parent clocks */ struct clk *bus_clk; struct clk *mod_clk; + struct clk *ddc_parent_clk; struct clk *pll0_clk; struct clk *pll1_clk; @@ -177,10 +231,28 @@ struct sun4i_hdmi { struct i2c_adapter *i2c; + /* Regmap fields for I2C adapter */ + struct regmap_field *field_ddc_en; + struct regmap_field *field_ddc_start; + struct regmap_field *field_ddc_reset; + struct regmap_field *field_ddc_addr_reg; + struct regmap_field *field_ddc_slave_addr; + struct regmap_field *field_ddc_int_mask; + struct regmap_field *field_ddc_int_status; + struct regmap_field *field_ddc_fifo_clear; + struct regmap_field *field_ddc_fifo_rx_thres; + struct regmap_field *field_ddc_fifo_tx_thres; + struct regmap_field *field_ddc_byte_count; + struct regmap_field *field_ddc_cmd; + struct regmap_field
[PATCH v3 09/14] regmap: add iopoll-like polling macro for regmap_field
This patch adds a macro regmap_field_read_poll_timeout that works similar to the readx_poll_timeout defined in linux/iopoll.h, except that this can also return the error value returned by a failed regmap_field_read. Signed-off-by: Chen-Yu Tsai --- include/linux/regmap.h | 39 +++ 1 file changed, 39 insertions(+) diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 978abfbac617..93a4663d7acb 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -139,6 +139,45 @@ struct reg_sequence { pollret ?: ((cond) ? 0 : -ETIMEDOUT); \ }) +/** + * regmap_field_read_poll_timeout - Poll until a condition is met or timeout + * + * @field: Regmap field to read from + * @val: Unsigned integer variable to read the value into + * @cond: Break condition (usually involving @val) + * @sleep_us: Maximum time to sleep between reads in us (0 + *tight-loops). Should be less than ~20ms since usleep_range + *is used (see Documentation/timers/timers-howto.txt). + * @timeout_us: Timeout in us, 0 means never timeout + * + * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read + * error return value in case of a error read. In the two former cases, + * the last read value at @addr is stored in @val. Must not be called + * from atomic context if sleep_us or timeout_us are used. + * + * This is modelled after the readx_poll_timeout macros in linux/iopoll.h. + */ +#define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \ +({ \ + ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ + int pollret; \ + might_sleep_if(sleep_us); \ + for (;;) { \ + pollret = regmap_field_read((field), &(val)); \ + if (pollret) \ + break; \ + if (cond) \ + break; \ + if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ + pollret = regmap_field_read((field), &(val)); \ + break; \ + } \ + if (sleep_us) \ + usleep_range((sleep_us >> 2) + 1, sleep_us); \ + } \ + pollret ?: ((cond) ? 0 : -ETIMEDOUT); \ +}) + #ifdef CONFIG_REGMAP enum regmap_endian { -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 03/14] drm/sun4i: tcon: Add variant callback for TCON output muxing
Different SoCs have different muxing options and values for the TCON outputs. Instead of stuffing every possibility in sun4i_tcon_set_mux(), add a callback pointer to sun4i_tcon_quirks that each TCON variant can use to provide muxing support. The current muxing options in sun4i_tcon_set_mux() for sun5i-a13 are moved to a new sun5i-specific callback function. Signed-off-by: Chen-Yu Tsai --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 45 -- drivers/gpu/drm/sun4i/sun4i_tcon.h | 5 + 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index e853dfe51389..7bf51abaee97 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -14,9 +14,12 @@ #include #include #include +#include #include #include +#include + #include #include #include @@ -112,23 +115,13 @@ EXPORT_SYMBOL(sun4i_tcon_enable_vblank); void sun4i_tcon_set_mux(struct sun4i_tcon *tcon, int channel, struct drm_encoder *encoder) { - u32 val; - - if (!tcon->quirks->has_unknown_mux) - return; + int ret = -ENOTSUPP; - if (channel != 1) - return; - - if (encoder->encoder_type == DRM_MODE_ENCODER_TVDAC) - val = 1; - else - val = 0; + if (tcon->quirks->set_mux) + ret = tcon->quirks->set_mux(tcon, encoder); - /* -* FIXME: Undocumented bits -*/ - regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, val); + DRM_DEBUG_DRIVER("Muxing encoder %s to CRTC %s: %d\n", +encoder->name, encoder->crtc->name, ret); } EXPORT_SYMBOL(sun4i_tcon_set_mux); @@ -767,9 +760,27 @@ static int sun4i_tcon_remove(struct platform_device *pdev) return 0; } +/* platform specific TCON muxing callbacks */ +static int sun5i_a13_tcon_set_mux(struct sun4i_tcon *tcon, + struct drm_encoder *encoder) +{ + u32 val; + + if (encoder->encoder_type == DRM_MODE_ENCODER_TVDAC) + val = 1; + else + val = 0; + + /* +* FIXME: Undocumented bits +*/ + return regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, val); +} + static const struct sun4i_tcon_quirks sun5i_a13_quirks = { - .has_unknown_mux = true, - .has_channel_1 = true, + .has_unknown_mux= true, + .has_channel_1 = true, + .set_mux= sun5i_a13_tcon_set_mux, }; static const struct sun4i_tcon_quirks sun6i_a31_quirks = { diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h index 5a219d1ccc26..6e699cbcf768 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h @@ -145,10 +145,15 @@ #define SUN4I_TCON_MAX_CHANNELS2 +struct sun4i_tcon; + struct sun4i_tcon_quirks { boolhas_unknown_mux; /* sun5i has undocumented mux */ boolhas_channel_1; /* a33 does not have channel 1 */ boolneeds_de_be_mux; /* sun6i needs mux to select backend */ + + /* callback to handle tcon muxing options */ + int (*set_mux)(struct sun4i_tcon *, struct drm_encoder *); }; struct sun4i_tcon { -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 13/14] ARM: dts: sun6i: Add device node for HDMI controller
Now that we support the HDMI controller on the A31 SoC, we can add it to the device tree. This adds a device node for the HDMI controller, and the of_graph nodes connecting it to the 2 TCONs. Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun6i-a31.dtsi | 55 1 file changed, 55 insertions(+) diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi index 93209cda28db..48b2382a18a9 100644 --- a/arch/arm/boot/dts/sun6i-a31.dtsi +++ b/arch/arm/boot/dts/sun6i-a31.dtsi @@ -289,6 +289,12 @@ #address-cells = <1>; #size-cells = <0>; reg = <1>; + + tcon0_out_hdmi: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_in_tcon0>; + allwinner,tcon-channel = <1>; + }; }; }; }; @@ -331,6 +337,12 @@ #address-cells = <1>; #size-cells = <0>; reg = <1>; + + tcon1_out_hdmi: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_in_tcon1>; + allwinner,tcon-channel = <1>; + }; }; }; }; @@ -411,6 +423,49 @@ #size-cells = <0>; }; + hdmi: hdmi@01c16000 { + compatible = "allwinner,sun6i-a31-hdmi"; + reg = <0x01c16000 0x1000>; + interrupts = ; + clocks = <&ccu CLK_AHB1_HDMI>, <&ccu CLK_HDMI>, +<&ccu CLK_HDMI_DDC>, +<&ccu CLK_PLL_VIDEO0_2X>, +<&ccu CLK_PLL_VIDEO1_2X>; + clock-names = "ahb", "mod", "ddc", "pll-0", "pll-1"; + resets = <&ccu RST_AHB1_HDMI>; + reset-names = "ahb"; + dma-names = "ddc-tx", "ddc-rx", "audio-tx"; + dmas = <&dma 13>, <&dma 13>, <&dma 14>; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + hdmi_in: port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + hdmi_in_tcon0: endpoint@0 { + reg = <0>; + remote-endpoint = <&tcon0_out_hdmi>; + }; + + hdmi_in_tcon1: endpoint@1 { + reg = <1>; + remote-endpoint = <&tcon1_out_hdmi>; + }; + }; + + hdmi_out: port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + }; + }; + }; + usb_otg: usb@01c19000 { compatible = "allwinner,sun6i-a31-musb"; reg = <0x01c19000 0x0400>; -- 2.14.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 8/9] drivers: clk: samsung: Fix m2m scaler clock on Exynos542x
On 09/29/2017 09:32 AM, Marek Szyprowski wrote: > From: Andrzej Pietrasiewicz > > TOP "aclk400_mscl" clock should be kept enabled all the time to allow > proper access to power management control for MSC power domain and > devices that are a part of it. This change is required for scaler to > work properly after domain power on/off sequence. > > Fixes: 318fa46cc60d ("clk/samsung: exynos542x: mark some clocks as critical") > Signed-off-by: Andrzej Pietrasiewicz > Signed-off-by: Marek Szyprowski Applied, thanks. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH hwc v2 1/6] drm_hwcomposer: Remove threading
On Fri, 2017-09-29 at 13:49 +0800, Chih-Wei Huang wrote: > 2017-09-29 5:29 GMT+08:00 Rob Herring : > > On Thu, Sep 28, 2017 at 11:43 AM, Chih-Wei Huang > > wrote: > > > 2017-09-27 19:58 GMT+08:00 Robert Foss > > >: > > > > From: Sean Paul > > > > > > > > Since HWC2 doesn't require the use of threads to implement > > > > correct > > > > synchronization, remove some of these threads. > > > > > > May I ask to avoid HWC2 only implementation? > > > The main reason is not all GPUs support > > > drm_hwcompser (as discussed in another thread). > > > > Which thread? Is that because they don't support explicit fences? > > Or > > something else? > > The "drm_hwcomposer moving to fd.o" thread. > For example, see > https://lists.freedesktop.org/archives/dri-devel/2017-September/15358 > 0.html > > > > To continue supporting these GPUs we need to > > > keep using HWC1 version of SurfaceFlinger. > > > > I think that is a lot of complexity to keep which will impact > > future > > changes as well. For example, is keeping it going to make removing > > sw_sync dependency (A non-stable debugfs interface) more difficult? > > drm_hwcomposer is already complex enough IMO with the GL > > compositing > > that removing some complexity would be a good thing. > > > > > So it's better to keep the code compatible with > > > HWC1. At least make it be a compile-time option. > > > > > > Personally I have a patch to make > > > HWC1 vs HWC2 a compile-time choice > > > of drm_hwcomposer. > > FYI, the patch is > https://osdn.net/projects/android-x86/scm/git/external-drm_hwcomposer > /commits/7acc332019d211cb2747fd4068cf41aaa62753fb > > > Perhaps just leave the current state as a separate branch. > > Did you mean we maintain the branch in our repo? > (that's what we do now, but I hope to avoid that) > > Or fd.o could help to maintain the two branches (HWC1 and HWC2)? > Android later than O will not support HWC1 (as far as I understand it), so HWC2 is the way forward. Furthermore I think targeting aosp/master at all time is the right thing to do for drm_hwcomposer. I for one am less than keen on maintaining branch that is incompatible with aosp/master upstream. Ideally we wouldn't maintain a compile time switch either, not on principle but because of the development overhead it causes. We have very finite resources contributing to drm_hwcomposer. If it was cheap&&easy to support old Android versions we should, but I don't think it is. I would suggest maintaining a HWC1 fork downstream as the way forward. But any input is welcome. Rob. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 01/14] clk: sunxi-ng: sun6i: Export video PLLs
On Fri, Sep 29, 2017 at 08:22:53AM +, Chen-Yu Tsai wrote: > The 2x outputs of the 2 video PLL clocks are directly used by the > HDMI controller block. > > Export them so they can be referenced in the device tree. > > Fixes: c6e6c96d8fa6 ("clk: sunxi-ng: Add A31/A31s clocks") > Signed-off-by: Chen-Yu Tsai > Acked-by: Maxime Ripard Applied, thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 02/14] clk: sunxi-ng: sun6i: Rename HDMI DDC clock to avoid name collision
On Fri, Sep 29, 2017 at 08:22:54AM +, Chen-Yu Tsai wrote: > The HDMI DDC clock found in the CCU is the parent of the actual DDC > clock within the HDMI controller. That clock is also named "hdmi-ddc". > > Rename the one in the CCU to "ddc". This makes more sense than renaming > the one in the HDMI controller to something else. > > Fixes: c6e6c96d8fa6 ("clk: sunxi-ng: Add A31/A31s clocks") > Signed-off-by: Chen-Yu Tsai Applied, thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH hwc v2 1/6] drm_hwcomposer: Remove threading
2017-09-29 16:44 GMT+08:00 Robert Foss : > On Fri, 2017-09-29 at 13:49 +0800, Chih-Wei Huang wrote: >> 2017-09-29 5:29 GMT+08:00 Rob Herring : >> > Perhaps just leave the current state as a separate branch. >> >> Did you mean we maintain the branch in our repo? >> (that's what we do now, but I hope to avoid that) >> >> Or fd.o could help to maintain the two branches (HWC1 and HWC2)? > > Android later than O will not support HWC1 (as far as I understand it), > so HWC2 is the way forward. If all x86 GPUs we want to support can work with drm_hwcomposer, I'm happy to switch to HWC2. However it seems impossible at this moment. :( > Furthermore I think targeting aosp/master at all time is the right > thing to do for drm_hwcomposer. > > I for one am less than keen on maintaining branch that is incompatible > with aosp/master upstream. > > Ideally we wouldn't maintain a compile time switch either, not on > principle but because of the development overhead it causes. > We have very finite resources contributing to drm_hwcomposer. > If it was cheap&&easy to support old Android versions we should, but I > don't think it is. My point is not to support old Android versions, but to support old(?) GPUs that can't work with drm_hwcomposer. > I would suggest maintaining a HWC1 fork downstream as the way forward. > But any input is welcome. -- Chih-Wei Android-x86 project http://www.android-x86.org ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 00/11] drm/exynos: TV path improvements
Hi all, This patchset does two main things: - removes mode limitation for Exynos542x chips, multiple modes were filtered out due to lack of HW version checking code, - enables two modes on older chips, thanks to quirk found by Daniel Drake, and published by Tobias Jakobi [1][2]. Beside this it consolidates the code and performs multiple cleanups. v2: - addressed comments by Tobias, - added Daniel's patch adding 1366x768Hz mode [1]: http://www.spinics.net/lists/linux-samsung-soc/msg24617.html [2]: https://www.spinics.net/lists/dri-devel/msg150906.html Regards Andrzej Andrzej Hajda (10): drm/exynos/mixer: abstract out output mode setup code drm/exynos/mixer: move mode commit to enable callback drm/exynos/mixer: move resolution configuration to single function drm/exynos/mixer: fix mode validation code drm/exynos/mixer: remove mixer_resources sub-structure drm/exynos/hdmi: remove redundant mode field drm/exynos: add mode_fixup callback to exynos_drm_crtc_ops drm/exynos/mixer: pass actual mode on MIXER to encoder drm/exynos/hdmi: quirk for support mode timings conversion drm/exynos/mixer: enable support for 1024x768 and 1280x1024 modes Daniel Drake (1): drm/exynos/hdmi: add 85.5MHz pixel clock for v14 HDMI PHY drivers/gpu/drm/exynos/exynos_drm_crtc.c | 15 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 3 + drivers/gpu/drm/exynos/exynos_hdmi.c | 58 ++-- drivers/gpu/drm/exynos/exynos_mixer.c| 458 +++ 4 files changed, 278 insertions(+), 256 deletions(-) -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 01/11] drm/exynos/mixer: abstract out output mode setup code
Mode setup code is called from video plane update and mixer plane update. Let's group it together in mixer_commit function like in case of other Exynos CRTCs. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_mixer.c | 33 ++--- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 002755415e00..499ebdca4fed 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -473,6 +473,22 @@ static void mixer_stop(struct mixer_context *ctx) usleep_range(1, 12000); } +static void mixer_commit(struct mixer_context *ctx) +{ + struct drm_display_mode *mode = &ctx->crtc->base.state->adjusted_mode; + + /* setup display size */ + if (ctx->mxr_ver == MXR_VER_128_0_0_184) { + u32 val = MXR_MXR_RES_HEIGHT(mode->vdisplay) +| MXR_MXR_RES_WIDTH(mode->hdisplay); + mixer_reg_write(&ctx->mixer_res, MXR_RESOLUTION, val); + } + + mixer_cfg_scan(ctx, mode->vdisplay); + mixer_cfg_rgb_fmt(ctx, mode->vdisplay); + mixer_run(ctx); +} + static void vp_video_buffer(struct mixer_context *ctx, struct exynos_drm_plane *plane) { @@ -553,11 +569,9 @@ static void vp_video_buffer(struct mixer_context *ctx, vp_reg_write(res, VP_TOP_C_PTR, chroma_addr[0]); vp_reg_write(res, VP_BOT_C_PTR, chroma_addr[1]); - mixer_cfg_scan(ctx, mode->vdisplay); - mixer_cfg_rgb_fmt(ctx, mode->vdisplay); mixer_cfg_layer(ctx, plane->index, priority, true); mixer_cfg_vp_blend(ctx); - mixer_run(ctx); + mixer_commit(ctx); spin_unlock_irqrestore(&res->reg_slock, flags); @@ -638,14 +652,6 @@ static void mixer_graph_buffer(struct mixer_context *ctx, mixer_reg_write(res, MXR_GRAPHIC_SPAN(win), fb->pitches[0] / fb->format->cpp[0]); - /* setup display size */ - if (ctx->mxr_ver == MXR_VER_128_0_0_184 && - win == DEFAULT_WIN) { - val = MXR_MXR_RES_HEIGHT(mode->vdisplay); - val |= MXR_MXR_RES_WIDTH(mode->hdisplay); - mixer_reg_write(res, MXR_RESOLUTION, val); - } - val = MXR_GRP_WH_WIDTH(state->src.w); val |= MXR_GRP_WH_HEIGHT(state->src.h); val |= MXR_GRP_WH_H_SCALE(x_ratio); @@ -660,18 +666,15 @@ static void mixer_graph_buffer(struct mixer_context *ctx, /* set buffer address to mixer */ mixer_reg_write(res, MXR_GRAPHIC_BASE(win), dma_addr); - mixer_cfg_scan(ctx, mode->vdisplay); - mixer_cfg_rgb_fmt(ctx, mode->vdisplay); mixer_cfg_layer(ctx, win, priority, true); mixer_cfg_gfx_blend(ctx, win, is_alpha_format(fb->format->format)); + mixer_commit(ctx); /* layer update mandatory for mixer 16.0.33.0 */ if (ctx->mxr_ver == MXR_VER_16_0_33_0 || ctx->mxr_ver == MXR_VER_128_0_0_184) mixer_layer_update(ctx); - mixer_run(ctx); - spin_unlock_irqrestore(&res->reg_slock, flags); mixer_regs_dump(ctx); -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 02/11] drm/exynos/mixer: move mode commit to enable callback
Mode commit should not be called for every plane separately. It is enough to call it once in enable callback. The change also requires that the interlace check is moved to mixer_commit. It should be done in the same patch to avoid regression. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_mixer.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 499ebdca4fed..ae89e53186ee 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -477,6 +477,11 @@ static void mixer_commit(struct mixer_context *ctx) { struct drm_display_mode *mode = &ctx->crtc->base.state->adjusted_mode; + if (mode->flags & DRM_MODE_FLAG_INTERLACE) + __set_bit(MXR_BIT_INTERLACE, &ctx->flags); + else + __clear_bit(MXR_BIT_INTERLACE, &ctx->flags); + /* setup display size */ if (ctx->mxr_ver == MXR_VER_128_0_0_184) { u32 val = MXR_MXR_RES_HEIGHT(mode->vdisplay) @@ -494,7 +499,6 @@ static void vp_video_buffer(struct mixer_context *ctx, { struct exynos_drm_plane_state *state = to_exynos_plane_state(plane->base.state); - struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode; struct mixer_resources *res = &ctx->mixer_res; struct drm_framebuffer *fb = state->base.fb; unsigned int priority = state->base.normalized_zpos + 1; @@ -509,8 +513,7 @@ static void vp_video_buffer(struct mixer_context *ctx, luma_addr[0] = exynos_drm_fb_dma_addr(fb, 0); chroma_addr[0] = exynos_drm_fb_dma_addr(fb, 1); - if (mode->flags & DRM_MODE_FLAG_INTERLACE) { - __set_bit(MXR_BIT_INTERLACE, &ctx->flags); + if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) { if (is_tiled) { luma_addr[1] = luma_addr[0] + 0x40; chroma_addr[1] = chroma_addr[0] + 0x40; @@ -519,7 +522,6 @@ static void vp_video_buffer(struct mixer_context *ctx, chroma_addr[1] = chroma_addr[0] + fb->pitches[0]; } } else { - __clear_bit(MXR_BIT_INTERLACE, &ctx->flags); luma_addr[1] = 0; chroma_addr[1] = 0; } @@ -571,7 +573,6 @@ static void vp_video_buffer(struct mixer_context *ctx, mixer_cfg_layer(ctx, plane->index, priority, true); mixer_cfg_vp_blend(ctx); - mixer_commit(ctx); spin_unlock_irqrestore(&res->reg_slock, flags); @@ -591,7 +592,6 @@ static void mixer_graph_buffer(struct mixer_context *ctx, { struct exynos_drm_plane_state *state = to_exynos_plane_state(plane->base.state); - struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode; struct mixer_resources *res = &ctx->mixer_res; struct drm_framebuffer *fb = state->base.fb; unsigned int priority = state->base.normalized_zpos + 1; @@ -637,11 +637,6 @@ static void mixer_graph_buffer(struct mixer_context *ctx, + (state->src.x * fb->format->cpp[0]) + (state->src.y * fb->pitches[0]); - if (mode->flags & DRM_MODE_FLAG_INTERLACE) - __set_bit(MXR_BIT_INTERLACE, &ctx->flags); - else - __clear_bit(MXR_BIT_INTERLACE, &ctx->flags); - spin_lock_irqsave(&res->reg_slock, flags); /* setup format */ @@ -668,7 +663,6 @@ static void mixer_graph_buffer(struct mixer_context *ctx, mixer_cfg_layer(ctx, win, priority, true); mixer_cfg_gfx_blend(ctx, win, is_alpha_format(fb->format->format)); - mixer_commit(ctx); /* layer update mandatory for mixer 16.0.33.0 */ if (ctx->mxr_ver == MXR_VER_16_0_33_0 || @@ -1021,6 +1015,8 @@ static void mixer_enable(struct exynos_drm_crtc *crtc) } mixer_win_reset(ctx); + mixer_commit(ctx); + mixer_vsync_set_update(ctx, true); set_bit(MXR_BIT_POWERED, &ctx->flags); -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 04/11] drm/exynos/mixer: fix mode validation code
Mode limitation checked in mixer driver affects only older HW. Mixer in Exynos542x has no such limitations. While at it patch changes validation callback to recently introduced mode_valid which is more suitable for the check. Additionally little cleanup is performed. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_mixer.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index a87f60bbf2c2..fba120346189 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1040,26 +1040,24 @@ static void mixer_disable(struct exynos_drm_crtc *crtc) clear_bit(MXR_BIT_POWERED, &ctx->flags); } -/* Only valid for Mixer version 16.0.33.0 */ -static int mixer_atomic_check(struct exynos_drm_crtc *crtc, - struct drm_crtc_state *state) +static int mixer_mode_valid(struct exynos_drm_crtc *crtc, + const struct drm_display_mode *mode) { - struct drm_display_mode *mode = &state->adjusted_mode; - u32 w, h; + struct mixer_context *ctx = crtc->ctx; + u32 w = mode->hdisplay, h = mode->vdisplay; - w = mode->hdisplay; - h = mode->vdisplay; + DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d\n", w, h, + mode->vrefresh, !!(mode->flags & DRM_MODE_FLAG_INTERLACE)); - DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d\n", - mode->hdisplay, mode->vdisplay, mode->vrefresh, - (mode->flags & DRM_MODE_FLAG_INTERLACE) ? 1 : 0); + if (ctx->mxr_ver == MXR_VER_128_0_0_184) + return MODE_OK; if ((w >= 464 && w <= 720 && h >= 261 && h <= 576) || - (w >= 1024 && w <= 1280 && h >= 576 && h <= 720) || - (w >= 1664 && w <= 1920 && h >= 936 && h <= 1080)) - return 0; + (w >= 1024 && w <= 1280 && h >= 576 && h <= 720) || + (w >= 1664 && w <= 1920 && h >= 936 && h <= 1080)) + return MODE_OK; - return -EINVAL; + return MODE_BAD; } static const struct exynos_drm_crtc_ops mixer_crtc_ops = { @@ -1071,7 +1069,7 @@ static const struct exynos_drm_crtc_ops mixer_crtc_ops = { .update_plane = mixer_update_plane, .disable_plane = mixer_disable_plane, .atomic_flush = mixer_atomic_flush, - .atomic_check = mixer_atomic_check, + .mode_valid = mixer_mode_valid, }; static const struct mixer_drv_data exynos5420_mxr_drv_data = { -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 08/11] drm/exynos/mixer: pass actual mode on MIXER to encoder
MIXER in SoCs prior to Exynos5420 supports only 4 video modes: 720x480, 720x576, 1280x720, 1920x1080. Support for other modes can be enabled by manipulating timings of HDMI. To allow it MIXER must pass actual video mode to HDMI, the proper way to do it is to modify adjusted_mode property in crtc::mode_fixup callback. Adding such callback allows also to simplify mixer_cfg_scan code - choosing mode is performed already in crtc::mode_fixup. mode_fixup is also better place to check interlace flag. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_mixer.c | 70 +-- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 2d8905ea0141..8baa93f80106 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -115,6 +115,7 @@ struct mixer_context { struct clk *sclk_hdmi; struct clk *mout_mixer; enum mixer_version_id mxr_ver; + int scan_value; }; struct mixer_drv_data { @@ -367,23 +368,11 @@ static void mixer_cfg_scan(struct mixer_context *ctx, int width, int height) val = test_bit(MXR_BIT_INTERLACE, &ctx->flags) ? MXR_CFG_SCAN_INTERLACE : MXR_CFG_SCAN_PROGRESSIVE; - /* setup display size */ - if (ctx->mxr_ver == MXR_VER_128_0_0_184) { + if (ctx->mxr_ver == MXR_VER_128_0_0_184) mixer_reg_write(ctx, MXR_RESOLUTION, MXR_MXR_RES_HEIGHT(height) | MXR_MXR_RES_WIDTH(width)); - } else { - /* choosing between proper HD and SD mode */ - if (height <= 480) - val |= MXR_CFG_SCAN_NTSC | MXR_CFG_SCAN_SD; - else if (height <= 576) - val |= MXR_CFG_SCAN_PAL | MXR_CFG_SCAN_SD; - else if (height <= 720) - val |= MXR_CFG_SCAN_HD_720 | MXR_CFG_SCAN_HD; - else if (height <= 1080) - val |= MXR_CFG_SCAN_HD_1080 | MXR_CFG_SCAN_HD; - else - val |= MXR_CFG_SCAN_HD_720 | MXR_CFG_SCAN_HD; - } + else + val |= ctx->scan_value; mixer_reg_writemask(ctx, MXR_CFG, val, MXR_CFG_SCAN_MASK); } @@ -467,11 +456,6 @@ static void mixer_commit(struct mixer_context *ctx) { struct drm_display_mode *mode = &ctx->crtc->base.state->adjusted_mode; - if (mode->flags & DRM_MODE_FLAG_INTERLACE) - __set_bit(MXR_BIT_INTERLACE, &ctx->flags); - else - __clear_bit(MXR_BIT_INTERLACE, &ctx->flags); - mixer_cfg_scan(ctx, mode->hdisplay, mode->vdisplay); mixer_cfg_rgb_fmt(ctx, mode->vdisplay); mixer_run(ctx); @@ -1033,6 +1017,51 @@ static int mixer_mode_valid(struct exynos_drm_crtc *crtc, return MODE_BAD; } +static bool mixer_mode_fixup(struct exynos_drm_crtc *crtc, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + struct mixer_context *ctx = crtc->ctx; + int width = mode->hdisplay, height = mode->vdisplay, i; + + struct { + int hdisplay, vdisplay, htotal, vtotal, scan_val; + } static const modes[] = { + { 720, 480, 858, 525, MXR_CFG_SCAN_NTSC | MXR_CFG_SCAN_SD }, + { 720, 576, 864, 625, MXR_CFG_SCAN_PAL | MXR_CFG_SCAN_SD }, + { 1280, 720, 1650, 750, MXR_CFG_SCAN_HD_720 | MXR_CFG_SCAN_HD }, + { 1920, 1080, 2200, 1125, MXR_CFG_SCAN_HD_1080 | MXR_CFG_SCAN_HD } + }; + + if (mode->flags & DRM_MODE_FLAG_INTERLACE) + __set_bit(MXR_BIT_INTERLACE, &ctx->flags); + else + __clear_bit(MXR_BIT_INTERLACE, &ctx->flags); + + if (ctx->mxr_ver == MXR_VER_128_0_0_184) + return true; + + for (i = 0; i < ARRAY_SIZE(modes); ++i) + if (width <= modes[i].hdisplay && height <= modes[i].vdisplay) { + ctx->scan_value = modes[i].scan_val; + if (width < modes[i].hdisplay || + height < modes[i].vdisplay) { + adjusted_mode->hdisplay = modes[i].hdisplay; + adjusted_mode->hsync_start = modes[i].hdisplay; + adjusted_mode->hsync_end = modes[i].htotal; + adjusted_mode->htotal = modes[i].htotal; + adjusted_mode->vdisplay = modes[i].vdisplay; + adjusted_mode->vsync_start = modes[i].vdisplay; + adjusted_mode->vsync_end = modes[i].vtotal; + adjusted_mode->vtotal = modes[i].vtotal; + } + + return true; + } + + return
[PATCH v2 06/11] drm/exynos/hdmi: remove redundant mode field
Display mode is preserved in CRTC state, there is no need to keep local copy of it. Moreover since HDMI should configure registers according to requested mode, use it instead of adjusted_mode, which should contain mode produced by CRTC - functionally it does not change anything, but subsequent patches will make the difference. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_hdmi.c | 34 +- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 214fa5e51963..7225b6521148 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -119,7 +119,6 @@ struct hdmi_context { boolpowered; booldvi_mode; struct delayed_work hotplug_work; - struct drm_display_mode current_mode; struct cec_notifier *notifier; const struct hdmi_driver_data *drv_data; @@ -770,6 +769,7 @@ static int hdmi_clk_set_parents(struct hdmi_context *hdata, bool to_phy) static void hdmi_reg_infoframes(struct hdmi_context *hdata) { + struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; union hdmi_infoframe frm; u8 buf[25]; int ret; @@ -783,8 +783,7 @@ static void hdmi_reg_infoframes(struct hdmi_context *hdata) return; } - ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi, - &hdata->current_mode, false); + ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi, m, false); if (!ret) ret = hdmi_avi_infoframe_pack(&frm.avi, buf, sizeof(buf)); if (ret > 0) { @@ -794,8 +793,7 @@ static void hdmi_reg_infoframes(struct hdmi_context *hdata) DRM_INFO("%s: invalid AVI infoframe (%d)\n", __func__, ret); } - ret = drm_hdmi_vendor_infoframe_from_display_mode(&frm.vendor.hdmi, - &hdata->current_mode); + ret = drm_hdmi_vendor_infoframe_from_display_mode(&frm.vendor.hdmi, m); if (!ret) ret = hdmi_vendor_infoframe_pack(&frm.vendor.hdmi, buf, sizeof(buf)); @@ -1088,9 +1086,10 @@ static void hdmi_audio_control(struct hdmi_context *hdata, bool onoff) static void hdmi_start(struct hdmi_context *hdata, bool start) { + struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; u32 val = start ? HDMI_TG_EN : 0; - if (hdata->current_mode.flags & DRM_MODE_FLAG_INTERLACE) + if (m->flags & DRM_MODE_FLAG_INTERLACE) val |= HDMI_FIELD_EN; hdmi_reg_writemask(hdata, HDMI_CON_0, val, HDMI_EN); @@ -1160,7 +1159,7 @@ static void hdmiphy_wait_for_pll(struct hdmi_context *hdata) static void hdmi_v13_mode_apply(struct hdmi_context *hdata) { - struct drm_display_mode *m = &hdata->current_mode; + struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; unsigned int val; hdmi_reg_writev(hdata, HDMI_H_BLANK_0, 2, m->htotal - m->hdisplay); @@ -1239,7 +1238,7 @@ static void hdmi_v13_mode_apply(struct hdmi_context *hdata) static void hdmi_v14_mode_apply(struct hdmi_context *hdata) { - struct drm_display_mode *m = &hdata->current_mode; + struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; hdmi_reg_writev(hdata, HDMI_H_BLANK_0, 2, m->htotal - m->hdisplay); hdmi_reg_writev(hdata, HDMI_V_LINE_0, 2, m->vtotal); @@ -1372,10 +1371,11 @@ static void hdmiphy_enable_mode_set(struct hdmi_context *hdata, bool enable) static void hdmiphy_conf_apply(struct hdmi_context *hdata) { + struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; int ret; const u8 *phy_conf; - ret = hdmi_find_phy_conf(hdata, hdata->current_mode.clock * 1000); + ret = hdmi_find_phy_conf(hdata, m->clock * 1000); if (ret < 0) { DRM_ERROR("failed to find hdmiphy conf\n"); return; @@ -1407,21 +1407,6 @@ static void hdmi_conf_apply(struct hdmi_context *hdata) hdmi_audio_control(hdata, true); } -static void hdmi_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - struct hdmi_context *hdata = encoder_to_hdmi(encoder); - struct drm_display_mode *m = adjusted_mode; - - DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%s\n", - m->hdisplay, m->vdisplay, - m->vrefresh, (m->flags & DRM_MODE_FLAG_INTERLACE) ? - "INTERLACED" : "PROGRESSIVE"); - - drm_mode_copy(&hdata->current_mode, m); -} - static void hdmi_set_refclk(struct hdmi_context *hdata, bool on) { if (!hdata->sysreg) @@ -1504,7 +1489,6 @@ static void hdmi_disable(st
[PATCH v2 05/11] drm/exynos/mixer: remove mixer_resources sub-structure
mixer_resources adds only unnecessary redirection, removing it makes the code shorter and cleaner. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_mixer.c | 323 -- 1 file changed, 147 insertions(+), 176 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index fba120346189..2d8905ea0141 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -67,19 +67,6 @@ #define MXR_FORMAT_ARGB6 #define MXR_FORMAT_ARGB7 -struct mixer_resources { - int irq; - void __iomem*mixer_regs; - void __iomem*vp_regs; - spinlock_t reg_slock; - struct clk *mixer; - struct clk *vp; - struct clk *hdmi; - struct clk *sclk_mixer; - struct clk *sclk_hdmi; - struct clk *mout_mixer; -}; - enum mixer_version_id { MXR_VER_0_0_0_16, MXR_VER_16_0_33_0, @@ -117,7 +104,16 @@ struct mixer_context { struct exynos_drm_plane planes[MIXER_WIN_NR]; unsigned long flags; - struct mixer_resources mixer_res; + int irq; + void __iomem*mixer_regs; + void __iomem*vp_regs; + spinlock_t reg_slock; + struct clk *mixer; + struct clk *vp; + struct clk *hdmi; + struct clk *sclk_mixer; + struct clk *sclk_hdmi; + struct clk *mout_mixer; enum mixer_version_id mxr_ver; }; @@ -194,44 +190,44 @@ static inline bool is_alpha_format(unsigned int pixel_format) } } -static inline u32 vp_reg_read(struct mixer_resources *res, u32 reg_id) +static inline u32 vp_reg_read(struct mixer_context *ctx, u32 reg_id) { - return readl(res->vp_regs + reg_id); + return readl(ctx->vp_regs + reg_id); } -static inline void vp_reg_write(struct mixer_resources *res, u32 reg_id, +static inline void vp_reg_write(struct mixer_context *ctx, u32 reg_id, u32 val) { - writel(val, res->vp_regs + reg_id); + writel(val, ctx->vp_regs + reg_id); } -static inline void vp_reg_writemask(struct mixer_resources *res, u32 reg_id, +static inline void vp_reg_writemask(struct mixer_context *ctx, u32 reg_id, u32 val, u32 mask) { - u32 old = vp_reg_read(res, reg_id); + u32 old = vp_reg_read(ctx, reg_id); val = (val & mask) | (old & ~mask); - writel(val, res->vp_regs + reg_id); + writel(val, ctx->vp_regs + reg_id); } -static inline u32 mixer_reg_read(struct mixer_resources *res, u32 reg_id) +static inline u32 mixer_reg_read(struct mixer_context *ctx, u32 reg_id) { - return readl(res->mixer_regs + reg_id); + return readl(ctx->mixer_regs + reg_id); } -static inline void mixer_reg_write(struct mixer_resources *res, u32 reg_id, +static inline void mixer_reg_write(struct mixer_context *ctx, u32 reg_id, u32 val) { - writel(val, res->mixer_regs + reg_id); + writel(val, ctx->mixer_regs + reg_id); } -static inline void mixer_reg_writemask(struct mixer_resources *res, +static inline void mixer_reg_writemask(struct mixer_context *ctx, u32 reg_id, u32 val, u32 mask) { - u32 old = mixer_reg_read(res, reg_id); + u32 old = mixer_reg_read(ctx, reg_id); val = (val & mask) | (old & ~mask); - writel(val, res->mixer_regs + reg_id); + writel(val, ctx->mixer_regs + reg_id); } static void mixer_regs_dump(struct mixer_context *ctx) @@ -239,7 +235,7 @@ static void mixer_regs_dump(struct mixer_context *ctx) #define DUMPREG(reg_id) \ do { \ DRM_DEBUG_KMS(#reg_id " = %08x\n", \ - (u32)readl(ctx->mixer_res.mixer_regs + reg_id)); \ + (u32)readl(ctx->mixer_regs + reg_id)); \ } while (0) DUMPREG(MXR_STATUS); @@ -271,7 +267,7 @@ static void vp_regs_dump(struct mixer_context *ctx) #define DUMPREG(reg_id) \ do { \ DRM_DEBUG_KMS(#reg_id " = %08x\n", \ - (u32) readl(ctx->mixer_res.vp_regs + reg_id)); \ + (u32) readl(ctx->vp_regs + reg_id)); \ } while (0) DUMPREG(VP_ENABLE); @@ -301,7 +297,7 @@ do { \ #undef DUMPREG } -static inline void vp_filter_set(struct mixer_resources *res, +static inline void vp_filter_set(struct mixer_context *ctx, int reg_id, const u8 *data, unsigned int size) { /* assure 4-byte align */ @@ -309,24 +305,23 @@ static inline void vp_filter_set(struct mixer_resources *res, for (; size; size -= 4, reg_id += 4, data += 4) { u32 val = (data[0] << 24) | (data[1] << 16) |
[PATCH v2 10/11] drm/exynos/mixer: enable support for 1024x768 and 1280x1024 modes
Since HDMI can handle these modes despite of MIXER limitations let's enable them. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_mixer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 8baa93f80106..85d33137cfd8 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1014,6 +1014,9 @@ static int mixer_mode_valid(struct exynos_drm_crtc *crtc, (w >= 1664 && w <= 1920 && h >= 936 && h <= 1080)) return MODE_OK; + if ((w == 1024 && h == 768) || (w == 1280 && h == 1024)) + return MODE_OK; + return MODE_BAD; } -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 03/11] drm/exynos/mixer: move resolution configuration to single function
Screen resolution configuration depends on HW version, let's put it into single function to make it consistent and simplify the code. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_mixer.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index ae89e53186ee..a87f60bbf2c2 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -367,7 +367,7 @@ static void mixer_vsync_set_update(struct mixer_context *ctx, bool enable) VP_SHADOW_UPDATE_ENABLE : 0); } -static void mixer_cfg_scan(struct mixer_context *ctx, unsigned int height) +static void mixer_cfg_scan(struct mixer_context *ctx, int width, int height) { struct mixer_resources *res = &ctx->mixer_res; u32 val; @@ -376,7 +376,11 @@ static void mixer_cfg_scan(struct mixer_context *ctx, unsigned int height) val = test_bit(MXR_BIT_INTERLACE, &ctx->flags) ? MXR_CFG_SCAN_INTERLACE : MXR_CFG_SCAN_PROGRESSIVE; - if (ctx->mxr_ver != MXR_VER_128_0_0_184) { + /* setup display size */ + if (ctx->mxr_ver == MXR_VER_128_0_0_184) { + mixer_reg_write(&ctx->mixer_res, MXR_RESOLUTION, + MXR_MXR_RES_HEIGHT(height) | MXR_MXR_RES_WIDTH(width)); + } else { /* choosing between proper HD and SD mode */ if (height <= 480) val |= MXR_CFG_SCAN_NTSC | MXR_CFG_SCAN_SD; @@ -482,14 +486,7 @@ static void mixer_commit(struct mixer_context *ctx) else __clear_bit(MXR_BIT_INTERLACE, &ctx->flags); - /* setup display size */ - if (ctx->mxr_ver == MXR_VER_128_0_0_184) { - u32 val = MXR_MXR_RES_HEIGHT(mode->vdisplay) -| MXR_MXR_RES_WIDTH(mode->hdisplay); - mixer_reg_write(&ctx->mixer_res, MXR_RESOLUTION, val); - } - - mixer_cfg_scan(ctx, mode->vdisplay); + mixer_cfg_scan(ctx, mode->hdisplay, mode->vdisplay); mixer_cfg_rgb_fmt(ctx, mode->vdisplay); mixer_run(ctx); } -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 11/11] drm/exynos/hdmi: add 85.5MHz pixel clock for v14 HDMI PHY
From: Daniel Drake Configuration details from Samsung. This enables 1366x768@60Hz, which also needs the 256px timing hack to work around a mixer limitation. Signed-off-by: Daniel Drake Signed-off-by: Tobias Jakobi [a.ha...@samsung.com: rebased onto proposed patchset] Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_hdmi.c | 11 ++- drivers/gpu/drm/exynos/exynos_mixer.c | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 4b081f6cfdcb..ee45accb81c7 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -296,6 +296,15 @@ static const struct hdmiphy_config hdmiphy_v14_configs[] = { 0x54, 0x93, 0x24, 0x01, 0x00, 0x00, 0x01, 0x80, }, }, + { + .pixel_clock = 8550, + .conf = { + 0x01, 0xd1, 0x24, 0x11, 0x40, 0x40, 0xd0, 0x08, + 0x84, 0xa0, 0xd6, 0xd8, 0x45, 0xa0, 0xac, 0x80, + 0x08, 0x80, 0x11, 0x04, 0x02, 0x22, 0x44, 0x86, + 0x54, 0x90, 0x24, 0x01, 0x00, 0x00, 0x01, 0x80, + }, + }, { .pixel_clock = 10650, .conf = { @@ -1248,7 +1257,7 @@ static void hdmi_v14_mode_apply(struct hdmi_context *hdata) * first line is distorted. */ if ((m->vdisplay != am->vdisplay) && - (m->hdisplay == 1280 || m->hdisplay == 1024)) + (m->hdisplay == 1280 || m->hdisplay == 1024 || m->hdisplay == 1366)) hquirk = 258; hdmi_reg_writev(hdata, HDMI_H_BLANK_0, 2, m->htotal - m->hdisplay); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 85d33137cfd8..59ab31eec1bb 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1014,7 +1014,9 @@ static int mixer_mode_valid(struct exynos_drm_crtc *crtc, (w >= 1664 && w <= 1920 && h >= 936 && h <= 1080)) return MODE_OK; - if ((w == 1024 && h == 768) || (w == 1280 && h == 1024)) + if ((w == 1024 && h == 768) || + (w == 1366 && h == 768) || + (w == 1280 && h == 1024)) return MODE_OK; return MODE_BAD; -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 07/11] drm/exynos: add mode_fixup callback to exynos_drm_crtc_ops
crtc::mode_fixup callback is required by crtcs which internally use a different mode than requested by user - case of Exynos Mixer. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 15 +++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 6ce0821590df..dc01342e759a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -95,8 +95,23 @@ static enum drm_mode_status exynos_crtc_mode_valid(struct drm_crtc *crtc, return MODE_OK; } +static bool exynos_crtc_mode_fixup(struct drm_crtc *crtc, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); + + if (exynos_crtc->ops->mode_fixup) + return exynos_crtc->ops->mode_fixup(exynos_crtc, mode, + adjusted_mode); + + return true; +} + + static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { .mode_valid = exynos_crtc_mode_valid, + .mode_fixup = exynos_crtc_mode_fixup, .atomic_check = exynos_crtc_atomic_check, .atomic_begin = exynos_crtc_atomic_begin, .atomic_flush = exynos_crtc_atomic_flush, diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index cf131c2aa23e..e8bcc7223016 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -136,6 +136,9 @@ struct exynos_drm_crtc_ops { u32 (*get_vblank_counter)(struct exynos_drm_crtc *crtc); enum drm_mode_status (*mode_valid)(struct exynos_drm_crtc *crtc, const struct drm_display_mode *mode); + bool (*mode_fixup)(struct exynos_drm_crtc *crtc, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode); int (*atomic_check)(struct exynos_drm_crtc *crtc, struct drm_crtc_state *state); void (*atomic_begin)(struct exynos_drm_crtc *crtc); -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 09/11] drm/exynos/hdmi: quirk for support mode timings conversion
MIXER in SoCs prior to Exynos5420 supports only 4 video modes: 720x480, 720x576, 1280x720, 1920x1080. Support for other modes can be enabled by manipulating timings of HDMI. To do it adjusted_mode should contain actual mode set on crtc. With this patch it is possible to enable 1024x768 and 1280x1024 modes in MIXER. Suggested-by: Daniel Drake Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_hdmi.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 7225b6521148..4b081f6cfdcb 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1239,6 +1239,17 @@ static void hdmi_v13_mode_apply(struct hdmi_context *hdata) static void hdmi_v14_mode_apply(struct hdmi_context *hdata) { struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; + struct drm_display_mode *am = &hdata->encoder.crtc->state->adjusted_mode; + int hquirk = 0; + + /* +* In case video mode coming from CRTC differs from requested one HDMI +* sometimes is able to almost properly perform conversion - only +* first line is distorted. +*/ + if ((m->vdisplay != am->vdisplay) && + (m->hdisplay == 1280 || m->hdisplay == 1024)) + hquirk = 258; hdmi_reg_writev(hdata, HDMI_H_BLANK_0, 2, m->htotal - m->hdisplay); hdmi_reg_writev(hdata, HDMI_V_LINE_0, 2, m->vtotal); @@ -1332,8 +1343,8 @@ static void hdmi_v14_mode_apply(struct hdmi_context *hdata) hdmi_reg_writev(hdata, HDMI_V_SYNC_LINE_AFT_PXL_6_0, 2, 0x); hdmi_reg_writev(hdata, HDMI_TG_H_FSZ_L, 2, m->htotal); - hdmi_reg_writev(hdata, HDMI_TG_HACT_ST_L, 2, m->htotal - m->hdisplay); - hdmi_reg_writev(hdata, HDMI_TG_HACT_SZ_L, 2, m->hdisplay); + hdmi_reg_writev(hdata, HDMI_TG_HACT_ST_L, 2, m->htotal - m->hdisplay - hquirk); + hdmi_reg_writev(hdata, HDMI_TG_HACT_SZ_L, 2, m->hdisplay + hquirk); hdmi_reg_writev(hdata, HDMI_TG_V_FSZ_L, 2, m->vtotal); if (hdata->drv_data == &exynos5433_hdmi_driver_data) hdmi_reg_writeb(hdata, HDMI_TG_DECON_EN, 1); -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 03/14] drm/sun4i: tcon: Add variant callback for TCON output muxing
On Fri, Sep 29, 2017 at 08:22:55AM +, Chen-Yu Tsai wrote: > static const struct sun4i_tcon_quirks sun5i_a13_quirks = { > - .has_unknown_mux = true, > - .has_channel_1 = true, > + .has_unknown_mux= true, > + .has_channel_1 = true, > + .set_mux= sun5i_a13_tcon_set_mux, I guess we could even retire has_unknown_mux now, since it provides the same information than if set_mux is set or to NULL. Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 04/14] drm/sun4i: tcon: Add support for demuxing TCON output on A31
On Fri, Sep 29, 2017 at 08:22:56AM +, Chen-Yu Tsai wrote: > On systems with 2 TCONs such as the A31, it is possible to demux the > output of the TCONs to one encoder. > > Add support for this for the A31. > > Signed-off-by: Chen-Yu Tsai > --- > drivers/gpu/drm/sun4i/sun4i_tcon.c | 38 > ++ > 1 file changed, 38 insertions(+) > > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c > b/drivers/gpu/drm/sun4i/sun4i_tcon.c > index 7bf51abaee97..c949309d4285 100644 > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c > @@ -112,6 +112,21 @@ void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, > bool enable) > } > EXPORT_SYMBOL(sun4i_tcon_enable_vblank); > > +static struct sun4i_tcon *sun4i_get_first_tcon(struct drm_device *drm) Would that make sense to make it a bit more generic, and pass the id to look for as an argument? -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 04/14] drm/sun4i: tcon: Add support for demuxing TCON output on A31
On Fri, Sep 29, 2017 at 6:20 PM, Maxime Ripard wrote: > On Fri, Sep 29, 2017 at 08:22:56AM +, Chen-Yu Tsai wrote: >> On systems with 2 TCONs such as the A31, it is possible to demux the >> output of the TCONs to one encoder. >> >> Add support for this for the A31. >> >> Signed-off-by: Chen-Yu Tsai >> --- >> drivers/gpu/drm/sun4i/sun4i_tcon.c | 38 >> ++ >> 1 file changed, 38 insertions(+) >> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c >> b/drivers/gpu/drm/sun4i/sun4i_tcon.c >> index 7bf51abaee97..c949309d4285 100644 >> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c >> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c >> @@ -112,6 +112,21 @@ void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, >> bool enable) >> } >> EXPORT_SYMBOL(sun4i_tcon_enable_vblank); >> >> +static struct sun4i_tcon *sun4i_get_first_tcon(struct drm_device *drm) > > Would that make sense to make it a bit more generic, and pass the id > to look for as an argument? The reason to look for TCON0 explicitly is to access the muxing registers, which are only available in TCON0. Other than that, there's nothing else shared between the two TCONs. So there's no particular reason to look for TCON1 explicitly. ChenYu ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 2/4] drm/i915: Convert i915 to use ioctl_register/ioctl_deregister.
On Mon, 2017-09-04 at 18:16 +0300, Marius Vlad wrote: > From: Marius Vlad > > Signed-off-by: Marius Vlad > Signed-off-by: Marius-Adrian Negreanu > @@ -1183,6 +1183,71 @@ static void i915_driver_cleanup_hw(struct > drm_i915_private *dev_priv) > i915_ggtt_cleanup_hw(dev_priv); > } > > +static int > +i915_gem_reject_pin_ioctl(struct drm_device *dev, void *data, > + struct drm_file *file) > +{ > + return -ENODEV; > +} > + > +static struct drm_ioctl_desc i915_ioctls[] = { This becomes non-const, with no obvious benefit? Regards, Joonas -- Joonas Lahtinen Open Source Technology Center Intel Corporation ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/i915/psr: Set frames before SU entry for psr2
On Thu, 28 Sep 2017, Rodrigo Vivi wrote: > Merged both patches to dinq. Thanks for the patches. While patch 1 was a simple addition of a few DP macros, we need to get ack from Dave or (preferrably non-Intel) drm-misc maintainers before queuing non-i915 patches through drm-intel. Dave, Sean, ack after the fact...? The patch is [1]. BR, Jani. [1] http://patchwork.freedesktop.org/patch/msgid/1506419953-32605-1-git-send-email-vathsala.nagar...@intel.com -- Jani Nikula, Intel Open Source Technology Center ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 0/4] drm/omap: DMM: Error handling
Hi, the following series adds basic error handling and reporting for the dmm/tiler driver. With the error handling in place we can catch the problems early to avoid more serious consequences. Regards, Peter --- Peter Ujfalusi (4): drm/omap: DMM: Fix DMM_IRQSTAT_ERR_MASK definition drm/omap: DMM: In case of error/timeout in wait_status() print the reason drm/omap: DMM: Print information if we received an error interrupt drm/omap: DMM: Check for DMM readiness after successful transaction commit drivers/gpu/drm/omapdrm/omap_dmm_priv.h | 12 ++-- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 22 -- 2 files changed, 26 insertions(+), 8 deletions(-) -- 2.14.1 Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/4] drm/omap: DMM: In case of error/timeout in wait_status() print the reason
If the wait_status() fails either because of an error reported in the STATUS register or because of a timeout waiting for the wait_mask, print information which might help diagnose the reason. Signed-off-by: Peter Ujfalusi --- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c index 1dd3dafc59af..5a18f0ead4d5 100644 --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c @@ -121,14 +121,22 @@ static int wait_status(struct refill_engine *engine, uint32_t wait_mask) while (true) { r = dmm_read(dmm, reg[PAT_STATUS][engine->id]); err = r & DMM_PATSTATUS_ERR; - if (err) + if (err) { + dev_err(dmm->dev, + "%s: error (engine%d). PAT_STATUS: 0x%08x\n", + __func__, engine->id, r); return -EFAULT; + } if ((r & wait_mask) == wait_mask) break; - if (--i == 0) + if (--i == 0) { + dev_err(dmm->dev, + "%s: timeout (engine%d). PAT_STATUS: 0x%08x\n", + __func__, engine->id, r); return -ETIMEDOUT; + } udelay(1); } -- 2.14.1 Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 4/4] drm/omap: DMM: Check for DMM readiness after successful transaction commit
Check the status of the DMM engine after it is reported that the transaction was completed as in rare cases the engine might not reached a working state. The wait_status() will print information in case the DMM is not reached the expected state and the dmm_txn_commit() will return with an error code to make sure that we are not continuing with a broken setup. Signed-off-by: Peter Ujfalusi --- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c index 09d09734117e..3bd24a254bd0 100644 --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c @@ -311,7 +311,12 @@ static int dmm_txn_commit(struct dmm_txn *txn, bool wait) msecs_to_jiffies(100))) { dev_err(dmm->dev, "timed out waiting for done\n"); ret = -ETIMEDOUT; + goto cleanup; } + + /* Check the engine status before continue */ + ret = wait_status(engine, DMM_PATSTATUS_READY | + DMM_PATSTATUS_VALID | DMM_PATSTATUS_DONE); } cleanup: -- 2.14.1 Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 3/4] drm/omap: DMM: Print information if we received an error interrupt
To help diagnose DMM errors, print out information if any of the error bits are set in the interrupt status register. Signed-off-by: Peter Ujfalusi --- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c index 5a18f0ead4d5..09d09734117e 100644 --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c @@ -166,6 +166,11 @@ static irqreturn_t omap_dmm_irq_handler(int irq, void *arg) dmm_write(dmm, status, DMM_PAT_IRQSTATUS); for (i = 0; i < dmm->num_engines; i++) { + if (status & DMM_IRQSTAT_ERR_MASK) + dev_err(dmm->dev, + "irq error(engine%d): IRQSTAT 0x%02x\n", + i, status & 0xff); + if (status & DMM_IRQSTAT_LST) { if (dmm->engines[i].async) release_engine(&dmm->engines[i]); -- 2.14.1 Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/4] drm/omap: DMM: Fix DMM_IRQSTAT_ERR_MASK definition
The error bit definitions are typoed in DMM_IRQSTAT_ERR_MASK which went unnoticed since the DMM_IRQSTAT_ERR_MASK was not used. Change the bit definitions to the correct ones. Signed-off-by: Peter Ujfalusi --- drivers/gpu/drm/omapdrm/omap_dmm_priv.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_priv.h b/drivers/gpu/drm/omapdrm/omap_dmm_priv.h index 9f32a83ca507..883762ea0aad 100644 --- a/drivers/gpu/drm/omapdrm/omap_dmm_priv.h +++ b/drivers/gpu/drm/omapdrm/omap_dmm_priv.h @@ -59,12 +59,12 @@ #define DMM_IRQSTAT_ERR_UPD_DATA (1<<6) #define DMM_IRQSTAT_ERR_LUT_MISS (1<<7) -#define DMM_IRQSTAT_ERR_MASK (DMM_IRQ_STAT_ERR_INV_DSC | \ - DMM_IRQ_STAT_ERR_INV_DATA | \ - DMM_IRQ_STAT_ERR_UPD_AREA | \ - DMM_IRQ_STAT_ERR_UPD_CTRL | \ - DMM_IRQ_STAT_ERR_UPD_DATA | \ - DMM_IRQ_STAT_ERR_LUT_MISS) +#define DMM_IRQSTAT_ERR_MASK (DMM_IRQSTAT_ERR_INV_DSC | \ + DMM_IRQSTAT_ERR_INV_DATA | \ + DMM_IRQSTAT_ERR_UPD_AREA | \ + DMM_IRQSTAT_ERR_UPD_CTRL | \ + DMM_IRQSTAT_ERR_UPD_DATA | \ + DMM_IRQSTAT_ERR_LUT_MISS) #define DMM_PATSTATUS_READY(1<<0) #define DMM_PATSTATUS_VALID(1<<1) -- 2.14.1 Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 1/2] drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
Den 29.09.2017 05.22, skrev Meghana Madhyastha: On Thu, Sep 28, 2017 at 06:02:27PM +0200, Noralf Trønnes wrote: Den 28.09.2017 16.08, skrev Daniel Vetter: On Thu, Sep 28, 2017 at 02:44:34PM +0530, Meghana Madhyastha wrote: Rename tinydrm_of_find_backlight to drm_of_find_backlight and move it into drm_of.c from tinydrm-helpers.c. This is because other drivers in the drm subsystem might need to call this function. In that case and otherwise, it is better from an organizational point of view to move it into drm_of.c along with the other _of.c functions. Signed-off-by: Meghana Madhyastha --- Changes in v3: -Change it back to a single patch from two patches in v2 drivers/gpu/drm/drm_of.c | 44 ++ drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 --- drivers/gpu/drm/tinydrm/mi0283qt.c | 3 +- include/drm/drm_of.h | 1 + include/drm/tinydrm/tinydrm-helpers.h | 1 - 5 files changed, 47 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 8dafbdf..d878d3a 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -260,3 +261,46 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, return ret; } EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); + +/** + * drm_of_find_backlight - Find backlight device in device-tree + * @dev: Device + * + * This function looks for a DT node pointed to by a property named 'backlight' + * and uses of_find_backlight_by_node() to get the backlight device. + * Additionally if the brightness property is zero, it is set to + * max_brightness. + * + * Note: It is the responsibility of the caller to call put_device() when + * releasing the resource. + * + * Returns: + * NULL if there's no backlight property. + * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device + * is found. + * If the backlight device is found, a pointer to the structure is returned. + */ +struct backlight_device *drm_of_find_backlight(struct device *dev) +{ + struct backlight_device *backlight; + struct device_node *np; + + np = of_parse_phandle(dev->of_node, "backlight", 0); + if (!np) + return NULL; + + backlight = of_find_backlight_by_node(np); + of_node_put(np); + + if (!backlight) + return ERR_PTR(-EPROBE_DEFER); + + if (!backlight->props.brightness) { + backlight->props.brightness = backlight->props.max_brightness; + DRM_DEBUG_KMS("Backlight brightness set to %d\n", + backlight->props.brightness); + } + + return backlight; +} +EXPORT_SYMBOL(drm_of_find_backlight); diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c index bd6cce0..cd4c6a5 100644 --- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c @@ -237,46 +237,6 @@ void tinydrm_xrgb_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, EXPORT_SYMBOL(tinydrm_xrgb_to_gray8); /** - * tinydrm_of_find_backlight - Find backlight device in device-tree - * @dev: Device - * - * This function looks for a DT node pointed to by a property named 'backlight' - * and uses of_find_backlight_by_node() to get the backlight device. - * Additionally if the brightness property is zero, it is set to - * max_brightness. - * - * Returns: - * NULL if there's no backlight property. - * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device - * is found. - * If the backlight device is found, a pointer to the structure is returned. - */ -struct backlight_device *tinydrm_of_find_backlight(struct device *dev) -{ - struct backlight_device *backlight; - struct device_node *np; - - np = of_parse_phandle(dev->of_node, "backlight", 0); - if (!np) - return NULL; - - backlight = of_find_backlight_by_node(np); - of_node_put(np); - - if (!backlight) - return ERR_PTR(-EPROBE_DEFER); - - if (!backlight->props.brightness) { - backlight->props.brightness = backlight->props.max_brightness; - DRM_DEBUG_KMS("Backlight brightness set to %d\n", - backlight->props.brightness); - } - - return backlight; -} -EXPORT_SYMBOL(tinydrm_of_find_backlight); - -/** * tinydrm_enable_backlight - Enable backlight helper * @backlight: Backlight device * diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c index 7e5bb7d..5e3d635 100644 --- a/drivers/gpu/drm/tinydrm/mi0283qt.c +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@
Re: [PATCH v3 2/2] drm/tinydrm: Add devres versions of drm_of_find_backlight
Den 29.09.2017 05.17, skrev Meghana Madhyastha: On Thu, Sep 28, 2017 at 06:19:35PM +0200, Noralf Trønnes wrote: Den 28.09.2017 11.15, skrev Meghana Madhyastha: Add devm_drm_of_find_backlight and the corresponding release function because some drivers such as tinydrm use devres versions of functions for requiring device resources. Signed-off-by: Meghana Madhyastha --- Changes in v3: -None drivers/gpu/drm/drm_of.c | 48 include/drm/drm_of.h | 2 ++ 2 files changed, 50 insertions(+) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index d878d3a..238e8e5 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -304,3 +304,51 @@ struct backlight_device *drm_of_find_backlight(struct device *dev) return backlight; } EXPORT_SYMBOL(drm_of_find_backlight); + +/** + * devm_drm_of_find_backlight_release - Release backlight device + * @dev: Device + * + * This is the release function corresponding to the devm_drm_of_find_backlight. + * Each devres entry is associated with a release function. + */ This is an internal function so no need for docs or exporting. I know that some devm_ functions have explicit release functions, but I don't think this is necessary since those users can just use drm_of_find_backlight() directly instead. I have a question here. devm_drm_of_find_backlight_release is a wrapper around put_device which is passed as a parameter to devm_add_action in devm_drm_of_find_backlight. So isn't the function useful here ? We need the function for devm_add_action(), but no one outside of this file needs it. Hence the static definition. We can't use put_device directly: ret = devm_add_action(dev, put_device, &backlight->dev); because devm_add_action expects an argument like this: void (*action)(void *) and put_device is: void put_device(struct device *dev) They differ in their argument type: void * vs. struct device * The compiler would complain. So we need a wrapper. +static void devm_drm_of_find_backlight_release(void *data) +{ + put_device(data); +} +EXPORT_SYMBOL(devm_drm_of_find_backlight_release); + +/** + * devm_drm_of_find_backlight - Find backlight device in device-tree + * devres version of the function + * @dev: Device + * + * This is the devres version of the function drm_of_find_backlight. + * Some drivers such as tinydrm use devres versions of functions for No need to mention tinydrm here. + * requiring device resources. + * + * Returns: + * NULL if there's no backlight property. + * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device + * is found. + * If the backlight device is found, a pointer to the structure is returned. + */ +struct backlight_device *devm_drm_of_find_backlight(struct device *dev) +{ + struct backlight_device *backlight; + int ret; + + backlight = drm_of_find_backlight(dev); + if (IS_ERR_OR_NULL(backlight)) + return backlight; + + ret = devm_add_action(dev, devm_drm_of_find_backlight_release, + &backlight->dev); + if (ret) { + put_device(&backlight->dev); + return ERR_PTR(ret); + } + + return backlight; +} +EXPORT_SYMBOL(devm_drm_of_find_backlight); diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index e8fba5b..071fb3b 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -30,7 +30,9 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, struct drm_panel **panel, struct drm_bridge **bridge); struct backlight_device *drm_of_find_backlight(struct device *dev); +struct backlight_device *devm_drm_of_find_backlight(struct device *dev); #else We need a dummy version of devm_drm_of_find_backlight() here that returns NULL as in the previous patch. +static void devm_drm_of_find_backlight_release(void *data); And this isn't needed as explained above. static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, struct device_node *port) { I'd appreciate if you could also switch mi0283qt over to this helper :-) Noralf. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 1/2] drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
On Fri, Sep 29, 2017 at 02:10:31PM +0200, Noralf Trønnes wrote: > > Den 29.09.2017 05.22, skrev Meghana Madhyastha: > >On Thu, Sep 28, 2017 at 06:02:27PM +0200, Noralf Trønnes wrote: > >>Den 28.09.2017 16.08, skrev Daniel Vetter: > >>>On Thu, Sep 28, 2017 at 02:44:34PM +0530, Meghana Madhyastha wrote: > Rename tinydrm_of_find_backlight to drm_of_find_backlight > and move it into drm_of.c from tinydrm-helpers.c. This is > because other drivers in the drm subsystem might need to call > this function. In that case and otherwise, it is better from > an organizational point of view to move it into drm_of.c along > with the other _of.c functions. > > Signed-off-by: Meghana Madhyastha > --- > Changes in v3: > -Change it back to a single patch from two patches in v2 > > drivers/gpu/drm/drm_of.c | 44 > ++ > drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 > --- > drivers/gpu/drm/tinydrm/mi0283qt.c | 3 +- > include/drm/drm_of.h | 1 + > include/drm/tinydrm/tinydrm-helpers.h | 1 - > 5 files changed, 47 insertions(+), 42 deletions(-) > > diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c > index 8dafbdf..d878d3a 100644 > --- a/drivers/gpu/drm/drm_of.c > +++ b/drivers/gpu/drm/drm_of.c > @@ -1,6 +1,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -260,3 +261,46 @@ int drm_of_find_panel_or_bridge(const struct > device_node *np, > return ret; > } > EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); > + > +/** > + * drm_of_find_backlight - Find backlight device in device-tree > + * @dev: Device > + * > + * This function looks for a DT node pointed to by a property named > 'backlight' > + * and uses of_find_backlight_by_node() to get the backlight device. > + * Additionally if the brightness property is zero, it is set to > + * max_brightness. > + * > + * Note: It is the responsibility of the caller to call put_device() when > + * releasing the resource. > + * > + * Returns: > + * NULL if there's no backlight property. > + * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight > device > + * is found. > + * If the backlight device is found, a pointer to the structure is > returned. > + */ > +struct backlight_device *drm_of_find_backlight(struct device *dev) > +{ > + struct backlight_device *backlight; > + struct device_node *np; > + > + np = of_parse_phandle(dev->of_node, "backlight", 0); > + if (!np) > + return NULL; > + > + backlight = of_find_backlight_by_node(np); > + of_node_put(np); > + > + if (!backlight) > + return ERR_PTR(-EPROBE_DEFER); > + > + if (!backlight->props.brightness) { > + backlight->props.brightness = backlight->props.max_brightness; > + DRM_DEBUG_KMS("Backlight brightness set to %d\n", > + backlight->props.brightness); > + } > + > + return backlight; > +} > +EXPORT_SYMBOL(drm_of_find_backlight); > diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c > b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c > index bd6cce0..cd4c6a5 100644 > --- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c > +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c > @@ -237,46 +237,6 @@ void tinydrm_xrgb_to_gray8(u8 *dst, void *vaddr, > struct drm_framebuffer *fb, > EXPORT_SYMBOL(tinydrm_xrgb_to_gray8); > /** > - * tinydrm_of_find_backlight - Find backlight device in device-tree > - * @dev: Device > - * > - * This function looks for a DT node pointed to by a property named > 'backlight' > - * and uses of_find_backlight_by_node() to get the backlight device. > - * Additionally if the brightness property is zero, it is set to > - * max_brightness. > - * > - * Returns: > - * NULL if there's no backlight property. > - * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight > device > - * is found. > - * If the backlight device is found, a pointer to the structure is > returned. > - */ > -struct backlight_device *tinydrm_of_find_backlight(struct device *dev) > -{ > - struct backlight_device *backlight; > - struct device_node *np; > - > - np = of_parse_phandle(dev->of_node, "backlight", 0); > - if (!np) > - return NULL; > - > - backlight = of_find_backlight_by_node(np); > - of_node_put(np); > - > - if (!backlight) > - return ERR_PTR(-EPROBE_DEFER); > - > - if (!backlight->props.brightness) {
Re: Re: [PATCH 05/33] drm/omap: partial workaround for DRA7 DMM errata i878
Hi Laurent, Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki On 2016-02-23 23:57, Laurent Pinchart wrote: > Hi Tomi, > > Thank you for the patch. > > On Friday 19 February 2016 11:47:40 Tomi Valkeinen wrote: >> Errata i878 says that MPU should not be used to access RAM and DMM at >> the same time. As it's not possible to prevent MPU accessing RAM, we >> need to access DMM via a proxy. >> >> This patch changes DMM driver to access DMM registers via sDMA. Instead >> of doing a normal readl/writel call to read/write a register, we use >> sDMA to copy 4 bytes from/to the DMM registers. >> >> This patch provides only a partial workaround for i878, as not only DMM >> register reads/writes are affected, but also accesses to the DMM mapped >> buffers (framebuffers, usually). > > Will this patch really improve the situation if the DMM mapping is accessed > anyway ? > >> Signed-off-by: Tomi Valkeinen >> --- >> Documentation/devicetree/bindings/arm/omap/dmm.txt | 3 +- >> drivers/gpu/drm/omapdrm/omap_dmm_priv.h| 8 ++ >> drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 141 +- >> 3 files changed, 149 insertions(+), 3 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/arm/omap/dmm.txt >> b/Documentation/devicetree/bindings/arm/omap/dmm.txt index >> 8bd6d0a238a8..e5fc2eb7f4da 100644 >> --- a/Documentation/devicetree/bindings/arm/omap/dmm.txt >> +++ b/Documentation/devicetree/bindings/arm/omap/dmm.txt >> @@ -8,7 +8,8 @@ translation for initiators which need contiguous dma bus >> addresses. >> >> Required properties: >> - compatible: Should contain "ti,omap4-dmm" for OMAP4 family >> -Should contain "ti,omap5-dmm" for OMAP5 and DRA7x family >> +Should contain "ti,omap5-dmm" for OMAP5 family >> +Should contain "ti,dra7-dmm" for DRA7x family > > Isn't it DRA7xx instead of DRA7x ? > >> - reg: Contains DMM register address range (base address and >> length) >> - interrupts: Should contain an interrupt-specifier for DMM_IRQ. >> - ti,hwmods:Name of the hwmod associated to DMM, which is typically > "dmm" >> diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_priv.h >> b/drivers/gpu/drm/omapdrm/omap_dmm_priv.h index 9f32a83ca507..4d292ba5bcca >> 100644 >> --- a/drivers/gpu/drm/omapdrm/omap_dmm_priv.h >> +++ b/drivers/gpu/drm/omapdrm/omap_dmm_priv.h >> @@ -155,10 +155,12 @@ struct refill_engine { >> >> struct dmm_platform_data { >> uint32_t cpu_cache_flags; >> +bool errata_i878_wa; >> }; >> >> struct dmm { >> struct device *dev; >> +u32 phys_base; >> void __iomem *base; >> int irq; >> >> @@ -189,6 +191,12 @@ struct dmm { >> struct list_head alloc_head; >> >> const struct dmm_platform_data *plat_data; >> + >> +bool dmm_workaround; >> +spinlock_t wa_lock; >> +u32 *wa_dma_data; >> +dma_addr_t wa_dma_handle; >> +struct dma_chan *wa_dma_chan; >> }; >> >> #endif >> diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c >> b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c index fe5260477b52..3ec5c6633585 >> 100644 >> --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c >> +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c >> @@ -19,6 +19,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -79,14 +80,124 @@ static const uint32_t reg[][4] = { >> DMM_PAT_DESCR__2, DMM_PAT_DESCR__3}, >> }; >> >> +static int dmm_dma_copy(struct dmm *dmm, u32 src, u32 dst) > > Anything wrong with using dma_addr_t ? Nothing wrong with the dma_addr_t. >> +{ >> +struct dma_device *dma_dev = dmm->wa_dma_chan->device; >> +struct dma_async_tx_descriptor *tx = NULL; > > No need to initialize tx to NULL. True. >> +enum dma_status status; >> +dma_cookie_t cookie; >> + >> +tx = dma_dev->device_prep_dma_memcpy(dmm->wa_dma_chan, dst, src, 4, 0); > > Given that you're transferring between an I/O mapped register and system > memory, I believe you should use dmaengine_prep_slave_single() instead, with > a > call to dmaengine_slave_config() to set the I/O mapped register physical > address. You will also need to request a slave DMA channel instead of a > memcpy > DMA channel. No, slave channel can not be used in this case as a slave channel would need hardware trigger to do the work and in this case we are not implementing DMA support for dmm, but we are using the DMA to read and write the registers due to the errata. The DMA setup (sDMA for example) is almost identical in both case with the exception that we don't have trigger configured for the memcpy type. > >> +if (!tx) { >> +dev_err(dmm->dev, "Failed to prepare DMA memcpy\n"); >> +return -EIO; >> +} >> + >> +cookie = tx->tx_submit(tx); >> +if (dma_submit_error(cookie)) { >> +dev_err(dmm->dev, "Failed to
Re: [PATCH] drm/armada: Remove unused #include
Den 29.09.2017 09.25, skrev Daniel Vetter: On Wed, Sep 27, 2017 at 01:38:46AM -0600, Haneen Mohammed wrote: Remove drmP.h as it is not needed anymore since nothing it defines is used in these files. Signed-off-by: Haneen Mohammed Applied, thanks. drivers/gpu/drm/armada/armada_fb.c uses DRM_ERROR() which is defined in include/drm/drmP.h. Doesn't that warrant an inclusion? Noralf. -Daniel --- drivers/gpu/drm/armada/armada_510.c | 1 - drivers/gpu/drm/armada/armada_drv.c | 1 - drivers/gpu/drm/armada/armada_fb.c| 1 - drivers/gpu/drm/armada/armada_fbdev.c | 1 - drivers/gpu/drm/armada/armada_gem.c | 1 - 5 files changed, 5 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_510.c b/drivers/gpu/drm/armada/armada_510.c index ad3d2eb..41a784f 100644 --- a/drivers/gpu/drm/armada/armada_510.c +++ b/drivers/gpu/drm/armada/armada_510.c @@ -9,7 +9,6 @@ */ #include #include -#include #include #include "armada_crtc.h" #include "armada_drm.h" diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index c993bcc..17bb675 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include "armada_crtc.h" diff --git a/drivers/gpu/drm/armada/armada_fb.c b/drivers/gpu/drm/armada/armada_fb.c index 51839c1..a38d5a0 100644 --- a/drivers/gpu/drm/armada/armada_fb.c +++ b/drivers/gpu/drm/armada/armada_fb.c @@ -5,7 +5,6 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -#include #include #include #include "armada_drm.h" diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c index cf6bad1..a2ce83f 100644 --- a/drivers/gpu/drm/armada/armada_fbdev.c +++ b/drivers/gpu/drm/armada/armada_fbdev.c @@ -10,7 +10,6 @@ #include #include -#include #include #include "armada_crtc.h" #include "armada_drm.h" diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c index 49d40aa..190280e 100644 --- a/drivers/gpu/drm/armada/armada_gem.c +++ b/drivers/gpu/drm/armada/armada_gem.c @@ -8,7 +8,6 @@ #include #include #include -#include #include "armada_drm.h" #include "armada_gem.h" #include -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 1/2] drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
Den 29.09.2017 14.20, skrev Meghana Madhyastha: On Fri, Sep 29, 2017 at 02:10:31PM +0200, Noralf Trønnes wrote: Den 29.09.2017 05.22, skrev Meghana Madhyastha: On Thu, Sep 28, 2017 at 06:02:27PM +0200, Noralf Trønnes wrote: Den 28.09.2017 16.08, skrev Daniel Vetter: On Thu, Sep 28, 2017 at 02:44:34PM +0530, Meghana Madhyastha wrote: Rename tinydrm_of_find_backlight to drm_of_find_backlight and move it into drm_of.c from tinydrm-helpers.c. This is because other drivers in the drm subsystem might need to call this function. In that case and otherwise, it is better from an organizational point of view to move it into drm_of.c along with the other _of.c functions. Signed-off-by: Meghana Madhyastha --- Changes in v3: -Change it back to a single patch from two patches in v2 drivers/gpu/drm/drm_of.c | 44 ++ drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 --- drivers/gpu/drm/tinydrm/mi0283qt.c | 3 +- include/drm/drm_of.h | 1 + include/drm/tinydrm/tinydrm-helpers.h | 1 - 5 files changed, 47 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 8dafbdf..d878d3a 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -260,3 +261,46 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, return ret; } EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); + +/** + * drm_of_find_backlight - Find backlight device in device-tree + * @dev: Device + * + * This function looks for a DT node pointed to by a property named 'backlight' + * and uses of_find_backlight_by_node() to get the backlight device. + * Additionally if the brightness property is zero, it is set to + * max_brightness. + * + * Note: It is the responsibility of the caller to call put_device() when + * releasing the resource. + * + * Returns: + * NULL if there's no backlight property. + * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device + * is found. + * If the backlight device is found, a pointer to the structure is returned. + */ +struct backlight_device *drm_of_find_backlight(struct device *dev) +{ + struct backlight_device *backlight; + struct device_node *np; + + np = of_parse_phandle(dev->of_node, "backlight", 0); + if (!np) + return NULL; + + backlight = of_find_backlight_by_node(np); + of_node_put(np); + + if (!backlight) + return ERR_PTR(-EPROBE_DEFER); + + if (!backlight->props.brightness) { + backlight->props.brightness = backlight->props.max_brightness; + DRM_DEBUG_KMS("Backlight brightness set to %d\n", + backlight->props.brightness); + } + + return backlight; +} +EXPORT_SYMBOL(drm_of_find_backlight); diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c index bd6cce0..cd4c6a5 100644 --- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c @@ -237,46 +237,6 @@ void tinydrm_xrgb_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, EXPORT_SYMBOL(tinydrm_xrgb_to_gray8); /** - * tinydrm_of_find_backlight - Find backlight device in device-tree - * @dev: Device - * - * This function looks for a DT node pointed to by a property named 'backlight' - * and uses of_find_backlight_by_node() to get the backlight device. - * Additionally if the brightness property is zero, it is set to - * max_brightness. - * - * Returns: - * NULL if there's no backlight property. - * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device - * is found. - * If the backlight device is found, a pointer to the structure is returned. - */ -struct backlight_device *tinydrm_of_find_backlight(struct device *dev) -{ - struct backlight_device *backlight; - struct device_node *np; - - np = of_parse_phandle(dev->of_node, "backlight", 0); - if (!np) - return NULL; - - backlight = of_find_backlight_by_node(np); - of_node_put(np); - - if (!backlight) - return ERR_PTR(-EPROBE_DEFER); - - if (!backlight->props.brightness) { - backlight->props.brightness = backlight->props.max_brightness; - DRM_DEBUG_KMS("Backlight brightness set to %d\n", - backlight->props.brightness); - } - - return backlight; -} -EXPORT_SYMBOL(tinydrm_of_find_backlight); - -/** * tinydrm_enable_backlight - Enable backlight helper * @backlight: Backlight device * diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c index 7e5bb7d..5e3d635 100644 --- a/drivers/gpu/drm/tinydrm/mi0283qt.c +++ b/drivers/gpu/drm/tinydrm/m
Re: [PATCH] dma-fence: fix dma_fence_get_rcu_safe
On Wed, 2017-09-20 at 20:20 +0200, Daniel Vetter wrote: > On Mon, Sep 11, 2017 at 01:06:32PM +0200, Christian König wrote: > > Am 11.09.2017 um 12:01 schrieb Chris Wilson: > > > [SNIP] > > > > Yeah, but that is illegal with a fence objects. > > > > > > > > When anybody allocates fences this way it breaks at least > > > > reservation_object_get_fences_rcu(), > > > > reservation_object_wait_timeout_rcu() and > > > > reservation_object_test_signaled_single(). > > > > > > Many, many months ago I sent patches to fix them all. > > > > Found those after a bit a searching. Yeah, those patches where proposed more > > than a year ago, but never pushed upstream. > > > > Not sure if we really should go this way. dma_fence objects are shared > > between drivers and since we can't judge if it's the correct fence based on > > a criteria in the object (only the read counter which is outside) all > > drivers need to be correct for this. > > > > I would rather go the way and change dma_fence_release() to wrap > > fence->ops->release into call_rcu() to keep the whole RCU handling outside > > of the individual drivers. > > Hm, I entirely dropped the ball on this, I kinda assumed that we managed > to get some agreement on this between i915 and dma_fence. Adding a pile > more people. > > Joonas, Tvrtko, I guess we need to fix this one way or the other. I definitely didn't get the memo or notice this before. Tvrtko/Chris? Regars, Joonas -- Joonas Lahtinen Open Source Technology Center Intel Corporation ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 2/2] drm/tinydrm: Add devres versions of drm_of_find_backlight
On Fri, Sep 29, 2017 at 02:20:16PM +0200, Noralf Trønnes wrote: > > Den 29.09.2017 05.17, skrev Meghana Madhyastha: > >On Thu, Sep 28, 2017 at 06:19:35PM +0200, Noralf Trønnes wrote: > >>Den 28.09.2017 11.15, skrev Meghana Madhyastha: > >>>Add devm_drm_of_find_backlight and the corresponding release > >>>function because some drivers such as tinydrm use devres versions > >>>of functions for requiring device resources. > >>> > >>>Signed-off-by: Meghana Madhyastha > >>>--- > >>>Changes in v3: > >>>-None > >>> > >>> drivers/gpu/drm/drm_of.c | 48 > >>> > >>> include/drm/drm_of.h | 2 ++ > >>> 2 files changed, 50 insertions(+) > >>> > >>>diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c > >>>index d878d3a..238e8e5 100644 > >>>--- a/drivers/gpu/drm/drm_of.c > >>>+++ b/drivers/gpu/drm/drm_of.c > >>>@@ -304,3 +304,51 @@ struct backlight_device *drm_of_find_backlight(struct > >>>device *dev) > >>> return backlight; > >>> } > >>> EXPORT_SYMBOL(drm_of_find_backlight); > >>>+ > >>>+/** > >>>+ * devm_drm_of_find_backlight_release - Release backlight device > >>>+ * @dev: Device > >>>+ * > >>>+ * This is the release function corresponding to the > >>>devm_drm_of_find_backlight. > >>>+ * Each devres entry is associated with a release function. > >>>+ */ > >>This is an internal function so no need for docs or exporting. I know > >>that some devm_ functions have explicit release functions, but I don't > >>think this is necessary since those users can just use > >>drm_of_find_backlight() directly instead. > >I have a question here. devm_drm_of_find_backlight_release is a > >wrapper around put_device which is passed as a parameter to > >devm_add_action in devm_drm_of_find_backlight. So isn't the function > >useful here ? > > We need the function for devm_add_action(), but no one outside of this file > needs > it. Hence the static definition. > > We can't use put_device directly: > ret = devm_add_action(dev, put_device, > &backlight->dev); > because devm_add_action expects an argument like this: void (*action)(void > *) > and put_device is: void put_device(struct device *dev) > They differ in their argument type: void * vs. struct device * > The compiler would complain. > > So we need a wrapper. Yes this is what I thought. Okay, I misunderstood your previous suggestion as removing the release function entirely which is why I asked my question. Now it makes sense and I understood. Thanks for the clarifications. Regards, Meghana > >>>+static void devm_drm_of_find_backlight_release(void *data) > >>>+{ > >>>+ put_device(data); > >>>+} > >>>+EXPORT_SYMBOL(devm_drm_of_find_backlight_release); > >>>+ > >>>+/** > >>>+ * devm_drm_of_find_backlight - Find backlight device in device-tree > >>>+ * devres version of the function > >>>+ * @dev: Device > >>>+ * > >>>+ * This is the devres version of the function drm_of_find_backlight. > >>>+ * Some drivers such as tinydrm use devres versions of functions for > >>No need to mention tinydrm here. > >> > >>>+ * requiring device resources. > >>>+ * > >>>+ * Returns: > >>>+ * NULL if there's no backlight property. > >>>+ * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight > >>>device > >>>+ * is found. > >>>+ * If the backlight device is found, a pointer to the structure is > >>>returned. > >>>+ */ > >>>+struct backlight_device *devm_drm_of_find_backlight(struct device *dev) > >>>+{ > >>>+ struct backlight_device *backlight; > >>>+ int ret; > >>>+ > >>>+ backlight = drm_of_find_backlight(dev); > >>>+ if (IS_ERR_OR_NULL(backlight)) > >>>+ return backlight; > >>>+ > >>>+ ret = devm_add_action(dev, devm_drm_of_find_backlight_release, > >>>+&backlight->dev); > >>>+ if (ret) { > >>>+ put_device(&backlight->dev); > >>>+ return ERR_PTR(ret); > >>>+ } > >>>+ > >>>+ return backlight; > >>>+} > >>>+EXPORT_SYMBOL(devm_drm_of_find_backlight); > >>>diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h > >>>index e8fba5b..071fb3b 100644 > >>>--- a/include/drm/drm_of.h > >>>+++ b/include/drm/drm_of.h > >>>@@ -30,7 +30,9 @@ int drm_of_find_panel_or_bridge(const struct device_node > >>>*np, > >>> struct drm_panel **panel, > >>> struct drm_bridge **bridge); > >>> struct backlight_device *drm_of_find_backlight(struct device *dev); > >>>+struct backlight_device *devm_drm_of_find_backlight(struct device *dev); > >>> #else > >>We need a dummy version of devm_drm_of_find_backlight() here that > >>returns NULL as in the previous patch. > >> > >>>+static void devm_drm_of_find_backlight_release(void *data); > >>And this isn't needed as explained above. > >>> static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, > >>> struct device_node *port) > >>> { > >>I'd appreciate if you could also switch mi0283qt over to th
Re: [PATCH 3/3] drm/amdgpu: add FENCE_TO_HANDLE ioctl that returns syncobj or sync_file
On Fri, Sep 29, 2017 at 1:42 AM, Dave Airlie wrote: > On 29 September 2017 at 06:41, Marek Olšák wrote: >> Can I get Rb for this series? >> > > For the series, > > Reviewed-by: Dave Airlie > > Alex, please merge the two drm core precursor with patch 3. Alex, this is for drm-next, where I can't push. Thanks, Marek ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 0/3] Simplify panel bridge cleanup
The goal of this series is to simplify driver code when they need to clean up a previously allocated panel bridge. Few drivers have "is_panel_bridge" flag to be able to distinguish a drm_panel_bridge from "simple" drm_bridge. To remove this flag I propose to - let drm_panel_bridge_remove() check if the bridge provided in parameter is really a drm_panel_bridge. - add drm_of_panel_bridge_remove() to remove a bridge given DT port and endpoint Finally that allow to remove drm_bridge structure and "is_panel_bridge" flag from stm driver internal structure. Benjamin Gaignard (3): drm/bridge: make drm_panel_bridge_remove more robust drm/drm_of: add drm_of_panel_bridge_remove function drm/stm: ltdc: remove bridge from driver internal structure drivers/gpu/drm/bridge/panel.c | 10 +- drivers/gpu/drm/drm_of.c | 33 + drivers/gpu/drm/stm/ltdc.c | 16 +--- drivers/gpu/drm/stm/ltdc.h | 2 -- include/drm/drm_of.h | 8 5 files changed, 55 insertions(+), 14 deletions(-) -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/3] drm/drm_of: add drm_of_panel_bridge_remove function
This function is the pendant of drm_of_find_panel_or_bridge() to remove a previously allocated panel_bridge. Given a specific port and endpoint it remove the panel bridge. Since drm_panel_bridge_remove() will check that bridge parameter is not NULL and is a real drm_panel_bridge and no a simple bridge it is safe to call it directly. Signed-off-by: Benjamin Gaignard --- drivers/gpu/drm/drm_of.c | 33 + include/drm/drm_of.h | 8 2 files changed, 41 insertions(+) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 8dafbdf..6b54f17 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -260,3 +260,36 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, return ret; } EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); + +#ifdef CONFIG_DRM_PANEL_BRIDGE +/* + * drm_of_panel_bridge_remove - remove panel bridge + * @np: device tree node containing panel bridge output ports + * + * Remove the panel bridge of a given DT node's port and endpoint number + * + * Returns zero if successful, or one of the standard error codes if it fails. + */ +int drm_of_panel_bridge_remove(const struct device_node *np, + int port, int endpoint) +{ + struct drm_bridge *bridge; + struct device_node *remote; + + remote = of_graph_get_remote_node(np, port, endpoint); + if (!remote) + return -ENODEV; + + bridge = of_drm_find_bridge(remote); + drm_panel_bridge_remove(bridge); + + return 0; +} +#else +int drm_of_panel_bridge_remove(const struct device_node *np, + int port, int endpoint) +{ + return -EINVAL; +} +#endif +EXPORT_SYMBOL_GPL(drm_of_panel_bridge_remove); diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 104dd51..390966e 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -29,6 +29,8 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, int port, int endpoint, struct drm_panel **panel, struct drm_bridge **bridge); +int drm_of_panel_bridge_remove(const struct device_node *np, + int port, int endpoint); #else static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, struct device_node *port) @@ -65,6 +67,12 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np, { return -EINVAL; } + +static inline int drm_of_panel_bridge_remove(const struct device_node *np, +int port, int endpoint) +{ + return -EINVAL; +} #endif static inline int drm_of_encoder_active_endpoint_id(struct device_node *node, -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 3/3] drm/stm: ltdc: remove bridge from driver internal structure
With a call to drm_of_panel_bridge_remove() we could remove the bridge without store it in ldtc internal driver structure. Signed-off-by: Benjamin Gaignard --- drivers/gpu/drm/stm/ltdc.c | 16 +--- drivers/gpu/drm/stm/ltdc.h | 2 -- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index d394a03..735c908 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -791,9 +791,8 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = { .destroy = drm_encoder_cleanup, }; -static int ltdc_encoder_init(struct drm_device *ddev) +static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge) { - struct ltdc_device *ldev = ddev->dev_private; struct drm_encoder *encoder; int ret; @@ -807,7 +806,7 @@ static int ltdc_encoder_init(struct drm_device *ddev) drm_encoder_init(ddev, encoder,bridge, NULL); + ret = drm_bridge_attach(encoder, bridge, NULL); if (ret) { drm_encoder_cleanup(encoder); return -EINVAL; @@ -936,12 +935,9 @@ int ltdc_load(struct drm_device *ddev) ret = PTR_ERR(bridge); goto err; } - ldev->is_panel_bridge = true; } - ldev->bridge = bridge; - - ret = ltdc_encoder_init(ddev); + ret = ltdc_encoder_init(ddev, bridge); if (ret) { DRM_ERROR("Failed to init encoder\n"); goto err; @@ -972,8 +968,7 @@ int ltdc_load(struct drm_device *ddev) return 0; err: - if (ldev->is_panel_bridge) - drm_panel_bridge_remove(bridge); + drm_panel_bridge_remove(bridge); clk_disable_unprepare(ldev->pixel_clk); @@ -986,8 +981,7 @@ void ltdc_unload(struct drm_device *ddev) DRM_DEBUG_DRIVER("\n"); - if (ldev->is_panel_bridge) - drm_panel_bridge_remove(ldev->bridge); + drm_of_panel_bridge_remove(ddev->dev->of_node, 0, 0); clk_disable_unprepare(ldev->pixel_clk); } diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h index bc6d6f6..ae43755 100644 --- a/drivers/gpu/drm/stm/ltdc.h +++ b/drivers/gpu/drm/stm/ltdc.h @@ -24,8 +24,6 @@ struct ltdc_device { struct drm_fbdev_cma *fbdev; void __iomem *regs; struct clk *pixel_clk; /* lcd pixel clock */ - struct drm_bridge *bridge; - bool is_panel_bridge; struct mutex err_lock; /* protecting error_status */ struct ltdc_caps caps; u32 error_status; -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/3] drm/bridge: make drm_panel_bridge_remove more robust
Make sure that bridge parameter is not NULL and can be safely cast into a panel_bridge structure. Signed-off-by: Benjamin Gaignard --- drivers/gpu/drm/bridge/panel.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index e0cca19..6d99d4a 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -188,7 +188,15 @@ EXPORT_SYMBOL(drm_panel_bridge_add); */ void drm_panel_bridge_remove(struct drm_bridge *bridge) { - struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge); + struct panel_bridge *panel_bridge; + + if (!bridge) + return; + + if (bridge->funcs != &panel_bridge_bridge_funcs) + return; + + panel_bridge = drm_bridge_to_panel_bridge(bridge); drm_bridge_remove(bridge); devm_kfree(panel_bridge->panel->dev, bridge); -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH hwc v2 1/6] drm_hwcomposer: Remove threading
On Fri, 2017-09-29 at 17:07 +0800, Chih-Wei Huang wrote: > 2017-09-29 16:44 GMT+08:00 Robert Foss : > > On Fri, 2017-09-29 at 13:49 +0800, Chih-Wei Huang wrote: > > > 2017-09-29 5:29 GMT+08:00 Rob Herring : > > > > Perhaps just leave the current state as a separate branch. > > > > > > Did you mean we maintain the branch in our repo? > > > (that's what we do now, but I hope to avoid that) > > > > > > Or fd.o could help to maintain the two branches (HWC1 and HWC2)? > > > > Android later than O will not support HWC1 (as far as I understand > > it), > > so HWC2 is the way forward. > > If all x86 GPUs we want to support > can work with drm_hwcomposer, > I'm happy to switch to HWC2. > However it seems impossible at this moment. :( > > > Furthermore I think targeting aosp/master at all time is the right > > thing to do for drm_hwcomposer. > > > > I for one am less than keen on maintaining branch that is > > incompatible > > with aosp/master upstream. > > > > Ideally we wouldn't maintain a compile time switch either, not on > > principle but because of the development overhead it causes. > > We have very finite resources contributing to drm_hwcomposer. > > If it was cheap&&easy to support old Android versions we should, > > but I > > don't think it is. > > My point is not to support old Android versions, > but to support old(?) GPUs that can't work with drm_hwcomposer. > If some GPU (which supports fences and atomic) does not work on drm_hwcomposer, I would consider that a bug. So the idea would be to fix it, and fixing it would prevent you from having any issues with HWC2 being the only supported API as far as I understand our IRC chat. Rob. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/exynos: fimc: enable autosuspend for runtime PM
Signed-off-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 1c48c57381f1..bffb4b513453 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c @@ -1009,7 +1009,8 @@ static irqreturn_t fimc_irq_handler(int irq, void *dev_id) struct exynos_drm_ipp_task *task = ctx->task; ctx->task = NULL; - pm_runtime_put(ctx->dev); + pm_runtime_mark_last_busy(ctx->dev); + pm_runtime_put_autosuspend(ctx->dev); exynos_drm_ipp_task_done(task, 0); } @@ -1158,7 +1159,8 @@ static void fimc_abort(struct exynos_drm_ipp *ipp, struct exynos_drm_ipp_task *task = ctx->task; ctx->task = NULL; - pm_runtime_put(ctx->dev); + pm_runtime_mark_last_busy(ctx->dev); + pm_runtime_put_autosuspend(ctx->dev); exynos_drm_ipp_task_done(task, -EIO); } } @@ -1329,6 +1331,8 @@ static int fimc_probe(struct platform_device *pdev) spin_lock_init(&ctx->lock); platform_set_drvdata(pdev, ctx); + pm_runtime_use_autosuspend(dev); + pm_runtime_set_autosuspend_delay(dev, 2000); pm_runtime_enable(dev); ret = component_add(dev, &fimc_component_ops); @@ -1340,6 +1344,7 @@ static int fimc_probe(struct platform_device *pdev) return 0; err_pm_dis: + pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); fimc_put_clocks(ctx); @@ -1352,6 +1357,7 @@ static int fimc_remove(struct platform_device *pdev) struct fimc_context *ctx = get_fimc_context(dev); component_del(dev, &fimc_component_ops); + pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); fimc_put_clocks(ctx); -- 2.13.5 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 0/9] Exynos DRM: rewrite IPP subsystem and userspace API
Hello Marek, I just tested this series, and I noticed a lot of these lines: > exynos-sysmmu 11a4.sysmmu: restoring state > exynos-sysmmu 11a4.sysmmu: saving state I guess it would make sense to enable autosuspend for runtime PM in each of the hw drivers. I've just send a patch that does it for the FIMC (the only hw I can test this on). This improves frame time stability for me. With best wishes, Tobias Marek Szyprowski wrote: > Dear all, > > This patchset performs complete rewrite of Exynos DRM IPP subsystem and > its userspace API. > > Why such rewrite is needed? Exynos DRM IPP API is over-engineered in > general, but not really extensible on the other side. It is also buggy, > with significant design flaws: > - Userspace API covers memory-2-memory picture operations together with > CRTC writeback and duplicating features, which belongs to video plane. > - Lack of support of the all required image formats (for example NV12 > Samsung-tiled cannot be used due to lack of pixel format modifier > support). > - Userspace API designed only to mimic hardware behaviour, not easy to > understand. > - Lack of proper input validation in the core, drivers also didn't do that > correctly, so it was possible to set incorrect parameters and easil > trigger IOMMU fault or memory trash. > - Drivers were partially disfunctional or supported only a subset of modes. > > Due to the above limitations and issues the Exynos DRM IPP API was not > used by any of the open-source projects. I assume that it is safe to remove > this broken API without any damage to open-source community. All remaining > users (mainly Tizen project related) will be updated to the new version. > > This patchset changes Exynos DRM IPP subsystem to something useful. The > userspace API is much simpler, state-less and easy to understand. Also > the code of the core and driver is significantly smaller and easier to > understand. > > Patches were tested on Exynos4412 based Odroid U3 and Exynos5422 > Odroid XU3 boards, on top of Linux next-20170928 kernel. > > Best regards > Marek Szyprowski > Samsung R&D Institute Poland > > > Changelog: > > v2: > - fixed minor issues pointed by other developers: > * fixed possible null pointer dereferrence (Tobias) > * changed limits_size to limits_count (Tobias) > * renamed struct exynos_drm_ipp_format to drm_exynos_ipp_format (Andrzej) > * added proper return value from exynos_drm_ipp_get_res_ioctl when no IPP > driver is present (Andrzej) > * properly aligned all uapi structures to be 32/64 bit safe (Emil) > * properly initialize all strucutres > - added new Exynos Scaler driver from Andrzej Pietrasiewicz > > v1: https://www.spinics.net/lists/linux-samsung-soc/msg60492.html > - initial version of IPP v2 > > My previous works in this area: > > "[RFC v2 0/2] Exynos DRM: add Picture Processor extension" > https://www.spinics.net/lists/dri-devel/msg140669.html > - removed usage of DRM objects and properties - replaced them with simple > list of parameters with predefined IDs > > "[RFC 0/4] Exynos DRM: add Picture Processor extension" > https://www.spinics.net/lists/linux-samsung-soc/msg59323.html > - moved this feature from DRM core to Exynos DRM driver > - changed name from framebuffer processor to picture processor > - simplified code to cover only things needed by Exynos drivers > - implemented simple fifo task scheduler > - cleaned up rotator driver conversion (removed IPP remainings) > > "[RFC 0/2] New feature: Framebuffer processors" > https://www.spinics.net/lists/linux-samsung-soc/msg54810.html > - generic approach implemented in DRM core, rejected > > > Patch summary: > > Andrzej Pietrasiewicz (3): > drm/exynos: Add driver for Exynos Scaler module > drivers: clk: samsung: Fix m2m scaler clock on Exynos542x > ARM: dts: exynos: Add mem-2-mem Scaler devices > > Marek Szyprowski (6): > drm/exynos: ipp: Remove Exynos DRM IPP subsystem > drm/exynos: ipp: Add IPP v2 framework > drm/exynos: rotator: Convert driver to IPP v2 core API > drm/exynos: gsc: Convert driver to IPP v2 core API > drm/exynos: Add generic support for devices shared with V4L2 subsystem > drm/exynos: fimc: Convert driver to IPP v2 core API > > .../devicetree/bindings/gpu/samsung-scaler.txt | 25 + > arch/arm/boot/dts/exynos5420.dtsi | 35 + > drivers/clk/samsung/clk-exynos5420.c |2 +- > drivers/gpu/drm/exynos/Kconfig | 18 +- > drivers/gpu/drm/exynos/Makefile|1 + > drivers/gpu/drm/exynos/exynos_drm_drv.c| 36 +- > drivers/gpu/drm/exynos/exynos_drm_drv.h|5 +- > drivers/gpu/drm/exynos/exynos_drm_fimc.c | 893 +++- > drivers/gpu/drm/exynos/exynos_drm_fimc.h | 23 - > drivers/gpu/drm/exynos/exynos_drm_gsc.c| 853 ++-- > drivers/gpu/drm/exynos/exynos_drm_gsc.h| 24 - > drivers/gpu/drm/exynos/exynos_drm_