| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2017 Sanechips Technology Co., Ltd. |
|---|
| 3 | 4 | * Copyright 2017 Linaro Ltd. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 7 | | - * published by the Free Software Foundation. |
|---|
| 8 | 5 | */ |
|---|
| 9 | 6 | |
|---|
| 10 | 7 | #include <linux/clk.h> |
|---|
| 11 | 8 | #include <linux/component.h> |
|---|
| 12 | 9 | #include <linux/mfd/syscon.h> |
|---|
| 10 | +#include <linux/module.h> |
|---|
| 11 | +#include <linux/platform_device.h> |
|---|
| 13 | 12 | #include <linux/regmap.h> |
|---|
| 14 | 13 | |
|---|
| 15 | 14 | #include <drm/drm_atomic_helper.h> |
|---|
| 16 | | -#include <drm/drm_crtc_helper.h> |
|---|
| 17 | | -#include <drm/drmP.h> |
|---|
| 15 | +#include <drm/drm_print.h> |
|---|
| 16 | +#include <drm/drm_probe_helper.h> |
|---|
| 17 | +#include <drm/drm_simple_kms_helper.h> |
|---|
| 18 | 18 | |
|---|
| 19 | 19 | #include "zx_drm_drv.h" |
|---|
| 20 | 20 | #include "zx_vga_regs.h" |
|---|
| .. | .. |
|---|
| 71 | 71 | static const struct drm_encoder_helper_funcs zx_vga_encoder_helper_funcs = { |
|---|
| 72 | 72 | .enable = zx_vga_encoder_enable, |
|---|
| 73 | 73 | .disable = zx_vga_encoder_disable, |
|---|
| 74 | | -}; |
|---|
| 75 | | - |
|---|
| 76 | | -static const struct drm_encoder_funcs zx_vga_encoder_funcs = { |
|---|
| 77 | | - .destroy = drm_encoder_cleanup, |
|---|
| 78 | 74 | }; |
|---|
| 79 | 75 | |
|---|
| 80 | 76 | static int zx_vga_connector_get_modes(struct drm_connector *connector) |
|---|
| .. | .. |
|---|
| 155 | 151 | |
|---|
| 156 | 152 | encoder->possible_crtcs = VOU_CRTC_MASK; |
|---|
| 157 | 153 | |
|---|
| 158 | | - ret = drm_encoder_init(drm, encoder, &zx_vga_encoder_funcs, |
|---|
| 159 | | - DRM_MODE_ENCODER_DAC, NULL); |
|---|
| 154 | + ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_DAC); |
|---|
| 160 | 155 | if (ret) { |
|---|
| 161 | 156 | DRM_DEV_ERROR(dev, "failed to init encoder: %d\n", ret); |
|---|
| 162 | 157 | return ret; |
|---|
| 163 | | - }; |
|---|
| 158 | + } |
|---|
| 164 | 159 | |
|---|
| 165 | 160 | drm_encoder_helper_add(encoder, &zx_vga_encoder_helper_funcs); |
|---|
| 166 | 161 | |
|---|
| 167 | 162 | vga->connector.polled = DRM_CONNECTOR_POLL_HPD; |
|---|
| 168 | 163 | |
|---|
| 169 | | - ret = drm_connector_init(drm, connector, &zx_vga_connector_funcs, |
|---|
| 170 | | - DRM_MODE_CONNECTOR_VGA); |
|---|
| 164 | + ret = drm_connector_init_with_ddc(drm, connector, |
|---|
| 165 | + &zx_vga_connector_funcs, |
|---|
| 166 | + DRM_MODE_CONNECTOR_VGA, |
|---|
| 167 | + &vga->ddc->adap); |
|---|
| 171 | 168 | if (ret) { |
|---|
| 172 | 169 | DRM_DEV_ERROR(dev, "failed to init connector: %d\n", ret); |
|---|
| 173 | 170 | goto clean_encoder; |
|---|
| 174 | | - }; |
|---|
| 171 | + } |
|---|
| 175 | 172 | |
|---|
| 176 | 173 | drm_connector_helper_add(connector, &zx_vga_connector_helper_funcs); |
|---|
| 177 | 174 | |
|---|
| .. | .. |
|---|
| 179 | 176 | if (ret) { |
|---|
| 180 | 177 | DRM_DEV_ERROR(dev, "failed to attach encoder: %d\n", ret); |
|---|
| 181 | 178 | goto clean_connector; |
|---|
| 182 | | - }; |
|---|
| 179 | + } |
|---|
| 183 | 180 | |
|---|
| 184 | 181 | return 0; |
|---|
| 185 | 182 | |
|---|