Files
android_kernel_samsung_sm86…/msm/dsi/dsi_hw.h
Michael Ru f470ecf038 disp: msm: dsi: consolidate DSI HW register macros
Cleanup DSI HW register access layer to minimize the number of macros that
access readl/writel functions.

Change-Id: Id78025b3837f9126f64681b4c1c1e13aec762081
Signed-off-by: Michael Ru <mru@codeaurora.org>
2021-06-22 11:43:48 -04:00

34 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
*/
#ifndef _DSI_HW_H_
#define _DSI_HW_H_
#include <linux/io.h>
#define DSI_GEN_R32(base, offset) readl_relaxed((base) + (offset))
#define DSI_GEN_W32(base, offset, val) writel_relaxed((val), (base) + (offset))
#define DSI_R64(dsi_hw, off) readq_relaxed((dsi_hw)->base + (off))
#define DSI_W64(dsi_hw, off, val) writeq_relaxed((val), (dsi_hw)->base + (off))
#define DSI_GEN_W32_DEBUG(base, index, offset, val) \
do {\
pr_debug("[DSI_%d][%s] - [0x%08x]\n", \
(index), #offset, (uint32_t)(val)); \
DSI_GEN_W32(base, offset, val); \
} while (0)
#define DSI_R32(dsi_hw, off) DSI_GEN_R32((dsi_hw)->base, off)
#define DSI_W32(dsi_hw, off, val) DSI_GEN_W32_DEBUG((dsi_hw)->base, \
(dsi_hw)->index, off, val)
#define PLL_CALC_DATA(addr0, addr1, data0, data1) \
(((data1) << 24) | ((((addr1)/4) & 0xFF) << 16) | \
((data0) << 8) | (((addr0)/4) & 0xFF))
#define DSI_DYN_REF_REG_W(base, offset, addr0, addr1, data0, data1) \
DSI_GEN_W32(base, offset, PLL_CALC_DATA(addr0, addr1, data0, data1))
#endif /* _DSI_HW_H_ */