Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'drm-misc-next-2023-01-12' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v6.3:

UAPI Changes:

* fourcc: Document Open Source user waiver

Cross-subsystem Changes:

* firmware: fix color-format selection for system framebuffers

Core Changes:

* format-helper: Add conversion from XRGB8888 to various sysfb formats;
Make XRGB8888 the only driver-emulated legacy format

* fb-helper: Avoid blank consoles from selecting an incorrect color format

* probe-helper: Enable/disable HPD on connectors plus driver updates

* Use drm_dbg_ helpers in several places

* docs: Document defaults for CRTC backgrounds; Document use of drm_minor

Driver Changes:

* arm/hdlcd: Use new debugfs helpers

* gud: Use new debugfs helpers

* panel: Support Visionox VTDR6130 AMOLED DSI; Support Himax HX8394; Convert
many drivers to common generic DSI write-sequence helper

* v3d: Do not opencode drm_gem_object_lookup()

* vc4: Various HVS an CRTC fixes

* vkms: Fix SEGFAULT from incorrect GEM-buffer mapping

* Convert various drivers to i2c probe_new()

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/Y8ADeSzZDj+tpibF@linux-uq9g

+3115 -1346
+76
Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/display/panel/himax,hx8394.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Himax HX8394 MIPI-DSI LCD panel controller 8 + 9 + maintainers: 10 + - Ondrej Jirman <megi@xff.cz> 11 + - Javier Martinez Canillas <javierm@redhat.com> 12 + 13 + description: 14 + Device tree bindings for panels based on the Himax HX8394 controller, 15 + such as the HannStar HSD060BHW4 720x1440 TFT LCD panel connected with 16 + a MIPI-DSI video interface. 17 + 18 + allOf: 19 + - $ref: panel-common.yaml# 20 + 21 + properties: 22 + compatible: 23 + items: 24 + - enum: 25 + - hannstar,hsd060bhw4 26 + - const: himax,hx8394 27 + 28 + reg: true 29 + 30 + reset-gpios: true 31 + 32 + backlight: true 33 + 34 + port: true 35 + 36 + vcc-supply: 37 + description: Panel power supply 38 + 39 + iovcc-supply: 40 + description: I/O voltage supply 41 + 42 + required: 43 + - compatible 44 + - reg 45 + - reset-gpios 46 + - backlight 47 + - port 48 + - vcc-supply 49 + - iovcc-supply 50 + 51 + additionalProperties: false 52 + 53 + examples: 54 + - | 55 + #include <dt-bindings/gpio/gpio.h> 56 + 57 + dsi { 58 + #address-cells = <1>; 59 + #size-cells = <0>; 60 + panel@0 { 61 + compatible = "hannstar,hsd060bhw4", "himax,hx8394"; 62 + reg = <0>; 63 + vcc-supply = <&reg_2v8_p>; 64 + iovcc-supply = <&reg_1v8_p>; 65 + reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>; 66 + backlight = <&backlight>; 67 + 68 + port { 69 + mipi_in_panel: endpoint { 70 + remote-endpoint = <&mipi_out_panel>; 71 + }; 72 + }; 73 + }; 74 + }; 75 + 76 + ...
+53
Documentation/devicetree/bindings/display/panel/visionox,vtdr6130.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/display/panel/visionox,vtdr6130.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Visionox VTDR6130 AMOLED DSI Panel 8 + 9 + maintainers: 10 + - Neil Armstrong <neil.armstrong@linaro.org> 11 + 12 + allOf: 13 + - $ref: panel-common.yaml# 14 + 15 + properties: 16 + compatible: 17 + const: visionox,vtdr6130 18 + 19 + vddio-supply: true 20 + vci-supply: true 21 + vdd-supply: true 22 + port: true 23 + reset-gpios: true 24 + 25 + additionalProperties: false 26 + 27 + required: 28 + - compatible 29 + - vddio-supply 30 + - vci-supply 31 + - vdd-supply 32 + - reset-gpios 33 + - port 34 + 35 + examples: 36 + - | 37 + #include <dt-bindings/gpio/gpio.h> 38 + panel { 39 + compatible = "visionox,vtdr6130"; 40 + 41 + vddio-supply = <&vreg_l12b_1p8>; 42 + vci-supply = <&vreg_l13b_3p0>; 43 + vdd-supply = <&vreg_l11b_1p2>; 44 + 45 + reset-gpios = <&tlmm 133 GPIO_ACTIVE_LOW>; 46 + 47 + port { 48 + panel0_in: endpoint { 49 + remote-endpoint = <&dsi0_out>; 50 + }; 51 + }; 52 + }; 53 + ...
+1
Documentation/userspace-api/ioctl/ioctl-number.rst
··· 222 222 'a' 00-0F drivers/crypto/qat/qat_common/adf_cfg_common.h conflict! qat driver 223 223 'b' 00-FF conflict! bit3 vme host bridge 224 224 <mailto:natalia@nikhefk.nikhef.nl> 225 + 'b' 00-0F linux/dma-buf.h conflict! 225 226 'c' all linux/cm4000_cs.h conflict! 226 227 'c' 00-7F linux/comstats.h conflict! 227 228 'c' 00-7F linux/coda.h conflict!
+8 -1
MAINTAINERS
··· 6550 6550 T: git git://anongit.freedesktop.org/drm/drm-misc 6551 6551 F: drivers/gpu/drm/tiny/gm12u320.c 6552 6552 6553 + DRM DRIVER FOR HIMAX HX8394 MIPI-DSI LCD panels 6554 + M: Ondrej Jirman <megi@xff.cz> 6555 + M: Javier Martinez Canillas <javierm@redhat.com> 6556 + S: Maintained 6557 + T: git git://anongit.freedesktop.org/drm/drm-misc 6558 + F: Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml 6559 + F: drivers/gpu/drm/panel/panel-himax-hx8394.c 6560 + 6553 6561 DRM DRIVER FOR HX8357D PANELS 6554 6562 M: Emma Anholt <emma@anholt.net> 6555 6563 S: Maintained ··· 7017 7009 M: Tian Tao <tiantao6@hisilicon.com> 7018 7010 R: John Stultz <jstultz@google.com> 7019 7011 R: Xinwei Kong <kong.kongxinwei@hisilicon.com> 7020 - R: Chen Feng <puck.chen@hisilicon.com> 7021 7012 L: dri-devel@lists.freedesktop.org 7022 7013 S: Maintained 7023 7014 T: git git://anongit.freedesktop.org/drm/drm-misc
+37 -6
drivers/firmware/sysfb_simplefb.c
··· 27 27 __init bool sysfb_parse_mode(const struct screen_info *si, 28 28 struct simplefb_platform_data *mode) 29 29 { 30 - const struct simplefb_format *f; 31 30 __u8 type; 31 + u32 bits_per_pixel; 32 32 unsigned int i; 33 33 34 34 type = si->orig_video_isVGA; 35 35 if (type != VIDEO_TYPE_VLFB && type != VIDEO_TYPE_EFI) 36 36 return false; 37 37 38 + /* 39 + * The meaning of depth and bpp for direct-color formats is 40 + * inconsistent: 41 + * 42 + * - DRM format info specifies depth as the number of color 43 + * bits; including alpha, but not including filler bits. 44 + * - Linux' EFI platform code computes lfb_depth from the 45 + * individual color channels, including the reserved bits. 46 + * - VBE 1.1 defines lfb_depth for XRGB1555 as 16, but later 47 + * versions use 15. 48 + * - On the kernel command line, 'bpp' of 32 is usually 49 + * XRGB8888 including the filler bits, but 15 is XRGB1555 50 + * not including the filler bit. 51 + * 52 + * It's not easily possible to fix this in struct screen_info, 53 + * as this could break UAPI. The best solution is to compute 54 + * bits_per_pixel here and ignore lfb_depth. In the loop below, 55 + * ignore simplefb formats with alpha bits, as EFI and VESA 56 + * don't specify alpha channels. 57 + */ 58 + if (si->lfb_depth > 8) { 59 + bits_per_pixel = max(max3(si->red_size + si->red_pos, 60 + si->green_size + si->green_pos, 61 + si->blue_size + si->blue_pos), 62 + si->rsvd_size + si->rsvd_pos); 63 + } else { 64 + bits_per_pixel = si->lfb_depth; 65 + } 66 + 38 67 for (i = 0; i < ARRAY_SIZE(formats); ++i) { 39 - f = &formats[i]; 40 - if (si->lfb_depth == f->bits_per_pixel && 68 + const struct simplefb_format *f = &formats[i]; 69 + 70 + if (f->transp.length) 71 + continue; /* transparent formats are unsupported by VESA/EFI */ 72 + 73 + if (bits_per_pixel == f->bits_per_pixel && 41 74 si->red_size == f->red.length && 42 75 si->red_pos == f->red.offset && 43 76 si->green_size == f->green.length && 44 77 si->green_pos == f->green.offset && 45 78 si->blue_size == f->blue.length && 46 - si->blue_pos == f->blue.offset && 47 - si->rsvd_size == f->transp.length && 48 - si->rsvd_pos == f->transp.offset) { 79 + si->blue_pos == f->blue.offset) { 49 80 mode->format = f->name; 50 81 mode->width = si->lfb_width; 51 82 mode->height = si->lfb_height;
-1
drivers/gpu/drm/Kconfig
··· 12 12 select HDMI 13 13 select FB_CMDLINE 14 14 select I2C 15 - select I2C_ALGOBIT 16 15 select DMA_SHARED_BUFFER 17 16 select SYNC_FILE 18 17 # gallium uses SYS_kcmp for os_same_file_description() to de-duplicate
+2
drivers/gpu/drm/amd/amdgpu/Kconfig
··· 13 13 select DRM_TTM_HELPER 14 14 select POWER_SUPPLY 15 15 select HWMON 16 + select I2C 17 + select I2C_ALGOBIT 16 18 select BACKLIGHT_CLASS_DEVICE 17 19 select INTERVAL_TREE 18 20 select DRM_BUDDY
+9 -15
drivers/gpu/drm/arm/hdlcd_drv.c
··· 195 195 #ifdef CONFIG_DEBUG_FS 196 196 static int hdlcd_show_underrun_count(struct seq_file *m, void *arg) 197 197 { 198 - struct drm_info_node *node = (struct drm_info_node *)m->private; 199 - struct drm_device *drm = node->minor->dev; 198 + struct drm_debugfs_entry *entry = m->private; 199 + struct drm_device *drm = entry->dev; 200 200 struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm); 201 201 202 202 seq_printf(m, "underrun : %d\n", atomic_read(&hdlcd->buffer_underrun_count)); ··· 208 208 209 209 static int hdlcd_show_pxlclock(struct seq_file *m, void *arg) 210 210 { 211 - struct drm_info_node *node = (struct drm_info_node *)m->private; 212 - struct drm_device *drm = node->minor->dev; 211 + struct drm_debugfs_entry *entry = m->private; 212 + struct drm_device *drm = entry->dev; 213 213 struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm); 214 214 unsigned long clkrate = clk_get_rate(hdlcd->clk); 215 215 unsigned long mode_clock = hdlcd->crtc.mode.crtc_clock * 1000; ··· 219 219 return 0; 220 220 } 221 221 222 - static struct drm_info_list hdlcd_debugfs_list[] = { 222 + static struct drm_debugfs_info hdlcd_debugfs_list[] = { 223 223 { "interrupt_count", hdlcd_show_underrun_count, 0 }, 224 224 { "clocks", hdlcd_show_pxlclock, 0 }, 225 225 }; 226 - 227 - static void hdlcd_debugfs_init(struct drm_minor *minor) 228 - { 229 - drm_debugfs_create_files(hdlcd_debugfs_list, 230 - ARRAY_SIZE(hdlcd_debugfs_list), 231 - minor->debugfs_root, minor); 232 - } 233 226 #endif 234 227 235 228 DEFINE_DRM_GEM_DMA_FOPS(fops); ··· 230 237 static const struct drm_driver hdlcd_driver = { 231 238 .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, 232 239 DRM_GEM_DMA_DRIVER_OPS, 233 - #ifdef CONFIG_DEBUG_FS 234 - .debugfs_init = hdlcd_debugfs_init, 235 - #endif 236 240 .fops = &fops, 237 241 .name = "hdlcd", 238 242 .desc = "ARM HDLCD Controller DRM", ··· 292 302 293 303 drm_mode_config_reset(drm); 294 304 drm_kms_helper_poll_init(drm); 305 + 306 + #ifdef CONFIG_DEBUG_FS 307 + drm_debugfs_add_files(drm, hdlcd_debugfs_list, ARRAY_SIZE(hdlcd_debugfs_list)); 308 + #endif 295 309 296 310 ret = drm_dev_register(drm, 0); 297 311 if (ret)
+2
drivers/gpu/drm/ast/Kconfig
··· 4 4 depends on DRM && PCI && MMU 5 5 select DRM_GEM_SHMEM_HELPER 6 6 select DRM_KMS_HELPER 7 + select I2C 8 + select I2C_ALGOBIT 7 9 help 8 10 Say yes for experimental AST GPU driver. Do not enable 9 11 this driver without having a working -modesetting,
+5 -4
drivers/gpu/drm/bridge/panel.c
··· 357 357 return ERR_PTR(-ENOMEM); 358 358 359 359 bridge = drm_panel_bridge_add_typed(panel, connector_type); 360 - if (!IS_ERR(bridge)) { 361 - *ptr = bridge; 362 - devres_add(dev, ptr); 363 - } else { 360 + if (IS_ERR(bridge)) { 364 361 devres_free(ptr); 362 + return bridge; 365 363 } 366 364 367 365 bridge->pre_enable_prev_first = panel->prepare_prev_first; 366 + 367 + *ptr = bridge; 368 + devres_add(dev, ptr); 368 369 369 370 return bridge; 370 371 }
+6 -7
drivers/gpu/drm/drm_blend.c
··· 450 450 int i, n = 0; 451 451 int ret = 0; 452 452 453 - DRM_DEBUG_ATOMIC("[CRTC:%d:%s] calculating normalized zpos values\n", 454 - crtc->base.id, crtc->name); 453 + drm_dbg_atomic(dev, "[CRTC:%d:%s] calculating normalized zpos values\n", 454 + crtc->base.id, crtc->name); 455 455 456 456 states = kmalloc_array(total_planes, sizeof(*states), GFP_KERNEL); 457 457 if (!states) ··· 469 469 goto done; 470 470 } 471 471 states[n++] = plane_state; 472 - DRM_DEBUG_ATOMIC("[PLANE:%d:%s] processing zpos value %d\n", 473 - plane->base.id, plane->name, 474 - plane_state->zpos); 472 + drm_dbg_atomic(dev, "[PLANE:%d:%s] processing zpos value %d\n", 473 + plane->base.id, plane->name, plane_state->zpos); 475 474 } 476 475 477 476 sort(states, n, sizeof(*states), drm_atomic_state_zpos_cmp, NULL); ··· 479 480 plane = states[i]->plane; 480 481 481 482 states[i]->normalized_zpos = i; 482 - DRM_DEBUG_ATOMIC("[PLANE:%d:%s] normalized zpos value %d\n", 483 - plane->base.id, plane->name, i); 483 + drm_dbg_atomic(dev, "[PLANE:%d:%s] normalized zpos value %d\n", 484 + plane->base.id, plane->name, i); 484 485 } 485 486 crtc_state->zpos_changed = true; 486 487
+5 -22
drivers/gpu/drm/drm_bridge_connector.c
··· 128 128 drm_kms_helper_hotplug_event(dev); 129 129 } 130 130 131 - /** 132 - * drm_bridge_connector_enable_hpd - Enable hot-plug detection for the connector 133 - * @connector: The DRM bridge connector 134 - * 135 - * This function enables hot-plug detection for the given bridge connector. 136 - * This is typically used by display drivers in their resume handler. 137 - */ 138 - void drm_bridge_connector_enable_hpd(struct drm_connector *connector) 131 + static void drm_bridge_connector_enable_hpd(struct drm_connector *connector) 139 132 { 140 133 struct drm_bridge_connector *bridge_connector = 141 134 to_drm_bridge_connector(connector); ··· 138 145 drm_bridge_hpd_enable(hpd, drm_bridge_connector_hpd_cb, 139 146 bridge_connector); 140 147 } 141 - EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd); 142 148 143 - /** 144 - * drm_bridge_connector_disable_hpd - Disable hot-plug detection for the 145 - * connector 146 - * @connector: The DRM bridge connector 147 - * 148 - * This function disables hot-plug detection for the given bridge connector. 149 - * This is typically used by display drivers in their suspend handler. 150 - */ 151 - void drm_bridge_connector_disable_hpd(struct drm_connector *connector) 149 + static void drm_bridge_connector_disable_hpd(struct drm_connector *connector) 152 150 { 153 151 struct drm_bridge_connector *bridge_connector = 154 152 to_drm_bridge_connector(connector); ··· 148 164 if (hpd) 149 165 drm_bridge_hpd_disable(hpd); 150 166 } 151 - EXPORT_SYMBOL_GPL(drm_bridge_connector_disable_hpd); 152 167 153 168 /* ----------------------------------------------------------------------------- 154 169 * Bridge Connector Functions ··· 288 305 static const struct drm_connector_helper_funcs drm_bridge_connector_helper_funcs = { 289 306 .get_modes = drm_bridge_connector_get_modes, 290 307 /* No need for .mode_valid(), the bridges are checked by the core. */ 308 + .enable_hpd = drm_bridge_connector_enable_hpd, 309 + .disable_hpd = drm_bridge_connector_disable_hpd, 291 310 }; 292 311 293 312 /* ----------------------------------------------------------------------------- ··· 372 387 connector_type, ddc); 373 388 drm_connector_helper_add(connector, &drm_bridge_connector_helper_funcs); 374 389 375 - if (bridge_connector->bridge_hpd) { 390 + if (bridge_connector->bridge_hpd) 376 391 connector->polled = DRM_CONNECTOR_POLL_HPD; 377 - drm_bridge_connector_enable_hpd(connector); 378 - } 379 392 else if (bridge_connector->bridge_detect) 380 393 connector->polled = DRM_CONNECTOR_POLL_CONNECT 381 394 | DRM_CONNECTOR_POLL_DISCONNECT;
+6 -6
drivers/gpu/drm/drm_debugfs.c
··· 207 207 208 208 tmp->minor = minor; 209 209 tmp->dent = debugfs_create_file(files[i].name, 210 - S_IFREG | S_IRUGO, root, tmp, 210 + 0444, root, tmp, 211 211 &drm_debugfs_fops); 212 212 tmp->info_ent = &files[i]; 213 213 ··· 246 246 dev->driver->debugfs_init(minor); 247 247 248 248 list_for_each_entry_safe(entry, tmp, &dev->debugfs_list, list) { 249 - debugfs_create_file(entry->file.name, S_IFREG | S_IRUGO, 249 + debugfs_create_file(entry->file.name, 0444, 250 250 minor->debugfs_root, entry, &drm_debugfs_entry_fops); 251 251 list_del(&entry->list); 252 252 } ··· 263 263 return; 264 264 265 265 list_for_each_entry_safe(entry, tmp, &dev->debugfs_list, list) { 266 - debugfs_create_file(entry->file.name, S_IFREG | S_IRUGO, 266 + debugfs_create_file(entry->file.name, 0444, 267 267 minor->debugfs_root, entry, &drm_debugfs_entry_fops); 268 268 list_del(&entry->list); 269 269 } ··· 508 508 connector->debugfs_entry = root; 509 509 510 510 /* force */ 511 - debugfs_create_file("force", S_IRUGO | S_IWUSR, root, connector, 511 + debugfs_create_file("force", 0644, root, connector, 512 512 &drm_connector_fops); 513 513 514 514 /* edid */ 515 - debugfs_create_file("edid_override", S_IRUGO | S_IWUSR, root, connector, 515 + debugfs_create_file("edid_override", 0644, root, connector, 516 516 &drm_edid_fops); 517 517 518 518 /* vrr range */ 519 - debugfs_create_file("vrr_range", S_IRUGO, root, connector, 519 + debugfs_create_file("vrr_range", 0444, root, connector, 520 520 &vrr_range_fops); 521 521 522 522 /* max bpc */
+155 -103
drivers/gpu/drm/drm_fb_helper.c
··· 1726 1726 } 1727 1727 EXPORT_SYMBOL(drm_fb_helper_pan_display); 1728 1728 1729 - /* 1730 - * Allocates the backing storage and sets up the fbdev info structure through 1731 - * the ->fb_probe callback. 1732 - */ 1733 - static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, 1734 - int preferred_bpp) 1729 + static uint32_t drm_fb_helper_find_format(struct drm_fb_helper *fb_helper, const uint32_t *formats, 1730 + size_t format_count, uint32_t bpp, uint32_t depth) 1731 + { 1732 + struct drm_device *dev = fb_helper->dev; 1733 + uint32_t format; 1734 + size_t i; 1735 + 1736 + /* 1737 + * Do not consider YUV or other complicated formats 1738 + * for framebuffers. This means only legacy formats 1739 + * are supported (fmt->depth is a legacy field), but 1740 + * the framebuffer emulation can only deal with such 1741 + * formats, specifically RGB/BGA formats. 1742 + */ 1743 + format = drm_mode_legacy_fb_format(bpp, depth); 1744 + if (!format) 1745 + goto err; 1746 + 1747 + for (i = 0; i < format_count; ++i) { 1748 + if (formats[i] == format) 1749 + return format; 1750 + } 1751 + 1752 + err: 1753 + /* We found nothing. */ 1754 + drm_warn(dev, "bpp/depth value of %u/%u not supported\n", bpp, depth); 1755 + 1756 + return DRM_FORMAT_INVALID; 1757 + } 1758 + 1759 + static uint32_t drm_fb_helper_find_color_mode_format(struct drm_fb_helper *fb_helper, 1760 + const uint32_t *formats, size_t format_count, 1761 + unsigned int color_mode) 1762 + { 1763 + struct drm_device *dev = fb_helper->dev; 1764 + uint32_t bpp, depth; 1765 + 1766 + switch (color_mode) { 1767 + case 1: 1768 + case 2: 1769 + case 4: 1770 + case 8: 1771 + case 16: 1772 + case 24: 1773 + bpp = depth = color_mode; 1774 + break; 1775 + case 15: 1776 + bpp = 16; 1777 + depth = 15; 1778 + break; 1779 + case 32: 1780 + bpp = 32; 1781 + depth = 24; 1782 + break; 1783 + default: 1784 + drm_info(dev, "unsupported color mode of %d\n", color_mode); 1785 + return DRM_FORMAT_INVALID; 1786 + } 1787 + 1788 + return drm_fb_helper_find_format(fb_helper, formats, format_count, bpp, depth); 1789 + } 1790 + 1791 + static int __drm_fb_helper_find_sizes(struct drm_fb_helper *fb_helper, int preferred_bpp, 1792 + struct drm_fb_helper_surface_size *sizes) 1735 1793 { 1736 1794 struct drm_client_dev *client = &fb_helper->client; 1737 1795 struct drm_device *dev = fb_helper->dev; 1738 - struct drm_mode_config *config = &dev->mode_config; 1739 - int ret = 0; 1740 1796 int crtc_count = 0; 1741 1797 struct drm_connector_list_iter conn_iter; 1742 - struct drm_fb_helper_surface_size sizes; 1743 1798 struct drm_connector *connector; 1744 1799 struct drm_mode_set *mode_set; 1745 - int best_depth = 0; 1800 + uint32_t surface_format = DRM_FORMAT_INVALID; 1801 + const struct drm_format_info *info; 1746 1802 1747 - memset(&sizes, 0, sizeof(struct drm_fb_helper_surface_size)); 1748 - sizes.surface_depth = 24; 1749 - sizes.surface_bpp = 32; 1750 - sizes.fb_width = (u32)-1; 1751 - sizes.fb_height = (u32)-1; 1803 + memset(sizes, 0, sizeof(*sizes)); 1804 + sizes->fb_width = (u32)-1; 1805 + sizes->fb_height = (u32)-1; 1752 1806 1753 - /* 1754 - * If driver picks 8 or 16 by default use that for both depth/bpp 1755 - * to begin with 1756 - */ 1757 - if (preferred_bpp != sizes.surface_bpp) 1758 - sizes.surface_depth = sizes.surface_bpp = preferred_bpp; 1759 - 1760 - drm_connector_list_iter_begin(fb_helper->dev, &conn_iter); 1761 - drm_client_for_each_connector_iter(connector, &conn_iter) { 1762 - struct drm_cmdline_mode *cmdline_mode; 1763 - 1764 - cmdline_mode = &connector->cmdline_mode; 1765 - 1766 - if (cmdline_mode->bpp_specified) { 1767 - switch (cmdline_mode->bpp) { 1768 - case 8: 1769 - sizes.surface_depth = sizes.surface_bpp = 8; 1770 - break; 1771 - case 15: 1772 - sizes.surface_depth = 15; 1773 - sizes.surface_bpp = 16; 1774 - break; 1775 - case 16: 1776 - sizes.surface_depth = sizes.surface_bpp = 16; 1777 - break; 1778 - case 24: 1779 - sizes.surface_depth = sizes.surface_bpp = 24; 1780 - break; 1781 - case 32: 1782 - sizes.surface_depth = 24; 1783 - sizes.surface_bpp = 32; 1784 - break; 1785 - } 1786 - break; 1787 - } 1788 - } 1789 - drm_connector_list_iter_end(&conn_iter); 1790 - 1791 - /* 1792 - * If we run into a situation where, for example, the primary plane 1793 - * supports RGBA5551 (16 bpp, depth 15) but not RGB565 (16 bpp, depth 1794 - * 16) we need to scale down the depth of the sizes we request. 1795 - */ 1796 - mutex_lock(&client->modeset_mutex); 1797 1807 drm_client_for_each_modeset(mode_set, client) { 1798 1808 struct drm_crtc *crtc = mode_set->crtc; 1799 1809 struct drm_plane *plane = crtc->primary; 1800 - int j; 1801 1810 1802 1811 drm_dbg_kms(dev, "test CRTC %u primary plane\n", drm_crtc_index(crtc)); 1803 1812 1804 - for (j = 0; j < plane->format_count; j++) { 1805 - const struct drm_format_info *fmt; 1813 + drm_connector_list_iter_begin(fb_helper->dev, &conn_iter); 1814 + drm_client_for_each_connector_iter(connector, &conn_iter) { 1815 + struct drm_cmdline_mode *cmdline_mode = &connector->cmdline_mode; 1806 1816 1807 - fmt = drm_format_info(plane->format_types[j]); 1808 - 1809 - /* 1810 - * Do not consider YUV or other complicated formats 1811 - * for framebuffers. This means only legacy formats 1812 - * are supported (fmt->depth is a legacy field) but 1813 - * the framebuffer emulation can only deal with such 1814 - * formats, specifically RGB/BGA formats. 1815 - */ 1816 - if (fmt->depth == 0) 1817 + if (!cmdline_mode->bpp_specified) 1817 1818 continue; 1818 1819 1819 - /* We found a perfect fit, great */ 1820 - if (fmt->depth == sizes.surface_depth) { 1821 - best_depth = fmt->depth; 1822 - break; 1823 - } 1824 - 1825 - /* Skip depths above what we're looking for */ 1826 - if (fmt->depth > sizes.surface_depth) 1827 - continue; 1828 - 1829 - /* Best depth found so far */ 1830 - if (fmt->depth > best_depth) 1831 - best_depth = fmt->depth; 1820 + surface_format = drm_fb_helper_find_color_mode_format(fb_helper, 1821 + plane->format_types, 1822 + plane->format_count, 1823 + cmdline_mode->bpp); 1824 + if (surface_format != DRM_FORMAT_INVALID) 1825 + break; /* found supported format */ 1832 1826 } 1827 + drm_connector_list_iter_end(&conn_iter); 1828 + 1829 + if (surface_format != DRM_FORMAT_INVALID) 1830 + break; /* found supported format */ 1831 + 1832 + /* try preferred color mode */ 1833 + surface_format = drm_fb_helper_find_color_mode_format(fb_helper, 1834 + plane->format_types, 1835 + plane->format_count, 1836 + preferred_bpp); 1837 + if (surface_format != DRM_FORMAT_INVALID) 1838 + break; /* found supported format */ 1833 1839 } 1834 - if (sizes.surface_depth != best_depth && best_depth) { 1835 - drm_info(dev, "requested bpp %d, scaled depth down to %d", 1836 - sizes.surface_bpp, best_depth); 1837 - sizes.surface_depth = best_depth; 1840 + 1841 + if (surface_format == DRM_FORMAT_INVALID) { 1842 + /* 1843 + * If none of the given color modes works, fall back 1844 + * to XRGB8888. Drivers are expected to provide this 1845 + * format for compatibility with legacy applications. 1846 + */ 1847 + drm_warn(dev, "No compatible format found\n"); 1848 + surface_format = drm_driver_legacy_fb_format(dev, 32, 24); 1838 1849 } 1850 + 1851 + info = drm_format_info(surface_format); 1852 + sizes->surface_bpp = drm_format_info_bpp(info, 0); 1853 + sizes->surface_depth = info->depth; 1839 1854 1840 1855 /* first up get a count of crtcs now in use and new min/maxes width/heights */ 1841 1856 crtc_count = 0; ··· 1873 1858 x = mode_set->x; 1874 1859 y = mode_set->y; 1875 1860 1876 - sizes.surface_width = max_t(u32, desired_mode->hdisplay + x, sizes.surface_width); 1877 - sizes.surface_height = max_t(u32, desired_mode->vdisplay + y, sizes.surface_height); 1861 + sizes->surface_width = 1862 + max_t(u32, desired_mode->hdisplay + x, sizes->surface_width); 1863 + sizes->surface_height = 1864 + max_t(u32, desired_mode->vdisplay + y, sizes->surface_height); 1878 1865 1879 1866 for (j = 0; j < mode_set->num_connectors; j++) { 1880 1867 struct drm_connector *connector = mode_set->connectors[j]; ··· 1892 1875 } 1893 1876 1894 1877 if (lasth) 1895 - sizes.fb_width = min_t(u32, desired_mode->hdisplay + x, sizes.fb_width); 1878 + sizes->fb_width = min_t(u32, desired_mode->hdisplay + x, sizes->fb_width); 1896 1879 if (lastv) 1897 - sizes.fb_height = min_t(u32, desired_mode->vdisplay + y, sizes.fb_height); 1880 + sizes->fb_height = min_t(u32, desired_mode->vdisplay + y, sizes->fb_height); 1898 1881 } 1899 - mutex_unlock(&client->modeset_mutex); 1900 1882 1901 - if (crtc_count == 0 || sizes.fb_width == -1 || sizes.fb_height == -1) { 1883 + if (crtc_count == 0 || sizes->fb_width == -1 || sizes->fb_height == -1) { 1902 1884 drm_info(dev, "Cannot find any crtc or sizes\n"); 1903 - 1904 - /* First time: disable all crtc's.. */ 1905 - if (!fb_helper->deferred_setup) 1906 - drm_client_modeset_commit(client); 1907 1885 return -EAGAIN; 1908 1886 } 1909 1887 1888 + return 0; 1889 + } 1890 + 1891 + static int drm_fb_helper_find_sizes(struct drm_fb_helper *fb_helper, int preferred_bpp, 1892 + struct drm_fb_helper_surface_size *sizes) 1893 + { 1894 + struct drm_client_dev *client = &fb_helper->client; 1895 + struct drm_device *dev = fb_helper->dev; 1896 + struct drm_mode_config *config = &dev->mode_config; 1897 + int ret; 1898 + 1899 + mutex_lock(&client->modeset_mutex); 1900 + ret = __drm_fb_helper_find_sizes(fb_helper, preferred_bpp, sizes); 1901 + mutex_unlock(&client->modeset_mutex); 1902 + 1903 + if (ret) 1904 + return ret; 1905 + 1910 1906 /* Handle our overallocation */ 1911 - sizes.surface_height *= drm_fbdev_overalloc; 1912 - sizes.surface_height /= 100; 1913 - if (sizes.surface_height > config->max_height) { 1907 + sizes->surface_height *= drm_fbdev_overalloc; 1908 + sizes->surface_height /= 100; 1909 + if (sizes->surface_height > config->max_height) { 1914 1910 drm_dbg_kms(dev, "Fbdev over-allocation too large; clamping height to %d\n", 1915 1911 config->max_height); 1916 - sizes.surface_height = config->max_height; 1912 + sizes->surface_height = config->max_height; 1913 + } 1914 + 1915 + return 0; 1916 + } 1917 + 1918 + /* 1919 + * Allocates the backing storage and sets up the fbdev info structure through 1920 + * the ->fb_probe callback. 1921 + */ 1922 + static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, 1923 + int preferred_bpp) 1924 + { 1925 + struct drm_client_dev *client = &fb_helper->client; 1926 + struct drm_fb_helper_surface_size sizes; 1927 + int ret; 1928 + 1929 + ret = drm_fb_helper_find_sizes(fb_helper, preferred_bpp, &sizes); 1930 + if (ret) { 1931 + /* First time: disable all crtc's.. */ 1932 + if (!fb_helper->deferred_setup) 1933 + drm_client_modeset_commit(client); 1934 + return ret; 1917 1935 } 1918 1936 1919 1937 #if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
+9 -9
drivers/gpu/drm/drm_file.c
··· 245 245 246 246 dev = file->minor->dev; 247 247 248 - DRM_DEBUG("comm=\"%s\", pid=%d, dev=0x%lx, open_count=%d\n", 249 - current->comm, task_pid_nr(current), 250 - (long)old_encode_dev(file->minor->kdev->devt), 251 - atomic_read(&dev->open_count)); 248 + drm_dbg_core(dev, "comm=\"%s\", pid=%d, dev=0x%lx, open_count=%d\n", 249 + current->comm, task_pid_nr(current), 250 + (long)old_encode_dev(file->minor->kdev->devt), 251 + atomic_read(&dev->open_count)); 252 252 253 253 #ifdef CONFIG_DRM_LEGACY 254 254 if (drm_core_check_feature(dev, DRIVER_LEGACY) && ··· 340 340 dev->switch_power_state != DRM_SWITCH_POWER_DYNAMIC_OFF) 341 341 return -EINVAL; 342 342 343 - DRM_DEBUG("comm=\"%s\", pid=%d, minor=%d\n", current->comm, 344 - task_pid_nr(current), minor->index); 343 + drm_dbg_core(dev, "comm=\"%s\", pid=%d, minor=%d\n", 344 + current->comm, task_pid_nr(current), minor->index); 345 345 346 346 priv = drm_file_alloc(minor); 347 347 if (IS_ERR(priv)) ··· 450 450 451 451 void drm_lastclose(struct drm_device * dev) 452 452 { 453 - DRM_DEBUG("\n"); 453 + drm_dbg_core(dev, "\n"); 454 454 455 455 if (dev->driver->lastclose) 456 456 dev->driver->lastclose(dev); 457 - DRM_DEBUG("driver lastclose completed\n"); 457 + drm_dbg_core(dev, "driver lastclose completed\n"); 458 458 459 459 if (drm_core_check_feature(dev, DRIVER_LEGACY)) 460 460 drm_legacy_dev_reinit(dev); ··· 485 485 if (drm_dev_needs_global_mutex(dev)) 486 486 mutex_lock(&drm_global_mutex); 487 487 488 - DRM_DEBUG("open_count = %d\n", atomic_read(&dev->open_count)); 488 + drm_dbg_core(dev, "open_count = %d\n", atomic_read(&dev->open_count)); 489 489 490 490 drm_close_helper(filp); 491 491
+327 -135
drivers/gpu/drm/drm_format_helper.c
··· 322 322 323 323 static void drm_fb_xrgb8888_to_rgb565_line(void *dbuf, const void *sbuf, unsigned int pixels) 324 324 { 325 - u16 *dbuf16 = dbuf; 325 + __le16 *dbuf16 = dbuf; 326 326 const __le32 *sbuf32 = sbuf; 327 327 unsigned int x; 328 328 u16 val16; ··· 333 333 val16 = ((pix & 0x00F80000) >> 8) | 334 334 ((pix & 0x0000FC00) >> 5) | 335 335 ((pix & 0x000000F8) >> 3); 336 - dbuf16[x] = val16; 336 + dbuf16[x] = cpu_to_le16(val16); 337 337 } 338 338 } 339 339 340 + /* TODO: implement this helper as conversion to RGB565|BIG_ENDIAN */ 340 341 static void drm_fb_xrgb8888_to_rgb565_swab_line(void *dbuf, const void *sbuf, 341 342 unsigned int pixels) 342 343 { 343 - u16 *dbuf16 = dbuf; 344 + __le16 *dbuf16 = dbuf; 344 345 const __le32 *sbuf32 = sbuf; 345 346 unsigned int x; 346 347 u16 val16; ··· 352 351 val16 = ((pix & 0x00F80000) >> 8) | 353 352 ((pix & 0x0000FC00) >> 5) | 354 353 ((pix & 0x000000F8) >> 3); 355 - dbuf16[x] = swab16(val16); 354 + dbuf16[x] = cpu_to_le16(swab16(val16)); 356 355 } 357 356 } 358 357 ··· 396 395 } 397 396 EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb565); 398 397 398 + static void drm_fb_xrgb8888_to_xrgb1555_line(void *dbuf, const void *sbuf, unsigned int pixels) 399 + { 400 + __le16 *dbuf16 = dbuf; 401 + const __le32 *sbuf32 = sbuf; 402 + unsigned int x; 403 + u16 val16; 404 + u32 pix; 405 + 406 + for (x = 0; x < pixels; x++) { 407 + pix = le32_to_cpu(sbuf32[x]); 408 + val16 = ((pix & 0x00f80000) >> 9) | 409 + ((pix & 0x0000f800) >> 6) | 410 + ((pix & 0x000000f8) >> 3); 411 + dbuf16[x] = cpu_to_le16(val16); 412 + } 413 + } 414 + 415 + /** 416 + * drm_fb_xrgb8888_to_xrgb1555 - Convert XRGB8888 to XRGB1555 clip buffer 417 + * @dst: Array of XRGB1555 destination buffers 418 + * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines 419 + * within @dst; can be NULL if scanlines are stored next to each other. 420 + * @src: Array of XRGB8888 source buffer 421 + * @fb: DRM framebuffer 422 + * @clip: Clip rectangle area to copy 423 + * 424 + * This function copies parts of a framebuffer to display memory and converts 425 + * the color format during the process. The parameters @dst, @dst_pitch and 426 + * @src refer to arrays. Each array must have at least as many entries as 427 + * there are planes in @fb's format. Each entry stores the value for the 428 + * format's respective color plane at the same index. 429 + * 430 + * This function does not apply clipping on @dst (i.e. the destination is at the 431 + * top-left corner). 432 + * 433 + * Drivers can use this function for XRGB1555 devices that don't support 434 + * XRGB8888 natively. 435 + */ 436 + void drm_fb_xrgb8888_to_xrgb1555(struct iosys_map *dst, const unsigned int *dst_pitch, 437 + const struct iosys_map *src, const struct drm_framebuffer *fb, 438 + const struct drm_rect *clip) 439 + { 440 + static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = { 441 + 2, 442 + }; 443 + 444 + drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false, 445 + drm_fb_xrgb8888_to_xrgb1555_line); 446 + } 447 + EXPORT_SYMBOL(drm_fb_xrgb8888_to_xrgb1555); 448 + 449 + static void drm_fb_xrgb8888_to_argb1555_line(void *dbuf, const void *sbuf, unsigned int pixels) 450 + { 451 + __le16 *dbuf16 = dbuf; 452 + const __le32 *sbuf32 = sbuf; 453 + unsigned int x; 454 + u16 val16; 455 + u32 pix; 456 + 457 + for (x = 0; x < pixels; x++) { 458 + pix = le32_to_cpu(sbuf32[x]); 459 + val16 = BIT(15) | /* set alpha bit */ 460 + ((pix & 0x00f80000) >> 9) | 461 + ((pix & 0x0000f800) >> 6) | 462 + ((pix & 0x000000f8) >> 3); 463 + dbuf16[x] = cpu_to_le16(val16); 464 + } 465 + } 466 + 467 + /** 468 + * drm_fb_xrgb8888_to_argb1555 - Convert XRGB8888 to ARGB1555 clip buffer 469 + * @dst: Array of ARGB1555 destination buffers 470 + * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines 471 + * within @dst; can be NULL if scanlines are stored next to each other. 472 + * @src: Array of XRGB8888 source buffer 473 + * @fb: DRM framebuffer 474 + * @clip: Clip rectangle area to copy 475 + * 476 + * This function copies parts of a framebuffer to display memory and converts 477 + * the color format during the process. The parameters @dst, @dst_pitch and 478 + * @src refer to arrays. Each array must have at least as many entries as 479 + * there are planes in @fb's format. Each entry stores the value for the 480 + * format's respective color plane at the same index. 481 + * 482 + * This function does not apply clipping on @dst (i.e. the destination is at the 483 + * top-left corner). 484 + * 485 + * Drivers can use this function for ARGB1555 devices that don't support 486 + * XRGB8888 natively. It sets an opaque alpha channel as part of the conversion. 487 + */ 488 + void drm_fb_xrgb8888_to_argb1555(struct iosys_map *dst, const unsigned int *dst_pitch, 489 + const struct iosys_map *src, const struct drm_framebuffer *fb, 490 + const struct drm_rect *clip) 491 + { 492 + static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = { 493 + 2, 494 + }; 495 + 496 + drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false, 497 + drm_fb_xrgb8888_to_argb1555_line); 498 + } 499 + EXPORT_SYMBOL(drm_fb_xrgb8888_to_argb1555); 500 + 501 + static void drm_fb_xrgb8888_to_rgba5551_line(void *dbuf, const void *sbuf, unsigned int pixels) 502 + { 503 + __le16 *dbuf16 = dbuf; 504 + const __le32 *sbuf32 = sbuf; 505 + unsigned int x; 506 + u16 val16; 507 + u32 pix; 508 + 509 + for (x = 0; x < pixels; x++) { 510 + pix = le32_to_cpu(sbuf32[x]); 511 + val16 = ((pix & 0x00f80000) >> 8) | 512 + ((pix & 0x0000f800) >> 5) | 513 + ((pix & 0x000000f8) >> 2) | 514 + BIT(0); /* set alpha bit */ 515 + dbuf16[x] = cpu_to_le16(val16); 516 + } 517 + } 518 + 519 + /** 520 + * drm_fb_xrgb8888_to_rgba5551 - Convert XRGB8888 to RGBA5551 clip buffer 521 + * @dst: Array of RGBA5551 destination buffers 522 + * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines 523 + * within @dst; can be NULL if scanlines are stored next to each other. 524 + * @src: Array of XRGB8888 source buffer 525 + * @fb: DRM framebuffer 526 + * @clip: Clip rectangle area to copy 527 + * 528 + * This function copies parts of a framebuffer to display memory and converts 529 + * the color format during the process. The parameters @dst, @dst_pitch and 530 + * @src refer to arrays. Each array must have at least as many entries as 531 + * there are planes in @fb's format. Each entry stores the value for the 532 + * format's respective color plane at the same index. 533 + * 534 + * This function does not apply clipping on @dst (i.e. the destination is at the 535 + * top-left corner). 536 + * 537 + * Drivers can use this function for RGBA5551 devices that don't support 538 + * XRGB8888 natively. It sets an opaque alpha channel as part of the conversion. 539 + */ 540 + void drm_fb_xrgb8888_to_rgba5551(struct iosys_map *dst, const unsigned int *dst_pitch, 541 + const struct iosys_map *src, const struct drm_framebuffer *fb, 542 + const struct drm_rect *clip) 543 + { 544 + static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = { 545 + 2, 546 + }; 547 + 548 + drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false, 549 + drm_fb_xrgb8888_to_rgba5551_line); 550 + } 551 + EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgba5551); 552 + 399 553 static void drm_fb_xrgb8888_to_rgb888_line(void *dbuf, const void *sbuf, unsigned int pixels) 400 554 { 401 555 u8 *dbuf8 = dbuf; ··· 560 404 561 405 for (x = 0; x < pixels; x++) { 562 406 pix = le32_to_cpu(sbuf32[x]); 407 + /* write blue-green-red to output in little endianness */ 563 408 *dbuf8++ = (pix & 0x000000FF) >> 0; 564 409 *dbuf8++ = (pix & 0x0000FF00) >> 8; 565 410 *dbuf8++ = (pix & 0x00FF0000) >> 16; ··· 601 444 } 602 445 EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb888); 603 446 604 - static void drm_fb_rgb565_to_xrgb8888_line(void *dbuf, const void *sbuf, unsigned int pixels) 447 + static void drm_fb_xrgb8888_to_argb8888_line(void *dbuf, const void *sbuf, unsigned int pixels) 605 448 { 606 449 __le32 *dbuf32 = dbuf; 607 - const __le16 *sbuf16 = sbuf; 450 + const __le32 *sbuf32 = sbuf; 608 451 unsigned int x; 452 + u32 pix; 609 453 610 454 for (x = 0; x < pixels; x++) { 611 - u16 val16 = le16_to_cpu(sbuf16[x]); 612 - u32 val32 = ((val16 & 0xf800) << 8) | 613 - ((val16 & 0x07e0) << 5) | 614 - ((val16 & 0x001f) << 3); 615 - val32 = 0xff000000 | val32 | 616 - ((val32 >> 3) & 0x00070007) | 617 - ((val32 >> 2) & 0x00000300); 618 - dbuf32[x] = cpu_to_le32(val32); 619 - } 620 - } 621 - 622 - static void drm_fb_rgb565_to_xrgb8888(struct iosys_map *dst, const unsigned int *dst_pitch, 623 - const struct iosys_map *src, 624 - const struct drm_framebuffer *fb, 625 - const struct drm_rect *clip) 626 - { 627 - static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = { 628 - 4, 629 - }; 630 - 631 - drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false, 632 - drm_fb_rgb565_to_xrgb8888_line); 633 - } 634 - 635 - static void drm_fb_rgb888_to_xrgb8888_line(void *dbuf, const void *sbuf, unsigned int pixels) 636 - { 637 - __le32 *dbuf32 = dbuf; 638 - const u8 *sbuf8 = sbuf; 639 - unsigned int x; 640 - 641 - for (x = 0; x < pixels; x++) { 642 - u8 r = *sbuf8++; 643 - u8 g = *sbuf8++; 644 - u8 b = *sbuf8++; 645 - u32 pix = 0xff000000 | (r << 16) | (g << 8) | b; 455 + pix = le32_to_cpu(sbuf32[x]); 456 + pix |= GENMASK(31, 24); /* fill alpha bits */ 646 457 dbuf32[x] = cpu_to_le32(pix); 647 458 } 648 459 } 649 460 650 - static void drm_fb_rgb888_to_xrgb8888(struct iosys_map *dst, const unsigned int *dst_pitch, 651 - const struct iosys_map *src, 652 - const struct drm_framebuffer *fb, 653 - const struct drm_rect *clip) 461 + /** 462 + * drm_fb_xrgb8888_to_argb8888 - Convert XRGB8888 to ARGB8888 clip buffer 463 + * @dst: Array of ARGB8888 destination buffers 464 + * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines 465 + * within @dst; can be NULL if scanlines are stored next to each other. 466 + * @src: Array of XRGB8888 source buffer 467 + * @fb: DRM framebuffer 468 + * @clip: Clip rectangle area to copy 469 + * 470 + * This function copies parts of a framebuffer to display memory and converts the 471 + * color format during the process. The parameters @dst, @dst_pitch and @src refer 472 + * to arrays. Each array must have at least as many entries as there are planes in 473 + * @fb's format. Each entry stores the value for the format's respective color plane 474 + * at the same index. 475 + * 476 + * This function does not apply clipping on @dst (i.e. the destination is at the 477 + * top-left corner). 478 + * 479 + * Drivers can use this function for ARGB8888 devices that don't support XRGB8888 480 + * natively. It sets an opaque alpha channel as part of the conversion. 481 + */ 482 + void drm_fb_xrgb8888_to_argb8888(struct iosys_map *dst, const unsigned int *dst_pitch, 483 + const struct iosys_map *src, const struct drm_framebuffer *fb, 484 + const struct drm_rect *clip) 654 485 { 655 486 static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = { 656 487 4, 657 488 }; 658 489 659 490 drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false, 660 - drm_fb_rgb888_to_xrgb8888_line); 491 + drm_fb_xrgb8888_to_argb8888_line); 661 492 } 493 + EXPORT_SYMBOL(drm_fb_xrgb8888_to_argb8888); 662 494 663 495 static void drm_fb_xrgb8888_to_xrgb2101010_line(void *dbuf, const void *sbuf, unsigned int pixels) 664 496 { ··· 700 554 drm_fb_xrgb8888_to_xrgb2101010_line); 701 555 } 702 556 EXPORT_SYMBOL(drm_fb_xrgb8888_to_xrgb2101010); 557 + 558 + static void drm_fb_xrgb8888_to_argb2101010_line(void *dbuf, const void *sbuf, unsigned int pixels) 559 + { 560 + __le32 *dbuf32 = dbuf; 561 + const __le32 *sbuf32 = sbuf; 562 + unsigned int x; 563 + u32 val32; 564 + u32 pix; 565 + 566 + for (x = 0; x < pixels; x++) { 567 + pix = le32_to_cpu(sbuf32[x]); 568 + val32 = ((pix & 0x000000ff) << 2) | 569 + ((pix & 0x0000ff00) << 4) | 570 + ((pix & 0x00ff0000) << 6); 571 + pix = GENMASK(31, 30) | /* set alpha bits */ 572 + val32 | ((val32 >> 8) & 0x00300c03); 573 + *dbuf32++ = cpu_to_le32(pix); 574 + } 575 + } 576 + 577 + /** 578 + * drm_fb_xrgb8888_to_argb2101010 - Convert XRGB8888 to ARGB2101010 clip buffer 579 + * @dst: Array of ARGB2101010 destination buffers 580 + * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines 581 + * within @dst; can be NULL if scanlines are stored next to each other. 582 + * @src: Array of XRGB8888 source buffers 583 + * @fb: DRM framebuffer 584 + * @clip: Clip rectangle area to copy 585 + * 586 + * This function copies parts of a framebuffer to display memory and converts 587 + * the color format during the process. The parameters @dst, @dst_pitch and 588 + * @src refer to arrays. Each array must have at least as many entries as 589 + * there are planes in @fb's format. Each entry stores the value for the 590 + * format's respective color plane at the same index. 591 + * 592 + * This function does not apply clipping on @dst (i.e. the destination is at the 593 + * top-left corner). 594 + * 595 + * Drivers can use this function for ARGB2101010 devices that don't support XRGB8888 596 + * natively. 597 + */ 598 + void drm_fb_xrgb8888_to_argb2101010(struct iosys_map *dst, const unsigned int *dst_pitch, 599 + const struct iosys_map *src, const struct drm_framebuffer *fb, 600 + const struct drm_rect *clip) 601 + { 602 + static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = { 603 + 4, 604 + }; 605 + 606 + drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false, 607 + drm_fb_xrgb8888_to_argb2101010_line); 608 + } 609 + EXPORT_SYMBOL(drm_fb_xrgb8888_to_argb2101010); 703 610 704 611 static void drm_fb_xrgb8888_to_gray8_line(void *dbuf, const void *sbuf, unsigned int pixels) 705 612 { ··· 840 641 { 841 642 uint32_t fb_format = fb->format->format; 842 643 843 - /* treat alpha channel like filler bits */ 844 - if (fb_format == DRM_FORMAT_ARGB8888) 845 - fb_format = DRM_FORMAT_XRGB8888; 846 - if (dst_format == DRM_FORMAT_ARGB8888) 847 - dst_format = DRM_FORMAT_XRGB8888; 848 - if (fb_format == DRM_FORMAT_ARGB2101010) 849 - fb_format = DRM_FORMAT_XRGB2101010; 850 - if (dst_format == DRM_FORMAT_ARGB2101010) 851 - dst_format = DRM_FORMAT_XRGB2101010; 852 - 853 - if (dst_format == fb_format) { 644 + if (fb_format == dst_format) { 854 645 drm_fb_memcpy(dst, dst_pitch, src, fb, clip); 855 646 return 0; 856 - 857 - } else if (dst_format == DRM_FORMAT_RGB565) { 858 - if (fb_format == DRM_FORMAT_XRGB8888) { 647 + } else if (fb_format == (dst_format | DRM_FORMAT_BIG_ENDIAN)) { 648 + drm_fb_swab(dst, dst_pitch, src, fb, clip, false); 649 + return 0; 650 + } else if (fb_format == (dst_format & ~DRM_FORMAT_BIG_ENDIAN)) { 651 + drm_fb_swab(dst, dst_pitch, src, fb, clip, false); 652 + return 0; 653 + } else if (fb_format == DRM_FORMAT_XRGB8888) { 654 + if (dst_format == DRM_FORMAT_RGB565) { 859 655 drm_fb_xrgb8888_to_rgb565(dst, dst_pitch, src, fb, clip, false); 860 656 return 0; 861 - } 862 - } else if (dst_format == (DRM_FORMAT_RGB565 | DRM_FORMAT_BIG_ENDIAN)) { 863 - if (fb_format == DRM_FORMAT_RGB565) { 864 - drm_fb_swab(dst, dst_pitch, src, fb, clip, false); 657 + } else if (dst_format == DRM_FORMAT_XRGB1555) { 658 + drm_fb_xrgb8888_to_xrgb1555(dst, dst_pitch, src, fb, clip); 865 659 return 0; 866 - } 867 - } else if (dst_format == DRM_FORMAT_RGB888) { 868 - if (fb_format == DRM_FORMAT_XRGB8888) { 660 + } else if (dst_format == DRM_FORMAT_ARGB1555) { 661 + drm_fb_xrgb8888_to_argb1555(dst, dst_pitch, src, fb, clip); 662 + return 0; 663 + } else if (dst_format == DRM_FORMAT_RGBA5551) { 664 + drm_fb_xrgb8888_to_rgba5551(dst, dst_pitch, src, fb, clip); 665 + return 0; 666 + } else if (dst_format == DRM_FORMAT_RGB888) { 869 667 drm_fb_xrgb8888_to_rgb888(dst, dst_pitch, src, fb, clip); 870 668 return 0; 871 - } 872 - } else if (dst_format == DRM_FORMAT_XRGB8888) { 873 - if (fb_format == DRM_FORMAT_RGB888) { 874 - drm_fb_rgb888_to_xrgb8888(dst, dst_pitch, src, fb, clip); 669 + } else if (dst_format == DRM_FORMAT_ARGB8888) { 670 + drm_fb_xrgb8888_to_argb8888(dst, dst_pitch, src, fb, clip); 875 671 return 0; 876 - } else if (fb_format == DRM_FORMAT_RGB565) { 877 - drm_fb_rgb565_to_xrgb8888(dst, dst_pitch, src, fb, clip); 878 - return 0; 879 - } 880 - } else if (dst_format == DRM_FORMAT_XRGB2101010) { 881 - if (fb_format == DRM_FORMAT_XRGB8888) { 672 + } else if (dst_format == DRM_FORMAT_XRGB2101010) { 882 673 drm_fb_xrgb8888_to_xrgb2101010(dst, dst_pitch, src, fb, clip); 883 674 return 0; 884 - } 885 - } else if (dst_format == DRM_FORMAT_BGRX8888) { 886 - if (fb_format == DRM_FORMAT_XRGB8888) { 675 + } else if (dst_format == DRM_FORMAT_ARGB2101010) { 676 + drm_fb_xrgb8888_to_argb2101010(dst, dst_pitch, src, fb, clip); 677 + return 0; 678 + } else if (dst_format == DRM_FORMAT_BGRX8888) { 887 679 drm_fb_swab(dst, dst_pitch, src, fb, clip, false); 888 680 return 0; 889 681 } ··· 995 805 } 996 806 EXPORT_SYMBOL(drm_fb_xrgb8888_to_mono); 997 807 808 + static uint32_t drm_fb_nonalpha_fourcc(uint32_t fourcc) 809 + { 810 + /* only handle formats with depth != 0 and alpha channel */ 811 + switch (fourcc) { 812 + case DRM_FORMAT_ARGB1555: 813 + return DRM_FORMAT_XRGB1555; 814 + case DRM_FORMAT_ABGR1555: 815 + return DRM_FORMAT_XBGR1555; 816 + case DRM_FORMAT_RGBA5551: 817 + return DRM_FORMAT_RGBX5551; 818 + case DRM_FORMAT_BGRA5551: 819 + return DRM_FORMAT_BGRX5551; 820 + case DRM_FORMAT_ARGB8888: 821 + return DRM_FORMAT_XRGB8888; 822 + case DRM_FORMAT_ABGR8888: 823 + return DRM_FORMAT_XBGR8888; 824 + case DRM_FORMAT_RGBA8888: 825 + return DRM_FORMAT_RGBX8888; 826 + case DRM_FORMAT_BGRA8888: 827 + return DRM_FORMAT_BGRX8888; 828 + case DRM_FORMAT_ARGB2101010: 829 + return DRM_FORMAT_XRGB2101010; 830 + case DRM_FORMAT_ABGR2101010: 831 + return DRM_FORMAT_XBGR2101010; 832 + case DRM_FORMAT_RGBA1010102: 833 + return DRM_FORMAT_RGBX1010102; 834 + case DRM_FORMAT_BGRA1010102: 835 + return DRM_FORMAT_BGRX1010102; 836 + } 837 + 838 + return fourcc; 839 + } 840 + 998 841 static bool is_listed_fourcc(const uint32_t *fourccs, size_t nfourccs, uint32_t fourcc) 999 842 { 1000 843 const uint32_t *fourccs_end = fourccs + nfourccs; ··· 1040 817 return false; 1041 818 } 1042 819 1043 - static const uint32_t conv_from_xrgb8888[] = { 1044 - DRM_FORMAT_XRGB8888, 1045 - DRM_FORMAT_ARGB8888, 1046 - DRM_FORMAT_XRGB2101010, 1047 - DRM_FORMAT_ARGB2101010, 1048 - DRM_FORMAT_RGB565, 1049 - DRM_FORMAT_RGB888, 1050 - }; 1051 - 1052 - static const uint32_t conv_from_rgb565_888[] = { 1053 - DRM_FORMAT_XRGB8888, 1054 - DRM_FORMAT_ARGB8888, 1055 - }; 1056 - 1057 - static bool is_conversion_supported(uint32_t from, uint32_t to) 1058 - { 1059 - switch (from) { 1060 - case DRM_FORMAT_XRGB8888: 1061 - case DRM_FORMAT_ARGB8888: 1062 - return is_listed_fourcc(conv_from_xrgb8888, ARRAY_SIZE(conv_from_xrgb8888), to); 1063 - case DRM_FORMAT_RGB565: 1064 - case DRM_FORMAT_RGB888: 1065 - return is_listed_fourcc(conv_from_rgb565_888, ARRAY_SIZE(conv_from_rgb565_888), to); 1066 - case DRM_FORMAT_XRGB2101010: 1067 - return to == DRM_FORMAT_ARGB2101010; 1068 - case DRM_FORMAT_ARGB2101010: 1069 - return to == DRM_FORMAT_XRGB2101010; 1070 - default: 1071 - return false; 1072 - } 1073 - } 1074 - 1075 820 /** 1076 821 * drm_fb_build_fourcc_list - Filters a list of supported color formats against 1077 822 * the device's native formats 1078 823 * @dev: DRM device 1079 824 * @native_fourccs: 4CC codes of natively supported color formats 1080 825 * @native_nfourccs: The number of entries in @native_fourccs 1081 - * @driver_fourccs: 4CC codes of all driver-supported color formats 1082 - * @driver_nfourccs: The number of entries in @driver_fourccs 1083 826 * @fourccs_out: Returns 4CC codes of supported color formats 1084 827 * @nfourccs_out: The number of available entries in @fourccs_out 1085 828 * 1086 829 * This function create a list of supported color format from natively 1087 - * supported formats and the emulated formats. 830 + * supported formats and additional emulated formats. 1088 831 * At a minimum, most userspace programs expect at least support for 1089 832 * XRGB8888 on the primary plane. Devices that have to emulate the 1090 833 * format, and possibly others, can use drm_fb_build_fourcc_list() to 1091 834 * create a list of supported color formats. The returned list can 1092 835 * be handed over to drm_universal_plane_init() et al. Native formats 1093 - * will go before emulated formats. Other heuristics might be applied 836 + * will go before emulated formats. Native formats with alpha channel 837 + * will be replaced by such without, as primary planes usually don't 838 + * support alpha. Other heuristics might be applied 1094 839 * to optimize the order. Formats near the beginning of the list are 1095 - * usually preferred over formats near the end of the list. Formats 1096 - * without conversion helpers will be skipped. New drivers should only 1097 - * pass in XRGB8888 and avoid exposing additional emulated formats. 840 + * usually preferred over formats near the end of the list. 1098 841 * 1099 842 * Returns: 1100 843 * The number of color-formats 4CC codes returned in @fourccs_out. 1101 844 */ 1102 845 size_t drm_fb_build_fourcc_list(struct drm_device *dev, 1103 846 const u32 *native_fourccs, size_t native_nfourccs, 1104 - const u32 *driver_fourccs, size_t driver_nfourccs, 1105 847 u32 *fourccs_out, size_t nfourccs_out) 1106 848 { 849 + /* 850 + * XRGB8888 is the default fallback format for most of userspace 851 + * and it's currently the only format that should be emulated for 852 + * the primary plane. Only if there's ever another default fallback, 853 + * it should be added here. 854 + */ 855 + static const uint32_t extra_fourccs[] = { 856 + DRM_FORMAT_XRGB8888, 857 + }; 858 + static const size_t extra_nfourccs = ARRAY_SIZE(extra_fourccs); 859 + 1107 860 u32 *fourccs = fourccs_out; 1108 861 const u32 *fourccs_end = fourccs_out + nfourccs_out; 1109 - uint32_t native_format = 0; 1110 862 size_t i; 1111 863 1112 864 /* ··· 1089 891 */ 1090 892 1091 893 for (i = 0; i < native_nfourccs; ++i) { 1092 - u32 fourcc = native_fourccs[i]; 894 + /* 895 + * Several DTs, boot loaders and firmware report native 896 + * alpha formats that are non-alpha formats instead. So 897 + * replace alpha formats by non-alpha formats. 898 + */ 899 + u32 fourcc = drm_fb_nonalpha_fourcc(native_fourccs[i]); 1093 900 1094 901 if (is_listed_fourcc(fourccs_out, fourccs - fourccs_out, fourcc)) { 1095 902 continue; /* skip duplicate entries */ ··· 1105 902 1106 903 drm_dbg_kms(dev, "adding native format %p4cc\n", &fourcc); 1107 904 1108 - /* 1109 - * There should only be one native format with the current API. 1110 - * This API needs to be refactored to correctly support arbitrary 1111 - * sets of native formats, since it needs to report which native 1112 - * format to use for each emulated format. 1113 - */ 1114 - if (!native_format) 1115 - native_format = fourcc; 1116 905 *fourccs = fourcc; 1117 906 ++fourccs; 1118 907 } ··· 1113 918 * The extra formats, emulated by the driver, go second. 1114 919 */ 1115 920 1116 - for (i = 0; (i < driver_nfourccs) && (fourccs < fourccs_end); ++i) { 1117 - u32 fourcc = driver_fourccs[i]; 921 + for (i = 0; (i < extra_nfourccs) && (fourccs < fourccs_end); ++i) { 922 + u32 fourcc = extra_fourccs[i]; 1118 923 1119 924 if (is_listed_fourcc(fourccs_out, fourccs - fourccs_out, fourcc)) { 1120 925 continue; /* skip duplicate and native entries */ 1121 926 } else if (fourccs == fourccs_end) { 1122 927 drm_warn(dev, "Ignoring emulated format %p4cc\n", &fourcc); 1123 928 continue; /* end of available output buffer */ 1124 - } else if (!is_conversion_supported(fourcc, native_format)) { 1125 - drm_dbg_kms(dev, "Unsupported emulated format %p4cc\n", &fourcc); 1126 - continue; /* format is not supported for conversion */ 1127 929 } 1128 930 1129 931 drm_dbg_kms(dev, "adding emulated format %p4cc\n", &fourcc);
+2 -2
drivers/gpu/drm/drm_gem_dma_helper.c
··· 477 477 dma_obj->dma_addr = sg_dma_address(sgt->sgl); 478 478 dma_obj->sgt = sgt; 479 479 480 - DRM_DEBUG_PRIME("dma_addr = %pad, size = %zu\n", &dma_obj->dma_addr, 481 - attach->dmabuf->size); 480 + drm_dbg_prime(dev, "dma_addr = %pad, size = %zu\n", &dma_obj->dma_addr, 481 + attach->dmabuf->size); 482 482 483 483 return &dma_obj->base; 484 484 }
+1 -1
drivers/gpu/drm/drm_gem_shmem_helper.c
··· 766 766 767 767 shmem->sgt = sgt; 768 768 769 - DRM_DEBUG_PRIME("size = %zu\n", size); 769 + drm_dbg_prime(dev, "size = %zu\n", size); 770 770 771 771 return &shmem->base; 772 772 }
+7 -6
drivers/gpu/drm/drm_ioc32.c
··· 972 972 { 973 973 unsigned int nr = DRM_IOCTL_NR(cmd); 974 974 struct drm_file *file_priv = filp->private_data; 975 + struct drm_device *dev = file_priv->minor->dev; 975 976 drm_ioctl_compat_t *fn; 976 977 int ret; 977 978 ··· 987 986 if (!fn) 988 987 return drm_ioctl(filp, cmd, arg); 989 988 990 - DRM_DEBUG("comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, %s\n", 991 - current->comm, task_pid_nr(current), 992 - (long)old_encode_dev(file_priv->minor->kdev->devt), 993 - file_priv->authenticated, 994 - drm_compat_ioctls[nr].name); 989 + drm_dbg_core(dev, "comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, %s\n", 990 + current->comm, task_pid_nr(current), 991 + (long)old_encode_dev(file_priv->minor->kdev->devt), 992 + file_priv->authenticated, 993 + drm_compat_ioctls[nr].name); 995 994 ret = (*fn)(filp, cmd, arg); 996 995 if (ret) 997 - DRM_DEBUG("ret = %d\n", ret); 996 + drm_dbg_core(dev, "ret = %d\n", ret); 998 997 return ret; 999 998 } 1000 999 EXPORT_SYMBOL(drm_compat_ioctl);
+13 -12
drivers/gpu/drm/drm_ioctl.c
··· 440 440 int drm_noop(struct drm_device *dev, void *data, 441 441 struct drm_file *file_priv) 442 442 { 443 - DRM_DEBUG("\n"); 443 + drm_dbg_core(dev, "\n"); 444 444 return 0; 445 445 } 446 446 EXPORT_SYMBOL(drm_noop); ··· 856 856 out_size = 0; 857 857 ksize = max(max(in_size, out_size), drv_size); 858 858 859 - DRM_DEBUG("comm=\"%s\" pid=%d, dev=0x%lx, auth=%d, %s\n", 860 - current->comm, task_pid_nr(current), 861 - (long)old_encode_dev(file_priv->minor->kdev->devt), 862 - file_priv->authenticated, ioctl->name); 859 + drm_dbg_core(dev, "comm=\"%s\" pid=%d, dev=0x%lx, auth=%d, %s\n", 860 + current->comm, task_pid_nr(current), 861 + (long)old_encode_dev(file_priv->minor->kdev->devt), 862 + file_priv->authenticated, ioctl->name); 863 863 864 864 /* Do not trust userspace, use our own definition */ 865 865 func = ioctl->func; 866 866 867 867 if (unlikely(!func)) { 868 - DRM_DEBUG("no function\n"); 868 + drm_dbg_core(dev, "no function\n"); 869 869 retcode = -EINVAL; 870 870 goto err_i1; 871 871 } ··· 894 894 895 895 err_i1: 896 896 if (!ioctl) 897 - DRM_DEBUG("invalid ioctl: comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n", 898 - current->comm, task_pid_nr(current), 899 - (long)old_encode_dev(file_priv->minor->kdev->devt), 900 - file_priv->authenticated, cmd, nr); 897 + drm_dbg_core(dev, 898 + "invalid ioctl: comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n", 899 + current->comm, task_pid_nr(current), 900 + (long)old_encode_dev(file_priv->minor->kdev->devt), 901 + file_priv->authenticated, cmd, nr); 901 902 902 903 if (kdata != stack_kdata) 903 904 kfree(kdata); 904 905 if (retcode) 905 - DRM_DEBUG("comm=\"%s\", pid=%d, ret=%d\n", current->comm, 906 - task_pid_nr(current), retcode); 906 + drm_dbg_core(dev, "comm=\"%s\", pid=%d, ret=%d\n", 907 + current->comm, task_pid_nr(current), retcode); 907 908 return retcode; 908 909 } 909 910 EXPORT_SYMBOL(drm_ioctl);
+34 -30
drivers/gpu/drm/drm_lease.c
··· 213 213 int id; 214 214 void *entry; 215 215 216 - DRM_DEBUG_LEASE("lessor %d\n", lessor->lessee_id); 216 + drm_dbg_lease(dev, "lessor %d\n", lessor->lessee_id); 217 217 218 218 lessee = drm_master_create(lessor->dev); 219 219 if (!lessee) { 220 - DRM_DEBUG_LEASE("drm_master_create failed\n"); 220 + drm_dbg_lease(dev, "drm_master_create failed\n"); 221 221 return ERR_PTR(-ENOMEM); 222 222 } 223 223 ··· 231 231 error = -EBUSY; 232 232 233 233 if (error != 0) { 234 - DRM_DEBUG_LEASE("object %d failed %d\n", object, error); 234 + drm_dbg_lease(dev, "object %d failed %d\n", object, error); 235 235 goto out_lessee; 236 236 } 237 237 } ··· 249 249 250 250 /* Move the leases over */ 251 251 lessee->leases = *leases; 252 - DRM_DEBUG_LEASE("new lessee %d %p, lessor %d %p\n", lessee->lessee_id, lessee, lessor->lessee_id, lessor); 252 + drm_dbg_lease(dev, "new lessee %d %p, lessor %d %p\n", 253 + lessee->lessee_id, lessee, lessor->lessee_id, lessor); 253 254 254 255 mutex_unlock(&dev->mode_config.idr_mutex); 255 256 return lessee; ··· 269 268 270 269 mutex_lock(&dev->mode_config.idr_mutex); 271 270 272 - DRM_DEBUG_LEASE("drm_lease_destroy %d\n", master->lessee_id); 271 + drm_dbg_lease(dev, "drm_lease_destroy %d\n", master->lessee_id); 273 272 274 273 /* This master is referenced by all lessees, hence it cannot be destroyed 275 274 * until all of them have been ··· 278 277 279 278 /* Remove this master from the lessee idr in the owner */ 280 279 if (master->lessee_id != 0) { 281 - DRM_DEBUG_LEASE("remove master %d from device list of lessees\n", master->lessee_id); 280 + drm_dbg_lease(dev, "remove master %d from device list of lessees\n", 281 + master->lessee_id); 282 282 idr_remove(&(drm_lease_owner(master)->lessee_idr), master->lessee_id); 283 283 } 284 284 ··· 294 292 drm_master_put(&master->lessor); 295 293 } 296 294 297 - DRM_DEBUG_LEASE("drm_lease_destroy done %d\n", master->lessee_id); 295 + drm_dbg_lease(dev, "drm_lease_destroy done %d\n", master->lessee_id); 298 296 } 299 297 300 298 static void _drm_lease_revoke(struct drm_master *top) ··· 310 308 * the tree is fully connected, we can do this without recursing 311 309 */ 312 310 for (;;) { 313 - DRM_DEBUG_LEASE("revoke leases for %p %d\n", master, master->lessee_id); 311 + drm_dbg_lease(master->dev, "revoke leases for %p %d\n", 312 + master, master->lessee_id); 314 313 315 314 /* Evacuate the lease */ 316 315 idr_for_each_entry(&master->leases, entry, object) ··· 411 408 412 409 ret = validate_lease(dev, object_count, objects, universal_planes); 413 410 if (ret) { 414 - DRM_DEBUG_LEASE("lease validation failed\n"); 411 + drm_dbg_lease(dev, "lease validation failed\n"); 415 412 goto out_free_objects; 416 413 } 417 414 ··· 421 418 struct drm_mode_object *obj = objects[o]; 422 419 u32 object_id = objects[o]->id; 423 420 424 - DRM_DEBUG_LEASE("Adding object %d to lease\n", object_id); 421 + drm_dbg_lease(dev, "Adding object %d to lease\n", object_id); 425 422 426 423 /* 427 424 * We're using an IDR to hold the set of leased ··· 433 430 */ 434 431 ret = idr_alloc(leases, &drm_lease_idr_object , object_id, object_id + 1, GFP_KERNEL); 435 432 if (ret < 0) { 436 - DRM_DEBUG_LEASE("Object %d cannot be inserted into leases (%d)\n", 437 - object_id, ret); 433 + drm_dbg_lease(dev, "Object %d cannot be inserted into leases (%d)\n", 434 + object_id, ret); 438 435 goto out_free_objects; 439 436 } 440 437 if (obj->type == DRM_MODE_OBJECT_CRTC && !universal_planes) { ··· 442 439 443 440 ret = idr_alloc(leases, &drm_lease_idr_object, crtc->primary->base.id, crtc->primary->base.id + 1, GFP_KERNEL); 444 441 if (ret < 0) { 445 - DRM_DEBUG_LEASE("Object primary plane %d cannot be inserted into leases (%d)\n", 446 - object_id, ret); 442 + drm_dbg_lease(dev, "Object primary plane %d cannot be inserted into leases (%d)\n", 443 + object_id, ret); 447 444 goto out_free_objects; 448 445 } 449 446 if (crtc->cursor) { 450 447 ret = idr_alloc(leases, &drm_lease_idr_object, crtc->cursor->base.id, crtc->cursor->base.id + 1, GFP_KERNEL); 451 448 if (ret < 0) { 452 - DRM_DEBUG_LEASE("Object cursor plane %d cannot be inserted into leases (%d)\n", 453 - object_id, ret); 449 + drm_dbg_lease(dev, "Object cursor plane %d cannot be inserted into leases (%d)\n", 450 + object_id, ret); 454 451 goto out_free_objects; 455 452 } 456 453 } ··· 493 490 return -EOPNOTSUPP; 494 491 495 492 if (cl->flags && (cl->flags & ~(O_CLOEXEC | O_NONBLOCK))) { 496 - DRM_DEBUG_LEASE("invalid flags\n"); 493 + drm_dbg_lease(dev, "invalid flags\n"); 497 494 return -EINVAL; 498 495 } 499 496 500 497 lessor = drm_file_get_master(lessor_priv); 501 498 /* Do not allow sub-leases */ 502 499 if (lessor->lessor) { 503 - DRM_DEBUG_LEASE("recursive leasing not allowed\n"); 500 + drm_dbg_lease(dev, "recursive leasing not allowed\n"); 504 501 ret = -EINVAL; 505 502 goto out_lessor; 506 503 } ··· 523 520 object_count, object_ids); 524 521 kfree(object_ids); 525 522 if (ret) { 526 - DRM_DEBUG_LEASE("lease object lookup failed: %i\n", ret); 523 + drm_dbg_lease(dev, "lease object lookup failed: %i\n", ret); 527 524 idr_destroy(&leases); 528 525 goto out_lessor; 529 526 } ··· 537 534 goto out_lessor; 538 535 } 539 536 540 - DRM_DEBUG_LEASE("Creating lease\n"); 537 + drm_dbg_lease(dev, "Creating lease\n"); 541 538 /* lessee will take the ownership of leases */ 542 539 lessee = drm_lease_create(lessor, &leases); 543 540 ··· 548 545 } 549 546 550 547 /* Clone the lessor file to create a new file for us */ 551 - DRM_DEBUG_LEASE("Allocating lease file\n"); 548 + drm_dbg_lease(dev, "Allocating lease file\n"); 552 549 lessee_file = file_clone_open(lessor_file); 553 550 if (IS_ERR(lessee_file)) { 554 551 ret = PTR_ERR(lessee_file); ··· 563 560 lessee_priv->authenticated = 1; 564 561 565 562 /* Pass fd back to userspace */ 566 - DRM_DEBUG_LEASE("Returning fd %d id %d\n", fd, lessee->lessee_id); 563 + drm_dbg_lease(dev, "Returning fd %d id %d\n", fd, lessee->lessee_id); 567 564 cl->fd = fd; 568 565 cl->lessee_id = lessee->lessee_id; 569 566 ··· 571 568 fd_install(fd, lessee_file); 572 569 573 570 drm_master_put(&lessor); 574 - DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl succeeded\n"); 571 + drm_dbg_lease(dev, "drm_mode_create_lease_ioctl succeeded\n"); 575 572 return 0; 576 573 577 574 out_lessee: ··· 582 579 583 580 out_lessor: 584 581 drm_master_put(&lessor); 585 - DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl failed: %d\n", ret); 582 + drm_dbg_lease(dev, "drm_mode_create_lease_ioctl failed: %d\n", ret); 586 583 return ret; 587 584 } 588 585 ··· 604 601 return -EOPNOTSUPP; 605 602 606 603 lessor = drm_file_get_master(lessor_priv); 607 - DRM_DEBUG_LEASE("List lessees for %d\n", lessor->lessee_id); 604 + drm_dbg_lease(dev, "List lessees for %d\n", lessor->lessee_id); 608 605 609 606 mutex_lock(&dev->mode_config.idr_mutex); 610 607 ··· 613 610 /* Only list un-revoked leases */ 614 611 if (!idr_is_empty(&lessee->leases)) { 615 612 if (count_lessees > count) { 616 - DRM_DEBUG_LEASE("Add lessee %d\n", lessee->lessee_id); 613 + drm_dbg_lease(dev, "Add lessee %d\n", 614 + lessee->lessee_id); 617 615 ret = put_user(lessee->lessee_id, lessee_ids + count); 618 616 if (ret) 619 617 break; ··· 623 619 } 624 620 } 625 621 626 - DRM_DEBUG_LEASE("Lessor leases to %d\n", count); 622 + drm_dbg_lease(dev, "Lessor leases to %d\n", count); 627 623 if (ret == 0) 628 624 arg->count_lessees = count; 629 625 ··· 655 651 return -EOPNOTSUPP; 656 652 657 653 lessee = drm_file_get_master(lessee_priv); 658 - DRM_DEBUG_LEASE("get lease for %d\n", lessee->lessee_id); 654 + drm_dbg_lease(dev, "get lease for %d\n", lessee->lessee_id); 659 655 660 656 mutex_lock(&dev->mode_config.idr_mutex); 661 657 ··· 669 665 count = 0; 670 666 idr_for_each_entry(object_idr, entry, object) { 671 667 if (count_objects > count) { 672 - DRM_DEBUG_LEASE("adding object %d\n", object); 668 + drm_dbg_lease(dev, "adding object %d\n", object); 673 669 ret = put_user(object, object_ids + count); 674 670 if (ret) 675 671 break; ··· 700 696 struct drm_master *lessee; 701 697 int ret = 0; 702 698 703 - DRM_DEBUG_LEASE("revoke lease for %d\n", arg->lessee_id); 699 + drm_dbg_lease(dev, "revoke lease for %d\n", arg->lessee_id); 704 700 705 701 /* Can't lease without MODESET */ 706 702 if (!drm_core_check_feature(dev, DRIVER_MODESET))
+5
drivers/gpu/drm/drm_plane.c
··· 46 46 * properties that specify how the pixels are positioned and blended, like 47 47 * rotation or Z-position. All these properties are stored in &drm_plane_state. 48 48 * 49 + * Unless explicitly specified (via CRTC property or otherwise), the active area 50 + * of a CRTC will be black by default. This means portions of the active area 51 + * which are not covered by a plane will be black, and alpha blending of any 52 + * planes with the CRTC background will blend with black at the lowest zpos. 53 + * 49 54 * To create a plane, a KMS drivers allocates and zeroes an instances of 50 55 * &struct drm_plane (possibly as part of a larger structure) and registers it 51 56 * with a call to drm_universal_plane_init().
+32 -8
drivers/gpu/drm/drm_probe_helper.c
··· 250 250 251 251 drm_connector_list_iter_begin(dev, &conn_iter); 252 252 drm_for_each_connector_iter(connector, &conn_iter) { 253 + const struct drm_connector_helper_funcs *funcs = 254 + connector->helper_private; 255 + 256 + if (funcs && funcs->enable_hpd) 257 + funcs->enable_hpd(connector); 258 + 253 259 if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | 254 260 DRM_CONNECTOR_POLL_DISCONNECT)) 255 261 poll = true; ··· 808 802 } 809 803 EXPORT_SYMBOL(drm_kms_helper_is_poll_worker); 810 804 805 + static void drm_kms_helper_poll_disable_fini(struct drm_device *dev, bool fini) 806 + { 807 + struct drm_connector *connector; 808 + struct drm_connector_list_iter conn_iter; 809 + 810 + if (!dev->mode_config.poll_enabled) 811 + return; 812 + 813 + if (fini) 814 + dev->mode_config.poll_enabled = false; 815 + 816 + drm_connector_list_iter_begin(dev, &conn_iter); 817 + drm_for_each_connector_iter(connector, &conn_iter) { 818 + const struct drm_connector_helper_funcs *funcs = 819 + connector->helper_private; 820 + 821 + if (funcs && funcs->disable_hpd) 822 + funcs->disable_hpd(connector); 823 + } 824 + drm_connector_list_iter_end(&conn_iter); 825 + 826 + cancel_delayed_work_sync(&dev->mode_config.output_poll_work); 827 + } 828 + 811 829 /** 812 830 * drm_kms_helper_poll_disable - disable output polling 813 831 * @dev: drm_device ··· 848 818 */ 849 819 void drm_kms_helper_poll_disable(struct drm_device *dev) 850 820 { 851 - if (!dev->mode_config.poll_enabled) 852 - return; 853 - cancel_delayed_work_sync(&dev->mode_config.output_poll_work); 821 + drm_kms_helper_poll_disable_fini(dev, false); 854 822 } 855 823 EXPORT_SYMBOL(drm_kms_helper_poll_disable); 856 824 ··· 886 858 */ 887 859 void drm_kms_helper_poll_fini(struct drm_device *dev) 888 860 { 889 - if (!dev->mode_config.poll_enabled) 890 - return; 891 - 892 - dev->mode_config.poll_enabled = false; 893 - cancel_delayed_work_sync(&dev->mode_config.output_poll_work); 861 + drm_kms_helper_poll_disable_fini(dev, true); 894 862 } 895 863 EXPORT_SYMBOL(drm_kms_helper_poll_fini); 896 864
+2
drivers/gpu/drm/gma500/Kconfig
··· 3 3 tristate "Intel GMA500/600/3600/3650 KMS Framebuffer" 4 4 depends on DRM && PCI && X86 && MMU 5 5 select DRM_KMS_HELPER 6 + select I2C 7 + select I2C_ALGOBIT 6 8 # GMA500 depends on ACPI_VIDEO when ACPI is enabled, just like i915 7 9 select ACPI_VIDEO if ACPI 8 10 select BACKLIGHT_CLASS_DEVICE if ACPI
+4 -13
drivers/gpu/drm/gud/gud_drv.c
··· 325 325 326 326 static int gud_stats_debugfs(struct seq_file *m, void *data) 327 327 { 328 - struct drm_info_node *node = m->private; 329 - struct gud_device *gdrm = to_gud_device(node->minor->dev); 328 + struct drm_debugfs_entry *entry = m->private; 329 + struct gud_device *gdrm = to_gud_device(entry->dev); 330 330 char buf[10]; 331 331 332 332 string_get_size(gdrm->bulk_len, 1, STRING_UNITS_2, buf, sizeof(buf)); ··· 350 350 } 351 351 352 352 return 0; 353 - } 354 - 355 - static const struct drm_info_list gud_debugfs_list[] = { 356 - { "stats", gud_stats_debugfs, 0, NULL }, 357 - }; 358 - 359 - static void gud_debugfs_init(struct drm_minor *minor) 360 - { 361 - drm_debugfs_create_files(gud_debugfs_list, ARRAY_SIZE(gud_debugfs_list), 362 - minor->debugfs_root, minor); 363 353 } 364 354 365 355 static const struct drm_simple_display_pipe_funcs gud_pipe_funcs = { ··· 376 386 .fops = &gud_fops, 377 387 DRM_GEM_SHMEM_DRIVER_OPS, 378 388 .gem_prime_import = gud_gem_prime_import, 379 - .debugfs_init = gud_debugfs_init, 380 389 381 390 .name = "gud", 382 391 .desc = "Generic USB Display", ··· 611 622 gdrm->dmadev = usb_intf_get_dma_device(intf); 612 623 if (!gdrm->dmadev) 613 624 dev_warn(dev, "buffer sharing not supported"); 625 + 626 + drm_debugfs_add_file(drm, "stats", gud_stats_debugfs, NULL); 614 627 615 628 ret = drm_dev_register(drm, 0); 616 629 if (ret) {
+2
drivers/gpu/drm/hisilicon/hibmc/Kconfig
··· 7 7 select DRM_VRAM_HELPER 8 8 select DRM_TTM 9 9 select DRM_TTM_HELPER 10 + select I2C 11 + select I2C_ALGOBIT 10 12 help 11 13 Choose this option if you have a Hisilicon Hibmc soc chipset. 12 14 If M is selected the module will be called hibmc-drm.
+2 -2
drivers/gpu/drm/i2c/ch7006_drv.c
··· 386 386 387 387 /* I2C driver functions */ 388 388 389 - static int ch7006_probe(struct i2c_client *client, const struct i2c_device_id *id) 389 + static int ch7006_probe(struct i2c_client *client) 390 390 { 391 391 uint8_t addr = CH7006_VERSION_ID; 392 392 uint8_t val; ··· 495 495 496 496 static struct drm_i2c_encoder_driver ch7006_driver = { 497 497 .i2c_driver = { 498 - .probe = ch7006_probe, 498 + .probe_new = ch7006_probe, 499 499 .remove = ch7006_remove, 500 500 501 501 .driver = {
+2 -2
drivers/gpu/drm/i2c/sil164_drv.c
··· 350 350 /* I2C driver functions */ 351 351 352 352 static int 353 - sil164_probe(struct i2c_client *client, const struct i2c_device_id *id) 353 + sil164_probe(struct i2c_client *client) 354 354 { 355 355 int vendor = sil164_read(client, SIL164_VENDOR_HI) << 8 | 356 356 sil164_read(client, SIL164_VENDOR_LO); ··· 420 420 421 421 static struct drm_i2c_encoder_driver sil164_driver = { 422 422 .i2c_driver = { 423 - .probe = sil164_probe, 423 + .probe_new = sil164_probe, 424 424 .driver = { 425 425 .name = "sil164", 426 426 },
+2 -3
drivers/gpu/drm/i2c/tda9950.c
··· 375 375 cec_delete_adapter(priv->adap); 376 376 } 377 377 378 - static int tda9950_probe(struct i2c_client *client, 379 - const struct i2c_device_id *id) 378 + static int tda9950_probe(struct i2c_client *client) 380 379 { 381 380 struct tda9950_glue *glue = client->dev.platform_data; 382 381 struct device *dev = &client->dev; ··· 492 493 MODULE_DEVICE_TABLE(i2c, tda9950_ids); 493 494 494 495 static struct i2c_driver tda9950_driver = { 495 - .probe = tda9950_probe, 496 + .probe_new = tda9950_probe, 496 497 .remove = tda9950_remove, 497 498 .driver = { 498 499 .name = "tda9950",
+2 -2
drivers/gpu/drm/i2c/tda998x_drv.c
··· 2059 2059 }; 2060 2060 2061 2061 static int 2062 - tda998x_probe(struct i2c_client *client, const struct i2c_device_id *id) 2062 + tda998x_probe(struct i2c_client *client) 2063 2063 { 2064 2064 int ret; 2065 2065 ··· 2099 2099 MODULE_DEVICE_TABLE(i2c, tda998x_ids); 2100 2100 2101 2101 static struct i2c_driver tda998x_driver = { 2102 - .probe = tda998x_probe, 2102 + .probe_new = tda998x_probe, 2103 2103 .remove = tda998x_remove, 2104 2104 .driver = { 2105 2105 .name = "tda998x",
+2
drivers/gpu/drm/i915/Kconfig
··· 18 18 select DRM_PANEL 19 19 select DRM_MIPI_DSI 20 20 select RELAY 21 + select I2C 22 + select I2C_ALGOBIT 21 23 select IRQ_WORK 22 24 # i915 depends on ACPI_VIDEO when ACPI is enabled 23 25 # but for select to work, need to select ACPI_VIDEO's dependencies, ick
-6
drivers/gpu/drm/imx/dcss/dcss-dev.c
··· 253 253 { 254 254 struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev); 255 255 struct drm_device *ddev = dcss_drv_dev_to_drm(dev); 256 - struct dcss_kms_dev *kms = container_of(ddev, struct dcss_kms_dev, base); 257 256 int ret; 258 - 259 - drm_bridge_connector_disable_hpd(kms->connector); 260 257 261 258 drm_mode_config_helper_suspend(ddev); 262 259 ··· 273 276 { 274 277 struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev); 275 278 struct drm_device *ddev = dcss_drv_dev_to_drm(dev); 276 - struct dcss_kms_dev *kms = container_of(ddev, struct dcss_kms_dev, base); 277 279 278 280 if (pm_runtime_suspended(dev)) { 279 281 drm_mode_config_helper_resume(ddev); ··· 286 290 dcss_ctxld_resume(dcss->ctxld); 287 291 288 292 drm_mode_config_helper_resume(ddev); 289 - 290 - drm_bridge_connector_enable_hpd(kms->connector); 291 293 292 294 return 0; 293 295 }
-7
drivers/gpu/drm/imx/dcss/dcss-drv.c
··· 74 74 dcss_shutoff: 75 75 dcss_dev_destroy(mdrv->dcss); 76 76 77 - dev_set_drvdata(dev, NULL); 78 - 79 77 err: 80 78 kfree(mdrv); 81 79 return err; ··· 83 85 { 84 86 struct dcss_drv *mdrv = dev_get_drvdata(&pdev->dev); 85 87 86 - if (!mdrv) 87 - return 0; 88 - 89 88 dcss_kms_detach(mdrv->kms); 90 89 dcss_dev_destroy(mdrv->dcss); 91 - 92 - dev_set_drvdata(&pdev->dev, NULL); 93 90 94 91 kfree(mdrv); 95 92
-2
drivers/gpu/drm/imx/dcss/dcss-kms.c
··· 150 150 return kms; 151 151 152 152 cleanup_crtc: 153 - drm_bridge_connector_disable_hpd(kms->connector); 154 153 drm_kms_helper_poll_fini(drm); 155 154 dcss_crtc_deinit(crtc, drm); 156 155 ··· 165 166 struct drm_device *drm = &kms->base; 166 167 167 168 drm_dev_unregister(drm); 168 - drm_bridge_connector_disable_hpd(kms->connector); 169 169 drm_kms_helper_poll_fini(drm); 170 170 drm_atomic_helper_shutdown(drm); 171 171 drm_crtc_vblank_off(&kms->crtc.base);
+1 -1
drivers/gpu/drm/meson/meson_dw_hdmi.c
··· 718 718 dw_plat_data = &meson_dw_hdmi->dw_plat_data; 719 719 720 720 ret = devm_regulator_get_enable_optional(dev, "hdmi"); 721 - if (ret != -ENODEV) 721 + if (ret < 0) 722 722 return ret; 723 723 724 724 meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
+2
drivers/gpu/drm/mgag200/Kconfig
··· 4 4 depends on DRM && PCI && MMU 5 5 select DRM_GEM_SHMEM_HELPER 6 6 select DRM_KMS_HELPER 7 + select I2C 8 + select I2C_ALGOBIT 7 9 help 8 10 This is a KMS driver for Matrox G200 chips. It supports the original 9 11 MGA G200 desktop chips and the server variants. It requires 0.3.0
-2
drivers/gpu/drm/msm/hdmi/hdmi.c
··· 203 203 goto fail; 204 204 } 205 205 206 - drm_bridge_connector_enable_hpd(hdmi->connector); 207 - 208 206 ret = msm_hdmi_hpd_enable(hdmi->bridge); 209 207 if (ret < 0) { 210 208 DRM_DEV_ERROR(&hdmi->pdev->dev, "failed to enable HPD: %d\n", ret);
+4 -6
drivers/gpu/drm/mxsfb/mxsfb_drv.c
··· 78 78 79 79 void mxsfb_enable_axi_clk(struct mxsfb_drm_private *mxsfb) 80 80 { 81 - if (mxsfb->clk_axi) 82 - clk_prepare_enable(mxsfb->clk_axi); 81 + clk_prepare_enable(mxsfb->clk_axi); 83 82 } 84 83 85 84 void mxsfb_disable_axi_clk(struct mxsfb_drm_private *mxsfb) 86 85 { 87 - if (mxsfb->clk_axi) 88 - clk_disable_unprepare(mxsfb->clk_axi); 86 + clk_disable_unprepare(mxsfb->clk_axi); 89 87 } 90 88 91 89 static struct drm_framebuffer * ··· 233 235 if (IS_ERR(mxsfb->clk)) 234 236 return PTR_ERR(mxsfb->clk); 235 237 236 - mxsfb->clk_axi = devm_clk_get(drm->dev, "axi"); 238 + mxsfb->clk_axi = devm_clk_get_optional(drm->dev, "axi"); 237 239 if (IS_ERR(mxsfb->clk_axi)) 238 - mxsfb->clk_axi = NULL; 240 + return PTR_ERR(mxsfb->clk_axi); 239 241 240 242 mxsfb->clk_disp_axi = devm_clk_get(drm->dev, "disp_axi"); 241 243 if (IS_ERR(mxsfb->clk_disp_axi))
+2
drivers/gpu/drm/nouveau/Kconfig
··· 10 10 select DRM_KMS_HELPER 11 11 select DRM_TTM 12 12 select DRM_TTM_HELPER 13 + select I2C 14 + select I2C_ALGOBIT 13 15 select BACKLIGHT_CLASS_DEVICE if DRM_NOUVEAU_BACKLIGHT 14 16 select X86_PLATFORM_DEVICES if ACPI && X86 15 17 select ACPI_WMI if ACPI && X86
-41
drivers/gpu/drm/omapdrm/omap_drv.c
··· 546 546 } 547 547 548 548 /* 549 - * Enable the HPD in external components if supported 550 - */ 551 - static void omap_modeset_enable_external_hpd(struct drm_device *ddev) 552 - { 553 - struct omap_drm_private *priv = ddev->dev_private; 554 - unsigned int i; 555 - 556 - for (i = 0; i < priv->num_pipes; i++) { 557 - struct drm_connector *connector = priv->pipes[i].connector; 558 - 559 - if (!connector) 560 - continue; 561 - 562 - if (priv->pipes[i].output->bridge) 563 - drm_bridge_connector_enable_hpd(connector); 564 - } 565 - } 566 - 567 - /* 568 - * Disable the HPD in external components if supported 569 - */ 570 - static void omap_modeset_disable_external_hpd(struct drm_device *ddev) 571 - { 572 - struct omap_drm_private *priv = ddev->dev_private; 573 - unsigned int i; 574 - 575 - for (i = 0; i < priv->num_pipes; i++) { 576 - struct drm_connector *connector = priv->pipes[i].connector; 577 - 578 - if (!connector) 579 - continue; 580 - 581 - if (priv->pipes[i].output->bridge) 582 - drm_bridge_connector_disable_hpd(connector); 583 - } 584 - } 585 - 586 - /* 587 549 * drm ioctl funcs 588 550 */ 589 551 ··· 744 782 omap_fbdev_init(ddev); 745 783 746 784 drm_kms_helper_poll_init(ddev); 747 - omap_modeset_enable_external_hpd(ddev); 748 785 749 786 /* 750 787 * Register the DRM device with the core and the connectors with ··· 756 795 return 0; 757 796 758 797 err_cleanup_helpers: 759 - omap_modeset_disable_external_hpd(ddev); 760 798 drm_kms_helper_poll_fini(ddev); 761 799 762 800 omap_fbdev_fini(ddev); ··· 782 822 783 823 drm_dev_unregister(ddev); 784 824 785 - omap_modeset_disable_external_hpd(ddev); 786 825 drm_kms_helper_poll_fini(ddev); 787 826 788 827 omap_fbdev_fini(ddev);
+20
drivers/gpu/drm/panel/Kconfig
··· 154 154 Say Y if you want to enable support for panels based on the 155 155 Feiyang FY07024DI26A30-D MIPI-DSI interface. 156 156 157 + config DRM_PANEL_HIMAX_HX8394 158 + tristate "HIMAX HX8394 MIPI-DSI LCD panels" 159 + depends on OF 160 + depends on DRM_MIPI_DSI 161 + depends on BACKLIGHT_CLASS_DEVICE 162 + help 163 + Say Y if you want to enable support for panels based on the 164 + Himax HX8394 controller, such as the HannStar HSD060BHW4 165 + 720x1440 TFT LCD panel that uses a MIPI-DSI interface. 166 + 167 + If M is selected the module will be called panel-himax-hx8394. 168 + 157 169 config DRM_PANEL_ILITEK_IL9322 158 170 tristate "Ilitek ILI9322 320x240 QVGA panels" 159 171 depends on OF && SPI ··· 737 725 help 738 726 Say Y here if you want to enable support for Visionox 739 727 RM69299 DSI Video Mode panel. 728 + 729 + config DRM_PANEL_VISIONOX_VTDR6130 730 + tristate "Visionox VTDR6130" 731 + depends on OF 732 + depends on DRM_MIPI_DSI 733 + help 734 + Say Y here if you want to enable support for Visionox 735 + VTDR6130 1080x2400 AMOLED DSI panel. 740 736 741 737 config DRM_PANEL_WIDECHIPS_WS2401 742 738 tristate "Widechips WS2401 DPI panel driver"
+2
drivers/gpu/drm/panel/Makefile
··· 13 13 obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o 14 14 obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o 15 15 obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += panel-feiyang-fy07024di26a30d.o 16 + obj-$(CONFIG_DRM_PANEL_HIMAX_HX8394) += panel-himax-hx8394.o 16 17 obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o 17 18 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o 18 19 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o ··· 75 74 obj-$(CONFIG_DRM_PANEL_TPO_TPG110) += panel-tpo-tpg110.o 76 75 obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o 77 76 obj-$(CONFIG_DRM_PANEL_VISIONOX_RM69299) += panel-visionox-rm69299.o 77 + obj-$(CONFIG_DRM_PANEL_VISIONOX_VTDR6130) += panel-visionox-vtdr6130.o 78 78 obj-$(CONFIG_DRM_PANEL_WIDECHIPS_WS2401) += panel-widechips-ws2401.o 79 79 obj-$(CONFIG_DRM_PANEL_XINPENG_XPP055C272) += panel-xinpeng-xpp055c272.o
+40 -56
drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
··· 24 24 return container_of(panel, struct tm5p5_nt35596, panel); 25 25 } 26 26 27 - #define dsi_generic_write_seq(dsi, seq...) do { \ 28 - static const u8 d[] = { seq }; \ 29 - int ret; \ 30 - ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ 31 - if (ret < 0) \ 32 - return ret; \ 33 - } while (0) 34 - 35 - #define dsi_dcs_write_seq(dsi, seq...) do { \ 36 - static const u8 d[] = { seq }; \ 37 - int ret; \ 38 - ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ 39 - if (ret < 0) \ 40 - return ret; \ 41 - } while (0) 42 - 43 27 static void tm5p5_nt35596_reset(struct tm5p5_nt35596 *ctx) 44 28 { 45 29 gpiod_set_value_cansleep(ctx->reset_gpio, 1); ··· 38 54 { 39 55 struct mipi_dsi_device *dsi = ctx->dsi; 40 56 41 - dsi_generic_write_seq(dsi, 0xff, 0x05); 42 - dsi_generic_write_seq(dsi, 0xfb, 0x01); 43 - dsi_generic_write_seq(dsi, 0xc5, 0x31); 44 - dsi_generic_write_seq(dsi, 0xff, 0x04); 45 - dsi_generic_write_seq(dsi, 0x01, 0x84); 46 - dsi_generic_write_seq(dsi, 0x05, 0x25); 47 - dsi_generic_write_seq(dsi, 0x06, 0x01); 48 - dsi_generic_write_seq(dsi, 0x07, 0x20); 49 - dsi_generic_write_seq(dsi, 0x08, 0x06); 50 - dsi_generic_write_seq(dsi, 0x09, 0x08); 51 - dsi_generic_write_seq(dsi, 0x0a, 0x10); 52 - dsi_generic_write_seq(dsi, 0x0b, 0x10); 53 - dsi_generic_write_seq(dsi, 0x0c, 0x10); 54 - dsi_generic_write_seq(dsi, 0x0d, 0x14); 55 - dsi_generic_write_seq(dsi, 0x0e, 0x14); 56 - dsi_generic_write_seq(dsi, 0x0f, 0x14); 57 - dsi_generic_write_seq(dsi, 0x10, 0x14); 58 - dsi_generic_write_seq(dsi, 0x11, 0x14); 59 - dsi_generic_write_seq(dsi, 0x12, 0x14); 60 - dsi_generic_write_seq(dsi, 0x17, 0xf3); 61 - dsi_generic_write_seq(dsi, 0x18, 0xc0); 62 - dsi_generic_write_seq(dsi, 0x19, 0xc0); 63 - dsi_generic_write_seq(dsi, 0x1a, 0xc0); 64 - dsi_generic_write_seq(dsi, 0x1b, 0xb3); 65 - dsi_generic_write_seq(dsi, 0x1c, 0xb3); 66 - dsi_generic_write_seq(dsi, 0x1d, 0xb3); 67 - dsi_generic_write_seq(dsi, 0x1e, 0xb3); 68 - dsi_generic_write_seq(dsi, 0x1f, 0xb3); 69 - dsi_generic_write_seq(dsi, 0x20, 0xb3); 70 - dsi_generic_write_seq(dsi, 0xfb, 0x01); 71 - dsi_generic_write_seq(dsi, 0xff, 0x00); 72 - dsi_generic_write_seq(dsi, 0xfb, 0x01); 73 - dsi_generic_write_seq(dsi, 0x35, 0x01); 74 - dsi_generic_write_seq(dsi, 0xd3, 0x06); 75 - dsi_generic_write_seq(dsi, 0xd4, 0x04); 76 - dsi_generic_write_seq(dsi, 0x5e, 0x0d); 77 - dsi_generic_write_seq(dsi, 0x11, 0x00); 57 + mipi_dsi_generic_write_seq(dsi, 0xff, 0x05); 58 + mipi_dsi_generic_write_seq(dsi, 0xfb, 0x01); 59 + mipi_dsi_generic_write_seq(dsi, 0xc5, 0x31); 60 + mipi_dsi_generic_write_seq(dsi, 0xff, 0x04); 61 + mipi_dsi_generic_write_seq(dsi, 0x01, 0x84); 62 + mipi_dsi_generic_write_seq(dsi, 0x05, 0x25); 63 + mipi_dsi_generic_write_seq(dsi, 0x06, 0x01); 64 + mipi_dsi_generic_write_seq(dsi, 0x07, 0x20); 65 + mipi_dsi_generic_write_seq(dsi, 0x08, 0x06); 66 + mipi_dsi_generic_write_seq(dsi, 0x09, 0x08); 67 + mipi_dsi_generic_write_seq(dsi, 0x0a, 0x10); 68 + mipi_dsi_generic_write_seq(dsi, 0x0b, 0x10); 69 + mipi_dsi_generic_write_seq(dsi, 0x0c, 0x10); 70 + mipi_dsi_generic_write_seq(dsi, 0x0d, 0x14); 71 + mipi_dsi_generic_write_seq(dsi, 0x0e, 0x14); 72 + mipi_dsi_generic_write_seq(dsi, 0x0f, 0x14); 73 + mipi_dsi_generic_write_seq(dsi, 0x10, 0x14); 74 + mipi_dsi_generic_write_seq(dsi, 0x11, 0x14); 75 + mipi_dsi_generic_write_seq(dsi, 0x12, 0x14); 76 + mipi_dsi_generic_write_seq(dsi, 0x17, 0xf3); 77 + mipi_dsi_generic_write_seq(dsi, 0x18, 0xc0); 78 + mipi_dsi_generic_write_seq(dsi, 0x19, 0xc0); 79 + mipi_dsi_generic_write_seq(dsi, 0x1a, 0xc0); 80 + mipi_dsi_generic_write_seq(dsi, 0x1b, 0xb3); 81 + mipi_dsi_generic_write_seq(dsi, 0x1c, 0xb3); 82 + mipi_dsi_generic_write_seq(dsi, 0x1d, 0xb3); 83 + mipi_dsi_generic_write_seq(dsi, 0x1e, 0xb3); 84 + mipi_dsi_generic_write_seq(dsi, 0x1f, 0xb3); 85 + mipi_dsi_generic_write_seq(dsi, 0x20, 0xb3); 86 + mipi_dsi_generic_write_seq(dsi, 0xfb, 0x01); 87 + mipi_dsi_generic_write_seq(dsi, 0xff, 0x00); 88 + mipi_dsi_generic_write_seq(dsi, 0xfb, 0x01); 89 + mipi_dsi_generic_write_seq(dsi, 0x35, 0x01); 90 + mipi_dsi_generic_write_seq(dsi, 0xd3, 0x06); 91 + mipi_dsi_generic_write_seq(dsi, 0xd4, 0x04); 92 + mipi_dsi_generic_write_seq(dsi, 0x5e, 0x0d); 93 + mipi_dsi_generic_write_seq(dsi, 0x11, 0x00); 78 94 msleep(100); 79 - dsi_generic_write_seq(dsi, 0x29, 0x00); 80 - dsi_generic_write_seq(dsi, 0x53, 0x24); 95 + mipi_dsi_generic_write_seq(dsi, 0x29, 0x00); 96 + mipi_dsi_generic_write_seq(dsi, 0x53, 0x24); 81 97 82 98 return 0; 83 99 } ··· 101 117 return ret; 102 118 } 103 119 104 - dsi_dcs_write_seq(dsi, 0x4f, 0x01); 120 + mipi_dsi_dcs_write_seq(dsi, 0x4f, 0x01); 105 121 106 122 return 0; 107 123 }
+17 -25
drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
··· 43 43 return container_of(panel, struct boe_bf060y8m_aj0, panel); 44 44 } 45 45 46 - #define dsi_dcs_write_seq(dsi, seq...) do { \ 47 - static const u8 d[] = { seq }; \ 48 - int ret; \ 49 - ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ 50 - if (ret < 0) \ 51 - return ret; \ 52 - } while (0) 53 - 54 46 static void boe_bf060y8m_aj0_reset(struct boe_bf060y8m_aj0 *boe) 55 47 { 56 48 gpiod_set_value_cansleep(boe->reset_gpio, 0); ··· 59 67 struct device *dev = &dsi->dev; 60 68 int ret; 61 69 62 - dsi_dcs_write_seq(dsi, 0xb0, 0xa5, 0x00); 63 - dsi_dcs_write_seq(dsi, 0xb2, 0x00, 0x4c); 64 - dsi_dcs_write_seq(dsi, MIPI_DCS_SET_3D_CONTROL, 0x10); 65 - dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, DCS_ALLOW_HBM_RANGE); 66 - dsi_dcs_write_seq(dsi, 0xf8, 67 - 0x00, 0x08, 0x10, 0x00, 0x22, 0x00, 0x00, 0x2d); 70 + mipi_dsi_dcs_write_seq(dsi, 0xb0, 0xa5, 0x00); 71 + mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x00, 0x4c); 72 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_3D_CONTROL, 0x10); 73 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, DCS_ALLOW_HBM_RANGE); 74 + mipi_dsi_dcs_write_seq(dsi, 0xf8, 75 + 0x00, 0x08, 0x10, 0x00, 0x22, 0x00, 0x00, 0x2d); 68 76 69 77 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); 70 78 if (ret < 0) { ··· 73 81 } 74 82 msleep(30); 75 83 76 - dsi_dcs_write_seq(dsi, 0xb0, 0xa5, 0x00); 77 - dsi_dcs_write_seq(dsi, 0xc0, 78 - 0x08, 0x48, 0x65, 0x33, 0x33, 0x33, 79 - 0x2a, 0x31, 0x39, 0x20, 0x09); 80 - dsi_dcs_write_seq(dsi, 0xc1, 0x00, 0x00, 0x00, 0x1f, 0x1f, 81 - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 82 - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); 83 - dsi_dcs_write_seq(dsi, 0xe2, 0x20, 0x04, 0x10, 0x12, 0x92, 84 - 0x4f, 0x8f, 0x44, 0x84, 0x83, 0x83, 0x83, 85 - 0x5c, 0x5c, 0x5c); 86 - dsi_dcs_write_seq(dsi, 0xde, 0x01, 0x2c, 0x00, 0x77, 0x3e); 84 + mipi_dsi_dcs_write_seq(dsi, 0xb0, 0xa5, 0x00); 85 + mipi_dsi_dcs_write_seq(dsi, 0xc0, 86 + 0x08, 0x48, 0x65, 0x33, 0x33, 0x33, 87 + 0x2a, 0x31, 0x39, 0x20, 0x09); 88 + mipi_dsi_dcs_write_seq(dsi, 0xc1, 0x00, 0x00, 0x00, 0x1f, 0x1f, 89 + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 90 + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); 91 + mipi_dsi_dcs_write_seq(dsi, 0xe2, 0x20, 0x04, 0x10, 0x12, 0x92, 92 + 0x4f, 0x8f, 0x44, 0x84, 0x83, 0x83, 0x83, 93 + 0x5c, 0x5c, 0x5c); 94 + mipi_dsi_dcs_write_seq(dsi, 0xde, 0x01, 0x2c, 0x00, 0x77, 0x3e); 87 95 88 96 msleep(30); 89 97
+2 -1
drivers/gpu/drm/panel/panel-edp.c
··· 1891 1891 EDP_PANEL_ENTRY('C', 'M', 'N', 0x1247, &delay_200_500_e80_d50, "N120ACA-EA1"), 1892 1892 1893 1893 EDP_PANEL_ENTRY('I', 'V', 'O', 0x057d, &delay_200_500_e200, "R140NWF5 RH"), 1894 - EDP_PANEL_ENTRY('I', 'V', 'O', 0x854b, &delay_200_500_p2e100, "M133NW4J-R3"), 1894 + EDP_PANEL_ENTRY('I', 'V', 'O', 0x854a, &delay_200_500_p2e100, "M133NW4J"), 1895 + EDP_PANEL_ENTRY('I', 'V', 'O', 0x854b, &delay_200_500_p2e100, "R133NW4K-R0"), 1895 1896 1896 1897 EDP_PANEL_ENTRY('K', 'D', 'B', 0x0624, &kingdisplay_kd116n21_30nv_a010.delay, "116N21-30NV-A010"), 1897 1898 EDP_PANEL_ENTRY('K', 'D', 'B', 0x1120, &delay_200_500_e80_d50, "116N29-30NK-C007"),
+19 -27
drivers/gpu/drm/panel/panel-elida-kd35t133.c
··· 51 51 return container_of(panel, struct kd35t133, panel); 52 52 } 53 53 54 - #define dsi_dcs_write_seq(dsi, cmd, seq...) do { \ 55 - static const u8 b[] = { cmd, seq }; \ 56 - int ret; \ 57 - ret = mipi_dsi_dcs_write_buffer(dsi, b, ARRAY_SIZE(b)); \ 58 - if (ret < 0) \ 59 - return ret; \ 60 - } while (0) 61 - 62 54 static int kd35t133_init_sequence(struct kd35t133 *ctx) 63 55 { 64 56 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); ··· 60 68 * Init sequence was supplied by the panel vendor with minimal 61 69 * documentation. 62 70 */ 63 - dsi_dcs_write_seq(dsi, KD35T133_CMD_POSITIVEGAMMA, 64 - 0x00, 0x13, 0x18, 0x04, 0x0f, 0x06, 0x3a, 0x56, 65 - 0x4d, 0x03, 0x0a, 0x06, 0x30, 0x3e, 0x0f); 66 - dsi_dcs_write_seq(dsi, KD35T133_CMD_NEGATIVEGAMMA, 67 - 0x00, 0x13, 0x18, 0x01, 0x11, 0x06, 0x38, 0x34, 68 - 0x4d, 0x06, 0x0d, 0x0b, 0x31, 0x37, 0x0f); 69 - dsi_dcs_write_seq(dsi, KD35T133_CMD_POWERCONTROL1, 0x18, 0x17); 70 - dsi_dcs_write_seq(dsi, KD35T133_CMD_POWERCONTROL2, 0x41); 71 - dsi_dcs_write_seq(dsi, KD35T133_CMD_VCOMCONTROL, 0x00, 0x1a, 0x80); 72 - dsi_dcs_write_seq(dsi, MIPI_DCS_SET_ADDRESS_MODE, 0x48); 73 - dsi_dcs_write_seq(dsi, MIPI_DCS_SET_PIXEL_FORMAT, 0x55); 74 - dsi_dcs_write_seq(dsi, KD35T133_CMD_INTERFACEMODECTRL, 0x00); 75 - dsi_dcs_write_seq(dsi, KD35T133_CMD_FRAMERATECTRL, 0xa0); 76 - dsi_dcs_write_seq(dsi, KD35T133_CMD_DISPLAYINVERSIONCTRL, 0x02); 77 - dsi_dcs_write_seq(dsi, KD35T133_CMD_DISPLAYFUNCTIONCTRL, 78 - 0x20, 0x02); 79 - dsi_dcs_write_seq(dsi, KD35T133_CMD_SETIMAGEFUNCTION, 0x00); 80 - dsi_dcs_write_seq(dsi, KD35T133_CMD_ADJUSTCONTROL3, 81 - 0xa9, 0x51, 0x2c, 0x82); 71 + mipi_dsi_dcs_write_seq(dsi, KD35T133_CMD_POSITIVEGAMMA, 72 + 0x00, 0x13, 0x18, 0x04, 0x0f, 0x06, 0x3a, 0x56, 73 + 0x4d, 0x03, 0x0a, 0x06, 0x30, 0x3e, 0x0f); 74 + mipi_dsi_dcs_write_seq(dsi, KD35T133_CMD_NEGATIVEGAMMA, 75 + 0x00, 0x13, 0x18, 0x01, 0x11, 0x06, 0x38, 0x34, 76 + 0x4d, 0x06, 0x0d, 0x0b, 0x31, 0x37, 0x0f); 77 + mipi_dsi_dcs_write_seq(dsi, KD35T133_CMD_POWERCONTROL1, 0x18, 0x17); 78 + mipi_dsi_dcs_write_seq(dsi, KD35T133_CMD_POWERCONTROL2, 0x41); 79 + mipi_dsi_dcs_write_seq(dsi, KD35T133_CMD_VCOMCONTROL, 0x00, 0x1a, 0x80); 80 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_ADDRESS_MODE, 0x48); 81 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_PIXEL_FORMAT, 0x55); 82 + mipi_dsi_dcs_write_seq(dsi, KD35T133_CMD_INTERFACEMODECTRL, 0x00); 83 + mipi_dsi_dcs_write_seq(dsi, KD35T133_CMD_FRAMERATECTRL, 0xa0); 84 + mipi_dsi_dcs_write_seq(dsi, KD35T133_CMD_DISPLAYINVERSIONCTRL, 0x02); 85 + mipi_dsi_dcs_write_seq(dsi, KD35T133_CMD_DISPLAYFUNCTIONCTRL, 86 + 0x20, 0x02); 87 + mipi_dsi_dcs_write_seq(dsi, KD35T133_CMD_SETIMAGEFUNCTION, 0x00); 88 + mipi_dsi_dcs_write_seq(dsi, KD35T133_CMD_ADJUSTCONTROL3, 89 + 0xa9, 0x51, 0x2c, 0x82); 82 90 mipi_dsi_dcs_write(dsi, MIPI_DCS_ENTER_INVERT_MODE, NULL, 0); 83 91 84 92 dev_dbg(dev, "Panel init sequence done\n");
+451
drivers/gpu/drm/panel/panel-himax-hx8394.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Driver for panels based on Himax HX8394 controller, such as: 4 + * 5 + * - HannStar HSD060BHW4 5.99" MIPI-DSI panel 6 + * 7 + * Copyright (C) 2021 Kamil Trzciński 8 + * 9 + * Based on drivers/gpu/drm/panel/panel-sitronix-st7703.c 10 + * Copyright (C) Purism SPC 2019 11 + */ 12 + 13 + #include <linux/delay.h> 14 + #include <linux/gpio/consumer.h> 15 + #include <linux/media-bus-format.h> 16 + #include <linux/mod_devicetable.h> 17 + #include <linux/module.h> 18 + #include <linux/of_device.h> 19 + #include <linux/regulator/consumer.h> 20 + 21 + #include <video/mipi_display.h> 22 + 23 + #include <drm/drm_mipi_dsi.h> 24 + #include <drm/drm_modes.h> 25 + #include <drm/drm_panel.h> 26 + 27 + #define DRV_NAME "panel-himax-hx8394" 28 + 29 + /* Manufacturer specific commands sent via DSI, listed in HX8394-F datasheet */ 30 + #define HX8394_CMD_SETSEQUENCE 0xb0 31 + #define HX8394_CMD_SETPOWER 0xb1 32 + #define HX8394_CMD_SETDISP 0xb2 33 + #define HX8394_CMD_SETCYC 0xb4 34 + #define HX8394_CMD_SETVCOM 0xb6 35 + #define HX8394_CMD_SETTE 0xb7 36 + #define HX8394_CMD_SETSENSOR 0xb8 37 + #define HX8394_CMD_SETEXTC 0xb9 38 + #define HX8394_CMD_SETMIPI 0xba 39 + #define HX8394_CMD_SETOTP 0xbb 40 + #define HX8394_CMD_SETREGBANK 0xbd 41 + #define HX8394_CMD_UNKNOWN1 0xc0 42 + #define HX8394_CMD_SETDGCLUT 0xc1 43 + #define HX8394_CMD_SETID 0xc3 44 + #define HX8394_CMD_SETDDB 0xc4 45 + #define HX8394_CMD_UNKNOWN2 0xc6 46 + #define HX8394_CMD_SETCABC 0xc9 47 + #define HX8394_CMD_SETCABCGAIN 0xca 48 + #define HX8394_CMD_SETPANEL 0xcc 49 + #define HX8394_CMD_SETOFFSET 0xd2 50 + #define HX8394_CMD_SETGIP0 0xd3 51 + #define HX8394_CMD_UNKNOWN3 0xd4 52 + #define HX8394_CMD_SETGIP1 0xd5 53 + #define HX8394_CMD_SETGIP2 0xd6 54 + #define HX8394_CMD_SETGPO 0xd6 55 + #define HX8394_CMD_SETSCALING 0xdd 56 + #define HX8394_CMD_SETIDLE 0xdf 57 + #define HX8394_CMD_SETGAMMA 0xe0 58 + #define HX8394_CMD_SETCHEMODE_DYN 0xe4 59 + #define HX8394_CMD_SETCHE 0xe5 60 + #define HX8394_CMD_SETCESEL 0xe6 61 + #define HX8394_CMD_SET_SP_CMD 0xe9 62 + #define HX8394_CMD_SETREADINDEX 0xfe 63 + #define HX8394_CMD_GETSPIREAD 0xff 64 + 65 + struct hx8394 { 66 + struct device *dev; 67 + struct drm_panel panel; 68 + struct gpio_desc *reset_gpio; 69 + struct regulator *vcc; 70 + struct regulator *iovcc; 71 + bool prepared; 72 + 73 + const struct hx8394_panel_desc *desc; 74 + }; 75 + 76 + struct hx8394_panel_desc { 77 + const struct drm_display_mode *mode; 78 + unsigned int lanes; 79 + unsigned long mode_flags; 80 + enum mipi_dsi_pixel_format format; 81 + int (*init_sequence)(struct hx8394 *ctx); 82 + }; 83 + 84 + static inline struct hx8394 *panel_to_hx8394(struct drm_panel *panel) 85 + { 86 + return container_of(panel, struct hx8394, panel); 87 + } 88 + 89 + static int hsd060bhw4_init_sequence(struct hx8394 *ctx) 90 + { 91 + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); 92 + 93 + /* 5.19.8 SETEXTC: Set extension command (B9h) */ 94 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETEXTC, 95 + 0xff, 0x83, 0x94); 96 + 97 + /* 5.19.2 SETPOWER: Set power (B1h) */ 98 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER, 99 + 0x48, 0x11, 0x71, 0x09, 0x32, 0x24, 0x71, 0x31, 0x55, 0x30); 100 + 101 + /* 5.19.9 SETMIPI: Set MIPI control (BAh) */ 102 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETMIPI, 103 + 0x63, 0x03, 0x68, 0x6b, 0xb2, 0xc0); 104 + 105 + /* 5.19.3 SETDISP: Set display related register (B2h) */ 106 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETDISP, 107 + 0x00, 0x80, 0x78, 0x0c, 0x07); 108 + 109 + /* 5.19.4 SETCYC: Set display waveform cycles (B4h) */ 110 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETCYC, 111 + 0x12, 0x63, 0x12, 0x63, 0x12, 0x63, 0x01, 0x0c, 0x7c, 0x55, 112 + 0x00, 0x3f, 0x12, 0x6b, 0x12, 0x6b, 0x12, 0x6b, 0x01, 0x0c, 113 + 0x7c); 114 + 115 + /* 5.19.19 SETGIP0: Set GIP Option0 (D3h) */ 116 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP0, 117 + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x1c, 0x00, 0x00, 0x32, 0x10, 118 + 0x09, 0x00, 0x09, 0x32, 0x15, 0xad, 0x05, 0xad, 0x32, 0x00, 119 + 0x00, 0x00, 0x00, 0x37, 0x03, 0x0b, 0x0b, 0x37, 0x00, 0x00, 120 + 0x00, 0x0c, 0x40); 121 + 122 + /* 5.19.20 Set GIP Option1 (D5h) */ 123 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP1, 124 + 0x19, 0x19, 0x18, 0x18, 0x1b, 0x1b, 0x1a, 0x1a, 0x00, 0x01, 125 + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x20, 0x21, 0x18, 0x18, 126 + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 127 + 0x24, 0x25, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 128 + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18); 129 + 130 + /* 5.19.21 Set GIP Option2 (D6h) */ 131 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP2, 132 + 0x18, 0x18, 0x19, 0x19, 0x1b, 0x1b, 0x1a, 0x1a, 0x07, 0x06, 133 + 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x25, 0x24, 0x18, 0x18, 134 + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 135 + 0x21, 0x20, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 136 + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18); 137 + 138 + /* 5.19.25 SETGAMMA: Set gamma curve related setting (E0h) */ 139 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGAMMA, 140 + 0x00, 0x04, 0x0c, 0x12, 0x14, 0x18, 0x1a, 0x18, 0x31, 0x3f, 141 + 0x4d, 0x4c, 0x54, 0x65, 0x6b, 0x70, 0x7f, 0x82, 0x7e, 0x8a, 142 + 0x99, 0x4a, 0x48, 0x49, 0x4b, 0x4a, 0x4c, 0x4b, 0x7f, 0x00, 143 + 0x04, 0x0c, 0x11, 0x13, 0x17, 0x1a, 0x18, 0x31, 144 + 0x3f, 0x4d, 0x4c, 0x54, 0x65, 0x6b, 0x70, 0x7f, 145 + 0x82, 0x7e, 0x8a, 0x99, 0x4a, 0x48, 0x49, 0x4b, 146 + 0x4a, 0x4c, 0x4b, 0x7f); 147 + 148 + /* 5.19.17 SETPANEL (CCh) */ 149 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPANEL, 150 + 0x0b); 151 + 152 + /* Unknown command, not listed in the HX8394-F datasheet */ 153 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN1, 154 + 0x1f, 0x31); 155 + 156 + /* 5.19.5 SETVCOM: Set VCOM voltage (B6h) */ 157 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETVCOM, 158 + 0x7d, 0x7d); 159 + 160 + /* Unknown command, not listed in the HX8394-F datasheet */ 161 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN3, 162 + 0x02); 163 + 164 + /* 5.19.11 Set register bank (BDh) */ 165 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, 166 + 0x01); 167 + 168 + /* 5.19.2 SETPOWER: Set power (B1h) */ 169 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER, 170 + 0x00); 171 + 172 + /* 5.19.11 Set register bank (BDh) */ 173 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, 174 + 0x00); 175 + 176 + /* Unknown command, not listed in the HX8394-F datasheet */ 177 + mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN3, 178 + 0xed); 179 + 180 + return 0; 181 + } 182 + 183 + static const struct drm_display_mode hsd060bhw4_mode = { 184 + .hdisplay = 720, 185 + .hsync_start = 720 + 40, 186 + .hsync_end = 720 + 40 + 46, 187 + .htotal = 720 + 40 + 46 + 40, 188 + .vdisplay = 1440, 189 + .vsync_start = 1440 + 9, 190 + .vsync_end = 1440 + 9 + 7, 191 + .vtotal = 1440 + 9 + 7 + 7, 192 + .clock = 74250, 193 + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, 194 + .width_mm = 68, 195 + .height_mm = 136, 196 + }; 197 + 198 + static const struct hx8394_panel_desc hsd060bhw4_desc = { 199 + .mode = &hsd060bhw4_mode, 200 + .lanes = 4, 201 + .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST, 202 + .format = MIPI_DSI_FMT_RGB888, 203 + .init_sequence = hsd060bhw4_init_sequence, 204 + }; 205 + 206 + static int hx8394_enable(struct drm_panel *panel) 207 + { 208 + struct hx8394 *ctx = panel_to_hx8394(panel); 209 + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); 210 + int ret; 211 + 212 + ret = ctx->desc->init_sequence(ctx); 213 + if (ret) { 214 + dev_err(ctx->dev, "Panel init sequence failed: %d\n", ret); 215 + return ret; 216 + } 217 + 218 + ret = mipi_dsi_dcs_exit_sleep_mode(dsi); 219 + if (ret) { 220 + dev_err(ctx->dev, "Failed to exit sleep mode: %d\n", ret); 221 + return ret; 222 + } 223 + 224 + /* Panel is operational 120 msec after reset */ 225 + msleep(120); 226 + 227 + ret = mipi_dsi_dcs_set_display_on(dsi); 228 + if (ret) { 229 + dev_err(ctx->dev, "Failed to turn on the display: %d\n", ret); 230 + goto sleep_in; 231 + } 232 + 233 + return 0; 234 + 235 + sleep_in: 236 + /* This will probably fail, but let's try orderly power off anyway. */ 237 + ret = mipi_dsi_dcs_enter_sleep_mode(dsi); 238 + if (!ret) 239 + msleep(50); 240 + 241 + return ret; 242 + } 243 + 244 + static int hx8394_disable(struct drm_panel *panel) 245 + { 246 + struct hx8394 *ctx = panel_to_hx8394(panel); 247 + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); 248 + int ret; 249 + 250 + ret = mipi_dsi_dcs_enter_sleep_mode(dsi); 251 + if (ret) { 252 + dev_err(ctx->dev, "Failed to enter sleep mode: %d\n", ret); 253 + return ret; 254 + } 255 + 256 + msleep(50); /* about 3 frames */ 257 + 258 + return 0; 259 + } 260 + 261 + static int hx8394_unprepare(struct drm_panel *panel) 262 + { 263 + struct hx8394 *ctx = panel_to_hx8394(panel); 264 + 265 + if (!ctx->prepared) 266 + return 0; 267 + 268 + gpiod_set_value_cansleep(ctx->reset_gpio, 1); 269 + 270 + regulator_disable(ctx->iovcc); 271 + regulator_disable(ctx->vcc); 272 + 273 + ctx->prepared = false; 274 + 275 + return 0; 276 + } 277 + 278 + static int hx8394_prepare(struct drm_panel *panel) 279 + { 280 + struct hx8394 *ctx = panel_to_hx8394(panel); 281 + int ret; 282 + 283 + if (ctx->prepared) 284 + return 0; 285 + 286 + gpiod_set_value_cansleep(ctx->reset_gpio, 1); 287 + 288 + ret = regulator_enable(ctx->vcc); 289 + if (ret) { 290 + dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); 291 + return ret; 292 + } 293 + 294 + ret = regulator_enable(ctx->iovcc); 295 + if (ret) { 296 + dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); 297 + goto disable_vcc; 298 + } 299 + 300 + gpiod_set_value_cansleep(ctx->reset_gpio, 0); 301 + 302 + msleep(180); 303 + 304 + ctx->prepared = true; 305 + 306 + return 0; 307 + 308 + disable_vcc: 309 + gpiod_set_value_cansleep(ctx->reset_gpio, 1); 310 + regulator_disable(ctx->vcc); 311 + return ret; 312 + } 313 + 314 + static int hx8394_get_modes(struct drm_panel *panel, 315 + struct drm_connector *connector) 316 + { 317 + struct hx8394 *ctx = panel_to_hx8394(panel); 318 + struct drm_display_mode *mode; 319 + 320 + mode = drm_mode_duplicate(connector->dev, ctx->desc->mode); 321 + if (!mode) { 322 + dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n", 323 + ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay, 324 + drm_mode_vrefresh(ctx->desc->mode)); 325 + return -ENOMEM; 326 + } 327 + 328 + drm_mode_set_name(mode); 329 + 330 + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; 331 + connector->display_info.width_mm = mode->width_mm; 332 + connector->display_info.height_mm = mode->height_mm; 333 + drm_mode_probed_add(connector, mode); 334 + 335 + return 1; 336 + } 337 + 338 + static const struct drm_panel_funcs hx8394_drm_funcs = { 339 + .disable = hx8394_disable, 340 + .unprepare = hx8394_unprepare, 341 + .prepare = hx8394_prepare, 342 + .enable = hx8394_enable, 343 + .get_modes = hx8394_get_modes, 344 + }; 345 + 346 + static int hx8394_probe(struct mipi_dsi_device *dsi) 347 + { 348 + struct device *dev = &dsi->dev; 349 + struct hx8394 *ctx; 350 + int ret; 351 + 352 + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); 353 + if (!ctx) 354 + return -ENOMEM; 355 + 356 + ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); 357 + if (IS_ERR(ctx->reset_gpio)) 358 + return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), 359 + "Failed to get reset gpio\n"); 360 + 361 + mipi_dsi_set_drvdata(dsi, ctx); 362 + 363 + ctx->dev = dev; 364 + ctx->desc = of_device_get_match_data(dev); 365 + 366 + dsi->mode_flags = ctx->desc->mode_flags; 367 + dsi->format = ctx->desc->format; 368 + dsi->lanes = ctx->desc->lanes; 369 + 370 + ctx->vcc = devm_regulator_get(dev, "vcc"); 371 + if (IS_ERR(ctx->vcc)) 372 + return dev_err_probe(dev, PTR_ERR(ctx->vcc), 373 + "Failed to request vcc regulator\n"); 374 + 375 + ctx->iovcc = devm_regulator_get(dev, "iovcc"); 376 + if (IS_ERR(ctx->iovcc)) 377 + return dev_err_probe(dev, PTR_ERR(ctx->iovcc), 378 + "Failed to request iovcc regulator\n"); 379 + 380 + drm_panel_init(&ctx->panel, dev, &hx8394_drm_funcs, 381 + DRM_MODE_CONNECTOR_DSI); 382 + 383 + ret = drm_panel_of_backlight(&ctx->panel); 384 + if (ret) 385 + return ret; 386 + 387 + drm_panel_add(&ctx->panel); 388 + 389 + ret = mipi_dsi_attach(dsi); 390 + if (ret < 0) { 391 + dev_err_probe(dev, ret, "mipi_dsi_attach failed\n"); 392 + drm_panel_remove(&ctx->panel); 393 + return ret; 394 + } 395 + 396 + dev_dbg(dev, "%ux%u@%u %ubpp dsi %udl - ready\n", 397 + ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay, 398 + drm_mode_vrefresh(ctx->desc->mode), 399 + mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes); 400 + 401 + return 0; 402 + } 403 + 404 + static void hx8394_shutdown(struct mipi_dsi_device *dsi) 405 + { 406 + struct hx8394 *ctx = mipi_dsi_get_drvdata(dsi); 407 + int ret; 408 + 409 + ret = drm_panel_disable(&ctx->panel); 410 + if (ret < 0) 411 + dev_err(&dsi->dev, "Failed to disable panel: %d\n", ret); 412 + 413 + ret = drm_panel_unprepare(&ctx->panel); 414 + if (ret < 0) 415 + dev_err(&dsi->dev, "Failed to unprepare panel: %d\n", ret); 416 + } 417 + 418 + static void hx8394_remove(struct mipi_dsi_device *dsi) 419 + { 420 + struct hx8394 *ctx = mipi_dsi_get_drvdata(dsi); 421 + int ret; 422 + 423 + hx8394_shutdown(dsi); 424 + 425 + ret = mipi_dsi_detach(dsi); 426 + if (ret < 0) 427 + dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); 428 + 429 + drm_panel_remove(&ctx->panel); 430 + } 431 + 432 + static const struct of_device_id hx8394_of_match[] = { 433 + { .compatible = "hannstar,hsd060bhw4", .data = &hsd060bhw4_desc }, 434 + { /* sentinel */ } 435 + }; 436 + MODULE_DEVICE_TABLE(of, hx8394_of_match); 437 + 438 + static struct mipi_dsi_driver hx8394_driver = { 439 + .probe = hx8394_probe, 440 + .remove = hx8394_remove, 441 + .shutdown = hx8394_shutdown, 442 + .driver = { 443 + .name = DRV_NAME, 444 + .of_match_table = hx8394_of_match, 445 + }, 446 + }; 447 + module_mipi_dsi_driver(hx8394_driver); 448 + 449 + MODULE_AUTHOR("Kamil Trzciński <ayufan@ayufan.eu>"); 450 + MODULE_DESCRIPTION("DRM driver for Himax HX8394 based MIPI DSI panels"); 451 + MODULE_LICENSE("GPL");
+21 -37
drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
··· 29 29 return container_of(panel, struct jdi_fhd_r63452, panel); 30 30 } 31 31 32 - #define dsi_generic_write_seq(dsi, seq...) do { \ 33 - static const u8 d[] = { seq }; \ 34 - int ret; \ 35 - ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ 36 - if (ret < 0) \ 37 - return ret; \ 38 - } while (0) 39 - 40 - #define dsi_dcs_write_seq(dsi, seq...) do { \ 41 - static const u8 d[] = { seq }; \ 42 - int ret; \ 43 - ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ 44 - if (ret < 0) \ 45 - return ret; \ 46 - } while (0) 47 - 48 32 static void jdi_fhd_r63452_reset(struct jdi_fhd_r63452 *ctx) 49 33 { 50 34 gpiod_set_value_cansleep(ctx->reset_gpio, 0); ··· 47 63 48 64 dsi->mode_flags |= MIPI_DSI_MODE_LPM; 49 65 50 - dsi_generic_write_seq(dsi, 0xb0, 0x00); 51 - dsi_generic_write_seq(dsi, 0xd6, 0x01); 52 - dsi_generic_write_seq(dsi, 0xec, 53 - 0x64, 0xdc, 0xec, 0x3b, 0x52, 0x00, 0x0b, 0x0b, 54 - 0x13, 0x15, 0x68, 0x0b, 0xb5); 55 - dsi_generic_write_seq(dsi, 0xb0, 0x03); 66 + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x00); 67 + mipi_dsi_generic_write_seq(dsi, 0xd6, 0x01); 68 + mipi_dsi_generic_write_seq(dsi, 0xec, 69 + 0x64, 0xdc, 0xec, 0x3b, 0x52, 0x00, 0x0b, 0x0b, 70 + 0x13, 0x15, 0x68, 0x0b, 0xb5); 71 + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x03); 56 72 57 73 ret = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK); 58 74 if (ret < 0) { ··· 60 76 return ret; 61 77 } 62 78 63 - dsi_dcs_write_seq(dsi, MIPI_DCS_SET_ADDRESS_MODE, 0x00); 79 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_ADDRESS_MODE, 0x00); 64 80 65 81 ret = mipi_dsi_dcs_set_pixel_format(dsi, 0x77); 66 82 if (ret < 0) { ··· 92 108 return ret; 93 109 } 94 110 95 - dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x24); 96 - dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00); 97 - dsi_dcs_write_seq(dsi, MIPI_DCS_SET_CABC_MIN_BRIGHTNESS, 0x00); 98 - dsi_dcs_write_seq(dsi, 0x84, 0x00); 111 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x24); 112 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00); 113 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_CABC_MIN_BRIGHTNESS, 0x00); 114 + mipi_dsi_dcs_write_seq(dsi, 0x84, 0x00); 99 115 100 116 ret = mipi_dsi_dcs_set_display_on(dsi); 101 117 if (ret < 0) { ··· 111 127 } 112 128 msleep(80); 113 129 114 - dsi_generic_write_seq(dsi, 0xb0, 0x04); 115 - dsi_dcs_write_seq(dsi, 0x84, 0x00); 116 - dsi_generic_write_seq(dsi, 0xc8, 0x11); 117 - dsi_generic_write_seq(dsi, 0xb0, 0x03); 130 + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x04); 131 + mipi_dsi_dcs_write_seq(dsi, 0x84, 0x00); 132 + mipi_dsi_generic_write_seq(dsi, 0xc8, 0x11); 133 + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x03); 118 134 119 135 return 0; 120 136 } ··· 127 143 128 144 dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; 129 145 130 - dsi_generic_write_seq(dsi, 0xb0, 0x00); 131 - dsi_generic_write_seq(dsi, 0xd6, 0x01); 132 - dsi_generic_write_seq(dsi, 0xec, 133 - 0x64, 0xdc, 0xec, 0x3b, 0x52, 0x00, 0x0b, 0x0b, 134 - 0x13, 0x15, 0x68, 0x0b, 0x95); 135 - dsi_generic_write_seq(dsi, 0xb0, 0x03); 146 + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x00); 147 + mipi_dsi_generic_write_seq(dsi, 0xd6, 0x01); 148 + mipi_dsi_generic_write_seq(dsi, 0xec, 149 + 0x64, 0xdc, 0xec, 0x3b, 0x52, 0x00, 0x0b, 0x0b, 150 + 0x13, 0x15, 0x68, 0x0b, 0x95); 151 + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x03); 136 152 137 153 ret = mipi_dsi_dcs_set_display_off(dsi); 138 154 if (ret < 0) {
+48 -56
drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
··· 244 244 return container_of(panel, struct ltk050h3146w, panel); 245 245 } 246 246 247 - #define dsi_dcs_write_seq(dsi, cmd, seq...) do { \ 248 - static const u8 b[] = { cmd, seq }; \ 249 - int ret; \ 250 - ret = mipi_dsi_dcs_write_buffer(dsi, b, ARRAY_SIZE(b)); \ 251 - if (ret < 0) \ 252 - return ret; \ 253 - } while (0) 254 - 255 247 static int ltk050h3146w_init_sequence(struct ltk050h3146w *ctx) 256 248 { 257 249 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); ··· 253 261 * Init sequence was supplied by the panel vendor without much 254 262 * documentation. 255 263 */ 256 - dsi_dcs_write_seq(dsi, 0xdf, 0x93, 0x65, 0xf8); 257 - dsi_dcs_write_seq(dsi, 0xb0, 0x01, 0x03, 0x02, 0x00, 0x64, 0x06, 258 - 0x01); 259 - dsi_dcs_write_seq(dsi, 0xb2, 0x00, 0xb5); 260 - dsi_dcs_write_seq(dsi, 0xb3, 0x00, 0xb5); 261 - dsi_dcs_write_seq(dsi, 0xb7, 0x00, 0xbf, 0x00, 0x00, 0xbf, 0x00); 264 + mipi_dsi_dcs_write_seq(dsi, 0xdf, 0x93, 0x65, 0xf8); 265 + mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x01, 0x03, 0x02, 0x00, 0x64, 0x06, 266 + 0x01); 267 + mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x00, 0xb5); 268 + mipi_dsi_dcs_write_seq(dsi, 0xb3, 0x00, 0xb5); 269 + mipi_dsi_dcs_write_seq(dsi, 0xb7, 0x00, 0xbf, 0x00, 0x00, 0xbf, 0x00); 262 270 263 - dsi_dcs_write_seq(dsi, 0xb9, 0x00, 0xc4, 0x23, 0x07); 264 - dsi_dcs_write_seq(dsi, 0xbb, 0x02, 0x01, 0x24, 0x00, 0x28, 0x0f, 265 - 0x28, 0x04, 0xcc, 0xcc, 0xcc); 266 - dsi_dcs_write_seq(dsi, 0xbc, 0x0f, 0x04); 267 - dsi_dcs_write_seq(dsi, 0xbe, 0x1e, 0xf2); 268 - dsi_dcs_write_seq(dsi, 0xc0, 0x26, 0x03); 269 - dsi_dcs_write_seq(dsi, 0xc1, 0x00, 0x12); 270 - dsi_dcs_write_seq(dsi, 0xc3, 0x04, 0x02, 0x02, 0x76, 0x01, 0x80, 271 - 0x80); 272 - dsi_dcs_write_seq(dsi, 0xc4, 0x24, 0x80, 0xb4, 0x81, 0x12, 0x0f, 273 - 0x16, 0x00, 0x00); 274 - dsi_dcs_write_seq(dsi, 0xc8, 0x7f, 0x72, 0x67, 0x5d, 0x5d, 0x50, 275 - 0x56, 0x41, 0x59, 0x57, 0x55, 0x70, 0x5b, 0x5f, 276 - 0x4f, 0x47, 0x38, 0x23, 0x08, 0x7f, 0x72, 0x67, 277 - 0x5d, 0x5d, 0x50, 0x56, 0x41, 0x59, 0x57, 0x55, 278 - 0x70, 0x5b, 0x5f, 0x4f, 0x47, 0x38, 0x23, 0x08); 279 - dsi_dcs_write_seq(dsi, 0xd0, 0x1e, 0x1f, 0x57, 0x58, 0x48, 0x4a, 280 - 0x44, 0x46, 0x40, 0x1f, 0x42, 0x1f, 0x1f, 0x1f, 281 - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); 282 - dsi_dcs_write_seq(dsi, 0xd1, 0x1e, 0x1f, 0x57, 0x58, 0x49, 0x4b, 283 - 0x45, 0x47, 0x41, 0x1f, 0x43, 0x1f, 0x1f, 0x1f, 284 - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); 285 - dsi_dcs_write_seq(dsi, 0xd2, 0x1f, 0x1e, 0x17, 0x18, 0x07, 0x05, 286 - 0x0b, 0x09, 0x03, 0x1f, 0x01, 0x1f, 0x1f, 0x1f, 287 - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); 288 - dsi_dcs_write_seq(dsi, 0xd3, 0x1f, 0x1e, 0x17, 0x18, 0x06, 0x04, 289 - 0x0a, 0x08, 0x02, 0x1f, 0x00, 0x1f, 0x1f, 0x1f, 290 - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); 291 - dsi_dcs_write_seq(dsi, 0xd4, 0x00, 0x00, 0x00, 0x0c, 0x06, 0x20, 292 - 0x01, 0x02, 0x00, 0x60, 0x15, 0xb0, 0x30, 0x03, 293 - 0x04, 0x00, 0x60, 0x72, 0x0a, 0x00, 0x60, 0x08); 294 - dsi_dcs_write_seq(dsi, 0xd5, 0x00, 0x06, 0x06, 0x00, 0x30, 0x00, 295 - 0x00, 0x00, 0x00, 0x00, 0xbc, 0x50, 0x00, 0x05, 296 - 0x21, 0x00, 0x60); 297 - dsi_dcs_write_seq(dsi, 0xdd, 0x2c, 0xa3, 0x00); 298 - dsi_dcs_write_seq(dsi, 0xde, 0x02); 299 - dsi_dcs_write_seq(dsi, 0xb2, 0x32, 0x1c); 300 - dsi_dcs_write_seq(dsi, 0xb7, 0x3b, 0x70, 0x00, 0x04); 301 - dsi_dcs_write_seq(dsi, 0xc1, 0x11); 302 - dsi_dcs_write_seq(dsi, 0xbb, 0x21, 0x22, 0x23, 0x24, 0x36, 0x37); 303 - dsi_dcs_write_seq(dsi, 0xc2, 0x20, 0x38, 0x1e, 0x84); 304 - dsi_dcs_write_seq(dsi, 0xde, 0x00); 271 + mipi_dsi_dcs_write_seq(dsi, 0xb9, 0x00, 0xc4, 0x23, 0x07); 272 + mipi_dsi_dcs_write_seq(dsi, 0xbb, 0x02, 0x01, 0x24, 0x00, 0x28, 0x0f, 273 + 0x28, 0x04, 0xcc, 0xcc, 0xcc); 274 + mipi_dsi_dcs_write_seq(dsi, 0xbc, 0x0f, 0x04); 275 + mipi_dsi_dcs_write_seq(dsi, 0xbe, 0x1e, 0xf2); 276 + mipi_dsi_dcs_write_seq(dsi, 0xc0, 0x26, 0x03); 277 + mipi_dsi_dcs_write_seq(dsi, 0xc1, 0x00, 0x12); 278 + mipi_dsi_dcs_write_seq(dsi, 0xc3, 0x04, 0x02, 0x02, 0x76, 0x01, 0x80, 279 + 0x80); 280 + mipi_dsi_dcs_write_seq(dsi, 0xc4, 0x24, 0x80, 0xb4, 0x81, 0x12, 0x0f, 281 + 0x16, 0x00, 0x00); 282 + mipi_dsi_dcs_write_seq(dsi, 0xc8, 0x7f, 0x72, 0x67, 0x5d, 0x5d, 0x50, 283 + 0x56, 0x41, 0x59, 0x57, 0x55, 0x70, 0x5b, 0x5f, 284 + 0x4f, 0x47, 0x38, 0x23, 0x08, 0x7f, 0x72, 0x67, 285 + 0x5d, 0x5d, 0x50, 0x56, 0x41, 0x59, 0x57, 0x55, 286 + 0x70, 0x5b, 0x5f, 0x4f, 0x47, 0x38, 0x23, 0x08); 287 + mipi_dsi_dcs_write_seq(dsi, 0xd0, 0x1e, 0x1f, 0x57, 0x58, 0x48, 0x4a, 288 + 0x44, 0x46, 0x40, 0x1f, 0x42, 0x1f, 0x1f, 0x1f, 289 + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); 290 + mipi_dsi_dcs_write_seq(dsi, 0xd1, 0x1e, 0x1f, 0x57, 0x58, 0x49, 0x4b, 291 + 0x45, 0x47, 0x41, 0x1f, 0x43, 0x1f, 0x1f, 0x1f, 292 + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); 293 + mipi_dsi_dcs_write_seq(dsi, 0xd2, 0x1f, 0x1e, 0x17, 0x18, 0x07, 0x05, 294 + 0x0b, 0x09, 0x03, 0x1f, 0x01, 0x1f, 0x1f, 0x1f, 295 + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); 296 + mipi_dsi_dcs_write_seq(dsi, 0xd3, 0x1f, 0x1e, 0x17, 0x18, 0x06, 0x04, 297 + 0x0a, 0x08, 0x02, 0x1f, 0x00, 0x1f, 0x1f, 0x1f, 298 + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); 299 + mipi_dsi_dcs_write_seq(dsi, 0xd4, 0x00, 0x00, 0x00, 0x0c, 0x06, 0x20, 300 + 0x01, 0x02, 0x00, 0x60, 0x15, 0xb0, 0x30, 0x03, 301 + 0x04, 0x00, 0x60, 0x72, 0x0a, 0x00, 0x60, 0x08); 302 + mipi_dsi_dcs_write_seq(dsi, 0xd5, 0x00, 0x06, 0x06, 0x00, 0x30, 0x00, 303 + 0x00, 0x00, 0x00, 0x00, 0xbc, 0x50, 0x00, 0x05, 304 + 0x21, 0x00, 0x60); 305 + mipi_dsi_dcs_write_seq(dsi, 0xdd, 0x2c, 0xa3, 0x00); 306 + mipi_dsi_dcs_write_seq(dsi, 0xde, 0x02); 307 + mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x32, 0x1c); 308 + mipi_dsi_dcs_write_seq(dsi, 0xb7, 0x3b, 0x70, 0x00, 0x04); 309 + mipi_dsi_dcs_write_seq(dsi, 0xc1, 0x11); 310 + mipi_dsi_dcs_write_seq(dsi, 0xbb, 0x21, 0x22, 0x23, 0x24, 0x36, 0x37); 311 + mipi_dsi_dcs_write_seq(dsi, 0xc2, 0x20, 0x38, 0x1e, 0x84); 312 + mipi_dsi_dcs_write_seq(dsi, 0xde, 0x00); 305 313 306 314 ret = mipi_dsi_dcs_set_tear_on(dsi, 1); 307 315 if (ret < 0) {
+8 -16
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
··· 45 45 return container_of(panel, struct mantix, panel); 46 46 } 47 47 48 - #define dsi_generic_write_seq(dsi, seq...) do { \ 49 - static const u8 d[] = { seq }; \ 50 - int ret; \ 51 - ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ 52 - if (ret < 0) \ 53 - return ret; \ 54 - } while (0) 55 - 56 48 static int mantix_init_sequence(struct mantix *ctx) 57 49 { 58 50 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); ··· 53 61 /* 54 62 * Init sequence was supplied by the panel vendor. 55 63 */ 56 - dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x5A); 64 + mipi_dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x5A); 57 65 58 - dsi_generic_write_seq(dsi, MANTIX_CMD_INT_CANCEL, 0x03); 59 - dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x5A, 0x03); 60 - dsi_generic_write_seq(dsi, 0x80, 0xA9, 0x00); 66 + mipi_dsi_generic_write_seq(dsi, MANTIX_CMD_INT_CANCEL, 0x03); 67 + mipi_dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x5A, 0x03); 68 + mipi_dsi_generic_write_seq(dsi, 0x80, 0xA9, 0x00); 61 69 62 - dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x5A, 0x09); 63 - dsi_generic_write_seq(dsi, 0x80, 0x64, 0x00, 0x64, 0x00, 0x00); 70 + mipi_dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x5A, 0x09); 71 + mipi_dsi_generic_write_seq(dsi, 0x80, 0x64, 0x00, 0x64, 0x00, 0x00); 64 72 msleep(20); 65 73 66 - dsi_generic_write_seq(dsi, MANTIX_CMD_SPI_FINISH, 0xA5); 67 - dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x00, 0x2F); 74 + mipi_dsi_generic_write_seq(dsi, MANTIX_CMD_SPI_FINISH, 0xA5); 75 + mipi_dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x00, 0x2F); 68 76 msleep(20); 69 77 70 78 dev_dbg(dev, "Panel init sequence done\n");
+3 -11
drivers/gpu/drm/panel/panel-novatek-nt35950.c
··· 89 89 return container_of(panel, struct nt35950, panel); 90 90 } 91 91 92 - #define dsi_dcs_write_seq(dsi, seq...) do { \ 93 - static const u8 d[] = { seq }; \ 94 - int ret; \ 95 - ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ 96 - if (ret < 0) \ 97 - return ret; \ 98 - } while (0) 99 - 100 92 static void nt35950_reset(struct nt35950 *nt) 101 93 { 102 94 gpiod_set_value_cansleep(nt->reset_gpio, 1); ··· 330 338 return ret; 331 339 332 340 /* Unknown command */ 333 - dsi_dcs_write_seq(dsi, 0xd4, 0x88, 0x88); 341 + mipi_dsi_dcs_write_seq(dsi, 0xd4, 0x88, 0x88); 334 342 335 343 /* CMD2 Page 7 */ 336 344 ret = nt35950_set_cmd2_page(nt, 7); ··· 338 346 return ret; 339 347 340 348 /* Enable SubPixel Rendering */ 341 - dsi_dcs_write_seq(dsi, MCS_PARAM_SPR_EN, 0x01); 349 + mipi_dsi_dcs_write_seq(dsi, MCS_PARAM_SPR_EN, 0x01); 342 350 343 351 /* SPR Mode: YYG Rainbow-RGB */ 344 - dsi_dcs_write_seq(dsi, MCS_PARAM_SPR_MODE, MCS_SPR_MODE_YYG_RAINBOW_RGB); 352 + mipi_dsi_dcs_write_seq(dsi, MCS_PARAM_SPR_MODE, MCS_SPR_MODE_YYG_RAINBOW_RGB); 345 353 346 354 /* CMD3 */ 347 355 ret = nt35950_inject_black_image(nt);
+2 -3
drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
··· 202 202 .get_modes = lcd_olinuxino_get_modes, 203 203 }; 204 204 205 - static int lcd_olinuxino_probe(struct i2c_client *client, 206 - const struct i2c_device_id *id) 205 + static int lcd_olinuxino_probe(struct i2c_client *client) 207 206 { 208 207 struct device *dev = &client->dev; 209 208 struct lcd_olinuxino *lcd; ··· 308 309 .name = "lcd_olinuxino", 309 310 .of_match_table = lcd_olinuxino_of_ids, 310 311 }, 311 - .probe = lcd_olinuxino_probe, 312 + .probe_new = lcd_olinuxino_probe, 312 313 .remove = lcd_olinuxino_remove, 313 314 }; 314 315
+2 -3
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
··· 362 362 .get_modes = rpi_touchscreen_get_modes, 363 363 }; 364 364 365 - static int rpi_touchscreen_probe(struct i2c_client *i2c, 366 - const struct i2c_device_id *id) 365 + static int rpi_touchscreen_probe(struct i2c_client *i2c) 367 366 { 368 367 struct device *dev = &i2c->dev; 369 368 struct rpi_touchscreen *ts; ··· 490 491 .name = "rpi_touchscreen", 491 492 .of_match_table = rpi_touchscreen_of_ids, 492 493 }, 493 - .probe = rpi_touchscreen_probe, 494 + .probe_new = rpi_touchscreen_probe, 494 495 .remove = rpi_touchscreen_remove, 495 496 }; 496 497
+18 -26
drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
··· 28 28 return container_of(panel, struct s6e88a0_ams452ef01, panel); 29 29 } 30 30 31 - #define dsi_dcs_write_seq(dsi, seq...) do { \ 32 - static const u8 d[] = { seq }; \ 33 - int ret; \ 34 - ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ 35 - if (ret < 0) \ 36 - return ret; \ 37 - } while (0) 38 - 39 31 static void s6e88a0_ams452ef01_reset(struct s6e88a0_ams452ef01 *ctx) 40 32 { 41 33 gpiod_set_value_cansleep(ctx->reset_gpio, 1); ··· 46 54 47 55 dsi->mode_flags |= MIPI_DSI_MODE_LPM; 48 56 49 - dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a); // enable LEVEL2 commands 50 - dsi_dcs_write_seq(dsi, 0xcc, 0x4c); // set Pixel Clock Divider polarity 57 + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a); // enable LEVEL2 commands 58 + mipi_dsi_dcs_write_seq(dsi, 0xcc, 0x4c); // set Pixel Clock Divider polarity 51 59 52 60 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); 53 61 if (ret < 0) { ··· 57 65 msleep(120); 58 66 59 67 // set default brightness/gama 60 - dsi_dcs_write_seq(dsi, 0xca, 61 - 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, // V255 RR,GG,BB 62 - 0x80, 0x80, 0x80, // V203 R,G,B 63 - 0x80, 0x80, 0x80, // V151 R,G,B 64 - 0x80, 0x80, 0x80, // V87 R,G,B 65 - 0x80, 0x80, 0x80, // V51 R,G,B 66 - 0x80, 0x80, 0x80, // V35 R,G,B 67 - 0x80, 0x80, 0x80, // V23 R,G,B 68 - 0x80, 0x80, 0x80, // V11 R,G,B 69 - 0x6b, 0x68, 0x71, // V3 R,G,B 70 - 0x00, 0x00, 0x00); // V1 R,G,B 68 + mipi_dsi_dcs_write_seq(dsi, 0xca, 69 + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, // V255 RR,GG,BB 70 + 0x80, 0x80, 0x80, // V203 R,G,B 71 + 0x80, 0x80, 0x80, // V151 R,G,B 72 + 0x80, 0x80, 0x80, // V87 R,G,B 73 + 0x80, 0x80, 0x80, // V51 R,G,B 74 + 0x80, 0x80, 0x80, // V35 R,G,B 75 + 0x80, 0x80, 0x80, // V23 R,G,B 76 + 0x80, 0x80, 0x80, // V11 R,G,B 77 + 0x6b, 0x68, 0x71, // V3 R,G,B 78 + 0x00, 0x00, 0x00); // V1 R,G,B 71 79 // set default Amoled Off Ratio 72 - dsi_dcs_write_seq(dsi, 0xb2, 0x40, 0x0a, 0x17, 0x00, 0x0a); 73 - dsi_dcs_write_seq(dsi, 0xb6, 0x2c, 0x0b); // set default elvss voltage 74 - dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00); 75 - dsi_dcs_write_seq(dsi, 0xf7, 0x03); // gamma/aor update 76 - dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5); // disable LEVEL2 commands 80 + mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x40, 0x0a, 0x17, 0x00, 0x0a); 81 + mipi_dsi_dcs_write_seq(dsi, 0xb6, 0x2c, 0x0b); // set default elvss voltage 82 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00); 83 + mipi_dsi_dcs_write_seq(dsi, 0xf7, 0x03); // gamma/aor update 84 + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5); // disable LEVEL2 commands 77 85 78 86 ret = mipi_dsi_dcs_set_display_on(dsi); 79 87 if (ret < 0) {
+8 -16
drivers/gpu/drm/panel/panel-samsung-sofef00.c
··· 34 34 return container_of(panel, struct sofef00_panel, panel); 35 35 } 36 36 37 - #define dsi_dcs_write_seq(dsi, seq...) do { \ 38 - static const u8 d[] = { seq }; \ 39 - int ret; \ 40 - ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ 41 - if (ret < 0) \ 42 - return ret; \ 43 - } while (0) 44 - 45 37 static void sofef00_panel_reset(struct sofef00_panel *ctx) 46 38 { 47 39 gpiod_set_value_cansleep(ctx->reset_gpio, 0); ··· 59 67 } 60 68 usleep_range(10000, 11000); 61 69 62 - dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a); 70 + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a); 63 71 64 72 ret = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK); 65 73 if (ret < 0) { ··· 67 75 return ret; 68 76 } 69 77 70 - dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5); 71 - dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a); 72 - dsi_dcs_write_seq(dsi, 0xb0, 0x07); 73 - dsi_dcs_write_seq(dsi, 0xb6, 0x12); 74 - dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5); 75 - dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x20); 76 - dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00); 78 + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5); 79 + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a); 80 + mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x07); 81 + mipi_dsi_dcs_write_seq(dsi, 0xb6, 0x12); 82 + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5); 83 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x20); 84 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00); 77 85 78 86 ret = mipi_dsi_dcs_set_display_on(dsi); 79 87 if (ret < 0) {
+2 -17
drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c
··· 32 32 return container_of(panel, struct sharp_ls060, panel); 33 33 } 34 34 35 - #define dsi_dcs_write_seq(dsi, seq...) ({ \ 36 - static const u8 d[] = { seq }; \ 37 - \ 38 - mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ 39 - }) 40 - 41 35 static void sharp_ls060_reset(struct sharp_ls060 *ctx) 42 36 { 43 37 gpiod_set_value_cansleep(ctx->reset_gpio, 0); ··· 50 56 51 57 dsi->mode_flags |= MIPI_DSI_MODE_LPM; 52 58 53 - ret = dsi_dcs_write_seq(dsi, 0xbb, 0x13); 54 - if (ret < 0) { 55 - dev_err(dev, "Failed to send command: %d\n", ret); 56 - return ret; 57 - } 58 - 59 - ret = dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_MEMORY_START); 60 - if (ret < 0) { 61 - dev_err(dev, "Failed to send command: %d\n", ret); 62 - return ret; 63 - } 59 + mipi_dsi_dcs_write_seq(dsi, 0xbb, 0x13); 60 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_MEMORY_START); 64 61 65 62 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); 66 63 if (ret < 0) {
+158 -175
drivers/gpu/drm/panel/panel-sitronix-st7703.c
··· 73 73 return container_of(panel, struct st7703, panel); 74 74 } 75 75 76 - #define dsi_generic_write_seq(dsi, seq...) do { \ 77 - static const u8 d[] = { seq }; \ 78 - int ret; \ 79 - ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ 80 - if (ret < 0) \ 81 - return ret; \ 82 - } while (0) 83 - 84 76 static int jh057n_init_sequence(struct st7703 *ctx) 85 77 { 86 78 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); ··· 82 90 * resemble the ST7703 but the number of parameters often don't match 83 91 * so it's likely a clone. 84 92 */ 85 - dsi_generic_write_seq(dsi, ST7703_CMD_SETEXTC, 86 - 0xF1, 0x12, 0x83); 87 - dsi_generic_write_seq(dsi, ST7703_CMD_SETRGBIF, 88 - 0x10, 0x10, 0x05, 0x05, 0x03, 0xFF, 0x00, 0x00, 89 - 0x00, 0x00); 90 - dsi_generic_write_seq(dsi, ST7703_CMD_SETSCR, 91 - 0x73, 0x73, 0x50, 0x50, 0x00, 0x00, 0x08, 0x70, 92 - 0x00); 93 - dsi_generic_write_seq(dsi, ST7703_CMD_SETVDC, 0x4E); 94 - dsi_generic_write_seq(dsi, ST7703_CMD_SETPANEL, 0x0B); 95 - dsi_generic_write_seq(dsi, ST7703_CMD_SETCYC, 0x80); 96 - dsi_generic_write_seq(dsi, ST7703_CMD_SETDISP, 0xF0, 0x12, 0x30); 97 - dsi_generic_write_seq(dsi, ST7703_CMD_SETEQ, 98 - 0x07, 0x07, 0x0B, 0x0B, 0x03, 0x0B, 0x00, 0x00, 99 - 0x00, 0x00, 0xFF, 0x00, 0xC0, 0x10); 100 - dsi_generic_write_seq(dsi, ST7703_CMD_SETBGP, 0x08, 0x08); 93 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETEXTC, 94 + 0xF1, 0x12, 0x83); 95 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETRGBIF, 96 + 0x10, 0x10, 0x05, 0x05, 0x03, 0xFF, 0x00, 0x00, 97 + 0x00, 0x00); 98 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETSCR, 99 + 0x73, 0x73, 0x50, 0x50, 0x00, 0x00, 0x08, 0x70, 100 + 0x00); 101 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETVDC, 0x4E); 102 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETPANEL, 0x0B); 103 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETCYC, 0x80); 104 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETDISP, 0xF0, 0x12, 0x30); 105 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETEQ, 106 + 0x07, 0x07, 0x0B, 0x0B, 0x03, 0x0B, 0x00, 0x00, 107 + 0x00, 0x00, 0xFF, 0x00, 0xC0, 0x10); 108 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETBGP, 0x08, 0x08); 101 109 msleep(20); 102 110 103 - dsi_generic_write_seq(dsi, ST7703_CMD_SETVCOM, 0x3F, 0x3F); 104 - dsi_generic_write_seq(dsi, ST7703_CMD_UNKNOWN_BF, 0x02, 0x11, 0x00); 105 - dsi_generic_write_seq(dsi, ST7703_CMD_SETGIP1, 106 - 0x82, 0x10, 0x06, 0x05, 0x9E, 0x0A, 0xA5, 0x12, 107 - 0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38, 108 - 0x0C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x00, 109 - 0x03, 0x00, 0x00, 0x00, 0x75, 0x75, 0x31, 0x88, 110 - 0x88, 0x88, 0x88, 0x88, 0x88, 0x13, 0x88, 0x64, 111 - 0x64, 0x20, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 112 - 0x02, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 113 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); 114 - dsi_generic_write_seq(dsi, ST7703_CMD_SETGIP2, 115 - 0x02, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 116 - 0x00, 0x00, 0x00, 0x00, 0x02, 0x46, 0x02, 0x88, 117 - 0x88, 0x88, 0x88, 0x88, 0x88, 0x64, 0x88, 0x13, 118 - 0x57, 0x13, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 119 - 0x75, 0x88, 0x23, 0x14, 0x00, 0x00, 0x02, 0x00, 120 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 121 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0A, 122 - 0xA5, 0x00, 0x00, 0x00, 0x00); 123 - dsi_generic_write_seq(dsi, ST7703_CMD_SETGAMMA, 124 - 0x00, 0x09, 0x0E, 0x29, 0x2D, 0x3C, 0x41, 0x37, 125 - 0x07, 0x0B, 0x0D, 0x10, 0x11, 0x0F, 0x10, 0x11, 126 - 0x18, 0x00, 0x09, 0x0E, 0x29, 0x2D, 0x3C, 0x41, 127 - 0x37, 0x07, 0x0B, 0x0D, 0x10, 0x11, 0x0F, 0x10, 128 - 0x11, 0x18); 111 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETVCOM, 0x3F, 0x3F); 112 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_UNKNOWN_BF, 0x02, 0x11, 0x00); 113 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETGIP1, 114 + 0x82, 0x10, 0x06, 0x05, 0x9E, 0x0A, 0xA5, 0x12, 115 + 0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38, 116 + 0x0C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x00, 117 + 0x03, 0x00, 0x00, 0x00, 0x75, 0x75, 0x31, 0x88, 118 + 0x88, 0x88, 0x88, 0x88, 0x88, 0x13, 0x88, 0x64, 119 + 0x64, 0x20, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 120 + 0x02, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 121 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); 122 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETGIP2, 123 + 0x02, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 124 + 0x00, 0x00, 0x00, 0x00, 0x02, 0x46, 0x02, 0x88, 125 + 0x88, 0x88, 0x88, 0x88, 0x88, 0x64, 0x88, 0x13, 126 + 0x57, 0x13, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 127 + 0x75, 0x88, 0x23, 0x14, 0x00, 0x00, 0x02, 0x00, 128 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 129 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0A, 130 + 0xA5, 0x00, 0x00, 0x00, 0x00); 131 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_SETGAMMA, 132 + 0x00, 0x09, 0x0E, 0x29, 0x2D, 0x3C, 0x41, 0x37, 133 + 0x07, 0x0B, 0x0D, 0x10, 0x11, 0x0F, 0x10, 0x11, 134 + 0x18, 0x00, 0x09, 0x0E, 0x29, 0x2D, 0x3C, 0x41, 135 + 0x37, 0x07, 0x0B, 0x0D, 0x10, 0x11, 0x0F, 0x10, 136 + 0x11, 0x18); 129 137 130 138 return 0; 131 139 } ··· 154 162 .init_sequence = jh057n_init_sequence, 155 163 }; 156 164 157 - #define dsi_dcs_write_seq(dsi, cmd, seq...) do { \ 158 - static const u8 d[] = { seq }; \ 159 - int ret; \ 160 - ret = mipi_dsi_dcs_write(dsi, cmd, d, ARRAY_SIZE(d)); \ 161 - if (ret < 0) \ 162 - return ret; \ 163 - } while (0) 164 - 165 - 166 165 static int xbd599_init_sequence(struct st7703 *ctx) 167 166 { 168 167 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); ··· 163 180 */ 164 181 165 182 /* Magic sequence to unlock user commands below. */ 166 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETEXTC, 0xF1, 0x12, 0x83); 183 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETEXTC, 0xF1, 0x12, 0x83); 167 184 168 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETMIPI, 169 - 0x33, /* VC_main = 0, Lane_Number = 3 (4 lanes) */ 170 - 0x81, /* DSI_LDO_SEL = 1.7V, RTERM = 90 Ohm */ 171 - 0x05, /* IHSRX = x6 (Low High Speed driving ability) */ 172 - 0xF9, /* TX_CLK_SEL = fDSICLK/16 */ 173 - 0x0E, /* HFP_OSC (min. HFP number in DSI mode) */ 174 - 0x0E, /* HBP_OSC (min. HBP number in DSI mode) */ 175 - /* The rest is undocumented in ST7703 datasheet */ 176 - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 177 - 0x44, 0x25, 0x00, 0x91, 0x0a, 0x00, 0x00, 0x02, 178 - 0x4F, 0x11, 0x00, 0x00, 0x37); 185 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETMIPI, 186 + 0x33, /* VC_main = 0, Lane_Number = 3 (4 lanes) */ 187 + 0x81, /* DSI_LDO_SEL = 1.7V, RTERM = 90 Ohm */ 188 + 0x05, /* IHSRX = x6 (Low High Speed driving ability) */ 189 + 0xF9, /* TX_CLK_SEL = fDSICLK/16 */ 190 + 0x0E, /* HFP_OSC (min. HFP number in DSI mode) */ 191 + 0x0E, /* HBP_OSC (min. HBP number in DSI mode) */ 192 + /* The rest is undocumented in ST7703 datasheet */ 193 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 194 + 0x44, 0x25, 0x00, 0x91, 0x0a, 0x00, 0x00, 0x02, 195 + 0x4F, 0x11, 0x00, 0x00, 0x37); 179 196 180 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER_EXT, 181 - 0x25, /* PCCS = 2, ECP_DC_DIV = 1/4 HSYNC */ 182 - 0x22, /* DT = 15ms XDK_ECP = x2 */ 183 - 0x20, /* PFM_DC_DIV = /1 */ 184 - 0x03 /* ECP_SYNC_EN = 1, VGX_SYNC_EN = 1 */); 197 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER_EXT, 198 + 0x25, /* PCCS = 2, ECP_DC_DIV = 1/4 HSYNC */ 199 + 0x22, /* DT = 15ms XDK_ECP = x2 */ 200 + 0x20, /* PFM_DC_DIV = /1 */ 201 + 0x03 /* ECP_SYNC_EN = 1, VGX_SYNC_EN = 1 */); 185 202 186 203 /* RGB I/F porch timing */ 187 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETRGBIF, 188 - 0x10, /* VBP_RGB_GEN */ 189 - 0x10, /* VFP_RGB_GEN */ 190 - 0x05, /* DE_BP_RGB_GEN */ 191 - 0x05, /* DE_FP_RGB_GEN */ 192 - /* The rest is undocumented in ST7703 datasheet */ 193 - 0x03, 0xFF, 194 - 0x00, 0x00, 195 - 0x00, 0x00); 204 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETRGBIF, 205 + 0x10, /* VBP_RGB_GEN */ 206 + 0x10, /* VFP_RGB_GEN */ 207 + 0x05, /* DE_BP_RGB_GEN */ 208 + 0x05, /* DE_FP_RGB_GEN */ 209 + /* The rest is undocumented in ST7703 datasheet */ 210 + 0x03, 0xFF, 211 + 0x00, 0x00, 212 + 0x00, 0x00); 196 213 197 214 /* Source driving settings. */ 198 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETSCR, 199 - 0x73, /* N_POPON */ 200 - 0x73, /* N_NOPON */ 201 - 0x50, /* I_POPON */ 202 - 0x50, /* I_NOPON */ 203 - 0x00, /* SCR[31,24] */ 204 - 0xC0, /* SCR[23,16] */ 205 - 0x08, /* SCR[15,8] */ 206 - 0x70, /* SCR[7,0] */ 207 - 0x00 /* Undocumented */); 215 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETSCR, 216 + 0x73, /* N_POPON */ 217 + 0x73, /* N_NOPON */ 218 + 0x50, /* I_POPON */ 219 + 0x50, /* I_NOPON */ 220 + 0x00, /* SCR[31,24] */ 221 + 0xC0, /* SCR[23,16] */ 222 + 0x08, /* SCR[15,8] */ 223 + 0x70, /* SCR[7,0] */ 224 + 0x00 /* Undocumented */); 208 225 209 226 /* NVDDD_SEL = -1.8V, VDDD_SEL = out of range (possibly 1.9V?) */ 210 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETVDC, 0x4E); 227 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETVDC, 0x4E); 211 228 212 229 /* 213 230 * SS_PANEL = 1 (reverse scan), GS_PANEL = 0 (normal scan) 214 231 * REV_PANEL = 1 (normally black panel), BGR_PANEL = 1 (BGR) 215 232 */ 216 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETPANEL, 0x0B); 233 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPANEL, 0x0B); 217 234 218 235 /* Zig-Zag Type C column inversion. */ 219 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETCYC, 0x80); 236 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETCYC, 0x80); 220 237 221 238 /* Set display resolution. */ 222 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETDISP, 223 - 0xF0, /* NL = 240 */ 224 - 0x12, /* RES_V_LSB = 0, BLK_CON = VSSD, 225 - * RESO_SEL = 720RGB 226 - */ 227 - 0xF0 /* WHITE_GND_EN = 1 (GND), 228 - * WHITE_FRAME_SEL = 7 frames, 229 - * ISC = 0 frames 230 - */); 239 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETDISP, 240 + 0xF0, /* NL = 240 */ 241 + 0x12, /* RES_V_LSB = 0, BLK_CON = VSSD, 242 + * RESO_SEL = 720RGB 243 + */ 244 + 0xF0 /* WHITE_GND_EN = 1 (GND), 245 + * WHITE_FRAME_SEL = 7 frames, 246 + * ISC = 0 frames 247 + */); 231 248 232 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETEQ, 233 - 0x00, /* PNOEQ */ 234 - 0x00, /* NNOEQ */ 235 - 0x0B, /* PEQGND */ 236 - 0x0B, /* NEQGND */ 237 - 0x10, /* PEQVCI */ 238 - 0x10, /* NEQVCI */ 239 - 0x00, /* PEQVCI1 */ 240 - 0x00, /* NEQVCI1 */ 241 - 0x00, /* reserved */ 242 - 0x00, /* reserved */ 243 - 0xFF, /* reserved */ 244 - 0x00, /* reserved */ 245 - 0xC0, /* ESD_DET_DATA_WHITE = 1, ESD_WHITE_EN = 1 */ 246 - 0x10 /* SLPIN_OPTION = 1 (no need vsync after sleep-in) 247 - * VEDIO_NO_CHECK_EN = 0 248 - * ESD_WHITE_GND_EN = 0 249 - * ESD_DET_TIME_SEL = 0 frames 250 - */); 249 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETEQ, 250 + 0x00, /* PNOEQ */ 251 + 0x00, /* NNOEQ */ 252 + 0x0B, /* PEQGND */ 253 + 0x0B, /* NEQGND */ 254 + 0x10, /* PEQVCI */ 255 + 0x10, /* NEQVCI */ 256 + 0x00, /* PEQVCI1 */ 257 + 0x00, /* NEQVCI1 */ 258 + 0x00, /* reserved */ 259 + 0x00, /* reserved */ 260 + 0xFF, /* reserved */ 261 + 0x00, /* reserved */ 262 + 0xC0, /* ESD_DET_DATA_WHITE = 1, ESD_WHITE_EN = 1 */ 263 + 0x10 /* SLPIN_OPTION = 1 (no need vsync after sleep-in) 264 + * VEDIO_NO_CHECK_EN = 0 265 + * ESD_WHITE_GND_EN = 0 266 + * ESD_DET_TIME_SEL = 0 frames 267 + */); 251 268 252 269 /* Undocumented command. */ 253 - dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_C6, 0x01, 0x00, 0xFF, 0xFF, 0x00); 270 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_C6, 0x01, 0x00, 0xFF, 0xFF, 0x00); 254 271 255 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER, 256 - 0x74, /* VBTHS, VBTLS: VGH = 17V, VBL = -11V */ 257 - 0x00, /* FBOFF_VGH = 0, FBOFF_VGL = 0 */ 258 - 0x32, /* VRP */ 259 - 0x32, /* VRN */ 260 - 0x77, /* reserved */ 261 - 0xF1, /* APS = 1 (small), 262 - * VGL_DET_EN = 1, VGH_DET_EN = 1, 263 - * VGL_TURBO = 1, VGH_TURBO = 1 264 - */ 265 - 0xFF, /* VGH1_L_DIV, VGL1_L_DIV (1.5MHz) */ 266 - 0xFF, /* VGH1_R_DIV, VGL1_R_DIV (1.5MHz) */ 267 - 0xCC, /* VGH2_L_DIV, VGL2_L_DIV (2.6MHz) */ 268 - 0xCC, /* VGH2_R_DIV, VGL2_R_DIV (2.6MHz) */ 269 - 0x77, /* VGH3_L_DIV, VGL3_L_DIV (4.5MHz) */ 270 - 0x77 /* VGH3_R_DIV, VGL3_R_DIV (4.5MHz) */); 272 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER, 273 + 0x74, /* VBTHS, VBTLS: VGH = 17V, VBL = -11V */ 274 + 0x00, /* FBOFF_VGH = 0, FBOFF_VGL = 0 */ 275 + 0x32, /* VRP */ 276 + 0x32, /* VRN */ 277 + 0x77, /* reserved */ 278 + 0xF1, /* APS = 1 (small), 279 + * VGL_DET_EN = 1, VGH_DET_EN = 1, 280 + * VGL_TURBO = 1, VGH_TURBO = 1 281 + */ 282 + 0xFF, /* VGH1_L_DIV, VGL1_L_DIV (1.5MHz) */ 283 + 0xFF, /* VGH1_R_DIV, VGL1_R_DIV (1.5MHz) */ 284 + 0xCC, /* VGH2_L_DIV, VGL2_L_DIV (2.6MHz) */ 285 + 0xCC, /* VGH2_R_DIV, VGL2_R_DIV (2.6MHz) */ 286 + 0x77, /* VGH3_L_DIV, VGL3_L_DIV (4.5MHz) */ 287 + 0x77 /* VGH3_R_DIV, VGL3_R_DIV (4.5MHz) */); 271 288 272 289 /* Reference voltage. */ 273 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP, 274 - 0x07, /* VREF_SEL = 4.2V */ 275 - 0x07 /* NVREF_SEL = 4.2V */); 290 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP, 291 + 0x07, /* VREF_SEL = 4.2V */ 292 + 0x07 /* NVREF_SEL = 4.2V */); 276 293 msleep(20); 277 294 278 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM, 279 - 0x2C, /* VCOMDC_F = -0.67V */ 280 - 0x2C /* VCOMDC_B = -0.67V */); 295 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM, 296 + 0x2C, /* VCOMDC_F = -0.67V */ 297 + 0x2C /* VCOMDC_B = -0.67V */); 281 298 282 299 /* Undocumented command. */ 283 - dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_BF, 0x02, 0x11, 0x00); 300 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_BF, 0x02, 0x11, 0x00); 284 301 285 302 /* This command is to set forward GIP timing. */ 286 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP1, 287 - 0x82, 0x10, 0x06, 0x05, 0xA2, 0x0A, 0xA5, 0x12, 288 - 0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38, 289 - 0x0C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x00, 290 - 0x03, 0x00, 0x00, 0x00, 0x75, 0x75, 0x31, 0x88, 291 - 0x88, 0x88, 0x88, 0x88, 0x88, 0x13, 0x88, 0x64, 292 - 0x64, 0x20, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 293 - 0x02, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 294 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); 303 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP1, 304 + 0x82, 0x10, 0x06, 0x05, 0xA2, 0x0A, 0xA5, 0x12, 305 + 0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38, 306 + 0x0C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x00, 307 + 0x03, 0x00, 0x00, 0x00, 0x75, 0x75, 0x31, 0x88, 308 + 0x88, 0x88, 0x88, 0x88, 0x88, 0x13, 0x88, 0x64, 309 + 0x64, 0x20, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 310 + 0x02, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 311 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); 295 312 296 313 /* This command is to set backward GIP timing. */ 297 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP2, 298 - 0x02, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 299 - 0x00, 0x00, 0x00, 0x00, 0x02, 0x46, 0x02, 0x88, 300 - 0x88, 0x88, 0x88, 0x88, 0x88, 0x64, 0x88, 0x13, 301 - 0x57, 0x13, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 302 - 0x75, 0x88, 0x23, 0x14, 0x00, 0x00, 0x02, 0x00, 303 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 304 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0A, 305 - 0xA5, 0x00, 0x00, 0x00, 0x00); 314 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP2, 315 + 0x02, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 316 + 0x00, 0x00, 0x00, 0x00, 0x02, 0x46, 0x02, 0x88, 317 + 0x88, 0x88, 0x88, 0x88, 0x88, 0x64, 0x88, 0x13, 318 + 0x57, 0x13, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 319 + 0x75, 0x88, 0x23, 0x14, 0x00, 0x00, 0x02, 0x00, 320 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 321 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0A, 322 + 0xA5, 0x00, 0x00, 0x00, 0x00); 306 323 307 324 /* Adjust the gamma characteristics of the panel. */ 308 - dsi_dcs_write_seq(dsi, ST7703_CMD_SETGAMMA, 309 - 0x00, 0x09, 0x0D, 0x23, 0x27, 0x3C, 0x41, 0x35, 310 - 0x07, 0x0D, 0x0E, 0x12, 0x13, 0x10, 0x12, 0x12, 311 - 0x18, 0x00, 0x09, 0x0D, 0x23, 0x27, 0x3C, 0x41, 312 - 0x35, 0x07, 0x0D, 0x0E, 0x12, 0x13, 0x10, 0x12, 313 - 0x12, 0x18); 325 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGAMMA, 326 + 0x00, 0x09, 0x0D, 0x23, 0x27, 0x3C, 0x41, 0x35, 327 + 0x07, 0x0D, 0x0E, 0x12, 0x13, 0x10, 0x12, 0x12, 328 + 0x18, 0x00, 0x09, 0x0D, 0x23, 0x27, 0x3C, 0x41, 329 + 0x35, 0x07, 0x0D, 0x0E, 0x12, 0x13, 0x10, 0x12, 330 + 0x12, 0x18); 314 331 315 332 return 0; 316 333 } ··· 482 499 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); 483 500 484 501 dev_dbg(ctx->dev, "Setting all pixels on\n"); 485 - dsi_generic_write_seq(dsi, ST7703_CMD_ALL_PIXEL_ON); 502 + mipi_dsi_generic_write_seq(dsi, ST7703_CMD_ALL_PIXEL_ON); 486 503 msleep(val * 1000); 487 504 /* Reset the panel to get video back */ 488 505 drm_panel_disable(&ctx->panel);
+195 -203
drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c
··· 33 33 return container_of(panel, struct truly_nt35521, panel); 34 34 } 35 35 36 - #define dsi_generic_write_seq(dsi, seq...) do { \ 37 - static const u8 d[] = { seq }; \ 38 - int ret; \ 39 - ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ 40 - if (ret < 0) \ 41 - return ret; \ 42 - } while (0) 43 - 44 36 static void truly_nt35521_reset(struct truly_nt35521 *ctx) 45 37 { 46 38 gpiod_set_value_cansleep(ctx->reset_gpio, 1); ··· 51 59 52 60 dsi->mode_flags |= MIPI_DSI_MODE_LPM; 53 61 54 - dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x00); 55 - dsi_generic_write_seq(dsi, 0xff, 0xaa, 0x55, 0xa5, 0x80); 56 - dsi_generic_write_seq(dsi, 0x6f, 0x11, 0x00); 57 - dsi_generic_write_seq(dsi, 0xf7, 0x20, 0x00); 58 - dsi_generic_write_seq(dsi, 0x6f, 0x01); 59 - dsi_generic_write_seq(dsi, 0xb1, 0x21); 60 - dsi_generic_write_seq(dsi, 0xbd, 0x01, 0xa0, 0x10, 0x08, 0x01); 61 - dsi_generic_write_seq(dsi, 0xb8, 0x01, 0x02, 0x0c, 0x02); 62 - dsi_generic_write_seq(dsi, 0xbb, 0x11, 0x11); 63 - dsi_generic_write_seq(dsi, 0xbc, 0x00, 0x00); 64 - dsi_generic_write_seq(dsi, 0xb6, 0x02); 65 - dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x01); 66 - dsi_generic_write_seq(dsi, 0xb0, 0x09, 0x09); 67 - dsi_generic_write_seq(dsi, 0xb1, 0x09, 0x09); 68 - dsi_generic_write_seq(dsi, 0xbc, 0x8c, 0x00); 69 - dsi_generic_write_seq(dsi, 0xbd, 0x8c, 0x00); 70 - dsi_generic_write_seq(dsi, 0xca, 0x00); 71 - dsi_generic_write_seq(dsi, 0xc0, 0x04); 72 - dsi_generic_write_seq(dsi, 0xbe, 0xb5); 73 - dsi_generic_write_seq(dsi, 0xb3, 0x35, 0x35); 74 - dsi_generic_write_seq(dsi, 0xb4, 0x25, 0x25); 75 - dsi_generic_write_seq(dsi, 0xb9, 0x43, 0x43); 76 - dsi_generic_write_seq(dsi, 0xba, 0x24, 0x24); 77 - dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x02); 78 - dsi_generic_write_seq(dsi, 0xee, 0x03); 79 - dsi_generic_write_seq(dsi, 0xb0, 80 - 0x00, 0xb2, 0x00, 0xb3, 0x00, 0xb6, 0x00, 0xc3, 81 - 0x00, 0xce, 0x00, 0xe1, 0x00, 0xf3, 0x01, 0x11); 82 - dsi_generic_write_seq(dsi, 0xb1, 83 - 0x01, 0x2e, 0x01, 0x5c, 0x01, 0x82, 0x01, 0xc3, 84 - 0x01, 0xfe, 0x02, 0x00, 0x02, 0x37, 0x02, 0x77); 85 - dsi_generic_write_seq(dsi, 0xb2, 86 - 0x02, 0xa1, 0x02, 0xd7, 0x02, 0xfe, 0x03, 0x2c, 87 - 0x03, 0x4b, 0x03, 0x63, 0x03, 0x8f, 0x03, 0x90); 88 - dsi_generic_write_seq(dsi, 0xb3, 0x03, 0x96, 0x03, 0x98); 89 - dsi_generic_write_seq(dsi, 0xb4, 90 - 0x00, 0x81, 0x00, 0x8b, 0x00, 0x9c, 0x00, 0xa9, 91 - 0x00, 0xb5, 0x00, 0xcb, 0x00, 0xdf, 0x01, 0x02); 92 - dsi_generic_write_seq(dsi, 0xb5, 93 - 0x01, 0x1f, 0x01, 0x51, 0x01, 0x7a, 0x01, 0xbf, 94 - 0x01, 0xfa, 0x01, 0xfc, 0x02, 0x34, 0x02, 0x76); 95 - dsi_generic_write_seq(dsi, 0xb6, 96 - 0x02, 0x9f, 0x02, 0xd7, 0x02, 0xfc, 0x03, 0x2c, 97 - 0x03, 0x4a, 0x03, 0x63, 0x03, 0x8f, 0x03, 0xa2); 98 - dsi_generic_write_seq(dsi, 0xb7, 0x03, 0xb8, 0x03, 0xba); 99 - dsi_generic_write_seq(dsi, 0xb8, 100 - 0x00, 0x01, 0x00, 0x02, 0x00, 0x0e, 0x00, 0x2a, 101 - 0x00, 0x41, 0x00, 0x67, 0x00, 0x87, 0x00, 0xb9); 102 - dsi_generic_write_seq(dsi, 0xb9, 103 - 0x00, 0xe2, 0x01, 0x22, 0x01, 0x54, 0x01, 0xa3, 104 - 0x01, 0xe6, 0x01, 0xe7, 0x02, 0x24, 0x02, 0x67); 105 - dsi_generic_write_seq(dsi, 0xba, 106 - 0x02, 0x93, 0x02, 0xcd, 0x02, 0xf6, 0x03, 0x31, 107 - 0x03, 0x6c, 0x03, 0xe9, 0x03, 0xef, 0x03, 0xf4); 108 - dsi_generic_write_seq(dsi, 0xbb, 0x03, 0xf6, 0x03, 0xf7); 109 - dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x03); 110 - dsi_generic_write_seq(dsi, 0xb0, 0x22, 0x00); 111 - dsi_generic_write_seq(dsi, 0xb1, 0x22, 0x00); 112 - dsi_generic_write_seq(dsi, 0xb2, 0x05, 0x00, 0x60, 0x00, 0x00); 113 - dsi_generic_write_seq(dsi, 0xb3, 0x05, 0x00, 0x60, 0x00, 0x00); 114 - dsi_generic_write_seq(dsi, 0xb4, 0x05, 0x00, 0x60, 0x00, 0x00); 115 - dsi_generic_write_seq(dsi, 0xb5, 0x05, 0x00, 0x60, 0x00, 0x00); 116 - dsi_generic_write_seq(dsi, 0xba, 0x53, 0x00, 0x60, 0x00, 0x00); 117 - dsi_generic_write_seq(dsi, 0xbb, 0x53, 0x00, 0x60, 0x00, 0x00); 118 - dsi_generic_write_seq(dsi, 0xbc, 0x53, 0x00, 0x60, 0x00, 0x00); 119 - dsi_generic_write_seq(dsi, 0xbd, 0x53, 0x00, 0x60, 0x00, 0x00); 120 - dsi_generic_write_seq(dsi, 0xc0, 0x00, 0x34, 0x00, 0x00); 121 - dsi_generic_write_seq(dsi, 0xc1, 0x00, 0x00, 0x34, 0x00); 122 - dsi_generic_write_seq(dsi, 0xc2, 0x00, 0x00, 0x34, 0x00); 123 - dsi_generic_write_seq(dsi, 0xc3, 0x00, 0x00, 0x34, 0x00); 124 - dsi_generic_write_seq(dsi, 0xc4, 0x60); 125 - dsi_generic_write_seq(dsi, 0xc5, 0xc0); 126 - dsi_generic_write_seq(dsi, 0xc6, 0x00); 127 - dsi_generic_write_seq(dsi, 0xc7, 0x00); 128 - dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x05); 129 - dsi_generic_write_seq(dsi, 0xb0, 0x17, 0x06); 130 - dsi_generic_write_seq(dsi, 0xb1, 0x17, 0x06); 131 - dsi_generic_write_seq(dsi, 0xb2, 0x17, 0x06); 132 - dsi_generic_write_seq(dsi, 0xb3, 0x17, 0x06); 133 - dsi_generic_write_seq(dsi, 0xb4, 0x17, 0x06); 134 - dsi_generic_write_seq(dsi, 0xb5, 0x17, 0x06); 135 - dsi_generic_write_seq(dsi, 0xb6, 0x17, 0x06); 136 - dsi_generic_write_seq(dsi, 0xb7, 0x17, 0x06); 137 - dsi_generic_write_seq(dsi, 0xb8, 0x00); 138 - dsi_generic_write_seq(dsi, 0xb9, 0x00, 0x03); 139 - dsi_generic_write_seq(dsi, 0xba, 0x00, 0x00); 140 - dsi_generic_write_seq(dsi, 0xbb, 0x02, 0x03); 141 - dsi_generic_write_seq(dsi, 0xbc, 0x02, 0x03); 142 - dsi_generic_write_seq(dsi, 0xbd, 0x03, 0x03, 0x00, 0x03, 0x03); 143 - dsi_generic_write_seq(dsi, 0xc0, 0x0b); 144 - dsi_generic_write_seq(dsi, 0xc1, 0x09); 145 - dsi_generic_write_seq(dsi, 0xc2, 0xa6); 146 - dsi_generic_write_seq(dsi, 0xc3, 0x05); 147 - dsi_generic_write_seq(dsi, 0xc4, 0x00); 148 - dsi_generic_write_seq(dsi, 0xc5, 0x02); 149 - dsi_generic_write_seq(dsi, 0xc6, 0x22); 150 - dsi_generic_write_seq(dsi, 0xc7, 0x03); 151 - dsi_generic_write_seq(dsi, 0xc8, 0x07, 0x20); 152 - dsi_generic_write_seq(dsi, 0xc9, 0x03, 0x20); 153 - dsi_generic_write_seq(dsi, 0xca, 0x01, 0x60); 154 - dsi_generic_write_seq(dsi, 0xcb, 0x01, 0x60); 155 - dsi_generic_write_seq(dsi, 0xcc, 0x00, 0x00, 0x02); 156 - dsi_generic_write_seq(dsi, 0xcd, 0x00, 0x00, 0x02); 157 - dsi_generic_write_seq(dsi, 0xce, 0x00, 0x00, 0x02); 158 - dsi_generic_write_seq(dsi, 0xcf, 0x00, 0x00, 0x02); 159 - dsi_generic_write_seq(dsi, 0xd1, 0x00, 0x05, 0x01, 0x07, 0x10); 160 - dsi_generic_write_seq(dsi, 0xd2, 0x10, 0x05, 0x05, 0x03, 0x10); 161 - dsi_generic_write_seq(dsi, 0xd3, 0x20, 0x00, 0x43, 0x07, 0x10); 162 - dsi_generic_write_seq(dsi, 0xd4, 0x30, 0x00, 0x43, 0x07, 0x10); 163 - dsi_generic_write_seq(dsi, 0xd0, 164 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); 165 - dsi_generic_write_seq(dsi, 0xd5, 166 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 167 - 0x00, 0x00, 0x00); 168 - dsi_generic_write_seq(dsi, 0xd6, 169 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 170 - 0x00, 0x00, 0x00); 171 - dsi_generic_write_seq(dsi, 0xd7, 172 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 173 - 0x00, 0x00, 0x00); 174 - dsi_generic_write_seq(dsi, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00); 175 - dsi_generic_write_seq(dsi, 0xe5, 0x06); 176 - dsi_generic_write_seq(dsi, 0xe6, 0x06); 177 - dsi_generic_write_seq(dsi, 0xe7, 0x00); 178 - dsi_generic_write_seq(dsi, 0xe8, 0x06); 179 - dsi_generic_write_seq(dsi, 0xe9, 0x06); 180 - dsi_generic_write_seq(dsi, 0xea, 0x06); 181 - dsi_generic_write_seq(dsi, 0xeb, 0x00); 182 - dsi_generic_write_seq(dsi, 0xec, 0x00); 183 - dsi_generic_write_seq(dsi, 0xed, 0x30); 184 - dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x06); 185 - dsi_generic_write_seq(dsi, 0xb0, 0x31, 0x31); 186 - dsi_generic_write_seq(dsi, 0xb1, 0x31, 0x31); 187 - dsi_generic_write_seq(dsi, 0xb2, 0x2d, 0x2e); 188 - dsi_generic_write_seq(dsi, 0xb3, 0x31, 0x34); 189 - dsi_generic_write_seq(dsi, 0xb4, 0x29, 0x2a); 190 - dsi_generic_write_seq(dsi, 0xb5, 0x12, 0x10); 191 - dsi_generic_write_seq(dsi, 0xb6, 0x18, 0x16); 192 - dsi_generic_write_seq(dsi, 0xb7, 0x00, 0x02); 193 - dsi_generic_write_seq(dsi, 0xb8, 0x08, 0x31); 194 - dsi_generic_write_seq(dsi, 0xb9, 0x31, 0x31); 195 - dsi_generic_write_seq(dsi, 0xba, 0x31, 0x31); 196 - dsi_generic_write_seq(dsi, 0xbb, 0x31, 0x08); 197 - dsi_generic_write_seq(dsi, 0xbc, 0x03, 0x01); 198 - dsi_generic_write_seq(dsi, 0xbd, 0x17, 0x19); 199 - dsi_generic_write_seq(dsi, 0xbe, 0x11, 0x13); 200 - dsi_generic_write_seq(dsi, 0xbf, 0x2a, 0x29); 201 - dsi_generic_write_seq(dsi, 0xc0, 0x34, 0x31); 202 - dsi_generic_write_seq(dsi, 0xc1, 0x2e, 0x2d); 203 - dsi_generic_write_seq(dsi, 0xc2, 0x31, 0x31); 204 - dsi_generic_write_seq(dsi, 0xc3, 0x31, 0x31); 205 - dsi_generic_write_seq(dsi, 0xc4, 0x31, 0x31); 206 - dsi_generic_write_seq(dsi, 0xc5, 0x31, 0x31); 207 - dsi_generic_write_seq(dsi, 0xc6, 0x2e, 0x2d); 208 - dsi_generic_write_seq(dsi, 0xc7, 0x31, 0x34); 209 - dsi_generic_write_seq(dsi, 0xc8, 0x29, 0x2a); 210 - dsi_generic_write_seq(dsi, 0xc9, 0x17, 0x19); 211 - dsi_generic_write_seq(dsi, 0xca, 0x11, 0x13); 212 - dsi_generic_write_seq(dsi, 0xcb, 0x03, 0x01); 213 - dsi_generic_write_seq(dsi, 0xcc, 0x08, 0x31); 214 - dsi_generic_write_seq(dsi, 0xcd, 0x31, 0x31); 215 - dsi_generic_write_seq(dsi, 0xce, 0x31, 0x31); 216 - dsi_generic_write_seq(dsi, 0xcf, 0x31, 0x08); 217 - dsi_generic_write_seq(dsi, 0xd0, 0x00, 0x02); 218 - dsi_generic_write_seq(dsi, 0xd1, 0x12, 0x10); 219 - dsi_generic_write_seq(dsi, 0xd2, 0x18, 0x16); 220 - dsi_generic_write_seq(dsi, 0xd3, 0x2a, 0x29); 221 - dsi_generic_write_seq(dsi, 0xd4, 0x34, 0x31); 222 - dsi_generic_write_seq(dsi, 0xd5, 0x2d, 0x2e); 223 - dsi_generic_write_seq(dsi, 0xd6, 0x31, 0x31); 224 - dsi_generic_write_seq(dsi, 0xd7, 0x31, 0x31); 225 - dsi_generic_write_seq(dsi, 0xe5, 0x31, 0x31); 226 - dsi_generic_write_seq(dsi, 0xe6, 0x31, 0x31); 227 - dsi_generic_write_seq(dsi, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00); 228 - dsi_generic_write_seq(dsi, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x00); 229 - dsi_generic_write_seq(dsi, 0xe7, 0x00); 230 - dsi_generic_write_seq(dsi, 0x6f, 0x02); 231 - dsi_generic_write_seq(dsi, 0xf7, 0x47); 232 - dsi_generic_write_seq(dsi, 0x6f, 0x0a); 233 - dsi_generic_write_seq(dsi, 0xf7, 0x02); 234 - dsi_generic_write_seq(dsi, 0x6f, 0x17); 235 - dsi_generic_write_seq(dsi, 0xf4, 0x60); 236 - dsi_generic_write_seq(dsi, 0x6f, 0x01); 237 - dsi_generic_write_seq(dsi, 0xf9, 0x46); 238 - dsi_generic_write_seq(dsi, 0x6f, 0x11); 239 - dsi_generic_write_seq(dsi, 0xf3, 0x01); 240 - dsi_generic_write_seq(dsi, 0x35, 0x00); 241 - dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x00); 242 - dsi_generic_write_seq(dsi, 0xd9, 0x02, 0x03, 0x00); 243 - dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x00, 0x00); 244 - dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x00); 245 - dsi_generic_write_seq(dsi, 0xb1, 0x6c, 0x21); 246 - dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x00, 0x00); 247 - dsi_generic_write_seq(dsi, 0x35, 0x00); 62 + mipi_dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x00); 63 + mipi_dsi_generic_write_seq(dsi, 0xff, 0xaa, 0x55, 0xa5, 0x80); 64 + mipi_dsi_generic_write_seq(dsi, 0x6f, 0x11, 0x00); 65 + mipi_dsi_generic_write_seq(dsi, 0xf7, 0x20, 0x00); 66 + mipi_dsi_generic_write_seq(dsi, 0x6f, 0x01); 67 + mipi_dsi_generic_write_seq(dsi, 0xb1, 0x21); 68 + mipi_dsi_generic_write_seq(dsi, 0xbd, 0x01, 0xa0, 0x10, 0x08, 0x01); 69 + mipi_dsi_generic_write_seq(dsi, 0xb8, 0x01, 0x02, 0x0c, 0x02); 70 + mipi_dsi_generic_write_seq(dsi, 0xbb, 0x11, 0x11); 71 + mipi_dsi_generic_write_seq(dsi, 0xbc, 0x00, 0x00); 72 + mipi_dsi_generic_write_seq(dsi, 0xb6, 0x02); 73 + mipi_dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x01); 74 + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x09, 0x09); 75 + mipi_dsi_generic_write_seq(dsi, 0xb1, 0x09, 0x09); 76 + mipi_dsi_generic_write_seq(dsi, 0xbc, 0x8c, 0x00); 77 + mipi_dsi_generic_write_seq(dsi, 0xbd, 0x8c, 0x00); 78 + mipi_dsi_generic_write_seq(dsi, 0xca, 0x00); 79 + mipi_dsi_generic_write_seq(dsi, 0xc0, 0x04); 80 + mipi_dsi_generic_write_seq(dsi, 0xbe, 0xb5); 81 + mipi_dsi_generic_write_seq(dsi, 0xb3, 0x35, 0x35); 82 + mipi_dsi_generic_write_seq(dsi, 0xb4, 0x25, 0x25); 83 + mipi_dsi_generic_write_seq(dsi, 0xb9, 0x43, 0x43); 84 + mipi_dsi_generic_write_seq(dsi, 0xba, 0x24, 0x24); 85 + mipi_dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x02); 86 + mipi_dsi_generic_write_seq(dsi, 0xee, 0x03); 87 + mipi_dsi_generic_write_seq(dsi, 0xb0, 88 + 0x00, 0xb2, 0x00, 0xb3, 0x00, 0xb6, 0x00, 0xc3, 89 + 0x00, 0xce, 0x00, 0xe1, 0x00, 0xf3, 0x01, 0x11); 90 + mipi_dsi_generic_write_seq(dsi, 0xb1, 91 + 0x01, 0x2e, 0x01, 0x5c, 0x01, 0x82, 0x01, 0xc3, 92 + 0x01, 0xfe, 0x02, 0x00, 0x02, 0x37, 0x02, 0x77); 93 + mipi_dsi_generic_write_seq(dsi, 0xb2, 94 + 0x02, 0xa1, 0x02, 0xd7, 0x02, 0xfe, 0x03, 0x2c, 95 + 0x03, 0x4b, 0x03, 0x63, 0x03, 0x8f, 0x03, 0x90); 96 + mipi_dsi_generic_write_seq(dsi, 0xb3, 0x03, 0x96, 0x03, 0x98); 97 + mipi_dsi_generic_write_seq(dsi, 0xb4, 98 + 0x00, 0x81, 0x00, 0x8b, 0x00, 0x9c, 0x00, 0xa9, 99 + 0x00, 0xb5, 0x00, 0xcb, 0x00, 0xdf, 0x01, 0x02); 100 + mipi_dsi_generic_write_seq(dsi, 0xb5, 101 + 0x01, 0x1f, 0x01, 0x51, 0x01, 0x7a, 0x01, 0xbf, 102 + 0x01, 0xfa, 0x01, 0xfc, 0x02, 0x34, 0x02, 0x76); 103 + mipi_dsi_generic_write_seq(dsi, 0xb6, 104 + 0x02, 0x9f, 0x02, 0xd7, 0x02, 0xfc, 0x03, 0x2c, 105 + 0x03, 0x4a, 0x03, 0x63, 0x03, 0x8f, 0x03, 0xa2); 106 + mipi_dsi_generic_write_seq(dsi, 0xb7, 0x03, 0xb8, 0x03, 0xba); 107 + mipi_dsi_generic_write_seq(dsi, 0xb8, 108 + 0x00, 0x01, 0x00, 0x02, 0x00, 0x0e, 0x00, 0x2a, 109 + 0x00, 0x41, 0x00, 0x67, 0x00, 0x87, 0x00, 0xb9); 110 + mipi_dsi_generic_write_seq(dsi, 0xb9, 111 + 0x00, 0xe2, 0x01, 0x22, 0x01, 0x54, 0x01, 0xa3, 112 + 0x01, 0xe6, 0x01, 0xe7, 0x02, 0x24, 0x02, 0x67); 113 + mipi_dsi_generic_write_seq(dsi, 0xba, 114 + 0x02, 0x93, 0x02, 0xcd, 0x02, 0xf6, 0x03, 0x31, 115 + 0x03, 0x6c, 0x03, 0xe9, 0x03, 0xef, 0x03, 0xf4); 116 + mipi_dsi_generic_write_seq(dsi, 0xbb, 0x03, 0xf6, 0x03, 0xf7); 117 + mipi_dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x03); 118 + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x22, 0x00); 119 + mipi_dsi_generic_write_seq(dsi, 0xb1, 0x22, 0x00); 120 + mipi_dsi_generic_write_seq(dsi, 0xb2, 0x05, 0x00, 0x60, 0x00, 0x00); 121 + mipi_dsi_generic_write_seq(dsi, 0xb3, 0x05, 0x00, 0x60, 0x00, 0x00); 122 + mipi_dsi_generic_write_seq(dsi, 0xb4, 0x05, 0x00, 0x60, 0x00, 0x00); 123 + mipi_dsi_generic_write_seq(dsi, 0xb5, 0x05, 0x00, 0x60, 0x00, 0x00); 124 + mipi_dsi_generic_write_seq(dsi, 0xba, 0x53, 0x00, 0x60, 0x00, 0x00); 125 + mipi_dsi_generic_write_seq(dsi, 0xbb, 0x53, 0x00, 0x60, 0x00, 0x00); 126 + mipi_dsi_generic_write_seq(dsi, 0xbc, 0x53, 0x00, 0x60, 0x00, 0x00); 127 + mipi_dsi_generic_write_seq(dsi, 0xbd, 0x53, 0x00, 0x60, 0x00, 0x00); 128 + mipi_dsi_generic_write_seq(dsi, 0xc0, 0x00, 0x34, 0x00, 0x00); 129 + mipi_dsi_generic_write_seq(dsi, 0xc1, 0x00, 0x00, 0x34, 0x00); 130 + mipi_dsi_generic_write_seq(dsi, 0xc2, 0x00, 0x00, 0x34, 0x00); 131 + mipi_dsi_generic_write_seq(dsi, 0xc3, 0x00, 0x00, 0x34, 0x00); 132 + mipi_dsi_generic_write_seq(dsi, 0xc4, 0x60); 133 + mipi_dsi_generic_write_seq(dsi, 0xc5, 0xc0); 134 + mipi_dsi_generic_write_seq(dsi, 0xc6, 0x00); 135 + mipi_dsi_generic_write_seq(dsi, 0xc7, 0x00); 136 + mipi_dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x05); 137 + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x17, 0x06); 138 + mipi_dsi_generic_write_seq(dsi, 0xb1, 0x17, 0x06); 139 + mipi_dsi_generic_write_seq(dsi, 0xb2, 0x17, 0x06); 140 + mipi_dsi_generic_write_seq(dsi, 0xb3, 0x17, 0x06); 141 + mipi_dsi_generic_write_seq(dsi, 0xb4, 0x17, 0x06); 142 + mipi_dsi_generic_write_seq(dsi, 0xb5, 0x17, 0x06); 143 + mipi_dsi_generic_write_seq(dsi, 0xb6, 0x17, 0x06); 144 + mipi_dsi_generic_write_seq(dsi, 0xb7, 0x17, 0x06); 145 + mipi_dsi_generic_write_seq(dsi, 0xb8, 0x00); 146 + mipi_dsi_generic_write_seq(dsi, 0xb9, 0x00, 0x03); 147 + mipi_dsi_generic_write_seq(dsi, 0xba, 0x00, 0x00); 148 + mipi_dsi_generic_write_seq(dsi, 0xbb, 0x02, 0x03); 149 + mipi_dsi_generic_write_seq(dsi, 0xbc, 0x02, 0x03); 150 + mipi_dsi_generic_write_seq(dsi, 0xbd, 0x03, 0x03, 0x00, 0x03, 0x03); 151 + mipi_dsi_generic_write_seq(dsi, 0xc0, 0x0b); 152 + mipi_dsi_generic_write_seq(dsi, 0xc1, 0x09); 153 + mipi_dsi_generic_write_seq(dsi, 0xc2, 0xa6); 154 + mipi_dsi_generic_write_seq(dsi, 0xc3, 0x05); 155 + mipi_dsi_generic_write_seq(dsi, 0xc4, 0x00); 156 + mipi_dsi_generic_write_seq(dsi, 0xc5, 0x02); 157 + mipi_dsi_generic_write_seq(dsi, 0xc6, 0x22); 158 + mipi_dsi_generic_write_seq(dsi, 0xc7, 0x03); 159 + mipi_dsi_generic_write_seq(dsi, 0xc8, 0x07, 0x20); 160 + mipi_dsi_generic_write_seq(dsi, 0xc9, 0x03, 0x20); 161 + mipi_dsi_generic_write_seq(dsi, 0xca, 0x01, 0x60); 162 + mipi_dsi_generic_write_seq(dsi, 0xcb, 0x01, 0x60); 163 + mipi_dsi_generic_write_seq(dsi, 0xcc, 0x00, 0x00, 0x02); 164 + mipi_dsi_generic_write_seq(dsi, 0xcd, 0x00, 0x00, 0x02); 165 + mipi_dsi_generic_write_seq(dsi, 0xce, 0x00, 0x00, 0x02); 166 + mipi_dsi_generic_write_seq(dsi, 0xcf, 0x00, 0x00, 0x02); 167 + mipi_dsi_generic_write_seq(dsi, 0xd1, 0x00, 0x05, 0x01, 0x07, 0x10); 168 + mipi_dsi_generic_write_seq(dsi, 0xd2, 0x10, 0x05, 0x05, 0x03, 0x10); 169 + mipi_dsi_generic_write_seq(dsi, 0xd3, 0x20, 0x00, 0x43, 0x07, 0x10); 170 + mipi_dsi_generic_write_seq(dsi, 0xd4, 0x30, 0x00, 0x43, 0x07, 0x10); 171 + mipi_dsi_generic_write_seq(dsi, 0xd0, 172 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); 173 + mipi_dsi_generic_write_seq(dsi, 0xd5, 174 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 175 + 0x00, 0x00, 0x00); 176 + mipi_dsi_generic_write_seq(dsi, 0xd6, 177 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 178 + 0x00, 0x00, 0x00); 179 + mipi_dsi_generic_write_seq(dsi, 0xd7, 180 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 181 + 0x00, 0x00, 0x00); 182 + mipi_dsi_generic_write_seq(dsi, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00); 183 + mipi_dsi_generic_write_seq(dsi, 0xe5, 0x06); 184 + mipi_dsi_generic_write_seq(dsi, 0xe6, 0x06); 185 + mipi_dsi_generic_write_seq(dsi, 0xe7, 0x00); 186 + mipi_dsi_generic_write_seq(dsi, 0xe8, 0x06); 187 + mipi_dsi_generic_write_seq(dsi, 0xe9, 0x06); 188 + mipi_dsi_generic_write_seq(dsi, 0xea, 0x06); 189 + mipi_dsi_generic_write_seq(dsi, 0xeb, 0x00); 190 + mipi_dsi_generic_write_seq(dsi, 0xec, 0x00); 191 + mipi_dsi_generic_write_seq(dsi, 0xed, 0x30); 192 + mipi_dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x06); 193 + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x31, 0x31); 194 + mipi_dsi_generic_write_seq(dsi, 0xb1, 0x31, 0x31); 195 + mipi_dsi_generic_write_seq(dsi, 0xb2, 0x2d, 0x2e); 196 + mipi_dsi_generic_write_seq(dsi, 0xb3, 0x31, 0x34); 197 + mipi_dsi_generic_write_seq(dsi, 0xb4, 0x29, 0x2a); 198 + mipi_dsi_generic_write_seq(dsi, 0xb5, 0x12, 0x10); 199 + mipi_dsi_generic_write_seq(dsi, 0xb6, 0x18, 0x16); 200 + mipi_dsi_generic_write_seq(dsi, 0xb7, 0x00, 0x02); 201 + mipi_dsi_generic_write_seq(dsi, 0xb8, 0x08, 0x31); 202 + mipi_dsi_generic_write_seq(dsi, 0xb9, 0x31, 0x31); 203 + mipi_dsi_generic_write_seq(dsi, 0xba, 0x31, 0x31); 204 + mipi_dsi_generic_write_seq(dsi, 0xbb, 0x31, 0x08); 205 + mipi_dsi_generic_write_seq(dsi, 0xbc, 0x03, 0x01); 206 + mipi_dsi_generic_write_seq(dsi, 0xbd, 0x17, 0x19); 207 + mipi_dsi_generic_write_seq(dsi, 0xbe, 0x11, 0x13); 208 + mipi_dsi_generic_write_seq(dsi, 0xbf, 0x2a, 0x29); 209 + mipi_dsi_generic_write_seq(dsi, 0xc0, 0x34, 0x31); 210 + mipi_dsi_generic_write_seq(dsi, 0xc1, 0x2e, 0x2d); 211 + mipi_dsi_generic_write_seq(dsi, 0xc2, 0x31, 0x31); 212 + mipi_dsi_generic_write_seq(dsi, 0xc3, 0x31, 0x31); 213 + mipi_dsi_generic_write_seq(dsi, 0xc4, 0x31, 0x31); 214 + mipi_dsi_generic_write_seq(dsi, 0xc5, 0x31, 0x31); 215 + mipi_dsi_generic_write_seq(dsi, 0xc6, 0x2e, 0x2d); 216 + mipi_dsi_generic_write_seq(dsi, 0xc7, 0x31, 0x34); 217 + mipi_dsi_generic_write_seq(dsi, 0xc8, 0x29, 0x2a); 218 + mipi_dsi_generic_write_seq(dsi, 0xc9, 0x17, 0x19); 219 + mipi_dsi_generic_write_seq(dsi, 0xca, 0x11, 0x13); 220 + mipi_dsi_generic_write_seq(dsi, 0xcb, 0x03, 0x01); 221 + mipi_dsi_generic_write_seq(dsi, 0xcc, 0x08, 0x31); 222 + mipi_dsi_generic_write_seq(dsi, 0xcd, 0x31, 0x31); 223 + mipi_dsi_generic_write_seq(dsi, 0xce, 0x31, 0x31); 224 + mipi_dsi_generic_write_seq(dsi, 0xcf, 0x31, 0x08); 225 + mipi_dsi_generic_write_seq(dsi, 0xd0, 0x00, 0x02); 226 + mipi_dsi_generic_write_seq(dsi, 0xd1, 0x12, 0x10); 227 + mipi_dsi_generic_write_seq(dsi, 0xd2, 0x18, 0x16); 228 + mipi_dsi_generic_write_seq(dsi, 0xd3, 0x2a, 0x29); 229 + mipi_dsi_generic_write_seq(dsi, 0xd4, 0x34, 0x31); 230 + mipi_dsi_generic_write_seq(dsi, 0xd5, 0x2d, 0x2e); 231 + mipi_dsi_generic_write_seq(dsi, 0xd6, 0x31, 0x31); 232 + mipi_dsi_generic_write_seq(dsi, 0xd7, 0x31, 0x31); 233 + mipi_dsi_generic_write_seq(dsi, 0xe5, 0x31, 0x31); 234 + mipi_dsi_generic_write_seq(dsi, 0xe6, 0x31, 0x31); 235 + mipi_dsi_generic_write_seq(dsi, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00); 236 + mipi_dsi_generic_write_seq(dsi, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x00); 237 + mipi_dsi_generic_write_seq(dsi, 0xe7, 0x00); 238 + mipi_dsi_generic_write_seq(dsi, 0x6f, 0x02); 239 + mipi_dsi_generic_write_seq(dsi, 0xf7, 0x47); 240 + mipi_dsi_generic_write_seq(dsi, 0x6f, 0x0a); 241 + mipi_dsi_generic_write_seq(dsi, 0xf7, 0x02); 242 + mipi_dsi_generic_write_seq(dsi, 0x6f, 0x17); 243 + mipi_dsi_generic_write_seq(dsi, 0xf4, 0x60); 244 + mipi_dsi_generic_write_seq(dsi, 0x6f, 0x01); 245 + mipi_dsi_generic_write_seq(dsi, 0xf9, 0x46); 246 + mipi_dsi_generic_write_seq(dsi, 0x6f, 0x11); 247 + mipi_dsi_generic_write_seq(dsi, 0xf3, 0x01); 248 + mipi_dsi_generic_write_seq(dsi, 0x35, 0x00); 249 + mipi_dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x00); 250 + mipi_dsi_generic_write_seq(dsi, 0xd9, 0x02, 0x03, 0x00); 251 + mipi_dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x00, 0x00); 252 + mipi_dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x08, 0x00); 253 + mipi_dsi_generic_write_seq(dsi, 0xb1, 0x6c, 0x21); 254 + mipi_dsi_generic_write_seq(dsi, 0xf0, 0x55, 0xaa, 0x52, 0x00, 0x00); 255 + mipi_dsi_generic_write_seq(dsi, 0x35, 0x00); 248 256 249 257 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); 250 258 if (ret < 0) { ··· 260 268 } 261 269 usleep_range(1000, 2000); 262 270 263 - dsi_generic_write_seq(dsi, 0x53, 0x24); 271 + mipi_dsi_generic_write_seq(dsi, 0x53, 0x24); 264 272 265 273 return 0; 266 274 }
+358
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + // Copyright (c) 2023, Linaro Limited 3 + 4 + #include <linux/backlight.h> 5 + #include <linux/delay.h> 6 + #include <linux/gpio/consumer.h> 7 + #include <linux/regulator/consumer.h> 8 + #include <linux/module.h> 9 + #include <linux/of.h> 10 + 11 + #include <drm/display/drm_dsc.h> 12 + #include <drm/drm_mipi_dsi.h> 13 + #include <drm/drm_modes.h> 14 + #include <drm/drm_panel.h> 15 + 16 + #include <video/mipi_display.h> 17 + 18 + struct visionox_vtdr6130 { 19 + struct drm_panel panel; 20 + struct mipi_dsi_device *dsi; 21 + struct gpio_desc *reset_gpio; 22 + struct regulator_bulk_data supplies[3]; 23 + bool prepared; 24 + }; 25 + 26 + static inline struct visionox_vtdr6130 *to_visionox_vtdr6130(struct drm_panel *panel) 27 + { 28 + return container_of(panel, struct visionox_vtdr6130, panel); 29 + } 30 + 31 + static void visionox_vtdr6130_reset(struct visionox_vtdr6130 *ctx) 32 + { 33 + gpiod_set_value_cansleep(ctx->reset_gpio, 0); 34 + usleep_range(10000, 11000); 35 + gpiod_set_value_cansleep(ctx->reset_gpio, 1); 36 + usleep_range(10000, 11000); 37 + gpiod_set_value_cansleep(ctx->reset_gpio, 0); 38 + usleep_range(10000, 11000); 39 + } 40 + 41 + static int visionox_vtdr6130_on(struct visionox_vtdr6130 *ctx) 42 + { 43 + struct mipi_dsi_device *dsi = ctx->dsi; 44 + struct device *dev = &dsi->dev; 45 + int ret; 46 + 47 + dsi->mode_flags |= MIPI_DSI_MODE_LPM; 48 + 49 + ret = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK); 50 + if (ret) 51 + return ret; 52 + 53 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x20); 54 + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0x00, 0x00); 55 + mipi_dsi_dcs_write_seq(dsi, 0x59, 0x09); 56 + mipi_dsi_dcs_write_seq(dsi, 0x6c, 0x01); 57 + mipi_dsi_dcs_write_seq(dsi, 0x6d, 0x00); 58 + mipi_dsi_dcs_write_seq(dsi, 0x6f, 0x01); 59 + mipi_dsi_dcs_write_seq(dsi, 0x70, 60 + 0x12, 0x00, 0x00, 0xab, 0x30, 0x80, 0x09, 0x60, 0x04, 61 + 0x38, 0x00, 0x28, 0x02, 0x1c, 0x02, 0x1c, 0x02, 0x00, 62 + 0x02, 0x0e, 0x00, 0x20, 0x03, 0xdd, 0x00, 0x07, 0x00, 63 + 0x0c, 0x02, 0x77, 0x02, 0x8b, 0x18, 0x00, 0x10, 0xf0, 64 + 0x07, 0x10, 0x20, 0x00, 0x06, 0x0f, 0x0f, 0x33, 0x0e, 65 + 0x1c, 0x2a, 0x38, 0x46, 0x54, 0x62, 0x69, 0x70, 0x77, 66 + 0x79, 0x7b, 0x7d, 0x7e, 0x02, 0x02, 0x22, 0x00, 0x2a, 67 + 0x40, 0x2a, 0xbe, 0x3a, 0xfc, 0x3a, 0xfa, 0x3a, 0xf8, 68 + 0x3b, 0x38, 0x3b, 0x78, 0x3b, 0xb6, 0x4b, 0xb6, 0x4b, 69 + 0xf4, 0x4b, 0xf4, 0x6c, 0x34, 0x84, 0x74, 0x00, 0x00, 70 + 0x00, 0x00, 0x00, 0x00); 71 + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xaa, 0x10); 72 + mipi_dsi_dcs_write_seq(dsi, 0xb1, 73 + 0x01, 0x38, 0x00, 0x14, 0x00, 0x1c, 0x00, 0x01, 0x66, 74 + 0x00, 0x14, 0x00, 0x14, 0x00, 0x01, 0x66, 0x00, 0x14, 75 + 0x05, 0xcc, 0x00); 76 + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xaa, 0x13); 77 + mipi_dsi_dcs_write_seq(dsi, 0xce, 78 + 0x09, 0x11, 0x09, 0x11, 0x08, 0xc1, 0x07, 0xfa, 0x05, 79 + 0xa4, 0x00, 0x3c, 0x00, 0x34, 0x00, 0x24, 0x00, 0x0c, 80 + 0x00, 0x0c, 0x04, 0x00, 0x35); 81 + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xaa, 0x14); 82 + mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x03, 0x33); 83 + mipi_dsi_dcs_write_seq(dsi, 0xb4, 84 + 0x00, 0x33, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 85 + 0x3e, 0x00, 0x00); 86 + mipi_dsi_dcs_write_seq(dsi, 0xb5, 87 + 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x06, 0x01); 88 + mipi_dsi_dcs_write_seq(dsi, 0xb9, 0x00, 0x00, 0x08, 0x09, 0x09, 0x09); 89 + mipi_dsi_dcs_write_seq(dsi, 0xbc, 90 + 0x10, 0x00, 0x00, 0x06, 0x11, 0x09, 0x3b, 0x09, 0x47, 91 + 0x09, 0x47, 0x00); 92 + mipi_dsi_dcs_write_seq(dsi, 0xbe, 93 + 0x10, 0x10, 0x00, 0x08, 0x22, 0x09, 0x19, 0x09, 0x25, 94 + 0x09, 0x25, 0x00); 95 + mipi_dsi_dcs_write_seq(dsi, 0xff, 0x5a, 0x80); 96 + mipi_dsi_dcs_write_seq(dsi, 0x65, 0x14); 97 + mipi_dsi_dcs_write_seq(dsi, 0xfa, 0x08, 0x08, 0x08); 98 + mipi_dsi_dcs_write_seq(dsi, 0xff, 0x5a, 0x81); 99 + mipi_dsi_dcs_write_seq(dsi, 0x65, 0x05); 100 + mipi_dsi_dcs_write_seq(dsi, 0xf3, 0x0f); 101 + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xaa, 0x00); 102 + mipi_dsi_dcs_write_seq(dsi, 0xff, 0x5a, 0x82); 103 + mipi_dsi_dcs_write_seq(dsi, 0xf9, 0x00); 104 + mipi_dsi_dcs_write_seq(dsi, 0xff, 0x51, 0x83); 105 + mipi_dsi_dcs_write_seq(dsi, 0x65, 0x04); 106 + mipi_dsi_dcs_write_seq(dsi, 0xf8, 0x00); 107 + mipi_dsi_dcs_write_seq(dsi, 0xff, 0x5a, 0x00); 108 + mipi_dsi_dcs_write_seq(dsi, 0x65, 0x01); 109 + mipi_dsi_dcs_write_seq(dsi, 0xf4, 0x9a); 110 + mipi_dsi_dcs_write_seq(dsi, 0xff, 0x5a, 0x00); 111 + 112 + ret = mipi_dsi_dcs_exit_sleep_mode(dsi); 113 + if (ret < 0) { 114 + dev_err(dev, "Failed to exit sleep mode: %d\n", ret); 115 + return ret; 116 + } 117 + msleep(120); 118 + 119 + ret = mipi_dsi_dcs_set_display_on(dsi); 120 + if (ret < 0) { 121 + dev_err(dev, "Failed to set display on: %d\n", ret); 122 + return ret; 123 + } 124 + msleep(20); 125 + 126 + return 0; 127 + } 128 + 129 + static int visionox_vtdr6130_off(struct visionox_vtdr6130 *ctx) 130 + { 131 + struct mipi_dsi_device *dsi = ctx->dsi; 132 + struct device *dev = &dsi->dev; 133 + int ret; 134 + 135 + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; 136 + 137 + ret = mipi_dsi_dcs_set_display_off(dsi); 138 + if (ret < 0) { 139 + dev_err(dev, "Failed to set display off: %d\n", ret); 140 + return ret; 141 + } 142 + msleep(20); 143 + 144 + ret = mipi_dsi_dcs_enter_sleep_mode(dsi); 145 + if (ret < 0) { 146 + dev_err(dev, "Failed to enter sleep mode: %d\n", ret); 147 + return ret; 148 + } 149 + msleep(120); 150 + 151 + return 0; 152 + } 153 + 154 + static int visionox_vtdr6130_prepare(struct drm_panel *panel) 155 + { 156 + struct visionox_vtdr6130 *ctx = to_visionox_vtdr6130(panel); 157 + struct device *dev = &ctx->dsi->dev; 158 + int ret; 159 + 160 + if (ctx->prepared) 161 + return 0; 162 + 163 + ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), 164 + ctx->supplies); 165 + if (ret < 0) 166 + return ret; 167 + 168 + visionox_vtdr6130_reset(ctx); 169 + 170 + ret = visionox_vtdr6130_on(ctx); 171 + if (ret < 0) { 172 + dev_err(dev, "Failed to initialize panel: %d\n", ret); 173 + gpiod_set_value_cansleep(ctx->reset_gpio, 1); 174 + regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); 175 + return ret; 176 + } 177 + 178 + ctx->prepared = true; 179 + return 0; 180 + } 181 + 182 + static int visionox_vtdr6130_unprepare(struct drm_panel *panel) 183 + { 184 + struct visionox_vtdr6130 *ctx = to_visionox_vtdr6130(panel); 185 + struct device *dev = &ctx->dsi->dev; 186 + int ret; 187 + 188 + if (!ctx->prepared) 189 + return 0; 190 + 191 + ret = visionox_vtdr6130_off(ctx); 192 + if (ret < 0) 193 + dev_err(dev, "Failed to un-initialize panel: %d\n", ret); 194 + 195 + gpiod_set_value_cansleep(ctx->reset_gpio, 1); 196 + 197 + regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); 198 + 199 + ctx->prepared = false; 200 + return 0; 201 + } 202 + 203 + static const struct drm_display_mode visionox_vtdr6130_mode = { 204 + .clock = (1080 + 20 + 2 + 20) * (2400 + 20 + 2 + 18) * 144 / 1000, 205 + .hdisplay = 1080, 206 + .hsync_start = 1080 + 20, 207 + .hsync_end = 1080 + 20 + 2, 208 + .htotal = 1080 + 20 + 2 + 20, 209 + .vdisplay = 2400, 210 + .vsync_start = 2400 + 20, 211 + .vsync_end = 2400 + 20 + 2, 212 + .vtotal = 2400 + 20 + 2 + 18, 213 + .width_mm = 71, 214 + .height_mm = 157, 215 + }; 216 + 217 + static int visionox_vtdr6130_get_modes(struct drm_panel *panel, 218 + struct drm_connector *connector) 219 + { 220 + struct drm_display_mode *mode; 221 + 222 + mode = drm_mode_duplicate(connector->dev, &visionox_vtdr6130_mode); 223 + if (!mode) 224 + return -ENOMEM; 225 + 226 + drm_mode_set_name(mode); 227 + 228 + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; 229 + connector->display_info.width_mm = mode->width_mm; 230 + connector->display_info.height_mm = mode->height_mm; 231 + drm_mode_probed_add(connector, mode); 232 + 233 + return 1; 234 + } 235 + 236 + static const struct drm_panel_funcs visionox_vtdr6130_panel_funcs = { 237 + .prepare = visionox_vtdr6130_prepare, 238 + .unprepare = visionox_vtdr6130_unprepare, 239 + .get_modes = visionox_vtdr6130_get_modes, 240 + }; 241 + 242 + static int visionox_vtdr6130_bl_update_status(struct backlight_device *bl) 243 + { 244 + struct mipi_dsi_device *dsi = bl_get_data(bl); 245 + u16 brightness = backlight_get_brightness(bl); 246 + /* Panel needs big-endian order of brightness value */ 247 + u8 payload[2] = { brightness >> 8, brightness & 0xff }; 248 + int ret; 249 + 250 + ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 251 + payload, sizeof(payload)); 252 + if (ret < 0) 253 + return ret; 254 + 255 + return 0; 256 + } 257 + 258 + static const struct backlight_ops visionox_vtdr6130_bl_ops = { 259 + .update_status = visionox_vtdr6130_bl_update_status, 260 + }; 261 + 262 + static struct backlight_device * 263 + visionox_vtdr6130_create_backlight(struct mipi_dsi_device *dsi) 264 + { 265 + struct device *dev = &dsi->dev; 266 + const struct backlight_properties props = { 267 + .type = BACKLIGHT_RAW, 268 + .brightness = 4095, 269 + .max_brightness = 4095, 270 + }; 271 + 272 + return devm_backlight_device_register(dev, dev_name(dev), dev, dsi, 273 + &visionox_vtdr6130_bl_ops, &props); 274 + } 275 + 276 + static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi) 277 + { 278 + struct device *dev = &dsi->dev; 279 + struct visionox_vtdr6130 *ctx; 280 + int ret; 281 + 282 + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); 283 + if (!ctx) 284 + return -ENOMEM; 285 + 286 + ctx->supplies[0].supply = "vddio"; 287 + ctx->supplies[1].supply = "vci"; 288 + ctx->supplies[2].supply = "vdd"; 289 + 290 + ret = devm_regulator_bulk_get(&dsi->dev, ARRAY_SIZE(ctx->supplies), 291 + ctx->supplies); 292 + if (ret < 0) 293 + return ret; 294 + 295 + ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); 296 + if (IS_ERR(ctx->reset_gpio)) 297 + return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), 298 + "Failed to get reset-gpios\n"); 299 + 300 + ctx->dsi = dsi; 301 + mipi_dsi_set_drvdata(dsi, ctx); 302 + 303 + dsi->lanes = 4; 304 + dsi->format = MIPI_DSI_FMT_RGB888; 305 + dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_NO_EOT_PACKET | 306 + MIPI_DSI_CLOCK_NON_CONTINUOUS; 307 + 308 + drm_panel_init(&ctx->panel, dev, &visionox_vtdr6130_panel_funcs, 309 + DRM_MODE_CONNECTOR_DSI); 310 + 311 + ctx->panel.backlight = visionox_vtdr6130_create_backlight(dsi); 312 + if (IS_ERR(ctx->panel.backlight)) 313 + return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight), 314 + "Failed to create backlight\n"); 315 + 316 + drm_panel_add(&ctx->panel); 317 + 318 + ret = mipi_dsi_attach(dsi); 319 + if (ret < 0) { 320 + dev_err(dev, "Failed to attach to DSI host: %d\n", ret); 321 + drm_panel_remove(&ctx->panel); 322 + return ret; 323 + } 324 + 325 + return 0; 326 + } 327 + 328 + static void visionox_vtdr6130_remove(struct mipi_dsi_device *dsi) 329 + { 330 + struct visionox_vtdr6130 *ctx = mipi_dsi_get_drvdata(dsi); 331 + int ret; 332 + 333 + ret = mipi_dsi_detach(dsi); 334 + if (ret < 0) 335 + dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); 336 + 337 + drm_panel_remove(&ctx->panel); 338 + } 339 + 340 + static const struct of_device_id visionox_vtdr6130_of_match[] = { 341 + { .compatible = "visionox,vtdr6130" }, 342 + { /* sentinel */ } 343 + }; 344 + MODULE_DEVICE_TABLE(of, visionox_vtdr6130_of_match); 345 + 346 + static struct mipi_dsi_driver visionox_vtdr6130_driver = { 347 + .probe = visionox_vtdr6130_probe, 348 + .remove = visionox_vtdr6130_remove, 349 + .driver = { 350 + .name = "panel-visionox-vtdr6130", 351 + .of_match_table = visionox_vtdr6130_of_match, 352 + }, 353 + }; 354 + module_mipi_dsi_driver(visionox_vtdr6130_driver); 355 + 356 + MODULE_AUTHOR("Neil Armstrong <neil.armstrong@linaro.org>"); 357 + MODULE_DESCRIPTION("Panel driver for the Visionox VTDR6130 AMOLED DSI panel"); 358 + MODULE_LICENSE("GPL");
+52 -60
drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c
··· 60 60 return container_of(panel, struct xpp055c272, panel); 61 61 } 62 62 63 - #define dsi_generic_write_seq(dsi, cmd, seq...) do { \ 64 - static const u8 b[] = { cmd, seq }; \ 65 - int ret; \ 66 - ret = mipi_dsi_dcs_write_buffer(dsi, b, ARRAY_SIZE(b)); \ 67 - if (ret < 0) \ 68 - return ret; \ 69 - } while (0) 70 - 71 63 static int xpp055c272_init_sequence(struct xpp055c272 *ctx) 72 64 { 73 65 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); ··· 69 77 * Init sequence was supplied by the panel vendor without much 70 78 * documentation. 71 79 */ 72 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETEXTC, 0xf1, 0x12, 0x83); 73 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETMIPI, 74 - 0x33, 0x81, 0x05, 0xf9, 0x0e, 0x0e, 0x00, 0x00, 75 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x25, 76 - 0x00, 0x91, 0x0a, 0x00, 0x00, 0x02, 0x4f, 0x01, 77 - 0x00, 0x00, 0x37); 78 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETPOWER_EXT, 0x25); 79 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETPCR, 0x02, 0x11, 0x00); 80 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETRGBIF, 81 - 0x0c, 0x10, 0x0a, 0x50, 0x03, 0xff, 0x00, 0x00, 82 - 0x00, 0x00); 83 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETSCR, 84 - 0x73, 0x73, 0x50, 0x50, 0x00, 0x00, 0x08, 0x70, 85 - 0x00); 86 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETVDC, 0x46); 87 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETPANEL, 0x0b); 88 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETCYC, 0x80); 89 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETDISP, 0xc8, 0x12, 0x30); 90 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETEQ, 91 - 0x07, 0x07, 0x0B, 0x0B, 0x03, 0x0B, 0x00, 0x00, 92 - 0x00, 0x00, 0xFF, 0x00, 0xC0, 0x10); 93 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETPOWER, 94 - 0x53, 0x00, 0x1e, 0x1e, 0x77, 0xe1, 0xcc, 0xdd, 95 - 0x67, 0x77, 0x33, 0x33); 96 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETECO, 0x00, 0x00, 0xff, 97 - 0xff, 0x01, 0xff); 98 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETBGP, 0x09, 0x09); 80 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETEXTC, 0xf1, 0x12, 0x83); 81 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETMIPI, 82 + 0x33, 0x81, 0x05, 0xf9, 0x0e, 0x0e, 0x00, 0x00, 83 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x25, 84 + 0x00, 0x91, 0x0a, 0x00, 0x00, 0x02, 0x4f, 0x01, 85 + 0x00, 0x00, 0x37); 86 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETPOWER_EXT, 0x25); 87 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETPCR, 0x02, 0x11, 0x00); 88 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETRGBIF, 89 + 0x0c, 0x10, 0x0a, 0x50, 0x03, 0xff, 0x00, 0x00, 90 + 0x00, 0x00); 91 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETSCR, 92 + 0x73, 0x73, 0x50, 0x50, 0x00, 0x00, 0x08, 0x70, 93 + 0x00); 94 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETVDC, 0x46); 95 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETPANEL, 0x0b); 96 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETCYC, 0x80); 97 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETDISP, 0xc8, 0x12, 0x30); 98 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETEQ, 99 + 0x07, 0x07, 0x0B, 0x0B, 0x03, 0x0B, 0x00, 0x00, 100 + 0x00, 0x00, 0xFF, 0x00, 0xC0, 0x10); 101 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETPOWER, 102 + 0x53, 0x00, 0x1e, 0x1e, 0x77, 0xe1, 0xcc, 0xdd, 103 + 0x67, 0x77, 0x33, 0x33); 104 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETECO, 0x00, 0x00, 0xff, 105 + 0xff, 0x01, 0xff); 106 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETBGP, 0x09, 0x09); 99 107 msleep(20); 100 108 101 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETVCOM, 0x87, 0x95); 102 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETGIP1, 103 - 0xc2, 0x10, 0x05, 0x05, 0x10, 0x05, 0xa0, 0x12, 104 - 0x31, 0x23, 0x3f, 0x81, 0x0a, 0xa0, 0x37, 0x18, 105 - 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 106 - 0x01, 0x00, 0x00, 0x00, 0x48, 0xf8, 0x86, 0x42, 107 - 0x08, 0x88, 0x88, 0x80, 0x88, 0x88, 0x88, 0x58, 108 - 0xf8, 0x87, 0x53, 0x18, 0x88, 0x88, 0x81, 0x88, 109 - 0x88, 0x88, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 110 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); 111 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETGIP2, 112 - 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 113 - 0x00, 0x00, 0x00, 0x00, 0x1f, 0x88, 0x81, 0x35, 114 - 0x78, 0x88, 0x88, 0x85, 0x88, 0x88, 0x88, 0x0f, 115 - 0x88, 0x80, 0x24, 0x68, 0x88, 0x88, 0x84, 0x88, 116 - 0x88, 0x88, 0x23, 0x10, 0x00, 0x00, 0x1c, 0x00, 117 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 118 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x05, 119 - 0xa0, 0x00, 0x00, 0x00, 0x00); 120 - dsi_generic_write_seq(dsi, XPP055C272_CMD_SETGAMMA, 121 - 0x00, 0x06, 0x08, 0x2a, 0x31, 0x3f, 0x38, 0x36, 122 - 0x07, 0x0c, 0x0d, 0x11, 0x13, 0x12, 0x13, 0x11, 123 - 0x18, 0x00, 0x06, 0x08, 0x2a, 0x31, 0x3f, 0x38, 124 - 0x36, 0x07, 0x0c, 0x0d, 0x11, 0x13, 0x12, 0x13, 125 - 0x11, 0x18); 109 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETVCOM, 0x87, 0x95); 110 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETGIP1, 111 + 0xc2, 0x10, 0x05, 0x05, 0x10, 0x05, 0xa0, 0x12, 112 + 0x31, 0x23, 0x3f, 0x81, 0x0a, 0xa0, 0x37, 0x18, 113 + 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 114 + 0x01, 0x00, 0x00, 0x00, 0x48, 0xf8, 0x86, 0x42, 115 + 0x08, 0x88, 0x88, 0x80, 0x88, 0x88, 0x88, 0x58, 116 + 0xf8, 0x87, 0x53, 0x18, 0x88, 0x88, 0x81, 0x88, 117 + 0x88, 0x88, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 118 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); 119 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETGIP2, 120 + 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 121 + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x88, 0x81, 0x35, 122 + 0x78, 0x88, 0x88, 0x85, 0x88, 0x88, 0x88, 0x0f, 123 + 0x88, 0x80, 0x24, 0x68, 0x88, 0x88, 0x84, 0x88, 124 + 0x88, 0x88, 0x23, 0x10, 0x00, 0x00, 0x1c, 0x00, 125 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 126 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x05, 127 + 0xa0, 0x00, 0x00, 0x00, 0x00); 128 + mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETGAMMA, 129 + 0x00, 0x06, 0x08, 0x2a, 0x31, 0x3f, 0x38, 0x36, 130 + 0x07, 0x0c, 0x0d, 0x11, 0x13, 0x12, 0x13, 0x11, 131 + 0x18, 0x00, 0x06, 0x08, 0x2a, 0x31, 0x3f, 0x38, 132 + 0x36, 0x07, 0x0c, 0x0d, 0x11, 0x13, 0x12, 0x13, 133 + 0x11, 0x18); 126 134 127 135 msleep(60); 128 136
+2
drivers/gpu/drm/radeon/Kconfig
··· 15 15 select HWMON 16 16 select BACKLIGHT_CLASS_DEVICE 17 17 select INTERVAL_TREE 18 + select I2C 19 + select I2C_ALGOBIT 18 20 # radeon depends on ACPI_VIDEO when ACPI is enabled, for select to work 19 21 # ACPI_VIDEO's dependencies must also be selected. 20 22 select INPUT if ACPI
+368 -16
drivers/gpu/drm/tests/drm_format_helper_test.c
··· 32 32 const u16 expected_swab[TEST_BUF_SIZE]; 33 33 }; 34 34 35 + struct convert_to_xrgb1555_result { 36 + unsigned int dst_pitch; 37 + const u16 expected[TEST_BUF_SIZE]; 38 + }; 39 + 40 + struct convert_to_argb1555_result { 41 + unsigned int dst_pitch; 42 + const u16 expected[TEST_BUF_SIZE]; 43 + }; 44 + 45 + struct convert_to_rgba5551_result { 46 + unsigned int dst_pitch; 47 + const u16 expected[TEST_BUF_SIZE]; 48 + }; 49 + 35 50 struct convert_to_rgb888_result { 36 51 unsigned int dst_pitch; 37 52 const u8 expected[TEST_BUF_SIZE]; 38 53 }; 39 54 55 + struct convert_to_argb8888_result { 56 + unsigned int dst_pitch; 57 + const u32 expected[TEST_BUF_SIZE]; 58 + }; 59 + 40 60 struct convert_to_xrgb2101010_result { 61 + unsigned int dst_pitch; 62 + const u32 expected[TEST_BUF_SIZE]; 63 + }; 64 + 65 + struct convert_to_argb2101010_result { 41 66 unsigned int dst_pitch; 42 67 const u32 expected[TEST_BUF_SIZE]; 43 68 }; ··· 75 50 struct convert_to_gray8_result gray8_result; 76 51 struct convert_to_rgb332_result rgb332_result; 77 52 struct convert_to_rgb565_result rgb565_result; 53 + struct convert_to_xrgb1555_result xrgb1555_result; 54 + struct convert_to_argb1555_result argb1555_result; 55 + struct convert_to_rgba5551_result rgba5551_result; 78 56 struct convert_to_rgb888_result rgb888_result; 57 + struct convert_to_argb8888_result argb8888_result; 79 58 struct convert_to_xrgb2101010_result xrgb2101010_result; 59 + struct convert_to_argb2101010_result argb2101010_result; 80 60 }; 81 61 82 62 static struct convert_xrgb8888_case convert_xrgb8888_cases[] = { ··· 103 73 .expected = { 0xF800 }, 104 74 .expected_swab = { 0x00F8 }, 105 75 }, 76 + .xrgb1555_result = { 77 + .dst_pitch = 0, 78 + .expected = { 0x7C00 }, 79 + }, 80 + .argb1555_result = { 81 + .dst_pitch = 0, 82 + .expected = { 0xFC00 }, 83 + }, 84 + .rgba5551_result = { 85 + .dst_pitch = 0, 86 + .expected = { 0xF801 }, 87 + }, 106 88 .rgb888_result = { 107 89 .dst_pitch = 0, 108 90 .expected = { 0x00, 0x00, 0xFF }, 109 91 }, 92 + .argb8888_result = { 93 + .dst_pitch = 0, 94 + .expected = { 0xFFFF0000 }, 95 + }, 110 96 .xrgb2101010_result = { 111 97 .dst_pitch = 0, 112 98 .expected = { 0x3FF00000 }, 99 + }, 100 + .argb2101010_result = { 101 + .dst_pitch = 0, 102 + .expected = { 0xFFF00000 }, 113 103 }, 114 104 }, 115 105 { ··· 153 103 .expected = { 0xF800 }, 154 104 .expected_swab = { 0x00F8 }, 155 105 }, 106 + .xrgb1555_result = { 107 + .dst_pitch = 0, 108 + .expected = { 0x7C00 }, 109 + }, 110 + .argb1555_result = { 111 + .dst_pitch = 0, 112 + .expected = { 0xFC00 }, 113 + }, 114 + .rgba5551_result = { 115 + .dst_pitch = 0, 116 + .expected = { 0xF801 }, 117 + }, 156 118 .rgb888_result = { 157 119 .dst_pitch = 0, 158 120 .expected = { 0x00, 0x00, 0xFF }, 159 121 }, 122 + .argb8888_result = { 123 + .dst_pitch = 0, 124 + .expected = { 0xFFFF0000 }, 125 + }, 160 126 .xrgb2101010_result = { 161 127 .dst_pitch = 0, 162 128 .expected = { 0x3FF00000 }, 129 + }, 130 + .argb2101010_result = { 131 + .dst_pitch = 0, 132 + .expected = { 0xFFF00000 }, 163 133 }, 164 134 }, 165 135 { ··· 230 160 0xE0FF, 0xFF07, 231 161 }, 232 162 }, 163 + .xrgb1555_result = { 164 + .dst_pitch = 0, 165 + .expected = { 166 + 0x7FFF, 0x0000, 167 + 0x7C00, 0x03E0, 168 + 0x001F, 0x7C1F, 169 + 0x7FE0, 0x03FF, 170 + }, 171 + }, 172 + .argb1555_result = { 173 + .dst_pitch = 0, 174 + .expected = { 175 + 0xFFFF, 0x8000, 176 + 0xFC00, 0x83E0, 177 + 0x801F, 0xFC1F, 178 + 0xFFE0, 0x83FF, 179 + }, 180 + }, 181 + .rgba5551_result = { 182 + .dst_pitch = 0, 183 + .expected = { 184 + 0xFFFF, 0x0001, 185 + 0xF801, 0x07C1, 186 + 0x003F, 0xF83F, 187 + 0xFFC1, 0x07FF, 188 + }, 189 + }, 233 190 .rgb888_result = { 234 191 .dst_pitch = 0, 235 192 .expected = { ··· 266 169 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 267 170 }, 268 171 }, 172 + .argb8888_result = { 173 + .dst_pitch = 0, 174 + .expected = { 175 + 0xFFFFFFFF, 0xFF000000, 176 + 0xFFFF0000, 0xFF00FF00, 177 + 0xFF0000FF, 0xFFFF00FF, 178 + 0xFFFFFF00, 0xFF00FFFF, 179 + }, 180 + }, 269 181 .xrgb2101010_result = { 270 182 .dst_pitch = 0, 271 183 .expected = { ··· 282 176 0x3FF00000, 0x000FFC00, 283 177 0x000003FF, 0x3FF003FF, 284 178 0x3FFFFC00, 0x000FFFFF, 179 + }, 180 + }, 181 + .argb2101010_result = { 182 + .dst_pitch = 0, 183 + .expected = { 184 + 0xFFFFFFFF, 0xC0000000, 185 + 0xFFF00000, 0xC00FFC00, 186 + 0xC00003FF, 0xFFF003FF, 187 + 0xFFFFFC00, 0xC00FFFFF, 285 188 }, 286 189 }, 287 190 }, ··· 333 218 0x00A8, 0x8E6B, 0x330A, 0x0000, 0x0000, 334 219 }, 335 220 }, 221 + .xrgb1555_result = { 222 + .dst_pitch = 10, 223 + .expected = { 224 + 0x0513, 0x0920, 0x5400, 0x0000, 0x0000, 225 + 0x35CE, 0x0513, 0x0920, 0x0000, 0x0000, 226 + 0x5400, 0x35CE, 0x0513, 0x0000, 0x0000, 227 + }, 228 + }, 229 + .argb1555_result = { 230 + .dst_pitch = 10, 231 + .expected = { 232 + 0x8513, 0x8920, 0xD400, 0x0000, 0x0000, 233 + 0xB5CE, 0x8513, 0x8920, 0x0000, 0x0000, 234 + 0xD400, 0xB5CE, 0x8513, 0x0000, 0x0000, 235 + }, 236 + }, 237 + .rgba5551_result = { 238 + .dst_pitch = 10, 239 + .expected = { 240 + 0x0A27, 0x1241, 0xA801, 0x0000, 0x0000, 241 + 0x6B9D, 0x0A27, 0x1241, 0x0000, 0x0000, 242 + 0xA801, 0x6B9D, 0x0A27, 0x0000, 0x0000, 243 + }, 244 + }, 336 245 .rgb888_result = { 337 246 .dst_pitch = 15, 338 247 .expected = { ··· 368 229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 369 230 }, 370 231 }, 232 + .argb8888_result = { 233 + .dst_pitch = 20, 234 + .expected = { 235 + 0xFF0E449C, 0xFF114D05, 0xFFA80303, 0x00000000, 0x00000000, 236 + 0xFF6C7073, 0xFF0E449C, 0xFF114D05, 0x00000000, 0x00000000, 237 + 0xFFA80303, 0xFF6C7073, 0xFF0E449C, 0x00000000, 0x00000000, 238 + }, 239 + }, 371 240 .xrgb2101010_result = { 372 241 .dst_pitch = 20, 373 242 .expected = { 374 243 0x03844672, 0x0444D414, 0x2A20300C, 0x00000000, 0x00000000, 375 244 0x1B1705CD, 0x03844672, 0x0444D414, 0x00000000, 0x00000000, 376 245 0x2A20300C, 0x1B1705CD, 0x03844672, 0x00000000, 0x00000000, 246 + }, 247 + }, 248 + .argb2101010_result = { 249 + .dst_pitch = 20, 250 + .expected = { 251 + 0xC3844672, 0xC444D414, 0xEA20300C, 0x00000000, 0x00000000, 252 + 0xDB1705CD, 0xC3844672, 0xC444D414, 0x00000000, 0x00000000, 253 + 0xEA20300C, 0xDB1705CD, 0xC3844672, 0x00000000, 0x00000000, 377 254 }, 378 255 }, 379 256 }, ··· 419 264 return dst_pitch * drm_rect_height(clip); 420 265 } 421 266 422 - static u32 *le32buf_to_cpu(struct kunit *test, const u32 *buf, size_t buf_size) 267 + static u16 *le16buf_to_cpu(struct kunit *test, const __le16 *buf, size_t buf_size) 268 + { 269 + u16 *dst = NULL; 270 + int n; 271 + 272 + dst = kunit_kzalloc(test, sizeof(*dst) * buf_size, GFP_KERNEL); 273 + if (!dst) 274 + return NULL; 275 + 276 + for (n = 0; n < buf_size; n++) 277 + dst[n] = le16_to_cpu(buf[n]); 278 + 279 + return dst; 280 + } 281 + 282 + static u32 *le32buf_to_cpu(struct kunit *test, const __le32 *buf, size_t buf_size) 423 283 { 424 284 u32 *dst = NULL; 425 285 int n; ··· 445 275 446 276 for (n = 0; n < buf_size; n++) 447 277 dst[n] = le32_to_cpu((__force __le32)buf[n]); 278 + 279 + return dst; 280 + } 281 + 282 + static __le32 *cpubuf_to_le32(struct kunit *test, const u32 *buf, size_t buf_size) 283 + { 284 + __le32 *dst = NULL; 285 + int n; 286 + 287 + dst = kunit_kzalloc(test, sizeof(*dst) * buf_size, GFP_KERNEL); 288 + if (!dst) 289 + return NULL; 290 + 291 + for (n = 0; n < buf_size; n++) 292 + dst[n] = cpu_to_le32(buf[n]); 448 293 449 294 return dst; 450 295 } ··· 478 293 const struct convert_xrgb8888_case *params = test->param_value; 479 294 const struct convert_to_gray8_result *result = &params->gray8_result; 480 295 size_t dst_size; 481 - __u8 *buf = NULL; 482 - __u32 *xrgb8888 = NULL; 296 + u8 *buf = NULL; 297 + __le32 *xrgb8888 = NULL; 483 298 struct iosys_map dst, src; 484 299 485 300 struct drm_framebuffer fb = { ··· 495 310 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf); 496 311 iosys_map_set_vaddr(&dst, buf); 497 312 498 - xrgb8888 = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE); 313 + xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE); 499 314 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888); 500 315 iosys_map_set_vaddr(&src, xrgb8888); 501 316 ··· 508 323 const struct convert_xrgb8888_case *params = test->param_value; 509 324 const struct convert_to_rgb332_result *result = &params->rgb332_result; 510 325 size_t dst_size; 511 - __u8 *buf = NULL; 512 - __u32 *xrgb8888 = NULL; 326 + u8 *buf = NULL; 327 + __le32 *xrgb8888 = NULL; 513 328 struct iosys_map dst, src; 514 329 515 330 struct drm_framebuffer fb = { ··· 525 340 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf); 526 341 iosys_map_set_vaddr(&dst, buf); 527 342 528 - xrgb8888 = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE); 343 + xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE); 529 344 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888); 530 345 iosys_map_set_vaddr(&src, xrgb8888); 531 346 ··· 538 353 const struct convert_xrgb8888_case *params = test->param_value; 539 354 const struct convert_to_rgb565_result *result = &params->rgb565_result; 540 355 size_t dst_size; 541 - __u16 *buf = NULL; 542 - __u32 *xrgb8888 = NULL; 356 + u16 *buf = NULL; 357 + __le32 *xrgb8888 = NULL; 543 358 struct iosys_map dst, src; 544 359 545 360 struct drm_framebuffer fb = { ··· 555 370 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf); 556 371 iosys_map_set_vaddr(&dst, buf); 557 372 558 - xrgb8888 = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE); 373 + xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE); 559 374 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888); 560 375 iosys_map_set_vaddr(&src, xrgb8888); 561 376 562 377 drm_fb_xrgb8888_to_rgb565(&dst, &result->dst_pitch, &src, &fb, &params->clip, false); 378 + buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16)); 563 379 KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size); 564 380 381 + buf = dst.vaddr; /* restore original value of buf */ 565 382 drm_fb_xrgb8888_to_rgb565(&dst, &result->dst_pitch, &src, &fb, &params->clip, true); 383 + buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16)); 566 384 KUNIT_EXPECT_MEMEQ(test, buf, result->expected_swab, dst_size); 385 + } 386 + 387 + static void drm_test_fb_xrgb8888_to_xrgb1555(struct kunit *test) 388 + { 389 + const struct convert_xrgb8888_case *params = test->param_value; 390 + const struct convert_to_xrgb1555_result *result = &params->xrgb1555_result; 391 + size_t dst_size; 392 + u16 *buf = NULL; 393 + __le32 *xrgb8888 = NULL; 394 + struct iosys_map dst, src; 395 + 396 + struct drm_framebuffer fb = { 397 + .format = drm_format_info(DRM_FORMAT_XRGB8888), 398 + .pitches = { params->pitch, 0, 0 }, 399 + }; 400 + 401 + dst_size = conversion_buf_size(DRM_FORMAT_XRGB1555, result->dst_pitch, 402 + &params->clip); 403 + KUNIT_ASSERT_GT(test, dst_size, 0); 404 + 405 + buf = kunit_kzalloc(test, dst_size, GFP_KERNEL); 406 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf); 407 + iosys_map_set_vaddr(&dst, buf); 408 + 409 + xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE); 410 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888); 411 + iosys_map_set_vaddr(&src, xrgb8888); 412 + 413 + drm_fb_xrgb8888_to_xrgb1555(&dst, &result->dst_pitch, &src, &fb, &params->clip); 414 + buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16)); 415 + KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0); 416 + } 417 + 418 + static void drm_test_fb_xrgb8888_to_argb1555(struct kunit *test) 419 + { 420 + const struct convert_xrgb8888_case *params = test->param_value; 421 + const struct convert_to_argb1555_result *result = &params->argb1555_result; 422 + size_t dst_size; 423 + u16 *buf = NULL; 424 + __le32 *xrgb8888 = NULL; 425 + struct iosys_map dst, src; 426 + 427 + struct drm_framebuffer fb = { 428 + .format = drm_format_info(DRM_FORMAT_XRGB8888), 429 + .pitches = { params->pitch, 0, 0 }, 430 + }; 431 + 432 + dst_size = conversion_buf_size(DRM_FORMAT_ARGB1555, result->dst_pitch, 433 + &params->clip); 434 + KUNIT_ASSERT_GT(test, dst_size, 0); 435 + 436 + buf = kunit_kzalloc(test, dst_size, GFP_KERNEL); 437 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf); 438 + iosys_map_set_vaddr(&dst, buf); 439 + 440 + xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE); 441 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888); 442 + iosys_map_set_vaddr(&src, xrgb8888); 443 + 444 + drm_fb_xrgb8888_to_argb1555(&dst, &result->dst_pitch, &src, &fb, &params->clip); 445 + buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16)); 446 + KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0); 447 + } 448 + 449 + static void drm_test_fb_xrgb8888_to_rgba5551(struct kunit *test) 450 + { 451 + const struct convert_xrgb8888_case *params = test->param_value; 452 + const struct convert_to_rgba5551_result *result = &params->rgba5551_result; 453 + size_t dst_size; 454 + u16 *buf = NULL; 455 + __le32 *xrgb8888 = NULL; 456 + struct iosys_map dst, src; 457 + 458 + struct drm_framebuffer fb = { 459 + .format = drm_format_info(DRM_FORMAT_XRGB8888), 460 + .pitches = { params->pitch, 0, 0 }, 461 + }; 462 + 463 + dst_size = conversion_buf_size(DRM_FORMAT_RGBA5551, result->dst_pitch, 464 + &params->clip); 465 + KUNIT_ASSERT_GT(test, dst_size, 0); 466 + 467 + buf = kunit_kzalloc(test, dst_size, GFP_KERNEL); 468 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf); 469 + iosys_map_set_vaddr(&dst, buf); 470 + 471 + xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE); 472 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888); 473 + iosys_map_set_vaddr(&src, xrgb8888); 474 + 475 + drm_fb_xrgb8888_to_rgba5551(&dst, &result->dst_pitch, &src, &fb, &params->clip); 476 + buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16)); 477 + KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0); 567 478 } 568 479 569 480 static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test) ··· 667 386 const struct convert_xrgb8888_case *params = test->param_value; 668 387 const struct convert_to_rgb888_result *result = &params->rgb888_result; 669 388 size_t dst_size; 670 - __u8 *buf = NULL; 671 - __u32 *xrgb8888 = NULL; 389 + u8 *buf = NULL; 390 + __le32 *xrgb8888 = NULL; 672 391 struct iosys_map dst, src; 673 392 674 393 struct drm_framebuffer fb = { ··· 684 403 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf); 685 404 iosys_map_set_vaddr(&dst, buf); 686 405 687 - xrgb8888 = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE); 406 + xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE); 688 407 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888); 689 408 iosys_map_set_vaddr(&src, xrgb8888); 690 409 410 + /* 411 + * RGB888 expected results are already in little-endian 412 + * order, so there's no need to convert the test output. 413 + */ 691 414 drm_fb_xrgb8888_to_rgb888(&dst, &result->dst_pitch, &src, &fb, &params->clip); 692 415 KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size); 416 + } 417 + 418 + static void drm_test_fb_xrgb8888_to_argb8888(struct kunit *test) 419 + { 420 + const struct convert_xrgb8888_case *params = test->param_value; 421 + const struct convert_to_argb8888_result *result = &params->argb8888_result; 422 + size_t dst_size; 423 + u32 *buf = NULL; 424 + __le32 *xrgb8888 = NULL; 425 + struct iosys_map dst, src; 426 + 427 + struct drm_framebuffer fb = { 428 + .format = drm_format_info(DRM_FORMAT_XRGB8888), 429 + .pitches = { params->pitch, 0, 0 }, 430 + }; 431 + 432 + dst_size = conversion_buf_size(DRM_FORMAT_ARGB8888, 433 + result->dst_pitch, &params->clip); 434 + KUNIT_ASSERT_GT(test, dst_size, 0); 435 + 436 + buf = kunit_kzalloc(test, dst_size, GFP_KERNEL); 437 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf); 438 + iosys_map_set_vaddr(&dst, buf); 439 + 440 + xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE); 441 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888); 442 + iosys_map_set_vaddr(&src, xrgb8888); 443 + 444 + drm_fb_xrgb8888_to_argb8888(&dst, &result->dst_pitch, &src, &fb, &params->clip); 445 + buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32)); 446 + KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0); 693 447 } 694 448 695 449 static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) ··· 732 416 const struct convert_xrgb8888_case *params = test->param_value; 733 417 const struct convert_to_xrgb2101010_result *result = &params->xrgb2101010_result; 734 418 size_t dst_size; 735 - __u32 *buf = NULL; 736 - __u32 *xrgb8888 = NULL; 419 + u32 *buf = NULL; 420 + __le32 *xrgb8888 = NULL; 737 421 struct iosys_map dst, src; 738 422 739 423 struct drm_framebuffer fb = { ··· 749 433 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf); 750 434 iosys_map_set_vaddr(&dst, buf); 751 435 752 - xrgb8888 = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE); 436 + xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE); 753 437 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888); 754 438 iosys_map_set_vaddr(&src, xrgb8888); 755 439 ··· 758 442 KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size); 759 443 } 760 444 445 + static void drm_test_fb_xrgb8888_to_argb2101010(struct kunit *test) 446 + { 447 + const struct convert_xrgb8888_case *params = test->param_value; 448 + const struct convert_to_argb2101010_result *result = &params->argb2101010_result; 449 + size_t dst_size; 450 + u32 *buf = NULL; 451 + __le32 *xrgb8888 = NULL; 452 + struct iosys_map dst, src; 453 + 454 + struct drm_framebuffer fb = { 455 + .format = drm_format_info(DRM_FORMAT_XRGB8888), 456 + .pitches = { params->pitch, 0, 0 }, 457 + }; 458 + 459 + dst_size = conversion_buf_size(DRM_FORMAT_ARGB2101010, 460 + result->dst_pitch, &params->clip); 461 + KUNIT_ASSERT_GT(test, dst_size, 0); 462 + 463 + buf = kunit_kzalloc(test, dst_size, GFP_KERNEL); 464 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf); 465 + iosys_map_set_vaddr(&dst, buf); 466 + 467 + xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE); 468 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888); 469 + iosys_map_set_vaddr(&src, xrgb8888); 470 + 471 + drm_fb_xrgb8888_to_argb2101010(&dst, &result->dst_pitch, &src, &fb, &params->clip); 472 + buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32)); 473 + KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0); 474 + } 475 + 761 476 static struct kunit_case drm_format_helper_test_cases[] = { 762 477 KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_gray8, convert_xrgb8888_gen_params), 763 478 KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_rgb332, convert_xrgb8888_gen_params), 764 479 KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_rgb565, convert_xrgb8888_gen_params), 480 + KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_xrgb1555, convert_xrgb8888_gen_params), 481 + KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_argb1555, convert_xrgb8888_gen_params), 482 + KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_rgba5551, convert_xrgb8888_gen_params), 765 483 KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_rgb888, convert_xrgb8888_gen_params), 484 + KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_argb8888, convert_xrgb8888_gen_params), 766 485 KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_xrgb2101010, convert_xrgb8888_gen_params), 486 + KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_argb2101010, convert_xrgb8888_gen_params), 767 487 {} 768 488 }; 769 489
+6 -21
drivers/gpu/drm/tiny/ofdrm.c
··· 754 754 kfree(ofdrm_crtc_state); 755 755 } 756 756 757 - /* 758 - * Support all formats of OF display and maybe more; in order 759 - * of preference. The display's update function will do any 760 - * conversion necessary. 761 - * 762 - * TODO: Add blit helpers for remaining formats and uncomment 763 - * constants. 764 - */ 765 - static const uint32_t ofdrm_primary_plane_formats[] = { 766 - DRM_FORMAT_XRGB8888, 767 - DRM_FORMAT_RGB565, 768 - //DRM_FORMAT_XRGB1555, 769 - //DRM_FORMAT_C8, 770 - /* Big-endian formats below */ 771 - DRM_FORMAT_BGRX8888, 772 - DRM_FORMAT_RGB565 | DRM_FORMAT_BIG_ENDIAN, 773 - }; 774 - 775 757 static const uint64_t ofdrm_primary_plane_format_modifiers[] = { 776 758 DRM_FORMAT_MOD_LINEAR, 777 759 DRM_FORMAT_MOD_INVALID ··· 1272 1290 /* Primary plane */ 1273 1291 1274 1292 nformats = drm_fb_build_fourcc_list(dev, &format->format, 1, 1275 - ofdrm_primary_plane_formats, 1276 - ARRAY_SIZE(ofdrm_primary_plane_formats), 1277 1293 odev->formats, ARRAY_SIZE(odev->formats)); 1278 1294 1279 1295 primary_plane = &odev->primary_plane; ··· 1352 1372 { 1353 1373 struct ofdrm_device *odev; 1354 1374 struct drm_device *dev; 1375 + unsigned int color_mode; 1355 1376 int ret; 1356 1377 1357 1378 odev = ofdrm_device_create(&ofdrm_driver, pdev); ··· 1364 1383 if (ret) 1365 1384 return ret; 1366 1385 1367 - drm_fbdev_generic_setup(dev, drm_format_info_bpp(odev->format, 0)); 1386 + color_mode = drm_format_info_bpp(odev->format, 0); 1387 + if (color_mode == 16) 1388 + color_mode = odev->format->depth; // can be 15 or 16 1389 + 1390 + drm_fbdev_generic_setup(dev, color_mode); 1368 1391 1369 1392 return 0; 1370 1393 }
+6 -22
drivers/gpu/drm/tiny/simpledrm.c
··· 446 446 * Modesetting 447 447 */ 448 448 449 - /* 450 - * Support all formats of simplefb and maybe more; in order 451 - * of preference. The display's update function will do any 452 - * conversion necessary. 453 - * 454 - * TODO: Add blit helpers for remaining formats and uncomment 455 - * constants. 456 - */ 457 - static const uint32_t simpledrm_primary_plane_formats[] = { 458 - DRM_FORMAT_XRGB8888, 459 - DRM_FORMAT_ARGB8888, 460 - DRM_FORMAT_RGB565, 461 - //DRM_FORMAT_XRGB1555, 462 - //DRM_FORMAT_ARGB1555, 463 - DRM_FORMAT_RGB888, 464 - DRM_FORMAT_XRGB2101010, 465 - DRM_FORMAT_ARGB2101010, 466 - }; 467 - 468 449 static const uint64_t simpledrm_primary_plane_format_modifiers[] = { 469 450 DRM_FORMAT_MOD_LINEAR, 470 451 DRM_FORMAT_MOD_INVALID ··· 726 745 /* Primary plane */ 727 746 728 747 nformats = drm_fb_build_fourcc_list(dev, &format->format, 1, 729 - simpledrm_primary_plane_formats, 730 - ARRAY_SIZE(simpledrm_primary_plane_formats), 731 748 sdev->formats, ARRAY_SIZE(sdev->formats)); 732 749 733 750 primary_plane = &sdev->primary_plane; ··· 802 823 { 803 824 struct simpledrm_device *sdev; 804 825 struct drm_device *dev; 826 + unsigned int color_mode; 805 827 int ret; 806 828 807 829 sdev = simpledrm_device_create(&simpledrm_driver, pdev); ··· 814 834 if (ret) 815 835 return ret; 816 836 817 - drm_fbdev_generic_setup(dev, drm_format_info_bpp(sdev->format, 0)); 837 + color_mode = drm_format_info_bpp(sdev->format, 0); 838 + if (color_mode == 16) 839 + color_mode = sdev->format->depth; // can be 15 or 16 840 + 841 + drm_fbdev_generic_setup(dev, color_mode); 818 842 819 843 return 0; 820 844 }
+1 -6
drivers/gpu/drm/v3d/v3d_gem.c
··· 861 861 862 862 job->args = *args; 863 863 864 - spin_lock(&file_priv->table_lock); 865 864 for (job->base.bo_count = 0; 866 865 job->base.bo_count < ARRAY_SIZE(args->bo_handles); 867 866 job->base.bo_count++) { ··· 869 870 if (!args->bo_handles[job->base.bo_count]) 870 871 break; 871 872 872 - bo = idr_find(&file_priv->object_idr, 873 - args->bo_handles[job->base.bo_count]); 873 + bo = drm_gem_object_lookup(file_priv, args->bo_handles[job->base.bo_count]); 874 874 if (!bo) { 875 875 DRM_DEBUG("Failed to look up GEM BO %d: %d\n", 876 876 job->base.bo_count, 877 877 args->bo_handles[job->base.bo_count]); 878 878 ret = -ENOENT; 879 - spin_unlock(&file_priv->table_lock); 880 879 goto fail; 881 880 } 882 - drm_gem_object_get(bo); 883 881 job->base.bo[job->base.bo_count] = bo; 884 882 } 885 - spin_unlock(&file_priv->table_lock); 886 883 887 884 ret = v3d_lock_bo_reservations(&job->base, &acquire_ctx); 888 885 if (ret)
+44 -27
drivers/gpu/drm/vc4/vc4_crtc.c
··· 335 335 bool is_dsi = (vc4_encoder->type == VC4_ENCODER_TYPE_DSI0 || 336 336 vc4_encoder->type == VC4_ENCODER_TYPE_DSI1); 337 337 bool is_dsi1 = vc4_encoder->type == VC4_ENCODER_TYPE_DSI1; 338 + bool is_vec = vc4_encoder->type == VC4_ENCODER_TYPE_VEC; 338 339 u32 format = is_dsi1 ? PV_CONTROL_FORMAT_DSIV_24 : PV_CONTROL_FORMAT_24; 339 340 u8 ppc = pv_data->pixels_per_clock; 341 + 342 + u16 vert_bp = mode->crtc_vtotal - mode->crtc_vsync_end; 343 + u16 vert_sync = mode->crtc_vsync_end - mode->crtc_vsync_start; 344 + u16 vert_fp = mode->crtc_vsync_start - mode->crtc_vdisplay; 345 + 340 346 bool debug_dump_regs = false; 341 347 int idx; 342 348 ··· 370 364 VC4_SET_FIELD(mode->hdisplay * pixel_rep / ppc, 371 365 PV_HORZB_HACTIVE)); 372 366 373 - CRTC_WRITE(PV_VERTA, 374 - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + 375 - interlace, 376 - PV_VERTA_VBP) | 377 - VC4_SET_FIELD(mode->crtc_vsync_end - mode->crtc_vsync_start, 378 - PV_VERTA_VSYNC)); 379 - CRTC_WRITE(PV_VERTB, 380 - VC4_SET_FIELD(mode->crtc_vsync_start - mode->crtc_vdisplay, 381 - PV_VERTB_VFP) | 382 - VC4_SET_FIELD(mode->crtc_vdisplay, PV_VERTB_VACTIVE)); 383 - 384 367 if (interlace) { 368 + bool odd_field_first = false; 369 + u32 field_delay = mode->htotal * pixel_rep / (2 * ppc); 370 + u16 vert_bp_even = vert_bp; 371 + u16 vert_fp_even = vert_fp; 372 + 373 + if (is_vec) { 374 + /* VEC (composite output) */ 375 + ++field_delay; 376 + if (mode->htotal == 858) { 377 + /* 525-line mode (NTSC or PAL-M) */ 378 + odd_field_first = true; 379 + } 380 + } 381 + 382 + if (odd_field_first) 383 + ++vert_fp_even; 384 + else 385 + ++vert_bp; 386 + 385 387 CRTC_WRITE(PV_VERTA_EVEN, 386 - VC4_SET_FIELD(mode->crtc_vtotal - 387 - mode->crtc_vsync_end, 388 - PV_VERTA_VBP) | 389 - VC4_SET_FIELD(mode->crtc_vsync_end - 390 - mode->crtc_vsync_start, 391 - PV_VERTA_VSYNC)); 388 + VC4_SET_FIELD(vert_bp_even, PV_VERTA_VBP) | 389 + VC4_SET_FIELD(vert_sync, PV_VERTA_VSYNC)); 392 390 CRTC_WRITE(PV_VERTB_EVEN, 393 - VC4_SET_FIELD(mode->crtc_vsync_start - 394 - mode->crtc_vdisplay, 395 - PV_VERTB_VFP) | 391 + VC4_SET_FIELD(vert_fp_even, PV_VERTB_VFP) | 396 392 VC4_SET_FIELD(mode->crtc_vdisplay, PV_VERTB_VACTIVE)); 397 393 398 - /* We set up first field even mode for HDMI. VEC's 399 - * NTSC mode would want first field odd instead, once 400 - * we support it (to do so, set ODD_FIRST and put the 401 - * delay in VSYNCD_EVEN instead). 394 + /* We set up first field even mode for HDMI and VEC's PAL. 395 + * For NTSC, we need first field odd. 402 396 */ 403 397 CRTC_WRITE(PV_V_CONTROL, 404 398 PV_VCONTROL_CONTINUOUS | 405 399 (is_dsi ? PV_VCONTROL_DSI : 0) | 406 400 PV_VCONTROL_INTERLACE | 407 - VC4_SET_FIELD(mode->htotal * pixel_rep / (2 * ppc), 408 - PV_VCONTROL_ODD_DELAY)); 409 - CRTC_WRITE(PV_VSYNCD_EVEN, 0); 401 + (odd_field_first 402 + ? PV_VCONTROL_ODD_FIRST 403 + : VC4_SET_FIELD(field_delay, 404 + PV_VCONTROL_ODD_DELAY))); 405 + CRTC_WRITE(PV_VSYNCD_EVEN, 406 + (odd_field_first ? field_delay : 0)); 410 407 } else { 411 408 CRTC_WRITE(PV_V_CONTROL, 412 409 PV_VCONTROL_CONTINUOUS | 413 410 (is_dsi ? PV_VCONTROL_DSI : 0)); 411 + CRTC_WRITE(PV_VSYNCD_EVEN, 0); 414 412 } 413 + 414 + CRTC_WRITE(PV_VERTA, 415 + VC4_SET_FIELD(vert_bp, PV_VERTA_VBP) | 416 + VC4_SET_FIELD(vert_sync, PV_VERTA_VSYNC)); 417 + CRTC_WRITE(PV_VERTB, 418 + VC4_SET_FIELD(vert_fp, PV_VERTB_VFP) | 419 + VC4_SET_FIELD(mode->crtc_vdisplay, PV_VERTB_VACTIVE)); 415 420 416 421 if (is_dsi) 417 422 CRTC_WRITE(PV_HACT_ACT, mode->hdisplay * pixel_rep);
-1
drivers/gpu/drm/vc4/vc4_dsi.c
··· 24 24 #include <linux/component.h> 25 25 #include <linux/dma-mapping.h> 26 26 #include <linux/dmaengine.h> 27 - #include <linux/i2c.h> 28 27 #include <linux/io.h> 29 28 #include <linux/of_address.h> 30 29 #include <linux/of_platform.h>
+3 -2
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 1307 1307 VC4_SET_FIELD(mode->crtc_vdisplay, VC5_HDMI_VERTA_VAL)); 1308 1308 u32 vertb = (VC4_SET_FIELD(mode->htotal >> (2 - pixel_rep), 1309 1309 VC5_HDMI_VERTB_VSPO) | 1310 - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, 1310 + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + 1311 + interlaced, 1311 1312 VC4_HDMI_VERTB_VBP)); 1312 1313 u32 vertb_even = (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | 1313 1314 VC4_SET_FIELD(mode->crtc_vtotal - 1314 - mode->crtc_vsync_end - interlaced, 1315 + mode->crtc_vsync_end, 1315 1316 VC4_HDMI_VERTB_VBP)); 1316 1317 unsigned long flags; 1317 1318 unsigned char gcp;
+139 -36
drivers/gpu/drm/vc4/vc4_hvs.c
··· 370 370 * mode. 371 371 */ 372 372 dispctrl = SCALER_DISPCTRLX_ENABLE; 373 + dispbkgndx = HVS_READ(SCALER_DISPBKGNDX(chan)); 373 374 374 - if (!vc4->is_vc5) 375 + if (!vc4->is_vc5) { 375 376 dispctrl |= VC4_SET_FIELD(mode->hdisplay, 376 377 SCALER_DISPCTRLX_WIDTH) | 377 378 VC4_SET_FIELD(mode->vdisplay, 378 379 SCALER_DISPCTRLX_HEIGHT) | 379 380 (oneshot ? SCALER_DISPCTRLX_ONESHOT : 0); 380 - else 381 + dispbkgndx |= SCALER_DISPBKGND_AUTOHS; 382 + } else { 381 383 dispctrl |= VC4_SET_FIELD(mode->hdisplay, 382 384 SCALER5_DISPCTRLX_WIDTH) | 383 385 VC4_SET_FIELD(mode->vdisplay, 384 386 SCALER5_DISPCTRLX_HEIGHT) | 385 387 (oneshot ? SCALER5_DISPCTRLX_ONESHOT : 0); 388 + dispbkgndx &= ~SCALER5_DISPBKGND_BCK2BCK; 389 + } 386 390 387 391 HVS_WRITE(SCALER_DISPCTRLX(chan), dispctrl); 388 392 389 - dispbkgndx = HVS_READ(SCALER_DISPBKGNDX(chan)); 390 393 dispbkgndx &= ~SCALER_DISPBKGND_GAMMA; 391 394 dispbkgndx &= ~SCALER_DISPBKGND_INTERLACE; 392 395 393 396 HVS_WRITE(SCALER_DISPBKGNDX(chan), dispbkgndx | 394 - SCALER_DISPBKGND_AUTOHS | 395 397 ((!vc4->is_vc5) ? SCALER_DISPBKGND_GAMMA : 0) | 396 398 (interlace ? SCALER_DISPBKGND_INTERLACE : 0)); 397 399 ··· 570 568 bool enable_bg_fill = false; 571 569 u32 __iomem *dlist_start = vc4->hvs->dlist + vc4_state->mm.start; 572 570 u32 __iomem *dlist_next = dlist_start; 571 + unsigned int zpos = 0; 572 + bool found = false; 573 573 int idx; 574 574 575 575 if (!drm_dev_enter(dev, &idx)) { ··· 579 575 return; 580 576 } 581 577 578 + if (vc4_state->assigned_channel == VC4_HVS_CHANNEL_DISABLED) 579 + return; 580 + 582 581 if (debug_dump_regs) { 583 582 DRM_INFO("CRTC %d HVS before:\n", drm_crtc_index(crtc)); 584 583 vc4_hvs_dump_state(hvs); 585 584 } 586 585 587 586 /* Copy all the active planes' dlist contents to the hardware dlist. */ 588 - drm_atomic_crtc_for_each_plane(plane, crtc) { 589 - /* Is this the first active plane? */ 590 - if (dlist_next == dlist_start) { 591 - /* We need to enable background fill when a plane 592 - * could be alpha blending from the background, i.e. 593 - * where no other plane is underneath. It suffices to 594 - * consider the first active plane here since we set 595 - * needs_bg_fill such that either the first plane 596 - * already needs it or all planes on top blend from 597 - * the first or a lower plane. 598 - */ 599 - vc4_plane_state = to_vc4_plane_state(plane->state); 600 - enable_bg_fill = vc4_plane_state->needs_bg_fill; 587 + do { 588 + found = false; 589 + 590 + drm_atomic_crtc_for_each_plane(plane, crtc) { 591 + if (plane->state->normalized_zpos != zpos) 592 + continue; 593 + 594 + /* Is this the first active plane? */ 595 + if (dlist_next == dlist_start) { 596 + /* We need to enable background fill when a plane 597 + * could be alpha blending from the background, i.e. 598 + * where no other plane is underneath. It suffices to 599 + * consider the first active plane here since we set 600 + * needs_bg_fill such that either the first plane 601 + * already needs it or all planes on top blend from 602 + * the first or a lower plane. 603 + */ 604 + vc4_plane_state = to_vc4_plane_state(plane->state); 605 + enable_bg_fill = vc4_plane_state->needs_bg_fill; 606 + } 607 + 608 + dlist_next += vc4_plane_write_dlist(plane, dlist_next); 609 + 610 + found = true; 601 611 } 602 612 603 - dlist_next += vc4_plane_write_dlist(plane, dlist_next); 604 - } 613 + zpos++; 614 + } while (found); 605 615 606 616 writel(SCALER_CTL0_END, dlist_next); 607 617 dlist_next++; ··· 676 658 return; 677 659 678 660 dispctrl = HVS_READ(SCALER_DISPCTRL); 679 - dispctrl &= ~SCALER_DISPCTRL_DSPEISLUR(channel); 661 + dispctrl &= ~(hvs->vc4->is_vc5 ? SCALER5_DISPCTRL_DSPEISLUR(channel) : 662 + SCALER_DISPCTRL_DSPEISLUR(channel)); 680 663 681 664 HVS_WRITE(SCALER_DISPCTRL, dispctrl); 682 665 ··· 694 675 return; 695 676 696 677 dispctrl = HVS_READ(SCALER_DISPCTRL); 697 - dispctrl |= SCALER_DISPCTRL_DSPEISLUR(channel); 678 + dispctrl |= (hvs->vc4->is_vc5 ? SCALER5_DISPCTRL_DSPEISLUR(channel) : 679 + SCALER_DISPCTRL_DSPEISLUR(channel)); 698 680 699 681 HVS_WRITE(SCALER_DISPSTAT, 700 682 SCALER_DISPSTAT_EUFLOW(channel)); ··· 721 701 int channel; 722 702 u32 control; 723 703 u32 status; 704 + u32 dspeislur; 724 705 725 706 /* 726 707 * NOTE: We don't need to protect the register access using ··· 738 717 control = HVS_READ(SCALER_DISPCTRL); 739 718 740 719 for (channel = 0; channel < SCALER_CHANNELS_COUNT; channel++) { 720 + dspeislur = vc4->is_vc5 ? SCALER5_DISPCTRL_DSPEISLUR(channel) : 721 + SCALER_DISPCTRL_DSPEISLUR(channel); 741 722 /* Interrupt masking is not always honored, so check it here. */ 742 723 if (status & SCALER_DISPSTAT_EUFLOW(channel) && 743 - control & SCALER_DISPCTRL_DSPEISLUR(channel)) { 724 + control & dspeislur) { 744 725 vc4_hvs_mask_underrun(hvs, channel); 745 726 vc4_hvs_report_underrun(dev); 746 727 ··· 829 806 struct vc4_hvs *hvs = NULL; 830 807 int ret; 831 808 u32 dispctrl; 832 - u32 reg; 809 + u32 reg, top; 833 810 834 811 hvs = __vc4_hvs_alloc(vc4, NULL); 835 812 if (IS_ERR(hvs)) ··· 922 899 SCALER_DISPCTRL_DISPEIRQ(1) | 923 900 SCALER_DISPCTRL_DISPEIRQ(2); 924 901 925 - dispctrl &= ~(SCALER_DISPCTRL_DMAEIRQ | 926 - SCALER_DISPCTRL_SLVWREIRQ | 927 - SCALER_DISPCTRL_SLVRDEIRQ | 928 - SCALER_DISPCTRL_DSPEIEOF(0) | 929 - SCALER_DISPCTRL_DSPEIEOF(1) | 930 - SCALER_DISPCTRL_DSPEIEOF(2) | 931 - SCALER_DISPCTRL_DSPEIEOLN(0) | 932 - SCALER_DISPCTRL_DSPEIEOLN(1) | 933 - SCALER_DISPCTRL_DSPEIEOLN(2) | 934 - SCALER_DISPCTRL_DSPEISLUR(0) | 935 - SCALER_DISPCTRL_DSPEISLUR(1) | 936 - SCALER_DISPCTRL_DSPEISLUR(2) | 937 - SCALER_DISPCTRL_SCLEIRQ); 902 + if (!vc4->is_vc5) 903 + dispctrl &= ~(SCALER_DISPCTRL_DMAEIRQ | 904 + SCALER_DISPCTRL_SLVWREIRQ | 905 + SCALER_DISPCTRL_SLVRDEIRQ | 906 + SCALER_DISPCTRL_DSPEIEOF(0) | 907 + SCALER_DISPCTRL_DSPEIEOF(1) | 908 + SCALER_DISPCTRL_DSPEIEOF(2) | 909 + SCALER_DISPCTRL_DSPEIEOLN(0) | 910 + SCALER_DISPCTRL_DSPEIEOLN(1) | 911 + SCALER_DISPCTRL_DSPEIEOLN(2) | 912 + SCALER_DISPCTRL_DSPEISLUR(0) | 913 + SCALER_DISPCTRL_DSPEISLUR(1) | 914 + SCALER_DISPCTRL_DSPEISLUR(2) | 915 + SCALER_DISPCTRL_SCLEIRQ); 916 + else 917 + dispctrl &= ~(SCALER_DISPCTRL_DMAEIRQ | 918 + SCALER5_DISPCTRL_SLVEIRQ | 919 + SCALER5_DISPCTRL_DSPEIEOF(0) | 920 + SCALER5_DISPCTRL_DSPEIEOF(1) | 921 + SCALER5_DISPCTRL_DSPEIEOF(2) | 922 + SCALER5_DISPCTRL_DSPEIEOLN(0) | 923 + SCALER5_DISPCTRL_DSPEIEOLN(1) | 924 + SCALER5_DISPCTRL_DSPEIEOLN(2) | 925 + SCALER5_DISPCTRL_DSPEISLUR(0) | 926 + SCALER5_DISPCTRL_DSPEISLUR(1) | 927 + SCALER5_DISPCTRL_DSPEISLUR(2) | 928 + SCALER_DISPCTRL_SCLEIRQ); 929 + 930 + 931 + /* Set AXI panic mode. 932 + * VC4 panics when < 2 lines in FIFO. 933 + * VC5 panics when less than 1 line in the FIFO. 934 + */ 935 + dispctrl &= ~(SCALER_DISPCTRL_PANIC0_MASK | 936 + SCALER_DISPCTRL_PANIC1_MASK | 937 + SCALER_DISPCTRL_PANIC2_MASK); 938 + dispctrl |= VC4_SET_FIELD(2, SCALER_DISPCTRL_PANIC0); 939 + dispctrl |= VC4_SET_FIELD(2, SCALER_DISPCTRL_PANIC1); 940 + dispctrl |= VC4_SET_FIELD(2, SCALER_DISPCTRL_PANIC2); 938 941 939 942 HVS_WRITE(SCALER_DISPCTRL, dispctrl); 943 + 944 + /* Recompute Composite Output Buffer (COB) allocations for the displays 945 + */ 946 + if (!vc4->is_vc5) { 947 + /* The COB is 20736 pixels, or just over 10 lines at 2048 wide. 948 + * The bottom 2048 pixels are full 32bpp RGBA (intended for the 949 + * TXP composing RGBA to memory), whilst the remainder are only 950 + * 24bpp RGB. 951 + * 952 + * Assign 3 lines to channels 1 & 2, and just over 4 lines to 953 + * channel 0. 954 + */ 955 + #define VC4_COB_SIZE 20736 956 + #define VC4_COB_LINE_WIDTH 2048 957 + #define VC4_COB_NUM_LINES 3 958 + reg = 0; 959 + top = VC4_COB_LINE_WIDTH * VC4_COB_NUM_LINES; 960 + reg |= (top - 1) << 16; 961 + HVS_WRITE(SCALER_DISPBASE2, reg); 962 + reg = top; 963 + top += VC4_COB_LINE_WIDTH * VC4_COB_NUM_LINES; 964 + reg |= (top - 1) << 16; 965 + HVS_WRITE(SCALER_DISPBASE1, reg); 966 + reg = top; 967 + top = VC4_COB_SIZE; 968 + reg |= (top - 1) << 16; 969 + HVS_WRITE(SCALER_DISPBASE0, reg); 970 + } else { 971 + /* The COB is 44416 pixels, or 10.8 lines at 4096 wide. 972 + * The bottom 4096 pixels are full RGBA (intended for the TXP 973 + * composing RGBA to memory), whilst the remainder are only 974 + * RGB. Addressing is always pixel wide. 975 + * 976 + * Assign 3 lines of 4096 to channels 1 & 2, and just over 4 977 + * lines. to channel 0. 978 + */ 979 + #define VC5_COB_SIZE 44416 980 + #define VC5_COB_LINE_WIDTH 4096 981 + #define VC5_COB_NUM_LINES 3 982 + reg = 0; 983 + top = VC5_COB_LINE_WIDTH * VC5_COB_NUM_LINES; 984 + reg |= top << 16; 985 + HVS_WRITE(SCALER_DISPBASE2, reg); 986 + top += 16; 987 + reg = top; 988 + top += VC5_COB_LINE_WIDTH * VC5_COB_NUM_LINES; 989 + reg |= top << 16; 990 + HVS_WRITE(SCALER_DISPBASE1, reg); 991 + top += 16; 992 + reg = top; 993 + top = VC5_COB_SIZE; 994 + reg |= top << 16; 995 + HVS_WRITE(SCALER_DISPBASE0, reg); 996 + } 940 997 941 998 ret = devm_request_irq(dev, platform_get_irq(pdev, 0), 942 999 vc4_hvs_irq_handler, 0, "vc4 hvs", drm);
+1
drivers/gpu/drm/vc4/vc4_kms.c
··· 1074 1074 dev->mode_config.helper_private = &vc4_mode_config_helpers; 1075 1075 dev->mode_config.preferred_depth = 24; 1076 1076 dev->mode_config.async_page_flip = true; 1077 + dev->mode_config.normalize_zpos = true; 1077 1078 1078 1079 ret = vc4_ctm_obj_init(vc4); 1079 1080 if (ret)
+129 -10
drivers/gpu/drm/vc4/vc4_plane.c
··· 65 65 .drm = DRM_FORMAT_RGB565, 66 66 .hvs = HVS_PIXEL_FORMAT_RGB565, 67 67 .pixel_order = HVS_PIXEL_ORDER_XRGB, 68 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XRGB, 68 69 }, 69 70 { 70 71 .drm = DRM_FORMAT_BGR565, 71 72 .hvs = HVS_PIXEL_FORMAT_RGB565, 72 73 .pixel_order = HVS_PIXEL_ORDER_XBGR, 74 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XBGR, 73 75 }, 74 76 { 75 77 .drm = DRM_FORMAT_ARGB1555, 76 78 .hvs = HVS_PIXEL_FORMAT_RGBA5551, 77 79 .pixel_order = HVS_PIXEL_ORDER_ABGR, 80 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB, 78 81 }, 79 82 { 80 83 .drm = DRM_FORMAT_XRGB1555, 81 84 .hvs = HVS_PIXEL_FORMAT_RGBA5551, 82 85 .pixel_order = HVS_PIXEL_ORDER_ABGR, 86 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB, 83 87 }, 84 88 { 85 89 .drm = DRM_FORMAT_RGB888, 86 90 .hvs = HVS_PIXEL_FORMAT_RGB888, 87 91 .pixel_order = HVS_PIXEL_ORDER_XRGB, 92 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XRGB, 88 93 }, 89 94 { 90 95 .drm = DRM_FORMAT_BGR888, 91 96 .hvs = HVS_PIXEL_FORMAT_RGB888, 92 97 .pixel_order = HVS_PIXEL_ORDER_XBGR, 98 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XBGR, 93 99 }, 94 100 { 95 101 .drm = DRM_FORMAT_YUV422, 96 102 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE, 97 103 .pixel_order = HVS_PIXEL_ORDER_XYCBCR, 104 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCBCR, 98 105 }, 99 106 { 100 107 .drm = DRM_FORMAT_YVU422, 101 108 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE, 102 109 .pixel_order = HVS_PIXEL_ORDER_XYCRCB, 110 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCRCB, 103 111 }, 104 112 { 105 113 .drm = DRM_FORMAT_YUV420, 106 114 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_3PLANE, 107 115 .pixel_order = HVS_PIXEL_ORDER_XYCBCR, 116 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCBCR, 108 117 }, 109 118 { 110 119 .drm = DRM_FORMAT_YVU420, 111 120 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_3PLANE, 112 121 .pixel_order = HVS_PIXEL_ORDER_XYCRCB, 122 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCRCB, 113 123 }, 114 124 { 115 125 .drm = DRM_FORMAT_NV12, 116 126 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_2PLANE, 117 127 .pixel_order = HVS_PIXEL_ORDER_XYCBCR, 128 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCBCR, 118 129 }, 119 130 { 120 131 .drm = DRM_FORMAT_NV21, 121 132 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_2PLANE, 122 133 .pixel_order = HVS_PIXEL_ORDER_XYCRCB, 134 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCRCB, 123 135 }, 124 136 { 125 137 .drm = DRM_FORMAT_NV16, 126 138 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_2PLANE, 127 139 .pixel_order = HVS_PIXEL_ORDER_XYCBCR, 140 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCBCR, 128 141 }, 129 142 { 130 143 .drm = DRM_FORMAT_NV61, 131 144 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_2PLANE, 132 145 .pixel_order = HVS_PIXEL_ORDER_XYCRCB, 146 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCRCB, 133 147 }, 134 148 { 135 149 .drm = DRM_FORMAT_P030, 136 150 .hvs = HVS_PIXEL_FORMAT_YCBCR_10BIT, 137 - .pixel_order = HVS_PIXEL_ORDER_XYCBCR, 151 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCBCR, 138 152 .hvs5_only = true, 153 + }, 154 + { 155 + .drm = DRM_FORMAT_XRGB2101010, 156 + .hvs = HVS_PIXEL_FORMAT_RGBA1010102, 157 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB, 158 + .hvs5_only = true, 159 + }, 160 + { 161 + .drm = DRM_FORMAT_ARGB2101010, 162 + .hvs = HVS_PIXEL_FORMAT_RGBA1010102, 163 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB, 164 + .hvs5_only = true, 165 + }, 166 + { 167 + .drm = DRM_FORMAT_ABGR2101010, 168 + .hvs = HVS_PIXEL_FORMAT_RGBA1010102, 169 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ABGR, 170 + .hvs5_only = true, 171 + }, 172 + { 173 + .drm = DRM_FORMAT_XBGR2101010, 174 + .hvs = HVS_PIXEL_FORMAT_RGBA1010102, 175 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ABGR, 176 + .hvs5_only = true, 177 + }, 178 + { 179 + .drm = DRM_FORMAT_RGB332, 180 + .hvs = HVS_PIXEL_FORMAT_RGB332, 181 + .pixel_order = HVS_PIXEL_ORDER_ARGB, 182 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB, 183 + }, 184 + { 185 + .drm = DRM_FORMAT_BGR233, 186 + .hvs = HVS_PIXEL_FORMAT_RGB332, 187 + .pixel_order = HVS_PIXEL_ORDER_ABGR, 188 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ABGR, 189 + }, 190 + { 191 + .drm = DRM_FORMAT_XRGB4444, 192 + .hvs = HVS_PIXEL_FORMAT_RGBA4444, 193 + .pixel_order = HVS_PIXEL_ORDER_ABGR, 194 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB, 195 + }, 196 + { 197 + .drm = DRM_FORMAT_ARGB4444, 198 + .hvs = HVS_PIXEL_FORMAT_RGBA4444, 199 + .pixel_order = HVS_PIXEL_ORDER_ABGR, 200 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB, 201 + }, 202 + { 203 + .drm = DRM_FORMAT_XBGR4444, 204 + .hvs = HVS_PIXEL_FORMAT_RGBA4444, 205 + .pixel_order = HVS_PIXEL_ORDER_ARGB, 206 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ABGR, 207 + }, 208 + { 209 + .drm = DRM_FORMAT_ABGR4444, 210 + .hvs = HVS_PIXEL_FORMAT_RGBA4444, 211 + .pixel_order = HVS_PIXEL_ORDER_ARGB, 212 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ABGR, 213 + }, 214 + { 215 + .drm = DRM_FORMAT_BGRX4444, 216 + .hvs = HVS_PIXEL_FORMAT_RGBA4444, 217 + .pixel_order = HVS_PIXEL_ORDER_RGBA, 218 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_BGRA, 219 + }, 220 + { 221 + .drm = DRM_FORMAT_BGRA4444, 222 + .hvs = HVS_PIXEL_FORMAT_RGBA4444, 223 + .pixel_order = HVS_PIXEL_ORDER_RGBA, 224 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_BGRA, 225 + }, 226 + { 227 + .drm = DRM_FORMAT_RGBX4444, 228 + .hvs = HVS_PIXEL_FORMAT_RGBA4444, 229 + .pixel_order = HVS_PIXEL_ORDER_BGRA, 230 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_RGBA, 231 + }, 232 + { 233 + .drm = DRM_FORMAT_RGBA4444, 234 + .hvs = HVS_PIXEL_FORMAT_RGBA4444, 235 + .pixel_order = HVS_PIXEL_ORDER_BGRA, 236 + .pixel_order_hvs5 = HVS_PIXEL_ORDER_RGBA, 139 237 }, 140 238 }; 141 239 ··· 1099 1001 vc4_dlist_write(vc4_state, 0xc0c0c0c0); 1100 1002 1101 1003 } else { 1102 - u32 hvs_pixel_order = format->pixel_order; 1103 - 1104 - if (format->pixel_order_hvs5) 1105 - hvs_pixel_order = format->pixel_order_hvs5; 1106 - 1107 1004 /* Control word */ 1108 1005 vc4_dlist_write(vc4_state, 1109 1006 SCALER_CTL0_VALID | 1110 - (hvs_pixel_order << SCALER_CTL0_ORDER_SHIFT) | 1007 + (format->pixel_order_hvs5 << SCALER_CTL0_ORDER_SHIFT) | 1111 1008 (hvs_format << SCALER_CTL0_PIXEL_FORMAT_SHIFT) | 1112 1009 VC4_SET_FIELD(tiling, SCALER_CTL0_TILING) | 1113 1010 (vc4_state->is_unity ? ··· 1581 1488 case DRM_FORMAT_BGRX1010102: 1582 1489 case DRM_FORMAT_RGBA1010102: 1583 1490 case DRM_FORMAT_BGRA1010102: 1491 + case DRM_FORMAT_XRGB4444: 1492 + case DRM_FORMAT_ARGB4444: 1493 + case DRM_FORMAT_XBGR4444: 1494 + case DRM_FORMAT_ABGR4444: 1495 + case DRM_FORMAT_RGBX4444: 1496 + case DRM_FORMAT_RGBA4444: 1497 + case DRM_FORMAT_BGRX4444: 1498 + case DRM_FORMAT_BGRA4444: 1499 + case DRM_FORMAT_RGB332: 1500 + case DRM_FORMAT_BGR233: 1584 1501 case DRM_FORMAT_YUV422: 1585 1502 case DRM_FORMAT_YVU422: 1586 1503 case DRM_FORMAT_YUV420: ··· 1671 1568 DRM_COLOR_YCBCR_BT709, 1672 1569 DRM_COLOR_YCBCR_LIMITED_RANGE); 1673 1570 1571 + if (type == DRM_PLANE_TYPE_PRIMARY) 1572 + drm_plane_create_zpos_immutable_property(plane, 0); 1573 + 1674 1574 return plane; 1675 1575 } 1576 + 1577 + #define VC4_NUM_OVERLAY_PLANES 16 1676 1578 1677 1579 int vc4_plane_create_additional_planes(struct drm_device *drm) 1678 1580 { ··· 1694 1586 * modest number of planes to expose, that should hopefully 1695 1587 * still cover any sane usecase. 1696 1588 */ 1697 - for (i = 0; i < 16; i++) { 1589 + for (i = 0; i < VC4_NUM_OVERLAY_PLANES; i++) { 1698 1590 struct drm_plane *plane = 1699 1591 vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY, 1700 1592 GENMASK(drm->mode_config.num_crtc - 1, 0)); 1701 1593 1702 1594 if (IS_ERR(plane)) 1703 1595 continue; 1596 + 1597 + /* Create zpos property. Max of all the overlays + 1 primary + 1598 + * 1 cursor plane on a crtc. 1599 + */ 1600 + drm_plane_create_zpos_property(plane, i + 1, 1, 1601 + VC4_NUM_OVERLAY_PLANES + 1); 1704 1602 } 1705 1603 1706 1604 drm_for_each_crtc(crtc, drm) { 1707 1605 /* Set up the legacy cursor after overlay initialization, 1708 - * since we overlay planes on the CRTC in the order they were 1709 - * initialized. 1606 + * since the zpos fallback is that planes are rendered by plane 1607 + * ID order, and that then puts the cursor on top. 1710 1608 */ 1711 1609 cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR, 1712 1610 drm_crtc_mask(crtc)); 1713 1611 if (!IS_ERR(cursor_plane)) { 1714 1612 crtc->cursor = cursor_plane; 1613 + 1614 + drm_plane_create_zpos_property(cursor_plane, 1615 + VC4_NUM_OVERLAY_PLANES + 1, 1616 + 1, 1617 + VC4_NUM_OVERLAY_PLANES + 1); 1715 1618 } 1716 1619 } 1717 1620
+18 -2
drivers/gpu/drm/vc4/vc4_regs.h
··· 220 220 #define SCALER_DISPCTRL 0x00000000 221 221 /* Global register for clock gating the HVS */ 222 222 # define SCALER_DISPCTRL_ENABLE BIT(31) 223 + # define SCALER_DISPCTRL_PANIC0_MASK VC4_MASK(25, 24) 224 + # define SCALER_DISPCTRL_PANIC0_SHIFT 24 225 + # define SCALER_DISPCTRL_PANIC1_MASK VC4_MASK(27, 26) 226 + # define SCALER_DISPCTRL_PANIC1_SHIFT 26 227 + # define SCALER_DISPCTRL_PANIC2_MASK VC4_MASK(29, 28) 228 + # define SCALER_DISPCTRL_PANIC2_SHIFT 28 223 229 # define SCALER_DISPCTRL_DSP3_MUX_MASK VC4_MASK(19, 18) 224 230 # define SCALER_DISPCTRL_DSP3_MUX_SHIFT 18 225 231 ··· 234 228 * always enabled. 235 229 */ 236 230 # define SCALER_DISPCTRL_DSPEISLUR(x) BIT(13 + (x)) 231 + # define SCALER5_DISPCTRL_DSPEISLUR(x) BIT(9 + ((x) * 4)) 237 232 /* Enables Display 0 end-of-line-N contribution to 238 233 * SCALER_DISPSTAT_IRQDISP0 239 234 */ 240 235 # define SCALER_DISPCTRL_DSPEIEOLN(x) BIT(8 + ((x) * 2)) 236 + # define SCALER5_DISPCTRL_DSPEIEOLN(x) BIT(8 + ((x) * 4)) 241 237 /* Enables Display 0 EOF contribution to SCALER_DISPSTAT_IRQDISP0 */ 242 238 # define SCALER_DISPCTRL_DSPEIEOF(x) BIT(7 + ((x) * 2)) 239 + # define SCALER5_DISPCTRL_DSPEIEOF(x) BIT(7 + ((x) * 4)) 243 240 244 - # define SCALER_DISPCTRL_SLVRDEIRQ BIT(6) 245 - # define SCALER_DISPCTRL_SLVWREIRQ BIT(5) 241 + # define SCALER5_DISPCTRL_DSPEIVST(x) BIT(6 + ((x) * 4)) 242 + 243 + # define SCALER_DISPCTRL_SLVRDEIRQ BIT(6) /* HVS4 only */ 244 + # define SCALER_DISPCTRL_SLVWREIRQ BIT(5) /* HVS4 only */ 245 + # define SCALER5_DISPCTRL_SLVEIRQ BIT(5) 246 246 # define SCALER_DISPCTRL_DMAEIRQ BIT(4) 247 247 /* Enables interrupt generation on the enabled EOF/EOLN/EISLUR 248 248 * bits and short frames.. ··· 372 360 373 361 #define SCALER_DISPBKGND0 0x00000044 374 362 # define SCALER_DISPBKGND_AUTOHS BIT(31) 363 + # define SCALER5_DISPBKGND_BCK2BCK BIT(31) 375 364 # define SCALER_DISPBKGND_INTERLACE BIT(30) 376 365 # define SCALER_DISPBKGND_GAMMA BIT(29) 377 366 # define SCALER_DISPBKGND_TESTMODE_MASK VC4_MASK(28, 25) ··· 848 835 /* Note: the LSB is the rightmost character shown. Only valid for 849 836 * HVS_PIXEL_FORMAT_RGB8888, not RGB888. 850 837 */ 838 + /* For modes 332, 4444, 555, 5551, 6666, 8888, 10:10:10:2 */ 851 839 #define HVS_PIXEL_ORDER_RGBA 0 852 840 #define HVS_PIXEL_ORDER_BGRA 1 853 841 #define HVS_PIXEL_ORDER_ARGB 2 854 842 #define HVS_PIXEL_ORDER_ABGR 3 855 843 844 + /* For modes 666 and 888 (4 & 5) */ 856 845 #define HVS_PIXEL_ORDER_XBRG 0 857 846 #define HVS_PIXEL_ORDER_XRBG 1 858 847 #define HVS_PIXEL_ORDER_XRGB 2 859 848 #define HVS_PIXEL_ORDER_XBGR 3 860 849 850 + /* For YCbCr modes (8-12, and 17) */ 861 851 #define HVS_PIXEL_ORDER_XYCBCR 0 862 852 #define HVS_PIXEL_ORDER_XYCRCB 1 863 853 #define HVS_PIXEL_ORDER_YXCBCR 2
+3 -1
drivers/gpu/drm/vc4/vc4_vec.c
··· 613 613 VEC_WRITE(VEC_CLMP0_START, 0xac); 614 614 VEC_WRITE(VEC_CLMP0_END, 0xec); 615 615 VEC_WRITE(VEC_CONFIG2, 616 - VEC_CONFIG2_UV_DIG_DIS | VEC_CONFIG2_RGB_DIG_DIS); 616 + VEC_CONFIG2_UV_DIG_DIS | 617 + VEC_CONFIG2_RGB_DIG_DIS | 618 + ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) ? 0 : VEC_CONFIG2_PROG_SCAN)); 617 619 VEC_WRITE(VEC_CONFIG3, VEC_CONFIG3_HORIZ_LEN_STD); 618 620 VEC_WRITE(VEC_DAC_CONFIG, vec->variant->dac_config); 619 621
+35 -1
drivers/gpu/drm/vkms/vkms_plane.c
··· 160 160 return 0; 161 161 } 162 162 163 + static int vkms_prepare_fb(struct drm_plane *plane, 164 + struct drm_plane_state *state) 165 + { 166 + struct drm_shadow_plane_state *shadow_plane_state; 167 + struct drm_framebuffer *fb = state->fb; 168 + int ret; 169 + 170 + if (!fb) 171 + return 0; 172 + 173 + shadow_plane_state = to_drm_shadow_plane_state(state); 174 + 175 + ret = drm_gem_plane_helper_prepare_fb(plane, state); 176 + if (ret) 177 + return ret; 178 + 179 + return drm_gem_fb_vmap(fb, shadow_plane_state->map, shadow_plane_state->data); 180 + } 181 + 182 + static void vkms_cleanup_fb(struct drm_plane *plane, 183 + struct drm_plane_state *state) 184 + { 185 + struct drm_shadow_plane_state *shadow_plane_state; 186 + struct drm_framebuffer *fb = state->fb; 187 + 188 + if (!fb) 189 + return; 190 + 191 + shadow_plane_state = to_drm_shadow_plane_state(state); 192 + 193 + drm_gem_fb_vunmap(fb, shadow_plane_state->map); 194 + } 195 + 163 196 static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = { 164 197 .atomic_update = vkms_plane_atomic_update, 165 198 .atomic_check = vkms_plane_atomic_check, 166 - DRM_GEM_SHADOW_PLANE_HELPER_FUNCS, 199 + .prepare_fb = vkms_prepare_fb, 200 + .cleanup_fb = vkms_cleanup_fb, 167 201 }; 168 202 169 203 struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
-2
include/drm/drm_bridge_connector.h
··· 10 10 struct drm_device; 11 11 struct drm_encoder; 12 12 13 - void drm_bridge_connector_enable_hpd(struct drm_connector *connector); 14 - void drm_bridge_connector_disable_hpd(struct drm_connector *connector); 15 13 struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, 16 14 struct drm_encoder *encoder); 17 15
+18
include/drm/drm_debugfs.h
··· 86 86 * core. 87 87 */ 88 88 struct drm_debugfs_info { 89 + /** @name: File name */ 89 90 const char *name; 91 + 92 + /** 93 + * @show: 94 + * 95 + * Show callback. &seq_file->private will be set to the &struct 96 + * drm_debugfs_entry corresponding to the instance of this info 97 + * on a given &struct drm_device. 98 + */ 90 99 int (*show)(struct seq_file*, void*); 100 + 101 + /** @driver_features: Required driver features for this entry. */ 91 102 u32 driver_features; 103 + 104 + /** @data: Driver-private data, should not be device-specific. */ 92 105 void *data; 93 106 }; 94 107 ··· 112 99 * drm_debugfs_info on a &struct drm_device. 113 100 */ 114 101 struct drm_debugfs_entry { 102 + /** @dev: &struct drm_device for this node. */ 115 103 struct drm_device *dev; 104 + 105 + /** @file: Template for this node. */ 116 106 struct drm_debugfs_info file; 107 + 108 + /** @list: Linked list of all device nodes. */ 117 109 struct list_head list; 118 110 }; 119 111
+15 -2
include/drm/drm_device.h
··· 87 87 */ 88 88 void *dev_private; 89 89 90 - /** @primary: Primary node */ 90 + /** 91 + * @primary: 92 + * 93 + * Primary node. Drivers should not interact with this 94 + * directly. debugfs interfaces can be registered with 95 + * drm_debugfs_add_file(), and sysfs should be directly added on the 96 + * hardware (and not character device node) struct device @dev. 97 + */ 91 98 struct drm_minor *primary; 92 99 93 - /** @render: Render node */ 100 + /** 101 + * @render: 102 + * 103 + * Render node. Drivers should not interact with this directly ever. 104 + * Drivers should not expose any additional interfaces in debugfs or 105 + * sysfs on this node. 106 + */ 94 107 struct drm_minor *render; 95 108 96 109 /** @accel: Compute Acceleration node */
+15 -1
include/drm/drm_format_helper.h
··· 30 30 void drm_fb_xrgb8888_to_rgb565(struct iosys_map *dst, const unsigned int *dst_pitch, 31 31 const struct iosys_map *src, const struct drm_framebuffer *fb, 32 32 const struct drm_rect *clip, bool swab); 33 + void drm_fb_xrgb8888_to_xrgb1555(struct iosys_map *dst, const unsigned int *dst_pitch, 34 + const struct iosys_map *src, const struct drm_framebuffer *fb, 35 + const struct drm_rect *clip); 36 + void drm_fb_xrgb8888_to_argb1555(struct iosys_map *dst, const unsigned int *dst_pitch, 37 + const struct iosys_map *src, const struct drm_framebuffer *fb, 38 + const struct drm_rect *clip); 39 + void drm_fb_xrgb8888_to_rgba5551(struct iosys_map *dst, const unsigned int *dst_pitch, 40 + const struct iosys_map *src, const struct drm_framebuffer *fb, 41 + const struct drm_rect *clip); 33 42 void drm_fb_xrgb8888_to_rgb888(struct iosys_map *dst, const unsigned int *dst_pitch, 34 43 const struct iosys_map *src, const struct drm_framebuffer *fb, 35 44 const struct drm_rect *clip); 45 + void drm_fb_xrgb8888_to_argb8888(struct iosys_map *dst, const unsigned int *dst_pitch, 46 + const struct iosys_map *src, const struct drm_framebuffer *fb, 47 + const struct drm_rect *clip); 36 48 void drm_fb_xrgb8888_to_xrgb2101010(struct iosys_map *dst, const unsigned int *dst_pitch, 49 + const struct iosys_map *src, const struct drm_framebuffer *fb, 50 + const struct drm_rect *clip); 51 + void drm_fb_xrgb8888_to_argb2101010(struct iosys_map *dst, const unsigned int *dst_pitch, 37 52 const struct iosys_map *src, const struct drm_framebuffer *fb, 38 53 const struct drm_rect *clip); 39 54 void drm_fb_xrgb8888_to_gray8(struct iosys_map *dst, const unsigned int *dst_pitch, ··· 65 50 66 51 size_t drm_fb_build_fourcc_list(struct drm_device *dev, 67 52 const u32 *native_fourccs, size_t native_nfourccs, 68 - const u32 *extra_fourccs, size_t extra_nfourccs, 69 53 u32 *fourccs_out, size_t nfourccs_out); 70 54 71 55 #endif /* __LINUX_DRM_FORMAT_HELPER_H */
+30 -9
include/drm/drm_mipi_dsi.h
··· 298 298 u16 *brightness); 299 299 300 300 /** 301 + * mipi_dsi_generic_write_seq - transmit data using a generic write packet 302 + * @dsi: DSI peripheral device 303 + * @seq: buffer containing the payload 304 + */ 305 + #define mipi_dsi_generic_write_seq(dsi, seq...) \ 306 + do { \ 307 + static const u8 d[] = { seq }; \ 308 + struct device *dev = &dsi->dev; \ 309 + int ret; \ 310 + ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ 311 + if (ret < 0) { \ 312 + dev_err_ratelimited(dev, "transmit data failed: %d\n", \ 313 + ret); \ 314 + return ret; \ 315 + } \ 316 + } while (0) 317 + 318 + /** 301 319 * mipi_dsi_dcs_write_seq - transmit a DCS command with payload 302 320 * @dsi: DSI peripheral device 303 321 * @cmd: Command 304 322 * @seq: buffer containing data to be transmitted 305 323 */ 306 - #define mipi_dsi_dcs_write_seq(dsi, cmd, seq...) do { \ 307 - static const u8 d[] = { cmd, seq }; \ 308 - struct device *dev = &dsi->dev; \ 309 - int ret; \ 310 - ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ 311 - if (ret < 0) { \ 312 - dev_err_ratelimited(dev, "sending command %#02x failed: %d\n", cmd, ret); \ 313 - return ret; \ 314 - } \ 324 + #define mipi_dsi_dcs_write_seq(dsi, cmd, seq...) \ 325 + do { \ 326 + static const u8 d[] = { cmd, seq }; \ 327 + struct device *dev = &dsi->dev; \ 328 + int ret; \ 329 + ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ 330 + if (ret < 0) { \ 331 + dev_err_ratelimited( \ 332 + dev, "sending command %#02x failed: %d\n", \ 333 + cmd, ret); \ 334 + return ret; \ 335 + } \ 315 336 } while (0) 316 337 317 338 /**
+22
include/drm/drm_modeset_helper_vtables.h
··· 1143 1143 */ 1144 1144 void (*cleanup_writeback_job)(struct drm_writeback_connector *connector, 1145 1145 struct drm_writeback_job *job); 1146 + 1147 + /** 1148 + * @enable_hpd: 1149 + * 1150 + * Enable hot-plug detection for the connector. 1151 + * 1152 + * This operation is optional. 1153 + * 1154 + * This callback is used by the drm_kms_helper_poll_enable() helpers. 1155 + */ 1156 + void (*enable_hpd)(struct drm_connector *connector); 1157 + 1158 + /** 1159 + * @disable_hpd: 1160 + * 1161 + * Disable hot-plug detection for the connector. 1162 + * 1163 + * This operation is optional. 1164 + * 1165 + * This callback is used by the drm_kms_helper_poll_disable() helpers. 1166 + */ 1167 + void (*disable_hpd)(struct drm_connector *connector); 1146 1168 }; 1147 1169 1148 1170 /**
+12
include/uapi/drm/drm_fourcc.h
··· 88 88 * 89 89 * The authoritative list of format modifier codes is found in 90 90 * `include/uapi/drm/drm_fourcc.h` 91 + * 92 + * Open Source User Waiver 93 + * ----------------------- 94 + * 95 + * Because this is the authoritative source for pixel formats and modifiers 96 + * referenced by GL, Vulkan extensions and other standards and hence used both 97 + * by open source and closed source driver stacks, the usual requirement for an 98 + * upstream in-kernel or open source userspace user does not apply. 99 + * 100 + * To ensure, as much as feasible, compatibility across stacks and avoid 101 + * confusion with incompatible enumerations stakeholders for all relevant driver 102 + * stacks should approve additions. 91 103 */ 92 104 93 105 #define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \