From patchwork Fri Apr 8 01:30:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 12805989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F0119C433EF for ; Fri, 8 Apr 2022 01:30:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5287110E06F; Fri, 8 Apr 2022 01:30:43 +0000 (UTC) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id 00B8A10E06F for ; Fri, 8 Apr 2022 01:30:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: nfraprado) with ESMTPSA id D66171F46B10 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1649381440; bh=8LfnufoqbKLUJpGpQ0uLp1AtFcRy4BBDR+hZk2BoruU=; h=From:To:Cc:Subject:Date:From; b=UVnRobzp+GkWSGygXxshTcnDIxRCggP8nBMb2/Hb9ojxq110fq/bxKpkSitWGctou wOzAH3kTK/dYNHRBWDiQL5zpkAhT3Gy0FHMM6jR4+Rdlyh/bAsAfI64ctQWJp/JJpL ti8bRdsEnpkIjs5Nwzp2kb93oUljPfLqPsCgLz3r45brTj/wppegYVmVvzsuqIXIHq iPapPYOFlf8O8JSf0P3JR9kJWKTiqhO7N2jHMbBGd70WpOuH2OuV/d3zMv7hKj1HCC +WLZY17aQYG5SpnsJW+iSFhI7ajfSfvOwRQXayldGtMEL/opVU//piwDEeyLZ1h8/G 1LWxl9bbRAezg== From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: Robert Foss , Neil Armstrong , Andrzej Hajda Subject: [PATCH] drm/bridge: anx7625: Use uint8 for lane-swing arrays Date: Thu, 7 Apr 2022 21:30:34 -0400 Message-Id: <20220408013034.673418-1-nfraprado@collabora.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pi-Hsun Shih , =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4g?= =?utf-8?b?UHJhZG8=?= , Jonas Karlman , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jernej Skrabec , Tzung-Bi Shih , Laurent Pinchart , Hsin-Yi Wang , Maxime Ripard , kernel@collabora.com, Sam Ravnborg , Xin Ji , AngeloGioacchino Del Regno Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As defined in the anx7625 dt-binding, the analogix,lane0-swing and analogix,lane1-swing properties are uint8 arrays. Yet, the driver was reading the array as if it were of uint32 and masking to 8-bit before writing to the registers. This means that a devicetree written in accordance to the dt-binding would have its values incorrectly parsed. Fix the issue by reading the array as uint8 and storing them as uint8 internally, so that we can also drop the masking when writing the registers. Fixes: fd0310b6fe7d ("drm/bridge: anx7625: add MIPI DPI input feature") Signed-off-by: NĂ­colas F. R. A. Prado Reviewed-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/bridge/analogix/anx7625.c | 8 ++++---- drivers/gpu/drm/bridge/analogix/anx7625.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 6516f9570b86..19a1a90ccff3 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1486,12 +1486,12 @@ static void anx7625_dp_adjust_swing(struct anx7625_data *ctx) for (i = 0; i < ctx->pdata.dp_lane0_swing_reg_cnt; i++) anx7625_reg_write(ctx, ctx->i2c.tx_p1_client, DP_TX_LANE0_SWING_REG0 + i, - ctx->pdata.lane0_reg_data[i] & 0xFF); + ctx->pdata.lane0_reg_data[i]); for (i = 0; i < ctx->pdata.dp_lane1_swing_reg_cnt; i++) anx7625_reg_write(ctx, ctx->i2c.tx_p1_client, DP_TX_LANE1_SWING_REG0 + i, - ctx->pdata.lane1_reg_data[i] & 0xFF); + ctx->pdata.lane1_reg_data[i]); } static void dp_hpd_change_handler(struct anx7625_data *ctx, bool on) @@ -1598,7 +1598,7 @@ static int anx7625_get_swing_setting(struct device *dev, num_regs = DP_TX_SWING_REG_CNT; pdata->dp_lane0_swing_reg_cnt = num_regs; - of_property_read_u32_array(dev->of_node, "analogix,lane0-swing", + of_property_read_u8_array(dev->of_node, "analogix,lane0-swing", pdata->lane0_reg_data, num_regs); } @@ -1608,7 +1608,7 @@ static int anx7625_get_swing_setting(struct device *dev, num_regs = DP_TX_SWING_REG_CNT; pdata->dp_lane1_swing_reg_cnt = num_regs; - of_property_read_u32_array(dev->of_node, "analogix,lane1-swing", + of_property_read_u8_array(dev->of_node, "analogix,lane1-swing", pdata->lane1_reg_data, num_regs); } diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h index edbbfe410a56..e257a84db962 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.h +++ b/drivers/gpu/drm/bridge/analogix/anx7625.h @@ -426,9 +426,9 @@ struct anx7625_platform_data { int mipi_lanes; int audio_en; int dp_lane0_swing_reg_cnt; - int lane0_reg_data[DP_TX_SWING_REG_CNT]; + u8 lane0_reg_data[DP_TX_SWING_REG_CNT]; int dp_lane1_swing_reg_cnt; - int lane1_reg_data[DP_TX_SWING_REG_CNT]; + u8 lane1_reg_data[DP_TX_SWING_REG_CNT]; u32 low_power_mode; struct device_node *mipi_host_node; };