From patchwork Wed Dec 20 08:28:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 181528 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2494860dyi; Wed, 20 Dec 2023 00:30:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+tQ+99i+7WObn19BjZabZyRjylFGYOYvxyxlVMMUSy/XigD3zgHdRMr2pHm2sdPtWWnO/ X-Received: by 2002:a05:6a00:9389:b0:6d5:d6c1:6379 with SMTP id ka9-20020a056a00938900b006d5d6c16379mr3287814pfb.47.1703061010355; Wed, 20 Dec 2023 00:30:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703061010; cv=none; d=google.com; s=arc-20160816; b=M81CmMslJiGN84Ojys5ub7Dald0kntQmbtiUbuzvNEhxSc48jLD1xXEnGdI4xcNZr3 B6f6Id+OFJIoZ3qX9b9Zyhr0bhFfMVFf2Pc19akZhOlNNGw+nyhKWzM7dXuS1ubEaOk/ W4oCPxSnkAzeEnPC+bOQseI8Qw+HAdap7z9qORIf519UQ9lfPoG1pV3Voq/veGhfhQSc 7l35zKBlQ1Nrq37sduKh411n4FGdZuiiPoJHFndM2/34fw1vzW+WJM94JLYeqoDE+DI9 RqWBl55ajmcfrwspR+E47PFH39Nq4vVJk1Nm6/RZOLhuko4f4b5KiKqmdR48UQh7aqAA yOwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Pnge+1KVjVw+sI86vmpy7qUzgDU254VIm7qUPhyPlKQ=; fh=CuA3e7TIJAx20sUC+9/civ42qQ0M4HxBJLaicSklPa8=; b=NkrqHkux/89gTycb+X8Qy1xRdGHW1uWjDqT6NQkzRalQmd/EDbIuWVKW9QNkXE9gxo rIfSv8fPDG+2FWAsYzJXW1Iss4Q46m6/pb6QrxZ8JHYAbK8Bj92rsYrMnzA+JjKDK8nn mceDqMAHra4f2t1jJE+sHtZ25mKp+Wql8pJZhzfs1cenKbqEOLSUMTfl/4d8DWvVLjrl z9lEo0EJbdpdnp139uMPyJ7KpKIKSFFPzyPuKlyOtDONST2bxX0O0BI6oWmasGx/02ZO 3UR4ZYxAxjkKYl0iLScFeZysD5uk54Ri9BJr3HPyTHkI15nGXdBHZzXypyAsgVh4pfCk 3ZSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=MZrQwlO3; spf=pass (google.com: domain of linux-kernel+bounces-6570-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6570-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id fm22-20020a056a002f9600b006d38c94f324si907753pfb.362.2023.12.20.00.30.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:30:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6570-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=MZrQwlO3; spf=pass (google.com: domain of linux-kernel+bounces-6570-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6570-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6AF7EB25C02 for ; Wed, 20 Dec 2023 08:29:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08DA51DA56; Wed, 20 Dec 2023 08:28:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=9elements.com header.i=@9elements.com header.b="MZrQwlO3" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A74741CF8F for ; Wed, 20 Dec 2023 08:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=9elements.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=9elements.com Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-552fba34d69so5190331a12.3 for ; Wed, 20 Dec 2023 00:28:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1703060888; x=1703665688; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Pnge+1KVjVw+sI86vmpy7qUzgDU254VIm7qUPhyPlKQ=; b=MZrQwlO3xukNXXNfYYdSjx8yDcUF3KcGglmtgTF3x+FXcAsgBVFQ0Xd5mDVD8PPcNr ZvDdjY+JgdhUZXxo20rXlqi8MWUK1fCDGjEoLw9yoZ90bqFwHBP6bBiekqvmNGCT17KS umQtaN+tT+uZY9sR4XGVETWOf0xiuccHI+niiwQVnsmVxwD9hIUOtGaqGQxeMQ7RlArS xZD7iIwBaDZoaZRJ/QbwdjkGd1ESJgaJ1LxtO3trdkYm5Bva3hjk1HeDXjUyxofyIOai 0kVhWk23qT5VHrDfBCU27+9RZcBJtWmZQ7qeAiysyuXY0ifB5knb7uCIuJS5EuJr54nd 4H6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703060888; x=1703665688; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Pnge+1KVjVw+sI86vmpy7qUzgDU254VIm7qUPhyPlKQ=; b=xDeMVEGX9CifvZ/9C7BQJzGmFKTQa4T4DQwUg3nD/CfcJWLXUvHydX5tI+R9S16vHD IHJVOG4wrQiqy02GcmQ1SOTaE0X6Cffrjpl4wa+EX9pGJ2myxYyrF2Ne2Bbu1yVS8l5k /xmCOdGQh1o695CXiyEpkAGvbJp2y5pIHJH/DWfTki9z437thm5Gbhwyl0nQckunSVH4 y/2QO15P3fBnDHwaEsZyETYPbiMdVoEzKPRUlAIqLu8ck8YHWrrQEilrji/14pH8T0RV pCELMhjP9BGWQz/hHLv6auOB+9fFjNErMOAmlGOhn0BXgPN+wh9ExQ9jMerj8ZR3Uzot a3fQ== X-Gm-Message-State: AOJu0YxU0vKfZ7mSh3d5gmbViwB7p2VObuJYz0jBYFn5BMjMZCVifQfg 8YG78jcS2PNMAjCY24//5+PoccnKLF7Tt9pejdB5eQ== X-Received: by 2002:a17:906:c784:b0:a23:3621:a542 with SMTP id cw4-20020a170906c78400b00a233621a542mr3111987ejb.108.1703060887793; Wed, 20 Dec 2023 00:28:07 -0800 (PST) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id s20-20020a170906bc5400b00a26965e4caesm334778ejv.43.2023.12.20.00.28.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:28:07 -0800 (PST) From: Naresh Solanki To: Peter Rosin , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Laurent Pinchart Cc: Patrick Rudolph , Naresh Solanki , Rob Herring , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH v5 1/2] dt-bindings: i2c: pca954x: Add custom properties for MAX7357 Date: Wed, 20 Dec 2023 13:58:01 +0530 Message-ID: <20231220082803.345153-1-naresh.solanki@9elements.com> X-Mailer: git-send-email 2.41.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785788901713528497 X-GMAIL-MSGID: 1785788901713528497 From: Patrick Rudolph Maxim Max7357 has a configuration register to enable additional features. These features aren't enabled by default & its up to board designer to enable the same as it may have unexpected side effects. These should be validated for proper functioning & detection of devices in secondary bus as sometimes it can cause secondary bus being disabled. Add booleans for: - maxim,isolate-stuck-channel - maxim,send-flush-out-sequence - maxim,preconnection-wiggle-test-enable Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki Reviewed-by: Rob Herring --- Changes in V4: - Drop max7358. Changes in V3: - Update commit message Changes in V2: - Update properties. --- .../bindings/i2c/i2c-mux-pca954x.yaml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) base-commit: 76998e5bcdf155b36c7066808a0a65b2ee13cb2a diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml index 2d7bb998b0e9..9aa0585200c9 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml @@ -71,6 +71,23 @@ properties: description: A voltage regulator supplying power to the chip. On PCA9846 the regulator supplies power to VDD2 (core logic) and optionally to VDD1. + maxim,isolate-stuck-channel: + type: boolean + description: Allows to use non faulty channels while a stuck channel is + isolated from the upstream bus. If not set all channels are isolated from + the upstream bus until the fault is cleared. + + maxim,send-flush-out-sequence: + type: boolean + description: Send a flush-out sequence to stuck auxiliary buses + automatically after a stuck channel is being detected. + + maxim,preconnection-wiggle-test-enable: + type: boolean + description: Send a STOP condition to the auxiliary buses when the switch + register activates a channel to detect a stuck high fault. On fault the + channel is isolated from the upstream bus. + required: - compatible - reg @@ -95,6 +112,19 @@ allOf: "#interrupt-cells": false interrupt-controller: false + - if: + not: + properties: + compatible: + contains: + enum: + - maxim,max7357 + then: + properties: + maxim,isolate-stuck-channel: false + maxim,send-flush-out-sequence: false + maxim,preconnection-wiggle-test-enable: false + unevaluatedProperties: false examples: From patchwork Wed Dec 20 08:28:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 181527 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2494538dyi; Wed, 20 Dec 2023 00:29:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhSX+7SxEDsaKuhykdbC3QMkrywU3NkiPA+pwiGSu2T8sazUj3dKi5tJrs4L8Xvn/o6gmy X-Received: by 2002:a17:907:9910:b0:a1f:5d99:fd1f with SMTP id ka16-20020a170907991000b00a1f5d99fd1fmr8994817ejc.128.1703060951072; Wed, 20 Dec 2023 00:29:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703060951; cv=none; d=google.com; s=arc-20160816; b=kvCiCl9QGwpYHWJvxs9PClTbPLNAAi8b7DnYdJ4RE52Zm8Nh4jwqJQVo7x265GM6cx HB1D8NOM2C/QBDwg/WVMFgx3G7cqUrpvwG3JEp5bSpR7oM68vao8BtUFhnavmpXKWVrC 7q9cgGnWWPu7Mi68b8GbMtd1FoZTtMA80IUqNkZCmF+gyjTtxtmmeH8uGF5RfYgTGKTj rBckzsj3gMjVQ9qbLilexHlBxrRzYdFQNY0QMeX3gB1ZNYm0hYzpX22KiTc/7rVIAIwV j8SwzfPvz+uW2wmh/W53SpowUg50vHVIW6y3uH9tUyrCXDugkqjPoMRDnvvcc1K+Xy/k xcUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=fsZ/9HB6yqurIFZ++8sH/zT31UdGeaTqC79G9+iRJHI=; fh=JTJ3G4p8sqAKk/6d5cSR9ApBg0xV1RfiDmBUkxSplto=; b=NUV3v51H2CIrH1iEZLHlIjIpwzIJnJcFy5TGqJYARJySuDZi9s6hgD9veDIti1+11q FnnJ3uSuG2Ybne3cKRTAdyp1QBq5nIbzt9We3U/bRUWn+8urWAycKlO8AC5fP/Vh1uX+ tsPes0Ul+VIY8SYXn3hoUDwcM2YAb547nvba41CxRrDlbNFfxOB+s6wBoAPb6gTwy/wM MDsxwpAxNCNErQ8d9cnsJ6LZio6y/YPyqqPtdXQ+uCEu3lmsi7eGET2FHEMjx5dseOXE afX9j6ODyhDnG+uuW37x+4f9r7CKjNLKueV0fABBb8gE2IW8SaZf1JBJU6cmAEMmCHYa AcJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=TnYbtwfb; spf=pass (google.com: domain of linux-kernel+bounces-6571-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6571-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u7-20020a17090617c700b00a197ea73226si11506994eje.44.2023.12.20.00.29.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:29:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6571-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=TnYbtwfb; spf=pass (google.com: domain of linux-kernel+bounces-6571-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6571-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AAB4C1F26884 for ; Wed, 20 Dec 2023 08:29:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33B1D1EA78; Wed, 20 Dec 2023 08:28:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=9elements.com header.i=@9elements.com header.b="TnYbtwfb" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0C571D120 for ; Wed, 20 Dec 2023 08:28:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=9elements.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=9elements.com Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a1915034144so629942066b.0 for ; Wed, 20 Dec 2023 00:28:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1703060889; x=1703665689; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fsZ/9HB6yqurIFZ++8sH/zT31UdGeaTqC79G9+iRJHI=; b=TnYbtwfbauuNmhGkedlV5XQIWbDJ9dFObg4f/+uioRFOHLJ33aZxnEUpaPeNkP+U22 9WBqnKkVyU/jwM7fx0BdvllAgbTRb5a2zRBXeHZmECSMrvMERrcc9vPuG1lRoEceehRB 4UkLbV0Un+X8bG20OFCxfQJ4I3h/lWrvG5sP4b3z0dUfsVg+PBWUj3Vrtv/07HQeoy56 seahj64Ch79Xl6pxJVQGXofcI96D/gwd8TO8A5/3Q8muTnp6rcftzdVoPvNl5d0KMYcH eqxi/WEmVXj/kcIkj/QD+jpdDOfHheboXsCjoP7AU1cZ/AQ+Uq3asDnBwH5HaKL3SBcB q+VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703060889; x=1703665689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fsZ/9HB6yqurIFZ++8sH/zT31UdGeaTqC79G9+iRJHI=; b=PszdgKdnRaj4tKJg7wq9ENiPvnOKEmc4MU7uypeJUTl2gDVsxkNi08h3QHpn1oH7fV BNyVbTQFznwbkf/XRkcBFdOlQWQ1svZVcBlHPX86SyoCMV67/nz6XtTW+WpgcVGZX5v5 hFpppd/7FlR1U9lDUgLVO8KwDykBelssHoN6ocDwk/X5rT5XMe81NauTBrUqArLWPpe2 ODs7M1s9/K2eCi5E2tQ8PVhkT48/xzWi0j4CT4AJ9vxKcyjIfTy7NK0TQkRhMYItMJjI jFsJm3ofz7XFFEQ5F/JCg+MsEjwjaTzkB09NtSYJpoUvEjpnJJV+fOSRWvT8BFneudcI vyBg== X-Gm-Message-State: AOJu0YyzLWv1tPS+O6UNHkRvb5hlnYqHTfAog6+HmUXGTygwk1D3z3vc Vy1smeOP+VOajEM+sFZkAxrdgA== X-Received: by 2002:a17:906:2085:b0:a1b:714f:c59d with SMTP id 5-20020a170906208500b00a1b714fc59dmr9868165ejq.30.1703060889101; Wed, 20 Dec 2023 00:28:09 -0800 (PST) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id s20-20020a170906bc5400b00a26965e4caesm334778ejv.43.2023.12.20.00.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:28:08 -0800 (PST) From: Naresh Solanki To: Peter Rosin Cc: Patrick Rudolph , Naresh Solanki , Andi Shyti , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH v5 2/2] i2c: muxes: pca954x: Enable features on MAX7357 Date: Wed, 20 Dec 2023 13:58:02 +0530 Message-ID: <20231220082803.345153-2-naresh.solanki@9elements.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220082803.345153-1-naresh.solanki@9elements.com> References: <20231220082803.345153-1-naresh.solanki@9elements.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785788840103904809 X-GMAIL-MSGID: 1785788840103904809 From: Patrick Rudolph Enable additional features based on DT settings and unconditionally release the shared interrupt pin after 1.6 seconds and allow to use it as reset. These features aren't enabled by default and it's up to board designer to validate for proper functioning and detection of devices in secondary bus as sometimes it can cause secondary bus being disabled. Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki Reviewed-by: Andi Shyti --- Changes in V5: - Fix typos - Update comment - Add newline in dev_warn Changes in V4: - Drop max7358 - Update #define - Move conf variable - Print warning when I2C_FUNC_SMBUS_WRITE_BYTE_DATA isn't supported Changes in V3: - Delete unused #define - Update pca954x_init - Update commit message Changes in V2: - Update comments - Update check for DT properties --- drivers/i2c/muxes/i2c-mux-pca954x.c | 43 ++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c index 2219062104fb..f5dfc33b97c0 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c @@ -57,6 +57,20 @@ #define PCA954X_IRQ_OFFSET 4 +/* + * MAX7357's configuration register is writeable after POR, but + * can be locked by setting the basic mode bit. MAX7358 configuration + * register is locked by default and needs to be unlocked first. + * The configuration register holds the following settings: + */ +#define MAX7357_CONF_INT_ENABLE BIT(0) +#define MAX7357_CONF_FLUSH_OUT BIT(1) +#define MAX7357_CONF_RELEASE_INT BIT(2) +#define MAX7357_CONF_DISCON_SINGLE_CHAN BIT(4) +#define MAX7357_CONF_PRECONNECT_TEST BIT(7) + +#define MAX7357_POR_DEFAULT_CONF MAX7357_CONF_INT_ENABLE + enum pca_type { max_7356, max_7357, @@ -470,7 +484,34 @@ static int pca954x_init(struct i2c_client *client, struct pca954x *data) else data->last_chan = 0; /* Disconnect multiplexer */ - ret = i2c_smbus_write_byte(client, data->last_chan); + if (device_is_compatible(&client->dev, "maxim,max7357")) { + if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + u8 conf = MAX7357_POR_DEFAULT_CONF; + /* + * The interrupt signal is shared with the reset pin. Release the + * interrupt after 1.6 seconds to allow using the pin as reset. + */ + conf |= MAX7357_CONF_RELEASE_INT; + + if (device_property_read_bool(&client->dev, "maxim,isolate-stuck-channel")) + conf |= MAX7357_CONF_DISCON_SINGLE_CHAN; + if (device_property_read_bool(&client->dev, + "maxim,send-flush-out-sequence")) + conf |= MAX7357_CONF_FLUSH_OUT; + if (device_property_read_bool(&client->dev, + "maxim,preconnection-wiggle-test-enable")) + conf |= MAX7357_CONF_PRECONNECT_TEST; + + ret = i2c_smbus_write_byte_data(client, data->last_chan, conf); + } else { + dev_warn(&client->dev, "Write byte data not supported." + "Cannot enable enhanced mode features\n"); + ret = i2c_smbus_write_byte(client, data->last_chan); + } + } else { + ret = i2c_smbus_write_byte(client, data->last_chan); + } + if (ret < 0) data->last_chan = 0;