diff options
| -rw-r--r-- | Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt | 3 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/panel/chunghwa,claa101wa01a.txt | 7 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/panel/samsung,ltn101nt05.txt | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 23 | ||||
| -rw-r--r-- | drivers/gpu/drm/drm_crtc_helper.c | 29 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 26 | ||||
| -rw-r--r-- | drivers/gpu/drm/panel/panel-simple.c | 51 | ||||
| -rw-r--r-- | drivers/gpu/drm/tegra/dc.c | 41 | ||||
| -rw-r--r-- | drivers/gpu/drm/tegra/hdmi.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/tegra/output.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/tegra/rgb.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/host1x/hw/intr_hw.c | 1 | ||||
| -rw-r--r-- | include/drm/drm_crtc.h | 26 |
13 files changed, 164 insertions, 62 deletions
diff --git a/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt b/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt index 9e9008f8fa32..efaeec8961b6 100644 --- a/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt +++ b/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt | |||
| @@ -118,6 +118,9 @@ of the following host1x client modules: | |||
| 118 | See ../reset/reset.txt for details. | 118 | See ../reset/reset.txt for details. |
| 119 | - reset-names: Must include the following entries: | 119 | - reset-names: Must include the following entries: |
| 120 | - dc | 120 | - dc |
| 121 | - nvidia,head: The number of the display controller head. This is used to | ||
| 122 | setup the various types of output to receive video data from the given | ||
| 123 | head. | ||
| 121 | 124 | ||
| 122 | Each display controller node has a child node, named "rgb", that represents | 125 | Each display controller node has a child node, named "rgb", that represents |
| 123 | the RGB output associated with the controller. It can take the following | 126 | the RGB output associated with the controller. It can take the following |
diff --git a/Documentation/devicetree/bindings/panel/chunghwa,claa101wa01a.txt b/Documentation/devicetree/bindings/panel/chunghwa,claa101wa01a.txt new file mode 100644 index 000000000000..f24614e4d5ec --- /dev/null +++ b/Documentation/devicetree/bindings/panel/chunghwa,claa101wa01a.txt | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | Chunghwa Picture Tubes Ltd. 10.1" WXGA TFT LCD panel | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible: should be "chunghwa,claa101wa01a" | ||
| 5 | |||
| 6 | This binding is compatible with the simple-panel binding, which is specified | ||
| 7 | in simple-panel.txt in this directory. | ||
diff --git a/Documentation/devicetree/bindings/panel/samsung,ltn101nt05.txt b/Documentation/devicetree/bindings/panel/samsung,ltn101nt05.txt new file mode 100644 index 000000000000..ef522c6bb85f --- /dev/null +++ b/Documentation/devicetree/bindings/panel/samsung,ltn101nt05.txt | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | Samsung Electronics 10.1" WSVGA TFT LCD panel | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible: should be "samsung,ltn101nt05" | ||
| 5 | |||
| 6 | This binding is compatible with the simple-panel binding, which is specified | ||
| 7 | in simple-panel.txt in this directory. | ||
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 266a01d7f635..3b7d32da1604 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
| @@ -675,6 +675,29 @@ void drm_crtc_cleanup(struct drm_crtc *crtc) | |||
| 675 | EXPORT_SYMBOL(drm_crtc_cleanup); | 675 | EXPORT_SYMBOL(drm_crtc_cleanup); |
| 676 | 676 | ||
| 677 | /** | 677 | /** |
| 678 | * drm_crtc_index - find the index of a registered CRTC | ||
| 679 | * @crtc: CRTC to find index for | ||
| 680 | * | ||
| 681 | * Given a registered CRTC, return the index of that CRTC within a DRM | ||
| 682 | * device's list of CRTCs. | ||
| 683 | */ | ||
| 684 | unsigned int drm_crtc_index(struct drm_crtc *crtc) | ||
| 685 | { | ||
| 686 | unsigned int index = 0; | ||
| 687 | struct drm_crtc *tmp; | ||
| 688 | |||
| 689 | list_for_each_entry(tmp, &crtc->dev->mode_config.crtc_list, head) { | ||
| 690 | if (tmp == crtc) | ||
| 691 | return index; | ||
| 692 | |||
| 693 | index++; | ||
| 694 | } | ||
| 695 | |||
| 696 | BUG(); | ||
| 697 | } | ||
| 698 | EXPORT_SYMBOL(drm_crtc_index); | ||
| 699 | |||
| 700 | /** | ||
| 678 | * drm_mode_probed_add - add a mode to a connector's probed mode list | 701 | * drm_mode_probed_add - add a mode to a connector's probed mode list |
| 679 | * @connector: connector the new mode | 702 | * @connector: connector the new mode |
| 680 | * @mode: mode data | 703 | * @mode: mode data |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 245fe4fa9c9e..ea92b827e787 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
| @@ -324,35 +324,6 @@ void drm_helper_disable_unused_functions(struct drm_device *dev) | |||
| 324 | } | 324 | } |
| 325 | EXPORT_SYMBOL(drm_helper_disable_unused_functions); | 325 | EXPORT_SYMBOL(drm_helper_disable_unused_functions); |
| 326 | 326 | ||
| 327 | /** | ||
| 328 | * drm_encoder_crtc_ok - can a given crtc drive a given encoder? | ||
| 329 | * @encoder: encoder to test | ||
| 330 | * @crtc: crtc to test | ||
| 331 | * | ||
| 332 | * Return false if @encoder can't be driven by @crtc, true otherwise. | ||
| 333 | */ | ||
| 334 | static bool drm_encoder_crtc_ok(struct drm_encoder *encoder, | ||
| 335 | struct drm_crtc *crtc) | ||
| 336 | { | ||
| 337 | struct drm_device *dev; | ||
| 338 | struct drm_crtc *tmp; | ||
| 339 | int crtc_mask = 1; | ||
| 340 | |||
| 341 | WARN(!crtc, "checking null crtc?\n"); | ||
| 342 | |||
| 343 | dev = crtc->dev; | ||
| 344 | |||
| 345 | list_for_each_entry(tmp, &dev->mode_config.crtc_list, head) { | ||
| 346 | if (tmp == crtc) | ||
| 347 | break; | ||
| 348 | crtc_mask <<= 1; | ||
| 349 | } | ||
| 350 | |||
| 351 | if (encoder->possible_crtcs & crtc_mask) | ||
| 352 | return true; | ||
| 353 | return false; | ||
| 354 | } | ||
| 355 | |||
| 356 | /* | 327 | /* |
| 357 | * Check the CRTC we're going to map each output to vs. its current | 328 | * Check the CRTC we're going to map each output to vs. its current |
| 358 | * CRTC. If they don't match, we have to disable the output and the CRTC | 329 | * CRTC. If they don't match, we have to disable the output and the CRTC |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 40a9338ad54f..9fa24347963a 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -8744,28 +8744,6 @@ static struct drm_crtc_helper_funcs intel_helper_funcs = { | |||
| 8744 | .load_lut = intel_crtc_load_lut, | 8744 | .load_lut = intel_crtc_load_lut, |
| 8745 | }; | 8745 | }; |
| 8746 | 8746 | ||
| 8747 | static bool intel_encoder_crtc_ok(struct drm_encoder *encoder, | ||
| 8748 | struct drm_crtc *crtc) | ||
| 8749 | { | ||
| 8750 | struct drm_device *dev; | ||
| 8751 | struct drm_crtc *tmp; | ||
| 8752 | int crtc_mask = 1; | ||
| 8753 | |||
| 8754 | WARN(!crtc, "checking null crtc?\n"); | ||
| 8755 | |||
| 8756 | dev = crtc->dev; | ||
| 8757 | |||
| 8758 | list_for_each_entry(tmp, &dev->mode_config.crtc_list, head) { | ||
| 8759 | if (tmp == crtc) | ||
| 8760 | break; | ||
| 8761 | crtc_mask <<= 1; | ||
| 8762 | } | ||
| 8763 | |||
| 8764 | if (encoder->possible_crtcs & crtc_mask) | ||
| 8765 | return true; | ||
| 8766 | return false; | ||
| 8767 | } | ||
| 8768 | |||
| 8769 | /** | 8747 | /** |
| 8770 | * intel_modeset_update_staged_output_state | 8748 | * intel_modeset_update_staged_output_state |
| 8771 | * | 8749 | * |
| @@ -9940,8 +9918,8 @@ intel_modeset_stage_output_state(struct drm_device *dev, | |||
| 9940 | } | 9918 | } |
| 9941 | 9919 | ||
| 9942 | /* Make sure the new CRTC will work with the encoder */ | 9920 | /* Make sure the new CRTC will work with the encoder */ |
| 9943 | if (!intel_encoder_crtc_ok(&connector->new_encoder->base, | 9921 | if (!drm_encoder_crtc_ok(&connector->new_encoder->base, |
| 9944 | new_crtc)) { | 9922 | new_crtc)) { |
| 9945 | return -EINVAL; | 9923 | return -EINVAL; |
| 9946 | } | 9924 | } |
| 9947 | connector->encoder->new_crtc = to_intel_crtc(new_crtc); | 9925 | connector->encoder->new_crtc = to_intel_crtc(new_crtc); |
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 3e611afc93f4..59d52ca2c67f 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c | |||
| @@ -162,6 +162,7 @@ static int panel_simple_get_modes(struct drm_panel *panel) | |||
| 162 | /* probe EDID if a DDC bus is available */ | 162 | /* probe EDID if a DDC bus is available */ |
| 163 | if (p->ddc) { | 163 | if (p->ddc) { |
| 164 | struct edid *edid = drm_get_edid(panel->connector, p->ddc); | 164 | struct edid *edid = drm_get_edid(panel->connector, p->ddc); |
| 165 | drm_mode_connector_update_edid_property(panel->connector, edid); | ||
| 165 | if (edid) { | 166 | if (edid) { |
| 166 | num += drm_add_edid_modes(panel->connector, edid); | 167 | num += drm_add_edid_modes(panel->connector, edid); |
| 167 | kfree(edid); | 168 | kfree(edid); |
| @@ -316,6 +317,28 @@ static const struct panel_desc auo_b101aw03 = { | |||
| 316 | }, | 317 | }, |
| 317 | }; | 318 | }; |
| 318 | 319 | ||
| 320 | static const struct drm_display_mode chunghwa_claa101wa01a_mode = { | ||
| 321 | .clock = 72070, | ||
| 322 | .hdisplay = 1366, | ||
| 323 | .hsync_start = 1366 + 58, | ||
| 324 | .hsync_end = 1366 + 58 + 58, | ||
| 325 | .htotal = 1366 + 58 + 58 + 58, | ||
| 326 | .vdisplay = 768, | ||
| 327 | .vsync_start = 768 + 4, | ||
| 328 | .vsync_end = 768 + 4 + 4, | ||
| 329 | .vtotal = 768 + 4 + 4 + 4, | ||
| 330 | .vrefresh = 60, | ||
| 331 | }; | ||
| 332 | |||
| 333 | static const struct panel_desc chunghwa_claa101wa01a = { | ||
| 334 | .modes = &chunghwa_claa101wa01a_mode, | ||
| 335 | .num_modes = 1, | ||
| 336 | .size = { | ||
| 337 | .width = 220, | ||
| 338 | .height = 120, | ||
| 339 | }, | ||
| 340 | }; | ||
| 341 | |||
| 319 | static const struct drm_display_mode chunghwa_claa101wb01_mode = { | 342 | static const struct drm_display_mode chunghwa_claa101wb01_mode = { |
| 320 | .clock = 69300, | 343 | .clock = 69300, |
| 321 | .hdisplay = 1366, | 344 | .hdisplay = 1366, |
| @@ -338,14 +361,42 @@ static const struct panel_desc chunghwa_claa101wb01 = { | |||
| 338 | }, | 361 | }, |
| 339 | }; | 362 | }; |
| 340 | 363 | ||
| 364 | static const struct drm_display_mode samsung_ltn101nt05_mode = { | ||
| 365 | .clock = 54030, | ||
| 366 | .hdisplay = 1024, | ||
| 367 | .hsync_start = 1024 + 24, | ||
| 368 | .hsync_end = 1024 + 24 + 136, | ||
| 369 | .htotal = 1024 + 24 + 136 + 160, | ||
| 370 | .vdisplay = 600, | ||
| 371 | .vsync_start = 600 + 3, | ||
| 372 | .vsync_end = 600 + 3 + 6, | ||
| 373 | .vtotal = 600 + 3 + 6 + 61, | ||
| 374 | .vrefresh = 60, | ||
| 375 | }; | ||
| 376 | |||
| 377 | static const struct panel_desc samsung_ltn101nt05 = { | ||
| 378 | .modes = &samsung_ltn101nt05_mode, | ||
| 379 | .num_modes = 1, | ||
| 380 | .size = { | ||
| 381 | .width = 1024, | ||
| 382 | .height = 600, | ||
| 383 | }, | ||
| 384 | }; | ||
| 385 | |||
| 341 | static const struct of_device_id platform_of_match[] = { | 386 | static const struct of_device_id platform_of_match[] = { |
| 342 | { | 387 | { |
| 343 | .compatible = "auo,b101aw03", | 388 | .compatible = "auo,b101aw03", |
| 344 | .data = &auo_b101aw03, | 389 | .data = &auo_b101aw03, |
| 345 | }, { | 390 | }, { |
| 391 | .compatible = "chunghwa,claa101wa01a", | ||
| 392 | .data = &chunghwa_claa101wa01a | ||
| 393 | }, { | ||
| 346 | .compatible = "chunghwa,claa101wb01", | 394 | .compatible = "chunghwa,claa101wb01", |
| 347 | .data = &chunghwa_claa101wb01 | 395 | .data = &chunghwa_claa101wb01 |
| 348 | }, { | 396 | }, { |
| 397 | .compatible = "samsung,ltn101nt05", | ||
| 398 | .data = &samsung_ltn101nt05, | ||
| 399 | }, { | ||
| 349 | .compatible = "simple-panel", | 400 | .compatible = "simple-panel", |
| 350 | }, { | 401 | }, { |
| 351 | /* sentinel */ | 402 | /* sentinel */ |
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 386f3b4b0094..9336006b475d 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
| @@ -1100,8 +1100,6 @@ static int tegra_dc_init(struct host1x_client *client) | |||
| 1100 | struct tegra_dc *dc = host1x_client_to_dc(client); | 1100 | struct tegra_dc *dc = host1x_client_to_dc(client); |
| 1101 | int err; | 1101 | int err; |
| 1102 | 1102 | ||
| 1103 | dc->pipe = tegra->drm->mode_config.num_crtc; | ||
| 1104 | |||
| 1105 | drm_crtc_init(tegra->drm, &dc->base, &tegra_crtc_funcs); | 1103 | drm_crtc_init(tegra->drm, &dc->base, &tegra_crtc_funcs); |
| 1106 | drm_mode_crtc_set_gamma_size(&dc->base, 256); | 1104 | drm_mode_crtc_set_gamma_size(&dc->base, 256); |
| 1107 | drm_crtc_helper_add(&dc->base, &tegra_crtc_helper_funcs); | 1105 | drm_crtc_helper_add(&dc->base, &tegra_crtc_helper_funcs); |
| @@ -1187,6 +1185,41 @@ static const struct of_device_id tegra_dc_of_match[] = { | |||
| 1187 | } | 1185 | } |
| 1188 | }; | 1186 | }; |
| 1189 | 1187 | ||
| 1188 | static int tegra_dc_parse_dt(struct tegra_dc *dc) | ||
| 1189 | { | ||
| 1190 | struct device_node *np; | ||
| 1191 | u32 value = 0; | ||
| 1192 | int err; | ||
| 1193 | |||
| 1194 | err = of_property_read_u32(dc->dev->of_node, "nvidia,head", &value); | ||
| 1195 | if (err < 0) { | ||
| 1196 | dev_err(dc->dev, "missing \"nvidia,head\" property\n"); | ||
| 1197 | |||
| 1198 | /* | ||
| 1199 | * If the nvidia,head property isn't present, try to find the | ||
| 1200 | * correct head number by looking up the position of this | ||
| 1201 | * display controller's node within the device tree. Assuming | ||
| 1202 | * that the nodes are ordered properly in the DTS file and | ||
| 1203 | * that the translation into a flattened device tree blob | ||
| 1204 | * preserves that ordering this will actually yield the right | ||
| 1205 | * head number. | ||
| 1206 | * | ||
| 1207 | * If those assumptions don't hold, this will still work for | ||
| 1208 | * cases where only a single display controller is used. | ||
| 1209 | */ | ||
| 1210 | for_each_matching_node(np, tegra_dc_of_match) { | ||
| 1211 | if (np == dc->dev->of_node) | ||
| 1212 | break; | ||
| 1213 | |||
| 1214 | value++; | ||
| 1215 | } | ||
| 1216 | } | ||
| 1217 | |||
| 1218 | dc->pipe = value; | ||
| 1219 | |||
| 1220 | return 0; | ||
| 1221 | } | ||
| 1222 | |||
| 1190 | static int tegra_dc_probe(struct platform_device *pdev) | 1223 | static int tegra_dc_probe(struct platform_device *pdev) |
| 1191 | { | 1224 | { |
| 1192 | const struct of_device_id *id; | 1225 | const struct of_device_id *id; |
| @@ -1207,6 +1240,10 @@ static int tegra_dc_probe(struct platform_device *pdev) | |||
| 1207 | dc->dev = &pdev->dev; | 1240 | dc->dev = &pdev->dev; |
| 1208 | dc->soc = id->data; | 1241 | dc->soc = id->data; |
| 1209 | 1242 | ||
| 1243 | err = tegra_dc_parse_dt(dc); | ||
| 1244 | if (err < 0) | ||
| 1245 | return err; | ||
| 1246 | |||
| 1210 | dc->clk = devm_clk_get(&pdev->dev, NULL); | 1247 | dc->clk = devm_clk_get(&pdev->dev, NULL); |
| 1211 | if (IS_ERR(dc->clk)) { | 1248 | if (IS_ERR(dc->clk)) { |
| 1212 | dev_err(&pdev->dev, "failed to get clock\n"); | 1249 | dev_err(&pdev->dev, "failed to get clock\n"); |
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index bc9cb1ac709b..6928015d11a4 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c | |||
| @@ -1418,9 +1418,6 @@ static int tegra_hdmi_probe(struct platform_device *pdev) | |||
| 1418 | return err; | 1418 | return err; |
| 1419 | 1419 | ||
| 1420 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1420 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 1421 | if (!regs) | ||
| 1422 | return -ENXIO; | ||
| 1423 | |||
| 1424 | hdmi->regs = devm_ioremap_resource(&pdev->dev, regs); | 1421 | hdmi->regs = devm_ioremap_resource(&pdev->dev, regs); |
| 1425 | if (IS_ERR(hdmi->regs)) | 1422 | if (IS_ERR(hdmi->regs)) |
| 1426 | return PTR_ERR(hdmi->regs); | 1423 | return PTR_ERR(hdmi->regs); |
diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index f1b5030f55e3..57cecbd18ca8 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c | |||
| @@ -18,6 +18,10 @@ static int tegra_connector_get_modes(struct drm_connector *connector) | |||
| 18 | struct edid *edid = NULL; | 18 | struct edid *edid = NULL; |
| 19 | int err = 0; | 19 | int err = 0; |
| 20 | 20 | ||
| 21 | /* | ||
| 22 | * If the panel provides one or more modes, use them exclusively and | ||
| 23 | * ignore any other means of obtaining a mode. | ||
| 24 | */ | ||
| 21 | if (output->panel) { | 25 | if (output->panel) { |
| 22 | err = output->panel->funcs->get_modes(output->panel); | 26 | err = output->panel->funcs->get_modes(output->panel); |
| 23 | if (err > 0) | 27 | if (err > 0) |
| @@ -187,8 +191,7 @@ int tegra_output_probe(struct tegra_output *output) | |||
| 187 | { | 191 | { |
| 188 | struct device_node *ddc, *panel; | 192 | struct device_node *ddc, *panel; |
| 189 | enum of_gpio_flags flags; | 193 | enum of_gpio_flags flags; |
| 190 | size_t size; | 194 | int err, size; |
| 191 | int err; | ||
| 192 | 195 | ||
| 193 | if (!output->of_node) | 196 | if (!output->of_node) |
| 194 | output->of_node = output->dev->of_node; | 197 | output->of_node = output->dev->of_node; |
diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index 03885bb8dcc0..338f7f6561d7 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c | |||
| @@ -258,7 +258,7 @@ int tegra_dc_rgb_init(struct drm_device *drm, struct tegra_dc *dc) | |||
| 258 | * RGB outputs are an exception, so we make sure they can be attached | 258 | * RGB outputs are an exception, so we make sure they can be attached |
| 259 | * to only their parent display controller. | 259 | * to only their parent display controller. |
| 260 | */ | 260 | */ |
| 261 | rgb->output.encoder.possible_crtcs = 1 << dc->pipe; | 261 | rgb->output.encoder.possible_crtcs = drm_crtc_mask(&dc->base); |
| 262 | 262 | ||
| 263 | return 0; | 263 | return 0; |
| 264 | } | 264 | } |
diff --git a/drivers/gpu/host1x/hw/intr_hw.c b/drivers/gpu/host1x/hw/intr_hw.c index b26dcc83bc1b..db9017adfe2b 100644 --- a/drivers/gpu/host1x/hw/intr_hw.c +++ b/drivers/gpu/host1x/hw/intr_hw.c | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
| 21 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
| 22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
| 23 | #include <asm/mach/irq.h> | ||
| 24 | 23 | ||
| 25 | #include "../intr.h" | 24 | #include "../intr.h" |
| 26 | #include "../dev.h" | 25 | #include "../dev.h" |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index e963470efd39..71727b6210ae 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -931,6 +931,19 @@ extern int drm_crtc_init(struct drm_device *dev, | |||
| 931 | struct drm_crtc *crtc, | 931 | struct drm_crtc *crtc, |
| 932 | const struct drm_crtc_funcs *funcs); | 932 | const struct drm_crtc_funcs *funcs); |
| 933 | extern void drm_crtc_cleanup(struct drm_crtc *crtc); | 933 | extern void drm_crtc_cleanup(struct drm_crtc *crtc); |
| 934 | extern unsigned int drm_crtc_index(struct drm_crtc *crtc); | ||
| 935 | |||
| 936 | /** | ||
| 937 | * drm_crtc_mask - find the mask of a registered CRTC | ||
| 938 | * @crtc: CRTC to find mask for | ||
| 939 | * | ||
| 940 | * Given a registered CRTC, return the mask bit of that CRTC for an | ||
| 941 | * encoder's possible_crtcs field. | ||
| 942 | */ | ||
| 943 | static inline uint32_t drm_crtc_mask(struct drm_crtc *crtc) | ||
| 944 | { | ||
| 945 | return 1 << drm_crtc_index(crtc); | ||
| 946 | } | ||
| 934 | 947 | ||
| 935 | extern void drm_connector_ida_init(void); | 948 | extern void drm_connector_ida_init(void); |
| 936 | extern void drm_connector_ida_destroy(void); | 949 | extern void drm_connector_ida_destroy(void); |
| @@ -952,6 +965,19 @@ extern int drm_encoder_init(struct drm_device *dev, | |||
| 952 | const struct drm_encoder_funcs *funcs, | 965 | const struct drm_encoder_funcs *funcs, |
| 953 | int encoder_type); | 966 | int encoder_type); |
| 954 | 967 | ||
| 968 | /** | ||
| 969 | * drm_encoder_crtc_ok - can a given crtc drive a given encoder? | ||
| 970 | * @encoder: encoder to test | ||
| 971 | * @crtc: crtc to test | ||
| 972 | * | ||
| 973 | * Return false if @encoder can't be driven by @crtc, true otherwise. | ||
| 974 | */ | ||
| 975 | static inline bool drm_encoder_crtc_ok(struct drm_encoder *encoder, | ||
| 976 | struct drm_crtc *crtc) | ||
| 977 | { | ||
| 978 | return !!(encoder->possible_crtcs & drm_crtc_mask(crtc)); | ||
| 979 | } | ||
| 980 | |||
| 955 | extern int drm_plane_init(struct drm_device *dev, | 981 | extern int drm_plane_init(struct drm_device *dev, |
| 956 | struct drm_plane *plane, | 982 | struct drm_plane *plane, |
| 957 | unsigned long possible_crtcs, | 983 | unsigned long possible_crtcs, |
