2018-07-26 02:37:32 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2013-06-19 13:54:11 +02:00
|
|
|
/*
|
2022-04-24 23:44:35 +03:00
|
|
|
* R-Car Display Unit DRM driver
|
2013-06-19 13:54:11 +02:00
|
|
|
*
|
2015-09-07 17:34:26 +03:00
|
|
|
* Copyright (C) 2013-2015 Renesas Electronics Corporation
|
2013-06-19 13:54:11 +02:00
|
|
|
*
|
|
|
|
* Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/clk.h>
|
2017-11-12 14:12:10 +02:00
|
|
|
#include <linux/dma-mapping.h>
|
2013-06-19 13:54:11 +02:00
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/module.h>
|
2023-07-14 11:45:34 -06:00
|
|
|
#include <linux/of.h>
|
2013-06-19 13:54:11 +02:00
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/pm.h>
|
|
|
|
#include <linux/slab.h>
|
2015-02-23 01:02:15 +02:00
|
|
|
#include <linux/wait.h>
|
2013-06-19 13:54:11 +02:00
|
|
|
|
2024-11-08 16:42:38 +01:00
|
|
|
#include <drm/clients/drm_client_setup.h>
|
2017-09-15 17:42:06 +01:00
|
|
|
#include <drm/drm_atomic_helper.h>
|
2020-12-03 18:21:55 +02:00
|
|
|
#include <drm/drm_drv.h>
|
2024-04-19 10:29:21 +02:00
|
|
|
#include <drm/drm_fbdev_dma.h>
|
2022-08-02 02:04:03 +02:00
|
|
|
#include <drm/drm_gem_dma_helper.h>
|
2020-12-03 18:21:55 +02:00
|
|
|
#include <drm/drm_managed.h>
|
2019-01-17 22:03:34 +01:00
|
|
|
#include <drm/drm_probe_helper.h>
|
2013-06-19 13:54:11 +02:00
|
|
|
|
|
|
|
#include "rcar_du_drv.h"
|
|
|
|
#include "rcar_du_kms.h"
|
|
|
|
|
2014-01-21 15:57:26 +01:00
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* Device Information
|
|
|
|
*/
|
|
|
|
|
2017-10-13 16:22:20 +01:00
|
|
|
static const struct rcar_du_device_info rzg1_du_r8a7743_info = {
|
|
|
|
.gen = 2,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-08-22 16:21:33 +03:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-27 23:21:52 +01:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2017-10-13 16:22:20 +01:00
|
|
|
.routes = {
|
|
|
|
/*
|
2018-09-21 19:08:30 +01:00
|
|
|
* R8A774[34] has one RGB output and one LVDS output
|
2017-10-13 16:22:20 +01:00
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(1) | BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 4,
|
2017-10-13 16:22:20 +01:00
|
|
|
};
|
|
|
|
|
2017-10-13 16:22:22 +01:00
|
|
|
static const struct rcar_du_device_info rzg1_du_r8a7745_info = {
|
|
|
|
.gen = 2,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-08-22 16:21:33 +03:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-27 23:21:52 +01:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2017-10-13 16:22:22 +01:00
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A7745 has two RGB outputs
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DPAD1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 4,
|
2017-10-13 16:22:22 +01:00
|
|
|
};
|
|
|
|
|
2018-10-16 17:58:59 +01:00
|
|
|
static const struct rcar_du_device_info rzg1_du_r8a77470_info = {
|
|
|
|
.gen = 2,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-10-16 17:58:59 +01:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A77470 has two RGB outputs, one LVDS output, and
|
|
|
|
* one (currently unsupported) analog video output
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DPAD1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0) | BIT(1),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 4,
|
2018-10-16 17:58:59 +01:00
|
|
|
};
|
|
|
|
|
2019-04-12 13:38:04 +01:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a774a1_info = {
|
|
|
|
.gen = 3,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2019-04-12 13:38:04 +01:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
|
|
|
.channels_mask = BIT(2) | BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A774A1 has one RGB output, one LVDS output and one HDMI
|
|
|
|
* output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 5,
|
2019-04-12 13:38:04 +01:00
|
|
|
.dpll_mask = BIT(1),
|
|
|
|
};
|
|
|
|
|
2019-09-30 10:15:03 +01:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a774b1_info = {
|
|
|
|
.gen = 3,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2019-09-30 10:15:03 +01:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
|
|
|
.channels_mask = BIT(3) | BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A774B1 has one RGB output, one LVDS output and one HDMI
|
|
|
|
* output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 5,
|
2019-09-30 10:15:03 +01:00
|
|
|
.dpll_mask = BIT(1),
|
|
|
|
};
|
|
|
|
|
2018-12-13 20:23:27 +00:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a774c0_info = {
|
|
|
|
.gen = 3,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-12-13 20:23:27 +00:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE,
|
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A774C0 has one RGB output and two LVDS outputs
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0) | BIT(1),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 2,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 4,
|
2018-12-13 20:23:27 +00:00
|
|
|
.lvds_clk_mask = BIT(1) | BIT(0),
|
|
|
|
};
|
|
|
|
|
2020-08-12 15:02:10 +01:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a774e1_info = {
|
|
|
|
.gen = 3,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2020-08-12 15:02:10 +01:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
|
|
|
.channels_mask = BIT(3) | BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A774E1 has one RGB output, one LVDS output and one HDMI
|
|
|
|
* output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 5,
|
2020-08-12 15:02:10 +01:00
|
|
|
.dpll_mask = BIT(1),
|
|
|
|
};
|
|
|
|
|
2014-01-21 15:57:26 +01:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7779_info = {
|
2018-11-24 19:57:17 +02:00
|
|
|
.gen = 1,
|
2018-08-22 16:21:33 +03:00
|
|
|
.features = RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-27 23:21:52 +01:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2014-01-21 15:57:26 +01:00
|
|
|
.routes = {
|
2017-07-11 01:13:20 +03:00
|
|
|
/*
|
|
|
|
* R8A7779 has two RGB outputs and one (currently unsupported)
|
2014-01-21 15:57:26 +01:00
|
|
|
* TCON output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DPAD1] = {
|
|
|
|
.possible_crtcs = BIT(1) | BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7790_info = {
|
2015-09-07 17:34:26 +03:00
|
|
|
.gen = 2,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-08-22 16:21:33 +03:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-01-10 05:47:42 +02:00
|
|
|
.quirks = RCAR_DU_QUIRK_ALIGN_128B,
|
2018-04-27 23:21:52 +01:00
|
|
|
.channels_mask = BIT(2) | BIT(1) | BIT(0),
|
2014-01-21 15:57:26 +01:00
|
|
|
.routes = {
|
2017-07-11 01:13:20 +03:00
|
|
|
/*
|
2020-08-07 18:49:49 +01:00
|
|
|
* R8A7742 and R8A7790 each have one RGB output and two LVDS
|
|
|
|
* outputs. Additionally R8A7790 supports one TCON output
|
|
|
|
* (currently unsupported by the driver).
|
2014-01-21 15:57:26 +01:00
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2) | BIT(1) | BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS1] = {
|
|
|
|
.possible_crtcs = BIT(2) | BIT(1),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 2,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 4,
|
2014-01-21 15:57:26 +01:00
|
|
|
};
|
|
|
|
|
2015-07-17 10:44:33 +03:00
|
|
|
/* M2-W (r8a7791) and M2-N (r8a7793) are identical */
|
2014-01-21 15:57:26 +01:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7791_info = {
|
2015-09-07 17:34:26 +03:00
|
|
|
.gen = 2,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-08-22 16:21:33 +03:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-27 23:21:52 +01:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2014-01-21 15:57:26 +01:00
|
|
|
.routes = {
|
2017-07-11 01:13:20 +03:00
|
|
|
/*
|
|
|
|
* R8A779[13] has one RGB output, one LVDS output and one
|
2014-01-21 15:57:26 +01:00
|
|
|
* (currently unsupported) TCON output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
2015-04-28 15:26:33 +03:00
|
|
|
.possible_crtcs = BIT(1) | BIT(0),
|
2014-01-21 15:57:26 +01:00
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 4,
|
2014-01-21 15:57:26 +01:00
|
|
|
};
|
|
|
|
|
2016-08-04 15:01:02 -07:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7792_info = {
|
|
|
|
.gen = 2,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-08-22 16:21:33 +03:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-27 23:21:52 +01:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2016-08-04 15:01:02 -07:00
|
|
|
.routes = {
|
|
|
|
/* R8A7792 has two RGB outputs. */
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DPAD1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 4,
|
2016-08-04 15:01:02 -07:00
|
|
|
};
|
|
|
|
|
2015-07-17 10:44:33 +03:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7794_info = {
|
2015-09-07 17:34:26 +03:00
|
|
|
.gen = 2,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-08-22 16:21:33 +03:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-27 23:21:52 +01:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2015-07-17 10:44:33 +03:00
|
|
|
.routes = {
|
2017-07-11 01:13:20 +03:00
|
|
|
/*
|
|
|
|
* R8A7794 has two RGB outputs and one (currently unsupported)
|
2015-07-17 10:44:33 +03:00
|
|
|
* TCON output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DPAD1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 4,
|
2015-07-17 10:44:33 +03:00
|
|
|
};
|
|
|
|
|
2015-09-07 17:34:26 +03:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7795_info = {
|
|
|
|
.gen = 3,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-08-20 17:00:44 +01:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
2018-08-22 16:21:33 +03:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-27 23:21:52 +01:00
|
|
|
.channels_mask = BIT(3) | BIT(2) | BIT(1) | BIT(0),
|
2015-09-07 17:34:26 +03:00
|
|
|
.routes = {
|
2017-07-11 01:13:20 +03:00
|
|
|
/*
|
|
|
|
* R8A7795 has one RGB output, two HDMI outputs and one
|
2016-11-11 18:07:39 +01:00
|
|
|
* LVDS output.
|
2015-09-07 17:34:26 +03:00
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(3),
|
|
|
|
.port = 0,
|
|
|
|
},
|
2016-11-11 18:07:39 +01:00
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_HDMI1] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 2,
|
|
|
|
},
|
2015-07-28 20:12:43 +09:00
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 3,
|
|
|
|
},
|
2015-09-07 17:34:26 +03:00
|
|
|
},
|
2015-07-28 20:12:43 +09:00
|
|
|
.num_lvds = 1,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 5,
|
2018-08-22 09:21:47 +02:00
|
|
|
.dpll_mask = BIT(2) | BIT(1),
|
2015-09-07 17:34:26 +03:00
|
|
|
};
|
|
|
|
|
2016-09-06 02:11:43 +03:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7796_info = {
|
|
|
|
.gen = 3,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-08-20 17:00:44 +01:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
2018-08-22 16:21:33 +03:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-27 23:21:52 +01:00
|
|
|
.channels_mask = BIT(2) | BIT(1) | BIT(0),
|
2016-09-06 02:11:43 +03:00
|
|
|
.routes = {
|
2017-07-11 01:13:20 +03:00
|
|
|
/*
|
2017-06-19 23:34:40 +03:00
|
|
|
* R8A7796 has one RGB output, one LVDS output and one HDMI
|
|
|
|
* output.
|
2016-09-06 02:11:43 +03:00
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 0,
|
|
|
|
},
|
2017-06-19 23:34:40 +03:00
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
2016-09-06 02:11:43 +03:00
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 5,
|
2018-08-22 09:21:47 +02:00
|
|
|
.dpll_mask = BIT(1),
|
2016-09-06 02:11:43 +03:00
|
|
|
};
|
|
|
|
|
2018-04-27 23:21:54 +01:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a77965_info = {
|
|
|
|
.gen = 3,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-08-20 17:00:44 +01:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
2018-08-22 16:21:33 +03:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-27 23:21:54 +01:00
|
|
|
.channels_mask = BIT(3) | BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A77965 has one RGB output, one LVDS output and one HDMI
|
|
|
|
* output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 5,
|
2018-08-22 09:21:47 +02:00
|
|
|
.dpll_mask = BIT(1),
|
2018-04-27 23:21:54 +01:00
|
|
|
};
|
|
|
|
|
2018-01-19 00:05:59 +03:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a77970_info = {
|
|
|
|
.gen = 3,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-08-20 17:00:44 +01:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
2018-08-22 16:21:33 +03:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-27 23:21:52 +01:00
|
|
|
.channels_mask = BIT(0),
|
2018-01-19 00:05:59 +03:00
|
|
|
.routes = {
|
2019-09-11 20:25:01 +01:00
|
|
|
/*
|
|
|
|
* R8A77970 and R8A77980 have one RGB output and one LVDS
|
|
|
|
* output.
|
|
|
|
*/
|
2018-01-19 00:05:59 +03:00
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 5,
|
2018-01-19 00:05:59 +03:00
|
|
|
};
|
|
|
|
|
2018-08-14 15:49:56 +02:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7799x_info = {
|
|
|
|
.gen = 3,
|
2021-09-23 00:47:25 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_CRTC_CLOCK
|
2018-08-14 15:49:56 +02:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE,
|
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A77990 and R8A77995 have one RGB output and two LVDS
|
|
|
|
* outputs.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0) | BIT(1),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 2,
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 5,
|
2018-08-14 15:49:56 +02:00
|
|
|
.lvds_clk_mask = BIT(1) | BIT(0),
|
|
|
|
};
|
|
|
|
|
2021-09-23 00:47:26 +01:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a779a0_info = {
|
2022-12-21 11:24:47 +02:00
|
|
|
.gen = 4,
|
2021-09-23 00:47:26 +01:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
2022-08-17 16:28:02 +03:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
|
|
|
| RCAR_DU_FEATURE_NO_BLENDING,
|
2021-09-23 00:47:26 +01:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/* R8A779A0 has two MIPI DSI outputs. */
|
|
|
|
[RCAR_DU_OUTPUT_DSI0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DSI1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
2022-04-21 17:31:27 +01:00
|
|
|
.num_rpf = 5,
|
2021-09-23 00:47:26 +01:00
|
|
|
.dsi_clk_mask = BIT(1) | BIT(0),
|
|
|
|
};
|
|
|
|
|
2022-12-01 11:56:30 +02:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a779g0_info = {
|
|
|
|
.gen = 4,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
|
|
|
| RCAR_DU_FEATURE_NO_BLENDING,
|
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/* R8A779G0 has two MIPI DSI outputs. */
|
|
|
|
[RCAR_DU_OUTPUT_DSI0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DSI1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_rpf = 5,
|
|
|
|
.dsi_clk_mask = BIT(1) | BIT(0),
|
|
|
|
};
|
|
|
|
|
2024-12-17 07:31:41 +02:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a779h0_info = {
|
|
|
|
.gen = 4,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ
|
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
|
|
|
| RCAR_DU_FEATURE_NO_BLENDING,
|
|
|
|
.channels_mask = BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/* R8A779H0 has one MIPI DSI output. */
|
|
|
|
[RCAR_DU_OUTPUT_DSI0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_rpf = 5,
|
|
|
|
.dsi_clk_mask = BIT(0),
|
|
|
|
};
|
|
|
|
|
2014-01-21 15:57:26 +01:00
|
|
|
static const struct of_device_id rcar_du_of_table[] = {
|
2020-08-07 18:49:49 +01:00
|
|
|
{ .compatible = "renesas,du-r8a7742", .data = &rcar_du_r8a7790_info },
|
2017-10-13 16:22:20 +01:00
|
|
|
{ .compatible = "renesas,du-r8a7743", .data = &rzg1_du_r8a7743_info },
|
2018-09-21 19:08:30 +01:00
|
|
|
{ .compatible = "renesas,du-r8a7744", .data = &rzg1_du_r8a7743_info },
|
2017-10-13 16:22:22 +01:00
|
|
|
{ .compatible = "renesas,du-r8a7745", .data = &rzg1_du_r8a7745_info },
|
2018-10-16 17:58:59 +01:00
|
|
|
{ .compatible = "renesas,du-r8a77470", .data = &rzg1_du_r8a77470_info },
|
2019-04-12 13:38:04 +01:00
|
|
|
{ .compatible = "renesas,du-r8a774a1", .data = &rcar_du_r8a774a1_info },
|
2019-09-30 10:15:03 +01:00
|
|
|
{ .compatible = "renesas,du-r8a774b1", .data = &rcar_du_r8a774b1_info },
|
2018-12-13 20:23:27 +00:00
|
|
|
{ .compatible = "renesas,du-r8a774c0", .data = &rcar_du_r8a774c0_info },
|
2020-08-12 15:02:10 +01:00
|
|
|
{ .compatible = "renesas,du-r8a774e1", .data = &rcar_du_r8a774e1_info },
|
2014-01-21 15:57:26 +01:00
|
|
|
{ .compatible = "renesas,du-r8a7779", .data = &rcar_du_r8a7779_info },
|
|
|
|
{ .compatible = "renesas,du-r8a7790", .data = &rcar_du_r8a7790_info },
|
|
|
|
{ .compatible = "renesas,du-r8a7791", .data = &rcar_du_r8a7791_info },
|
2016-08-04 15:01:02 -07:00
|
|
|
{ .compatible = "renesas,du-r8a7792", .data = &rcar_du_r8a7792_info },
|
2015-07-17 10:44:33 +03:00
|
|
|
{ .compatible = "renesas,du-r8a7793", .data = &rcar_du_r8a7791_info },
|
2015-07-17 10:44:33 +03:00
|
|
|
{ .compatible = "renesas,du-r8a7794", .data = &rcar_du_r8a7794_info },
|
2015-09-07 17:34:26 +03:00
|
|
|
{ .compatible = "renesas,du-r8a7795", .data = &rcar_du_r8a7795_info },
|
2016-09-06 02:11:43 +03:00
|
|
|
{ .compatible = "renesas,du-r8a7796", .data = &rcar_du_r8a7796_info },
|
2020-09-08 09:34:32 +09:00
|
|
|
{ .compatible = "renesas,du-r8a77961", .data = &rcar_du_r8a7796_info },
|
2018-04-27 23:21:54 +01:00
|
|
|
{ .compatible = "renesas,du-r8a77965", .data = &rcar_du_r8a77965_info },
|
2018-01-19 00:05:59 +03:00
|
|
|
{ .compatible = "renesas,du-r8a77970", .data = &rcar_du_r8a77970_info },
|
2019-09-11 20:25:01 +01:00
|
|
|
{ .compatible = "renesas,du-r8a77980", .data = &rcar_du_r8a77970_info },
|
2018-08-14 15:49:56 +02:00
|
|
|
{ .compatible = "renesas,du-r8a77990", .data = &rcar_du_r8a7799x_info },
|
|
|
|
{ .compatible = "renesas,du-r8a77995", .data = &rcar_du_r8a7799x_info },
|
2021-09-23 00:47:26 +01:00
|
|
|
{ .compatible = "renesas,du-r8a779a0", .data = &rcar_du_r8a779a0_info },
|
2022-12-01 11:56:30 +02:00
|
|
|
{ .compatible = "renesas,du-r8a779g0", .data = &rcar_du_r8a779g0_info },
|
2024-12-17 07:31:41 +02:00
|
|
|
{ .compatible = "renesas,du-r8a779h0", .data = &rcar_du_r8a779h0_info },
|
2014-01-21 15:57:26 +01:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(of, rcar_du_of_table);
|
|
|
|
|
2021-08-22 02:44:27 +03:00
|
|
|
const char *rcar_du_output_name(enum rcar_du_output output)
|
|
|
|
{
|
|
|
|
static const char * const names[] = {
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = "DPAD0",
|
|
|
|
[RCAR_DU_OUTPUT_DPAD1] = "DPAD1",
|
2021-11-29 17:08:45 +00:00
|
|
|
[RCAR_DU_OUTPUT_DSI0] = "DSI0",
|
|
|
|
[RCAR_DU_OUTPUT_DSI1] = "DSI1",
|
2021-08-22 02:44:27 +03:00
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = "HDMI0",
|
|
|
|
[RCAR_DU_OUTPUT_HDMI1] = "HDMI1",
|
2021-11-29 17:08:45 +00:00
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = "LVDS0",
|
|
|
|
[RCAR_DU_OUTPUT_LVDS1] = "LVDS1",
|
2021-08-22 02:44:27 +03:00
|
|
|
[RCAR_DU_OUTPUT_TCON] = "TCON",
|
|
|
|
};
|
|
|
|
|
|
|
|
if (output >= ARRAY_SIZE(names) || !names[output])
|
|
|
|
return "UNKNOWN";
|
|
|
|
|
|
|
|
return names[output];
|
|
|
|
}
|
|
|
|
|
2013-06-19 13:54:11 +02:00
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* DRM operations
|
|
|
|
*/
|
|
|
|
|
2022-08-02 02:04:03 +02:00
|
|
|
DEFINE_DRM_GEM_DMA_FOPS(rcar_du_fops);
|
2013-06-19 13:54:11 +02:00
|
|
|
|
2020-11-04 11:04:24 +01:00
|
|
|
static const struct drm_driver rcar_du_driver = {
|
2019-06-17 17:39:24 +02:00
|
|
|
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
|
drm: rcar-du: Allow importing non-contiguous dma-buf with VSP
On R-Car Gen3, the DU uses a separate IP core named VSP to perform DMA
from memory and composition of planes. The DU hardware then only handles
the video timings and the interface with the encoders. This differs from
Gen2, where the DU included a composer with DMA engines.
When sourcing from the VSP, the DU hardware performs no memory access,
and thus has no requirements on imported dma-buf memory types. The GEM
CMA helpers however still create a DMA mapping to the DU device, which
isn't used. The mapping to the VSP is done when processing the atomic
commits, in the plane .prepare_fb() handler.
When the system uses an IOMMU, the VSP device is attached to it, which
enables the VSP to use non physically contiguous memory. The DU, as it
performs no memory access, isn't connected to the IOMMU. The GEM CMA
drm_gem_cma_prime_import_sg_table() helper will in that case fail to map
non-contiguous imported dma-bufs, as the DMA mapping to the DU device
will have multiple entries in its sgtable. The prevents using non
physically contiguous memory for display.
The DRM PRIME and GEM CMA helpers are designed to create the sgtable
when the dma-buf is imported. By default, the device referenced by the
drm_device is used to create the dma-buf attachment. Drivers can use a
different device by using the drm_gem_prime_import_dev() function. While
the DU has access to the VSP device, this won't help here, as different
CRTCs use different VSP instances, connected to different IOMMU
channels. The driver doesn't know at import time which CRTC a GEM object
will be used, and thus can't select the right VSP device to pass to
drm_gem_prime_import_dev().
To support non-contiguous memory, implement a custom
.gem_prime_import_sg_table() operation that accepts all imported dma-buf
regardless of the number of scatterlist entries. The sgtable will be
mapped to the VSP at .prepare_fb() time, which will reject the
framebuffer if the VSP isn't connected to an IOMMU.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
2017-11-13 04:40:30 +02:00
|
|
|
.dumb_create = rcar_du_dumb_create,
|
|
|
|
.gem_prime_import_sg_table = rcar_du_gem_prime_import_sg_table,
|
2024-09-24 09:12:31 +02:00
|
|
|
DRM_FBDEV_DMA_DRIVER_OPS,
|
2013-06-19 13:54:11 +02:00
|
|
|
.fops = &rcar_du_fops,
|
|
|
|
.name = "rcar-du",
|
|
|
|
.desc = "Renesas R-Car Display Unit",
|
|
|
|
.major = 1,
|
|
|
|
.minor = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* Power management
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int rcar_du_pm_suspend(struct device *dev)
|
|
|
|
{
|
|
|
|
struct rcar_du_device *rcdu = dev_get_drvdata(dev);
|
|
|
|
|
2020-12-03 18:21:55 +02:00
|
|
|
return drm_mode_config_helper_suspend(&rcdu->ddev);
|
2013-06-19 13:54:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rcar_du_pm_resume(struct device *dev)
|
|
|
|
{
|
|
|
|
struct rcar_du_device *rcdu = dev_get_drvdata(dev);
|
|
|
|
|
2020-12-03 18:21:55 +02:00
|
|
|
return drm_mode_config_helper_resume(&rcdu->ddev);
|
2013-06-19 13:54:11 +02:00
|
|
|
}
|
|
|
|
|
2022-11-29 19:19:33 +00:00
|
|
|
static DEFINE_SIMPLE_DEV_PM_OPS(rcar_du_pm_ops,
|
|
|
|
rcar_du_pm_suspend, rcar_du_pm_resume);
|
2013-06-19 13:54:11 +02:00
|
|
|
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* Platform driver
|
|
|
|
*/
|
|
|
|
|
2023-05-07 18:26:00 +02:00
|
|
|
static void rcar_du_remove(struct platform_device *pdev)
|
2013-06-19 13:54:11 +02:00
|
|
|
{
|
2015-09-28 18:39:53 +03:00
|
|
|
struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
|
2020-12-03 18:21:55 +02:00
|
|
|
struct drm_device *ddev = &rcdu->ddev;
|
2015-09-28 18:39:53 +03:00
|
|
|
|
|
|
|
drm_dev_unregister(ddev);
|
2021-03-23 02:09:53 +02:00
|
|
|
drm_atomic_helper_shutdown(ddev);
|
2015-09-28 18:39:53 +03:00
|
|
|
|
|
|
|
drm_kms_helper_poll_fini(ddev);
|
2013-06-19 13:54:11 +02:00
|
|
|
}
|
|
|
|
|
2021-03-23 02:09:53 +02:00
|
|
|
static void rcar_du_shutdown(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
|
|
|
|
|
|
|
|
drm_atomic_helper_shutdown(&rcdu->ddev);
|
|
|
|
}
|
|
|
|
|
2015-09-28 18:39:53 +03:00
|
|
|
static int rcar_du_probe(struct platform_device *pdev)
|
2013-06-19 13:54:11 +02:00
|
|
|
{
|
2015-09-28 18:39:53 +03:00
|
|
|
struct rcar_du_device *rcdu;
|
2017-11-12 14:12:10 +02:00
|
|
|
unsigned int mask;
|
2015-09-28 18:39:53 +03:00
|
|
|
int ret;
|
|
|
|
|
2022-01-26 22:13:23 +02:00
|
|
|
if (drm_firmware_drivers_only())
|
|
|
|
return -ENODEV;
|
|
|
|
|
2016-10-19 00:51:35 +03:00
|
|
|
/* Allocate and initialize the R-Car device structure. */
|
2020-12-03 18:21:55 +02:00
|
|
|
rcdu = devm_drm_dev_alloc(&pdev->dev, &rcar_du_driver,
|
|
|
|
struct rcar_du_device, ddev);
|
|
|
|
if (IS_ERR(rcdu))
|
|
|
|
return PTR_ERR(rcdu);
|
2015-09-28 18:39:53 +03:00
|
|
|
|
|
|
|
rcdu->dev = &pdev->dev;
|
2023-01-23 12:47:40 +02:00
|
|
|
|
2016-10-16 10:01:47 +02:00
|
|
|
rcdu->info = of_device_get_match_data(rcdu->dev);
|
2015-09-28 18:39:53 +03:00
|
|
|
|
|
|
|
platform_set_drvdata(pdev, rcdu);
|
|
|
|
|
|
|
|
/* I/O resources */
|
2021-08-31 15:54:42 +08:00
|
|
|
rcdu->mmio = devm_platform_ioremap_resource(pdev, 0);
|
2016-10-19 00:51:35 +03:00
|
|
|
if (IS_ERR(rcdu->mmio))
|
|
|
|
return PTR_ERR(rcdu->mmio);
|
2015-09-28 18:39:53 +03:00
|
|
|
|
2017-11-12 14:12:10 +02:00
|
|
|
/*
|
|
|
|
* Set the DMA coherent mask to reflect the DU 32-bit DMA address space
|
|
|
|
* limitations. When sourcing frames from a VSP the DU doesn't perform
|
|
|
|
* any memory access so set the mask to 40 bits to accept all buffers.
|
|
|
|
*/
|
|
|
|
mask = rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE) ? 40 : 32;
|
|
|
|
ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(mask));
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2015-09-28 18:39:53 +03:00
|
|
|
/* DRM/KMS objects */
|
|
|
|
ret = rcar_du_modeset_init(rcdu);
|
|
|
|
if (ret < 0) {
|
2023-05-30 12:19:58 +03:00
|
|
|
/*
|
|
|
|
* Don't use dev_err_probe(), as it would overwrite the probe
|
|
|
|
* deferral reason recorded in rcar_du_modeset_init().
|
|
|
|
*/
|
2016-05-25 00:41:18 +00:00
|
|
|
if (ret != -EPROBE_DEFER)
|
|
|
|
dev_err(&pdev->dev,
|
|
|
|
"failed to initialize DRM/KMS (%d)\n", ret);
|
2015-09-28 18:39:53 +03:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2017-07-11 01:13:20 +03:00
|
|
|
/*
|
|
|
|
* Register the DRM device with the core and the connectors with
|
2015-09-28 18:39:53 +03:00
|
|
|
* sysfs.
|
|
|
|
*/
|
2020-12-03 18:21:55 +02:00
|
|
|
ret = drm_dev_register(&rcdu->ddev, 0);
|
2015-09-28 18:39:53 +03:00
|
|
|
if (ret)
|
|
|
|
goto error;
|
|
|
|
|
2023-05-30 12:20:52 +03:00
|
|
|
drm_info(&rcdu->ddev, "Device %s probed\n", dev_name(&pdev->dev));
|
2013-06-19 13:54:11 +02:00
|
|
|
|
2024-09-24 09:12:31 +02:00
|
|
|
drm_client_setup(&rcdu->ddev, NULL);
|
2018-11-28 22:27:11 +01:00
|
|
|
|
2013-06-19 13:54:11 +02:00
|
|
|
return 0;
|
2015-09-28 18:39:53 +03:00
|
|
|
|
|
|
|
error:
|
2020-12-03 18:21:55 +02:00
|
|
|
drm_kms_helper_poll_fini(&rcdu->ddev);
|
2015-09-28 18:39:53 +03:00
|
|
|
return ret;
|
2013-06-19 13:54:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct platform_driver rcar_du_platform_driver = {
|
|
|
|
.probe = rcar_du_probe,
|
2024-12-01 15:12:43 -08:00
|
|
|
.remove = rcar_du_remove,
|
2021-03-23 02:09:53 +02:00
|
|
|
.shutdown = rcar_du_shutdown,
|
2013-06-19 13:54:11 +02:00
|
|
|
.driver = {
|
|
|
|
.name = "rcar-du",
|
2022-11-29 19:19:33 +00:00
|
|
|
.pm = pm_sleep_ptr(&rcar_du_pm_ops),
|
2014-01-21 15:57:26 +01:00
|
|
|
.of_match_table = rcar_du_of_table,
|
2013-06-19 13:54:11 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-01-26 22:13:23 +02:00
|
|
|
module_platform_driver(rcar_du_platform_driver);
|
2013-06-19 13:54:11 +02:00
|
|
|
|
|
|
|
MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>");
|
|
|
|
MODULE_DESCRIPTION("Renesas R-Car Display Unit DRM Driver");
|
|
|
|
MODULE_LICENSE("GPL");
|