From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9A532165F0; Thu, 12 Dec 2024 17:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734023701; cv=none; b=Byjv+2pcIkJ+y6qm1ZkcYAR5sJgBPSlaV78lKLdK0w09L1Rpxtc14GdzfXns7vwn5ZTzK9j60TF2iWAI8+lhKM5Sw29cJHvjGMuvDMM6JdxIPNhvQ/58OqYjy6y5YBgMGvQmpdmqQA24BepzWT1xci7PWBJmkJ76DrEhjN6dm7I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734023701; c=relaxed/simple; bh=wJ67vK7Nvu4h3exL8Ns9aE2VUvAeBMkArOviIbtKx2c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=opdP2UX7aU3i2NkzE9HqHyLgiPwbymjk6Yehn2L97PJWhhxTfXzbTMWDxbvvXo7FHDFOaQ2OoEGegaRyOh6Ntta+dPtYtb4PtCuFHLlLgBjZ/yX3WVtvALN8KlLWv+tpfrOexzrQaHijAsf2ECQ5fjj3TAWIhNMRKnMPSAPK/I8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pTHuDaaZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pTHuDaaZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3066EC4CECE; Thu, 12 Dec 2024 17:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734023701; bh=wJ67vK7Nvu4h3exL8Ns9aE2VUvAeBMkArOviIbtKx2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pTHuDaaZw8hWLou1uuvVk1i75xXCnwOtvmGoJdHMdYOshdahAdBGrmtLABezu7Qgf Ii2jLGSvSVpK59vT+J3UHzaETHqPCddxFlDyHyMEGy2PDqFlKyaJmwaeN7bp2Aqn0m 11rOIWTrUEmd0jxzP9AQBTHoZAs0vpE8yjAJFHlI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Francesco Dolcini , Neil Armstrong Subject: [PATCH 5.10 023/459] drm/bridge: tc358768: Fix DSI command tx Date: Thu, 12 Dec 2024 15:56:01 +0100 Message-ID: <20241212144254.440516560@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144253.511169641@linuxfoundation.org> References: <20241212144253.511169641@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Francesco Dolcini commit 32c4514455b2b8fde506f8c0962f15c7e4c26f1d upstream. Wait for the command transmission to be completed in the DSI transfer function polling for the dc_start bit to go back to idle state after the transmission is started. This is documented in the datasheet and failures to do so lead to commands corruption. Fixes: ff1ca6397b1d ("drm/bridge: Add tc358768 driver") Cc: stable@vger.kernel.org Signed-off-by: Francesco Dolcini Reviewed-by: Neil Armstrong Link: https://lore.kernel.org/r/20240926141246.48282-1-francesco@dolcini.it Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20240926141246.48282-1-francesco@dolcini.it Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/bridge/tc358768.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/bridge/tc358768.c +++ b/drivers/gpu/drm/bridge/tc358768.c @@ -124,6 +124,9 @@ #define TC358768_DSI_CONFW_MODE_CLR (6 << 29) #define TC358768_DSI_CONFW_ADDR_DSI_CONTROL (0x3 << 24) +/* TC358768_DSICMD_TX (0x0600) register */ +#define TC358768_DSI_CMDTX_DC_START BIT(0) + static const char * const tc358768_supplies[] = { "vddc", "vddmipi", "vddio" }; @@ -227,6 +230,21 @@ static void tc358768_update_bits(struct tc358768_write(priv, reg, tmp); } +static void tc358768_dsicmd_tx(struct tc358768_priv *priv) +{ + u32 val; + + /* start transfer */ + tc358768_write(priv, TC358768_DSICMD_TX, TC358768_DSI_CMDTX_DC_START); + if (priv->error) + return; + + /* wait transfer completion */ + priv->error = regmap_read_poll_timeout(priv->regmap, TC358768_DSICMD_TX, val, + (val & TC358768_DSI_CMDTX_DC_START) == 0, + 100, 100000); +} + static int tc358768_sw_reset(struct tc358768_priv *priv) { /* Assert Reset */ @@ -507,8 +525,7 @@ static ssize_t tc358768_dsi_host_transfe } } - /* start transfer */ - tc358768_write(priv, TC358768_DSICMD_TX, 1); + tc358768_dsicmd_tx(priv); ret = tc358768_clear_error(priv); if (ret)