From d4e944055378fc66c579a8579756344458e2a951 Mon Sep 17 00:00:00 2001 From: Simon1511 Date: Sun, 3 Jul 2022 14:28:26 +0200 Subject: [PATCH] sm7125: drm: msm: make Samsung HBM work On stock ROM Samsung writes the brightness value for the finger mask to /sys/class/lcd/panel/mask_brightness and then turns on the mask layer. However we don't know how they actually turn it on. Therefore enable/disable the finger mask every time we write something to mask_brightness. Signed-off-by: Simon1511 Change-Id: If14119b8856d329f6049701fd16d20c39301f712 --- .../gpu/drm/msm/samsung_lego/ss_dsi_panel_sysfs.c | 12 ++++++++++-- drivers/gpu/drm/msm/sde/sde_connector.c | 12 +++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/samsung_lego/ss_dsi_panel_sysfs.c b/drivers/gpu/drm/msm/samsung_lego/ss_dsi_panel_sysfs.c index dffd7908164c..4ad5140bf829 100755 --- a/drivers/gpu/drm/msm/samsung_lego/ss_dsi_panel_sysfs.c +++ b/drivers/gpu/drm/msm/samsung_lego/ss_dsi_panel_sysfs.c @@ -4285,12 +4285,20 @@ static ssize_t ss_finger_hbm_store(struct device *dev, return size; } - if (sscanf(buf, "%d", &value) != 1) - return size; + sscanf(buf, "%d", &value); LCD_INFO("mask_bl_level value : %d\n", value); vdd->br_info.common_br.finger_mask_bl_level = value; + // brightness value > 0 means enabled + if (value > 0) { + vdd->finger_mask = 1; + } else { + vdd->finger_mask = 0; + } + // Update finger mask after turning on and off + vdd->finger_mask_updated = true; + return size; } diff --git a/drivers/gpu/drm/msm/sde/sde_connector.c b/drivers/gpu/drm/msm/sde/sde_connector.c index a4def9caa0fa..1a31349bf705 100755 --- a/drivers/gpu/drm/msm/sde/sde_connector.c +++ b/drivers/gpu/drm/msm/sde/sde_connector.c @@ -645,11 +645,13 @@ int sde_connector_pre_kickoff(struct drm_connector *connector) if (vdd->support_optical_fingerprint) { finger_mask_state = sde_connector_get_property(c_conn->base.state, CONNECTOR_PROP_FINGERPRINT_MASK); - vdd->finger_mask_updated = false; - if (finger_mask_state != vdd->finger_mask) { - vdd->finger_mask = finger_mask_state; - vdd->finger_mask_updated = true; - SDE_ERROR("[FINGER_MASK]updated finger mask mode %d\n", finger_mask_state); + if (finger_mask_state == 0 && vdd->finger_mask == 1) { + finger_mask_state = vdd->finger_mask; + SDE_ERROR("[FINGER_MASK]updated finger mask mode %d\n", vdd->finger_mask); + } else if (finger_mask_state == 1 && vdd->finger_mask == 0) { + finger_mask_state = vdd->finger_mask; + vdd->finger_mask_updated = false; + SDE_ERROR("[FINGER_MASK]updated finger mask mode %d\n", vdd->finger_mask); } } }