[PATCH] drm/vmwgfx/ttm: fix the non-THP cleanup path.
From: Dave Airlie I fixed the init path, but missed the cleanup path. Fixes: e0830704de7c ("drm/vmwgfx: takedown vram manager") Signed-off-by: Dave Airlie --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index a68ae0204bf5..2c4858ea89b1 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -639,7 +639,7 @@ static void vmw_vram_manager_fini(struct vmw_private *dev_priv) #ifdef CONFIG_TRANSPARENT_HUGEPAGE vmw_thp_fini(dev_priv); #else - ttm_bo_man_fini(&dev_priv->bdev, TTM_PL_VRAM); + ttm_range_man_fini(&dev_priv->bdev, TTM_PL_VRAM); #endif } -- 2.27.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[drm-tip:drm-tip 2191/2285] include/drm/ttm/ttm_bo_driver.h:644 ttm_bo_reserve() warn: inconsistent returns
tree: git://anongit.freedesktop.org/drm/drm-tip drm-tip head: 147f0d3f7239756494adef31518f87e60a970878 commit: 46bca88bbdd3046db31b8b7e053a909ae79e285b [2191/2285] drm/ttm/amdgpu: consolidate ttm reserve paths config: i386-randconfig-m021-20200809 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot New smatch warnings: include/drm/ttm/ttm_bo_driver.h:644 ttm_bo_reserve() warn: inconsistent returns '*bo->base.resv'. include/drm/ttm/ttm_bo_driver.h:644 ttm_bo_reserve() warn: inconsistent returns '*bo->base.resv'. include/drm/ttm/ttm_bo_driver.h:644 ttm_bo_reserve() warn: inconsistent returns '*bo->base.resv'. include/drm/ttm/ttm_bo_driver.h:644 ttm_bo_reserve() warn: inconsistent returns '*bo->base.resv'. include/drm/ttm/ttm_bo_driver.h:644 ttm_bo_reserve() warn: inconsistent returns '*bo->base.resv'. include/drm/ttm/ttm_bo_driver.h:644 ttm_bo_reserve() warn: inconsistent returns '*bo->base.resv'. include/drm/ttm/ttm_bo_driver.h:644 ttm_bo_reserve() warn: inconsistent returns '*bo->base.resv'. include/drm/ttm/ttm_bo_driver.h:644 ttm_bo_reserve() warn: inconsistent returns '*bo->base.resv'. include/drm/ttm/ttm_bo_driver.h:644 ttm_bo_reserve() warn: inconsistent returns '*bo->base.resv'. include/drm/ttm/ttm_bo_driver.h:644 ttm_bo_reserve() warn: inconsistent returns '*bo->base.resv'. Old smatch warnings: drivers/gpu/drm/ttm/ttm_bo_vm.c:227 ttm_bo_vm_insert_huge() warn: was '== 2048' instead of '=' drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:737 amdgpu_gem_op_ioctl() warn: should 'robj->tbo.mem.page_alignment << 12' be a 64 bit type? drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:546 amdgpu_dma_buf_move_notify() error: double unlocked '*resv' (orig line 525) drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:166 amdgpu_gfx_parse_disable_cu() warn: potential spectre issue 'mask' [w] drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:5062 gfx_v8_0_pre_soft_reset() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1013 amdgpu_dm_fini() error: we previously assumed 'adev->dm.dc' could be null (see line 1010) drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1024 amdgpu_dm_fini() warn: variable dereferenced before check 'adev->dm.dc' (see line 1013) drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4545 create_stream_for_sink() error: we previously assumed 'aconnector->dc_sink' could be null (see line 4436) drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:266 amdgpu_bo_create_reserved() error: we previously assumed '*bo_ptr' could be null (see line 256) drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:645 amdgpu_bo_create_shadow() error: we previously assumed 'bo->shadow' could be null (see line 632) drivers/gpu/drm/nouveau/nouveau_bo.c:430 nouveau_bo_pin() warn: should '1 << bo->mem.mem_type' be a 64 bit type? drivers/gpu/drm/nouveau/nouveau_bo.c:884 nv50_bo_move_m2mf() warn: should 'new_reg->num_pages << 12' be a 64 bit type? drivers/gpu/drm/nouveau/nouveau_bo.c:1260 nouveau_bo_move_ntfy() warn: should 'new_reg->start << 12' be a 64 bit type? drivers/gpu/drm/nouveau/nouveau_bo.c:1274 nouveau_bo_vm_bind() warn: should 'new_reg->start << 12' be a 64 bit type? drivers/gpu/drm/nouveau/nouveau_gem.c:246 nouveau_gem_info() warn: should 'nvbo->bo.mem.num_pages << 12' be a 64 bit type? vim +644 include/drm/ttm/ttm_bo_driver.h eba67093f53532 Thomas Hellstrom 2010-11-11 600 3482032457f50c Maarten Lankhorst 2013-06-27 601 /** 46bca88bbdd304 Dave Airlie 2020-08-04 602 * ttm_bo_reserve: 3482032457f50c Maarten Lankhorst 2013-06-27 603 * 3482032457f50c Maarten Lankhorst 2013-06-27 604 * @bo: A pointer to a struct ttm_buffer_object. 3482032457f50c Maarten Lankhorst 2013-06-27 605 * @interruptible: Sleep interruptible if waiting. 3482032457f50c Maarten Lankhorst 2013-06-27 606 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. dfd5e50ea43ca4 Christian König 2016-04-06 607 * @ticket: ticket used to acquire the ww_mutex. 3482032457f50c Maarten Lankhorst 2013-06-27 608 * 46bca88bbdd304 Dave Airlie 2020-08-04 609 * Locks a buffer object for validation. (Or prevents other processes from 46bca88bbdd304 Dave Airlie 2020-08-04 610 * locking it for validation), while taking a number of measures to prevent 46bca88bbdd304 Dave Airlie 2020-08-04 611 * deadlocks. 3482032457f50c Maarten Lankhorst 2013-06-27 612 * 3482032457f50c Maarten Lankhorst 2013-06-27 613 * Returns: 3482032457f50c Maarten Lankhorst 2013-06-27 614 * -EDEADLK: The re
[drm-tip:drm-tip 2214/2285] drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:646:2: error: implicit declaration of function 'ttm_bo_man_fini'
tree: git://anongit.freedesktop.org/drm/drm-tip drm-tip head: 147f0d3f7239756494adef31518f87e60a970878 commit: e0830704de7c06c72b1f83a3f67cb160b853812a [2214/2285] drm/vmwgfx: takedown vram manager config: x86_64-randconfig-r004-20200810 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 3a34228bff6fdf45b50cb57cf5fb85d659eeb672) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu git checkout e0830704de7c06c72b1f83a3f67cb160b853812a # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): >> drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:646:2: error: implicit declaration of >> function 'ttm_bo_man_fini' [-Werror,-Wimplicit-function-declaration] ttm_bo_man_fini(&dev_priv->bdev, ^ drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:646:2: note: did you mean 'ttm_range_man_fini'? include/drm/ttm/ttm_bo_driver.h:869:5: note: 'ttm_range_man_fini' declared here int ttm_range_man_fini(struct ttm_bo_device *bdev, ^ 1 error generated. vim +/ttm_bo_man_fini +646 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c 640 641 static void vmw_vram_manager_fini(struct vmw_private *dev_priv) 642 { 643 #ifdef CONFIG_TRANSPARENT_HUGEPAGE 644 vmw_thp_fini(dev_priv); 645 #else > 646 ttm_bo_man_fini(&dev_priv->bdev, 647 &dev_priv->bdev.man[TTM_PL_VRAM]); 648 #endif 649 } 650 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 201539] AMDGPU R9 390 automatic fan speed control in Linux 4.19/4.20/5.0
https://bugzilla.kernel.org/show_bug.cgi?id=201539 --- Comment #56 from Sean Birkholz (supas...@hotmail.com) --- I was going to try and get a fancontrol script working, but I found the following as I started to play around: I got my results on Arch Linux's 5.7.12-arch1-1 kernel. On boot pwm1_enable is set to 1 (manual mode). On 4.18.x it is normally set to 2 (automatic mode) iirc. Changing this value to 2 does essentially nothing for me and the fans do not spin up with increasing temp. However, I've found that running pwmconfig and not even answering the first question (ie; I can just ctrl+c out) causes the automatic temp control to start functioning. So after you run pwmconfig, then change pwm1_enable to 2 and everything works again. So far it appears doing these two things gets me the same functionality I had on 4.18.x and I can finally upgrade my kernel. No fan control script needed. It is interesting to note, if you do these in the opposite order; set pwm1_enable to 2 and then run pwmconfig, you must say yes to enabling manual mode on the gpu's fan before they start functioning properly. This also causes the fan to run full speed (like pwm1_enable is set to 0) and you will need to set 2 in pwm1_enable again. I dont know what pwmconfig is modifying to cause pwm to work again... I wish i knew so I could set that up with a script and not have to manually start it, but this is good enough for now as I reboot rarely. Maybe I can make a script to use with systemctl when I'm not lazy. -- You are receiving this mail because: You are watching the assignee of the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/7] drm: rcar-du: Add r8a7742 support
Hi Prabhakar, On Sun, Aug 09, 2020 at 09:38:05PM +0100, Lad, Prabhakar wrote: > On Sat, Aug 8, 2020 at 10:02 PM Laurent Pinchart wrote: > > On Fri, Aug 07, 2020 at 06:49:49PM +0100, Lad Prabhakar wrote: > > > Add direct support for the r8a7742 (RZ/G1H). > > > > > > The RZ/G1H shares a common, compatible configuration with the r8a7790 > > > (R-Car H2) so that device info structure is reused, the only difference > > > being TCON is unsupported on RZ/G1H (Currently unsupported by the driver). > > > > > > Signed-off-by: Lad Prabhakar > > > Reviewed-by: Marian-Cristian Rotariu > > > > > > --- > > > drivers/gpu/drm/rcar-du/rcar_du_drv.c | 5 +++-- > > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > > b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > > index 3e67cf70f040..7e286c7a7a6c 100644 > > > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > > @@ -216,8 +216,8 @@ static const struct rcar_du_device_info > > > rcar_du_r8a7790_info = { > > > .channels_mask = BIT(2) | BIT(1) | BIT(0), > > > .routes = { > > > /* > > > - * R8A7790 has one RGB output, two LVDS outputs and one > > > - * (currently unsupported) TCON output. > > > + * R8A7742 and R8A7790 each have one RGB output and two > > > LVDS outputs. Additionally > > > + * R8A7790 supports one TCON output (currently unsupported > > > by the driver). > > > > Once we support TCON we'll have to split this, but for now I suppose > > it's fine. Would you however mind wrapping this to 80 columns ? I can do > > so when applying if it's fine with you. > > Agreed once TCON is added this has to be split. But isn't the column > size has been increased (checkpatch too doesn't complain about), but It has, but it doesn't mean it's mandatory to increase line length :-) I think aligning with the style of the existing code should be favoured. > feel free to wrapp it for 80 columns. OK, I'll do that. > > Reviewed-by: Laurent Pinchart > > > > >*/ > > > [RCAR_DU_OUTPUT_DPAD0] = { > > > .possible_crtcs = BIT(2) | BIT(1) | BIT(0), > > > @@ -443,6 +443,7 @@ static const struct rcar_du_device_info > > > rcar_du_r8a7799x_info = { > > > }; > > > > > > static const struct of_device_id rcar_du_of_table[] = { > > > + { .compatible = "renesas,du-r8a7742", .data = &rcar_du_r8a7790_info > > > }, > > > { .compatible = "renesas,du-r8a7743", .data = &rzg1_du_r8a7743_info > > > }, > > > { .compatible = "renesas,du-r8a7744", .data = &rzg1_du_r8a7743_info > > > }, > > > { .compatible = "renesas,du-r8a7745", .data = &rzg1_du_r8a7745_info > > > }, -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/4] drm/panel: s6e63m0: Add DSI transport
This makes it possible to use the s6e63m0 panel with a DSI host, such as in the Samsung GT-I8190 (Golden) mobile phone. Cc: Stephan Gerhold Cc: Paweł Chmiel Signed-off-by: Linus Walleij --- drivers/gpu/drm/panel/Kconfig | 8 ++ drivers/gpu/drm/panel/Makefile| 1 + .../gpu/drm/panel/panel-samsung-s6e63m0-dsi.c | 128 ++ .../gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 2 +- drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 4 +- drivers/gpu/drm/panel/panel-samsung-s6e63m0.h | 4 +- 6 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 96e1548e475f..731e84c5a13b 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -343,6 +343,14 @@ config DRM_PANEL_SAMSUNG_S6E63M0_SPI Say Y here if you want to be able to access the Samsung S6E63M0 panel using SPI. +config DRM_PANEL_SAMSUNG_S6E63M0_DSI + tristate "Samsung S6E63M0 RGB DSI interface" + depends on DRM_MIPI_DSI + depends on DRM_PANEL_SAMSUNG_S6E63M0 + help + Say Y here if you want to be able to access the Samsung + S6E63M0 panel using DSI. + config DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01 tristate "Samsung AMS452EF01 panel with S6E88A0 DSI video mode controller" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 9cf71adfa794..14212cae3c29 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -35,6 +35,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0_SPI) += panel-samsung-s6e63m0-spi.o +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0_DSI) += panel-samsung-s6e63m0-dsi.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01) += panel-samsung-s6e88a0-ams452ef01.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c new file mode 100644 index ..f4927a6ce26d --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c @@ -0,0 +1,128 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * DSI interface to the Samsung S6E63M0 panel. + * (C) 2019 Linus Walleij + */ + +#include +#include +#include + +#include +#include + +#include "panel-samsung-s6e63m0.h" + +#define MCS_GLOBAL_PARAM 0xb0 +#define S6E63M0_DSI_MAX_CHUNK 15 /* CMD + 15 bytes max */ + +static int s6e63m0_dsi_dcs_write(struct device *dev, const u8 *data, size_t len) +{ + struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); + const u8 *seqp = data; + u8 cmd; + u8 cmdwritten; + int remain; + int chunk; + int ret; + + DRM_DEV_INFO(dev, "DSI writing dcs seq: %*ph\n", (int)len, data); + + /* Pick out and skip past the DCS command */ + cmd = *seqp; + seqp++; + cmdwritten = 0; + remain = len - 1; + chunk = remain; + + /* Send max S6E63M0_DSI_MAX_CHUNK bytes at a time */ + if (chunk > S6E63M0_DSI_MAX_CHUNK) + chunk = S6E63M0_DSI_MAX_CHUNK; + ret = mipi_dsi_dcs_write(dsi, cmd, seqp, chunk); + if (ret < 0) { + DRM_DEV_ERROR(dev, + "error sending DCS command seq cmd %02x\n", + cmd); + return ret; + } + cmdwritten += chunk; + seqp += chunk; + + while (cmdwritten < remain) { + chunk = remain - cmdwritten; + if (chunk > S6E63M0_DSI_MAX_CHUNK) + chunk = S6E63M0_DSI_MAX_CHUNK; + ret = mipi_dsi_dcs_write(dsi, MCS_GLOBAL_PARAM, &cmdwritten, 1); + if (ret < 0) { + DRM_DEV_ERROR(dev, + "error sending CMD %02x global param %02x\n", + cmd, cmdwritten); + return ret; + } + ret = mipi_dsi_dcs_write(dsi, cmd, seqp, chunk); + if (ret < 0) { + DRM_DEV_ERROR(dev, + "error sending CMD %02x chunk\n", + cmd); + return ret; + } + cmdwritten += chunk; + seqp += chunk; + } + DRM_DEV_INFO(dev, "sent command %02x %02x bytes\n", +cmd, cmdwritten); + + usleep_range(8000, 9000); + + return 0; +} + +static int s6e63m0_dsi_probe(struct mipi_dsi_device *dsi) +{ + struct device *dev = &dsi->dev; +
[PATCH 4/4] drm/panel: s6e63m0: Add code to identify panel
We add code to identify a few different panels mounted on the s6e63m0 controller. This is necessary to achieve the proper biasing with DSI versions of the panel. Cc: Stephan Gerhold Cc: Paweł Chmiel Signed-off-by: Linus Walleij --- drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 61 +++ 1 file changed, 61 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c index b25021bdd724..0b22e382b80f 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c @@ -26,12 +26,21 @@ #define MCS_ELVSS_ON0xb1 #define MCS_MIECTL10xc0 #define MCS_BCMODE 0xc1 +#define MCS_READ_ID1 0xda +#define MCS_READ_ID2 0xdb +#define MCS_READ_ID3 0xdc +#define MCS_LEVEL_2_KEY0xf0 +#define MCS_MTP_KEY0xf1 #define MCS_DISCTL 0xf2 #define MCS_SRCCTL 0xf6 #define MCS_IFCTL 0xf7 #define MCS_PANELCTL 0xF8 #define MCS_PGAMMACTL 0xfa +#define S6E63M0_LCD_ID_VALUE_M20xA4 +#define S6E63M0_LCD_ID_VALUE_SM2 0xB4 +#define S6E63M0_LCD_ID_VALUE_SM2_1 0xB6 + #define NUM_GAMMA_LEVELS 11 #define GAMMA_TABLE_COUNT 23 @@ -91,6 +100,7 @@ struct s6e63m0 { int (*dcs_write)(struct device *dev, const u8 *data, size_t len); struct drm_panel panel; struct backlight_device *bl_dev; + u8 lcd_type; struct regulator_bulk_data supplies[2]; struct gpio_desc *reset_gpio; @@ -159,6 +169,48 @@ static void s6e63m0_dcs_write(struct s6e63m0 *ctx, const u8 *data, size_t len) s6e63m0_dcs_write(ctx, d, ARRAY_SIZE(d)); \ }) + +static int s6e63m0_check_lcd_type(struct s6e63m0 *ctx) +{ + u8 id1, id2, id3; + int ret; + + s6e63m0_dcs_read(ctx, MCS_READ_ID1, &id1); + s6e63m0_dcs_read(ctx, MCS_READ_ID2, &id2); + s6e63m0_dcs_read(ctx, MCS_READ_ID3, &id3); + + ret = s6e63m0_clear_error(ctx); + if (ret) { + DRM_DEV_ERROR(ctx->dev, "error checking LCD type (%d)\n", + ret); + ctx->lcd_type = 0x00; + return ret; + } + + DRM_DEV_INFO(ctx->dev, "MTP ID: %02x %02x %02x\n", id1, id2, id3); + + /* We attempt to detect what panel is mounted on the controller */ + switch (id2) { + case S6E63M0_LCD_ID_VALUE_M2: + DRM_DEV_INFO(ctx->dev, +"detected LCD panel AMS397GE MIPI M2\n"); + break; + case S6E63M0_LCD_ID_VALUE_SM2: + case S6E63M0_LCD_ID_VALUE_SM2_1: + DRM_DEV_INFO(ctx->dev, +"detected LCD panel AMS397GE MIPI SM2\n"); + break; + default: + DRM_DEV_INFO(ctx->dev, +"unknown LCD panel type %02x\n", id2); + break; + } + + ctx->lcd_type = id2; + + return 0; +} + static void s6e63m0_init(struct s6e63m0 *ctx) { s6e63m0_dcs_write_seq_static(ctx, MCS_PANELCTL, @@ -312,6 +364,15 @@ static int s6e63m0_prepare(struct drm_panel *panel) if (ret < 0) return ret; + /* Magic to unlock level 2 control of the display */ + s6e63m0_dcs_write_seq_static(ctx, MCS_LEVEL_2_KEY, 0x5a, 0x5a); + /* Magic to unlock MTP reading */ + s6e63m0_dcs_write_seq_static(ctx, MCS_MTP_KEY, 0x5a, 0x5a); + + ret = s6e63m0_check_lcd_type(ctx); + if (ret < 0) + return ret; + s6e63m0_init(ctx); ret = s6e63m0_clear_error(ctx); -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 3/4] drm/panel: s6e63m0: Add reading functionality
This adds code to send read commands to read a single byte from the display, in order to perform MTP ID look-up of the mounted panel on the s6e63m0 controller. This is needed for proper biasing on the DSI variants. Cc: Stephan Gerhold Cc: Paweł Chmiel Signed-off-by: Linus Walleij --- .../gpu/drm/panel/panel-samsung-s6e63m0-dsi.c | 19 ++- .../gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 14 +- drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 11 +++ drivers/gpu/drm/panel/panel-samsung-s6e63m0.h | 1 + 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c index f4927a6ce26d..2ec9e7900791 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c @@ -16,6 +16,22 @@ #define MCS_GLOBAL_PARAM 0xb0 #define S6E63M0_DSI_MAX_CHUNK 15 /* CMD + 15 bytes max */ +static int s6e63m0_dsi_dcs_read(struct device *dev, const u8 cmd, u8 *data) +{ + struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); + int ret; + + ret = mipi_dsi_dcs_read(dsi, cmd, data, 1); + if (ret < 0) { + DRM_DEV_ERROR(dev, "could not read DCS CMD %02x\n", cmd); + return ret; + } + + DRM_DEV_INFO(dev, "DSI read CMD %02x = %02x\n", cmd, *data); + + return 0; +} + static int s6e63m0_dsi_dcs_write(struct device *dev, const u8 *data, size_t len) { struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); @@ -90,7 +106,8 @@ static int s6e63m0_dsi_probe(struct mipi_dsi_device *dsi) MIPI_DSI_MODE_EOT_PACKET | MIPI_DSI_MODE_VIDEO_BURST; - ret = s6e63m0_probe(dev, s6e63m0_dsi_dcs_write, true); + ret = s6e63m0_probe(dev, s6e63m0_dsi_dcs_read, s6e63m0_dsi_dcs_write, + true); if (ret) return ret; diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c index 0587eac52f2a..3b1a2a3a44ea 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c @@ -11,6 +11,17 @@ #define DATA_MASK 0x100 +static int s6e63m0_spi_dcs_read(struct device *dev, const u8 cmd, u8 *data) +{ + /* +* FIXME: implement reading DCS commands over SPI so we can +* properly identify which physical panel is connected. +*/ + *data = 0; + + return 0; +} + static int s6e63m0_spi_write_word(struct device *dev, u16 data) { struct spi_device *spi = to_spi_device(dev); @@ -60,7 +71,8 @@ static int s6e63m0_spi_probe(struct spi_device *spi) DRM_DEV_ERROR(dev, "spi setup failed.\n"); return ret; } - return s6e63m0_probe(dev, s6e63m0_spi_dcs_write, false); + return s6e63m0_probe(dev, s6e63m0_spi_dcs_read, s6e63m0_spi_dcs_write, +false); } static int s6e63m0_spi_remove(struct spi_device *spi) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c index c6d17e938955..b25021bdd724 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c @@ -87,6 +87,7 @@ static u8 const s6e63m0_gamma_22[NUM_GAMMA_LEVELS][GAMMA_TABLE_COUNT] = { struct s6e63m0 { struct device *dev; + int (*dcs_read)(struct device *dev, const u8 cmd, u8 *val); int (*dcs_write)(struct device *dev, const u8 *data, size_t len); struct drm_panel panel; struct backlight_device *bl_dev; @@ -136,6 +137,14 @@ static int s6e63m0_clear_error(struct s6e63m0 *ctx) return ret; } +static void s6e63m0_dcs_read(struct s6e63m0 *ctx, const u8 cmd, u8 *data) +{ + if (ctx->error < 0) + return; + + ctx->error = ctx->dcs_read(ctx->dev, cmd, data); +} + static void s6e63m0_dcs_write(struct s6e63m0 *ctx, const u8 *data, size_t len) { if (ctx->error < 0 || len == 0) @@ -403,6 +412,7 @@ static int s6e63m0_backlight_register(struct s6e63m0 *ctx) } int s6e63m0_probe(struct device *dev, + int (*dcs_read)(struct device *dev, const u8 cmd, u8 *val), int (*dcs_write)(struct device *dev, const u8 *data, size_t len), bool dsi_mode) { @@ -413,6 +423,7 @@ int s6e63m0_probe(struct device *dev, if (!ctx) return -ENOMEM; + ctx->dcs_read = dcs_read; ctx->dcs_write = dcs_write; dev_set_drvdata(dev, ctx); diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h index 229e23b0c97a..c669fec91763 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h @@ -4,6 +4,7 @@ #define _PANEL_SAMSUNG_S6E63M0_H int s6e63m0_probe(struct device *dev
[PATCH 0/4] drm/panel: s6e63m0: Add DSI transport
This begins to modify the Samsung S6E63M0 driver to provide DSI support. After these initial changes the driver can already be used with the Samsung GT-I8190 (Golden) phone. After this initial support we will make more changes to support more gammas (more levels of backlight), special biasing on different display types and handling of the ESD IRQ. But let's begin with this. Linus Walleij (4): drm/panel: s6e63m0: Break out SPI transport drm/panel: s6e63m0: Add DSI transport drm/panel: s6e63m0: Add reading functionality drm/panel: s6e63m0: Add code to identify panel drivers/gpu/drm/panel/Kconfig | 23 ++- drivers/gpu/drm/panel/Makefile| 2 + .../gpu/drm/panel/panel-samsung-s6e63m0-dsi.c | 145 + .../gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 101 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 146 ++ drivers/gpu/drm/panel/panel-samsung-s6e63m0.h | 13 ++ 6 files changed, 363 insertions(+), 67 deletions(-) create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0.h -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/4] drm/panel: s6e63m0: Break out SPI transport
This panel can be accessed using both SPI and DSI. To make it possible to probe and use the device also from a DSI bus, first break out the SPI support to its own file. Since all the panel driver does is write DCS commands to the panel, we pass a DCS write function to probe() from each subdriver. We make the Kconfig entry for SPI mode default so all current users will continue to work. Cc: Stephan Gerhold Cc: Paweł Chmiel Signed-off-by: Linus Walleij --- drivers/gpu/drm/panel/Kconfig | 15 +++- drivers/gpu/drm/panel/Makefile| 1 + .../gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 89 +++ drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 80 +++-- drivers/gpu/drm/panel/panel-samsung-s6e63m0.h | 10 +++ 5 files changed, 124 insertions(+), 71 deletions(-) create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0.h diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 39055c1f0e2f..96e1548e475f 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -326,13 +326,22 @@ config DRM_PANEL_SAMSUNG_S6E63J0X03 select VIDEOMODE_HELPERS config DRM_PANEL_SAMSUNG_S6E63M0 - tristate "Samsung S6E63M0 RGB/SPI panel" + tristate "Samsung S6E63M0 RGB panel" depends on OF - depends on SPI depends on BACKLIGHT_CLASS_DEVICE help Say Y here if you want to enable support for Samsung S6E63M0 - AMOLED LCD panel. + AMOLED LCD panel. This panel can be accessed using SPI or + DSI. + +config DRM_PANEL_SAMSUNG_S6E63M0_SPI + tristate "Samsung S6E63M0 RGB SPI interface" + depends on SPI + depends on DRM_PANEL_SAMSUNG_S6E63M0 + default DRM_PANEL_SAMSUNG_S6E63M0 + help + Say Y here if you want to be able to access the Samsung + S6E63M0 panel using SPI. config DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01 tristate "Samsung AMS452EF01 panel with S6E88A0 DSI video mode controller" diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index de74f282c433..9cf71adfa794 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -34,6 +34,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0_SPI) += panel-samsung-s6e63m0-spi.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01) += panel-samsung-s6e88a0-ams452ef01.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c new file mode 100644 index ..4082fbd75b79 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include +#include +#include + +#include + +#include "panel-samsung-s6e63m0.h" + +#define DATA_MASK 0x100 + +static int s6e63m0_spi_write_word(struct device *dev, u16 data) +{ + struct spi_device *spi = to_spi_device(dev); + struct spi_transfer xfer = { + .len= 2, + .tx_buf = &data, + }; + struct spi_message msg; + + spi_message_init(&msg); + spi_message_add_tail(&xfer, &msg); + + return spi_sync(spi, &msg); +} + +static int s6e63m0_spi_dcs_write(struct device *dev, const u8 *data, size_t len) +{ + int ret = 0; + + DRM_DEV_DEBUG(dev, "SPI writing dcs seq: %*ph\n", (int)len, data); + ret = s6e63m0_spi_write_word(dev, *data); + + while (!ret && --len) { + ++data; + ret = s6e63m0_spi_write_word(dev, *data | DATA_MASK); + } + + if (ret) { + DRM_DEV_ERROR(dev, "SPI error %d writing dcs seq: %*ph\n", ret, + (int)len, data); + } + + usleep_range(300, 310); + + return ret; +} + +static int s6e63m0_spi_probe(struct spi_device *spi) +{ + struct device *dev = &spi->dev; + int ret; + + spi->bits_per_word = 9; + spi->mode = SPI_MODE_3; + ret = spi_setup(spi); + if (ret < 0) { + DRM_DEV_ERROR(dev, "spi setup failed.\n"); + return ret; + } + return s6e63m0_probe(dev, s6e63m0_spi_dcs_write); +} + +static int s6e63m0_spi_remove(struct spi_device *spi) +{ + return s6e63m0_remove(&spi->dev); +} + +static const struct of_device_id s6e63m0_spi_of_match[] = { + { .compatible = "samsung,s6e63m0" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, s6e63m0_spi_of_match); + +static struct spi_driver
Re: [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin()
Hi [This is an automated email] This commit has been processed because it contains a "Fixes:" tag fixing commit: 4961eb60f145 ("drm/ast: Enable atomic modesetting"). The bot has tested the following trees: v5.8, v5.7.13. v5.8: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()") v5.7.13: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()") NOTE: The patch will not be queued to stable trees until it is upstream. How should we proceed with this patch? -- Thanks Sasha ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes
Hi [This is an automated email] This commit has been processed because it contains a "Fixes:" tag fixing commit: 4961eb60f145 ("drm/ast: Enable atomic modesetting"). The bot has tested the following trees: v5.8, v5.7.13. v5.8: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()") v5.7.13: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()") NOTE: The patch will not be queued to stable trees until it is upstream. How should we proceed with this patch? -- Thanks Sasha ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v1 3/4] drm/ast: Add commit-tail function
Hi [This is an automated email] This commit has been processed because it contains a "Fixes:" tag fixing commit: 4961eb60f145 ("drm/ast: Enable atomic modesetting"). The bot has tested the following trees: v5.8, v5.7.13. v5.8: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()") v5.7.13: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()") NOTE: The patch will not be queued to stable trees until it is upstream. How should we proceed with this patch? -- Thanks Sasha ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes
Hi [This is an automated email] This commit has been processed because it contains a "Fixes:" tag fixing commit: 4961eb60f145 ("drm/ast: Enable atomic modesetting"). The bot has tested the following trees: v5.8, v5.7.13. v5.8: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()") v5.7.13: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()") NOTE: The patch will not be queued to stable trees until it is upstream. How should we proceed with this patch? -- Thanks Sasha ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel