num_modes += drm_panel_get_modes(dp->plat_data->panel);
if (dp->plat_data->get_modes)
- num_modes += dp->plat_data->get_modes(dp->plat_data);
+ num_modes += dp->plat_data->get_modes(dp->plat_data, connector);
return num_modes;
}
-static enum drm_mode_status
-analogix_dp_mode_valid(struct drm_connector *connector,
- struct drm_display_mode *mode)
-{
- struct analogix_dp_device *dp = to_dp(connector);
- enum drm_mode_status status = MODE_OK;
-
- if (dp->plat_data->mode_valid)
- status = dp->plat_data->mode_valid(dp->plat_data, connector,
- mode);
-
- return status;
-}
-
static struct drm_encoder *
analogix_dp_best_encoder(struct drm_connector *connector)
{
static const struct drm_connector_helper_funcs analogix_dp_connector_helper_funcs = {
.get_modes = analogix_dp_get_modes,
.best_encoder = analogix_dp_best_encoder,
- .mode_valid = analogix_dp_mode_valid,
};
enum drm_connector_status
switch (dp->plat_data->dev_type) {
case ROCKCHIP_DP:
/*
- * Like ROCKCHIP DisplayPort TRM indicate that "Main link
+ * Like Rockchip DisplayPort TRM indicate that "Main link
* containing 4 physical lanes of 2.7/1.62 Gbps/lane".
*/
video_info->max_link_rate = 0x0A;
#define to_dp(nm) container_of(nm, struct rockchip_dp_device, nm)
-enum rockchip_dp_chip_type {
- RK3288_DP,
- RK3399_EDP,
-};
-
+/**
+ * struct rockchip_dp_chip_data - splite the grf setting of kind of chips
+ * @lcdsel_grf_reg: grf register offset of lcdc select
+ * @lcdsel_big: reg value of selecting vop big for eDP
+ * @lcdsel_lit: reg value of selecting vop little for eDP
+ */
struct rockchip_dp_chip_data {
u32 lcdsel_grf_reg;
u32 lcdsel_big;
u32 lcdsel_lit;
- u32 lcdsel_mask;
u32 chip_type;
};
return 0;
}
-static enum drm_mode_status
-rockchip_dp_mode_valid(struct analogix_dp_plat_data *plat_data,
- struct drm_connector *connector,
- struct drm_display_mode *mode)
+static int rockchip_dp_get_modes(struct analogix_dp_plat_data *plat_data,
+ struct drm_connector *connector)
{
struct drm_display_info *di = &connector->display_info;
di->bpc = 8;
}
- return MODE_OK;
+ return 0;
}
static bool
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
+ /* do nothing */
return true;
}
return;
if (ret)
- val = dp->data->lcdsel_lit | dp->data->lcdsel_mask;
+ val = dp->data->lcdsel_lit;
else
- val = dp->data->lcdsel_big | dp->data->lcdsel_mask;
+ val = dp->data->lcdsel_big;
dev_dbg(dp->dev, "vop %s output to dp\n", (ret) ? "LIT" : "BIG");
static int
rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder,
- struct drm_crtc_state *crtc_state,
- struct drm_connector_state *conn_state)
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
{
- struct rockchip_dp_device *dp = to_dp(encoder);
struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
+ struct rockchip_dp_device *dp = to_dp(encoder);
int ret;
/*
s->output_mode = ROCKCHIP_OUT_MODE_AAAA;
break;
}
+
s->output_type = DRM_MODE_CONNECTOR_eDP;
return 0;
dp->plat_data.encoder = &dp->encoder;
dp->plat_data.dev_type = ROCKCHIP_DP;
+ dp->plat_data.subdev_type = dp_data->chip_type;
dp->plat_data.power_on = rockchip_dp_poweron;
dp->plat_data.power_off = rockchip_dp_powerdown;
- dp->plat_data.mode_valid = rockchip_dp_mode_valid;
+ dp->plat_data.get_modes = rockchip_dp_get_modes;
return analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data);
}
return 0;
}
+static const struct dev_pm_ops rockchip_dp_pm_ops = {
#ifdef CONFIG_PM_SLEEP
-static int rockchip_dp_suspend(struct device *dev)
-{
- return analogix_dp_suspend(dev);
-}
-
-static int rockchip_dp_resume(struct device *dev)
-{
- return analogix_dp_resume(dev);
-}
+ .suspend = analogix_dp_suspend,
+ .resume_early = analogix_dp_resume,
#endif
-
-static const struct dev_pm_ops rockchip_dp_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(rockchip_dp_suspend, rockchip_dp_resume)
};
static const struct rockchip_dp_chip_data rk3399_edp = {
.lcdsel_grf_reg = 0x6250,
- .lcdsel_big = 0,
- .lcdsel_lit = BIT(5),
- .lcdsel_mask = BIT(21),
+ .lcdsel_big = 0 | BIT(21),
+ .lcdsel_lit = BIT(5) | BIT(21),
.chip_type = RK3399_EDP,
};
static const struct rockchip_dp_chip_data rk3288_dp = {
.lcdsel_grf_reg = 0x025c,
- .lcdsel_big = 0,
- .lcdsel_lit = BIT(5),
- .lcdsel_mask = BIT(21),
+ .lcdsel_big = 0 | BIT(21),
+ .lcdsel_lit = BIT(5) | BIT(21),
.chip_type = RK3288_DP,
};
ROCKCHIP_DP,
};
+enum analogix_dp_sub_devtype {
+ RK3288_DP,
+ RK3399_EDP,
+};
+
struct analogix_dp_plat_data {
enum analogix_dp_devtype dev_type;
+ enum analogix_dp_sub_devtype subdev_type;
struct drm_panel *panel;
struct drm_encoder *encoder;
struct drm_connector *connector;
int (*power_off)(struct analogix_dp_plat_data *);
int (*attach)(struct analogix_dp_plat_data *, struct drm_bridge *,
struct drm_connector *);
- int (*get_modes)(struct analogix_dp_plat_data *);
-
- enum drm_mode_status (*mode_valid)(struct analogix_dp_plat_data *,
- struct drm_connector *,
- struct drm_display_mode *);
+ int (*get_modes)(struct analogix_dp_plat_data *,
+ struct drm_connector *);
};
int analogix_dp_resume(struct device *dev);