hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
....@@ -1,29 +1,27 @@
1
-// SPDX-License-Identifier: GPL-2.0
1
+/* SPDX-License-Identifier: GPL-2.0-only */
22 /*
3
- * Copyright(c) 2017 Icenowy Zheng <icenowy@aosc.io>
3
+ * Copyright(c) 2016, Analogix Semiconductor.
44 *
5
- * Based on analogix-anx78xx.c, which is:
6
- * Copyright(c) 2016, Analogix Semiconductor. All rights reserved.
5
+ * Based on anx7808 driver obtained from chromeos with copyright:
6
+ * Copyright(c) 2013, Google Inc.
77 */
8
-
9
-#include <linux/module.h>
108 #include <linux/regmap.h>
119
1210 #include <drm/drm.h>
13
-#include <drm/drmP.h>
1411 #include <drm/drm_dp_helper.h>
12
+#include <drm/drm_print.h>
1513
1614 #include "analogix-i2c-dptx.h"
1715
1816 #define AUX_WAIT_TIMEOUT_MS 15
1917 #define AUX_CH_BUFFER_SIZE 16
2018
21
-static int anx_clear_bits(struct regmap *map, u8 reg, u8 mask)
19
+static int anx_i2c_dp_clear_bits(struct regmap *map, u8 reg, u8 mask)
2220 {
2321 return regmap_update_bits(map, reg, mask, 0);
2422 }
2523
26
-static bool anx_aux_op_finished(struct regmap *map_dptx)
24
+static bool anx_dp_aux_op_finished(struct regmap *map_dptx)
2725 {
2826 unsigned int value;
2927 int err;
....@@ -35,7 +33,7 @@
3533 return (value & SP_AUX_EN) == 0;
3634 }
3735
38
-static int anx_aux_wait(struct regmap *map_dptx)
36
+static int anx_dp_aux_wait(struct regmap *map_dptx)
3937 {
4038 unsigned long timeout;
4139 unsigned int status;
....@@ -43,9 +41,9 @@
4341
4442 timeout = jiffies + msecs_to_jiffies(AUX_WAIT_TIMEOUT_MS) + 1;
4543
46
- while (!anx_aux_op_finished(map_dptx)) {
44
+ while (!anx_dp_aux_op_finished(map_dptx)) {
4745 if (time_after(jiffies, timeout)) {
48
- if (!anx_aux_op_finished(map_dptx)) {
46
+ if (!anx_dp_aux_op_finished(map_dptx)) {
4947 DRM_ERROR("Timed out waiting AUX to finish\n");
5048 return -ETIMEDOUT;
5149 }
....@@ -72,7 +70,7 @@
7270 return 0;
7371 }
7472
75
-static int anx_aux_address(struct regmap *map_dptx, unsigned int addr)
73
+static int anx_dp_aux_address(struct regmap *map_dptx, unsigned int addr)
7674 {
7775 int err;
7876
....@@ -100,7 +98,8 @@
10098 return 0;
10199 }
102100
103
-ssize_t anx_aux_transfer(struct regmap *map_dptx, struct drm_dp_aux_msg *msg)
101
+ssize_t anx_dp_aux_transfer(struct regmap *map_dptx,
102
+ struct drm_dp_aux_msg *msg)
104103 {
105104 u8 ctrl1 = msg->request;
106105 u8 ctrl2 = SP_AUX_EN;
....@@ -127,7 +126,7 @@
127126 }
128127
129128 /* Write address and request */
130
- err = anx_aux_address(map_dptx, msg->address);
129
+ err = anx_dp_aux_address(map_dptx, msg->address);
131130 if (err)
132131 return err;
133132
....@@ -141,7 +140,7 @@
141140 if (err)
142141 return err;
143142
144
- err = anx_aux_wait(map_dptx);
143
+ err = anx_dp_aux_wait(map_dptx);
145144 if (err)
146145 return err;
147146
....@@ -156,14 +155,11 @@
156155 return err;
157156 }
158157
159
- err = anx_clear_bits(map_dptx, SP_DP_AUX_CH_CTRL2_REG, SP_ADDR_ONLY);
158
+ err = anx_i2c_dp_clear_bits(map_dptx, SP_DP_AUX_CH_CTRL2_REG,
159
+ SP_ADDR_ONLY);
160160 if (err)
161161 return err;
162162
163163 return msg->size;
164164 }
165
-EXPORT_SYMBOL(anx_aux_transfer);
166
-
167
-MODULE_DESCRIPTION("Analogix DisplayPort Transmitter common code");
168
-MODULE_AUTHOR("Icenowy Zheng <icenowy@aosc.io>");
169
-MODULE_LICENSE("GPL v2");
165
+EXPORT_SYMBOL_GPL(anx_dp_aux_transfer);