From patchwork Thu Aug 31 18:17:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 719634 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51433C83F2F for ; Thu, 31 Aug 2023 18:18:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244692AbjHaSSM (ORCPT ); Thu, 31 Aug 2023 14:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242148AbjHaSSM (ORCPT ); Thu, 31 Aug 2023 14:18:12 -0400 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 825E8E5F for ; Thu, 31 Aug 2023 11:18:09 -0700 (PDT) Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 293E480702; Thu, 31 Aug 2023 20:18:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1693505888; bh=SSyy5p6GBLWM4WJD7NXGqgc/zib0LYrCgS3OTnqMioU=; h=From:To:Cc:Subject:Date:From; b=CPXh4FbxZ0i/RKRclYd94/I8Y8icAJKBpLeOGnjhQFMraWtWdoR/OIfVInJi5rix+ R0jYcY4Z/6QvRRP8dLX3+oMiUjGsJJvtdYlHvW7b2rb9wyO2lvSC+mfYEecbp9YtDU kIxs69wwvspBDaxJblvJbloNY0R+DJqMdpJQMlv2geFvEYGU/1jDPWTgCz4ItrzMfh UjHMy4D7nxCMWued6MGi1/E5uPuUejBg5F7nZRrEsjDYUJxNpxd3chobvIPcl3WF9x cRN61z00ipY7X72MNaxibiz6F2nhfPEIVCgt/2l5wSXV90cXM0ounNI0s3tGqQaCF1 Xtu5PT+kY3Qnw== From: Marek Vasut To: linux-i2c@vger.kernel.org Cc: Marek Vasut , Peter Rosin , Wolfram Sang Subject: [PATCH 1/2] i2c: mux: pca954x: Make sure the mux remains configured the same as before resume Date: Thu, 31 Aug 2023 20:17:52 +0200 Message-Id: <20230831181753.154787-1-marex@denx.de> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The current implementation of pca954x_init() rewrites content of data->last_chan which is then populated into the mux select register. Skip this part, so that the mux is populated with content of data->last_chan as it was set before suspend. This way, the mux state is retained across suspend/resume cycle. Fixes: e65e228eb096 ("i2c: mux: pca954x: support property idle-state") Signed-off-by: Marek Vasut --- Cc: Peter Rosin Cc: Wolfram Sang Cc: linux-i2c@vger.kernel.org --- drivers/i2c/muxes/i2c-mux-pca954x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c index 2219062104fbc..97cf475dde0f4 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c @@ -620,9 +620,9 @@ static int pca954x_resume(struct device *dev) struct pca954x *data = i2c_mux_priv(muxc); int ret; - ret = pca954x_init(client, data); + ret = i2c_smbus_write_byte(client, data->last_chan); if (ret < 0) - dev_err(&client->dev, "failed to verify mux presence\n"); + dev_err(&client->dev, "failed to restore mux state\n"); return ret; }