From b87b13690b46007daa6e7061fd01be1e0165b560 Mon Sep 17 00:00:00 2001 From: Jeykumar Sankaran Date: Wed, 27 May 2020 18:20:13 -0700 Subject: [PATCH] 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 --- msm/msm_prop.c | 10 +++++----- msm/msm_prop.h | 4 +++- msm/sde/sde_connector.c | 10 +++++----- msm/sde/sde_crtc.c | 8 ++++---- msm/sde/sde_plane.c | 9 +++++---- msm/sde/sde_wb.c | 2 +- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/msm/msm_prop.c b/msm/msm_prop.c index d7c9eb0f84..a4981f215b 100644 --- a/msm/msm_prop.c +++ b/msm/msm_prop.c @@ -1,6 +1,6 @@ // 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" @@ -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, const char *name, int flags, int is_bitmask, 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; @@ -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].force_dirty = false; - /* select first defined value for enums */ - if (!is_bitmask) + /* initialize with the given idx if valid */ + if (!is_bitmask && init_idx && (init_idx < num_values)) info->property_data[property_idx].default_value = - values->type; + values[init_idx].type; /* always attach property, if created */ if (*prop) { diff --git a/msm/msm_prop.h b/msm/msm_prop.h index 6069aaaa50..63acce8432 100644 --- a/msm/msm_prop.h +++ b/msm/msm_prop.h @@ -1,6 +1,6 @@ /* 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_ @@ -250,6 +250,7 @@ void msm_property_install_volatile_range(struct msm_property_info *info, * enumeration one * @values: Array of allowable enumeration/bitmask values * @num_values: Size of values array + * @init_idx: index of the values array entry to initialize the property * @property_idx: Property index */ 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, const struct drm_prop_enum_list *values, int num_values, + u32 init_idx, uint32_t property_idx); /** diff --git a/msm/sde/sde_connector.c b/msm/sde/sde_connector.c index 02cacc9374..c212b00d05 100644 --- a/msm/sde/sde_connector.c +++ b/msm/sde/sde_connector.c @@ -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) msm_property_install_enum(&c_conn->property_info, "qsync_mode", 0, 0, e_qsync_mode, - ARRAY_SIZE(e_qsync_mode), + ARRAY_SIZE(e_qsync_mode), 0, CONNECTOR_PROP_QSYNC_MODE); if (display_info->capabilities & MSM_DISPLAY_CAP_CMD_MODE) msm_property_install_enum(&c_conn->property_info, "frame_trigger_mode", 0, 0, e_frame_trigger_mode, - ARRAY_SIZE(e_frame_trigger_mode), + ARRAY_SIZE(e_frame_trigger_mode), 0, CONNECTOR_PROP_CMD_FRAME_TRIGGER_MODE); if (sde_kms->catalog->has_demura) { @@ -2554,15 +2554,15 @@ static int _sde_connector_install_properties(struct drm_device *dev, /* enum/bitmask properties */ msm_property_install_enum(&c_conn->property_info, "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); msm_property_install_enum(&c_conn->property_info, "topology_control", 0, 1, e_topology_control, - ARRAY_SIZE(e_topology_control), + ARRAY_SIZE(e_topology_control), 0, CONNECTOR_PROP_TOPOLOGY_CONTROL); msm_property_install_enum(&c_conn->property_info, "LP", 0, 0, e_power_mode, - ARRAY_SIZE(e_power_mode), + ARRAY_SIZE(e_power_mode), 0, CONNECTOR_PROP_LP); return 0; diff --git a/msm/sde/sde_crtc.c b/msm/sde/sde_crtc.c index a9db51e25e..c3cdeed477 100644 --- a/msm/sde/sde_crtc.c +++ b/msm/sde/sde_crtc.c @@ -5277,13 +5277,13 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc, if (catalog->has_idle_pc) msm_property_install_enum(&sde_crtc->property_info, "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); if (catalog->has_cwb_support) msm_property_install_enum(&sde_crtc->property_info, "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); 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", 0x0, 0, e_secure_level, - ARRAY_SIZE(e_secure_level), + ARRAY_SIZE(e_secure_level), 0, CRTC_PROP_SECURITY_LEVEL); msm_property_install_enum(&sde_crtc->property_info, "cache_state", 0x0, 0, e_cache_state, - ARRAY_SIZE(e_cache_state), + ARRAY_SIZE(e_cache_state), 0, CRTC_PROP_CACHE_STATE); if (catalog->has_dim_layer) { diff --git a/msm/sde/sde_plane.c b/msm/sde/sde_plane.c index 3135963c88..18d06be3dd 100644 --- a/msm/sde/sde_plane.c +++ b/msm/sde/sde_plane.c @@ -3709,7 +3709,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane, else msm_property_install_enum(&psde->property_info, "multirect_mode", 0x0, 0, e_multirect_mode, - ARRAY_SIZE(e_multirect_mode), + ARRAY_SIZE(e_multirect_mode), 0, PLANE_PROP_MULTIRECT_MODE); 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); 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, - 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) 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", 0x0, 0, e_fb_translation_mode, - ARRAY_SIZE(e_fb_translation_mode), + ARRAY_SIZE(e_fb_translation_mode), 0, PLANE_PROP_FB_TRANSLATION_MODE); kfree(info); diff --git a/msm/sde/sde_wb.c b/msm/sde/sde_wb.c index 3b51db3492..dcb308fabf 100644 --- a/msm/sde/sde_wb.c +++ b/msm/sde/sde_wb.c @@ -443,7 +443,7 @@ int sde_wb_connector_post_init(struct drm_connector *connector, void *display) "fb_translation_mode", 0x0, 0, e_fb_translation_mode, - ARRAY_SIZE(e_fb_translation_mode), + ARRAY_SIZE(e_fb_translation_mode), 0, CONNECTOR_PROP_FB_TRANSLATION_MODE); return 0;