disp: msm: specify default value for msm enum property
Allow caller to specify the default value of the enum property while installing with msm prop layer. It is not always the case that the default value to be the first entry. Change-Id: Ie0bb1ad7479e3e07810b3d817fdf618b1935858c Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "msm_prop.h"
|
#include "msm_prop.h"
|
||||||
@@ -203,7 +203,7 @@ void msm_property_install_volatile_range(struct msm_property_info *info,
|
|||||||
void msm_property_install_enum(struct msm_property_info *info,
|
void msm_property_install_enum(struct msm_property_info *info,
|
||||||
const char *name, int flags, int is_bitmask,
|
const char *name, int flags, int is_bitmask,
|
||||||
const struct drm_prop_enum_list *values, int num_values,
|
const struct drm_prop_enum_list *values, int num_values,
|
||||||
uint32_t property_idx)
|
u32 init_idx, uint32_t property_idx)
|
||||||
{
|
{
|
||||||
struct drm_property **prop;
|
struct drm_property **prop;
|
||||||
|
|
||||||
@@ -239,10 +239,10 @@ void msm_property_install_enum(struct msm_property_info *info,
|
|||||||
info->property_data[property_idx].default_value = 0;
|
info->property_data[property_idx].default_value = 0;
|
||||||
info->property_data[property_idx].force_dirty = false;
|
info->property_data[property_idx].force_dirty = false;
|
||||||
|
|
||||||
/* select first defined value for enums */
|
/* initialize with the given idx if valid */
|
||||||
if (!is_bitmask)
|
if (!is_bitmask && init_idx && (init_idx < num_values))
|
||||||
info->property_data[property_idx].default_value =
|
info->property_data[property_idx].default_value =
|
||||||
values->type;
|
values[init_idx].type;
|
||||||
|
|
||||||
/* always attach property, if created */
|
/* always attach property, if created */
|
||||||
if (*prop) {
|
if (*prop) {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MSM_PROP_H_
|
#ifndef _MSM_PROP_H_
|
||||||
@@ -250,6 +250,7 @@ void msm_property_install_volatile_range(struct msm_property_info *info,
|
|||||||
* enumeration one
|
* enumeration one
|
||||||
* @values: Array of allowable enumeration/bitmask values
|
* @values: Array of allowable enumeration/bitmask values
|
||||||
* @num_values: Size of values array
|
* @num_values: Size of values array
|
||||||
|
* @init_idx: index of the values array entry to initialize the property
|
||||||
* @property_idx: Property index
|
* @property_idx: Property index
|
||||||
*/
|
*/
|
||||||
void msm_property_install_enum(struct msm_property_info *info,
|
void msm_property_install_enum(struct msm_property_info *info,
|
||||||
@@ -258,6 +259,7 @@ void msm_property_install_enum(struct msm_property_info *info,
|
|||||||
int is_bitmask,
|
int is_bitmask,
|
||||||
const struct drm_prop_enum_list *values,
|
const struct drm_prop_enum_list *values,
|
||||||
int num_values,
|
int num_values,
|
||||||
|
u32 init_idx,
|
||||||
uint32_t property_idx);
|
uint32_t property_idx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2511,14 +2511,14 @@ static int _sde_connector_install_properties(struct drm_device *dev,
|
|||||||
if (sde_kms->catalog->has_qsync && display_info->qsync_min_fps)
|
if (sde_kms->catalog->has_qsync && display_info->qsync_min_fps)
|
||||||
msm_property_install_enum(&c_conn->property_info,
|
msm_property_install_enum(&c_conn->property_info,
|
||||||
"qsync_mode", 0, 0, e_qsync_mode,
|
"qsync_mode", 0, 0, e_qsync_mode,
|
||||||
ARRAY_SIZE(e_qsync_mode),
|
ARRAY_SIZE(e_qsync_mode), 0,
|
||||||
CONNECTOR_PROP_QSYNC_MODE);
|
CONNECTOR_PROP_QSYNC_MODE);
|
||||||
|
|
||||||
if (display_info->capabilities & MSM_DISPLAY_CAP_CMD_MODE)
|
if (display_info->capabilities & MSM_DISPLAY_CAP_CMD_MODE)
|
||||||
msm_property_install_enum(&c_conn->property_info,
|
msm_property_install_enum(&c_conn->property_info,
|
||||||
"frame_trigger_mode", 0, 0,
|
"frame_trigger_mode", 0, 0,
|
||||||
e_frame_trigger_mode,
|
e_frame_trigger_mode,
|
||||||
ARRAY_SIZE(e_frame_trigger_mode),
|
ARRAY_SIZE(e_frame_trigger_mode), 0,
|
||||||
CONNECTOR_PROP_CMD_FRAME_TRIGGER_MODE);
|
CONNECTOR_PROP_CMD_FRAME_TRIGGER_MODE);
|
||||||
|
|
||||||
if (sde_kms->catalog->has_demura) {
|
if (sde_kms->catalog->has_demura) {
|
||||||
@@ -2554,15 +2554,15 @@ static int _sde_connector_install_properties(struct drm_device *dev,
|
|||||||
/* enum/bitmask properties */
|
/* enum/bitmask properties */
|
||||||
msm_property_install_enum(&c_conn->property_info, "topology_name",
|
msm_property_install_enum(&c_conn->property_info, "topology_name",
|
||||||
DRM_MODE_PROP_IMMUTABLE, 0, e_topology_name,
|
DRM_MODE_PROP_IMMUTABLE, 0, e_topology_name,
|
||||||
ARRAY_SIZE(e_topology_name),
|
ARRAY_SIZE(e_topology_name), 0,
|
||||||
CONNECTOR_PROP_TOPOLOGY_NAME);
|
CONNECTOR_PROP_TOPOLOGY_NAME);
|
||||||
msm_property_install_enum(&c_conn->property_info, "topology_control",
|
msm_property_install_enum(&c_conn->property_info, "topology_control",
|
||||||
0, 1, e_topology_control,
|
0, 1, e_topology_control,
|
||||||
ARRAY_SIZE(e_topology_control),
|
ARRAY_SIZE(e_topology_control), 0,
|
||||||
CONNECTOR_PROP_TOPOLOGY_CONTROL);
|
CONNECTOR_PROP_TOPOLOGY_CONTROL);
|
||||||
msm_property_install_enum(&c_conn->property_info, "LP",
|
msm_property_install_enum(&c_conn->property_info, "LP",
|
||||||
0, 0, e_power_mode,
|
0, 0, e_power_mode,
|
||||||
ARRAY_SIZE(e_power_mode),
|
ARRAY_SIZE(e_power_mode), 0,
|
||||||
CONNECTOR_PROP_LP);
|
CONNECTOR_PROP_LP);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -5277,13 +5277,13 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc,
|
|||||||
if (catalog->has_idle_pc)
|
if (catalog->has_idle_pc)
|
||||||
msm_property_install_enum(&sde_crtc->property_info,
|
msm_property_install_enum(&sde_crtc->property_info,
|
||||||
"idle_pc_state", 0x0, 0, e_idle_pc_state,
|
"idle_pc_state", 0x0, 0, e_idle_pc_state,
|
||||||
ARRAY_SIZE(e_idle_pc_state),
|
ARRAY_SIZE(e_idle_pc_state), 0,
|
||||||
CRTC_PROP_IDLE_PC_STATE);
|
CRTC_PROP_IDLE_PC_STATE);
|
||||||
|
|
||||||
if (catalog->has_cwb_support)
|
if (catalog->has_cwb_support)
|
||||||
msm_property_install_enum(&sde_crtc->property_info,
|
msm_property_install_enum(&sde_crtc->property_info,
|
||||||
"capture_mode", 0, 0, e_cwb_data_points,
|
"capture_mode", 0, 0, e_cwb_data_points,
|
||||||
ARRAY_SIZE(e_cwb_data_points),
|
ARRAY_SIZE(e_cwb_data_points), 0,
|
||||||
CRTC_PROP_CAPTURE_OUTPUT);
|
CRTC_PROP_CAPTURE_OUTPUT);
|
||||||
|
|
||||||
msm_property_install_volatile_range(&sde_crtc->property_info,
|
msm_property_install_volatile_range(&sde_crtc->property_info,
|
||||||
@@ -5291,12 +5291,12 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc,
|
|||||||
|
|
||||||
msm_property_install_enum(&sde_crtc->property_info, "security_level",
|
msm_property_install_enum(&sde_crtc->property_info, "security_level",
|
||||||
0x0, 0, e_secure_level,
|
0x0, 0, e_secure_level,
|
||||||
ARRAY_SIZE(e_secure_level),
|
ARRAY_SIZE(e_secure_level), 0,
|
||||||
CRTC_PROP_SECURITY_LEVEL);
|
CRTC_PROP_SECURITY_LEVEL);
|
||||||
|
|
||||||
msm_property_install_enum(&sde_crtc->property_info, "cache_state",
|
msm_property_install_enum(&sde_crtc->property_info, "cache_state",
|
||||||
0x0, 0, e_cache_state,
|
0x0, 0, e_cache_state,
|
||||||
ARRAY_SIZE(e_cache_state),
|
ARRAY_SIZE(e_cache_state), 0,
|
||||||
CRTC_PROP_CACHE_STATE);
|
CRTC_PROP_CACHE_STATE);
|
||||||
|
|
||||||
if (catalog->has_dim_layer) {
|
if (catalog->has_dim_layer) {
|
||||||
|
@@ -3709,7 +3709,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
|
|||||||
else
|
else
|
||||||
msm_property_install_enum(&psde->property_info,
|
msm_property_install_enum(&psde->property_info,
|
||||||
"multirect_mode", 0x0, 0, e_multirect_mode,
|
"multirect_mode", 0x0, 0, e_multirect_mode,
|
||||||
ARRAY_SIZE(e_multirect_mode),
|
ARRAY_SIZE(e_multirect_mode), 0,
|
||||||
PLANE_PROP_MULTIRECT_MODE);
|
PLANE_PROP_MULTIRECT_MODE);
|
||||||
|
|
||||||
if (psde->features & BIT(SDE_SSPP_EXCL_RECT))
|
if (psde->features & BIT(SDE_SSPP_EXCL_RECT))
|
||||||
@@ -3719,10 +3719,11 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
|
|||||||
sde_plane_rot_install_properties(plane, catalog);
|
sde_plane_rot_install_properties(plane, catalog);
|
||||||
|
|
||||||
msm_property_install_enum(&psde->property_info, "blend_op", 0x0, 0,
|
msm_property_install_enum(&psde->property_info, "blend_op", 0x0, 0,
|
||||||
e_blend_op, ARRAY_SIZE(e_blend_op), PLANE_PROP_BLEND_OP);
|
e_blend_op, ARRAY_SIZE(e_blend_op), 0, PLANE_PROP_BLEND_OP);
|
||||||
|
|
||||||
msm_property_install_enum(&psde->property_info, "src_config", 0x0, 1,
|
msm_property_install_enum(&psde->property_info, "src_config", 0x0, 1,
|
||||||
e_src_config, ARRAY_SIZE(e_src_config), PLANE_PROP_SRC_CONFIG);
|
e_src_config, ARRAY_SIZE(e_src_config), 0,
|
||||||
|
PLANE_PROP_SRC_CONFIG);
|
||||||
|
|
||||||
if (psde->pipe_hw->ops.setup_solidfill)
|
if (psde->pipe_hw->ops.setup_solidfill)
|
||||||
msm_property_install_range(&psde->property_info, "color_fill",
|
msm_property_install_range(&psde->property_info, "color_fill",
|
||||||
@@ -3748,7 +3749,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
|
|||||||
|
|
||||||
msm_property_install_enum(&psde->property_info, "fb_translation_mode",
|
msm_property_install_enum(&psde->property_info, "fb_translation_mode",
|
||||||
0x0, 0, e_fb_translation_mode,
|
0x0, 0, e_fb_translation_mode,
|
||||||
ARRAY_SIZE(e_fb_translation_mode),
|
ARRAY_SIZE(e_fb_translation_mode), 0,
|
||||||
PLANE_PROP_FB_TRANSLATION_MODE);
|
PLANE_PROP_FB_TRANSLATION_MODE);
|
||||||
|
|
||||||
kfree(info);
|
kfree(info);
|
||||||
|
@@ -443,7 +443,7 @@ int sde_wb_connector_post_init(struct drm_connector *connector, void *display)
|
|||||||
"fb_translation_mode",
|
"fb_translation_mode",
|
||||||
0x0,
|
0x0,
|
||||||
0, e_fb_translation_mode,
|
0, e_fb_translation_mode,
|
||||||
ARRAY_SIZE(e_fb_translation_mode),
|
ARRAY_SIZE(e_fb_translation_mode), 0,
|
||||||
CONNECTOR_PROP_FB_TRANSLATION_MODE);
|
CONNECTOR_PROP_FB_TRANSLATION_MODE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user