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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm fixes from Dave Airlie:
"Unfortunately this contains no easter eggs, its a bit larger than I'd
like, but I included a patch that just moves code from one file to
another and I'd like to avoid merge conflicts with that later, so it
makes it seem worse than it is,

Otherwise:
- radeon: fixes to use new microcode to stabilise some cards, use
some common displayport code, some runtime pm fixes, pll regression
fixes
- i915: fix for some context oopses, a warn in a used path, backlight
fixes
- nouveau: regression fix
- omap: a bunch of fixes"

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (51 commits)
drm: bochs: drop unused struct fields
drm: bochs: add power management support
drm: cirrus: add power management support
drm: Split out drm_probe_helper.c from drm_crtc_helper.c
drm/plane-helper: Don't fake-implement primary plane disabling
drm/ast: fix value check in cbr_scan2
drm/nouveau/bios: fix a bit shift error introduced by 457e77b
drm/radeon/ci: make sure mc ucode is loaded before checking the size
drm/radeon/si: make sure mc ucode is loaded before checking the size
drm/radeon: improve PLL params if we don't match exactly v2
drm/radeon: memory leak on bo reservation failure. v2
drm/radeon: fix VCE fence command
drm/radeon: re-enable mclk dpm on R7 260X asics
drm/radeon: add support for newer mc ucode on CI (v2)
drm/radeon: add support for newer mc ucode on SI (v2)
drm/radeon: apply more strict limits for PLL params v2
drm/radeon: update CI DPM powertune settings
drm/radeon: fix runpm handling on APUs (v4)
drm/radeon: disable mclk dpm on R7 260X
drm/tegra: Remove gratuitous pad field
...

+1059 -915
+5
Documentation/DocBook/drm.tmpl
··· 2287 2287 !Edrivers/gpu/drm/drm_crtc_helper.c 2288 2288 </sect2> 2289 2289 <sect2> 2290 + <title>Output Probing Helper Functions Reference</title> 2291 + !Pdrivers/gpu/drm/drm_probe_helper.c output probing helper overview 2292 + !Edrivers/gpu/drm/drm_probe_helper.c 2293 + </sect2> 2294 + <sect2> 2290 2295 <title>fbdev Helper Functions Reference</title> 2291 2296 !Pdrivers/gpu/drm/drm_fb_helper.c fbdev helpers 2292 2297 !Edrivers/gpu/drm/drm_fb_helper.c
+1 -1
drivers/gpu/drm/Makefile
··· 23 23 24 24 drm-usb-y := drm_usb.o 25 25 26 - drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o 26 + drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o 27 27 drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o 28 28 drm_kms_helper-$(CONFIG_DRM_KMS_FB_HELPER) += drm_fb_helper.o 29 29 drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
+1 -1
drivers/gpu/drm/ast/ast_post.c
··· 572 572 for (loop = 0; loop < CBR_PASSNUM2; loop++) { 573 573 if ((data = cbr_test2(ast)) != 0) { 574 574 data2 &= data; 575 - if (!data) 575 + if (!data2) 576 576 return 0; 577 577 break; 578 578 }
+1 -2
drivers/gpu/drm/bochs/bochs.h
··· 1 1 #include <linux/io.h> 2 2 #include <linux/fb.h> 3 + #include <linux/console.h> 3 4 4 5 #include <drm/drmP.h> 5 6 #include <drm/drm_crtc.h> ··· 88 87 struct bochs_framebuffer gfb; 89 88 struct drm_fb_helper helper; 90 89 int size; 91 - int x1, y1, x2, y2; /* dirty rect */ 92 - spinlock_t dirty_lock; 93 90 bool initialized; 94 91 } fb; 95 92 };
+44
drivers/gpu/drm/bochs/bochs_drv.c
··· 95 95 }; 96 96 97 97 /* ---------------------------------------------------------------------- */ 98 + /* pm interface */ 99 + 100 + static int bochs_pm_suspend(struct device *dev) 101 + { 102 + struct pci_dev *pdev = to_pci_dev(dev); 103 + struct drm_device *drm_dev = pci_get_drvdata(pdev); 104 + struct bochs_device *bochs = drm_dev->dev_private; 105 + 106 + drm_kms_helper_poll_disable(drm_dev); 107 + 108 + if (bochs->fb.initialized) { 109 + console_lock(); 110 + fb_set_suspend(bochs->fb.helper.fbdev, 1); 111 + console_unlock(); 112 + } 113 + 114 + return 0; 115 + } 116 + 117 + static int bochs_pm_resume(struct device *dev) 118 + { 119 + struct pci_dev *pdev = to_pci_dev(dev); 120 + struct drm_device *drm_dev = pci_get_drvdata(pdev); 121 + struct bochs_device *bochs = drm_dev->dev_private; 122 + 123 + drm_helper_resume_force_mode(drm_dev); 124 + 125 + if (bochs->fb.initialized) { 126 + console_lock(); 127 + fb_set_suspend(bochs->fb.helper.fbdev, 0); 128 + console_unlock(); 129 + } 130 + 131 + drm_kms_helper_poll_enable(drm_dev); 132 + return 0; 133 + } 134 + 135 + static const struct dev_pm_ops bochs_pm_ops = { 136 + SET_SYSTEM_SLEEP_PM_OPS(bochs_pm_suspend, 137 + bochs_pm_resume) 138 + }; 139 + 140 + /* ---------------------------------------------------------------------- */ 98 141 /* pci interface */ 99 142 100 143 static int bochs_kick_out_firmware_fb(struct pci_dev *pdev) ··· 198 155 .id_table = bochs_pci_tbl, 199 156 .probe = bochs_pci_probe, 200 157 .remove = bochs_pci_remove, 158 + .driver.pm = &bochs_pm_ops, 201 159 }; 202 160 203 161 /* ---------------------------------------------------------------------- */
-1
drivers/gpu/drm/bochs/bochs_fbdev.c
··· 190 190 int ret; 191 191 192 192 bochs->fb.helper.funcs = &bochs_fb_helper_funcs; 193 - spin_lock_init(&bochs->fb.dirty_lock); 194 193 195 194 ret = drm_fb_helper_init(bochs->dev, &bochs->fb.helper, 196 195 1, 1);
+42
drivers/gpu/drm/cirrus/cirrus_drv.c
··· 11 11 #include <linux/module.h> 12 12 #include <linux/console.h> 13 13 #include <drm/drmP.h> 14 + #include <drm/drm_crtc_helper.h> 14 15 15 16 #include "cirrus_drv.h" 16 17 ··· 76 75 drm_put_dev(dev); 77 76 } 78 77 78 + static int cirrus_pm_suspend(struct device *dev) 79 + { 80 + struct pci_dev *pdev = to_pci_dev(dev); 81 + struct drm_device *drm_dev = pci_get_drvdata(pdev); 82 + struct cirrus_device *cdev = drm_dev->dev_private; 83 + 84 + drm_kms_helper_poll_disable(drm_dev); 85 + 86 + if (cdev->mode_info.gfbdev) { 87 + console_lock(); 88 + fb_set_suspend(cdev->mode_info.gfbdev->helper.fbdev, 1); 89 + console_unlock(); 90 + } 91 + 92 + return 0; 93 + } 94 + 95 + static int cirrus_pm_resume(struct device *dev) 96 + { 97 + struct pci_dev *pdev = to_pci_dev(dev); 98 + struct drm_device *drm_dev = pci_get_drvdata(pdev); 99 + struct cirrus_device *cdev = drm_dev->dev_private; 100 + 101 + drm_helper_resume_force_mode(drm_dev); 102 + 103 + if (cdev->mode_info.gfbdev) { 104 + console_lock(); 105 + fb_set_suspend(cdev->mode_info.gfbdev->helper.fbdev, 0); 106 + console_unlock(); 107 + } 108 + 109 + drm_kms_helper_poll_enable(drm_dev); 110 + return 0; 111 + } 112 + 79 113 static const struct file_operations cirrus_driver_fops = { 80 114 .owner = THIS_MODULE, 81 115 .open = drm_open, ··· 139 103 .dumb_destroy = drm_gem_dumb_destroy, 140 104 }; 141 105 106 + static const struct dev_pm_ops cirrus_pm_ops = { 107 + SET_SYSTEM_SLEEP_PM_OPS(cirrus_pm_suspend, 108 + cirrus_pm_resume) 109 + }; 110 + 142 111 static struct pci_driver cirrus_pci_driver = { 143 112 .name = DRIVER_NAME, 144 113 .id_table = pciidlist, 145 114 .probe = cirrus_pci_probe, 146 115 .remove = cirrus_pci_remove, 116 + .driver.pm = &cirrus_pm_ops, 147 117 }; 148 118 149 119 static int __init cirrus_init(void)
+3
drivers/gpu/drm/cirrus/cirrus_mode.c
··· 308 308 309 309 WREG_HDR(hdr); 310 310 cirrus_crtc_do_set_base(crtc, old_fb, x, y, 0); 311 + 312 + /* Unblank (needed on S3 resume, vgabios doesn't do it then) */ 313 + outb(0x20, 0x3c0); 311 314 return 0; 312 315 } 313 316
-370
drivers/gpu/drm/drm_crtc_helper.c
··· 72 72 } 73 73 EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head); 74 74 75 - static bool drm_kms_helper_poll = true; 76 - module_param_named(poll, drm_kms_helper_poll, bool, 0600); 77 - 78 - static void drm_mode_validate_flag(struct drm_connector *connector, 79 - int flags) 80 - { 81 - struct drm_display_mode *mode; 82 - 83 - if (flags == (DRM_MODE_FLAG_DBLSCAN | DRM_MODE_FLAG_INTERLACE | 84 - DRM_MODE_FLAG_3D_MASK)) 85 - return; 86 - 87 - list_for_each_entry(mode, &connector->modes, head) { 88 - if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && 89 - !(flags & DRM_MODE_FLAG_INTERLACE)) 90 - mode->status = MODE_NO_INTERLACE; 91 - if ((mode->flags & DRM_MODE_FLAG_DBLSCAN) && 92 - !(flags & DRM_MODE_FLAG_DBLSCAN)) 93 - mode->status = MODE_NO_DBLESCAN; 94 - if ((mode->flags & DRM_MODE_FLAG_3D_MASK) && 95 - !(flags & DRM_MODE_FLAG_3D_MASK)) 96 - mode->status = MODE_NO_STEREO; 97 - } 98 - 99 - return; 100 - } 101 - 102 - /** 103 - * drm_helper_probe_single_connector_modes - get complete set of display modes 104 - * @connector: connector to probe 105 - * @maxX: max width for modes 106 - * @maxY: max height for modes 107 - * 108 - * Based on the helper callbacks implemented by @connector try to detect all 109 - * valid modes. Modes will first be added to the connector's probed_modes list, 110 - * then culled (based on validity and the @maxX, @maxY parameters) and put into 111 - * the normal modes list. 112 - * 113 - * Intended to be use as a generic implementation of the ->fill_modes() 114 - * @connector vfunc for drivers that use the crtc helpers for output mode 115 - * filtering and detection. 116 - * 117 - * Returns: 118 - * The number of modes found on @connector. 119 - */ 120 - int drm_helper_probe_single_connector_modes(struct drm_connector *connector, 121 - uint32_t maxX, uint32_t maxY) 122 - { 123 - struct drm_device *dev = connector->dev; 124 - struct drm_display_mode *mode; 125 - struct drm_connector_helper_funcs *connector_funcs = 126 - connector->helper_private; 127 - int count = 0; 128 - int mode_flags = 0; 129 - bool verbose_prune = true; 130 - 131 - WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); 132 - 133 - DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, 134 - drm_get_connector_name(connector)); 135 - /* set all modes to the unverified state */ 136 - list_for_each_entry(mode, &connector->modes, head) 137 - mode->status = MODE_UNVERIFIED; 138 - 139 - if (connector->force) { 140 - if (connector->force == DRM_FORCE_ON) 141 - connector->status = connector_status_connected; 142 - else 143 - connector->status = connector_status_disconnected; 144 - if (connector->funcs->force) 145 - connector->funcs->force(connector); 146 - } else { 147 - connector->status = connector->funcs->detect(connector, true); 148 - } 149 - 150 - /* Re-enable polling in case the global poll config changed. */ 151 - if (drm_kms_helper_poll != dev->mode_config.poll_running) 152 - drm_kms_helper_poll_enable(dev); 153 - 154 - dev->mode_config.poll_running = drm_kms_helper_poll; 155 - 156 - if (connector->status == connector_status_disconnected) { 157 - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n", 158 - connector->base.id, drm_get_connector_name(connector)); 159 - drm_mode_connector_update_edid_property(connector, NULL); 160 - verbose_prune = false; 161 - goto prune; 162 - } 163 - 164 - #ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE 165 - count = drm_load_edid_firmware(connector); 166 - if (count == 0) 167 - #endif 168 - count = (*connector_funcs->get_modes)(connector); 169 - 170 - if (count == 0 && connector->status == connector_status_connected) 171 - count = drm_add_modes_noedid(connector, 1024, 768); 172 - if (count == 0) 173 - goto prune; 174 - 175 - drm_mode_connector_list_update(connector); 176 - 177 - if (maxX && maxY) 178 - drm_mode_validate_size(dev, &connector->modes, maxX, maxY); 179 - 180 - if (connector->interlace_allowed) 181 - mode_flags |= DRM_MODE_FLAG_INTERLACE; 182 - if (connector->doublescan_allowed) 183 - mode_flags |= DRM_MODE_FLAG_DBLSCAN; 184 - if (connector->stereo_allowed) 185 - mode_flags |= DRM_MODE_FLAG_3D_MASK; 186 - drm_mode_validate_flag(connector, mode_flags); 187 - 188 - list_for_each_entry(mode, &connector->modes, head) { 189 - if (mode->status == MODE_OK) 190 - mode->status = connector_funcs->mode_valid(connector, 191 - mode); 192 - } 193 - 194 - prune: 195 - drm_mode_prune_invalid(dev, &connector->modes, verbose_prune); 196 - 197 - if (list_empty(&connector->modes)) 198 - return 0; 199 - 200 - list_for_each_entry(mode, &connector->modes, head) 201 - mode->vrefresh = drm_mode_vrefresh(mode); 202 - 203 - drm_mode_sort(&connector->modes); 204 - 205 - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id, 206 - drm_get_connector_name(connector)); 207 - list_for_each_entry(mode, &connector->modes, head) { 208 - drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); 209 - drm_mode_debug_printmodeline(mode); 210 - } 211 - 212 - return count; 213 - } 214 - EXPORT_SYMBOL(drm_helper_probe_single_connector_modes); 215 - 216 75 /** 217 76 * drm_helper_encoder_in_use - check if a given encoder is in use 218 77 * @encoder: encoder to check ··· 879 1020 drm_modeset_unlock_all(dev); 880 1021 } 881 1022 EXPORT_SYMBOL(drm_helper_resume_force_mode); 882 - 883 - /** 884 - * drm_kms_helper_hotplug_event - fire off KMS hotplug events 885 - * @dev: drm_device whose connector state changed 886 - * 887 - * This function fires off the uevent for userspace and also calls the 888 - * output_poll_changed function, which is most commonly used to inform the fbdev 889 - * emulation code and allow it to update the fbcon output configuration. 890 - * 891 - * Drivers should call this from their hotplug handling code when a change is 892 - * detected. Note that this function does not do any output detection of its 893 - * own, like drm_helper_hpd_irq_event() does - this is assumed to be done by the 894 - * driver already. 895 - * 896 - * This function must be called from process context with no mode 897 - * setting locks held. 898 - */ 899 - void drm_kms_helper_hotplug_event(struct drm_device *dev) 900 - { 901 - /* send a uevent + call fbdev */ 902 - drm_sysfs_hotplug_event(dev); 903 - if (dev->mode_config.funcs->output_poll_changed) 904 - dev->mode_config.funcs->output_poll_changed(dev); 905 - } 906 - EXPORT_SYMBOL(drm_kms_helper_hotplug_event); 907 - 908 - #define DRM_OUTPUT_POLL_PERIOD (10*HZ) 909 - static void output_poll_execute(struct work_struct *work) 910 - { 911 - struct delayed_work *delayed_work = to_delayed_work(work); 912 - struct drm_device *dev = container_of(delayed_work, struct drm_device, mode_config.output_poll_work); 913 - struct drm_connector *connector; 914 - enum drm_connector_status old_status; 915 - bool repoll = false, changed = false; 916 - 917 - if (!drm_kms_helper_poll) 918 - return; 919 - 920 - mutex_lock(&dev->mode_config.mutex); 921 - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 922 - 923 - /* Ignore forced connectors. */ 924 - if (connector->force) 925 - continue; 926 - 927 - /* Ignore HPD capable connectors and connectors where we don't 928 - * want any hotplug detection at all for polling. */ 929 - if (!connector->polled || connector->polled == DRM_CONNECTOR_POLL_HPD) 930 - continue; 931 - 932 - repoll = true; 933 - 934 - old_status = connector->status; 935 - /* if we are connected and don't want to poll for disconnect 936 - skip it */ 937 - if (old_status == connector_status_connected && 938 - !(connector->polled & DRM_CONNECTOR_POLL_DISCONNECT)) 939 - continue; 940 - 941 - connector->status = connector->funcs->detect(connector, false); 942 - if (old_status != connector->status) { 943 - const char *old, *new; 944 - 945 - old = drm_get_connector_status_name(old_status); 946 - new = drm_get_connector_status_name(connector->status); 947 - 948 - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] " 949 - "status updated from %s to %s\n", 950 - connector->base.id, 951 - drm_get_connector_name(connector), 952 - old, new); 953 - 954 - changed = true; 955 - } 956 - } 957 - 958 - mutex_unlock(&dev->mode_config.mutex); 959 - 960 - if (changed) 961 - drm_kms_helper_hotplug_event(dev); 962 - 963 - if (repoll) 964 - schedule_delayed_work(delayed_work, DRM_OUTPUT_POLL_PERIOD); 965 - } 966 - 967 - /** 968 - * drm_kms_helper_poll_disable - disable output polling 969 - * @dev: drm_device 970 - * 971 - * This function disables the output polling work. 972 - * 973 - * Drivers can call this helper from their device suspend implementation. It is 974 - * not an error to call this even when output polling isn't enabled or arlready 975 - * disabled. 976 - */ 977 - void drm_kms_helper_poll_disable(struct drm_device *dev) 978 - { 979 - if (!dev->mode_config.poll_enabled) 980 - return; 981 - cancel_delayed_work_sync(&dev->mode_config.output_poll_work); 982 - } 983 - EXPORT_SYMBOL(drm_kms_helper_poll_disable); 984 - 985 - /** 986 - * drm_kms_helper_poll_enable - re-enable output polling. 987 - * @dev: drm_device 988 - * 989 - * This function re-enables the output polling work. 990 - * 991 - * Drivers can call this helper from their device resume implementation. It is 992 - * an error to call this when the output polling support has not yet been set 993 - * up. 994 - */ 995 - void drm_kms_helper_poll_enable(struct drm_device *dev) 996 - { 997 - bool poll = false; 998 - struct drm_connector *connector; 999 - 1000 - if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll) 1001 - return; 1002 - 1003 - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 1004 - if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | 1005 - DRM_CONNECTOR_POLL_DISCONNECT)) 1006 - poll = true; 1007 - } 1008 - 1009 - if (poll) 1010 - schedule_delayed_work(&dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD); 1011 - } 1012 - EXPORT_SYMBOL(drm_kms_helper_poll_enable); 1013 - 1014 - /** 1015 - * drm_kms_helper_poll_init - initialize and enable output polling 1016 - * @dev: drm_device 1017 - * 1018 - * This function intializes and then also enables output polling support for 1019 - * @dev. Drivers which do not have reliable hotplug support in hardware can use 1020 - * this helper infrastructure to regularly poll such connectors for changes in 1021 - * their connection state. 1022 - * 1023 - * Drivers can control which connectors are polled by setting the 1024 - * DRM_CONNECTOR_POLL_CONNECT and DRM_CONNECTOR_POLL_DISCONNECT flags. On 1025 - * connectors where probing live outputs can result in visual distortion drivers 1026 - * should not set the DRM_CONNECTOR_POLL_DISCONNECT flag to avoid this. 1027 - * Connectors which have no flag or only DRM_CONNECTOR_POLL_HPD set are 1028 - * completely ignored by the polling logic. 1029 - * 1030 - * Note that a connector can be both polled and probed from the hotplug handler, 1031 - * in case the hotplug interrupt is known to be unreliable. 1032 - */ 1033 - void drm_kms_helper_poll_init(struct drm_device *dev) 1034 - { 1035 - INIT_DELAYED_WORK(&dev->mode_config.output_poll_work, output_poll_execute); 1036 - dev->mode_config.poll_enabled = true; 1037 - 1038 - drm_kms_helper_poll_enable(dev); 1039 - } 1040 - EXPORT_SYMBOL(drm_kms_helper_poll_init); 1041 - 1042 - /** 1043 - * drm_kms_helper_poll_fini - disable output polling and clean it up 1044 - * @dev: drm_device 1045 - */ 1046 - void drm_kms_helper_poll_fini(struct drm_device *dev) 1047 - { 1048 - drm_kms_helper_poll_disable(dev); 1049 - } 1050 - EXPORT_SYMBOL(drm_kms_helper_poll_fini); 1051 - 1052 - /** 1053 - * drm_helper_hpd_irq_event - hotplug processing 1054 - * @dev: drm_device 1055 - * 1056 - * Drivers can use this helper function to run a detect cycle on all connectors 1057 - * which have the DRM_CONNECTOR_POLL_HPD flag set in their &polled member. All 1058 - * other connectors are ignored, which is useful to avoid reprobing fixed 1059 - * panels. 1060 - * 1061 - * This helper function is useful for drivers which can't or don't track hotplug 1062 - * interrupts for each connector. 1063 - * 1064 - * Drivers which support hotplug interrupts for each connector individually and 1065 - * which have a more fine-grained detect logic should bypass this code and 1066 - * directly call drm_kms_helper_hotplug_event() in case the connector state 1067 - * changed. 1068 - * 1069 - * This function must be called from process context with no mode 1070 - * setting locks held. 1071 - * 1072 - * Note that a connector can be both polled and probed from the hotplug handler, 1073 - * in case the hotplug interrupt is known to be unreliable. 1074 - */ 1075 - bool drm_helper_hpd_irq_event(struct drm_device *dev) 1076 - { 1077 - struct drm_connector *connector; 1078 - enum drm_connector_status old_status; 1079 - bool changed = false; 1080 - 1081 - if (!dev->mode_config.poll_enabled) 1082 - return false; 1083 - 1084 - mutex_lock(&dev->mode_config.mutex); 1085 - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 1086 - 1087 - /* Only handle HPD capable connectors. */ 1088 - if (!(connector->polled & DRM_CONNECTOR_POLL_HPD)) 1089 - continue; 1090 - 1091 - old_status = connector->status; 1092 - 1093 - connector->status = connector->funcs->detect(connector, false); 1094 - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n", 1095 - connector->base.id, 1096 - drm_get_connector_name(connector), 1097 - drm_get_connector_status_name(old_status), 1098 - drm_get_connector_status_name(connector->status)); 1099 - if (old_status != connector->status) 1100 - changed = true; 1101 - } 1102 - 1103 - mutex_unlock(&dev->mode_config.mutex); 1104 - 1105 - if (changed) 1106 - drm_kms_helper_hotplug_event(dev); 1107 - 1108 - return changed; 1109 - } 1110 - EXPORT_SYMBOL(drm_helper_hpd_irq_event);
+35 -20
drivers/gpu/drm/drm_dp_helper.c
··· 577 577 578 578 /* 579 579 * Transfer a single I2C-over-AUX message and handle various error conditions, 580 - * retrying the transaction as appropriate. 580 + * retrying the transaction as appropriate. It is assumed that the 581 + * aux->transfer function does not modify anything in the msg other than the 582 + * reply field. 581 583 */ 582 584 static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) 583 585 { ··· 667 665 { 668 666 struct drm_dp_aux *aux = adapter->algo_data; 669 667 unsigned int i, j; 668 + struct drm_dp_aux_msg msg; 669 + int err = 0; 670 + 671 + memset(&msg, 0, sizeof(msg)); 670 672 671 673 for (i = 0; i < num; i++) { 672 - struct drm_dp_aux_msg msg; 673 - int err; 674 - 674 + msg.address = msgs[i].addr; 675 + msg.request = (msgs[i].flags & I2C_M_RD) ? 676 + DP_AUX_I2C_READ : 677 + DP_AUX_I2C_WRITE; 678 + msg.request |= DP_AUX_I2C_MOT; 679 + /* Send a bare address packet to start the transaction. 680 + * Zero sized messages specify an address only (bare 681 + * address) transaction. 682 + */ 683 + msg.buffer = NULL; 684 + msg.size = 0; 685 + err = drm_dp_i2c_do_msg(aux, &msg); 686 + if (err < 0) 687 + break; 675 688 /* 676 689 * Many hardware implementations support FIFOs larger than a 677 690 * single byte, but it has been empirically determined that ··· 695 678 * transferred byte-by-byte. 696 679 */ 697 680 for (j = 0; j < msgs[i].len; j++) { 698 - memset(&msg, 0, sizeof(msg)); 699 - msg.address = msgs[i].addr; 700 - 701 - msg.request = (msgs[i].flags & I2C_M_RD) ? 702 - DP_AUX_I2C_READ : 703 - DP_AUX_I2C_WRITE; 704 - 705 - /* 706 - * All messages except the last one are middle-of- 707 - * transfer messages. 708 - */ 709 - if ((i < num - 1) || (j < msgs[i].len - 1)) 710 - msg.request |= DP_AUX_I2C_MOT; 711 - 712 681 msg.buffer = msgs[i].buf + j; 713 682 msg.size = 1; 714 683 715 684 err = drm_dp_i2c_do_msg(aux, &msg); 716 685 if (err < 0) 717 - return err; 686 + break; 718 687 } 688 + if (err < 0) 689 + break; 719 690 } 691 + if (err >= 0) 692 + err = num; 693 + /* Send a bare address packet to close out the transaction. 694 + * Zero sized messages specify an address only (bare 695 + * address) transaction. 696 + */ 697 + msg.request &= ~DP_AUX_I2C_MOT; 698 + msg.buffer = NULL; 699 + msg.size = 0; 700 + (void)drm_dp_i2c_do_msg(aux, &msg); 720 701 721 - return num; 702 + return err; 722 703 } 723 704 724 705 static const struct i2c_algorithm drm_dp_i2c_algo = {
-2
drivers/gpu/drm/drm_mm.c
··· 207 207 return 0; 208 208 } 209 209 210 - WARN(1, "no hole found for node 0x%lx + 0x%lx\n", 211 - node->start, node->size); 212 210 return -ENOSPC; 213 211 } 214 212 EXPORT_SYMBOL(drm_mm_reserve_node);
+5 -28
drivers/gpu/drm/drm_plane_helper.c
··· 203 203 * 204 204 * Provides a default plane disable handler for primary planes. This is handler 205 205 * is called in response to a userspace SetPlane operation on the plane with a 206 - * NULL framebuffer parameter. We call the driver's modeset handler with a NULL 207 - * framebuffer to disable the CRTC if no other planes are currently enabled. 208 - * If other planes are still enabled on the same CRTC, we return -EBUSY. 206 + * NULL framebuffer parameter. It unconditionally fails the disable call with 207 + * -EINVAL the only way to disable the primary plane without driver support is 208 + * to disable the entier CRTC. Which does not match the plane ->disable hook. 209 209 * 210 210 * Note that some hardware may be able to disable the primary plane without 211 211 * disabling the whole CRTC. Drivers for such hardware should provide their ··· 214 214 * disabled primary plane). 215 215 * 216 216 * RETURNS: 217 - * Zero on success, error code on failure 217 + * Unconditionally returns -EINVAL. 218 218 */ 219 219 int drm_primary_helper_disable(struct drm_plane *plane) 220 220 { 221 - struct drm_plane *p; 222 - struct drm_mode_set set = { 223 - .crtc = plane->crtc, 224 - .fb = NULL, 225 - }; 226 - 227 - if (plane->crtc == NULL || plane->fb == NULL) 228 - /* Already disabled */ 229 - return 0; 230 - 231 - list_for_each_entry(p, &plane->dev->mode_config.plane_list, head) 232 - if (p != plane && p->fb) { 233 - DRM_DEBUG_KMS("Cannot disable primary plane while other planes are still active on CRTC.\n"); 234 - return -EBUSY; 235 - } 236 - 237 - /* 238 - * N.B. We call set_config() directly here rather than 239 - * drm_mode_set_config_internal() since drm_mode_setplane() already 240 - * handles the basic refcounting and we don't need the special 241 - * cross-CRTC refcounting (no chance of stealing connectors from 242 - * other CRTC's with this update). 243 - */ 244 - return plane->crtc->funcs->set_config(&set); 221 + return -EINVAL; 245 222 } 246 223 EXPORT_SYMBOL(drm_primary_helper_disable); 247 224
+426
drivers/gpu/drm/drm_probe_helper.c
··· 1 + /* 2 + * Copyright (c) 2006-2008 Intel Corporation 3 + * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> 4 + * 5 + * DRM core CRTC related functions 6 + * 7 + * Permission to use, copy, modify, distribute, and sell this software and its 8 + * documentation for any purpose is hereby granted without fee, provided that 9 + * the above copyright notice appear in all copies and that both that copyright 10 + * notice and this permission notice appear in supporting documentation, and 11 + * that the name of the copyright holders not be used in advertising or 12 + * publicity pertaining to distribution of the software without specific, 13 + * written prior permission. The copyright holders make no representations 14 + * about the suitability of this software for any purpose. It is provided "as 15 + * is" without express or implied warranty. 16 + * 17 + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 18 + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 19 + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 20 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 21 + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 22 + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 23 + * OF THIS SOFTWARE. 24 + * 25 + * Authors: 26 + * Keith Packard 27 + * Eric Anholt <eric@anholt.net> 28 + * Dave Airlie <airlied@linux.ie> 29 + * Jesse Barnes <jesse.barnes@intel.com> 30 + */ 31 + 32 + #include <linux/export.h> 33 + #include <linux/moduleparam.h> 34 + 35 + #include <drm/drmP.h> 36 + #include <drm/drm_crtc.h> 37 + #include <drm/drm_fourcc.h> 38 + #include <drm/drm_crtc_helper.h> 39 + #include <drm/drm_fb_helper.h> 40 + #include <drm/drm_edid.h> 41 + 42 + /** 43 + * DOC: output probing helper overview 44 + * 45 + * This library provides some helper code for output probing. It provides an 46 + * implementation of the core connector->fill_modes interface with 47 + * drm_helper_probe_single_connector_modes. 48 + * 49 + * It also provides support for polling connectors with a work item and for 50 + * generic hotplug interrupt handling where the driver doesn't or cannot keep 51 + * track of a per-connector hpd interrupt. 52 + * 53 + * This helper library can be used independently of the modeset helper library. 54 + * Drivers can also overwrite different parts e.g. use their own hotplug 55 + * handling code to avoid probing unrelated outputs. 56 + */ 57 + 58 + static bool drm_kms_helper_poll = true; 59 + module_param_named(poll, drm_kms_helper_poll, bool, 0600); 60 + 61 + static void drm_mode_validate_flag(struct drm_connector *connector, 62 + int flags) 63 + { 64 + struct drm_display_mode *mode; 65 + 66 + if (flags == (DRM_MODE_FLAG_DBLSCAN | DRM_MODE_FLAG_INTERLACE | 67 + DRM_MODE_FLAG_3D_MASK)) 68 + return; 69 + 70 + list_for_each_entry(mode, &connector->modes, head) { 71 + if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && 72 + !(flags & DRM_MODE_FLAG_INTERLACE)) 73 + mode->status = MODE_NO_INTERLACE; 74 + if ((mode->flags & DRM_MODE_FLAG_DBLSCAN) && 75 + !(flags & DRM_MODE_FLAG_DBLSCAN)) 76 + mode->status = MODE_NO_DBLESCAN; 77 + if ((mode->flags & DRM_MODE_FLAG_3D_MASK) && 78 + !(flags & DRM_MODE_FLAG_3D_MASK)) 79 + mode->status = MODE_NO_STEREO; 80 + } 81 + 82 + return; 83 + } 84 + 85 + /** 86 + * drm_helper_probe_single_connector_modes - get complete set of display modes 87 + * @connector: connector to probe 88 + * @maxX: max width for modes 89 + * @maxY: max height for modes 90 + * 91 + * Based on the helper callbacks implemented by @connector try to detect all 92 + * valid modes. Modes will first be added to the connector's probed_modes list, 93 + * then culled (based on validity and the @maxX, @maxY parameters) and put into 94 + * the normal modes list. 95 + * 96 + * Intended to be use as a generic implementation of the ->fill_modes() 97 + * @connector vfunc for drivers that use the crtc helpers for output mode 98 + * filtering and detection. 99 + * 100 + * Returns: 101 + * The number of modes found on @connector. 102 + */ 103 + int drm_helper_probe_single_connector_modes(struct drm_connector *connector, 104 + uint32_t maxX, uint32_t maxY) 105 + { 106 + struct drm_device *dev = connector->dev; 107 + struct drm_display_mode *mode; 108 + struct drm_connector_helper_funcs *connector_funcs = 109 + connector->helper_private; 110 + int count = 0; 111 + int mode_flags = 0; 112 + bool verbose_prune = true; 113 + 114 + WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); 115 + 116 + DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, 117 + drm_get_connector_name(connector)); 118 + /* set all modes to the unverified state */ 119 + list_for_each_entry(mode, &connector->modes, head) 120 + mode->status = MODE_UNVERIFIED; 121 + 122 + if (connector->force) { 123 + if (connector->force == DRM_FORCE_ON) 124 + connector->status = connector_status_connected; 125 + else 126 + connector->status = connector_status_disconnected; 127 + if (connector->funcs->force) 128 + connector->funcs->force(connector); 129 + } else { 130 + connector->status = connector->funcs->detect(connector, true); 131 + } 132 + 133 + /* Re-enable polling in case the global poll config changed. */ 134 + if (drm_kms_helper_poll != dev->mode_config.poll_running) 135 + drm_kms_helper_poll_enable(dev); 136 + 137 + dev->mode_config.poll_running = drm_kms_helper_poll; 138 + 139 + if (connector->status == connector_status_disconnected) { 140 + DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n", 141 + connector->base.id, drm_get_connector_name(connector)); 142 + drm_mode_connector_update_edid_property(connector, NULL); 143 + verbose_prune = false; 144 + goto prune; 145 + } 146 + 147 + #ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE 148 + count = drm_load_edid_firmware(connector); 149 + if (count == 0) 150 + #endif 151 + count = (*connector_funcs->get_modes)(connector); 152 + 153 + if (count == 0 && connector->status == connector_status_connected) 154 + count = drm_add_modes_noedid(connector, 1024, 768); 155 + if (count == 0) 156 + goto prune; 157 + 158 + drm_mode_connector_list_update(connector); 159 + 160 + if (maxX && maxY) 161 + drm_mode_validate_size(dev, &connector->modes, maxX, maxY); 162 + 163 + if (connector->interlace_allowed) 164 + mode_flags |= DRM_MODE_FLAG_INTERLACE; 165 + if (connector->doublescan_allowed) 166 + mode_flags |= DRM_MODE_FLAG_DBLSCAN; 167 + if (connector->stereo_allowed) 168 + mode_flags |= DRM_MODE_FLAG_3D_MASK; 169 + drm_mode_validate_flag(connector, mode_flags); 170 + 171 + list_for_each_entry(mode, &connector->modes, head) { 172 + if (mode->status == MODE_OK) 173 + mode->status = connector_funcs->mode_valid(connector, 174 + mode); 175 + } 176 + 177 + prune: 178 + drm_mode_prune_invalid(dev, &connector->modes, verbose_prune); 179 + 180 + if (list_empty(&connector->modes)) 181 + return 0; 182 + 183 + list_for_each_entry(mode, &connector->modes, head) 184 + mode->vrefresh = drm_mode_vrefresh(mode); 185 + 186 + drm_mode_sort(&connector->modes); 187 + 188 + DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id, 189 + drm_get_connector_name(connector)); 190 + list_for_each_entry(mode, &connector->modes, head) { 191 + drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); 192 + drm_mode_debug_printmodeline(mode); 193 + } 194 + 195 + return count; 196 + } 197 + EXPORT_SYMBOL(drm_helper_probe_single_connector_modes); 198 + 199 + /** 200 + * drm_kms_helper_hotplug_event - fire off KMS hotplug events 201 + * @dev: drm_device whose connector state changed 202 + * 203 + * This function fires off the uevent for userspace and also calls the 204 + * output_poll_changed function, which is most commonly used to inform the fbdev 205 + * emulation code and allow it to update the fbcon output configuration. 206 + * 207 + * Drivers should call this from their hotplug handling code when a change is 208 + * detected. Note that this function does not do any output detection of its 209 + * own, like drm_helper_hpd_irq_event() does - this is assumed to be done by the 210 + * driver already. 211 + * 212 + * This function must be called from process context with no mode 213 + * setting locks held. 214 + */ 215 + void drm_kms_helper_hotplug_event(struct drm_device *dev) 216 + { 217 + /* send a uevent + call fbdev */ 218 + drm_sysfs_hotplug_event(dev); 219 + if (dev->mode_config.funcs->output_poll_changed) 220 + dev->mode_config.funcs->output_poll_changed(dev); 221 + } 222 + EXPORT_SYMBOL(drm_kms_helper_hotplug_event); 223 + 224 + #define DRM_OUTPUT_POLL_PERIOD (10*HZ) 225 + static void output_poll_execute(struct work_struct *work) 226 + { 227 + struct delayed_work *delayed_work = to_delayed_work(work); 228 + struct drm_device *dev = container_of(delayed_work, struct drm_device, mode_config.output_poll_work); 229 + struct drm_connector *connector; 230 + enum drm_connector_status old_status; 231 + bool repoll = false, changed = false; 232 + 233 + if (!drm_kms_helper_poll) 234 + return; 235 + 236 + mutex_lock(&dev->mode_config.mutex); 237 + list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 238 + 239 + /* Ignore forced connectors. */ 240 + if (connector->force) 241 + continue; 242 + 243 + /* Ignore HPD capable connectors and connectors where we don't 244 + * want any hotplug detection at all for polling. */ 245 + if (!connector->polled || connector->polled == DRM_CONNECTOR_POLL_HPD) 246 + continue; 247 + 248 + repoll = true; 249 + 250 + old_status = connector->status; 251 + /* if we are connected and don't want to poll for disconnect 252 + skip it */ 253 + if (old_status == connector_status_connected && 254 + !(connector->polled & DRM_CONNECTOR_POLL_DISCONNECT)) 255 + continue; 256 + 257 + connector->status = connector->funcs->detect(connector, false); 258 + if (old_status != connector->status) { 259 + const char *old, *new; 260 + 261 + old = drm_get_connector_status_name(old_status); 262 + new = drm_get_connector_status_name(connector->status); 263 + 264 + DRM_DEBUG_KMS("[CONNECTOR:%d:%s] " 265 + "status updated from %s to %s\n", 266 + connector->base.id, 267 + drm_get_connector_name(connector), 268 + old, new); 269 + 270 + changed = true; 271 + } 272 + } 273 + 274 + mutex_unlock(&dev->mode_config.mutex); 275 + 276 + if (changed) 277 + drm_kms_helper_hotplug_event(dev); 278 + 279 + if (repoll) 280 + schedule_delayed_work(delayed_work, DRM_OUTPUT_POLL_PERIOD); 281 + } 282 + 283 + /** 284 + * drm_kms_helper_poll_disable - disable output polling 285 + * @dev: drm_device 286 + * 287 + * This function disables the output polling work. 288 + * 289 + * Drivers can call this helper from their device suspend implementation. It is 290 + * not an error to call this even when output polling isn't enabled or arlready 291 + * disabled. 292 + */ 293 + void drm_kms_helper_poll_disable(struct drm_device *dev) 294 + { 295 + if (!dev->mode_config.poll_enabled) 296 + return; 297 + cancel_delayed_work_sync(&dev->mode_config.output_poll_work); 298 + } 299 + EXPORT_SYMBOL(drm_kms_helper_poll_disable); 300 + 301 + /** 302 + * drm_kms_helper_poll_enable - re-enable output polling. 303 + * @dev: drm_device 304 + * 305 + * This function re-enables the output polling work. 306 + * 307 + * Drivers can call this helper from their device resume implementation. It is 308 + * an error to call this when the output polling support has not yet been set 309 + * up. 310 + */ 311 + void drm_kms_helper_poll_enable(struct drm_device *dev) 312 + { 313 + bool poll = false; 314 + struct drm_connector *connector; 315 + 316 + if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll) 317 + return; 318 + 319 + list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 320 + if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | 321 + DRM_CONNECTOR_POLL_DISCONNECT)) 322 + poll = true; 323 + } 324 + 325 + if (poll) 326 + schedule_delayed_work(&dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD); 327 + } 328 + EXPORT_SYMBOL(drm_kms_helper_poll_enable); 329 + 330 + /** 331 + * drm_kms_helper_poll_init - initialize and enable output polling 332 + * @dev: drm_device 333 + * 334 + * This function intializes and then also enables output polling support for 335 + * @dev. Drivers which do not have reliable hotplug support in hardware can use 336 + * this helper infrastructure to regularly poll such connectors for changes in 337 + * their connection state. 338 + * 339 + * Drivers can control which connectors are polled by setting the 340 + * DRM_CONNECTOR_POLL_CONNECT and DRM_CONNECTOR_POLL_DISCONNECT flags. On 341 + * connectors where probing live outputs can result in visual distortion drivers 342 + * should not set the DRM_CONNECTOR_POLL_DISCONNECT flag to avoid this. 343 + * Connectors which have no flag or only DRM_CONNECTOR_POLL_HPD set are 344 + * completely ignored by the polling logic. 345 + * 346 + * Note that a connector can be both polled and probed from the hotplug handler, 347 + * in case the hotplug interrupt is known to be unreliable. 348 + */ 349 + void drm_kms_helper_poll_init(struct drm_device *dev) 350 + { 351 + INIT_DELAYED_WORK(&dev->mode_config.output_poll_work, output_poll_execute); 352 + dev->mode_config.poll_enabled = true; 353 + 354 + drm_kms_helper_poll_enable(dev); 355 + } 356 + EXPORT_SYMBOL(drm_kms_helper_poll_init); 357 + 358 + /** 359 + * drm_kms_helper_poll_fini - disable output polling and clean it up 360 + * @dev: drm_device 361 + */ 362 + void drm_kms_helper_poll_fini(struct drm_device *dev) 363 + { 364 + drm_kms_helper_poll_disable(dev); 365 + } 366 + EXPORT_SYMBOL(drm_kms_helper_poll_fini); 367 + 368 + /** 369 + * drm_helper_hpd_irq_event - hotplug processing 370 + * @dev: drm_device 371 + * 372 + * Drivers can use this helper function to run a detect cycle on all connectors 373 + * which have the DRM_CONNECTOR_POLL_HPD flag set in their &polled member. All 374 + * other connectors are ignored, which is useful to avoid reprobing fixed 375 + * panels. 376 + * 377 + * This helper function is useful for drivers which can't or don't track hotplug 378 + * interrupts for each connector. 379 + * 380 + * Drivers which support hotplug interrupts for each connector individually and 381 + * which have a more fine-grained detect logic should bypass this code and 382 + * directly call drm_kms_helper_hotplug_event() in case the connector state 383 + * changed. 384 + * 385 + * This function must be called from process context with no mode 386 + * setting locks held. 387 + * 388 + * Note that a connector can be both polled and probed from the hotplug handler, 389 + * in case the hotplug interrupt is known to be unreliable. 390 + */ 391 + bool drm_helper_hpd_irq_event(struct drm_device *dev) 392 + { 393 + struct drm_connector *connector; 394 + enum drm_connector_status old_status; 395 + bool changed = false; 396 + 397 + if (!dev->mode_config.poll_enabled) 398 + return false; 399 + 400 + mutex_lock(&dev->mode_config.mutex); 401 + list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 402 + 403 + /* Only handle HPD capable connectors. */ 404 + if (!(connector->polled & DRM_CONNECTOR_POLL_HPD)) 405 + continue; 406 + 407 + old_status = connector->status; 408 + 409 + connector->status = connector->funcs->detect(connector, false); 410 + DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n", 411 + connector->base.id, 412 + drm_get_connector_name(connector), 413 + drm_get_connector_status_name(old_status), 414 + drm_get_connector_status_name(connector->status)); 415 + if (old_status != connector->status) 416 + changed = true; 417 + } 418 + 419 + mutex_unlock(&dev->mode_config.mutex); 420 + 421 + if (changed) 422 + drm_kms_helper_hotplug_event(dev); 423 + 424 + return changed; 425 + } 426 + EXPORT_SYMBOL(drm_helper_hpd_irq_event);
+4 -5
drivers/gpu/drm/i915/i915_drv.h
··· 1308 1308 1309 1309 struct { 1310 1310 u16 pwm_freq_hz; 1311 + bool present; 1311 1312 bool active_low_pwm; 1312 1313 } backlight; 1313 1314 ··· 2432 2431 int i915_gem_context_enable(struct drm_i915_private *dev_priv); 2433 2432 void i915_gem_context_close(struct drm_device *dev, struct drm_file *file); 2434 2433 int i915_switch_context(struct intel_ring_buffer *ring, 2435 - struct drm_file *file, struct i915_hw_context *to); 2434 + struct i915_hw_context *to); 2436 2435 struct i915_hw_context * 2437 2436 i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id); 2438 2437 void i915_gem_context_free(struct kref *ctx_ref); 2439 2438 static inline void i915_gem_context_reference(struct i915_hw_context *ctx) 2440 2439 { 2441 - if (ctx->obj && HAS_HW_CONTEXTS(ctx->obj->base.dev)) 2442 - kref_get(&ctx->ref); 2440 + kref_get(&ctx->ref); 2443 2441 } 2444 2442 2445 2443 static inline void i915_gem_context_unreference(struct i915_hw_context *ctx) 2446 2444 { 2447 - if (ctx->obj && HAS_HW_CONTEXTS(ctx->obj->base.dev)) 2448 - kref_put(&ctx->ref, i915_gem_context_free); 2445 + kref_put(&ctx->ref, i915_gem_context_free); 2449 2446 } 2450 2447 2451 2448 static inline bool i915_gem_context_is_default(const struct i915_hw_context *c)
+1 -1
drivers/gpu/drm/i915/i915_gem.c
··· 2790 2790 2791 2791 /* Flush everything onto the inactive list. */ 2792 2792 for_each_ring(ring, dev_priv, i) { 2793 - ret = i915_switch_context(ring, NULL, ring->default_context); 2793 + ret = i915_switch_context(ring, ring->default_context); 2794 2794 if (ret) 2795 2795 return ret; 2796 2796
+89 -131
drivers/gpu/drm/i915/i915_gem_context.c
··· 96 96 #define GEN6_CONTEXT_ALIGN (64<<10) 97 97 #define GEN7_CONTEXT_ALIGN 4096 98 98 99 - static int do_switch(struct intel_ring_buffer *ring, 100 - struct i915_hw_context *to); 101 - 102 99 static void do_ppgtt_cleanup(struct i915_hw_ppgtt *ppgtt) 103 100 { 104 101 struct drm_device *dev = ppgtt->base.dev; ··· 182 185 typeof(*ctx), ref); 183 186 struct i915_hw_ppgtt *ppgtt = NULL; 184 187 185 - /* We refcount even the aliasing PPGTT to keep the code symmetric */ 186 - if (USES_PPGTT(ctx->obj->base.dev)) 187 - ppgtt = ctx_to_ppgtt(ctx); 188 + if (ctx->obj) { 189 + /* We refcount even the aliasing PPGTT to keep the code symmetric */ 190 + if (USES_PPGTT(ctx->obj->base.dev)) 191 + ppgtt = ctx_to_ppgtt(ctx); 188 192 189 - /* XXX: Free up the object before tearing down the address space, in 190 - * case we're bound in the PPGTT */ 191 - drm_gem_object_unreference(&ctx->obj->base); 193 + /* XXX: Free up the object before tearing down the address space, in 194 + * case we're bound in the PPGTT */ 195 + drm_gem_object_unreference(&ctx->obj->base); 196 + } 192 197 193 198 if (ppgtt) 194 199 kref_put(&ppgtt->ref, ppgtt_release); ··· 231 232 return ERR_PTR(-ENOMEM); 232 233 233 234 kref_init(&ctx->ref); 234 - ctx->obj = i915_gem_alloc_object(dev, dev_priv->hw_context_size); 235 - INIT_LIST_HEAD(&ctx->link); 236 - if (ctx->obj == NULL) { 237 - kfree(ctx); 238 - DRM_DEBUG_DRIVER("Context object allocated failed\n"); 239 - return ERR_PTR(-ENOMEM); 240 - } 241 - 242 - if (INTEL_INFO(dev)->gen >= 7) { 243 - ret = i915_gem_object_set_cache_level(ctx->obj, 244 - I915_CACHE_L3_LLC); 245 - /* Failure shouldn't ever happen this early */ 246 - if (WARN_ON(ret)) 247 - goto err_out; 248 - } 249 - 250 235 list_add_tail(&ctx->link, &dev_priv->context_list); 251 236 252 - /* Default context will never have a file_priv */ 253 - if (file_priv == NULL) 254 - return ctx; 237 + if (dev_priv->hw_context_size) { 238 + ctx->obj = i915_gem_alloc_object(dev, dev_priv->hw_context_size); 239 + if (ctx->obj == NULL) { 240 + ret = -ENOMEM; 241 + goto err_out; 242 + } 255 243 256 - ret = idr_alloc(&file_priv->context_idr, ctx, DEFAULT_CONTEXT_ID, 0, 257 - GFP_KERNEL); 258 - if (ret < 0) 259 - goto err_out; 244 + if (INTEL_INFO(dev)->gen >= 7) { 245 + ret = i915_gem_object_set_cache_level(ctx->obj, 246 + I915_CACHE_L3_LLC); 247 + /* Failure shouldn't ever happen this early */ 248 + if (WARN_ON(ret)) 249 + goto err_out; 250 + } 251 + } 252 + 253 + /* Default context will never have a file_priv */ 254 + if (file_priv != NULL) { 255 + ret = idr_alloc(&file_priv->context_idr, ctx, 256 + DEFAULT_CONTEXT_ID, 0, GFP_KERNEL); 257 + if (ret < 0) 258 + goto err_out; 259 + } else 260 + ret = DEFAULT_CONTEXT_ID; 260 261 261 262 ctx->file_priv = file_priv; 262 263 ctx->id = ret; ··· 293 294 if (IS_ERR(ctx)) 294 295 return ctx; 295 296 296 - if (is_global_default_ctx) { 297 + if (is_global_default_ctx && ctx->obj) { 297 298 /* We may need to do things with the shrinker which 298 299 * require us to immediately switch back to the default 299 300 * context. This can cause a problem as pinning the ··· 341 342 return ctx; 342 343 343 344 err_unpin: 344 - if (is_global_default_ctx) 345 + if (is_global_default_ctx && ctx->obj) 345 346 i915_gem_object_ggtt_unpin(ctx->obj); 346 347 err_destroy: 347 348 i915_gem_context_unreference(ctx); ··· 351 352 void i915_gem_context_reset(struct drm_device *dev) 352 353 { 353 354 struct drm_i915_private *dev_priv = dev->dev_private; 354 - struct intel_ring_buffer *ring; 355 355 int i; 356 - 357 - if (!HAS_HW_CONTEXTS(dev)) 358 - return; 359 356 360 357 /* Prevent the hardware from restoring the last context (which hung) on 361 358 * the next switch */ 362 359 for (i = 0; i < I915_NUM_RINGS; i++) { 363 - struct i915_hw_context *dctx; 364 - if (!(INTEL_INFO(dev)->ring_mask & (1<<i))) 365 - continue; 360 + struct intel_ring_buffer *ring = &dev_priv->ring[i]; 361 + struct i915_hw_context *dctx = ring->default_context; 366 362 367 363 /* Do a fake switch to the default context */ 368 - ring = &dev_priv->ring[i]; 369 - dctx = ring->default_context; 370 - if (WARN_ON(!dctx)) 364 + if (ring->last_context == dctx) 371 365 continue; 372 366 373 367 if (!ring->last_context) 374 368 continue; 375 369 376 - if (ring->last_context == dctx) 377 - continue; 378 - 379 - if (i == RCS) { 370 + if (dctx->obj && i == RCS) { 380 371 WARN_ON(i915_gem_obj_ggtt_pin(dctx->obj, 381 372 get_context_alignment(dev), 0)); 382 373 /* Fake a finish/inactive */ ··· 383 394 int i915_gem_context_init(struct drm_device *dev) 384 395 { 385 396 struct drm_i915_private *dev_priv = dev->dev_private; 386 - struct intel_ring_buffer *ring; 397 + struct i915_hw_context *ctx; 387 398 int i; 388 - 389 - if (!HAS_HW_CONTEXTS(dev)) 390 - return 0; 391 399 392 400 /* Init should only be called once per module load. Eventually the 393 401 * restriction on the context_disabled check can be loosened. */ 394 402 if (WARN_ON(dev_priv->ring[RCS].default_context)) 395 403 return 0; 396 404 397 - dev_priv->hw_context_size = round_up(get_context_size(dev), 4096); 398 - 399 - if (dev_priv->hw_context_size > (1<<20)) { 400 - DRM_DEBUG_DRIVER("Disabling HW Contexts; invalid size\n"); 401 - return -E2BIG; 405 + if (HAS_HW_CONTEXTS(dev)) { 406 + dev_priv->hw_context_size = round_up(get_context_size(dev), 4096); 407 + if (dev_priv->hw_context_size > (1<<20)) { 408 + DRM_DEBUG_DRIVER("Disabling HW Contexts; invalid size %d\n", 409 + dev_priv->hw_context_size); 410 + dev_priv->hw_context_size = 0; 411 + } 402 412 } 403 413 404 - dev_priv->ring[RCS].default_context = 405 - i915_gem_create_context(dev, NULL, USES_PPGTT(dev)); 406 - 407 - if (IS_ERR_OR_NULL(dev_priv->ring[RCS].default_context)) { 408 - DRM_DEBUG_DRIVER("Disabling HW Contexts; create failed %ld\n", 409 - PTR_ERR(dev_priv->ring[RCS].default_context)); 410 - return PTR_ERR(dev_priv->ring[RCS].default_context); 414 + ctx = i915_gem_create_context(dev, NULL, USES_PPGTT(dev)); 415 + if (IS_ERR(ctx)) { 416 + DRM_ERROR("Failed to create default global context (error %ld)\n", 417 + PTR_ERR(ctx)); 418 + return PTR_ERR(ctx); 411 419 } 412 420 413 - for (i = RCS + 1; i < I915_NUM_RINGS; i++) { 414 - if (!(INTEL_INFO(dev)->ring_mask & (1<<i))) 415 - continue; 421 + /* NB: RCS will hold a ref for all rings */ 422 + for (i = 0; i < I915_NUM_RINGS; i++) 423 + dev_priv->ring[i].default_context = ctx; 416 424 417 - ring = &dev_priv->ring[i]; 418 - 419 - /* NB: RCS will hold a ref for all rings */ 420 - ring->default_context = dev_priv->ring[RCS].default_context; 421 - } 422 - 423 - DRM_DEBUG_DRIVER("HW context support initialized\n"); 425 + DRM_DEBUG_DRIVER("%s context support initialized\n", dev_priv->hw_context_size ? "HW" : "fake"); 424 426 return 0; 425 427 } 426 428 ··· 421 441 struct i915_hw_context *dctx = dev_priv->ring[RCS].default_context; 422 442 int i; 423 443 424 - if (!HAS_HW_CONTEXTS(dev)) 425 - return; 444 + if (dctx->obj) { 445 + /* The only known way to stop the gpu from accessing the hw context is 446 + * to reset it. Do this as the very last operation to avoid confusing 447 + * other code, leading to spurious errors. */ 448 + intel_gpu_reset(dev); 426 449 427 - /* The only known way to stop the gpu from accessing the hw context is 428 - * to reset it. Do this as the very last operation to avoid confusing 429 - * other code, leading to spurious errors. */ 430 - intel_gpu_reset(dev); 431 - 432 - /* When default context is created and switched to, base object refcount 433 - * will be 2 (+1 from object creation and +1 from do_switch()). 434 - * i915_gem_context_fini() will be called after gpu_idle() has switched 435 - * to default context. So we need to unreference the base object once 436 - * to offset the do_switch part, so that i915_gem_context_unreference() 437 - * can then free the base object correctly. */ 438 - WARN_ON(!dev_priv->ring[RCS].last_context); 439 - if (dev_priv->ring[RCS].last_context == dctx) { 440 - /* Fake switch to NULL context */ 441 - WARN_ON(dctx->obj->active); 442 - i915_gem_object_ggtt_unpin(dctx->obj); 443 - i915_gem_context_unreference(dctx); 444 - dev_priv->ring[RCS].last_context = NULL; 450 + /* When default context is created and switched to, base object refcount 451 + * will be 2 (+1 from object creation and +1 from do_switch()). 452 + * i915_gem_context_fini() will be called after gpu_idle() has switched 453 + * to default context. So we need to unreference the base object once 454 + * to offset the do_switch part, so that i915_gem_context_unreference() 455 + * can then free the base object correctly. */ 456 + WARN_ON(!dev_priv->ring[RCS].last_context); 457 + if (dev_priv->ring[RCS].last_context == dctx) { 458 + /* Fake switch to NULL context */ 459 + WARN_ON(dctx->obj->active); 460 + i915_gem_object_ggtt_unpin(dctx->obj); 461 + i915_gem_context_unreference(dctx); 462 + dev_priv->ring[RCS].last_context = NULL; 463 + } 445 464 } 446 465 447 466 for (i = 0; i < I915_NUM_RINGS; i++) { 448 467 struct intel_ring_buffer *ring = &dev_priv->ring[i]; 449 - if (!(INTEL_INFO(dev)->ring_mask & (1<<i))) 450 - continue; 451 468 452 469 if (ring->last_context) 453 470 i915_gem_context_unreference(ring->last_context); ··· 455 478 456 479 i915_gem_object_ggtt_unpin(dctx->obj); 457 480 i915_gem_context_unreference(dctx); 458 - dev_priv->mm.aliasing_ppgtt = NULL; 459 481 } 460 482 461 483 int i915_gem_context_enable(struct drm_i915_private *dev_priv) 462 484 { 463 485 struct intel_ring_buffer *ring; 464 486 int ret, i; 465 - 466 - if (!HAS_HW_CONTEXTS(dev_priv->dev)) 467 - return 0; 468 487 469 488 /* This is the only place the aliasing PPGTT gets enabled, which means 470 489 * it has to happen before we bail on reset */ ··· 476 503 BUG_ON(!dev_priv->ring[RCS].default_context); 477 504 478 505 for_each_ring(ring, dev_priv, i) { 479 - ret = do_switch(ring, ring->default_context); 506 + ret = i915_switch_context(ring, ring->default_context); 480 507 if (ret) 481 508 return ret; 482 509 } ··· 499 526 int i915_gem_context_open(struct drm_device *dev, struct drm_file *file) 500 527 { 501 528 struct drm_i915_file_private *file_priv = file->driver_priv; 502 - struct drm_i915_private *dev_priv = dev->dev_private; 503 - 504 - if (!HAS_HW_CONTEXTS(dev)) { 505 - /* Cheat for hang stats */ 506 - file_priv->private_default_ctx = 507 - kzalloc(sizeof(struct i915_hw_context), GFP_KERNEL); 508 - 509 - if (file_priv->private_default_ctx == NULL) 510 - return -ENOMEM; 511 - 512 - file_priv->private_default_ctx->vm = &dev_priv->gtt.base; 513 - return 0; 514 - } 515 529 516 530 idr_init(&file_priv->context_idr); 517 531 ··· 519 559 { 520 560 struct drm_i915_file_private *file_priv = file->driver_priv; 521 561 522 - if (!HAS_HW_CONTEXTS(dev)) { 523 - kfree(file_priv->private_default_ctx); 524 - return; 525 - } 526 - 527 562 idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL); 528 - i915_gem_context_unreference(file_priv->private_default_ctx); 529 563 idr_destroy(&file_priv->context_idr); 564 + 565 + i915_gem_context_unreference(file_priv->private_default_ctx); 530 566 } 531 567 532 568 struct i915_hw_context * 533 569 i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id) 534 570 { 535 571 struct i915_hw_context *ctx; 536 - 537 - if (!HAS_HW_CONTEXTS(file_priv->dev_priv->dev)) 538 - return file_priv->private_default_ctx; 539 572 540 573 ctx = (struct i915_hw_context *)idr_find(&file_priv->context_idr, id); 541 574 if (!ctx) ··· 711 758 /** 712 759 * i915_switch_context() - perform a GPU context switch. 713 760 * @ring: ring for which we'll execute the context switch 714 - * @file_priv: file_priv associated with the context, may be NULL 715 761 * @to: the context to switch to 716 762 * 717 763 * The context life cycle is simple. The context refcount is incremented and ··· 719 767 * object while letting the normal object tracking destroy the backing BO. 720 768 */ 721 769 int i915_switch_context(struct intel_ring_buffer *ring, 722 - struct drm_file *file, 723 770 struct i915_hw_context *to) 724 771 { 725 772 struct drm_i915_private *dev_priv = ring->dev->dev_private; 726 773 727 774 WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); 728 775 729 - BUG_ON(file && to == NULL); 730 - 731 - /* We have the fake context */ 732 - if (!HAS_HW_CONTEXTS(ring->dev)) { 733 - ring->last_context = to; 776 + if (to->obj == NULL) { /* We have the fake context */ 777 + if (to != ring->last_context) { 778 + i915_gem_context_reference(to); 779 + if (ring->last_context) 780 + i915_gem_context_unreference(ring->last_context); 781 + ring->last_context = to; 782 + } 734 783 return 0; 735 784 } 736 785 737 786 return do_switch(ring, to); 787 + } 788 + 789 + static bool hw_context_enabled(struct drm_device *dev) 790 + { 791 + return to_i915(dev)->hw_context_size; 738 792 } 739 793 740 794 int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, ··· 751 793 struct i915_hw_context *ctx; 752 794 int ret; 753 795 754 - if (!HAS_HW_CONTEXTS(dev)) 796 + if (!hw_context_enabled(dev)) 755 797 return -ENODEV; 756 798 757 799 ret = i915_mutex_lock_interruptible(dev);
+1 -1
drivers/gpu/drm/i915/i915_gem_execbuffer.c
··· 1221 1221 if (ret) 1222 1222 goto err; 1223 1223 1224 - ret = i915_switch_context(ring, file, ctx); 1224 + ret = i915_switch_context(ring, ctx); 1225 1225 if (ret) 1226 1226 goto err; 1227 1227
+10
drivers/gpu/drm/i915/intel_bios.c
··· 287 287 const struct bdb_lfp_backlight_data *backlight_data; 288 288 const struct bdb_lfp_backlight_data_entry *entry; 289 289 290 + /* Err to enabling backlight if no backlight block. */ 291 + dev_priv->vbt.backlight.present = true; 292 + 290 293 backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT); 291 294 if (!backlight_data) 292 295 return; ··· 301 298 } 302 299 303 300 entry = &backlight_data->data[panel_type]; 301 + 302 + dev_priv->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM; 303 + if (!dev_priv->vbt.backlight.present) { 304 + DRM_DEBUG_KMS("PWM backlight not present in VBT (type %u)\n", 305 + entry->type); 306 + return; 307 + } 304 308 305 309 dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz; 306 310 dev_priv->vbt.backlight.active_low_pwm = entry->active_low_pwm;
+3
drivers/gpu/drm/i915/intel_bios.h
··· 374 374 struct bdb_lvds_lfp_data_entry data[16]; 375 375 } __packed; 376 376 377 + #define BDB_BACKLIGHT_TYPE_NONE 0 378 + #define BDB_BACKLIGHT_TYPE_PWM 2 379 + 377 380 struct bdb_lfp_backlight_data_entry { 378 381 u8 type:2; 379 382 u8 active_low_pwm:1;
+4 -3
drivers/gpu/drm/i915/intel_dp.c
··· 575 575 return ret; 576 576 } 577 577 578 - #define HEADER_SIZE 4 578 + #define BARE_ADDRESS_SIZE 3 579 + #define HEADER_SIZE (BARE_ADDRESS_SIZE + 1) 579 580 static ssize_t 580 581 intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) 581 582 { ··· 593 592 switch (msg->request & ~DP_AUX_I2C_MOT) { 594 593 case DP_AUX_NATIVE_WRITE: 595 594 case DP_AUX_I2C_WRITE: 596 - txsize = HEADER_SIZE + msg->size; 595 + txsize = msg->size ? HEADER_SIZE + msg->size : BARE_ADDRESS_SIZE; 597 596 rxsize = 1; 598 597 599 598 if (WARN_ON(txsize > 20)) ··· 612 611 613 612 case DP_AUX_NATIVE_READ: 614 613 case DP_AUX_I2C_READ: 615 - txsize = HEADER_SIZE; 614 + txsize = msg->size ? HEADER_SIZE : BARE_ADDRESS_SIZE; 616 615 rxsize = msg->size + 1; 617 616 618 617 if (WARN_ON(rxsize > 20))
+5
drivers/gpu/drm/i915/intel_panel.c
··· 1065 1065 unsigned long flags; 1066 1066 int ret; 1067 1067 1068 + if (!dev_priv->vbt.backlight.present) { 1069 + DRM_DEBUG_KMS("native backlight control not available per VBT\n"); 1070 + return 0; 1071 + } 1072 + 1068 1073 /* set level and max in panel struct */ 1069 1074 spin_lock_irqsave(&dev_priv->backlight_lock, flags); 1070 1075 ret = dev_priv->display.setup_backlight(intel_connector);
+10
drivers/gpu/drm/i915/intel_pm.c
··· 1545 1545 1546 1546 DRM_DEBUG_KMS("FIFO watermarks - A: %d, B: %d\n", planea_wm, planeb_wm); 1547 1547 1548 + if (IS_I915GM(dev) && enabled) { 1549 + struct intel_framebuffer *fb; 1550 + 1551 + fb = to_intel_framebuffer(enabled->primary->fb); 1552 + 1553 + /* self-refresh seems busted with untiled */ 1554 + if (fb->obj->tiling_mode == I915_TILING_NONE) 1555 + enabled = NULL; 1556 + } 1557 + 1548 1558 /* 1549 1559 * Overlay gets an aggressive default since video jitter is bad. 1550 1560 */
+1 -1
drivers/gpu/drm/nouveau/core/subdev/bios/base.c
··· 109 109 return; 110 110 } 111 111 112 - addr = (u64)(addr >> 8) << 8; 112 + addr = (addr & 0xffffff00) << 8; 113 113 if (!addr) { 114 114 addr = (u64)nv_rd32(bios, 0x001700) << 16; 115 115 addr += 0xf0000;
+72 -28
drivers/gpu/drm/omapdrm/omap_crtc.c
··· 33 33 int pipe; 34 34 enum omap_channel channel; 35 35 struct omap_overlay_manager_info info; 36 + struct drm_encoder *current_encoder; 36 37 37 38 /* 38 39 * Temporary: eventually this will go away, but it is needed ··· 121 120 { 122 121 } 123 122 123 + static void set_enabled(struct drm_crtc *crtc, bool enable); 124 + 124 125 static int omap_crtc_enable(struct omap_overlay_manager *mgr) 125 126 { 127 + struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; 128 + 129 + dispc_mgr_setup(omap_crtc->channel, &omap_crtc->info); 130 + dispc_mgr_set_timings(omap_crtc->channel, 131 + &omap_crtc->timings); 132 + set_enabled(&omap_crtc->base, true); 133 + 126 134 return 0; 127 135 } 128 136 129 137 static void omap_crtc_disable(struct omap_overlay_manager *mgr) 130 138 { 139 + struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; 140 + 141 + set_enabled(&omap_crtc->base, false); 131 142 } 132 143 133 144 static void omap_crtc_set_timings(struct omap_overlay_manager *mgr, ··· 197 184 WARN_ON(omap_crtc->apply_irq.registered); 198 185 omap_irq_unregister(crtc->dev, &omap_crtc->error_irq); 199 186 200 - omap_crtc->plane->funcs->destroy(omap_crtc->plane); 201 187 drm_crtc_cleanup(crtc); 202 188 203 189 kfree(omap_crtc); ··· 350 338 struct omap_crtc *omap_crtc = to_omap_crtc(crtc); 351 339 struct drm_plane *primary = crtc->primary; 352 340 struct drm_gem_object *bo; 341 + unsigned long flags; 353 342 354 343 DBG("%d -> %d (event=%p)", primary->fb ? primary->fb->base.id : -1, 355 344 fb->base.id, event); 356 345 346 + spin_lock_irqsave(&dev->event_lock, flags); 347 + 357 348 if (omap_crtc->old_fb) { 349 + spin_unlock_irqrestore(&dev->event_lock, flags); 358 350 dev_err(dev->dev, "already a pending flip\n"); 359 351 return -EINVAL; 360 352 } 361 353 362 354 omap_crtc->event = event; 363 - primary->fb = fb; 355 + omap_crtc->old_fb = primary->fb = fb; 356 + 357 + spin_unlock_irqrestore(&dev->event_lock, flags); 364 358 365 359 /* 366 360 * Hold a reference temporarily until the crtc is updated ··· 546 528 struct drm_device *dev = crtc->dev; 547 529 struct omap_crtc *omap_crtc = to_omap_crtc(crtc); 548 530 enum omap_channel channel = omap_crtc->channel; 549 - struct omap_irq_wait *wait = NULL; 531 + struct omap_irq_wait *wait; 532 + u32 framedone_irq, vsync_irq; 533 + int ret; 550 534 551 535 if (dispc_mgr_is_enabled(channel) == enable) 552 536 return; 553 537 554 - /* ignore sync-lost irqs during enable/disable */ 538 + /* 539 + * Digit output produces some sync lost interrupts during the first 540 + * frame when enabling, so we need to ignore those. 541 + */ 555 542 omap_irq_unregister(crtc->dev, &omap_crtc->error_irq); 556 543 557 - if (dispc_mgr_get_framedone_irq(channel)) { 558 - if (!enable) { 559 - wait = omap_irq_wait_init(dev, 560 - dispc_mgr_get_framedone_irq(channel), 1); 561 - } 544 + framedone_irq = dispc_mgr_get_framedone_irq(channel); 545 + vsync_irq = dispc_mgr_get_vsync_irq(channel); 546 + 547 + if (enable) { 548 + wait = omap_irq_wait_init(dev, vsync_irq, 1); 562 549 } else { 563 550 /* 564 - * When we disable digit output, we need to wait until fields 565 - * are done. Otherwise the DSS is still working, and turning 566 - * off the clocks prevents DSS from going to OFF mode. And when 567 - * enabling, we need to wait for the extra sync losts 551 + * When we disable the digit output, we need to wait for 552 + * FRAMEDONE to know that DISPC has finished with the output. 553 + * 554 + * OMAP2/3 does not have FRAMEDONE irq for digit output, and in 555 + * that case we need to use vsync interrupt, and wait for both 556 + * even and odd frames. 568 557 */ 569 - wait = omap_irq_wait_init(dev, 570 - dispc_mgr_get_vsync_irq(channel), 2); 558 + 559 + if (framedone_irq) 560 + wait = omap_irq_wait_init(dev, framedone_irq, 1); 561 + else 562 + wait = omap_irq_wait_init(dev, vsync_irq, 2); 571 563 } 572 564 573 565 dispc_mgr_enable(channel, enable); 574 566 575 - if (wait) { 576 - int ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100)); 577 - if (ret) { 578 - dev_err(dev->dev, "%s: timeout waiting for %s\n", 579 - omap_crtc->name, enable ? "enable" : "disable"); 580 - } 567 + ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100)); 568 + if (ret) { 569 + dev_err(dev->dev, "%s: timeout waiting for %s\n", 570 + omap_crtc->name, enable ? "enable" : "disable"); 581 571 } 582 572 583 573 omap_irq_register(crtc->dev, &omap_crtc->error_irq); ··· 612 586 } 613 587 } 614 588 589 + if (omap_crtc->current_encoder && encoder != omap_crtc->current_encoder) 590 + omap_encoder_set_enabled(omap_crtc->current_encoder, false); 591 + 592 + omap_crtc->current_encoder = encoder; 593 + 615 594 if (!omap_crtc->enabled) { 616 - set_enabled(&omap_crtc->base, false); 617 595 if (encoder) 618 596 omap_encoder_set_enabled(encoder, false); 619 597 } else { ··· 626 596 omap_encoder_update(encoder, omap_crtc->mgr, 627 597 &omap_crtc->timings); 628 598 omap_encoder_set_enabled(encoder, true); 629 - omap_crtc->full_update = false; 630 599 } 631 - 632 - dispc_mgr_setup(omap_crtc->channel, &omap_crtc->info); 633 - dispc_mgr_set_timings(omap_crtc->channel, 634 - &omap_crtc->timings); 635 - set_enabled(&omap_crtc->base, true); 636 600 } 637 601 638 602 omap_crtc->full_update = false; ··· 637 613 /* nothing needed for post-apply */ 638 614 } 639 615 616 + void omap_crtc_flush(struct drm_crtc *crtc) 617 + { 618 + struct omap_crtc *omap_crtc = to_omap_crtc(crtc); 619 + int loops = 0; 620 + 621 + while (!list_empty(&omap_crtc->pending_applies) || 622 + !list_empty(&omap_crtc->queued_applies) || 623 + omap_crtc->event || omap_crtc->old_fb) { 624 + 625 + if (++loops > 10) { 626 + dev_err(crtc->dev->dev, 627 + "omap_crtc_flush() timeout\n"); 628 + break; 629 + } 630 + 631 + schedule_timeout_uninterruptible(msecs_to_jiffies(20)); 632 + } 633 + } 634 + 640 635 static const char *channel_names[] = { 641 636 [OMAP_DSS_CHANNEL_LCD] = "lcd", 642 637 [OMAP_DSS_CHANNEL_DIGIT] = "tv", 643 638 [OMAP_DSS_CHANNEL_LCD2] = "lcd2", 639 + [OMAP_DSS_CHANNEL_LCD3] = "lcd3", 644 640 }; 645 641 646 642 void omap_crtc_pre_init(void)
+27 -5
drivers/gpu/drm/omapdrm/omap_drv.c
··· 513 513 static int dev_unload(struct drm_device *dev) 514 514 { 515 515 struct omap_drm_private *priv = dev->dev_private; 516 + int i; 516 517 517 518 DBG("unload: dev=%p", dev); 518 519 519 520 drm_kms_helper_poll_fini(dev); 520 521 521 522 omap_fbdev_free(dev); 523 + 524 + /* flush crtcs so the fbs get released */ 525 + for (i = 0; i < priv->num_crtcs; i++) 526 + omap_crtc_flush(priv->crtcs[i]); 527 + 522 528 omap_modeset_free(dev); 523 529 omap_gem_deinit(dev); 524 530 ··· 702 696 { 703 697 DBG(""); 704 698 699 + drm_put_dev(platform_get_drvdata(device)); 700 + 705 701 omap_disconnect_dssdevs(); 706 702 omap_crtc_pre_uninit(); 707 703 708 - drm_put_dev(platform_get_drvdata(device)); 709 704 return 0; 710 705 } 711 706 ··· 733 726 734 727 static int __init omap_drm_init(void) 735 728 { 729 + int r; 730 + 736 731 DBG("init"); 737 - if (platform_driver_register(&omap_dmm_driver)) { 738 - /* we can continue on without DMM.. so not fatal */ 739 - dev_err(NULL, "DMM registration failed\n"); 732 + 733 + r = platform_driver_register(&omap_dmm_driver); 734 + if (r) { 735 + pr_err("DMM driver registration failed\n"); 736 + return r; 740 737 } 741 - return platform_driver_register(&pdev); 738 + 739 + r = platform_driver_register(&pdev); 740 + if (r) { 741 + pr_err("omapdrm driver registration failed\n"); 742 + platform_driver_unregister(&omap_dmm_driver); 743 + return r; 744 + } 745 + 746 + return 0; 742 747 } 743 748 744 749 static void __exit omap_drm_fini(void) 745 750 { 746 751 DBG("fini"); 752 + 747 753 platform_driver_unregister(&pdev); 754 + 755 + platform_driver_unregister(&omap_dmm_driver); 748 756 } 749 757 750 758 /* need late_initcall() so we load after dss_driver's are loaded */
+1
drivers/gpu/drm/omapdrm/omap_drv.h
··· 163 163 void omap_crtc_pre_uninit(void); 164 164 struct drm_crtc *omap_crtc_init(struct drm_device *dev, 165 165 struct drm_plane *plane, enum omap_channel channel, int id); 166 + void omap_crtc_flush(struct drm_crtc *crtc); 166 167 167 168 struct drm_plane *omap_plane_init(struct drm_device *dev, 168 169 int plane_id, bool private_plane);
+14
drivers/gpu/drm/omapdrm/omap_fb.c
··· 218 218 info->rotation_type = OMAP_DSS_ROT_TILER; 219 219 info->screen_width = omap_gem_tiled_stride(plane->bo, orient); 220 220 } else { 221 + switch (win->rotation & 0xf) { 222 + case 0: 223 + case BIT(DRM_ROTATE_0): 224 + /* OK */ 225 + break; 226 + 227 + default: 228 + dev_warn(fb->dev->dev, 229 + "rotation '%d' ignored for non-tiled fb\n", 230 + win->rotation); 231 + win->rotation = 0; 232 + break; 233 + } 234 + 221 235 info->paddr = get_linear_addr(plane, format, 0, x, y); 222 236 info->rotation_type = OMAP_DSS_ROT_DMA; 223 237 info->screen_width = plane->pitch;
+3
drivers/gpu/drm/omapdrm/omap_fbdev.c
··· 371 371 372 372 fbdev = to_omap_fbdev(priv->fbdev); 373 373 374 + /* release the ref taken in omap_fbdev_create() */ 375 + omap_gem_put_paddr(fbdev->bo); 376 + 374 377 /* this will free the backing object */ 375 378 if (fbdev->fb) { 376 379 drm_framebuffer_unregister_private(fbdev->fb);
+4 -5
drivers/gpu/drm/omapdrm/omap_gem.c
··· 980 980 #ifdef CONFIG_DEBUG_FS 981 981 void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m) 982 982 { 983 - struct drm_device *dev = obj->dev; 984 983 struct omap_gem_object *omap_obj = to_omap_bo(obj); 985 984 uint64_t off; 986 - 987 - WARN_ON(!mutex_is_locked(&dev->struct_mutex)); 988 985 989 986 off = drm_vma_node_start(&obj->vma_node); 990 987 ··· 1047 1050 { 1048 1051 struct omap_gem_object *omap_obj = waiter->omap_obj; 1049 1052 if ((waiter->op & OMAP_GEM_READ) && 1050 - (omap_obj->sync->read_complete < waiter->read_target)) 1053 + (omap_obj->sync->write_complete < waiter->write_target)) 1051 1054 return true; 1052 1055 if ((waiter->op & OMAP_GEM_WRITE) && 1053 - (omap_obj->sync->write_complete < waiter->write_target)) 1056 + (omap_obj->sync->read_complete < waiter->read_target)) 1054 1057 return true; 1055 1058 return false; 1056 1059 } ··· 1226 1229 } 1227 1230 1228 1231 spin_unlock(&sync_lock); 1232 + 1233 + kfree(waiter); 1229 1234 } 1230 1235 1231 1236 /* no waiting.. */
+12 -4
drivers/gpu/drm/omapdrm/omap_plane.c
··· 225 225 omap_plane->apply_done_cb.arg = arg; 226 226 } 227 227 228 + if (plane->fb) 229 + drm_framebuffer_unreference(plane->fb); 230 + 231 + drm_framebuffer_reference(fb); 232 + 228 233 plane->fb = fb; 229 234 plane->crtc = crtc; 230 235 ··· 246 241 struct omap_plane *omap_plane = to_omap_plane(plane); 247 242 omap_plane->enabled = true; 248 243 249 - if (plane->fb) 250 - drm_framebuffer_unreference(plane->fb); 251 - 252 - drm_framebuffer_reference(fb); 244 + /* omap_plane_mode_set() takes adjusted src */ 245 + switch (omap_plane->win.rotation & 0xf) { 246 + case BIT(DRM_ROTATE_90): 247 + case BIT(DRM_ROTATE_270): 248 + swap(src_w, src_h); 249 + break; 250 + } 253 251 254 252 return omap_plane_mode_set(plane, crtc, fb, 255 253 crtc_x, crtc_y, crtc_w, crtc_h,
+35 -105
drivers/gpu/drm/radeon/atombios_dp.c
··· 142 142 return recv_bytes; 143 143 } 144 144 145 - #define HEADER_SIZE 4 145 + #define BARE_ADDRESS_SIZE 3 146 + #define HEADER_SIZE (BARE_ADDRESS_SIZE + 1) 146 147 147 148 static ssize_t 148 149 radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) ··· 161 160 tx_buf[0] = msg->address & 0xff; 162 161 tx_buf[1] = msg->address >> 8; 163 162 tx_buf[2] = msg->request << 4; 164 - tx_buf[3] = msg->size - 1; 163 + tx_buf[3] = msg->size ? (msg->size - 1) : 0; 165 164 166 165 switch (msg->request & ~DP_AUX_I2C_MOT) { 167 166 case DP_AUX_NATIVE_WRITE: 168 167 case DP_AUX_I2C_WRITE: 168 + /* tx_size needs to be 4 even for bare address packets since the atom 169 + * table needs the info in tx_buf[3]. 170 + */ 169 171 tx_size = HEADER_SIZE + msg->size; 170 - tx_buf[3] |= tx_size << 4; 172 + if (msg->size == 0) 173 + tx_buf[3] |= BARE_ADDRESS_SIZE << 4; 174 + else 175 + tx_buf[3] |= tx_size << 4; 171 176 memcpy(tx_buf + HEADER_SIZE, msg->buffer, msg->size); 172 177 ret = radeon_process_aux_ch(chan, 173 178 tx_buf, tx_size, NULL, 0, delay, &ack); ··· 183 176 break; 184 177 case DP_AUX_NATIVE_READ: 185 178 case DP_AUX_I2C_READ: 179 + /* tx_size needs to be 4 even for bare address packets since the atom 180 + * table needs the info in tx_buf[3]. 181 + */ 186 182 tx_size = HEADER_SIZE; 187 - tx_buf[3] |= tx_size << 4; 183 + if (msg->size == 0) 184 + tx_buf[3] |= BARE_ADDRESS_SIZE << 4; 185 + else 186 + tx_buf[3] |= tx_size << 4; 188 187 ret = radeon_process_aux_ch(chan, 189 188 tx_buf, tx_size, msg->buffer, msg->size, delay, &ack); 190 189 break; ··· 199 186 break; 200 187 } 201 188 202 - if (ret > 0) 189 + if (ret >= 0) 203 190 msg->reply = ack >> 4; 204 191 205 192 return ret; ··· 207 194 208 195 void radeon_dp_aux_init(struct radeon_connector *radeon_connector) 209 196 { 210 - struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; 211 - 212 - dig_connector->dp_i2c_bus->aux.dev = radeon_connector->base.kdev; 213 - dig_connector->dp_i2c_bus->aux.transfer = radeon_dp_aux_transfer; 214 - } 215 - 216 - int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, 217 - u8 write_byte, u8 *read_byte) 218 - { 219 - struct i2c_algo_dp_aux_data *algo_data = adapter->algo_data; 220 - struct radeon_i2c_chan *auxch = i2c_get_adapdata(adapter); 221 - u16 address = algo_data->address; 222 - u8 msg[5]; 223 - u8 reply[2]; 224 - unsigned retry; 225 - int msg_bytes; 226 - int reply_bytes = 1; 227 197 int ret; 228 - u8 ack; 229 198 230 - /* Set up the address */ 231 - msg[0] = address; 232 - msg[1] = address >> 8; 199 + radeon_connector->ddc_bus->aux.dev = radeon_connector->base.kdev; 200 + radeon_connector->ddc_bus->aux.transfer = radeon_dp_aux_transfer; 201 + ret = drm_dp_aux_register_i2c_bus(&radeon_connector->ddc_bus->aux); 202 + if (!ret) 203 + radeon_connector->ddc_bus->has_aux = true; 233 204 234 - /* Set up the command byte */ 235 - if (mode & MODE_I2C_READ) { 236 - msg[2] = DP_AUX_I2C_READ << 4; 237 - msg_bytes = 4; 238 - msg[3] = msg_bytes << 4; 239 - } else { 240 - msg[2] = DP_AUX_I2C_WRITE << 4; 241 - msg_bytes = 5; 242 - msg[3] = msg_bytes << 4; 243 - msg[4] = write_byte; 244 - } 245 - 246 - /* special handling for start/stop */ 247 - if (mode & (MODE_I2C_START | MODE_I2C_STOP)) 248 - msg[3] = 3 << 4; 249 - 250 - /* Set MOT bit for all but stop */ 251 - if ((mode & MODE_I2C_STOP) == 0) 252 - msg[2] |= DP_AUX_I2C_MOT << 4; 253 - 254 - for (retry = 0; retry < 7; retry++) { 255 - ret = radeon_process_aux_ch(auxch, 256 - msg, msg_bytes, reply, reply_bytes, 0, &ack); 257 - if (ret == -EBUSY) 258 - continue; 259 - else if (ret < 0) { 260 - DRM_DEBUG_KMS("aux_ch failed %d\n", ret); 261 - return ret; 262 - } 263 - 264 - switch ((ack >> 4) & DP_AUX_NATIVE_REPLY_MASK) { 265 - case DP_AUX_NATIVE_REPLY_ACK: 266 - /* I2C-over-AUX Reply field is only valid 267 - * when paired with AUX ACK. 268 - */ 269 - break; 270 - case DP_AUX_NATIVE_REPLY_NACK: 271 - DRM_DEBUG_KMS("aux_ch native nack\n"); 272 - return -EREMOTEIO; 273 - case DP_AUX_NATIVE_REPLY_DEFER: 274 - DRM_DEBUG_KMS("aux_ch native defer\n"); 275 - usleep_range(500, 600); 276 - continue; 277 - default: 278 - DRM_ERROR("aux_ch invalid native reply 0x%02x\n", ack); 279 - return -EREMOTEIO; 280 - } 281 - 282 - switch ((ack >> 4) & DP_AUX_I2C_REPLY_MASK) { 283 - case DP_AUX_I2C_REPLY_ACK: 284 - if (mode == MODE_I2C_READ) 285 - *read_byte = reply[0]; 286 - return ret; 287 - case DP_AUX_I2C_REPLY_NACK: 288 - DRM_DEBUG_KMS("aux_i2c nack\n"); 289 - return -EREMOTEIO; 290 - case DP_AUX_I2C_REPLY_DEFER: 291 - DRM_DEBUG_KMS("aux_i2c defer\n"); 292 - usleep_range(400, 500); 293 - break; 294 - default: 295 - DRM_ERROR("aux_i2c invalid reply 0x%02x\n", ack); 296 - return -EREMOTEIO; 297 - } 298 - } 299 - 300 - DRM_DEBUG_KMS("aux i2c too many retries, giving up\n"); 301 - return -EREMOTEIO; 205 + WARN(ret, "drm_dp_aux_register_i2c_bus() failed with error %d\n", ret); 302 206 } 303 207 304 208 /***** general DP utility functions *****/ ··· 350 420 351 421 u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector) 352 422 { 353 - struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; 354 423 struct drm_device *dev = radeon_connector->base.dev; 355 424 struct radeon_device *rdev = dev->dev_private; 356 425 357 426 return radeon_dp_encoder_service(rdev, ATOM_DP_ACTION_GET_SINK_TYPE, 0, 358 - dig_connector->dp_i2c_bus->rec.i2c_id, 0); 427 + radeon_connector->ddc_bus->rec.i2c_id, 0); 359 428 } 360 429 361 430 static void radeon_dp_probe_oui(struct radeon_connector *radeon_connector) ··· 365 436 if (!(dig_connector->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT)) 366 437 return; 367 438 368 - if (drm_dp_dpcd_read(&dig_connector->dp_i2c_bus->aux, DP_SINK_OUI, buf, 3)) 439 + if (drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_SINK_OUI, buf, 3)) 369 440 DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n", 370 441 buf[0], buf[1], buf[2]); 371 442 372 - if (drm_dp_dpcd_read(&dig_connector->dp_i2c_bus->aux, DP_BRANCH_OUI, buf, 3)) 443 + if (drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_BRANCH_OUI, buf, 3)) 373 444 DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n", 374 445 buf[0], buf[1], buf[2]); 375 446 } ··· 380 451 u8 msg[DP_DPCD_SIZE]; 381 452 int ret, i; 382 453 383 - ret = drm_dp_dpcd_read(&dig_connector->dp_i2c_bus->aux, DP_DPCD_REV, msg, 454 + ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, 384 455 DP_DPCD_SIZE); 385 456 if (ret > 0) { 386 457 memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); ··· 418 489 419 490 if (dp_bridge != ENCODER_OBJECT_ID_NONE) { 420 491 /* DP bridge chips */ 421 - drm_dp_dpcd_readb(&dig_connector->dp_i2c_bus->aux, 492 + drm_dp_dpcd_readb(&radeon_connector->ddc_bus->aux, 422 493 DP_EDP_CONFIGURATION_CAP, &tmp); 423 494 if (tmp & 1) 424 495 panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; ··· 429 500 panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; 430 501 } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { 431 502 /* eDP */ 432 - drm_dp_dpcd_readb(&dig_connector->dp_i2c_bus->aux, 503 + drm_dp_dpcd_readb(&radeon_connector->ddc_bus->aux, 433 504 DP_EDP_CONFIGURATION_CAP, &tmp); 434 505 if (tmp & 1) 435 506 panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; ··· 483 554 u8 link_status[DP_LINK_STATUS_SIZE]; 484 555 struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; 485 556 486 - if (drm_dp_dpcd_read_link_status(&dig->dp_i2c_bus->aux, link_status) <= 0) 557 + if (drm_dp_dpcd_read_link_status(&radeon_connector->ddc_bus->aux, link_status) 558 + <= 0) 487 559 return false; 488 560 if (drm_dp_channel_eq_ok(link_status, dig->dp_lane_count)) 489 561 return false; ··· 504 574 505 575 /* power up/down the sink */ 506 576 if (dig_connector->dpcd[0] >= 0x11) { 507 - drm_dp_dpcd_writeb(&dig_connector->dp_i2c_bus->aux, 577 + drm_dp_dpcd_writeb(&radeon_connector->ddc_bus->aux, 508 578 DP_SET_POWER, power_state); 509 579 usleep_range(1000, 2000); 510 580 } ··· 808 878 else 809 879 dp_info.enc_id |= ATOM_DP_CONFIG_LINK_A; 810 880 811 - drm_dp_dpcd_readb(&dig_connector->dp_i2c_bus->aux, DP_MAX_LANE_COUNT, &tmp); 881 + drm_dp_dpcd_readb(&radeon_connector->ddc_bus->aux, DP_MAX_LANE_COUNT, &tmp); 812 882 if (ASIC_IS_DCE5(rdev) && (tmp & DP_TPS3_SUPPORTED)) 813 883 dp_info.tp3_supported = true; 814 884 else ··· 820 890 dp_info.connector = connector; 821 891 dp_info.dp_lane_count = dig_connector->dp_lane_count; 822 892 dp_info.dp_clock = dig_connector->dp_clock; 823 - dp_info.aux = &dig_connector->dp_i2c_bus->aux; 893 + dp_info.aux = &radeon_connector->ddc_bus->aux; 824 894 825 895 if (radeon_dp_link_train_init(&dp_info)) 826 896 goto done;
+21 -12
drivers/gpu/drm/radeon/ci_dpm.c
··· 21 21 * 22 22 */ 23 23 24 + #include <linux/firmware.h> 24 25 #include "drmP.h" 25 26 #include "radeon.h" 27 + #include "radeon_ucode.h" 26 28 #include "cikd.h" 27 29 #include "r600_dpm.h" 28 30 #include "ci_dpm.h" ··· 204 202 struct ci_power_info *pi = ci_get_pi(rdev); 205 203 206 204 switch (rdev->pdev->device) { 205 + case 0x6649: 207 206 case 0x6650: 207 + case 0x6651: 208 208 case 0x6658: 209 209 case 0x665C: 210 + case 0x665D: 210 211 default: 211 212 pi->powertune_defaults = &defaults_bonaire_xt; 212 213 break; 213 - case 0x6651: 214 - case 0x665D: 215 - pi->powertune_defaults = &defaults_bonaire_pro; 216 - break; 217 214 case 0x6640: 218 - pi->powertune_defaults = &defaults_saturn_xt; 219 - break; 220 215 case 0x6641: 221 - pi->powertune_defaults = &defaults_saturn_pro; 216 + case 0x6646: 217 + case 0x6647: 218 + pi->powertune_defaults = &defaults_saturn_xt; 222 219 break; 223 220 case 0x67B8: 224 221 case 0x67B0: 222 + pi->powertune_defaults = &defaults_hawaii_xt; 223 + break; 224 + case 0x67BA: 225 + case 0x67B1: 226 + pi->powertune_defaults = &defaults_hawaii_pro; 227 + break; 225 228 case 0x67A0: 226 229 case 0x67A1: 227 230 case 0x67A2: ··· 235 228 case 0x67AA: 236 229 case 0x67B9: 237 230 case 0x67BE: 238 - pi->powertune_defaults = &defaults_hawaii_xt; 239 - break; 240 - case 0x67BA: 241 - case 0x67B1: 242 - pi->powertune_defaults = &defaults_hawaii_pro; 231 + pi->powertune_defaults = &defaults_bonaire_xt; 243 232 break; 244 233 } 245 234 ··· 5148 5145 pi->sclk_dpm_key_disabled = 0; 5149 5146 pi->mclk_dpm_key_disabled = 0; 5150 5147 pi->pcie_dpm_key_disabled = 0; 5148 + 5149 + /* mclk dpm is unstable on some R7 260X cards with the old mc ucode */ 5150 + if ((rdev->pdev->device == 0x6658) && 5151 + (rdev->mc_fw->size == (BONAIRE_MC_UCODE_SIZE * 4))) { 5152 + pi->mclk_dpm_key_disabled = 1; 5153 + } 5151 5154 5152 5155 pi->caps_sclk_ds = true; 5153 5156
+19 -9
drivers/gpu/drm/radeon/cik.c
··· 38 38 MODULE_FIRMWARE("radeon/BONAIRE_ce.bin"); 39 39 MODULE_FIRMWARE("radeon/BONAIRE_mec.bin"); 40 40 MODULE_FIRMWARE("radeon/BONAIRE_mc.bin"); 41 + MODULE_FIRMWARE("radeon/BONAIRE_mc2.bin"); 41 42 MODULE_FIRMWARE("radeon/BONAIRE_rlc.bin"); 42 43 MODULE_FIRMWARE("radeon/BONAIRE_sdma.bin"); 43 44 MODULE_FIRMWARE("radeon/BONAIRE_smc.bin"); ··· 47 46 MODULE_FIRMWARE("radeon/HAWAII_ce.bin"); 48 47 MODULE_FIRMWARE("radeon/HAWAII_mec.bin"); 49 48 MODULE_FIRMWARE("radeon/HAWAII_mc.bin"); 49 + MODULE_FIRMWARE("radeon/HAWAII_mc2.bin"); 50 50 MODULE_FIRMWARE("radeon/HAWAII_rlc.bin"); 51 51 MODULE_FIRMWARE("radeon/HAWAII_sdma.bin"); 52 52 MODULE_FIRMWARE("radeon/HAWAII_smc.bin"); ··· 1705 1703 const __be32 *fw_data; 1706 1704 u32 running, blackout = 0; 1707 1705 u32 *io_mc_regs; 1708 - int i, ucode_size, regs_size; 1706 + int i, regs_size, ucode_size; 1709 1707 1710 1708 if (!rdev->mc_fw) 1711 1709 return -EINVAL; 1712 1710 1711 + ucode_size = rdev->mc_fw->size / 4; 1712 + 1713 1713 switch (rdev->family) { 1714 1714 case CHIP_BONAIRE: 1715 1715 io_mc_regs = (u32 *)&bonaire_io_mc_regs; 1716 - ucode_size = CIK_MC_UCODE_SIZE; 1717 1716 regs_size = BONAIRE_IO_MC_REGS_SIZE; 1718 1717 break; 1719 1718 case CHIP_HAWAII: 1720 1719 io_mc_regs = (u32 *)&hawaii_io_mc_regs; 1721 - ucode_size = HAWAII_MC_UCODE_SIZE; 1722 1720 regs_size = HAWAII_IO_MC_REGS_SIZE; 1723 1721 break; 1724 1722 default: ··· 1785 1783 const char *chip_name; 1786 1784 size_t pfp_req_size, me_req_size, ce_req_size, 1787 1785 mec_req_size, rlc_req_size, mc_req_size = 0, 1788 - sdma_req_size, smc_req_size = 0; 1786 + sdma_req_size, smc_req_size = 0, mc2_req_size = 0; 1789 1787 char fw_name[30]; 1790 1788 int err; 1791 1789 ··· 1799 1797 ce_req_size = CIK_CE_UCODE_SIZE * 4; 1800 1798 mec_req_size = CIK_MEC_UCODE_SIZE * 4; 1801 1799 rlc_req_size = BONAIRE_RLC_UCODE_SIZE * 4; 1802 - mc_req_size = CIK_MC_UCODE_SIZE * 4; 1800 + mc_req_size = BONAIRE_MC_UCODE_SIZE * 4; 1801 + mc2_req_size = BONAIRE_MC2_UCODE_SIZE * 4; 1803 1802 sdma_req_size = CIK_SDMA_UCODE_SIZE * 4; 1804 1803 smc_req_size = ALIGN(BONAIRE_SMC_UCODE_SIZE, 4); 1805 1804 break; ··· 1812 1809 mec_req_size = CIK_MEC_UCODE_SIZE * 4; 1813 1810 rlc_req_size = BONAIRE_RLC_UCODE_SIZE * 4; 1814 1811 mc_req_size = HAWAII_MC_UCODE_SIZE * 4; 1812 + mc2_req_size = HAWAII_MC2_UCODE_SIZE * 4; 1815 1813 sdma_req_size = CIK_SDMA_UCODE_SIZE * 4; 1816 1814 smc_req_size = ALIGN(HAWAII_SMC_UCODE_SIZE, 4); 1817 1815 break; ··· 1908 1904 1909 1905 /* No SMC, MC ucode on APUs */ 1910 1906 if (!(rdev->flags & RADEON_IS_IGP)) { 1911 - snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); 1907 + snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc2.bin", chip_name); 1912 1908 err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); 1913 - if (err) 1914 - goto out; 1915 - if (rdev->mc_fw->size != mc_req_size) { 1909 + if (err) { 1910 + snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); 1911 + err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); 1912 + if (err) 1913 + goto out; 1914 + } 1915 + if ((rdev->mc_fw->size != mc_req_size) && 1916 + (rdev->mc_fw->size != mc2_req_size)){ 1916 1917 printk(KERN_ERR 1917 1918 "cik_mc: Bogus length %zu in firmware \"%s\"\n", 1918 1919 rdev->mc_fw->size, fw_name); 1919 1920 err = -EINVAL; 1920 1921 } 1922 + DRM_INFO("%s: %zu bytes\n", fw_name, rdev->mc_fw->size); 1921 1923 1922 1924 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); 1923 1925 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
+10 -4
drivers/gpu/drm/radeon/dce6_afmt.c
··· 309 309 310 310 rdev->audio.enabled = true; 311 311 312 - if (ASIC_IS_DCE8(rdev)) 312 + if (ASIC_IS_DCE81(rdev)) /* KV: 4 streams, 7 endpoints */ 313 + rdev->audio.num_pins = 7; 314 + else if (ASIC_IS_DCE83(rdev)) /* KB: 2 streams, 3 endpoints */ 315 + rdev->audio.num_pins = 3; 316 + else if (ASIC_IS_DCE8(rdev)) /* BN/HW: 6 streams, 7 endpoints */ 317 + rdev->audio.num_pins = 7; 318 + else if (ASIC_IS_DCE61(rdev)) /* TN: 4 streams, 6 endpoints */ 313 319 rdev->audio.num_pins = 6; 314 - else if (ASIC_IS_DCE61(rdev)) 315 - rdev->audio.num_pins = 4; 316 - else 320 + else if (ASIC_IS_DCE64(rdev)) /* OL: 2 streams, 2 endpoints */ 321 + rdev->audio.num_pins = 2; 322 + else /* SI: 6 streams, 6 endpoints */ 317 323 rdev->audio.num_pins = 6; 318 324 319 325 for (i = 0; i < rdev->audio.num_pins; i++) {
+5 -1
drivers/gpu/drm/radeon/radeon.h
··· 739 739 struct cik_irq_stat_regs cik; 740 740 }; 741 741 742 - #define RADEON_MAX_HPD_PINS 6 742 + #define RADEON_MAX_HPD_PINS 7 743 743 #define RADEON_MAX_CRTCS 6 744 744 #define RADEON_MAX_AFMT_BLOCKS 7 745 745 ··· 2321 2321 bool have_disp_power_ref; 2322 2322 }; 2323 2323 2324 + bool radeon_is_px(struct drm_device *dev); 2324 2325 int radeon_device_init(struct radeon_device *rdev, 2325 2326 struct drm_device *ddev, 2326 2327 struct pci_dev *pdev, ··· 2632 2631 #define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND)) 2633 2632 #define ASIC_IS_NODCE(rdev) ((rdev->family == CHIP_HAINAN)) 2634 2633 #define ASIC_IS_DCE8(rdev) ((rdev->family >= CHIP_BONAIRE)) 2634 + #define ASIC_IS_DCE81(rdev) ((rdev->family == CHIP_KAVERI)) 2635 + #define ASIC_IS_DCE82(rdev) ((rdev->family == CHIP_BONAIRE)) 2636 + #define ASIC_IS_DCE83(rdev) ((rdev->family == CHIP_KABINI)) 2635 2637 2636 2638 #define ASIC_IS_LOMBOK(rdev) ((rdev->ddev->pdev->device == 0x6849) || \ 2637 2639 (rdev->ddev->pdev->device == 0x6850) || \
+1 -1
drivers/gpu/drm/radeon/radeon_atpx_handler.c
··· 59 59 u16 mux; 60 60 } __packed; 61 61 62 - bool radeon_is_px(void) { 62 + bool radeon_has_atpx(void) { 63 63 return radeon_atpx_priv.atpx_detected; 64 64 } 65 65
+7 -37
drivers/gpu/drm/radeon/radeon_connectors.c
··· 1261 1261 .force = radeon_dvi_force, 1262 1262 }; 1263 1263 1264 - static void radeon_dp_connector_destroy(struct drm_connector *connector) 1265 - { 1266 - struct radeon_connector *radeon_connector = to_radeon_connector(connector); 1267 - struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; 1268 - 1269 - if (radeon_connector->edid) 1270 - kfree(radeon_connector->edid); 1271 - if (radeon_dig_connector->dp_i2c_bus) 1272 - radeon_i2c_destroy(radeon_dig_connector->dp_i2c_bus); 1273 - kfree(radeon_connector->con_priv); 1274 - drm_sysfs_connector_remove(connector); 1275 - drm_connector_cleanup(connector); 1276 - kfree(connector); 1277 - } 1278 - 1279 1264 static int radeon_dp_get_modes(struct drm_connector *connector) 1280 1265 { 1281 1266 struct radeon_connector *radeon_connector = to_radeon_connector(connector); ··· 1538 1553 .detect = radeon_dp_detect, 1539 1554 .fill_modes = drm_helper_probe_single_connector_modes, 1540 1555 .set_property = radeon_connector_set_property, 1541 - .destroy = radeon_dp_connector_destroy, 1556 + .destroy = radeon_connector_destroy, 1542 1557 .force = radeon_dvi_force, 1543 1558 }; 1544 1559 ··· 1547 1562 .detect = radeon_dp_detect, 1548 1563 .fill_modes = drm_helper_probe_single_connector_modes, 1549 1564 .set_property = radeon_lvds_set_property, 1550 - .destroy = radeon_dp_connector_destroy, 1565 + .destroy = radeon_connector_destroy, 1551 1566 .force = radeon_dvi_force, 1552 1567 }; 1553 1568 ··· 1556 1571 .detect = radeon_dp_detect, 1557 1572 .fill_modes = drm_helper_probe_single_connector_modes, 1558 1573 .set_property = radeon_lvds_set_property, 1559 - .destroy = radeon_dp_connector_destroy, 1574 + .destroy = radeon_connector_destroy, 1560 1575 .force = radeon_dvi_force, 1561 1576 }; 1562 1577 ··· 1653 1668 radeon_dig_connector->igp_lane_info = igp_lane_info; 1654 1669 radeon_connector->con_priv = radeon_dig_connector; 1655 1670 if (i2c_bus->valid) { 1656 - /* add DP i2c bus */ 1657 - if (connector_type == DRM_MODE_CONNECTOR_eDP) 1658 - radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch"); 1659 - else 1660 - radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); 1661 - if (radeon_dig_connector->dp_i2c_bus) 1671 + radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1672 + if (radeon_connector->ddc_bus) 1662 1673 has_aux = true; 1663 1674 else 1664 - DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n"); 1665 - radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1666 - if (!radeon_connector->ddc_bus) 1667 1675 DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); 1668 1676 } 1669 1677 switch (connector_type) { ··· 1871 1893 drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type); 1872 1894 drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs); 1873 1895 if (i2c_bus->valid) { 1874 - /* add DP i2c bus */ 1875 - radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); 1876 - if (!radeon_dig_connector->dp_i2c_bus) 1877 - DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n"); 1878 1896 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1879 1897 if (radeon_connector->ddc_bus) 1880 1898 has_aux = true; ··· 1916 1942 drm_connector_init(dev, &radeon_connector->base, &radeon_edp_connector_funcs, connector_type); 1917 1943 drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs); 1918 1944 if (i2c_bus->valid) { 1919 - /* add DP i2c bus */ 1920 - radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch"); 1921 - if (radeon_dig_connector->dp_i2c_bus) 1945 + radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1946 + if (radeon_connector->ddc_bus) 1922 1947 has_aux = true; 1923 1948 else 1924 - DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n"); 1925 - radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1926 - if (!radeon_connector->ddc_bus) 1927 1949 DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); 1928 1950 } 1929 1951 drm_object_attach_property(&radeon_connector->base.base,
+10 -9
drivers/gpu/drm/radeon/radeon_device.c
··· 102 102 "LAST", 103 103 }; 104 104 105 - #if defined(CONFIG_VGA_SWITCHEROO) 106 - bool radeon_is_px(void); 107 - #else 108 - static inline bool radeon_is_px(void) { return false; } 109 - #endif 105 + bool radeon_is_px(struct drm_device *dev) 106 + { 107 + struct radeon_device *rdev = dev->dev_private; 108 + 109 + if (rdev->flags & RADEON_IS_PX) 110 + return true; 111 + return false; 112 + } 110 113 111 114 /** 112 115 * radeon_program_register_sequence - program an array of registers. ··· 1085 1082 { 1086 1083 struct drm_device *dev = pci_get_drvdata(pdev); 1087 1084 1088 - if (radeon_is_px() && state == VGA_SWITCHEROO_OFF) 1085 + if (radeon_is_px(dev) && state == VGA_SWITCHEROO_OFF) 1089 1086 return; 1090 1087 1091 1088 if (state == VGA_SWITCHEROO_ON) { ··· 1304 1301 * ignore it */ 1305 1302 vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode); 1306 1303 1307 - if (radeon_runtime_pm == 1) 1308 - runtime = true; 1309 - if ((radeon_runtime_pm == -1) && radeon_is_px()) 1304 + if (rdev->flags & RADEON_IS_PX) 1310 1305 runtime = true; 1311 1306 vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops, runtime); 1312 1307 if (runtime)
+15 -12
drivers/gpu/drm/radeon/radeon_display.c
··· 759 759 760 760 if (radeon_connector_encoder_get_dp_bridge_encoder_id(&radeon_connector->base) != 761 761 ENCODER_OBJECT_ID_NONE) { 762 - struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; 763 - 764 - if (dig->dp_i2c_bus) 762 + if (radeon_connector->ddc_bus->has_aux) 765 763 radeon_connector->edid = drm_get_edid(&radeon_connector->base, 766 - &dig->dp_i2c_bus->adapter); 764 + &radeon_connector->ddc_bus->aux.ddc); 767 765 } else if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || 768 766 (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) { 769 767 struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; 770 768 771 769 if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT || 772 - dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) && dig->dp_i2c_bus) 770 + dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) && 771 + radeon_connector->ddc_bus->has_aux) 773 772 radeon_connector->edid = drm_get_edid(&radeon_connector->base, 774 - &dig->dp_i2c_bus->adapter); 773 + &radeon_connector->ddc_bus->aux.ddc); 775 774 else if (radeon_connector->ddc_bus && !radeon_connector->edid) 776 775 radeon_connector->edid = drm_get_edid(&radeon_connector->base, 777 776 &radeon_connector->ddc_bus->adapter); ··· 864 865 unsigned post_div_min, post_div_max, post_div; 865 866 unsigned ref_div_min, ref_div_max, ref_div; 866 867 unsigned post_div_best, diff_best; 867 - unsigned nom, den, tmp; 868 + unsigned nom, den; 868 869 869 870 /* determine allowed feedback divider range */ 870 871 fb_div_min = pll->min_feedback_div; ··· 936 937 } 937 938 post_div = post_div_best; 938 939 940 + /* limit reference * post divider to a maximum */ 941 + ref_div_max = min(210 / post_div, ref_div_max); 942 + 939 943 /* get matching reference and feedback divider */ 940 - ref_div = max(den / post_div, 1u); 941 - fb_div = nom; 944 + ref_div = max(DIV_ROUND_CLOSEST(den, post_div), 1u); 945 + fb_div = DIV_ROUND_CLOSEST(nom * ref_div * post_div, den); 942 946 943 947 /* we're almost done, but reference and feedback 944 948 divider might be to large now */ 945 949 946 - tmp = ref_div; 950 + nom = fb_div; 951 + den = ref_div; 947 952 948 953 if (fb_div > fb_div_max) { 949 - ref_div = ref_div * fb_div_max / fb_div; 954 + ref_div = DIV_ROUND_CLOSEST(den * fb_div_max, nom); 950 955 fb_div = fb_div_max; 951 956 } 952 957 953 958 if (ref_div > ref_div_max) { 954 959 ref_div = ref_div_max; 955 - fb_div = nom * ref_div_max / tmp; 960 + fb_div = DIV_ROUND_CLOSEST(nom * ref_div_max, den); 956 961 } 957 962 958 963 /* reduce the numbers to a simpler ratio once more */
+5 -21
drivers/gpu/drm/radeon/radeon_drv.c
··· 115 115 unsigned int flags, 116 116 int *vpos, int *hpos, ktime_t *stime, 117 117 ktime_t *etime); 118 + extern bool radeon_is_px(struct drm_device *dev); 118 119 extern const struct drm_ioctl_desc radeon_ioctls_kms[]; 119 120 extern int radeon_max_kms_ioctl; 120 121 int radeon_mmap(struct file *filp, struct vm_area_struct *vma); ··· 145 144 #if defined(CONFIG_VGA_SWITCHEROO) 146 145 void radeon_register_atpx_handler(void); 147 146 void radeon_unregister_atpx_handler(void); 148 - bool radeon_is_px(void); 149 147 #else 150 148 static inline void radeon_register_atpx_handler(void) {} 151 149 static inline void radeon_unregister_atpx_handler(void) {} 152 - static inline bool radeon_is_px(void) { return false; } 153 150 #endif 154 151 155 152 int radeon_no_wb; ··· 185 186 MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx"); 186 187 module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444); 187 188 188 - MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing"); 189 + MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); 189 190 module_param_named(vramlimit, radeon_vram_limit, int, 0600); 190 191 191 192 MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)"); ··· 404 405 struct drm_device *drm_dev = pci_get_drvdata(pdev); 405 406 int ret; 406 407 407 - if (radeon_runtime_pm == 0) { 408 - pm_runtime_forbid(dev); 409 - return -EBUSY; 410 - } 411 - 412 - if (radeon_runtime_pm == -1 && !radeon_is_px()) { 408 + if (!radeon_is_px(drm_dev)) { 413 409 pm_runtime_forbid(dev); 414 410 return -EBUSY; 415 411 } ··· 428 434 struct drm_device *drm_dev = pci_get_drvdata(pdev); 429 435 int ret; 430 436 431 - if (radeon_runtime_pm == 0) 432 - return -EINVAL; 433 - 434 - if (radeon_runtime_pm == -1 && !radeon_is_px()) 437 + if (!radeon_is_px(drm_dev)) 435 438 return -EINVAL; 436 439 437 440 drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; ··· 453 462 struct drm_device *drm_dev = pci_get_drvdata(pdev); 454 463 struct drm_crtc *crtc; 455 464 456 - if (radeon_runtime_pm == 0) { 457 - pm_runtime_forbid(dev); 458 - return -EBUSY; 459 - } 460 - 461 - /* are we PX enabled? */ 462 - if (radeon_runtime_pm == -1 && !radeon_is_px()) { 463 - DRM_DEBUG_DRIVER("failing to power off - not px\n"); 465 + if (!radeon_is_px(drm_dev)) { 464 466 pm_runtime_forbid(dev); 465 467 return -EBUSY; 466 468 }
+1
drivers/gpu/drm/radeon/radeon_family.h
··· 115 115 RADEON_NEW_MEMMAP = 0x00400000UL, 116 116 RADEON_IS_PCI = 0x00800000UL, 117 117 RADEON_IS_IGPGART = 0x01000000UL, 118 + RADEON_IS_PX = 0x02000000UL, 118 119 }; 119 120 120 121 #endif
+13 -47
drivers/gpu/drm/radeon/radeon_i2c.c
··· 64 64 radeon_router_select_ddc_port(radeon_connector); 65 65 66 66 if (use_aux) { 67 - struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; 68 - ret = i2c_transfer(&dig->dp_i2c_bus->adapter, msgs, 2); 67 + ret = i2c_transfer(&radeon_connector->ddc_bus->aux.ddc, msgs, 2); 69 68 } else { 70 69 ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); 71 70 } ··· 949 950 /* set the radeon bit adapter */ 950 951 snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), 951 952 "Radeon i2c bit bus %s", name); 952 - i2c->adapter.algo_data = &i2c->algo.bit; 953 - i2c->algo.bit.pre_xfer = pre_xfer; 954 - i2c->algo.bit.post_xfer = post_xfer; 955 - i2c->algo.bit.setsda = set_data; 956 - i2c->algo.bit.setscl = set_clock; 957 - i2c->algo.bit.getsda = get_data; 958 - i2c->algo.bit.getscl = get_clock; 959 - i2c->algo.bit.udelay = 10; 960 - i2c->algo.bit.timeout = usecs_to_jiffies(2200); /* from VESA */ 961 - i2c->algo.bit.data = i2c; 953 + i2c->adapter.algo_data = &i2c->bit; 954 + i2c->bit.pre_xfer = pre_xfer; 955 + i2c->bit.post_xfer = post_xfer; 956 + i2c->bit.setsda = set_data; 957 + i2c->bit.setscl = set_clock; 958 + i2c->bit.getsda = get_data; 959 + i2c->bit.getscl = get_clock; 960 + i2c->bit.udelay = 10; 961 + i2c->bit.timeout = usecs_to_jiffies(2200); /* from VESA */ 962 + i2c->bit.data = i2c; 962 963 ret = i2c_bit_add_bus(&i2c->adapter); 963 964 if (ret) { 964 965 DRM_ERROR("Failed to register bit i2c %s\n", name); ··· 973 974 974 975 } 975 976 976 - struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, 977 - struct radeon_i2c_bus_rec *rec, 978 - const char *name) 979 - { 980 - struct radeon_i2c_chan *i2c; 981 - int ret; 982 - 983 - i2c = kzalloc(sizeof(struct radeon_i2c_chan), GFP_KERNEL); 984 - if (i2c == NULL) 985 - return NULL; 986 - 987 - i2c->rec = *rec; 988 - i2c->adapter.owner = THIS_MODULE; 989 - i2c->adapter.class = I2C_CLASS_DDC; 990 - i2c->adapter.dev.parent = &dev->pdev->dev; 991 - i2c->dev = dev; 992 - snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), 993 - "Radeon aux bus %s", name); 994 - i2c_set_adapdata(&i2c->adapter, i2c); 995 - i2c->adapter.algo_data = &i2c->algo.dp; 996 - i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; 997 - i2c->algo.dp.address = 0; 998 - ret = i2c_dp_aux_add_bus(&i2c->adapter); 999 - if (ret) { 1000 - DRM_INFO("Failed to register i2c %s\n", name); 1001 - goto out_free; 1002 - } 1003 - 1004 - return i2c; 1005 - out_free: 1006 - kfree(i2c); 1007 - return NULL; 1008 - 1009 - } 1010 - 1011 977 void radeon_i2c_destroy(struct radeon_i2c_chan *i2c) 1012 978 { 1013 979 if (!i2c) 1014 980 return; 1015 981 i2c_del_adapter(&i2c->adapter); 982 + if (i2c->has_aux) 983 + drm_dp_aux_unregister_i2c_bus(&i2c->aux); 1016 984 kfree(i2c); 1017 985 } 1018 986
+17 -6
drivers/gpu/drm/radeon/radeon_kms.c
··· 35 35 #include <linux/pm_runtime.h> 36 36 37 37 #if defined(CONFIG_VGA_SWITCHEROO) 38 - bool radeon_is_px(void); 38 + bool radeon_has_atpx(void); 39 39 #else 40 - static inline bool radeon_is_px(void) { return false; } 40 + static inline bool radeon_has_atpx(void) { return false; } 41 41 #endif 42 42 43 43 /** ··· 107 107 flags |= RADEON_IS_PCI; 108 108 } 109 109 110 + if (radeon_runtime_pm == 1) 111 + flags |= RADEON_IS_PX; 112 + else if ((radeon_runtime_pm == -1) && 113 + radeon_has_atpx() && 114 + ((flags & RADEON_IS_IGP) == 0)) 115 + flags |= RADEON_IS_PX; 116 + 110 117 /* radeon_device_init should report only fatal error 111 118 * like memory allocation failure or iomapping failure, 112 119 * or memory manager initialization failure, it must ··· 144 137 "Error during ACPI methods call\n"); 145 138 } 146 139 147 - if ((radeon_runtime_pm == 1) || 148 - ((radeon_runtime_pm == -1) && radeon_is_px())) { 140 + if (radeon_is_px(dev)) { 149 141 pm_runtime_use_autosuspend(dev->dev); 150 142 pm_runtime_set_autosuspend_delay(dev->dev, 5000); 151 143 pm_runtime_set_active(dev->dev); ··· 574 568 } 575 569 576 570 r = radeon_vm_init(rdev, &fpriv->vm); 577 - if (r) 571 + if (r) { 572 + kfree(fpriv); 578 573 return r; 574 + } 579 575 580 576 r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); 581 - if (r) 577 + if (r) { 578 + radeon_vm_fini(rdev, &fpriv->vm); 579 + kfree(fpriv); 582 580 return r; 581 + } 583 582 584 583 /* map the ib pool buffer read only into 585 584 * virtual address space */
+2 -10
drivers/gpu/drm/radeon/radeon_mode.h
··· 187 187 struct radeon_i2c_chan { 188 188 struct i2c_adapter adapter; 189 189 struct drm_device *dev; 190 - union { 191 - struct i2c_algo_bit_data bit; 192 - struct i2c_algo_dp_aux_data dp; 193 - } algo; 190 + struct i2c_algo_bit_data bit; 194 191 struct radeon_i2c_bus_rec rec; 195 192 struct drm_dp_aux aux; 193 + bool has_aux; 196 194 }; 197 195 198 196 /* mostly for macs, but really any system without connector tables */ ··· 438 440 struct radeon_connector_atom_dig { 439 441 uint32_t igp_lane_info; 440 442 /* displayport */ 441 - struct radeon_i2c_chan *dp_i2c_bus; 442 443 u8 dpcd[DP_RECEIVER_CAP_SIZE]; 443 444 u8 dp_sink_type; 444 445 int dp_clock; ··· 699 702 uint8_t lane_set); 700 703 extern void radeon_atom_ext_encoder_setup_ddc(struct drm_encoder *encoder); 701 704 extern struct drm_encoder *radeon_get_external_encoder(struct drm_encoder *encoder); 702 - extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, 703 - u8 write_byte, u8 *read_byte); 704 705 void radeon_atom_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le); 705 706 706 707 extern void radeon_i2c_init(struct radeon_device *rdev); ··· 710 715 const char *name); 711 716 extern struct radeon_i2c_chan *radeon_i2c_lookup(struct radeon_device *rdev, 712 717 struct radeon_i2c_bus_rec *i2c_bus); 713 - extern struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, 714 - struct radeon_i2c_bus_rec *rec, 715 - const char *name); 716 718 extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, 717 719 struct radeon_i2c_bus_rec *rec, 718 720 const char *name);
+6 -1
drivers/gpu/drm/radeon/radeon_ucode.h
··· 57 57 #define BTC_MC_UCODE_SIZE 6024 58 58 #define CAYMAN_MC_UCODE_SIZE 6037 59 59 #define SI_MC_UCODE_SIZE 7769 60 + #define TAHITI_MC_UCODE_SIZE 7808 61 + #define PITCAIRN_MC_UCODE_SIZE 7775 62 + #define VERDE_MC_UCODE_SIZE 7875 60 63 #define OLAND_MC_UCODE_SIZE 7863 61 - #define CIK_MC_UCODE_SIZE 7866 64 + #define BONAIRE_MC_UCODE_SIZE 7866 65 + #define BONAIRE_MC2_UCODE_SIZE 7948 62 66 #define HAWAII_MC_UCODE_SIZE 7933 67 + #define HAWAII_MC2_UCODE_SIZE 8091 63 68 64 69 /* SDMA */ 65 70 #define CIK_SDMA_UCODE_SIZE 1050
+1 -1
drivers/gpu/drm/radeon/radeon_vce.c
··· 613 613 struct radeon_fence *fence) 614 614 { 615 615 struct radeon_ring *ring = &rdev->ring[fence->ring]; 616 - uint32_t addr = rdev->fence_drv[fence->ring].gpu_addr; 616 + uint64_t addr = rdev->fence_drv[fence->ring].gpu_addr; 617 617 618 618 radeon_ring_write(ring, VCE_CMD_FENCE); 619 619 radeon_ring_write(ring, addr);
+24 -13
drivers/gpu/drm/radeon/si.c
··· 39 39 MODULE_FIRMWARE("radeon/TAHITI_me.bin"); 40 40 MODULE_FIRMWARE("radeon/TAHITI_ce.bin"); 41 41 MODULE_FIRMWARE("radeon/TAHITI_mc.bin"); 42 + MODULE_FIRMWARE("radeon/TAHITI_mc2.bin"); 42 43 MODULE_FIRMWARE("radeon/TAHITI_rlc.bin"); 43 44 MODULE_FIRMWARE("radeon/TAHITI_smc.bin"); 44 45 MODULE_FIRMWARE("radeon/PITCAIRN_pfp.bin"); 45 46 MODULE_FIRMWARE("radeon/PITCAIRN_me.bin"); 46 47 MODULE_FIRMWARE("radeon/PITCAIRN_ce.bin"); 47 48 MODULE_FIRMWARE("radeon/PITCAIRN_mc.bin"); 49 + MODULE_FIRMWARE("radeon/PITCAIRN_mc2.bin"); 48 50 MODULE_FIRMWARE("radeon/PITCAIRN_rlc.bin"); 49 51 MODULE_FIRMWARE("radeon/PITCAIRN_smc.bin"); 50 52 MODULE_FIRMWARE("radeon/VERDE_pfp.bin"); 51 53 MODULE_FIRMWARE("radeon/VERDE_me.bin"); 52 54 MODULE_FIRMWARE("radeon/VERDE_ce.bin"); 53 55 MODULE_FIRMWARE("radeon/VERDE_mc.bin"); 56 + MODULE_FIRMWARE("radeon/VERDE_mc2.bin"); 54 57 MODULE_FIRMWARE("radeon/VERDE_rlc.bin"); 55 58 MODULE_FIRMWARE("radeon/VERDE_smc.bin"); 56 59 MODULE_FIRMWARE("radeon/OLAND_pfp.bin"); 57 60 MODULE_FIRMWARE("radeon/OLAND_me.bin"); 58 61 MODULE_FIRMWARE("radeon/OLAND_ce.bin"); 59 62 MODULE_FIRMWARE("radeon/OLAND_mc.bin"); 63 + MODULE_FIRMWARE("radeon/OLAND_mc2.bin"); 60 64 MODULE_FIRMWARE("radeon/OLAND_rlc.bin"); 61 65 MODULE_FIRMWARE("radeon/OLAND_smc.bin"); 62 66 MODULE_FIRMWARE("radeon/HAINAN_pfp.bin"); 63 67 MODULE_FIRMWARE("radeon/HAINAN_me.bin"); 64 68 MODULE_FIRMWARE("radeon/HAINAN_ce.bin"); 65 69 MODULE_FIRMWARE("radeon/HAINAN_mc.bin"); 70 + MODULE_FIRMWARE("radeon/HAINAN_mc2.bin"); 66 71 MODULE_FIRMWARE("radeon/HAINAN_rlc.bin"); 67 72 MODULE_FIRMWARE("radeon/HAINAN_smc.bin"); 68 73 ··· 1472 1467 const __be32 *fw_data; 1473 1468 u32 running, blackout = 0; 1474 1469 u32 *io_mc_regs; 1475 - int i, ucode_size, regs_size; 1470 + int i, regs_size, ucode_size; 1476 1471 1477 1472 if (!rdev->mc_fw) 1478 1473 return -EINVAL; 1479 1474 1475 + ucode_size = rdev->mc_fw->size / 4; 1476 + 1480 1477 switch (rdev->family) { 1481 1478 case CHIP_TAHITI: 1482 1479 io_mc_regs = (u32 *)&tahiti_io_mc_regs; 1483 - ucode_size = SI_MC_UCODE_SIZE; 1484 1480 regs_size = TAHITI_IO_MC_REGS_SIZE; 1485 1481 break; 1486 1482 case CHIP_PITCAIRN: 1487 1483 io_mc_regs = (u32 *)&pitcairn_io_mc_regs; 1488 - ucode_size = SI_MC_UCODE_SIZE; 1489 1484 regs_size = TAHITI_IO_MC_REGS_SIZE; 1490 1485 break; 1491 1486 case CHIP_VERDE: 1492 1487 default: 1493 1488 io_mc_regs = (u32 *)&verde_io_mc_regs; 1494 - ucode_size = SI_MC_UCODE_SIZE; 1495 1489 regs_size = TAHITI_IO_MC_REGS_SIZE; 1496 1490 break; 1497 1491 case CHIP_OLAND: 1498 1492 io_mc_regs = (u32 *)&oland_io_mc_regs; 1499 - ucode_size = OLAND_MC_UCODE_SIZE; 1500 1493 regs_size = TAHITI_IO_MC_REGS_SIZE; 1501 1494 break; 1502 1495 case CHIP_HAINAN: 1503 1496 io_mc_regs = (u32 *)&hainan_io_mc_regs; 1504 - ucode_size = OLAND_MC_UCODE_SIZE; 1505 1497 regs_size = TAHITI_IO_MC_REGS_SIZE; 1506 1498 break; 1507 1499 } ··· 1554 1552 const char *chip_name; 1555 1553 const char *rlc_chip_name; 1556 1554 size_t pfp_req_size, me_req_size, ce_req_size, rlc_req_size, mc_req_size; 1557 - size_t smc_req_size; 1555 + size_t smc_req_size, mc2_req_size; 1558 1556 char fw_name[30]; 1559 1557 int err; 1560 1558 ··· 1569 1567 ce_req_size = SI_CE_UCODE_SIZE * 4; 1570 1568 rlc_req_size = SI_RLC_UCODE_SIZE * 4; 1571 1569 mc_req_size = SI_MC_UCODE_SIZE * 4; 1570 + mc2_req_size = TAHITI_MC_UCODE_SIZE * 4; 1572 1571 smc_req_size = ALIGN(TAHITI_SMC_UCODE_SIZE, 4); 1573 1572 break; 1574 1573 case CHIP_PITCAIRN: ··· 1580 1577 ce_req_size = SI_CE_UCODE_SIZE * 4; 1581 1578 rlc_req_size = SI_RLC_UCODE_SIZE * 4; 1582 1579 mc_req_size = SI_MC_UCODE_SIZE * 4; 1580 + mc2_req_size = PITCAIRN_MC_UCODE_SIZE * 4; 1583 1581 smc_req_size = ALIGN(PITCAIRN_SMC_UCODE_SIZE, 4); 1584 1582 break; 1585 1583 case CHIP_VERDE: ··· 1591 1587 ce_req_size = SI_CE_UCODE_SIZE * 4; 1592 1588 rlc_req_size = SI_RLC_UCODE_SIZE * 4; 1593 1589 mc_req_size = SI_MC_UCODE_SIZE * 4; 1590 + mc2_req_size = VERDE_MC_UCODE_SIZE * 4; 1594 1591 smc_req_size = ALIGN(VERDE_SMC_UCODE_SIZE, 4); 1595 1592 break; 1596 1593 case CHIP_OLAND: ··· 1601 1596 me_req_size = SI_PM4_UCODE_SIZE * 4; 1602 1597 ce_req_size = SI_CE_UCODE_SIZE * 4; 1603 1598 rlc_req_size = SI_RLC_UCODE_SIZE * 4; 1604 - mc_req_size = OLAND_MC_UCODE_SIZE * 4; 1599 + mc_req_size = mc2_req_size = OLAND_MC_UCODE_SIZE * 4; 1605 1600 smc_req_size = ALIGN(OLAND_SMC_UCODE_SIZE, 4); 1606 1601 break; 1607 1602 case CHIP_HAINAN: ··· 1611 1606 me_req_size = SI_PM4_UCODE_SIZE * 4; 1612 1607 ce_req_size = SI_CE_UCODE_SIZE * 4; 1613 1608 rlc_req_size = SI_RLC_UCODE_SIZE * 4; 1614 - mc_req_size = OLAND_MC_UCODE_SIZE * 4; 1609 + mc_req_size = mc2_req_size = OLAND_MC_UCODE_SIZE * 4; 1615 1610 smc_req_size = ALIGN(HAINAN_SMC_UCODE_SIZE, 4); 1616 1611 break; 1617 1612 default: BUG(); ··· 1664 1659 err = -EINVAL; 1665 1660 } 1666 1661 1667 - snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); 1662 + snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc2.bin", chip_name); 1668 1663 err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); 1669 - if (err) 1670 - goto out; 1671 - if (rdev->mc_fw->size != mc_req_size) { 1664 + if (err) { 1665 + snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); 1666 + err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); 1667 + if (err) 1668 + goto out; 1669 + } 1670 + if ((rdev->mc_fw->size != mc_req_size) && 1671 + (rdev->mc_fw->size != mc2_req_size)) { 1672 1672 printk(KERN_ERR 1673 1673 "si_mc: Bogus length %zu in firmware \"%s\"\n", 1674 1674 rdev->mc_fw->size, fw_name); 1675 1675 err = -EINVAL; 1676 1676 } 1677 + DRM_INFO("%s: %zu bytes\n", fw_name, rdev->mc_fw->size); 1677 1678 1678 1679 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); 1679 1680 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
+31 -13
drivers/gpu/drm/tegra/dpaux.c
··· 99 99 static ssize_t tegra_dpaux_transfer(struct drm_dp_aux *aux, 100 100 struct drm_dp_aux_msg *msg) 101 101 { 102 - unsigned long value = DPAUX_DP_AUXCTL_TRANSACTREQ; 103 102 unsigned long timeout = msecs_to_jiffies(250); 104 103 struct tegra_dpaux *dpaux = to_dpaux(aux); 105 104 unsigned long status; 106 105 ssize_t ret = 0; 106 + u32 value; 107 107 108 - if (msg->size < 1 || msg->size > 16) 108 + /* Tegra has 4x4 byte DP AUX transmit and receive FIFOs. */ 109 + if (msg->size > 16) 109 110 return -EINVAL; 110 111 111 - tegra_dpaux_writel(dpaux, msg->address, DPAUX_DP_AUXADDR); 112 + /* 113 + * Allow zero-sized messages only for I2C, in which case they specify 114 + * address-only transactions. 115 + */ 116 + if (msg->size < 1) { 117 + switch (msg->request & ~DP_AUX_I2C_MOT) { 118 + case DP_AUX_I2C_WRITE: 119 + case DP_AUX_I2C_READ: 120 + value = DPAUX_DP_AUXCTL_CMD_ADDRESS_ONLY; 121 + break; 122 + 123 + default: 124 + return -EINVAL; 125 + } 126 + } else { 127 + /* For non-zero-sized messages, set the CMDLEN field. */ 128 + value = DPAUX_DP_AUXCTL_CMDLEN(msg->size - 1); 129 + } 112 130 113 131 switch (msg->request & ~DP_AUX_I2C_MOT) { 114 132 case DP_AUX_I2C_WRITE: 115 133 if (msg->request & DP_AUX_I2C_MOT) 116 - value = DPAUX_DP_AUXCTL_CMD_MOT_WR; 134 + value |= DPAUX_DP_AUXCTL_CMD_MOT_WR; 117 135 else 118 - value = DPAUX_DP_AUXCTL_CMD_I2C_WR; 136 + value |= DPAUX_DP_AUXCTL_CMD_I2C_WR; 119 137 120 138 break; 121 139 122 140 case DP_AUX_I2C_READ: 123 141 if (msg->request & DP_AUX_I2C_MOT) 124 - value = DPAUX_DP_AUXCTL_CMD_MOT_RD; 142 + value |= DPAUX_DP_AUXCTL_CMD_MOT_RD; 125 143 else 126 - value = DPAUX_DP_AUXCTL_CMD_I2C_RD; 144 + value |= DPAUX_DP_AUXCTL_CMD_I2C_RD; 127 145 128 146 break; 129 147 130 148 case DP_AUX_I2C_STATUS: 131 149 if (msg->request & DP_AUX_I2C_MOT) 132 - value = DPAUX_DP_AUXCTL_CMD_MOT_RQ; 150 + value |= DPAUX_DP_AUXCTL_CMD_MOT_RQ; 133 151 else 134 - value = DPAUX_DP_AUXCTL_CMD_I2C_RQ; 152 + value |= DPAUX_DP_AUXCTL_CMD_I2C_RQ; 135 153 136 154 break; 137 155 138 156 case DP_AUX_NATIVE_WRITE: 139 - value = DPAUX_DP_AUXCTL_CMD_AUX_WR; 157 + value |= DPAUX_DP_AUXCTL_CMD_AUX_WR; 140 158 break; 141 159 142 160 case DP_AUX_NATIVE_READ: 143 - value = DPAUX_DP_AUXCTL_CMD_AUX_RD; 161 + value |= DPAUX_DP_AUXCTL_CMD_AUX_RD; 144 162 break; 145 163 146 164 default: 147 165 return -EINVAL; 148 166 } 149 167 150 - value |= DPAUX_DP_AUXCTL_CMDLEN(msg->size - 1); 168 + tegra_dpaux_writel(dpaux, msg->address, DPAUX_DP_AUXADDR); 151 169 tegra_dpaux_writel(dpaux, value, DPAUX_DP_AUXCTL); 152 170 153 171 if ((msg->request & DP_AUX_I2C_READ) == 0) { ··· 216 198 break; 217 199 } 218 200 219 - if (msg->reply == DP_AUX_NATIVE_REPLY_ACK) { 201 + if ((msg->size > 0) && (msg->reply == DP_AUX_NATIVE_REPLY_ACK)) { 220 202 if (msg->request & DP_AUX_I2C_READ) { 221 203 size_t count = value & DPAUX_DP_AUXSTAT_REPLY_MASK; 222 204
+1
drivers/gpu/drm/tegra/dpaux.h
··· 32 32 #define DPAUX_DP_AUXCTL_CMD_I2C_RQ (2 << 12) 33 33 #define DPAUX_DP_AUXCTL_CMD_I2C_RD (1 << 12) 34 34 #define DPAUX_DP_AUXCTL_CMD_I2C_WR (0 << 12) 35 + #define DPAUX_DP_AUXCTL_CMD_ADDRESS_ONLY (1 << 8) 35 36 #define DPAUX_DP_AUXCTL_CMDLEN(x) ((x) & 0xff) 36 37 37 38 #define DPAUX_DP_AUXSTAT 0x31
+2 -2
drivers/gpu/host1x/hw/intr_hw.c
··· 47 47 unsigned long reg; 48 48 int i, id; 49 49 50 - for (i = 0; i <= BIT_WORD(host->info->nb_pts); i++) { 50 + for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); i++) { 51 51 reg = host1x_sync_readl(host, 52 52 HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(i)); 53 53 for_each_set_bit(id, &reg, BITS_PER_LONG) { ··· 64 64 { 65 65 u32 i; 66 66 67 - for (i = 0; i <= BIT_WORD(host->info->nb_pts); ++i) { 67 + for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); ++i) { 68 68 host1x_sync_writel(host, 0xffffffffu, 69 69 HOST1X_SYNC_SYNCPT_THRESH_INT_DISABLE(i)); 70 70 host1x_sync_writel(host, 0xffffffffu,
+5 -1
include/drm/drm_crtc_helper.h
··· 125 125 struct drm_encoder *(*best_encoder)(struct drm_connector *connector); 126 126 }; 127 127 128 - extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); 129 128 extern void drm_helper_disable_unused_functions(struct drm_device *dev); 130 129 extern int drm_crtc_helper_set_config(struct drm_mode_set *set); 131 130 extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, ··· 160 161 } 161 162 162 163 extern void drm_helper_resume_force_mode(struct drm_device *dev); 164 + 165 + /* drm_probe_helper.c */ 166 + extern int drm_helper_probe_single_connector_modes(struct drm_connector 167 + *connector, uint32_t maxX, 168 + uint32_t maxY); 163 169 extern void drm_kms_helper_poll_init(struct drm_device *dev); 164 170 extern void drm_kms_helper_poll_fini(struct drm_device *dev); 165 171 extern bool drm_helper_hpd_irq_event(struct drm_device *dev);
+4
include/drm/drm_dp_helper.h
··· 456 456 * transactions. The drm_dp_aux_register_i2c_bus() function registers an 457 457 * I2C adapter that can be passed to drm_probe_ddc(). Upon removal, drivers 458 458 * should call drm_dp_aux_unregister_i2c_bus() to remove the I2C adapter. 459 + * 460 + * Note that the aux helper code assumes that the .transfer() function 461 + * only modifies the reply field of the drm_dp_aux_msg structure. The 462 + * retry logic and i2c helpers assume this is the case. 459 463 */ 460 464 struct drm_dp_aux { 461 465 const char *name;
-1
include/uapi/drm/tegra_drm.h
··· 120 120 __u32 num_waitchks; 121 121 __u32 waitchk_mask; 122 122 __u32 timeout; 123 - __u32 pad; 124 123 __u64 syncpts; 125 124 __u64 cmdbufs; 126 125 __u64 relocs;