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

Merge tag 'topic/drm-misc-2015-02-06' of git://anongit.freedesktop.org/drm-intel into drm-next

Flushing out my drm-misc queue with a few oddball things all over.

* tag 'topic/drm-misc-2015-02-06' of git://anongit.freedesktop.org/drm-intel:
drm: Use static attribute groups for managing connector sysfs entries
drm: remove DRM_FORMAT_NV12MT
drm/modes: Print the mode status in human readable form
drm/irq: Don't disable vblank interrupts when already disabled

+78 -91
+9 -2
drivers/gpu/drm/drm_irq.c
··· 185 185 return; 186 186 } 187 187 188 - dev->driver->disable_vblank(dev, crtc); 189 - vblank->enabled = false; 188 + /* 189 + * Only disable vblank interrupts if they're enabled. This avoids 190 + * calling the ->disable_vblank() operation in atomic context with the 191 + * hardware potentially runtime suspended. 192 + */ 193 + if (vblank->enabled) { 194 + dev->driver->disable_vblank(dev, crtc); 195 + vblank->enabled = false; 196 + } 190 197 191 198 /* No further vblank irq's will be processed after 192 199 * this point. Get current hardware vblank count and
+67 -65
drivers/gpu/drm/drm_sysfs.c
··· 339 339 drm_get_dvi_i_select_name((int)subconnector)); 340 340 } 341 341 342 - static struct device_attribute connector_attrs[] = { 343 - __ATTR_RO(status), 344 - __ATTR_RO(enabled), 345 - __ATTR_RO(dpms), 346 - __ATTR_RO(modes), 342 + static DEVICE_ATTR_RO(status); 343 + static DEVICE_ATTR_RO(enabled); 344 + static DEVICE_ATTR_RO(dpms); 345 + static DEVICE_ATTR_RO(modes); 346 + 347 + static struct attribute *connector_dev_attrs[] = { 348 + &dev_attr_status.attr, 349 + &dev_attr_enabled.attr, 350 + &dev_attr_dpms.attr, 351 + &dev_attr_modes.attr, 352 + NULL 347 353 }; 348 354 349 355 /* These attributes are for both DVI-I connectors and all types of tv-out. */ 350 - static struct device_attribute connector_attrs_opt1[] = { 351 - __ATTR_RO(subconnector), 352 - __ATTR_RO(select_subconnector), 356 + static DEVICE_ATTR_RO(subconnector); 357 + static DEVICE_ATTR_RO(select_subconnector); 358 + 359 + static struct attribute *connector_opt_dev_attrs[] = { 360 + &dev_attr_subconnector.attr, 361 + &dev_attr_select_subconnector.attr, 362 + NULL 353 363 }; 364 + 365 + static umode_t connector_opt_dev_is_visible(struct kobject *kobj, 366 + struct attribute *attr, int idx) 367 + { 368 + struct device *dev = kobj_to_dev(kobj); 369 + struct drm_connector *connector = to_drm_connector(dev); 370 + 371 + /* 372 + * In the long run it maybe a good idea to make one set of 373 + * optionals per connector type. 374 + */ 375 + switch (connector->connector_type) { 376 + case DRM_MODE_CONNECTOR_DVII: 377 + case DRM_MODE_CONNECTOR_Composite: 378 + case DRM_MODE_CONNECTOR_SVIDEO: 379 + case DRM_MODE_CONNECTOR_Component: 380 + case DRM_MODE_CONNECTOR_TV: 381 + return attr->mode; 382 + } 383 + 384 + return 0; 385 + } 354 386 355 387 static struct bin_attribute edid_attr = { 356 388 .attr.name = "edid", 357 389 .attr.mode = 0444, 358 390 .size = 0, 359 391 .read = edid_show, 392 + }; 393 + 394 + static struct bin_attribute *connector_bin_attrs[] = { 395 + &edid_attr, 396 + NULL 397 + }; 398 + 399 + static const struct attribute_group connector_dev_group = { 400 + .attrs = connector_dev_attrs, 401 + .bin_attrs = connector_bin_attrs, 402 + }; 403 + 404 + static const struct attribute_group connector_opt_dev_group = { 405 + .attrs = connector_opt_dev_attrs, 406 + .is_visible = connector_opt_dev_is_visible, 407 + }; 408 + 409 + static const struct attribute_group *connector_dev_groups[] = { 410 + &connector_dev_group, 411 + &connector_opt_dev_group, 412 + NULL 360 413 }; 361 414 362 415 /** ··· 424 371 int drm_sysfs_connector_add(struct drm_connector *connector) 425 372 { 426 373 struct drm_device *dev = connector->dev; 427 - int attr_cnt = 0; 428 - int opt_cnt = 0; 429 - int i; 430 - int ret; 431 374 432 375 if (connector->kdev) 433 376 return 0; 434 377 435 - connector->kdev = device_create(drm_class, dev->primary->kdev, 436 - 0, connector, "card%d-%s", 437 - dev->primary->index, connector->name); 378 + connector->kdev = 379 + device_create_with_groups(drm_class, dev->primary->kdev, 0, 380 + connector, connector_dev_groups, 381 + "card%d-%s", dev->primary->index, 382 + connector->name); 438 383 DRM_DEBUG("adding \"%s\" to sysfs\n", 439 384 connector->name); 440 385 441 386 if (IS_ERR(connector->kdev)) { 442 387 DRM_ERROR("failed to register connector device: %ld\n", PTR_ERR(connector->kdev)); 443 - ret = PTR_ERR(connector->kdev); 444 - goto out; 388 + return PTR_ERR(connector->kdev); 445 389 } 446 - 447 - /* Standard attributes */ 448 - 449 - for (attr_cnt = 0; attr_cnt < ARRAY_SIZE(connector_attrs); attr_cnt++) { 450 - ret = device_create_file(connector->kdev, &connector_attrs[attr_cnt]); 451 - if (ret) 452 - goto err_out_files; 453 - } 454 - 455 - /* Optional attributes */ 456 - /* 457 - * In the long run it maybe a good idea to make one set of 458 - * optionals per connector type. 459 - */ 460 - switch (connector->connector_type) { 461 - case DRM_MODE_CONNECTOR_DVII: 462 - case DRM_MODE_CONNECTOR_Composite: 463 - case DRM_MODE_CONNECTOR_SVIDEO: 464 - case DRM_MODE_CONNECTOR_Component: 465 - case DRM_MODE_CONNECTOR_TV: 466 - for (opt_cnt = 0; opt_cnt < ARRAY_SIZE(connector_attrs_opt1); opt_cnt++) { 467 - ret = device_create_file(connector->kdev, &connector_attrs_opt1[opt_cnt]); 468 - if (ret) 469 - goto err_out_files; 470 - } 471 - break; 472 - default: 473 - break; 474 - } 475 - 476 - ret = sysfs_create_bin_file(&connector->kdev->kobj, &edid_attr); 477 - if (ret) 478 - goto err_out_files; 479 390 480 391 /* Let userspace know we have a new connector */ 481 392 drm_sysfs_hotplug_event(dev); 482 393 483 394 return 0; 484 - 485 - err_out_files: 486 - for (i = 0; i < opt_cnt; i++) 487 - device_remove_file(connector->kdev, &connector_attrs_opt1[i]); 488 - for (i = 0; i < attr_cnt; i++) 489 - device_remove_file(connector->kdev, &connector_attrs[i]); 490 - device_unregister(connector->kdev); 491 - 492 - out: 493 - return ret; 494 395 } 495 396 496 397 /** ··· 462 455 */ 463 456 void drm_sysfs_connector_remove(struct drm_connector *connector) 464 457 { 465 - int i; 466 - 467 458 if (!connector->kdev) 468 459 return; 469 460 DRM_DEBUG("removing \"%s\" from sysfs\n", 470 461 connector->name); 471 462 472 - for (i = 0; i < ARRAY_SIZE(connector_attrs); i++) 473 - device_remove_file(connector->kdev, &connector_attrs[i]); 474 - sysfs_remove_bin_file(&connector->kdev->kobj, &edid_attr); 475 463 device_unregister(connector->kdev); 476 464 connector->kdev = NULL; 477 465 }
+2 -12
drivers/gpu/drm/exynos/exynos_drm_fimc.c
··· 461 461 cfg |= EXYNOS_MSCTRL_C_INT_IN_3PLANE; 462 462 break; 463 463 case DRM_FORMAT_NV12: 464 - case DRM_FORMAT_NV12MT: 465 464 case DRM_FORMAT_NV16: 466 465 cfg |= (EXYNOS_MSCTRL_ORDER2P_LSB_CBCR | 467 466 EXYNOS_MSCTRL_C_INT_IN_2PLANE); ··· 510 511 case DRM_FORMAT_YVU420: 511 512 case DRM_FORMAT_NV12: 512 513 case DRM_FORMAT_NV21: 513 - case DRM_FORMAT_NV12MT: 514 514 cfg |= EXYNOS_MSCTRL_INFORMAT_YCBCR420; 515 515 break; 516 516 default: ··· 522 524 cfg = fimc_read(ctx, EXYNOS_CIDMAPARAM); 523 525 cfg &= ~EXYNOS_CIDMAPARAM_R_MODE_MASK; 524 526 525 - if (fmt == DRM_FORMAT_NV12MT) 526 - cfg |= EXYNOS_CIDMAPARAM_R_MODE_64X32; 527 - else 528 - cfg |= EXYNOS_CIDMAPARAM_R_MODE_LINEAR; 527 + cfg |= EXYNOS_CIDMAPARAM_R_MODE_LINEAR; 529 528 530 529 fimc_write(ctx, cfg, EXYNOS_CIDMAPARAM); 531 530 ··· 807 812 cfg |= EXYNOS_CIOCTRL_YCBCR_3PLANE; 808 813 break; 809 814 case DRM_FORMAT_NV12: 810 - case DRM_FORMAT_NV12MT: 811 815 case DRM_FORMAT_NV16: 812 816 cfg |= EXYNOS_CIOCTRL_ORDER2P_LSB_CBCR; 813 817 cfg |= EXYNOS_CIOCTRL_YCBCR_2PLANE; ··· 861 867 case DRM_FORMAT_YUV420: 862 868 case DRM_FORMAT_YVU420: 863 869 case DRM_FORMAT_NV12: 864 - case DRM_FORMAT_NV12MT: 865 870 case DRM_FORMAT_NV21: 866 871 cfg |= EXYNOS_CITRGFMT_OUTFORMAT_YCBCR420; 867 872 break; ··· 876 883 cfg = fimc_read(ctx, EXYNOS_CIDMAPARAM); 877 884 cfg &= ~EXYNOS_CIDMAPARAM_W_MODE_MASK; 878 885 879 - if (fmt == DRM_FORMAT_NV12MT) 880 - cfg |= EXYNOS_CIDMAPARAM_W_MODE_64X32; 881 - else 882 - cfg |= EXYNOS_CIDMAPARAM_W_MODE_LINEAR; 886 + cfg |= EXYNOS_CIDMAPARAM_W_MODE_LINEAR; 883 887 884 888 fimc_write(ctx, cfg, EXYNOS_CIDMAPARAM); 885 889
-6
drivers/gpu/drm/exynos/exynos_drm_gsc.c
··· 542 542 cfg |= (GSC_IN_CHROMA_ORDER_CBCR | 543 543 GSC_IN_YUV420_2P); 544 544 break; 545 - case DRM_FORMAT_NV12MT: 546 - cfg |= (GSC_IN_TILE_C_16x8 | GSC_IN_TILE_MODE); 547 - break; 548 545 default: 549 546 dev_err(ippdrv->dev, "inavlid target yuv order 0x%x.\n", fmt); 550 547 return -EINVAL; ··· 805 808 case DRM_FORMAT_NV16: 806 809 cfg |= (GSC_OUT_CHROMA_ORDER_CBCR | 807 810 GSC_OUT_YUV420_2P); 808 - break; 809 - case DRM_FORMAT_NV12MT: 810 - cfg |= (GSC_OUT_TILE_C_16x8 | GSC_OUT_TILE_MODE); 811 811 break; 812 812 default: 813 813 dev_err(ippdrv->dev, "inavlid target yuv order 0x%x.\n", fmt);
-1
drivers/gpu/drm/exynos/exynos_drm_plane.c
··· 23 23 DRM_FORMAT_XRGB8888, 24 24 DRM_FORMAT_ARGB8888, 25 25 DRM_FORMAT_NV12, 26 - DRM_FORMAT_NV12MT, 27 26 }; 28 27 29 28 /*
-2
drivers/gpu/drm/exynos/exynos_mixer.c
··· 412 412 win_data = &ctx->win_data[win]; 413 413 414 414 switch (win_data->pixel_format) { 415 - case DRM_FORMAT_NV12MT: 416 - tiled_mode = true; 417 415 case DRM_FORMAT_NV12: 418 416 crcb_mode = false; 419 417 buf_num = 2;
-3
include/uapi/drm/drm_fourcc.h
··· 109 109 #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ 110 110 #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ 111 111 112 - /* special NV12 tiled format */ 113 - #define DRM_FORMAT_NV12MT fourcc_code('T', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane 64x32 macroblocks */ 114 - 115 112 /* 116 113 * 3 plane YCbCr 117 114 * index 0: Y plane, [7:0] Y