1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved
4  *
5  * Helper methods for MSM-specific DSC calculations that are common between timing engine,
6  * DSI, and DP.
7  */
8 
9 #ifndef MSM_DSC_HELPER_H_
10 #define MSM_DSC_HELPER_H_
11 
12 #include <linux/math.h>
13 #include <drm/display/drm_dsc_helper.h>
14 
15 /**
16  * msm_dsc_get_bytes_per_line() - calculate bytes per line
17  * @dsc: Pointer to drm dsc config struct
18  * Returns: Integer value representing bytes per line. DSI and DP need
19  *          to perform further calculations to turn this into pclk_per_intf,
20  *          such as dividing by different values depending on if widebus is enabled.
21  */
msm_dsc_get_bytes_per_line(const struct drm_dsc_config * dsc)22 static inline u32 msm_dsc_get_bytes_per_line(const struct drm_dsc_config *dsc)
23 {
24 	return dsc->slice_count * dsc->slice_chunk_size;
25 }
26 
27 #endif /* MSM_DSC_HELPER_H_ */
28