hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/mfd/rkx110_x120/rkx120_dsi_tx.c
....@@ -751,10 +751,9 @@
751751 return msg->tx_len;
752752 }
753753
754
-static int rkx120_mipi_dsi_generic_write(struct rk_serdes *des, u8 remote_id,
755
- const void *payload, size_t size)
754
+static int rkx120_mipi_dsi_generic_write(struct rk_serdes *des, struct rkx120_dsi_tx *dsi,
755
+ u8 remote_id, const void *payload, size_t size)
756756 {
757
- const struct rkx120_dsi_tx *dsi = &des->dsi_tx;
758757 struct mipi_dsi_msg msg;
759758
760759 memset(&msg, 0, sizeof(msg));
....@@ -785,10 +784,9 @@
785784 return rkx120_dsi_tx_transfer(des, remote_id, dsi, &msg);
786785 }
787786
788
-static int rkx120_mipi_dsi_dcs_write_buffer(struct rk_serdes *des, u8 remote_id,
789
- const void *data, size_t len)
787
+static int rkx120_mipi_dsi_dcs_write_buffer(struct rk_serdes *des, struct rkx120_dsi_tx *dsi,
788
+ u8 remote_id, const void *data, size_t len)
790789 {
791
- const struct rkx120_dsi_tx *dsi = &des->dsi_tx;
792790 struct mipi_dsi_msg msg;
793791
794792 memset(&msg, 0, sizeof(msg));
....@@ -818,10 +816,9 @@
818816 }
819817
820818 static __maybe_unused int
821
-rkx120_mipi_dsi_dcs_read(struct rk_serdes *des, u8 remote_id,
819
+rkx120_mipi_dsi_dcs_read(struct rk_serdes *des, struct rkx120_dsi_tx *dsi, u8 remote_id,
822820 u8 cmd, void *data, size_t len)
823821 {
824
- const struct rkx120_dsi_tx *dsi = &des->dsi_tx;
825822 struct mipi_dsi_msg msg;
826823
827824 memset(&msg, 0, sizeof(msg));
....@@ -835,7 +832,7 @@
835832 return rkx120_dsi_tx_transfer(des, remote_id, dsi, &msg);
836833 }
837834
838
-int rkx120_dsi_tx_cmd_seq_xfer(struct rk_serdes *des, u8 remote_id,
835
+int rkx120_dsi_tx_cmd_seq_xfer(struct rk_serdes *des, struct rkx120_dsi_tx *dsi, u8 remote_id,
839836 struct panel_cmds *cmds)
840837 {
841838 u16 i;
....@@ -852,13 +849,13 @@
852849 case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
853850 case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
854851 case MIPI_DSI_GENERIC_LONG_WRITE:
855
- err = rkx120_mipi_dsi_generic_write(des, remote_id, cmd->payload,
852
+ err = rkx120_mipi_dsi_generic_write(des, dsi, remote_id, cmd->payload,
856853 cmd->dchdr.dlen);
857854 break;
858855 case MIPI_DSI_DCS_SHORT_WRITE:
859856 case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
860857 case MIPI_DSI_DCS_LONG_WRITE:
861
- err = rkx120_mipi_dsi_dcs_write_buffer(des, remote_id, cmd->payload,
858
+ err = rkx120_mipi_dsi_dcs_write_buffer(des, dsi, remote_id, cmd->payload,
862859 cmd->dchdr.dlen);
863860 break;
864861 default:
....@@ -901,7 +898,8 @@
901898 }
902899
903900 static void
904
-mipi_dphy_power_on(struct rk_serdes *des, const struct rkx120_dsi_tx *dsi, u8 remote_id)
901
+mipi_dphy_power_on(struct rk_serdes *des, const struct rkx120_dsi_tx *dsi,
902
+ u8 remote_id)
905903 {
906904 struct i2c_client *client = des->chip[remote_id].client;
907905 u32 val, mask;
....@@ -920,7 +918,7 @@
920918 dsi_update_bits(des, remote_id, DSI_PHY_RSTZ, PHY_RSTZ, PHY_RSTZ);
921919 usleep_range(1500, 2000);
922920
923
- rkx120_combtxphy_power_on(des, remote_id, 0);
921
+ rkx120_combtxphy_power_on(des, dsi->combtxphy, remote_id, 0);
924922
925923 ret = read_poll_timeout(des->i2c_read_reg, ret,
926924 !(ret < 0) && (val & PHY_LOCK),
....@@ -954,9 +952,9 @@
954952 //dsi_i2c_write(des, remote_id, CRU_SOFTRST_CON02, 0x400000);
955953 }
956954
957
-static void rkx120_dsi_tx_bridge_pre_enable(struct rk_serdes *des, u8 remote_id)
955
+static void rkx120_dsi_tx_bridge_pre_enable(struct rk_serdes *des, struct rkx120_dsi_tx *dsi,
956
+ u8 remote_id)
958957 {
959
- struct rkx120_dsi_tx *dsi = &des->dsi_tx;
960958 u32 val;
961959
962960 dsi_write(des, remote_id, DSI_PWR_UP, RESET);
....@@ -1064,9 +1062,8 @@
10641062 }
10651063
10661064 static void
1067
-rkx120_dsi_tx_bridge_enable(struct rk_serdes *des, u8 remote_id)
1065
+rkx120_dsi_tx_bridge_enable(struct rk_serdes *des, struct rkx120_dsi_tx *dsi, u8 remote_id)
10681066 {
1069
- struct rkx120_dsi_tx *dsi = &des->dsi_tx;
10701067 const struct videomode *vm = dsi->vm;
10711068 u32 val;
10721069
....@@ -1117,15 +1114,16 @@
11171114 struct rk_serdes_route *route,
11181115 u8 remote_id)
11191116 {
1120
- struct rkx120_dsi_tx *dsi = &des->dsi_tx;
1117
+ struct rk_serdes_panel *sd_panel = container_of(route, struct rk_serdes_panel, route);
1118
+ struct rkx120_dsi_tx *dsi = &sd_panel->dsi_tx;
11211119 u64 rate;
11221120
11231121 dsi->vm = &route->vm;
11241122 rate = rkx120_dsi_tx_get_lane_rate(dsi);
11251123
1126
- rkx120_combtxphy_set_mode(des, COMBTX_PHY_MODE_VIDEO_MIPI);
1127
- rkx120_combtxphy_set_rate(des, rate);
1128
- lane_kbps = rkx120_combtxphy_get_rate(des) / MSEC_PER_SEC;
1124
+ rkx120_combtxphy_set_mode(dsi->combtxphy, COMBTX_PHY_MODE_VIDEO_MIPI);
1125
+ rkx120_combtxphy_set_rate(dsi->combtxphy, rate);
1126
+ lane_kbps = rkx120_combtxphy_get_rate(dsi->combtxphy) / MSEC_PER_SEC;
11291127
11301128 /* rst for dsi */
11311129 rkx120_dsi_tx_reset_control_assert(des, remote_id);
....@@ -1133,12 +1131,11 @@
11331131 rkx120_dsi_tx_reset_control_deassert(des, remote_id);
11341132 usleep_range(20, 40);
11351133
1136
- rkx120_dsi_tx_bridge_pre_enable(des, remote_id);
1137
-
1134
+ rkx120_dsi_tx_bridge_pre_enable(des, dsi, remote_id);
11381135 #ifdef DSI_READ_POWER_MODE
11391136 u8 mode;
11401137
1141
- rkx120_mipi_dsi_dcs_read(des, remote_id, MIPI_DCS_GET_POWER_MODE,
1138
+ rkx120_mipi_dsi_dcs_read(des, dsi, remote_id, MIPI_DCS_GET_POWER_MODE,
11421139 &mode, sizeof(mode));
11431140
11441141 dev_info(rkx120->dev, "dsi: mode: 0x%x\n", mode);
....@@ -1149,17 +1146,18 @@
11491146 struct rk_serdes_route *route,
11501147 u8 remote_id)
11511148 {
1152
- struct rkx120_dsi_tx *dsi = &des->dsi_tx;
1149
+ struct rk_serdes_panel *sd_panel = container_of(route, struct rk_serdes_panel, route);
1150
+ struct rkx120_dsi_tx *dsi = &sd_panel->dsi_tx;
11531151
11541152 #ifdef DSI_READ_POWER_MODE
11551153 u8 mode;
11561154
1157
- rkx120_mipi_dsi_dcs_read(des, remote_id, MIPI_DCS_GET_POWER_MODE,
1155
+ rkx120_mipi_dsi_dcs_read(des, dsi, remote_id, MIPI_DCS_GET_POWER_MODE,
11581156 &mode, sizeof(mode));
11591157
11601158 dev_info(rkx120->dev, "dsi: mode: 0x%x\n", mode);
11611159 #endif
1162
- rkx120_dsi_tx_bridge_enable(des, remote_id);
1160
+ rkx120_dsi_tx_bridge_enable(des, dsi, remote_id);
11631161
11641162 dev_info(des->dev, "rkx120_dsi_tx final DSI-Link bandwidth: %llu Kbps x %d lanes\n",
11651163 lane_kbps, dsi->lanes);
....@@ -1169,7 +1167,10 @@
11691167 struct rk_serdes_route *route,
11701168 u8 remote_id)
11711169 {
1172
- rkx120_combtxphy_power_off(des, remote_id);
1170
+ struct rk_serdes_panel *sd_panel = container_of(route, struct rk_serdes_panel, route);
1171
+ struct rkx120_dsi_tx *dsi = &sd_panel->dsi_tx;
1172
+
1173
+ rkx120_combtxphy_power_off(des, dsi->combtxphy, remote_id, 0);
11731174 }
11741175
11751176 void rkx120_dsi_tx_disable(struct rk_serdes *des, struct rk_serdes_route *route, u8 remote_id)