diff options
| -rw-r--r-- | drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index 796b28c14a92..7ddf5d9aade7 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c | |||
| @@ -158,7 +158,6 @@ | |||
| 158 | #define LPRX_TO_CNT(p) ((p) & 0xffff) | 158 | #define LPRX_TO_CNT(p) ((p) & 0xffff) |
| 159 | 159 | ||
| 160 | #define DSI_BTA_TO_CNT 0x8c | 160 | #define DSI_BTA_TO_CNT 0x8c |
| 161 | |||
| 162 | #define DSI_LPCLK_CTRL 0x94 | 161 | #define DSI_LPCLK_CTRL 0x94 |
| 163 | #define AUTO_CLKLANE_CTRL BIT(1) | 162 | #define AUTO_CLKLANE_CTRL BIT(1) |
| 164 | #define PHY_TXREQUESTCLKHS BIT(0) | 163 | #define PHY_TXREQUESTCLKHS BIT(0) |
| @@ -224,11 +223,11 @@ | |||
| 224 | 223 | ||
| 225 | #define HSFREQRANGE_SEL(val) (((val) & 0x3f) << 1) | 224 | #define HSFREQRANGE_SEL(val) (((val) & 0x3f) << 1) |
| 226 | 225 | ||
| 227 | #define INPUT_DIVIDER(val) ((val - 1) & 0x7f) | 226 | #define INPUT_DIVIDER(val) (((val) - 1) & 0x7f) |
| 228 | #define LOW_PROGRAM_EN 0 | 227 | #define LOW_PROGRAM_EN 0 |
| 229 | #define HIGH_PROGRAM_EN BIT(7) | 228 | #define HIGH_PROGRAM_EN BIT(7) |
| 230 | #define LOOP_DIV_LOW_SEL(val) ((val - 1) & 0x1f) | 229 | #define LOOP_DIV_LOW_SEL(val) (((val) - 1) & 0x1f) |
| 231 | #define LOOP_DIV_HIGH_SEL(val) (((val - 1) >> 5) & 0x1f) | 230 | #define LOOP_DIV_HIGH_SEL(val) ((((val) - 1) >> 5) & 0x1f) |
| 232 | #define PLL_LOOP_DIV_EN BIT(5) | 231 | #define PLL_LOOP_DIV_EN BIT(5) |
| 233 | #define PLL_INPUT_DIV_EN BIT(4) | 232 | #define PLL_INPUT_DIV_EN BIT(4) |
| 234 | 233 | ||
| @@ -370,6 +369,7 @@ static inline struct dw_mipi_dsi *encoder_to_dsi(struct drm_encoder *encoder) | |||
| 370 | { | 369 | { |
| 371 | return container_of(encoder, struct dw_mipi_dsi, encoder); | 370 | return container_of(encoder, struct dw_mipi_dsi, encoder); |
| 372 | } | 371 | } |
| 372 | |||
| 373 | static inline void dsi_write(struct dw_mipi_dsi *dsi, u32 reg, u32 val) | 373 | static inline void dsi_write(struct dw_mipi_dsi *dsi, u32 reg, u32 val) |
| 374 | { | 374 | { |
| 375 | writel(val, dsi->base + reg); | 375 | writel(val, dsi->base + reg); |
| @@ -381,7 +381,7 @@ static inline u32 dsi_read(struct dw_mipi_dsi *dsi, u32 reg) | |||
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | static void dw_mipi_dsi_phy_write(struct dw_mipi_dsi *dsi, u8 test_code, | 383 | static void dw_mipi_dsi_phy_write(struct dw_mipi_dsi *dsi, u8 test_code, |
| 384 | u8 test_data) | 384 | u8 test_data) |
| 385 | { | 385 | { |
| 386 | /* | 386 | /* |
| 387 | * With the falling edge on TESTCLK, the TESTDIN[7:0] signal content | 387 | * With the falling edge on TESTCLK, the TESTDIN[7:0] signal content |
| @@ -493,7 +493,6 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi) | |||
| 493 | dsi_write(dsi, DSI_PHY_RSTZ, PHY_ENFORCEPLL | PHY_ENABLECLK | | 493 | dsi_write(dsi, DSI_PHY_RSTZ, PHY_ENFORCEPLL | PHY_ENABLECLK | |
| 494 | PHY_UNRSTZ | PHY_UNSHUTDOWNZ); | 494 | PHY_UNRSTZ | PHY_UNSHUTDOWNZ); |
| 495 | 495 | ||
| 496 | |||
| 497 | ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS, | 496 | ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS, |
| 498 | val, val & LOCK, 1000, PHY_STATUS_TIMEOUT_US); | 497 | val, val & LOCK, 1000, PHY_STATUS_TIMEOUT_US); |
| 499 | if (ret < 0) { | 498 | if (ret < 0) { |
| @@ -579,7 +578,7 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, | |||
| 579 | 578 | ||
| 580 | if (device->lanes > dsi->pdata->max_data_lanes) { | 579 | if (device->lanes > dsi->pdata->max_data_lanes) { |
| 581 | dev_err(dsi->dev, "the number of data lanes(%u) is too many\n", | 580 | dev_err(dsi->dev, "the number of data lanes(%u) is too many\n", |
| 582 | device->lanes); | 581 | device->lanes); |
| 583 | return -EINVAL; | 582 | return -EINVAL; |
| 584 | } | 583 | } |
| 585 | 584 | ||
| @@ -1024,14 +1023,14 @@ dw_mipi_dsi_encoder_atomic_check(struct drm_encoder *encoder, | |||
| 1024 | return 0; | 1023 | return 0; |
| 1025 | } | 1024 | } |
| 1026 | 1025 | ||
| 1027 | static struct drm_encoder_helper_funcs | 1026 | static const struct drm_encoder_helper_funcs |
| 1028 | dw_mipi_dsi_encoder_helper_funcs = { | 1027 | dw_mipi_dsi_encoder_helper_funcs = { |
| 1029 | .enable = dw_mipi_dsi_encoder_enable, | 1028 | .enable = dw_mipi_dsi_encoder_enable, |
| 1030 | .disable = dw_mipi_dsi_encoder_disable, | 1029 | .disable = dw_mipi_dsi_encoder_disable, |
| 1031 | .atomic_check = dw_mipi_dsi_encoder_atomic_check, | 1030 | .atomic_check = dw_mipi_dsi_encoder_atomic_check, |
| 1032 | }; | 1031 | }; |
| 1033 | 1032 | ||
| 1034 | static struct drm_encoder_funcs dw_mipi_dsi_encoder_funcs = { | 1033 | static const struct drm_encoder_funcs dw_mipi_dsi_encoder_funcs = { |
| 1035 | .destroy = drm_encoder_cleanup, | 1034 | .destroy = drm_encoder_cleanup, |
| 1036 | }; | 1035 | }; |
| 1037 | 1036 | ||
| @@ -1067,7 +1066,7 @@ static void dw_mipi_dsi_drm_connector_destroy(struct drm_connector *connector) | |||
| 1067 | drm_connector_cleanup(connector); | 1066 | drm_connector_cleanup(connector); |
| 1068 | } | 1067 | } |
| 1069 | 1068 | ||
| 1070 | static struct drm_connector_funcs dw_mipi_dsi_atomic_connector_funcs = { | 1069 | static const struct drm_connector_funcs dw_mipi_dsi_atomic_connector_funcs = { |
| 1071 | .dpms = drm_atomic_helper_connector_dpms, | 1070 | .dpms = drm_atomic_helper_connector_dpms, |
| 1072 | .fill_modes = drm_helper_probe_single_connector_modes, | 1071 | .fill_modes = drm_helper_probe_single_connector_modes, |
| 1073 | .destroy = dw_mipi_dsi_drm_connector_destroy, | 1072 | .destroy = dw_mipi_dsi_drm_connector_destroy, |
| @@ -1077,7 +1076,7 @@ static struct drm_connector_funcs dw_mipi_dsi_atomic_connector_funcs = { | |||
| 1077 | }; | 1076 | }; |
| 1078 | 1077 | ||
| 1079 | static int dw_mipi_dsi_register(struct drm_device *drm, | 1078 | static int dw_mipi_dsi_register(struct drm_device *drm, |
| 1080 | struct dw_mipi_dsi *dsi) | 1079 | struct dw_mipi_dsi *dsi) |
| 1081 | { | 1080 | { |
| 1082 | struct drm_encoder *encoder = &dsi->encoder; | 1081 | struct drm_encoder *encoder = &dsi->encoder; |
| 1083 | struct drm_connector *connector = &dsi->connector; | 1082 | struct drm_connector *connector = &dsi->connector; |
| @@ -1098,14 +1097,14 @@ static int dw_mipi_dsi_register(struct drm_device *drm, | |||
| 1098 | drm_encoder_helper_add(&dsi->encoder, | 1097 | drm_encoder_helper_add(&dsi->encoder, |
| 1099 | &dw_mipi_dsi_encoder_helper_funcs); | 1098 | &dw_mipi_dsi_encoder_helper_funcs); |
| 1100 | ret = drm_encoder_init(drm, &dsi->encoder, &dw_mipi_dsi_encoder_funcs, | 1099 | ret = drm_encoder_init(drm, &dsi->encoder, &dw_mipi_dsi_encoder_funcs, |
| 1101 | DRM_MODE_ENCODER_DSI, NULL); | 1100 | DRM_MODE_ENCODER_DSI, NULL); |
| 1102 | if (ret) { | 1101 | if (ret) { |
| 1103 | dev_err(dev, "Failed to initialize encoder with drm\n"); | 1102 | dev_err(dev, "Failed to initialize encoder with drm\n"); |
| 1104 | return ret; | 1103 | return ret; |
| 1105 | } | 1104 | } |
| 1106 | 1105 | ||
| 1107 | drm_connector_helper_add(connector, | 1106 | drm_connector_helper_add(connector, |
| 1108 | &dw_mipi_dsi_connector_helper_funcs); | 1107 | &dw_mipi_dsi_connector_helper_funcs); |
| 1109 | 1108 | ||
| 1110 | drm_connector_init(drm, &dsi->connector, | 1109 | drm_connector_init(drm, &dsi->connector, |
| 1111 | &dw_mipi_dsi_atomic_connector_funcs, | 1110 | &dw_mipi_dsi_atomic_connector_funcs, |
| @@ -1180,7 +1179,7 @@ static const struct of_device_id dw_mipi_dsi_dt_ids[] = { | |||
| 1180 | MODULE_DEVICE_TABLE(of, dw_mipi_dsi_dt_ids); | 1179 | MODULE_DEVICE_TABLE(of, dw_mipi_dsi_dt_ids); |
| 1181 | 1180 | ||
| 1182 | static int dw_mipi_dsi_bind(struct device *dev, struct device *master, | 1181 | static int dw_mipi_dsi_bind(struct device *dev, struct device *master, |
| 1183 | void *data) | 1182 | void *data) |
| 1184 | { | 1183 | { |
| 1185 | const struct of_device_id *of_id = | 1184 | const struct of_device_id *of_id = |
| 1186 | of_match_device(dw_mipi_dsi_dt_ids, dev); | 1185 | of_match_device(dw_mipi_dsi_dt_ids, dev); |
| @@ -1304,7 +1303,7 @@ err_pllref: | |||
| 1304 | } | 1303 | } |
| 1305 | 1304 | ||
| 1306 | static void dw_mipi_dsi_unbind(struct device *dev, struct device *master, | 1305 | static void dw_mipi_dsi_unbind(struct device *dev, struct device *master, |
| 1307 | void *data) | 1306 | void *data) |
| 1308 | { | 1307 | { |
| 1309 | struct dw_mipi_dsi *dsi = dev_get_drvdata(dev); | 1308 | struct dw_mipi_dsi *dsi = dev_get_drvdata(dev); |
| 1310 | 1309 | ||
