| .. | .. |
|---|
| 11 | 11 | #include <linux/of_gpio.h> |
|---|
| 12 | 12 | #include <linux/platform_device.h> |
|---|
| 13 | 13 | |
|---|
| 14 | | -#include <drm/drmP.h> |
|---|
| 15 | 14 | #include <drm/drm_atomic_helper.h> |
|---|
| 16 | | -#include <drm/drm_crtc_helper.h> |
|---|
| 15 | +#include <drm/drm_bridge.h> |
|---|
| 16 | +#include <drm/drm_device.h> |
|---|
| 17 | 17 | #include <drm/drm_panel.h> |
|---|
| 18 | +#include <drm/drm_print.h> |
|---|
| 19 | +#include <drm/drm_probe_helper.h> |
|---|
| 18 | 20 | |
|---|
| 19 | 21 | #include "sti_awg_utils.h" |
|---|
| 20 | 22 | #include "sti_drv.h" |
|---|
| .. | .. |
|---|
| 64 | 66 | .awg_fwgen_fct = sti_awg_generate_code_data_enable_mode, |
|---|
| 65 | 67 | }; |
|---|
| 66 | 68 | |
|---|
| 67 | | -/** |
|---|
| 69 | +/* |
|---|
| 68 | 70 | * STI digital video output structure |
|---|
| 69 | 71 | * |
|---|
| 70 | 72 | * @dev: driver device |
|---|
| .. | .. |
|---|
| 194 | 196 | { "dvo", dvo_dbg_show, 0, NULL }, |
|---|
| 195 | 197 | }; |
|---|
| 196 | 198 | |
|---|
| 197 | | -static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor) |
|---|
| 199 | +static void dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor) |
|---|
| 198 | 200 | { |
|---|
| 199 | 201 | unsigned int i; |
|---|
| 200 | 202 | |
|---|
| 201 | 203 | for (i = 0; i < ARRAY_SIZE(dvo_debugfs_files); i++) |
|---|
| 202 | 204 | dvo_debugfs_files[i].data = dvo; |
|---|
| 203 | 205 | |
|---|
| 204 | | - return drm_debugfs_create_files(dvo_debugfs_files, |
|---|
| 205 | | - ARRAY_SIZE(dvo_debugfs_files), |
|---|
| 206 | | - minor->debugfs_root, minor); |
|---|
| 206 | + drm_debugfs_create_files(dvo_debugfs_files, |
|---|
| 207 | + ARRAY_SIZE(dvo_debugfs_files), |
|---|
| 208 | + minor->debugfs_root, minor); |
|---|
| 207 | 209 | } |
|---|
| 208 | 210 | |
|---|
| 209 | 211 | static void sti_dvo_disable(struct drm_bridge *bridge) |
|---|
| .. | .. |
|---|
| 220 | 222 | |
|---|
| 221 | 223 | writel(0x00000000, dvo->regs + DVO_DOF_CFG); |
|---|
| 222 | 224 | |
|---|
| 223 | | - if (dvo->panel) |
|---|
| 224 | | - dvo->panel->funcs->disable(dvo->panel); |
|---|
| 225 | + drm_panel_disable(dvo->panel); |
|---|
| 225 | 226 | |
|---|
| 226 | 227 | /* Disable/unprepare dvo clock */ |
|---|
| 227 | 228 | clk_disable_unprepare(dvo->clk_pix); |
|---|
| .. | .. |
|---|
| 261 | 262 | if (clk_prepare_enable(dvo->clk)) |
|---|
| 262 | 263 | DRM_ERROR("Failed to prepare/enable dvo clk\n"); |
|---|
| 263 | 264 | |
|---|
| 264 | | - if (dvo->panel) |
|---|
| 265 | | - dvo->panel->funcs->enable(dvo->panel); |
|---|
| 265 | + drm_panel_enable(dvo->panel); |
|---|
| 266 | 266 | |
|---|
| 267 | 267 | /* Set LUT */ |
|---|
| 268 | 268 | writel(config->lowbyte, dvo->regs + DVO_LUT_PROG_LOW); |
|---|
| .. | .. |
|---|
| 277 | 277 | } |
|---|
| 278 | 278 | |
|---|
| 279 | 279 | static void sti_dvo_set_mode(struct drm_bridge *bridge, |
|---|
| 280 | | - struct drm_display_mode *mode, |
|---|
| 281 | | - struct drm_display_mode *adjusted_mode) |
|---|
| 280 | + const struct drm_display_mode *mode, |
|---|
| 281 | + const struct drm_display_mode *adjusted_mode) |
|---|
| 282 | 282 | { |
|---|
| 283 | 283 | struct sti_dvo *dvo = bridge->driver_private; |
|---|
| 284 | 284 | struct sti_mixer *mixer = to_sti_mixer(dvo->encoder->crtc); |
|---|
| .. | .. |
|---|
| 288 | 288 | |
|---|
| 289 | 289 | DRM_DEBUG_DRIVER("\n"); |
|---|
| 290 | 290 | |
|---|
| 291 | | - memcpy(&dvo->mode, mode, sizeof(struct drm_display_mode)); |
|---|
| 291 | + drm_mode_copy(&dvo->mode, mode); |
|---|
| 292 | 292 | |
|---|
| 293 | 293 | /* According to the path used (main or aux), the dvo clocks should |
|---|
| 294 | 294 | * have a different parent clock. */ |
|---|
| .. | .. |
|---|
| 339 | 339 | struct sti_dvo *dvo = dvo_connector->dvo; |
|---|
| 340 | 340 | |
|---|
| 341 | 341 | if (dvo->panel) |
|---|
| 342 | | - return dvo->panel->funcs->get_modes(dvo->panel); |
|---|
| 342 | + return drm_panel_get_modes(dvo->panel, connector); |
|---|
| 343 | 343 | |
|---|
| 344 | 344 | return 0; |
|---|
| 345 | 345 | } |
|---|
| 346 | 346 | |
|---|
| 347 | 347 | #define CLK_TOLERANCE_HZ 50 |
|---|
| 348 | 348 | |
|---|
| 349 | | -static int sti_dvo_connector_mode_valid(struct drm_connector *connector, |
|---|
| 350 | | - struct drm_display_mode *mode) |
|---|
| 349 | +static enum drm_mode_status |
|---|
| 350 | +sti_dvo_connector_mode_valid(struct drm_connector *connector, |
|---|
| 351 | + struct drm_display_mode *mode) |
|---|
| 351 | 352 | { |
|---|
| 352 | 353 | int target = mode->clock * 1000; |
|---|
| 353 | 354 | int target_min = target - CLK_TOLERANCE_HZ; |
|---|
| .. | .. |
|---|
| 389 | 390 | dvo->panel = of_drm_find_panel(dvo->panel_node); |
|---|
| 390 | 391 | if (IS_ERR(dvo->panel)) |
|---|
| 391 | 392 | dvo->panel = NULL; |
|---|
| 392 | | - else |
|---|
| 393 | | - drm_panel_attach(dvo->panel, connector); |
|---|
| 394 | 393 | } |
|---|
| 395 | 394 | |
|---|
| 396 | 395 | if (dvo->panel) |
|---|
| .. | .. |
|---|
| 405 | 404 | = to_sti_dvo_connector(connector); |
|---|
| 406 | 405 | struct sti_dvo *dvo = dvo_connector->dvo; |
|---|
| 407 | 406 | |
|---|
| 408 | | - if (dvo_debugfs_init(dvo, dvo->drm_dev->primary)) { |
|---|
| 409 | | - DRM_ERROR("DVO debugfs setup failed\n"); |
|---|
| 410 | | - return -EINVAL; |
|---|
| 411 | | - } |
|---|
| 407 | + dvo_debugfs_init(dvo, dvo->drm_dev->primary); |
|---|
| 412 | 408 | |
|---|
| 413 | 409 | return 0; |
|---|
| 414 | 410 | } |
|---|
| .. | .. |
|---|
| 467 | 463 | bridge->of_node = dvo->dev.of_node; |
|---|
| 468 | 464 | drm_bridge_add(bridge); |
|---|
| 469 | 465 | |
|---|
| 470 | | - err = drm_bridge_attach(encoder, bridge, NULL); |
|---|
| 466 | + err = drm_bridge_attach(encoder, bridge, NULL, 0); |
|---|
| 471 | 467 | if (err) { |
|---|
| 472 | 468 | DRM_ERROR("Failed to attach bridge\n"); |
|---|
| 473 | 469 | return err; |
|---|
| .. | .. |
|---|
| 534 | 530 | DRM_ERROR("Invalid dvo resource\n"); |
|---|
| 535 | 531 | return -ENOMEM; |
|---|
| 536 | 532 | } |
|---|
| 537 | | - dvo->regs = devm_ioremap_nocache(dev, res->start, |
|---|
| 533 | + dvo->regs = devm_ioremap(dev, res->start, |
|---|
| 538 | 534 | resource_size(res)); |
|---|
| 539 | 535 | if (!dvo->regs) |
|---|
| 540 | 536 | return -ENOMEM; |
|---|