.. | .. |
---|
6 | 6 | |
---|
7 | 7 | #include <linux/clk.h> |
---|
8 | 8 | #include <linux/component.h> |
---|
| 9 | +#include <linux/io.h> |
---|
9 | 10 | #include <linux/module.h> |
---|
10 | 11 | #include <linux/platform_device.h> |
---|
11 | 12 | #include <linux/seq_file.h> |
---|
12 | 13 | |
---|
13 | | -#include <drm/drmP.h> |
---|
14 | 14 | #include <drm/drm_atomic_helper.h> |
---|
15 | | -#include <drm/drm_crtc_helper.h> |
---|
| 15 | +#include <drm/drm_bridge.h> |
---|
| 16 | +#include <drm/drm_debugfs.h> |
---|
| 17 | +#include <drm/drm_device.h> |
---|
| 18 | +#include <drm/drm_file.h> |
---|
| 19 | +#include <drm/drm_print.h> |
---|
| 20 | +#include <drm/drm_probe_helper.h> |
---|
16 | 21 | |
---|
17 | 22 | /* HDformatter registers */ |
---|
18 | 23 | #define HDA_ANA_CFG 0x0000 |
---|
.. | .. |
---|
226 | 231 | AWGi_720x480p_60, NN_720x480p_60, VID_ED} |
---|
227 | 232 | }; |
---|
228 | 233 | |
---|
229 | | -/** |
---|
| 234 | +/* |
---|
230 | 235 | * STI hd analog structure |
---|
231 | 236 | * |
---|
232 | 237 | * @dev: driver device |
---|
.. | .. |
---|
362 | 367 | { "hda", hda_dbg_show, 0, NULL }, |
---|
363 | 368 | }; |
---|
364 | 369 | |
---|
365 | | -static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor) |
---|
| 370 | +static void hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor) |
---|
366 | 371 | { |
---|
367 | 372 | unsigned int i; |
---|
368 | 373 | |
---|
369 | 374 | for (i = 0; i < ARRAY_SIZE(hda_debugfs_files); i++) |
---|
370 | 375 | hda_debugfs_files[i].data = hda; |
---|
371 | 376 | |
---|
372 | | - return drm_debugfs_create_files(hda_debugfs_files, |
---|
373 | | - ARRAY_SIZE(hda_debugfs_files), |
---|
374 | | - minor->debugfs_root, minor); |
---|
| 377 | + drm_debugfs_create_files(hda_debugfs_files, |
---|
| 378 | + ARRAY_SIZE(hda_debugfs_files), |
---|
| 379 | + minor->debugfs_root, minor); |
---|
375 | 380 | } |
---|
376 | 381 | |
---|
377 | 382 | /** |
---|
.. | .. |
---|
508 | 513 | } |
---|
509 | 514 | |
---|
510 | 515 | static void sti_hda_set_mode(struct drm_bridge *bridge, |
---|
511 | | - struct drm_display_mode *mode, |
---|
512 | | - struct drm_display_mode *adjusted_mode) |
---|
| 516 | + const struct drm_display_mode *mode, |
---|
| 517 | + const struct drm_display_mode *adjusted_mode) |
---|
513 | 518 | { |
---|
514 | 519 | struct sti_hda *hda = bridge->driver_private; |
---|
515 | 520 | u32 mode_idx; |
---|
.. | .. |
---|
518 | 523 | |
---|
519 | 524 | DRM_DEBUG_DRIVER("\n"); |
---|
520 | 525 | |
---|
521 | | - memcpy(&hda->mode, mode, sizeof(struct drm_display_mode)); |
---|
| 526 | + drm_mode_copy(&hda->mode, mode); |
---|
522 | 527 | |
---|
523 | 528 | if (!hda_get_mode_idx(hda->mode, &mode_idx)) { |
---|
524 | 529 | DRM_ERROR("Undefined mode\n"); |
---|
.. | .. |
---|
581 | 586 | &hda_supported_modes[i].mode); |
---|
582 | 587 | if (!mode) |
---|
583 | 588 | continue; |
---|
584 | | - mode->vrefresh = drm_mode_vrefresh(mode); |
---|
585 | 589 | |
---|
586 | 590 | /* the first mode is the preferred mode */ |
---|
587 | 591 | if (i == 0) |
---|
.. | .. |
---|
596 | 600 | |
---|
597 | 601 | #define CLK_TOLERANCE_HZ 50 |
---|
598 | 602 | |
---|
599 | | -static int sti_hda_connector_mode_valid(struct drm_connector *connector, |
---|
600 | | - struct drm_display_mode *mode) |
---|
| 603 | +static enum drm_mode_status |
---|
| 604 | +sti_hda_connector_mode_valid(struct drm_connector *connector, |
---|
| 605 | + struct drm_display_mode *mode) |
---|
601 | 606 | { |
---|
602 | 607 | int target = mode->clock * 1000; |
---|
603 | 608 | int target_min = target - CLK_TOLERANCE_HZ; |
---|
.. | .. |
---|
638 | 643 | = to_sti_hda_connector(connector); |
---|
639 | 644 | struct sti_hda *hda = hda_connector->hda; |
---|
640 | 645 | |
---|
641 | | - if (hda_debugfs_init(hda, hda->drm_dev->primary)) { |
---|
642 | | - DRM_ERROR("HDA debugfs setup failed\n"); |
---|
643 | | - return -EINVAL; |
---|
644 | | - } |
---|
| 646 | + hda_debugfs_init(hda, hda->drm_dev->primary); |
---|
645 | 647 | |
---|
646 | 648 | return 0; |
---|
647 | 649 | } |
---|
.. | .. |
---|
696 | 698 | |
---|
697 | 699 | bridge->driver_private = hda; |
---|
698 | 700 | bridge->funcs = &sti_hda_bridge_funcs; |
---|
699 | | - drm_bridge_attach(encoder, bridge, NULL); |
---|
| 701 | + drm_bridge_attach(encoder, bridge, NULL, 0); |
---|
700 | 702 | |
---|
701 | 703 | connector->encoder = encoder; |
---|
702 | 704 | |
---|
.. | .. |
---|
754 | 756 | DRM_ERROR("Invalid hda resource\n"); |
---|
755 | 757 | return -ENOMEM; |
---|
756 | 758 | } |
---|
757 | | - hda->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); |
---|
| 759 | + hda->regs = devm_ioremap(dev, res->start, resource_size(res)); |
---|
758 | 760 | if (!hda->regs) |
---|
759 | 761 | return -ENOMEM; |
---|
760 | 762 | |
---|
761 | 763 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
---|
762 | 764 | "video-dacs-ctrl"); |
---|
763 | 765 | if (res) { |
---|
764 | | - hda->video_dacs_ctrl = devm_ioremap_nocache(dev, res->start, |
---|
| 766 | + hda->video_dacs_ctrl = devm_ioremap(dev, res->start, |
---|
765 | 767 | resource_size(res)); |
---|
766 | 768 | if (!hda->video_dacs_ctrl) |
---|
767 | 769 | return -ENOMEM; |
---|