Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp205322pxh; Thu, 7 Apr 2022 18:58:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL8j7SxRhwNq5JZca4zIVT9nsnNbsXZi520cu7zDZ29aH3K98iQuy/F6KaC6NKUE/nCA/u X-Received: by 2002:a17:90b:1652:b0:1c7:305f:3a32 with SMTP id il18-20020a17090b165200b001c7305f3a32mr18774044pjb.108.1649383123519; Thu, 07 Apr 2022 18:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649383123; cv=none; d=google.com; s=arc-20160816; b=PS3Xh9sXPPXxfwjWDuKOa99D2r4v7VO0WuMZ3uI4ntpS3tSP9TBU/s5ldEslMkK/Z5 3VZascdH8+k05sihU7lJ9npdqpgTuK3oJ1uIrBq5xiACUPaNHbsZ95xQj0TUMKp47YNP odHFbCvNxFt3KF/vauc/EuMYxh9bYktA1bru6BAg4hGrOmXN7n/KcYfB1yh5q4//x/ZK cocOFQVz+aDcQ5pMs4lhAidXqTxDWn+vdqprga0N7MxElPqDC9tRMHISaFcZ8OE+h5Rc GQdEXe9l5+vEGfo08CxQdT7cVKoNU19tQNS01SpeHWCLOH4XbR1nt7RYKqT295RcCvKy 1xMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=r7dHFrd7TanerM6n0qMecFk7GOOu20MeIRslVOukJVc=; b=RVALAY8gDPRo/Voz8JXZWy9YeA3VpuctTc6YD7h20yXHS7DDibeJ6HP1dvE2//yaBp eNpxY+bxeOSz4XcdGFxKr/UzdWsPkBF/3ONi7w5SJsVlXLrDXjRXsy+flmDwOvkY7Tmo N/BqrIsaQf0r8R5P7WGjtUw4K1PbDop+7xnnplLsl3nwop/b2wn4+raPlBV2OuT1eAL+ F9pB99ZKLO8kXQIvBpRzaBgZ5PNSCXDKr5xcarLHnhAv9/xhMvHGw1xJuT46Dlfqb123 kSgW/+/KNzyAR1RrFJTn6jxishnssATRNPJnzGysrw1waQpDLMLar/LkfQ3LD5u4XDf3 ELNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=UVnRobzp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s3-20020a170903214300b00153b2d16474si1180956ple.124.2022.04.07.18.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 18:58:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=UVnRobzp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3A4172DE15E; Thu, 7 Apr 2022 18:30:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233490AbiDHBcr (ORCPT + 99 others); Thu, 7 Apr 2022 21:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233434AbiDHBco (ORCPT ); Thu, 7 Apr 2022 21:32:44 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCFDA2BC545 for ; Thu, 7 Apr 2022 18:30:41 -0700 (PDT) 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?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= To: Robert Foss , Neil Armstrong , Andrzej Hajda Cc: AngeloGioacchino Del Regno , kernel@collabora.com, =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= , Daniel Vetter , David Airlie , Hsin-Yi Wang , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Maxime Ripard , Pi-Hsun Shih , Sam Ravnborg , Tzung-Bi Shih , Xin Ji , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; }; -- 2.35.1