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

Merge tag 'drm-misc-next-2025-05-08' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next

drm-misc-next for v6.16-rc1:

Cross-subsystem Changes:
- Change vsprintf %p4cn to %p4chR, remove %p4cn.

Core Changes:
- Documentation updates (fb rendering, actual_brightness)

Driver Changes:
- Small fixes to appletbdrm, panthor, st7571-i2c, rockchip, renesas,
panic handler, gpusvm, vkms, panel timings.
- Add AUO B140QAN08.H, BOE NE140WUM-N6S, CSW MNE007QS3-8, BOE TD4320 panels.
- Convert rk3066_hdmi to bridge driver.
- Improve HPD on anx7625.
- Speed up loading tegra firmware, and other small fixes to tegra & host1x.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://lore.kernel.org/r/5428be12-fc08-4e28-8c5f-85d73b8a7e04@linux.intel.com

Dave Airlie f9fa0122 80669042

+717 -312
+6 -1
Documentation/ABI/stable/sysfs-class-backlight
··· 26 26 KernelVersion: 2.6.17 27 27 Contact: Richard Purdie <rpurdie@rpsys.net> 28 28 Description: 29 - Show the actual brightness by querying the hardware. 29 + Show the actual brightness by querying the hardware. Due 30 + to implementation differences in hardware this may not 31 + match the value in 'brightness'. For example some hardware 32 + may treat blanking differently or have custom power saving 33 + features. Userspace should generally use the values in 34 + 'brightness' to make decisions. 30 35 Users: HAL 31 36 32 37 What: /sys/class/backlight/<backlight>/max_brightness
+5 -5
Documentation/core-api/printk-formats.rst
··· 652 652 ------------------- 653 653 654 654 :: 655 - %p4c[hnlb] gP00 (0x67503030) 655 + %p4c[h[R]lb] gP00 (0x67503030) 656 656 657 657 Print a generic FourCC code, as both ASCII characters and its numerical 658 658 value as hexadecimal. ··· 660 660 The generic FourCC code is always printed in the big-endian format, 661 661 the most significant byte first. This is the opposite of V4L/DRM FourCCs. 662 662 663 - The additional ``h``, ``n``, ``l``, and ``b`` specifiers define what 663 + The additional ``h``, ``hR``, ``l``, and ``b`` specifiers define what 664 664 endianness is used to load the stored bytes. The data might be interpreted 665 - using the host byte order, network byte order, little-endian, or big-endian. 665 + using the host, reversed host byte order, little-endian, or big-endian. 666 666 667 667 Passed by reference. 668 668 669 669 Examples for a little-endian machine, given &(u32)0x67503030:: 670 670 671 671 %p4ch gP00 (0x67503030) 672 - %p4cn 00Pg (0x30305067) 672 + %p4chR 00Pg (0x30305067) 673 673 %p4cl gP00 (0x67503030) 674 674 %p4cb 00Pg (0x30305067) 675 675 676 676 Examples for a big-endian machine, given &(u32)0x67503030:: 677 677 678 678 %p4ch gP00 (0x67503030) 679 - %p4cn 00Pg (0x30305067) 679 + %p4chR 00Pg (0x30305067) 680 680 %p4cl 00Pg (0x30305067) 681 681 %p4cb gP00 (0x67503030) 682 682
+65
Documentation/devicetree/bindings/display/panel/boe,td4320.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/boe,td4320.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: BOE TD4320 MIPI-DSI panels 8 + 9 + maintainers: 10 + - Barnabas Czeman <barnabas.czeman@mainlining.org> 11 + 12 + description: 13 + BOE TD4320 6.3" 1080x2340 panel found in Xiaomi Redmi Note 7 smartphone. 14 + 15 + allOf: 16 + - $ref: panel-common.yaml# 17 + 18 + properties: 19 + compatible: 20 + items: 21 + - const: boe,td4320 22 + 23 + reg: 24 + maxItems: 1 25 + 26 + iovcc-supply: 27 + description: I/O voltage rail 28 + 29 + vsn-supply: 30 + description: Negative source voltage rail 31 + 32 + vsp-supply: 33 + description: Positive source voltage rail 34 + 35 + required: 36 + - compatible 37 + - reg 38 + - reset-gpios 39 + - port 40 + 41 + unevaluatedProperties: false 42 + 43 + examples: 44 + - | 45 + #include <dt-bindings/gpio/gpio.h> 46 + 47 + dsi { 48 + #address-cells = <1>; 49 + #size-cells = <0>; 50 + 51 + panel@0 { 52 + compatible = "boe,td4320"; 53 + reg = <0>; 54 + backlight = <&backlight>; 55 + reset-gpios = <&tlmm 45 GPIO_ACTIVE_LOW>; 56 + 57 + port { 58 + panel_in: endpoint { 59 + remote-endpoint = <&dsi_out>; 60 + }; 61 + }; 62 + }; 63 + }; 64 + 65 + ...
+1
Documentation/devicetree/bindings/display/panel/leadtek,ltk050h3146w.yaml
··· 23 23 maxItems: 1 24 24 25 25 backlight: true 26 + port: true 26 27 reset-gpios: true 27 28 iovcc-supply: 28 29 description: regulator that supplies the iovcc voltage
+1
Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
··· 22 22 maxItems: 1 23 23 24 24 backlight: true 25 + port: true 25 26 reset-gpios: true 26 27 iovcc-supply: 27 28 description: regulator that supplies the iovcc voltage
+11 -9
Documentation/devicetree/bindings/display/rockchip/rockchip,inno-hdmi.yaml
··· 23 23 maxItems: 1 24 24 25 25 clocks: 26 - minItems: 1 27 26 items: 28 27 - description: The HDMI controller main clock 29 28 - description: The HDMI PHY reference clock 30 29 31 30 clock-names: 32 - minItems: 1 33 31 items: 34 32 - const: pclk 35 33 - const: ref ··· 56 58 - port@0 57 59 - port@1 58 60 61 + rockchip,grf: 62 + $ref: /schemas/types.yaml#/definitions/phandle 63 + description: 64 + Phandle to GRF used for control the polarity of hsync/vsync of rk3036 65 + HDMI. 66 + 59 67 required: 60 68 - compatible 61 69 - reg ··· 81 77 const: rockchip,rk3036-inno-hdmi 82 78 83 79 then: 80 + required: 81 + - rockchip,grf 84 82 properties: 85 83 power-domains: false 86 84 ··· 93 87 const: rockchip,rk3128-inno-hdmi 94 88 95 89 then: 96 - properties: 97 - clocks: 98 - minItems: 2 99 - clock-names: 100 - minItems: 2 101 90 required: 102 91 - power-domains 103 92 ··· 107 106 compatible = "rockchip,rk3036-inno-hdmi"; 108 107 reg = <0x20034000 0x4000>; 109 108 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>; 110 - clocks = <&cru PCLK_HDMI>; 111 - clock-names = "pclk"; 109 + clocks = <&cru PCLK_HDMI>, <&cru SCLK_LCDC>; 110 + clock-names = "pclk", "ref"; 112 111 pinctrl-names = "default"; 113 112 pinctrl-0 = <&hdmi_ctl>; 113 + rockchip,grf = <&grf>; 114 114 #sound-dai-cells = <0>; 115 115 116 116 ports {
+24 -10
drivers/gpu/drm/bridge/analogix/anx7625.c
··· 1257 1257 usleep_range(11000, 12000); 1258 1258 1259 1259 /* Power on pin enable */ 1260 - gpiod_set_value(ctx->pdata.gpio_p_on, 1); 1260 + gpiod_set_value_cansleep(ctx->pdata.gpio_p_on, 1); 1261 1261 usleep_range(10000, 11000); 1262 1262 /* Power reset pin enable */ 1263 - gpiod_set_value(ctx->pdata.gpio_reset, 1); 1263 + gpiod_set_value_cansleep(ctx->pdata.gpio_reset, 1); 1264 1264 usleep_range(10000, 11000); 1265 1265 1266 1266 DRM_DEV_DEBUG_DRIVER(dev, "power on !\n"); ··· 1280 1280 return; 1281 1281 } 1282 1282 1283 - gpiod_set_value(ctx->pdata.gpio_reset, 0); 1283 + gpiod_set_value_cansleep(ctx->pdata.gpio_reset, 0); 1284 1284 usleep_range(1000, 1100); 1285 - gpiod_set_value(ctx->pdata.gpio_p_on, 0); 1285 + gpiod_set_value_cansleep(ctx->pdata.gpio_p_on, 0); 1286 1286 usleep_range(1000, 1100); 1287 1287 1288 1288 ret = regulator_bulk_disable(ARRAY_SIZE(ctx->pdata.supplies), ··· 1813 1813 struct device *dev = ctx->dev; 1814 1814 1815 1815 DRM_DEV_DEBUG_DRIVER(dev, "sink detect\n"); 1816 - 1817 - if (ctx->pdata.panel_bridge) 1818 - return connector_status_connected; 1819 1816 1820 1817 return ctx->hpd_status ? connector_status_connected : 1821 1818 connector_status_disconnected; ··· 2472 2475 return anx7625_edid_read(ctx); 2473 2476 } 2474 2477 2478 + static void anx7625_bridge_hpd_enable(struct drm_bridge *bridge) 2479 + { 2480 + struct anx7625_data *ctx = bridge_to_anx7625(bridge); 2481 + struct device *dev = ctx->dev; 2482 + 2483 + pm_runtime_get_sync(dev); 2484 + } 2485 + 2486 + static void anx7625_bridge_hpd_disable(struct drm_bridge *bridge) 2487 + { 2488 + struct anx7625_data *ctx = bridge_to_anx7625(bridge); 2489 + struct device *dev = ctx->dev; 2490 + 2491 + pm_runtime_put_sync(dev); 2492 + } 2493 + 2475 2494 static const struct drm_bridge_funcs anx7625_bridge_funcs = { 2476 2495 .attach = anx7625_bridge_attach, 2477 2496 .detach = anx7625_bridge_detach, ··· 2501 2488 .atomic_reset = drm_atomic_helper_bridge_reset, 2502 2489 .detect = anx7625_bridge_detect, 2503 2490 .edid_read = anx7625_bridge_edid_read, 2491 + .hpd_enable = anx7625_bridge_hpd_enable, 2492 + .hpd_disable = anx7625_bridge_hpd_disable, 2504 2493 }; 2505 2494 2506 2495 static int anx7625_register_i2c_dummy_clients(struct anx7625_data *ctx, ··· 2600 2585 platform->bridge.of_node = dev->of_node; 2601 2586 if (!anx7625_of_panel_on_aux_bus(dev)) 2602 2587 platform->bridge.ops |= DRM_BRIDGE_OP_EDID; 2603 - if (!platform->pdata.panel_bridge) 2604 - platform->bridge.ops |= DRM_BRIDGE_OP_HPD | 2605 - DRM_BRIDGE_OP_DETECT; 2588 + if (!platform->pdata.panel_bridge || !anx7625_of_panel_on_aux_bus(dev)) 2589 + platform->bridge.ops |= DRM_BRIDGE_OP_HPD | DRM_BRIDGE_OP_DETECT; 2606 2590 platform->bridge.type = platform->pdata.panel_bridge ? 2607 2591 DRM_MODE_CONNECTOR_eDP : 2608 2592 DRM_MODE_CONNECTOR_DisplayPort;
+6
drivers/gpu/drm/drm_blend.c
··· 75 75 * the currently visible vertical area of the &drm_crtc. 76 76 * FB_ID: 77 77 * Mode object ID of the &drm_framebuffer this plane should scan out. 78 + * 79 + * When a KMS client is performing front-buffer rendering, it should set 80 + * FB_ID to the same front-buffer FB on each atomic commit. This implies 81 + * to the driver that it needs to re-read the same FB again. Otherwise 82 + * drivers which do not employ continuously repeated scanout cycles might 83 + * not update the screen. 78 84 * CRTC_ID: 79 85 * Mode object ID of the &drm_crtc this plane should be connected to. 80 86 *
-4
drivers/gpu/drm/drm_gpusvm.c
··· 1330 1330 unsigned long num_dma_mapped; 1331 1331 unsigned int order = 0; 1332 1332 unsigned long *pfns; 1333 - struct page **pages; 1334 1333 int err = 0; 1335 1334 struct dev_pagemap *pagemap; 1336 1335 struct drm_pagemap *dpagemap; ··· 1368 1369 if (err) 1369 1370 goto err_free; 1370 1371 1371 - pages = (struct page **)pfns; 1372 1372 map_pages: 1373 1373 /* 1374 1374 * Perform all dma mappings under the notifier lock to not ··· 1442 1444 err = -EFAULT; 1443 1445 goto err_unmap; 1444 1446 } 1445 - 1446 - pages[i] = page; 1447 1447 } else { 1448 1448 dma_addr_t addr; 1449 1449
+48 -23
drivers/gpu/drm/drm_panic_qr.rs
··· 366 366 SegmentIterator { 367 367 segment: self, 368 368 offset: 0, 369 - carry: 0, 370 - carry_len: 0, 369 + decfifo: Default::default(), 370 + } 371 + } 372 + } 373 + 374 + /// Max fifo size is 17 (max push) + 2 (max remaining) 375 + const MAX_FIFO_SIZE: usize = 19; 376 + 377 + /// A simple Decimal digit FIFO 378 + #[derive(Default)] 379 + struct DecFifo { 380 + decimals: [u8; MAX_FIFO_SIZE], 381 + len: usize, 382 + } 383 + 384 + impl DecFifo { 385 + fn push(&mut self, data: u64, len: usize) { 386 + let mut chunk = data; 387 + for i in (0..self.len).rev() { 388 + self.decimals[i + len] = self.decimals[i]; 389 + } 390 + for i in 0..len { 391 + self.decimals[i] = (chunk % 10) as u8; 392 + chunk /= 10; 393 + } 394 + self.len += len; 395 + } 396 + 397 + /// Pop 3 decimal digits from the FIFO 398 + fn pop3(&mut self) -> Option<(u16, usize)> { 399 + if self.len == 0 { 400 + None 401 + } else { 402 + let poplen = 3.min(self.len); 403 + self.len -= poplen; 404 + let mut out = 0; 405 + let mut exp = 1; 406 + for i in 0..poplen { 407 + out += self.decimals[self.len + i] as u16 * exp; 408 + exp *= 10; 409 + } 410 + Some((out, NUM_CHARS_BITS[poplen])) 371 411 } 372 412 } 373 413 } ··· 415 375 struct SegmentIterator<'a> { 416 376 segment: &'a Segment<'a>, 417 377 offset: usize, 418 - carry: u64, 419 - carry_len: usize, 378 + decfifo: DecFifo, 420 379 } 421 380 422 381 impl Iterator for SegmentIterator<'_> { ··· 433 394 } 434 395 } 435 396 Segment::Numeric(data) => { 436 - if self.carry_len < 3 && self.offset < data.len() { 437 - // If there are less than 3 decimal digits in the carry, 438 - // take the next 7 bytes of input, and add them to the carry. 397 + if self.decfifo.len < 3 && self.offset < data.len() { 398 + // If there are less than 3 decimal digits in the fifo, 399 + // take the next 7 bytes of input, and push them to the fifo. 439 400 let mut buf = [0u8; 8]; 440 401 let len = 7.min(data.len() - self.offset); 441 402 buf[..len].copy_from_slice(&data[self.offset..self.offset + len]); 442 403 let chunk = u64::from_le_bytes(buf); 443 - let pow = u64::pow(10, BYTES_TO_DIGITS[len] as u32); 444 - self.carry = chunk + self.carry * pow; 404 + self.decfifo.push(chunk, BYTES_TO_DIGITS[len]); 445 405 self.offset += len; 446 - self.carry_len += BYTES_TO_DIGITS[len]; 447 406 } 448 - match self.carry_len { 449 - 0 => None, 450 - len => { 451 - // take the next 3 decimal digits of the carry 452 - // and return 10bits of numeric data. 453 - let out_len = 3.min(len); 454 - self.carry_len -= out_len; 455 - let pow = u64::pow(10, self.carry_len as u32); 456 - let out = (self.carry / pow) as u16; 457 - self.carry %= pow; 458 - Some((out, NUM_CHARS_BITS[out_len])) 459 - } 460 - } 407 + self.decfifo.pop3() 461 408 } 462 409 } 463 410 }
+9
drivers/gpu/drm/panel/Kconfig
··· 67 67 24 bit RGB per pixel. It provides a MIPI DSI interface to 68 68 the host and has a built-in LED backlight. 69 69 70 + config DRM_PANEL_BOE_TD4320 71 + tristate "BOE TD4320 DSI panel" 72 + depends on OF 73 + depends on DRM_MIPI_DSI 74 + depends on BACKLIGHT_CLASS_DEVICE 75 + help 76 + Say Y here if you want to enable support for BOE TD4320 1080x2340 77 + video mode panel found in Xiaomi Redmi Note 7 smartphones. 78 + 70 79 config DRM_PANEL_BOE_TH101MB31UIG002_28A 71 80 tristate "Boe TH101MB31UIG002-28A panel" 72 81 depends on OF
+1
drivers/gpu/drm/panel/Makefile
··· 5 5 obj-$(CONFIG_DRM_PANEL_AUO_A030JTN01) += panel-auo-a030jtn01.o 6 6 obj-$(CONFIG_DRM_PANEL_BOE_BF060Y8M_AJ0) += panel-boe-bf060y8m-aj0.o 7 7 obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o 8 + obj-$(CONFIG_DRM_PANEL_BOE_TD4320) += panel-boe-td4320.o 8 9 obj-$(CONFIG_DRM_PANEL_BOE_TH101MB31UIG002_28A) += panel-boe-th101mb31ig002-28a.o 9 10 obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_LL2) += panel-boe-tv101wum-ll2.o 10 11 obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o
+247
drivers/gpu/drm/panel/panel-boe-td4320.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + // Copyright (c) 2024 Barnabas Czeman <barnabas.czeman@mainlining.org> 3 + // Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree: 4 + // Copyright (c) 2013, The Linux Foundation. All rights reserved. 5 + 6 + #include <linux/delay.h> 7 + #include <linux/gpio/consumer.h> 8 + #include <linux/mod_devicetable.h> 9 + #include <linux/module.h> 10 + #include <linux/regulator/consumer.h> 11 + 12 + #include <video/mipi_display.h> 13 + 14 + #include <drm/drm_mipi_dsi.h> 15 + #include <drm/drm_modes.h> 16 + #include <drm/drm_panel.h> 17 + #include <drm/drm_probe_helper.h> 18 + 19 + struct boe_td4320 { 20 + struct drm_panel panel; 21 + struct mipi_dsi_device *dsi; 22 + struct regulator_bulk_data *supplies; 23 + struct gpio_desc *reset_gpio; 24 + }; 25 + 26 + static const struct regulator_bulk_data boe_td4320_supplies[] = { 27 + { .supply = "iovcc" }, 28 + { .supply = "vsn" }, 29 + { .supply = "vsp" }, 30 + }; 31 + 32 + static inline struct boe_td4320 *to_boe_td4320(struct drm_panel *panel) 33 + { 34 + return container_of(panel, struct boe_td4320, panel); 35 + } 36 + 37 + static void boe_td4320_reset(struct boe_td4320 *ctx) 38 + { 39 + gpiod_set_value_cansleep(ctx->reset_gpio, 0); 40 + usleep_range(1000, 2000); 41 + gpiod_set_value_cansleep(ctx->reset_gpio, 1); 42 + usleep_range(5000, 6000); 43 + gpiod_set_value_cansleep(ctx->reset_gpio, 0); 44 + msleep(30); 45 + } 46 + 47 + static int boe_td4320_on(struct boe_td4320 *ctx) 48 + { 49 + struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; 50 + 51 + ctx->dsi->mode_flags |= MIPI_DSI_MODE_LPM; 52 + 53 + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb0, 0x04); 54 + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xd6, 0x00); 55 + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb8, 56 + 0x19, 0x55, 0x00, 0xbe, 0x00, 0x00, 57 + 0x00); 58 + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb9, 59 + 0x4d, 0x55, 0x05, 0xe6, 0x00, 0x02, 60 + 0x03); 61 + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xba, 62 + 0x9b, 0x5b, 0x07, 0xe6, 0x00, 0x13, 63 + 0x00); 64 + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xf9, 65 + 0x44, 0x3f, 0x00, 0x8d, 0xbf); 66 + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xce, 67 + 0x5d, 0x00, 0x0f, 0x1f, 0x2f, 0x3f, 68 + 0x4f, 0x5f, 0x6f, 0x7f, 0x8f, 0x9f, 69 + 0xaf, 0xbf, 0xcf, 0xdf, 0xef, 0xff, 70 + 0x04, 0x00, 0x02, 0x02, 0x42, 0x01, 71 + 0x69, 0x5a, 0x40, 0x40, 0x00, 0x00, 72 + 0x04, 0xfa, 0x00); 73 + mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, 0x00b8); 74 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY, 75 + 0x2c); 76 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_POWER_SAVE, 0x00); 77 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb0, 0x03); 78 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x11, 0x00); 79 + mipi_dsi_msleep(&dsi_ctx, 96); 80 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x29, 0x00); 81 + mipi_dsi_msleep(&dsi_ctx, 20); 82 + 83 + return dsi_ctx.accum_err; 84 + } 85 + 86 + static int boe_td4320_off(struct boe_td4320 *ctx) 87 + { 88 + struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; 89 + 90 + ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; 91 + 92 + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); 93 + mipi_dsi_msleep(&dsi_ctx, 20); 94 + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); 95 + mipi_dsi_msleep(&dsi_ctx, 120); 96 + 97 + return dsi_ctx.accum_err; 98 + } 99 + 100 + static int boe_td4320_prepare(struct drm_panel *panel) 101 + { 102 + struct boe_td4320 *ctx = to_boe_td4320(panel); 103 + struct device *dev = &ctx->dsi->dev; 104 + int ret; 105 + 106 + ret = regulator_bulk_enable(ARRAY_SIZE(boe_td4320_supplies), ctx->supplies); 107 + if (ret < 0) { 108 + dev_err(dev, "Failed to enable regulators: %d\n", ret); 109 + return ret; 110 + } 111 + 112 + boe_td4320_reset(ctx); 113 + 114 + ret = boe_td4320_on(ctx); 115 + if (ret < 0) { 116 + dev_err(dev, "Failed to initialize panel: %d\n", ret); 117 + gpiod_set_value_cansleep(ctx->reset_gpio, 1); 118 + regulator_bulk_disable(ARRAY_SIZE(boe_td4320_supplies), ctx->supplies); 119 + return ret; 120 + } 121 + 122 + return 0; 123 + } 124 + 125 + static int boe_td4320_unprepare(struct drm_panel *panel) 126 + { 127 + struct boe_td4320 *ctx = to_boe_td4320(panel); 128 + struct device *dev = &ctx->dsi->dev; 129 + int ret; 130 + 131 + ret = boe_td4320_off(ctx); 132 + if (ret < 0) 133 + dev_err(dev, "Failed to un-initialize panel: %d\n", ret); 134 + 135 + gpiod_set_value_cansleep(ctx->reset_gpio, 1); 136 + regulator_bulk_disable(ARRAY_SIZE(boe_td4320_supplies), ctx->supplies); 137 + 138 + return 0; 139 + } 140 + 141 + static const struct drm_display_mode boe_td4320_mode = { 142 + .clock = (1080 + 86 + 2 + 100) * (2340 + 4 + 4 + 60) * 60 / 1000, 143 + .hdisplay = 1080, 144 + .hsync_start = 1080 + 86, 145 + .hsync_end = 1080 + 86 + 2, 146 + .htotal = 1080 + 86 + 2 + 100, 147 + .vdisplay = 2340, 148 + .vsync_start = 2340 + 4, 149 + .vsync_end = 2340 + 4 + 4, 150 + .vtotal = 2340 + 4 + 4 + 60, 151 + .width_mm = 67, 152 + .height_mm = 145, 153 + .type = DRM_MODE_TYPE_DRIVER, 154 + }; 155 + 156 + static int boe_td4320_get_modes(struct drm_panel *panel, 157 + struct drm_connector *connector) 158 + { 159 + return drm_connector_helper_get_modes_fixed(connector, &boe_td4320_mode); 160 + } 161 + 162 + static const struct drm_panel_funcs boe_td4320_panel_funcs = { 163 + .prepare = boe_td4320_prepare, 164 + .unprepare = boe_td4320_unprepare, 165 + .get_modes = boe_td4320_get_modes, 166 + }; 167 + 168 + static int boe_td4320_probe(struct mipi_dsi_device *dsi) 169 + { 170 + struct device *dev = &dsi->dev; 171 + struct boe_td4320 *ctx; 172 + int ret; 173 + 174 + ctx = devm_drm_panel_alloc(dev, struct boe_td4320, panel, 175 + &boe_td4320_panel_funcs, 176 + DRM_MODE_CONNECTOR_DSI); 177 + if (IS_ERR(ctx)) 178 + return PTR_ERR(ctx); 179 + 180 + ret = devm_regulator_bulk_get_const(dev, 181 + ARRAY_SIZE(boe_td4320_supplies), 182 + boe_td4320_supplies, 183 + &ctx->supplies); 184 + if (ret < 0) 185 + return ret; 186 + 187 + ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); 188 + if (IS_ERR(ctx->reset_gpio)) 189 + return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), 190 + "Failed to get reset-gpios\n"); 191 + 192 + ctx->dsi = dsi; 193 + mipi_dsi_set_drvdata(dsi, ctx); 194 + 195 + dsi->lanes = 4; 196 + dsi->format = MIPI_DSI_FMT_RGB888; 197 + dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 198 + MIPI_DSI_CLOCK_NON_CONTINUOUS; 199 + 200 + ctx->panel.prepare_prev_first = true; 201 + 202 + ret = drm_panel_of_backlight(&ctx->panel); 203 + if (ret) 204 + return dev_err_probe(dev, ret, "Failed to get backlight\n"); 205 + 206 + drm_panel_add(&ctx->panel); 207 + 208 + ret = mipi_dsi_attach(dsi); 209 + if (ret < 0) { 210 + drm_panel_remove(&ctx->panel); 211 + return dev_err_probe(dev, ret, "Failed to attach to DSI host\n"); 212 + } 213 + 214 + return 0; 215 + } 216 + 217 + static void boe_td4320_remove(struct mipi_dsi_device *dsi) 218 + { 219 + struct boe_td4320 *ctx = mipi_dsi_get_drvdata(dsi); 220 + int ret; 221 + 222 + ret = mipi_dsi_detach(dsi); 223 + if (ret < 0) 224 + dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); 225 + 226 + drm_panel_remove(&ctx->panel); 227 + } 228 + 229 + static const struct of_device_id boe_td4320_of_match[] = { 230 + { .compatible = "boe,td4320" }, 231 + { /* sentinel */ } 232 + }; 233 + MODULE_DEVICE_TABLE(of, boe_td4320_of_match); 234 + 235 + static struct mipi_dsi_driver boe_td4320_driver = { 236 + .probe = boe_td4320_probe, 237 + .remove = boe_td4320_remove, 238 + .driver = { 239 + .name = "panel-boe-td4320", 240 + .of_match_table = boe_td4320_of_match, 241 + }, 242 + }; 243 + module_mipi_dsi_driver(boe_td4320_driver); 244 + 245 + MODULE_AUTHOR("Barnabas Czeman <barnabas.czeman@mainlining.org>"); 246 + MODULE_DESCRIPTION("DRM driver for boe td4320 fhdplus video mode dsi panel"); 247 + MODULE_LICENSE("GPL");
+10
drivers/gpu/drm/panel/panel-edp.c
··· 1762 1762 .enable = 50, 1763 1763 }; 1764 1764 1765 + static const struct panel_delay delay_80_500_e80_p2e200 = { 1766 + .hpd_absent = 80, 1767 + .unprepare = 500, 1768 + .enable = 80, 1769 + .prepare_to_enable = 200, 1770 + }; 1771 + 1765 1772 static const struct panel_delay delay_100_500_e200 = { 1766 1773 .hpd_absent = 100, 1767 1774 .unprepare = 500, ··· 1884 1877 EDP_PANEL_ENTRY('A', 'U', 'O', 0xa199, &delay_200_500_e50, "B116XAN06.1"), 1885 1878 EDP_PANEL_ENTRY('A', 'U', 'O', 0xa7b3, &delay_200_500_e50, "B140UAN04.4"), 1886 1879 EDP_PANEL_ENTRY('A', 'U', 'O', 0xc4b4, &delay_200_500_e50, "B116XAT04.1"), 1880 + EDP_PANEL_ENTRY('A', 'U', 'O', 0xc9a8, &delay_200_500_e50, "B140QAN08.H"), 1887 1881 EDP_PANEL_ENTRY('A', 'U', 'O', 0xd497, &delay_200_500_e50, "B120XAN01.0"), 1888 1882 EDP_PANEL_ENTRY('A', 'U', 'O', 0xf390, &delay_200_500_e50, "B140XTN07.7"), 1889 1883 ··· 1945 1937 EDP_PANEL_ENTRY('B', 'O', 'E', 0x0c93, &delay_200_500_e200, "Unknown"), 1946 1938 EDP_PANEL_ENTRY('B', 'O', 'E', 0x0cb6, &delay_200_500_e200, "NT116WHM-N44"), 1947 1939 EDP_PANEL_ENTRY('B', 'O', 'E', 0x0cfa, &delay_200_500_e50, "NV116WHM-A4D"), 1940 + EDP_PANEL_ENTRY('B', 'O', 'E', 0x0d73, &delay_200_500_e80, "NE140WUM-N6S"), 1948 1941 1949 1942 EDP_PANEL_ENTRY('C', 'M', 'N', 0x1130, &delay_200_500_e50, "N116BGE-EB2"), 1950 1943 EDP_PANEL_ENTRY('C', 'M', 'N', 0x1132, &delay_200_500_e80_d50, "N116BGE-EA2"), ··· 1981 1972 EDP_PANEL_ENTRY('C', 'S', 'W', 0x1103, &delay_200_500_e80_d50, "MNB601LS1-3"), 1982 1973 EDP_PANEL_ENTRY('C', 'S', 'W', 0x1104, &delay_200_500_e50, "MNB601LS1-4"), 1983 1974 EDP_PANEL_ENTRY('C', 'S', 'W', 0x1448, &delay_200_500_e50, "MNE007QS3-7"), 1975 + EDP_PANEL_ENTRY('C', 'S', 'W', 0x1457, &delay_80_500_e80_p2e200, "MNE007QS3-8"), 1984 1976 1985 1977 EDP_PANEL_ENTRY('E', 'T', 'C', 0x0000, &delay_50_500_e200_d200_po2e335, "LP079QX1-SP0V"), 1986 1978
+13 -12
drivers/gpu/drm/panel/panel-simple.c
··· 1026 1026 }, 1027 1027 }; 1028 1028 1029 - static const struct drm_display_mode auo_g101evn010_mode = { 1030 - .clock = 68930, 1031 - .hdisplay = 1280, 1032 - .hsync_start = 1280 + 82, 1033 - .hsync_end = 1280 + 82 + 2, 1034 - .htotal = 1280 + 82 + 2 + 84, 1035 - .vdisplay = 800, 1036 - .vsync_start = 800 + 8, 1037 - .vsync_end = 800 + 8 + 2, 1038 - .vtotal = 800 + 8 + 2 + 6, 1029 + static const struct display_timing auo_g101evn010_timing = { 1030 + .pixelclock = { 64000000, 68930000, 85000000 }, 1031 + .hactive = { 1280, 1280, 1280 }, 1032 + .hfront_porch = { 8, 64, 256 }, 1033 + .hback_porch = { 8, 64, 256 }, 1034 + .hsync_len = { 40, 168, 767 }, 1035 + .vactive = { 800, 800, 800 }, 1036 + .vfront_porch = { 4, 8, 100 }, 1037 + .vback_porch = { 4, 8, 100 }, 1038 + .vsync_len = { 8, 16, 223 }, 1039 1039 }; 1040 1040 1041 1041 static const struct panel_desc auo_g101evn010 = { 1042 - .modes = &auo_g101evn010_mode, 1043 - .num_modes = 1, 1042 + .timings = &auo_g101evn010_timing, 1043 + .num_timings = 1, 1044 1044 .bpc = 6, 1045 1045 .size = { 1046 1046 .width = 216, 1047 1047 .height = 135, 1048 1048 }, 1049 1049 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG, 1050 + .bus_flags = DRM_BUS_FLAG_DE_HIGH, 1050 1051 .connector_type = DRM_MODE_CONNECTOR_LVDS, 1051 1052 }; 1052 1053
+5
drivers/gpu/drm/panthor/panthor_gem.c
··· 42 42 mutex_unlock(&ptdev->gems.lock); 43 43 } 44 44 45 + static void panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags) 46 + { 47 + bo->debugfs.flags = usage_flags | PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED; 48 + } 45 49 #else 46 50 static void panthor_gem_debugfs_bo_add(struct panthor_device *ptdev, 47 51 struct panthor_gem_object *bo) 48 52 {} 49 53 static void panthor_gem_debugfs_bo_rm(struct panthor_gem_object *bo) {} 54 + static void panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags) {} 50 55 #endif 51 56 52 57 static void panthor_gem_free_object(struct drm_gem_object *obj)
-8
drivers/gpu/drm/panthor/panthor_gem.h
··· 212 212 #ifdef CONFIG_DEBUG_FS 213 213 void panthor_gem_debugfs_print_bos(struct panthor_device *pfdev, 214 214 struct seq_file *m); 215 - static inline void 216 - panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags) 217 - { 218 - bo->debugfs.flags = usage_flags | PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED; 219 - } 220 - 221 - #else 222 - void panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags) {}; 223 215 #endif 224 216 225 217 #endif /* __PANTHOR_GEM_H__ */
-5
drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
··· 32 32 } lut; 33 33 }; 34 34 35 - static inline int rcar_cmm_read(struct rcar_cmm *rcmm, u32 reg) 36 - { 37 - return ioread32(rcmm->base + reg); 38 - } 39 - 40 35 static inline void rcar_cmm_write(struct rcar_cmm *rcmm, u32 reg, u32 data) 41 36 { 42 37 iowrite32(data, rcmm->base + reg);
+4 -6
drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
··· 705 705 ret = of_parse_phandle_with_fixed_args(np, vsps_prop_name, 706 706 cells, i, &args); 707 707 if (ret < 0) 708 - goto error; 708 + goto done; 709 709 710 710 /* 711 711 * Add the VSP to the list or update the corresponding existing ··· 743 743 vsp->dev = rcdu; 744 744 745 745 ret = rcar_du_vsp_init(vsp, vsps[i].np, vsps[i].crtcs_mask); 746 - if (ret < 0) 747 - goto error; 746 + if (ret) 747 + goto done; 748 748 } 749 749 750 - return 0; 751 - 752 - error: 750 + done: 753 751 for (i = 0; i < ARRAY_SIZE(vsps); ++i) 754 752 of_node_put(vsps[i].np); 755 753
+1
drivers/gpu/drm/rockchip/Kconfig
··· 2 2 config DRM_ROCKCHIP 3 3 tristate "DRM Support for Rockchip" 4 4 depends on DRM && ROCKCHIP_IOMMU 5 + depends on OF 5 6 select DRM_CLIENT_SELECTION 6 7 select DRM_GEM_DMA_HELPER 7 8 select DRM_KMS_HELPER
+41 -14
drivers/gpu/drm/rockchip/inno_hdmi.c
··· 10 10 #include <linux/delay.h> 11 11 #include <linux/err.h> 12 12 #include <linux/hdmi.h> 13 + #include <linux/mfd/syscon.h> 13 14 #include <linux/mod_devicetable.h> 14 15 #include <linux/module.h> 15 16 #include <linux/mutex.h> 16 17 #include <linux/platform_device.h> 18 + #include <linux/regmap.h> 17 19 18 20 #include <drm/drm_atomic.h> 19 21 #include <drm/drm_atomic_helper.h> ··· 31 29 32 30 #include "inno_hdmi.h" 33 31 32 + #define HIWORD_UPDATE(val, mask) ((val) | (mask) << 16) 33 + 34 34 #define INNO_HDMI_MIN_TMDS_CLOCK 25000000U 35 + 36 + #define RK3036_GRF_SOC_CON2 0x148 37 + #define RK3036_HDMI_PHSYNC BIT(4) 38 + #define RK3036_HDMI_PVSYNC BIT(5) 39 + 40 + enum inno_hdmi_dev_type { 41 + RK3036_HDMI, 42 + RK3128_HDMI, 43 + }; 35 44 36 45 struct inno_hdmi_phy_config { 37 46 unsigned long pixelclock; ··· 51 38 }; 52 39 53 40 struct inno_hdmi_variant { 41 + enum inno_hdmi_dev_type dev_type; 54 42 struct inno_hdmi_phy_config *phy_configs; 55 43 struct inno_hdmi_phy_config *default_phy_config; 56 44 }; ··· 72 58 struct clk *pclk; 73 59 struct clk *refclk; 74 60 void __iomem *regs; 61 + struct regmap *grf; 75 62 76 63 struct drm_connector connector; 77 64 struct rockchip_encoder encoder; ··· 389 374 static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi, 390 375 struct drm_display_mode *mode) 391 376 { 392 - int value; 377 + int value, psync; 378 + 379 + if (hdmi->variant->dev_type == RK3036_HDMI) { 380 + psync = mode->flags & DRM_MODE_FLAG_PHSYNC ? RK3036_HDMI_PHSYNC : 0; 381 + value = HIWORD_UPDATE(psync, RK3036_HDMI_PHSYNC); 382 + psync = mode->flags & DRM_MODE_FLAG_PVSYNC ? RK3036_HDMI_PVSYNC : 0; 383 + value |= HIWORD_UPDATE(psync, RK3036_HDMI_PVSYNC); 384 + regmap_write(hdmi->grf, RK3036_GRF_SOC_CON2, value); 385 + } 393 386 394 387 /* Set detail external video timing polarity and interlace mode */ 395 388 value = v_EXTERANL_VIDEO(1); ··· 908 885 return PTR_ERR(hdmi->regs); 909 886 910 887 hdmi->pclk = devm_clk_get(hdmi->dev, "pclk"); 911 - if (IS_ERR(hdmi->pclk)) { 912 - DRM_DEV_ERROR(hdmi->dev, "Unable to get HDMI pclk clk\n"); 913 - return PTR_ERR(hdmi->pclk); 914 - } 888 + if (IS_ERR(hdmi->pclk)) 889 + return dev_err_probe(dev, PTR_ERR(hdmi->pclk), "Unable to get HDMI pclk\n"); 915 890 916 891 ret = clk_prepare_enable(hdmi->pclk); 917 - if (ret) { 918 - DRM_DEV_ERROR(hdmi->dev, 919 - "Cannot enable HDMI pclk clock: %d\n", ret); 920 - return ret; 921 - } 892 + if (ret) 893 + return dev_err_probe(dev, ret, "Cannot enable HDMI pclk: %d\n", ret); 922 894 923 895 hdmi->refclk = devm_clk_get_optional(hdmi->dev, "ref"); 924 896 if (IS_ERR(hdmi->refclk)) { 925 - DRM_DEV_ERROR(hdmi->dev, "Unable to get HDMI reference clock\n"); 926 - ret = PTR_ERR(hdmi->refclk); 897 + ret = dev_err_probe(dev, PTR_ERR(hdmi->refclk), "Unable to get HDMI refclk\n"); 927 898 goto err_disable_pclk; 928 899 } 929 900 930 901 ret = clk_prepare_enable(hdmi->refclk); 931 902 if (ret) { 932 - DRM_DEV_ERROR(hdmi->dev, 933 - "Cannot enable HDMI reference clock: %d\n", ret); 903 + ret = dev_err_probe(dev, ret, "Cannot enable HDMI refclk: %d\n", ret); 934 904 goto err_disable_pclk; 905 + } 906 + 907 + if (hdmi->variant->dev_type == RK3036_HDMI) { 908 + hdmi->grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); 909 + if (IS_ERR(hdmi->grf)) { 910 + ret = dev_err_probe(dev, PTR_ERR(hdmi->grf), 911 + "Unable to get rockchip,grf\n"); 912 + goto err_disable_clk; 913 + } 935 914 } 936 915 937 916 irq = platform_get_irq(pdev, 0); ··· 1020 995 } 1021 996 1022 997 static const struct inno_hdmi_variant rk3036_inno_hdmi_variant = { 998 + .dev_type = RK3036_HDMI, 1023 999 .phy_configs = rk3036_hdmi_phy_configs, 1024 1000 .default_phy_config = &rk3036_hdmi_phy_configs[1], 1025 1001 }; 1026 1002 1027 1003 static const struct inno_hdmi_variant rk3128_inno_hdmi_variant = { 1004 + .dev_type = RK3128_HDMI, 1028 1005 .phy_configs = rk3128_hdmi_phy_configs, 1029 1006 .default_phy_config = &rk3128_hdmi_phy_configs[1], 1030 1007 };
+146 -169
drivers/gpu/drm/rockchip/rk3066_hdmi.c
··· 5 5 */ 6 6 7 7 #include <drm/drm_atomic.h> 8 + #include <drm/drm_bridge_connector.h> 9 + #include <drm/display/drm_hdmi_helper.h> 10 + #include <drm/display/drm_hdmi_state_helper.h> 8 11 #include <drm/drm_edid.h> 9 12 #include <drm/drm_of.h> 10 13 #include <drm/drm_probe_helper.h> ··· 49 46 struct clk *hclk; 50 47 void __iomem *regs; 51 48 52 - struct drm_connector connector; 49 + struct drm_bridge bridge; 50 + struct drm_connector *connector; 53 51 struct rockchip_encoder encoder; 54 52 55 53 struct rk3066_hdmi_i2c *i2c; 56 - struct i2c_adapter *ddc; 57 54 58 55 unsigned int tmdsclk; 59 56 60 57 struct hdmi_data_info hdmi_data; 61 58 }; 62 59 63 - static struct rk3066_hdmi *encoder_to_rk3066_hdmi(struct drm_encoder *encoder) 60 + static struct rk3066_hdmi *bridge_to_rk3066_hdmi(struct drm_bridge *bridge) 64 61 { 65 - struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder); 66 - 67 - return container_of(rkencoder, struct rk3066_hdmi, encoder); 68 - } 69 - 70 - static struct rk3066_hdmi *connector_to_rk3066_hdmi(struct drm_connector *connector) 71 - { 72 - return container_of(connector, struct rk3066_hdmi, connector); 62 + return container_of(bridge, struct rk3066_hdmi, bridge); 73 63 } 74 64 75 65 static inline u8 hdmi_readb(struct rk3066_hdmi *hdmi, u16 offset) ··· 157 161 hdmi->tmdsclk = DEFAULT_PLLA_RATE; 158 162 } 159 163 160 - static int 161 - rk3066_hdmi_upload_frame(struct rk3066_hdmi *hdmi, int setup_rc, 162 - union hdmi_infoframe *frame, u32 frame_index, 163 - u32 mask, u32 disable, u32 enable) 164 + static int rk3066_hdmi_bridge_clear_infoframe(struct drm_bridge *bridge, 165 + enum hdmi_infoframe_type type) 164 166 { 165 - if (mask) 166 - hdmi_modb(hdmi, HDMI_CP_AUTO_SEND_CTRL, mask, disable); 167 + struct rk3066_hdmi *hdmi = bridge_to_rk3066_hdmi(bridge); 167 168 168 - hdmi_writeb(hdmi, HDMI_CP_BUF_INDEX, frame_index); 169 - 170 - if (setup_rc >= 0) { 171 - u8 packed_frame[HDMI_MAXIMUM_INFO_FRAME_SIZE]; 172 - ssize_t rc, i; 173 - 174 - rc = hdmi_infoframe_pack(frame, packed_frame, 175 - sizeof(packed_frame)); 176 - if (rc < 0) 177 - return rc; 178 - 179 - for (i = 0; i < rc; i++) 180 - hdmi_writeb(hdmi, HDMI_CP_BUF_ACC_HB0 + i * 4, 181 - packed_frame[i]); 182 - 183 - if (mask) 184 - hdmi_modb(hdmi, HDMI_CP_AUTO_SEND_CTRL, mask, enable); 169 + if (type != HDMI_INFOFRAME_TYPE_AVI) { 170 + drm_err(bridge->dev, "Unsupported infoframe type: %u\n", type); 171 + return 0; 185 172 } 186 173 187 - return setup_rc; 174 + hdmi_writeb(hdmi, HDMI_CP_BUF_INDEX, HDMI_INFOFRAME_AVI); 175 + 176 + return 0; 188 177 } 189 178 190 - static int rk3066_hdmi_config_avi(struct rk3066_hdmi *hdmi, 191 - struct drm_display_mode *mode) 179 + static int 180 + rk3066_hdmi_bridge_write_infoframe(struct drm_bridge *bridge, 181 + enum hdmi_infoframe_type type, 182 + const u8 *buffer, size_t len) 192 183 { 193 - union hdmi_infoframe frame; 194 - int rc; 184 + struct rk3066_hdmi *hdmi = bridge_to_rk3066_hdmi(bridge); 185 + ssize_t i; 195 186 196 - rc = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, 197 - &hdmi->connector, mode); 187 + if (type != HDMI_INFOFRAME_TYPE_AVI) { 188 + drm_err(bridge->dev, "Unsupported infoframe type: %u\n", type); 189 + return 0; 190 + } 198 191 199 - if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV444) 200 - frame.avi.colorspace = HDMI_COLORSPACE_YUV444; 201 - else if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV422) 202 - frame.avi.colorspace = HDMI_COLORSPACE_YUV422; 203 - else 204 - frame.avi.colorspace = HDMI_COLORSPACE_RGB; 192 + rk3066_hdmi_bridge_clear_infoframe(bridge, type); 205 193 206 - frame.avi.colorimetry = hdmi->hdmi_data.colorimetry; 207 - frame.avi.scan_mode = HDMI_SCAN_MODE_NONE; 194 + for (i = 0; i < len; i++) 195 + hdmi_writeb(hdmi, HDMI_CP_BUF_ACC_HB0 + i * 4, buffer[i]); 208 196 209 - return rk3066_hdmi_upload_frame(hdmi, rc, &frame, 210 - HDMI_INFOFRAME_AVI, 0, 0, 0); 197 + return 0; 211 198 } 212 199 213 200 static int rk3066_hdmi_config_video_timing(struct rk3066_hdmi *hdmi, ··· 303 324 } 304 325 305 326 static int rk3066_hdmi_setup(struct rk3066_hdmi *hdmi, 306 - struct drm_display_mode *mode) 327 + struct drm_atomic_state *state) 307 328 { 308 - struct drm_display_info *display = &hdmi->connector.display_info; 329 + struct drm_bridge *bridge = &hdmi->bridge; 330 + struct drm_connector *connector; 331 + struct drm_display_info *display; 332 + struct drm_display_mode *mode; 333 + struct drm_connector_state *new_conn_state; 334 + struct drm_crtc_state *new_crtc_state; 335 + 336 + connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); 337 + 338 + new_conn_state = drm_atomic_get_new_connector_state(state, connector); 339 + if (WARN_ON(!new_conn_state)) 340 + return -EINVAL; 341 + 342 + new_crtc_state = drm_atomic_get_new_crtc_state(state, new_conn_state->crtc); 343 + if (WARN_ON(!new_crtc_state)) 344 + return -EINVAL; 345 + 346 + display = &connector->display_info; 347 + mode = &new_crtc_state->adjusted_mode; 309 348 310 349 hdmi->hdmi_data.vic = drm_match_cea_mode(mode); 311 350 hdmi->hdmi_data.enc_out_format = HDMI_COLORSPACE_RGB; ··· 360 363 if (display->is_hdmi) { 361 364 hdmi_modb(hdmi, HDMI_HDCP_CTRL, HDMI_VIDEO_MODE_MASK, 362 365 HDMI_VIDEO_MODE_HDMI); 363 - rk3066_hdmi_config_avi(hdmi, mode); 366 + drm_atomic_helper_connector_hdmi_update_infoframes(connector, state); 364 367 } else { 365 368 hdmi_modb(hdmi, HDMI_HDCP_CTRL, HDMI_VIDEO_MODE_MASK, 0); 366 369 } ··· 383 386 return 0; 384 387 } 385 388 386 - static void rk3066_hdmi_encoder_enable(struct drm_encoder *encoder, 387 - struct drm_atomic_state *state) 389 + static void rk3066_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, 390 + struct drm_atomic_state *state) 388 391 { 389 - struct rk3066_hdmi *hdmi = encoder_to_rk3066_hdmi(encoder); 392 + struct rk3066_hdmi *hdmi = bridge_to_rk3066_hdmi(bridge); 390 393 struct drm_connector_state *conn_state; 391 394 struct drm_crtc_state *crtc_state; 392 395 int mux, val; 393 396 394 - conn_state = drm_atomic_get_new_connector_state(state, &hdmi->connector); 397 + conn_state = drm_atomic_get_new_connector_state(state, hdmi->connector); 395 398 if (WARN_ON(!conn_state)) 396 399 return; 397 400 ··· 399 402 if (WARN_ON(!crtc_state)) 400 403 return; 401 404 402 - mux = drm_of_encoder_active_endpoint_id(hdmi->dev->of_node, encoder); 405 + mux = drm_of_encoder_active_endpoint_id(hdmi->dev->of_node, &hdmi->encoder.encoder); 403 406 if (mux) 404 407 val = (HDMI_VIDEO_SEL << 16) | HDMI_VIDEO_SEL; 405 408 else ··· 410 413 DRM_DEV_DEBUG(hdmi->dev, "hdmi encoder enable select: vop%s\n", 411 414 (mux) ? "1" : "0"); 412 415 413 - rk3066_hdmi_setup(hdmi, &crtc_state->adjusted_mode); 416 + rk3066_hdmi_setup(hdmi, state); 414 417 } 415 418 416 - static void rk3066_hdmi_encoder_disable(struct drm_encoder *encoder, 417 - struct drm_atomic_state *state) 419 + static void rk3066_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, 420 + struct drm_atomic_state *state) 418 421 { 419 - struct rk3066_hdmi *hdmi = encoder_to_rk3066_hdmi(encoder); 422 + struct rk3066_hdmi *hdmi = bridge_to_rk3066_hdmi(bridge); 420 423 421 424 DRM_DEV_DEBUG(hdmi->dev, "hdmi encoder disable\n"); 422 425 ··· 447 450 static const 448 451 struct drm_encoder_helper_funcs rk3066_hdmi_encoder_helper_funcs = { 449 452 .atomic_check = rk3066_hdmi_encoder_atomic_check, 450 - .atomic_enable = rk3066_hdmi_encoder_enable, 451 - .atomic_disable = rk3066_hdmi_encoder_disable, 452 453 }; 453 454 454 455 static enum drm_connector_status 455 - rk3066_hdmi_connector_detect(struct drm_connector *connector, bool force) 456 + rk3066_hdmi_bridge_detect(struct drm_bridge *bridge) 456 457 { 457 - struct rk3066_hdmi *hdmi = connector_to_rk3066_hdmi(connector); 458 + struct rk3066_hdmi *hdmi = bridge_to_rk3066_hdmi(bridge); 458 459 459 460 return (hdmi_readb(hdmi, HDMI_HPG_MENS_STA) & HDMI_HPG_IN_STATUS_HIGH) ? 460 461 connector_status_connected : connector_status_disconnected; 461 462 } 462 463 463 - static int rk3066_hdmi_connector_get_modes(struct drm_connector *connector) 464 + static const struct drm_edid * 465 + rk3066_hdmi_bridge_edid_read(struct drm_bridge *bridge, struct drm_connector *connector) 464 466 { 465 - struct rk3066_hdmi *hdmi = connector_to_rk3066_hdmi(connector); 467 + struct rk3066_hdmi *hdmi = bridge_to_rk3066_hdmi(bridge); 466 468 const struct drm_edid *drm_edid; 467 - int ret = 0; 468 469 469 - if (!hdmi->ddc) 470 - return 0; 470 + drm_edid = drm_edid_read_ddc(connector, bridge->ddc); 471 + if (!drm_edid) 472 + dev_dbg(hdmi->dev, "failed to get edid\n"); 471 473 472 - drm_edid = drm_edid_read_ddc(connector, hdmi->ddc); 473 - drm_edid_connector_update(connector, drm_edid); 474 - ret = drm_edid_connector_add_modes(connector); 475 - drm_edid_free(drm_edid); 476 - 477 - return ret; 474 + return drm_edid; 478 475 } 479 476 480 477 static enum drm_mode_status 481 - rk3066_hdmi_connector_mode_valid(struct drm_connector *connector, 482 - const struct drm_display_mode *mode) 478 + rk3066_hdmi_bridge_mode_valid(struct drm_bridge *bridge, 479 + const struct drm_display_info *info, 480 + const struct drm_display_mode *mode) 483 481 { 484 482 u32 vic = drm_match_cea_mode(mode); 485 483 ··· 484 492 return MODE_BAD; 485 493 } 486 494 487 - static struct drm_encoder * 488 - rk3066_hdmi_connector_best_encoder(struct drm_connector *connector) 489 - { 490 - struct rk3066_hdmi *hdmi = connector_to_rk3066_hdmi(connector); 491 - 492 - return &hdmi->encoder.encoder; 493 - } 494 - 495 - static int 496 - rk3066_hdmi_probe_single_connector_modes(struct drm_connector *connector, 497 - uint32_t maxX, uint32_t maxY) 498 - { 499 - if (maxX > 1920) 500 - maxX = 1920; 501 - if (maxY > 1080) 502 - maxY = 1080; 503 - 504 - return drm_helper_probe_single_connector_modes(connector, maxX, maxY); 505 - } 506 - 507 - static void rk3066_hdmi_connector_destroy(struct drm_connector *connector) 508 - { 509 - drm_connector_unregister(connector); 510 - drm_connector_cleanup(connector); 511 - } 512 - 513 - static const struct drm_connector_funcs rk3066_hdmi_connector_funcs = { 514 - .fill_modes = rk3066_hdmi_probe_single_connector_modes, 515 - .detect = rk3066_hdmi_connector_detect, 516 - .destroy = rk3066_hdmi_connector_destroy, 517 - .reset = drm_atomic_helper_connector_reset, 518 - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, 519 - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, 495 + static const struct drm_bridge_funcs rk3066_hdmi_bridge_funcs = { 496 + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, 497 + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, 498 + .atomic_reset = drm_atomic_helper_bridge_reset, 499 + .atomic_enable = rk3066_hdmi_bridge_atomic_enable, 500 + .atomic_disable = rk3066_hdmi_bridge_atomic_disable, 501 + .detect = rk3066_hdmi_bridge_detect, 502 + .edid_read = rk3066_hdmi_bridge_edid_read, 503 + .hdmi_clear_infoframe = rk3066_hdmi_bridge_clear_infoframe, 504 + .hdmi_write_infoframe = rk3066_hdmi_bridge_write_infoframe, 505 + .mode_valid = rk3066_hdmi_bridge_mode_valid, 520 506 }; 521 507 522 - static const 523 - struct drm_connector_helper_funcs rk3066_hdmi_connector_helper_funcs = { 524 - .get_modes = rk3066_hdmi_connector_get_modes, 525 - .mode_valid = rk3066_hdmi_connector_mode_valid, 526 - .best_encoder = rk3066_hdmi_connector_best_encoder, 527 - }; 528 - 529 - static int 530 - rk3066_hdmi_register(struct drm_device *drm, struct rk3066_hdmi *hdmi) 531 - { 532 - struct drm_encoder *encoder = &hdmi->encoder.encoder; 533 - struct device *dev = hdmi->dev; 534 - 535 - encoder->possible_crtcs = 536 - drm_of_find_possible_crtcs(drm, dev->of_node); 537 - 538 - /* 539 - * If we failed to find the CRTC(s) which this encoder is 540 - * supposed to be connected to, it's because the CRTC has 541 - * not been registered yet. Defer probing, and hope that 542 - * the required CRTC is added later. 543 - */ 544 - if (encoder->possible_crtcs == 0) 545 - return -EPROBE_DEFER; 546 - 547 - drm_encoder_helper_add(encoder, &rk3066_hdmi_encoder_helper_funcs); 548 - drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); 549 - 550 - hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD; 551 - 552 - drm_connector_helper_add(&hdmi->connector, 553 - &rk3066_hdmi_connector_helper_funcs); 554 - drm_connector_init_with_ddc(drm, &hdmi->connector, 555 - &rk3066_hdmi_connector_funcs, 556 - DRM_MODE_CONNECTOR_HDMIA, 557 - hdmi->ddc); 558 - 559 - drm_connector_attach_encoder(&hdmi->connector, encoder); 560 - 561 - return 0; 562 - } 563 508 564 509 static irqreturn_t rk3066_hdmi_hardirq(int irq, void *dev_id) 565 510 { ··· 526 597 { 527 598 struct rk3066_hdmi *hdmi = dev_id; 528 599 529 - drm_helper_hpd_irq_event(hdmi->connector.dev); 600 + drm_helper_hpd_irq_event(hdmi->connector->dev); 530 601 531 602 return IRQ_HANDLED; 532 603 } ··· 649 720 strscpy(adap->name, "RK3066 HDMI", sizeof(adap->name)); 650 721 i2c_set_adapdata(adap, hdmi); 651 722 652 - ret = i2c_add_adapter(adap); 723 + ret = devm_i2c_add_adapter(hdmi->dev, adap); 653 724 if (ret) { 654 725 DRM_DEV_ERROR(hdmi->dev, "cannot add %s I2C adapter\n", 655 726 adap->name); ··· 662 733 DRM_DEV_DEBUG(hdmi->dev, "registered %s I2C bus driver\n", adap->name); 663 734 664 735 return adap; 736 + } 737 + 738 + static int 739 + rk3066_hdmi_register(struct drm_device *drm, struct rk3066_hdmi *hdmi) 740 + { 741 + struct drm_encoder *encoder = &hdmi->encoder.encoder; 742 + struct device *dev = hdmi->dev; 743 + int ret; 744 + 745 + encoder->possible_crtcs = 746 + drm_of_find_possible_crtcs(drm, dev->of_node); 747 + 748 + /* 749 + * If we failed to find the CRTC(s) which this encoder is 750 + * supposed to be connected to, it's because the CRTC has 751 + * not been registered yet. Defer probing, and hope that 752 + * the required CRTC is added later. 753 + */ 754 + if (encoder->possible_crtcs == 0) 755 + return -EPROBE_DEFER; 756 + 757 + drm_encoder_helper_add(encoder, &rk3066_hdmi_encoder_helper_funcs); 758 + drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); 759 + 760 + hdmi->bridge.driver_private = hdmi; 761 + hdmi->bridge.funcs = &rk3066_hdmi_bridge_funcs; 762 + hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | 763 + DRM_BRIDGE_OP_EDID | 764 + DRM_BRIDGE_OP_HDMI | 765 + DRM_BRIDGE_OP_HPD; 766 + hdmi->bridge.of_node = hdmi->dev->of_node; 767 + hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA; 768 + hdmi->bridge.vendor = "Rockchip"; 769 + hdmi->bridge.product = "RK3066 HDMI"; 770 + 771 + hdmi->bridge.ddc = rk3066_hdmi_i2c_adapter(hdmi); 772 + if (IS_ERR(hdmi->bridge.ddc)) 773 + return PTR_ERR(hdmi->bridge.ddc); 774 + 775 + if (IS_ERR(hdmi->bridge.ddc)) 776 + return PTR_ERR(hdmi->bridge.ddc); 777 + 778 + ret = devm_drm_bridge_add(dev, &hdmi->bridge); 779 + if (ret) 780 + return ret; 781 + 782 + ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); 783 + if (ret) 784 + return ret; 785 + 786 + hdmi->connector = drm_bridge_connector_init(drm, encoder); 787 + if (IS_ERR(hdmi->connector)) { 788 + ret = PTR_ERR(hdmi->connector); 789 + dev_err(hdmi->dev, "failed to init bridge connector: %d\n", ret); 790 + return ret; 791 + } 792 + 793 + drm_connector_attach_encoder(hdmi->connector, encoder); 794 + 795 + return 0; 665 796 } 666 797 667 798 static int rk3066_hdmi_bind(struct device *dev, struct device *master, ··· 770 781 /* internal hclk = hdmi_hclk / 25 */ 771 782 hdmi_writeb(hdmi, HDMI_INTERNAL_CLK_DIVIDER, 25); 772 783 773 - hdmi->ddc = rk3066_hdmi_i2c_adapter(hdmi); 774 - if (IS_ERR(hdmi->ddc)) { 775 - ret = PTR_ERR(hdmi->ddc); 776 - hdmi->ddc = NULL; 777 - goto err_disable_hclk; 778 - } 779 - 780 784 rk3066_hdmi_set_power_mode(hdmi, HDMI_SYS_POWER_MODE_B); 781 785 usleep_range(999, 1000); 782 786 hdmi_writeb(hdmi, HDMI_INTR_MASK1, HDMI_INTR_HOTPLUG); ··· 780 798 781 799 ret = rk3066_hdmi_register(drm, hdmi); 782 800 if (ret) 783 - goto err_disable_i2c; 801 + goto err_disable_hclk; 784 802 785 803 dev_set_drvdata(dev, hdmi); 786 804 ··· 795 813 return 0; 796 814 797 815 err_cleanup_hdmi: 798 - hdmi->connector.funcs->destroy(&hdmi->connector); 799 816 hdmi->encoder.encoder.funcs->destroy(&hdmi->encoder.encoder); 800 - err_disable_i2c: 801 - i2c_put_adapter(hdmi->ddc); 802 817 err_disable_hclk: 803 818 clk_disable_unprepare(hdmi->hclk); 804 819 ··· 807 828 { 808 829 struct rk3066_hdmi *hdmi = dev_get_drvdata(dev); 809 830 810 - hdmi->connector.funcs->destroy(&hdmi->connector); 811 831 hdmi->encoder.encoder.funcs->destroy(&hdmi->encoder.encoder); 812 832 813 - i2c_put_adapter(hdmi->ddc); 814 833 clk_disable_unprepare(hdmi->hclk); 815 834 } 816 835
+12 -5
drivers/gpu/drm/tegra/dc.c
··· 1321 1321 if (wgrp->dc == dc->pipe) { 1322 1322 for (j = 0; j < wgrp->num_windows; j++) { 1323 1323 unsigned int index = wgrp->windows[j]; 1324 + enum drm_plane_type type; 1325 + 1326 + if (primary) 1327 + type = DRM_PLANE_TYPE_OVERLAY; 1328 + else 1329 + type = DRM_PLANE_TYPE_PRIMARY; 1324 1330 1325 1331 plane = tegra_shared_plane_create(drm, dc, 1326 1332 wgrp->index, 1327 - index); 1333 + index, type); 1328 1334 if (IS_ERR(plane)) 1329 1335 return plane; 1330 1336 ··· 1338 1332 * Choose the first shared plane owned by this 1339 1333 * head as the primary plane. 1340 1334 */ 1341 - if (!primary) { 1342 - plane->type = DRM_PLANE_TYPE_PRIMARY; 1335 + if (!primary) 1343 1336 primary = plane; 1344 - } 1345 1337 } 1346 1338 } 1347 1339 } ··· 1393 1389 if (crtc->state) 1394 1390 tegra_crtc_atomic_destroy_state(crtc, crtc->state); 1395 1391 1396 - __drm_atomic_helper_crtc_reset(crtc, &state->base); 1392 + if (state) 1393 + __drm_atomic_helper_crtc_reset(crtc, &state->base); 1394 + else 1395 + __drm_atomic_helper_crtc_reset(crtc, NULL); 1397 1396 } 1398 1397 1399 1398 static struct drm_crtc_state *
+3 -8
drivers/gpu/drm/tegra/dpaux.c
··· 501 501 502 502 dpaux->vdd = devm_regulator_get_optional(&pdev->dev, "vdd"); 503 503 if (IS_ERR(dpaux->vdd)) { 504 - if (PTR_ERR(dpaux->vdd) != -ENODEV) { 505 - if (PTR_ERR(dpaux->vdd) != -EPROBE_DEFER) 506 - dev_err(&pdev->dev, 507 - "failed to get VDD supply: %ld\n", 508 - PTR_ERR(dpaux->vdd)); 509 - 510 - return PTR_ERR(dpaux->vdd); 511 - } 504 + if (PTR_ERR(dpaux->vdd) != -ENODEV) 505 + return dev_err_probe(&pdev->dev, PTR_ERR(dpaux->vdd), 506 + "failed to get VDD supply\n"); 512 507 513 508 dpaux->vdd = NULL; 514 509 }
+19 -1
drivers/gpu/drm/tegra/falcon.c
··· 30 30 (value == 0), 10, 100000); 31 31 } 32 32 33 + static int falcon_dma_wait_not_full(struct falcon *falcon) 34 + { 35 + u32 value; 36 + 37 + return readl_poll_timeout(falcon->regs + FALCON_DMATRFCMD, value, 38 + !(value & FALCON_DMATRFCMD_FULL), 10, 100000); 39 + } 40 + 33 41 static int falcon_dma_wait_idle(struct falcon *falcon) 34 42 { 35 43 u32 value; ··· 52 44 enum falcon_memory target) 53 45 { 54 46 u32 cmd = FALCON_DMATRFCMD_SIZE_256B; 47 + int err; 55 48 56 49 if (target == FALCON_MEMORY_IMEM) 57 50 cmd |= FALCON_DMATRFCMD_IMEM; ··· 65 56 */ 66 57 cmd |= FALCON_DMATRFCMD_DMACTX(1); 67 58 59 + err = falcon_dma_wait_not_full(falcon); 60 + if (err < 0) 61 + return err; 62 + 68 63 falcon_writel(falcon, offset, FALCON_DMATRFMOFFS); 69 64 falcon_writel(falcon, base, FALCON_DMATRFFBOFFS); 70 65 falcon_writel(falcon, cmd, FALCON_DMATRFCMD); 71 66 72 - return falcon_dma_wait_idle(falcon); 67 + return 0; 73 68 } 74 69 75 70 static void falcon_copy_firmware_image(struct falcon *falcon, ··· 203 190 for (offset = 0; offset < falcon->firmware.code.size; offset += 256) 204 191 falcon_copy_chunk(falcon, falcon->firmware.code.offset + offset, 205 192 offset, FALCON_MEMORY_IMEM); 193 + 194 + /* wait for DMA to complete */ 195 + err = falcon_dma_wait_idle(falcon); 196 + if (err < 0) 197 + return err; 206 198 207 199 /* setup falcon interrupts */ 208 200 falcon_writel(falcon, FALCON_IRQMSET_EXT(0xff) |
+1
drivers/gpu/drm/tegra/falcon.h
··· 47 47 #define FALCON_DMATRFMOFFS 0x00001114 48 48 49 49 #define FALCON_DMATRFCMD 0x00001118 50 + #define FALCON_DMATRFCMD_FULL (1 << 0) 50 51 #define FALCON_DMATRFCMD_IDLE (1 << 1) 51 52 #define FALCON_DMATRFCMD_IMEM (1 << 4) 52 53 #define FALCON_DMATRFCMD_SIZE_256B (6 << 8)
-1
drivers/gpu/drm/tegra/gem.c
··· 17 17 18 18 #include <drm/drm_drv.h> 19 19 #include <drm/drm_prime.h> 20 - #include <drm/tegra_drm.h> 21 20 22 21 #include "drm.h" 23 22 #include "gem.h"
+2 -2
drivers/gpu/drm/tegra/hub.c
··· 755 755 struct drm_plane *tegra_shared_plane_create(struct drm_device *drm, 756 756 struct tegra_dc *dc, 757 757 unsigned int wgrp, 758 - unsigned int index) 758 + unsigned int index, 759 + enum drm_plane_type type) 759 760 { 760 - enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY; 761 761 struct tegra_drm *tegra = drm->dev_private; 762 762 struct tegra_display_hub *hub = tegra->hub; 763 763 struct tegra_shared_plane *plane;
+2 -1
drivers/gpu/drm/tegra/hub.h
··· 80 80 struct drm_plane *tegra_shared_plane_create(struct drm_device *drm, 81 81 struct tegra_dc *dc, 82 82 unsigned int wgrp, 83 - unsigned int index); 83 + unsigned int index, 84 + enum drm_plane_type type); 84 85 85 86 int tegra_display_hub_atomic_check(struct drm_device *drm, 86 87 struct drm_atomic_state *state);
+13 -1
drivers/gpu/drm/tegra/rgb.c
··· 200 200 .atomic_check = tegra_rgb_encoder_atomic_check, 201 201 }; 202 202 203 + static void tegra_dc_of_node_put(void *data) 204 + { 205 + of_node_put(data); 206 + } 207 + 203 208 int tegra_dc_rgb_probe(struct tegra_dc *dc) 204 209 { 205 210 struct device_node *np; ··· 212 207 int err; 213 208 214 209 np = of_get_child_by_name(dc->dev->of_node, "rgb"); 215 - if (!np || !of_device_is_available(np)) 210 + if (!np) 211 + return -ENODEV; 212 + 213 + err = devm_add_action_or_reset(dc->dev, tegra_dc_of_node_put, np); 214 + if (err < 0) 215 + return err; 216 + 217 + if (!of_device_is_available(np)) 216 218 return -ENODEV; 217 219 218 220 rgb = devm_kzalloc(dc->dev, sizeof(*rgb), GFP_KERNEL);
+1
drivers/gpu/drm/tiny/Kconfig
··· 3 3 config DRM_APPLETBDRM 4 4 tristate "DRM support for Apple Touch Bars" 5 5 depends on DRM && USB && MMU 6 + depends on X86 || COMPILE_TEST 6 7 select DRM_GEM_SHMEM_HELPER 7 8 select DRM_KMS_HELPER 8 9 help
+4 -6
drivers/gpu/drm/tiny/st7571-i2c.c
··· 908 908 st7571->hwbuf = devm_kzalloc(&client->dev, 909 909 (st7571->nlines * st7571->ncols * st7571->bpp) / 8, 910 910 GFP_KERNEL); 911 - if (IS_ERR(st7571->hwbuf)) 912 - return dev_err_probe(&client->dev, PTR_ERR(st7571->hwbuf), 913 - "Failed to allocate intermediate buffer\n"); 911 + if (!st7571->hwbuf) 912 + return -ENOMEM; 914 913 915 914 st7571->row = devm_kzalloc(&client->dev, 916 915 (st7571->ncols * st7571->bpp), 917 916 GFP_KERNEL); 918 - if (IS_ERR(st7571->row)) 919 - return dev_err_probe(&client->dev, PTR_ERR(st7571->row), 920 - "Failed to allocate row buffer\n"); 917 + if (!st7571->row) 918 + return -ENOMEM; 921 919 922 920 ret = st7571_mode_config_init(st7571); 923 921 if (ret)
+1 -1
drivers/gpu/drm/vkms/vkms_crtc.c
··· 194 194 i++; 195 195 } 196 196 197 - vkms_state->active_planes = kcalloc(i, sizeof(plane), GFP_KERNEL); 197 + vkms_state->active_planes = kcalloc(i, sizeof(*vkms_state->active_planes), GFP_KERNEL); 198 198 if (!vkms_state->active_planes) 199 199 return -ENOMEM; 200 200 vkms_state->num_active_planes = i;
+3 -8
drivers/gpu/host1x/bus.c
··· 41 41 struct device_node *np) 42 42 { 43 43 struct host1x_subdev *subdev; 44 - struct device_node *child; 45 44 int err; 46 45 47 46 subdev = kzalloc(sizeof(*subdev), GFP_KERNEL); ··· 55 56 mutex_unlock(&device->subdevs_lock); 56 57 57 58 /* recursively add children */ 58 - for_each_child_of_node(np, child) { 59 + for_each_child_of_node_scoped(np, child) { 59 60 if (of_match_node(driver->subdevs, child) && 60 61 of_device_is_available(child)) { 61 62 err = host1x_subdev_add(device, driver, child); 62 63 if (err < 0) { 63 64 /* XXX cleanup? */ 64 - of_node_put(child); 65 65 return err; 66 66 } 67 67 } ··· 88 90 static int host1x_device_parse_dt(struct host1x_device *device, 89 91 struct host1x_driver *driver) 90 92 { 91 - struct device_node *np; 92 93 int err; 93 94 94 - for_each_child_of_node(device->dev.parent->of_node, np) { 95 + for_each_child_of_node_scoped(device->dev.parent->of_node, np) { 95 96 if (of_match_node(driver->subdevs, np) && 96 97 of_device_is_available(np)) { 97 98 err = host1x_subdev_add(device, driver, np); 98 - if (err < 0) { 99 - of_node_put(np); 99 + if (err < 0) 100 100 return err; 101 - } 102 101 } 103 102 } 104 103
+1 -6
drivers/gpu/host1x/cdma.c
··· 247 247 trace_host1x_wait_cdma(dev_name(cdma_to_channel(cdma)->dev), 248 248 CDMA_EVENT_PUSH_BUFFER_SPACE); 249 249 250 - host1x_hw_cdma_flush(host1x, cdma); 251 - 252 250 /* If somebody has managed to already start waiting, yield */ 253 251 if (cdma->event != CDMA_EVENT_NONE) { 254 252 mutex_unlock(&cdma->lock); ··· 589 591 */ 590 592 void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2) 591 593 { 592 - struct host1x *host1x = cdma_to_host1x(cdma); 593 594 struct push_buffer *pb = &cdma->push_buffer; 594 595 u32 slots_free = cdma->slots_free; 595 596 ··· 596 599 trace_host1x_cdma_push(dev_name(cdma_to_channel(cdma)->dev), 597 600 op1, op2); 598 601 599 - if (slots_free == 0) { 600 - host1x_hw_cdma_flush(host1x, cdma); 602 + if (slots_free == 0) 601 603 slots_free = host1x_cdma_wait_locked(cdma, 602 604 CDMA_EVENT_PUSH_BUFFER_SPACE); 603 - } 604 605 605 606 cdma->slots_free = slots_free - 1; 606 607 cdma->slots_used++;
+2 -2
lib/tests/printf_kunit.c
··· 726 726 static const struct fourcc_struct try_ch[] = { 727 727 { 0x41424344, "ABCD (0x41424344)", }, 728 728 }; 729 - static const struct fourcc_struct try_cn[] = { 729 + static const struct fourcc_struct try_chR[] = { 730 730 { 0x41424344, "DCBA (0x44434241)", }, 731 731 }; 732 732 static const struct fourcc_struct try_cl[] = { ··· 738 738 739 739 fourcc_pointer_test(kunittest, try_cc, ARRAY_SIZE(try_cc), "%p4cc"); 740 740 fourcc_pointer_test(kunittest, try_ch, ARRAY_SIZE(try_ch), "%p4ch"); 741 - fourcc_pointer_test(kunittest, try_cn, ARRAY_SIZE(try_cn), "%p4cn"); 741 + fourcc_pointer_test(kunittest, try_chR, ARRAY_SIZE(try_chR), "%p4chR"); 742 742 fourcc_pointer_test(kunittest, try_cl, ARRAY_SIZE(try_cl), "%p4cl"); 743 743 fourcc_pointer_test(kunittest, try_cb, ARRAY_SIZE(try_cb), "%p4cb"); 744 744 }
+8 -3
lib/vsprintf.c
··· 1805 1805 orig = get_unaligned(fourcc); 1806 1806 switch (fmt[2]) { 1807 1807 case 'h': 1808 - break; 1809 - case 'n': 1810 - orig = swab32(orig); 1808 + if (fmt[3] == 'R') 1809 + orig = swab32(orig); 1811 1810 break; 1812 1811 case 'l': 1813 1812 orig = (__force u32)cpu_to_le32(orig); ··· 2396 2397 * read the documentation (path below) first. 2397 2398 * - 'NF' For a netdev_features_t 2398 2399 * - '4cc' V4L2 or DRM FourCC code, with endianness and raw numerical value. 2400 + * - '4c[h[R]lb]' For generic FourCC code with raw numerical value. Both are 2401 + * displayed in the big-endian format. This is the opposite of V4L2 or 2402 + * DRM FourCCs. 2403 + * The additional specifiers define what endianness is used to load 2404 + * the stored bytes. The data might be interpreted using the host, 2405 + * reversed host byte order, little-endian, or big-endian. 2399 2406 * - 'h[CDN]' For a variable-length buffer, it prints it as a hex string with 2400 2407 * a certain separator (' ' by default): 2401 2408 * C colon
+1 -1
scripts/checkpatch.pl
··· 6891 6891 ($extension eq "f" && 6892 6892 defined $qualifier && $qualifier !~ /^w/) || 6893 6893 ($extension eq "4" && 6894 - defined $qualifier && $qualifier !~ /^c[hnlbc]/)) { 6894 + defined $qualifier && $qualifier !~ /^c(?:[hlbc]|hR)$/)) { 6895 6895 $bad_specifier = $specifier; 6896 6896 last; 6897 6897 }