forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
....@@ -1,20 +1,18 @@
1
+// SPDX-License-Identifier: GPL-2.0+
12 /*
23 * R-Car Gen3 HDMI PHY
34 *
45 * Copyright (C) 2016 Renesas Electronics Corporation
56 *
67 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
128 */
139
10
+#include <linux/mod_devicetable.h>
1411 #include <linux/module.h>
1512 #include <linux/platform_device.h>
1613
1714 #include <drm/bridge/dw_hdmi.h>
15
+#include <drm/drm_modes.h>
1816
1917 #define RCAR_HDMI_PHY_OPMODE_PLLCFG 0x06 /* Mode of operation and PLL dividers */
2018 #define RCAR_HDMI_PHY_PLLCURRGMPCTRL 0x10 /* PLL current and Gmp (conductance) */
....@@ -39,8 +37,22 @@
3937 { ~0UL, 0x0000, 0x0000, 0x0000 },
4038 };
4139
42
-static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi,
43
- const struct dw_hdmi_plat_data *pdata,
40
+static enum drm_mode_status
41
+rcar_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data,
42
+ const struct drm_display_info *info,
43
+ const struct drm_display_mode *mode)
44
+{
45
+ /*
46
+ * The maximum supported clock frequency is 297 MHz, as shown in the PHY
47
+ * parameters table.
48
+ */
49
+ if (mode->clock > 297000)
50
+ return MODE_CLOCK_HIGH;
51
+
52
+ return MODE_OK;
53
+}
54
+
55
+static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi, void *data,
4456 unsigned long mpixelclock)
4557 {
4658 const struct rcar_hdmi_phy_params *params = rcar_hdmi_phy_params;
....@@ -63,6 +75,7 @@
6375 }
6476
6577 static const struct dw_hdmi_plat_data rcar_dw_hdmi_plat_data = {
78
+ .mode_valid = rcar_hdmi_mode_valid,
6679 .configure_phy = rcar_hdmi_phy_configure,
6780 };
6881