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 76A571AB6F8; Wed, 20 Nov 2024 12:59:28 +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=1732107568; cv=none; b=u0+2hNefGKjGqI3V2610fBujYoDddYguLMiOs82+IfFvPrKd+5a+RCF8v/nlXmnU9kpuVl38IVVNclQoXdxgiz79K0mwhjdp7hyPEKIcgVdOb6x4cGjYgswyDhaofm1nyAayc6RhDkjpVHLxKN6Kt7znOLf+aYT2Sl3ZVbAdwcM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732107568; c=relaxed/simple; bh=iE4sq2GWaJLTXW20rNg4IotZ4DvvH3U0axHW1G9+dCQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UsdmmMwXwkFQngOnWmiXaf9oRWKU1VEBAuDjrQ+dxjlHmE0saOgwF6Q8y9b4xtrHs2gjDctCSAxQ1qvn0HDgwy7MNZOq+NOOXm9zpzwHnnh6kEB0R9UHk34zVe8peSz68KpE5gA1MP9Jz3oey91BUwEpsW7CP3YG/D8law7V3ew= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oxAkndmA; 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="oxAkndmA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EC71C4CED6; Wed, 20 Nov 2024 12:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1732107568; bh=iE4sq2GWaJLTXW20rNg4IotZ4DvvH3U0axHW1G9+dCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oxAkndmAhBUsG+OFUSwzRKasTckmWmvzb/RkjRHfn4dhEvvW4XzCibjerfVT9uGIe fIyiQhQO5pFgT6krSi3FJOx0sKteTWhG/PZw6s9jYMU5JF4ealhvMgJPqv7h9BDBRf YiFKXVxZ+UsefwzqH5nWSGY0Bb6czsV/Ymua36Mw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Francesco Dolcini , Neil Armstrong Subject: [PATCH 6.11 083/107] drm/bridge: tc358768: Fix DSI command tx Date: Wed, 20 Nov 2024 13:56:58 +0100 Message-ID: <20241120125631.560728076@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241120125629.681745345@linuxfoundation.org> References: <20241120125629.681745345@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.11-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 @@ -125,6 +125,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" }; @@ -229,6 +232,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 */ @@ -516,8 +534,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)