diff mbox series

[19/49] staging: hikey9xx/gpu: add a copy of set_reg() function there

Message ID a92be25fef54fc7f339417861e2bd8ead90ac5cb.1597833138.git.mchehab+huawei@kernel.org (mailing list archive)
State New, archived
Headers show
Series DRM driver for Hikey 970 | expand

Commit Message

Mauro Carvalho Chehab Aug. 19, 2020, 11:45 a.m. UTC
This function has a too generic name to export it as a
symbol. Also, we should likely use some other macro instead.

So, for now, just copy it into the Kirin9xx dsi module, in order
for the driver to build.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 .../staging/hikey9xx/gpu/kirin9xx_dw_drm_dsi.c  | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/staging/hikey9xx/gpu/kirin9xx_dw_drm_dsi.c b/drivers/staging/hikey9xx/gpu/kirin9xx_dw_drm_dsi.c
index cfb6bfd1c338..cba81ee2639d 100644
--- a/drivers/staging/hikey9xx/gpu/kirin9xx_dw_drm_dsi.c
+++ b/drivers/staging/hikey9xx/gpu/kirin9xx_dw_drm_dsi.c
@@ -37,7 +37,6 @@ 
 #else
 #include "kirin960_dpe_reg.h"
 #endif
-#include "kirin9xx_drm_dpe_utils.h"
 #include "kirin9xx_drm_drv.h"
 
 #if defined (CONFIG_DRM_HISI_KIRIN970)
@@ -270,6 +269,22 @@  static const struct dsi_phy_range dphy_range_info[] = {
 	{ 1000000,  1500000,   0,    0 }
 };
 
+/*
+ * Except for debug, this is identical to the one defined at
+ * kirin9xx_drm_dpe_utils.h.
+ */
+static void set_reg(char __iomem *addr, uint32_t val, uint8_t bw,
+		    uint8_t bs)
+{
+	u32 mask = (1UL << bw) - 1UL;
+	u32 tmp = 0;
+
+	tmp = inp32(addr);
+	tmp &= ~(mask << bs);
+
+	outp32(addr, tmp | ((val & mask) << bs));
+}
+
 void dsi_set_output_client(struct drm_device *dev)
 {
 	struct drm_connector_list_iter conn_iter;