From patchwork Mon Feb 19 23:11:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13563202 Received: from ahti.lucaweiss.eu (ahti.lucaweiss.eu [128.199.32.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75F2150A87; Mon, 19 Feb 2024 23:11:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=128.199.32.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708384309; cv=none; b=e1rBNxLpjw/FoM3qHwavpH5NHUAs/iA9zYmhv9qd+6fll1+WSnb9f86Y2QAgkjT/K6Lsvgu0PVGQ9KMoe1ripwLiMr/qQluI0w2RCdvuWZZgUxMUdoo/LDJ6uviFsq0kaDXvFUCJNvElevBJdFyD0xRmEPn4KA0LnsKj3RBqr0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708384309; c=relaxed/simple; bh=O9YMNtZsdJs0ZoYFcgO+aLhFGygFWBl09MvW27EqzNs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tZomJVfBYPP5M4fof++vyajDGPCAtfJBSMqcWbnupOYrHdAYH1Hjq1cIqG+/T+WVvii6uq9+sfwM0z+L4ZlvBl9nDTxzKrpiqNSESZPsnRHG3ABBOfR/jQ2OoVT68XTw7VKw0XETMlqlrPJreHIfKJoeyqpnqCTOQ0+C6jlFMWM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=z3ntu.xyz; spf=pass smtp.mailfrom=z3ntu.xyz; dkim=pass (1024-bit key) header.d=z3ntu.xyz header.i=@z3ntu.xyz header.b=5PP/5MQS; arc=none smtp.client-ip=128.199.32.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=z3ntu.xyz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=z3ntu.xyz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=z3ntu.xyz header.i=@z3ntu.xyz header.b="5PP/5MQS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=s1; t=1708384299; bh=O9YMNtZsdJs0ZoYFcgO+aLhFGygFWBl09MvW27EqzNs=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=5PP/5MQS/NZGiSIhjFC+hhb796yKqY9eIf/WVyc816zMf/ybvf5bZWh5Z/4fcd9bz 0JHM5PQoWge37lkmPN1ge30RyJwWZo96ZcIC2nXFRPLOw7makclHCprFkVWtrk5wZF 3u3qNriw4SDgdMI7C/j6IQyqU42dMGQOsn19HxMc= From: Luca Weiss Date: Tue, 20 Feb 2024 00:11:19 +0100 Subject: [PATCH 1/4] backlight: lm3630a: Initialize backlight_properties on init Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-lm3630a-fixups-v1-1-9ca62f7e4a33@z3ntu.xyz> References: <20240220-lm3630a-fixups-v1-0-9ca62f7e4a33@z3ntu.xyz> In-Reply-To: <20240220-lm3630a-fixups-v1-0-9ca62f7e4a33@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Lee Jones , Daniel Thompson , Jingoo Han , Helge Deller , Andrew Morton , "G.Shark Jeong" , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maximilian Weigand Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=910; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=O9YMNtZsdJs0ZoYFcgO+aLhFGygFWBl09MvW27EqzNs=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBl0+AmkPMYimxC9RpcBH7pJ2gK7RCa2Jy2ieylP OpvmUPTil+JAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZdPgJgAKCRBy2EO4nU3X VtkcD/9fwi4fxP0SycQ4dCjxctRHRSvDpH+GAoMyZ3M2g1/fwAEId+gPCE0mNaE0WONLGs32pqs o9AhRwC8QFTC0XMOZ1gRGUTgmmf4a3v4o/c+SVJw6R/0IRIRbRdUatb0RnJpUTcGyuXtF7+wwsh la5IqIgdBfyWc3Uh7yFXeaNzYmg2J47uQDmlSPFcKcnWkM05dbSfz1chi5i75b/gta7zo43KRAI tAtJNP5v8JjQiEwun/g3l17xiD/mjr2W47NOlISG4DknjP55c59b5ExD4l+NyjLbQA840nLQJZd 1W7I6Rz8x62p9slPWIAP3S7vDfArGCSZLU8YXWTZmROecRPQtGK/O0/JT4CYmLcuSD9snO5wPJI fXvxAmJXVeSC6FUII9yl6DkbDx78lzoVW6hrTb4O+EypMiMcdtNR7IM/NE2EDb8XRHBH6tSE3RZ v1KrCIFsDxvSL2eC5h5ddBRWNlc3DcNPP6qA0oXx26OjnFiFKcx1xiUUsb6qRYpi4aRnq/E8Xud LIo2YJkvNZKlfS9mDaXzwm58i6h8p4t+tj9g3d9ZaNTdPZt1pYtQ6ligvuLquiSSRvDa7NFhhHT VRxoEokazRn4Ivwzl/tAkulw+DIj2j+olzz6++dEeHA8TndVUORUpynWm7Z3AvH4S04Js4ah4SF wPwvHdfGVGWWKRg== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD The backlight_properties struct should be initialized to zero before using, otherwise there will be some random values in the struct. Fixes: 0c2a665a648e ("backlight: add Backlight driver for lm3630 chip") Signed-off-by: Luca Weiss Reviewed-by: Daniel Thompson --- drivers/video/backlight/lm3630a_bl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c index a3412c936ca2..8e275275b808 100644 --- a/drivers/video/backlight/lm3630a_bl.c +++ b/drivers/video/backlight/lm3630a_bl.c @@ -343,6 +343,7 @@ static int lm3630a_backlight_register(struct lm3630a_chip *pchip) struct backlight_properties props; const char *label; + memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; if (pdata->leda_ctrl != LM3630A_LEDA_DISABLE) { props.brightness = pdata->leda_init_brt; From patchwork Mon Feb 19 23:11:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13563203 Received: from ahti.lucaweiss.eu (ahti.lucaweiss.eu [128.199.32.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75F5C54BD3; Mon, 19 Feb 2024 23:11:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=128.199.32.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708384309; cv=none; b=Yi+YUSvU5U3XC7CMVResLtc3Y2O45PQqYCiTxIa6/LbCXkpcLz6iPcmyDi292pFow2ue/dkuutBAZWDeH2/TuzpJXbsJbg5LKOCeRbLZiX3ts/Jyi/3ceJCpDDQ0tVkP5/MMH+phLd1GV01zYgF3qo3ItEnwbvkPFdzqmEi3wD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708384309; c=relaxed/simple; bh=4FVN1lsdigo7viniW4HQplRB1ye5k50DGqYItrjf0oQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M/R4GOIP6Q2ykrWawnmuPXfiSygmWgpX1JJoH/0SpXC3WZQfeIW91N2ksL7XkpH8+c963G42sYdZ/fkbpeUZV4tLgFJXqq5vY28fhCqSoNYcXyao3LphLur8x0E1RanblNaRsWOyYNtxxdzZBPCZFeLwvFl2bLTEleQCKiHhm7I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=z3ntu.xyz; spf=pass smtp.mailfrom=z3ntu.xyz; dkim=pass (1024-bit key) header.d=z3ntu.xyz header.i=@z3ntu.xyz header.b=1bEuaatO; arc=none smtp.client-ip=128.199.32.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=z3ntu.xyz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=z3ntu.xyz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=z3ntu.xyz header.i=@z3ntu.xyz header.b="1bEuaatO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=s1; t=1708384300; bh=4FVN1lsdigo7viniW4HQplRB1ye5k50DGqYItrjf0oQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=1bEuaatOD1fd9xD70XSQxeSdxxdIvvmBFP2Gdb9ZbycwZtGPxi8rlZJkihq0UWmFe rcthh3ZWuu1dzYuxfTwxCsHH4GG4h33s5o6JRgO+rD6tZuPyKiJERctJm4IBkZHYpc 9d2mJJxvitmqJT7tYY7+YbT4WJzy6aDVfjrkAwr8= From: Luca Weiss Date: Tue, 20 Feb 2024 00:11:20 +0100 Subject: [PATCH 2/4] backlight: lm3630a: Don't set bl->props.brightness in get_brightness Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-lm3630a-fixups-v1-2-9ca62f7e4a33@z3ntu.xyz> References: <20240220-lm3630a-fixups-v1-0-9ca62f7e4a33@z3ntu.xyz> In-Reply-To: <20240220-lm3630a-fixups-v1-0-9ca62f7e4a33@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Lee Jones , Daniel Thompson , Jingoo Han , Helge Deller , Andrew Morton , "G.Shark Jeong" , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maximilian Weigand Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1906; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=4FVN1lsdigo7viniW4HQplRB1ye5k50DGqYItrjf0oQ=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBl0+AnYpKXaDh4PR2QorZC1//Jx6rBuSWTvVmRQ ss0kIhVH7mJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZdPgJwAKCRBy2EO4nU3X VpElEADPFLgNHVWgOTwC2O0e7/NUR5zzEQnnFlqCsJBvQqF8rZ/gmLqtpf1YSlBjltHklrDcCM4 gnHZ5XCeF+JQqGh+5w3Y3xRDhM8EVtv10ubomUNe3h2jbLyb26lt5/vUz2GfoJJTBN/2yQPZMMI jwzpQ8T5ojxpYeKlsRhTZ8cAtu7dobFXxxwjeI+kj+diFjnh57XbS3ddJAaI+tXKAC5fb798oNd VzVsNUg79xo6ZWYsJdvhyNMyxg3TuqVUYeV2yvy/vWX9Z3Y0fOTGWFwY5OyGBqd+Zu1i7Yl5/c4 Kg7Ijq0Q2Lkx5rhD+k+VUNW3mNGwYO77xYre8C+DBvtE37DqJz8GrdhSe1sXKeVSnYoy1hJ2j6p OltUTu/OKh/K/VK24W/Ldj42oEYAyYM4t6/J0f5Qf1LGm6I4Z/IC5qcBOgyOZ8QZK04alIxBCZ+ 7sk+Lp5bE/zBSGw7EOcgZKo8hnQaqk3tfSo4Bdna2B7KUaJtabDwDbTv1lJf31u006rkkG/2Hhb VRiNJYWlDbF+ZhRXr4sr5bwNKxRPJRoqiDZzpXxdOfuNyBy89DUA+hx4frbZ+nn3owi6HyiZdh+ 7DE8RTwwEN6DNh4iajbZ9eJOtuNWe/Be8n/l3FN79wR1EzdbkZxpfnR/fxJdotAs2Cxi+nVlO8l iFu1Pjz0fHEmQXg== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD There's no need to set bl->props.brightness, the get_brightness function is just supposed to return the current brightness and not touch the struct. With that done we can also remove the 'goto out' and just return the value. Fixes: 0c2a665a648e ("backlight: add Backlight driver for lm3630 chip") Signed-off-by: Luca Weiss Reviewed-by: Daniel Thompson --- drivers/video/backlight/lm3630a_bl.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c index 8e275275b808..26ff4178cc16 100644 --- a/drivers/video/backlight/lm3630a_bl.c +++ b/drivers/video/backlight/lm3630a_bl.c @@ -233,7 +233,7 @@ static int lm3630a_bank_a_get_brightness(struct backlight_device *bl) if (rval < 0) goto out_i2c_err; brightness |= rval; - goto out; + return brightness; } /* disable sleep */ @@ -244,11 +244,8 @@ static int lm3630a_bank_a_get_brightness(struct backlight_device *bl) rval = lm3630a_read(pchip, REG_BRT_A); if (rval < 0) goto out_i2c_err; - brightness = rval; + return rval; -out: - bl->props.brightness = brightness; - return bl->props.brightness; out_i2c_err: dev_err(pchip->dev, "i2c failed to access register\n"); return 0; @@ -310,7 +307,7 @@ static int lm3630a_bank_b_get_brightness(struct backlight_device *bl) if (rval < 0) goto out_i2c_err; brightness |= rval; - goto out; + return brightness; } /* disable sleep */ @@ -321,11 +318,8 @@ static int lm3630a_bank_b_get_brightness(struct backlight_device *bl) rval = lm3630a_read(pchip, REG_BRT_B); if (rval < 0) goto out_i2c_err; - brightness = rval; + return rval; -out: - bl->props.brightness = brightness; - return bl->props.brightness; out_i2c_err: dev_err(pchip->dev, "i2c failed to access register\n"); return 0; From patchwork Mon Feb 19 23:11:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13563205 Received: from ahti.lucaweiss.eu (ahti.lucaweiss.eu [128.199.32.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 555DF56448; Mon, 19 Feb 2024 23:11:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=128.199.32.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708384311; cv=none; b=Y12N86eb5U3GP2NVRLABV3qloxpWzBdm10NUqoXdaefMOBHgDQV8a/qI/d3I+yEp1cwmM0G/kEBnHE9vYc0VcT/P+YEAoSQnJ38u7Sqjca2emwKVrokRJRmASo1TQxhDOzsi8YhCEgfqagCoKdPyL40UhX2tlv4U7ottGyA4BVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708384311; c=relaxed/simple; bh=tgSDAwlrVTzUIqiZyqw7iiUTatrOj4HaquGU5a8EzIU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o/OHUnWER17yuSSCdPsdV3qplLhZLZh1lGU2Z36TBsARMEhErdKuWxg0R8WvuhQYcdeOA8VVO4wxaWYZ8c65W76zNhNLC/tAkYtWqNzbe8+mofp7D5Hejk2TZYLYFpd3t/RV23vsv0LCyB7yOsCdvHRmMXDOvc1P4giQMjgioGE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=z3ntu.xyz; spf=pass smtp.mailfrom=z3ntu.xyz; dkim=pass (1024-bit key) header.d=z3ntu.xyz header.i=@z3ntu.xyz header.b=vGsHYTAa; arc=none smtp.client-ip=128.199.32.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=z3ntu.xyz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=z3ntu.xyz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=z3ntu.xyz header.i=@z3ntu.xyz header.b="vGsHYTAa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=s1; t=1708384300; bh=tgSDAwlrVTzUIqiZyqw7iiUTatrOj4HaquGU5a8EzIU=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=vGsHYTAaubBzb2bYsXKkzfudGfH7qgOPou2A89bhFI7dVoNZtUuqZKndldkTDoges m4nnpyNEXOtzzLO2I2n/E4w505BcJhS81oI3ojXv3bqGQRX+7bAU0fVpqfiIyixtEZ IudaTj5Wajeq1MYkLlTuMhbRd3/PbV7BGms8PvcU= From: Luca Weiss Date: Tue, 20 Feb 2024 00:11:21 +0100 Subject: [PATCH 3/4] backlight: lm3630a: Use backlight_get_brightness helper in update_status Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-lm3630a-fixups-v1-3-9ca62f7e4a33@z3ntu.xyz> References: <20240220-lm3630a-fixups-v1-0-9ca62f7e4a33@z3ntu.xyz> In-Reply-To: <20240220-lm3630a-fixups-v1-0-9ca62f7e4a33@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Lee Jones , Daniel Thompson , Jingoo Han , Helge Deller , Andrew Morton , "G.Shark Jeong" , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maximilian Weigand Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2663; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=tgSDAwlrVTzUIqiZyqw7iiUTatrOj4HaquGU5a8EzIU=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBl0+AoTixhJbLZliq9WxIhxRszJgCAbf5dK6Uaz 3FQbTd6OhKJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZdPgKAAKCRBy2EO4nU3X Vul3D/40hfXK/hCXfw+Oi4sNLlrVTWbF3wGBLJv0EYE+UIYALtzpvViG6lquEEohZzR8nJOGd5m SOCn4lYVrh69CX4YGafx/Z035y23A3f7lOGlhkCZHxCmC7TkCz7jUZDIESfH2TGyxYG4im6sVnn 71RPTiAzOyD89Qv8Tr0TKWPgA/K8bbf+U2BtESebvJpkVMcWuMHtSiE67fqAacK7iheq+glGzjc DHwBzbL7/3YFJKZL9j18yXpSoKNZJZEFTtvWKPzCv75tB9Hd6h3Q7zbkN6cvOPsO9PWdjkFa/NI QCfymKnd9v1CPuENWvC5ADh+6z+j3N6l/moHLDtMLu6t1HTbDLYz9nVi1EplW/ECfW5LRKMM3Aw KvoArTl1OzAZ7kVLFAR7U9kCRYsrRUD28dcVJ9dK8Rm1ce4svScTKNQA7VtlfpogEzQlrbcB/BY 09cpxfGmPN8exdgSWL8cOhY89TSZqQgHVN+YzhE+COLgm0LExv7pp4wzTr4DAejtjeQxjIwfcSy +2UJrKAhEIz3mFyQw9t7aj8dlmiNey9T0lemmUXe+PJpnwHYcmyndCRiiYw8j0FE08de3ECwrBL 837t9lFnkz1VbucT4TL+uSBfcB4qjUqDAEkb2w1uUsOSrSSJIHubbZsL/JjrCaK7jST+ZPV4ICW fv/vS9d1qz9CyDg== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD As per documentation "drivers are expected to use this function in their update_status() operation to get the brightness value.". With this we can also drop the manual backlight_is_blank() handling since backlight_get_brightness() is already handling this correctly. Signed-off-by: Luca Weiss Reviewed-by: Daniel Thompson --- drivers/video/backlight/lm3630a_bl.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c index 26ff4178cc16..e6c0916ec88b 100644 --- a/drivers/video/backlight/lm3630a_bl.c +++ b/drivers/video/backlight/lm3630a_bl.c @@ -189,10 +189,11 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl) int ret; struct lm3630a_chip *pchip = bl_get_data(bl); enum lm3630a_pwm_ctrl pwm_ctrl = pchip->pdata->pwm_ctrl; + int brightness = backlight_get_brightness(bl); /* pwm control */ if ((pwm_ctrl & LM3630A_PWM_BANK_A) != 0) - return lm3630a_pwm_ctrl(pchip, bl->props.brightness, + return lm3630a_pwm_ctrl(pchip, brightness, bl->props.max_brightness); /* disable sleep */ @@ -201,9 +202,9 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl) goto out_i2c_err; usleep_range(1000, 2000); /* minimum brightness is 0x04 */ - ret = lm3630a_write(pchip, REG_BRT_A, bl->props.brightness); + ret = lm3630a_write(pchip, REG_BRT_A, brightness); - if (backlight_is_blank(bl) || (backlight_get_brightness(bl) < 0x4)) + if (brightness < 0x4) /* turn the string off */ ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDA_ENABLE, 0); else @@ -263,10 +264,11 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl) int ret; struct lm3630a_chip *pchip = bl_get_data(bl); enum lm3630a_pwm_ctrl pwm_ctrl = pchip->pdata->pwm_ctrl; + int brightness = backlight_get_brightness(bl); /* pwm control */ if ((pwm_ctrl & LM3630A_PWM_BANK_B) != 0) - return lm3630a_pwm_ctrl(pchip, bl->props.brightness, + return lm3630a_pwm_ctrl(pchip, brightness, bl->props.max_brightness); /* disable sleep */ @@ -275,9 +277,9 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl) goto out_i2c_err; usleep_range(1000, 2000); /* minimum brightness is 0x04 */ - ret = lm3630a_write(pchip, REG_BRT_B, bl->props.brightness); + ret = lm3630a_write(pchip, REG_BRT_B, brightness); - if (backlight_is_blank(bl) || (backlight_get_brightness(bl) < 0x4)) + if (brightness < 0x4) /* turn the string off */ ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDB_ENABLE, 0); else From patchwork Mon Feb 19 23:11:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13563204 Received: from ahti.lucaweiss.eu (ahti.lucaweiss.eu [128.199.32.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5559E55E74; Mon, 19 Feb 2024 23:11:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=128.199.32.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708384310; cv=none; b=Y7XlomcfHvSCvH+yaXMNw3L2l7uV1UCRA4cCTf/Qv1jVWURj4hZZCMm0Sp+4QKc2DupN8To7gz8SyxYJ5Ue39rYUn/n/CQECwogD/G2fFHRlNP7lhYPF8tFp3soLOxUey8A7Uf0pZzbrBLesHspnyxr2+o9q6QzrfS03uzV1OR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708384310; c=relaxed/simple; bh=ni9Hk46J16/FHSxaH5CWtQXBguOqf3wPvo6zQuh0j5I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tcS0yHS2tzjJ2tDd/3hAS32uSv4Jgl+9v512KiL1mCm+xIZprTG/LDZPH/O4CXJ4Ka3TMOruD1cdSAmwdXsaL3plsCWiHQnb9M3FIy2RWP7i6kYUHC4u15N7t07K7VYtB3DFBUG57PqDVENLzQxNydw38mWxJg92SsxvUFutPVQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=z3ntu.xyz; spf=pass smtp.mailfrom=z3ntu.xyz; dkim=pass (1024-bit key) header.d=z3ntu.xyz header.i=@z3ntu.xyz header.b=bLdO6L6Z; arc=none smtp.client-ip=128.199.32.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=z3ntu.xyz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=z3ntu.xyz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=z3ntu.xyz header.i=@z3ntu.xyz header.b="bLdO6L6Z" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=s1; t=1708384301; bh=ni9Hk46J16/FHSxaH5CWtQXBguOqf3wPvo6zQuh0j5I=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=bLdO6L6ZOMuCpGRuBzoCbFIj6Ne9M2++W6hJNKuHY4J/H4Wke2M63dMmBuUr2NAFZ wPsuUdezeIIR+iDXVMJiu67OwpMGyEE/dfGAbV+L7ivphIc/s86+/8KuEn47/5gTK+ cGaagGby6KD2aQoEeXFSUNK5CDXlH9SCmVHU08/E= From: Luca Weiss Date: Tue, 20 Feb 2024 00:11:22 +0100 Subject: [PATCH 4/4] ARM: dts: qcom: msm8974-hammerhead: Hook up backlight Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-lm3630a-fixups-v1-4-9ca62f7e4a33@z3ntu.xyz> References: <20240220-lm3630a-fixups-v1-0-9ca62f7e4a33@z3ntu.xyz> In-Reply-To: <20240220-lm3630a-fixups-v1-0-9ca62f7e4a33@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Lee Jones , Daniel Thompson , Jingoo Han , Helge Deller , Andrew Morton , "G.Shark Jeong" , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maximilian Weigand Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1027; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=ni9Hk46J16/FHSxaH5CWtQXBguOqf3wPvo6zQuh0j5I=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBl0+Ap06xVVfOjf7jo2py8gyWN6Lc4io9S0g2Uy UAt+awT6YOJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZdPgKQAKCRBy2EO4nU3X VsSCD/42xL9+QTj0aHPyGIPTtH/EKXNhf6ghXkZmndDoIPhAm7thYII1LR1oCs7HUJ5omau9+th 9lJaTndXPqbbXnZ+a/RIBnSyVdt/eXQKDxa7WIlXGro+gUYgVyt9cPQZ4E0d+8DnHeuX803yhOX YDNPkHa5UwzwkojTUIu9KHf82KbQxbQb9UygKLcsx5RKGdTE4Z2N480ygzvaiskAueFtPxlVYS8 ijqBTGzGz5sp6hK8C0oNNXJHphROVnwEZKAvJLeBrmcJgBI51rd+2BcMKCHqA717ibE3wd9nYTV bgH0KCzC1Fb5SqswvEv//ePLT5M4s2OfU7kWQ9Zo8e6Ko0NZFqhrYIw8c5XwOmv8YucDls8MtmO HugR0Km3hPqOUSAfuEGWVSNFfWzPuwcykI/EcVjsUSYKWQevqLqGZexTFAL4i+YRITNspjlbnKR AtJL2pcNro0SWEtcUrW2hN5ak6AUbIfemzRo3/j96n96BaoBCImRCHcduFKCdlSaeIpZYtu2H4f TXr9UMAh7c80tzAfjSY2vvcTb1lwO3S3loeXvqQ1WcWl4HtXC5vsyJX2pun4s6QST96xKYH5h8B 5QMlXneIVb8+DyGPQZiOkP3MhbPIXKw3D4nLlLd1FT1KSFE7XOH7TFHJa+K/70i+NkhGJpCyewJ cU9CaRARJQ9Ihqw== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Connect the panel with the backlight nodes so that the backlight can be turned off when the display is blanked. Signed-off-by: Luca Weiss Reviewed-by: Daniel Thompson --- arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts index 4aaae8537a3f..8eaa5b162815 100644 --- a/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts +++ b/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts @@ -182,7 +182,7 @@ &blsp2_i2c5 { status = "okay"; clock-frequency = <355000>; - led-controller@38 { + backlight: led-controller@38 { compatible = "ti,lm3630a"; status = "okay"; reg = <0x38>; @@ -272,6 +272,8 @@ panel: panel@0 { reg = <0>; compatible = "lg,acx467akm-7"; + backlight = <&backlight>; + pinctrl-names = "default"; pinctrl-0 = <&panel_pin>;