Message ID | 20231005134541.947727-2-naresh.solanki@9elements.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp333109vqb; Thu, 5 Oct 2023 07:22:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWy12uNgD52Pmd5khxTnQCOcvbb83jUT/cMThuU3sx9SnNwbh6q1UPbUKFXDvm0mCXajLR X-Received: by 2002:a17:90b:1a8c:b0:271:9237:a07f with SMTP id ng12-20020a17090b1a8c00b002719237a07fmr5453590pjb.32.1696515739133; Thu, 05 Oct 2023 07:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696515739; cv=none; d=google.com; s=arc-20160816; b=NXivX6TQB01CIO36QK3H2QBZC41EQmsgL/GklIyInS2RFT4sjwU6+bzyWcGxpDmgLi U6DqCC6CYz/nOBQ+gMVmKMHET5m1JTCbmGMDJjo6zwOF7/SEgvEY4V6p0HUKeSIsDeuY +RvOal8PQ10mHNOuvbRkvGFbIY8qST2TW0s2neJJngkn1/+tSfuj328mfcEGxIrxLW2Q CQocDRye0kac3nk573X+4nWVeOmFgvy6bPoYQOQg7w6Uc2Sz/3jHNAU2Id7BcfmcLjDk 4MjI2aVGoDO8Gz3NbXBUN0AgHhmrsgduleEdznQ9LLQCkcWLJ7GbvU79xMGyMLxPHGFx yJAQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rBNNqrHa2yEgalSP+O5HBVONjN/jujiaMQ0nBzAx80Q=; fh=dziCoGOK45IxncPyCEt5KIp8QEF+WH1/OwO8MRo89q4=; b=g80g63M4o5BGX1lpSfWztwd6BIe6OVzUvx3awa88xLvYhStfuM5of07SA5voQ6vfrD gu8+6gdvHE3iL4H7lIttSRmA8XZWEOIZ+B6jPAOY+ZLV1RPiyXVzpLfpSpukmrrcQm4b Vk8RTDeOl8xkpke0cm1Ui0fcd6cgxEyGfqrFwKvGBbPtN/pZzYdaWjlZ3WUgFonQXc8x LB4UDrOEVj+9TkLcbm7Bhhsvf6da3jog5tcXsmrXrVU98Jxih4FDlywGS6+Oo3mwfwq6 /rzlS0hy7oQSPnnjG9vLzY+bDYQSiZuPgZgMfZAsKPMq3ApJWv0DbFjHp0xLPViaL+VB AgYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=cTG7cnIz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id bj18-20020a17090b089200b0026961fdd37bsi1672343pjb.97.2023.10.05.07.22.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:22:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=cTG7cnIz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id DF63B818594B; Thu, 5 Oct 2023 07:21:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233685AbjJEOUZ (ORCPT <rfc822;ezelljr.billy@gmail.com> + 19 others); Thu, 5 Oct 2023 10:20:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233766AbjJEOSm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 5 Oct 2023 10:18:42 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C831B2812D for <linux-kernel@vger.kernel.org>; Thu, 5 Oct 2023 06:45:47 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-32157c8e4c7so1008666f8f.1 for <linux-kernel@vger.kernel.org>; Thu, 05 Oct 2023 06:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1696513546; x=1697118346; 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=rBNNqrHa2yEgalSP+O5HBVONjN/jujiaMQ0nBzAx80Q=; b=cTG7cnIzvKHOhK0kwfVA9Y7CLfmjOXRwT/M+qp64BaXVK5NNBP9Ix9qCmvQOhhy7Ho zmu4FDrEVY6p++aHNcRyGwQ8fMYehcZQ84Z1Wv7chKWwvGV5d7aAqYODr4dktMxZAZxS 1Xj7bBHncvsIM6yZZlxLZUF0jpQc+SXoGD/RcoXoreHQC97CbyBeB0Q5Jb6pgwbPF42v IsJgSCCA25RB9doZAxPnBWF/oMoz7Bkm1h7dJSIaBDhoKa8tzDPHh/TNWYA2Fwe+NUmR 3j3oE1egSXmSCcWpVBlW6TYAlsCWHjyiy3G9hntgJfgGWCA2qygFdVN17SWK/PT6v7+m UIBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696513546; x=1697118346; 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=rBNNqrHa2yEgalSP+O5HBVONjN/jujiaMQ0nBzAx80Q=; b=U7pf1xYd+uMWOXf8CiNlMePIb6YCF/yF844gqvWbYy1+BuOqvI8f+AoiSk17O1iqSl 2IjO1YUR3fHb7OCMuyYqHvAEmlEbkXYpx7+D4INz/HfDkn6jKBUwPpAAsZEQt1OsWHHu +0kWYhY9w7FbAm0Uuu3+Su39xakl3L/l2wmfGBHfpRqb/+jxnhEvKQD3vmEOzbXG+KMH /o660gCf6N3bkIVQiKXYYjQaEcXc+FJbRsqMQuAsKG1rS8oCePcsp7XC6lVXh5WKwdze xIZZnLvurouY87s4OXECMM19g5fnSUnbQTZT8M0sBxOlkfGvqEpyG/Gyt126Yrgluhzr VQyg== X-Gm-Message-State: AOJu0YwZPLiadA6sXO8ETnYmkfTgH5t4H/d4NXpGVSswJk35Ml92iojx NWBL4ON+4/ULcZU0XGT8KV1d1w== X-Received: by 2002:a5d:4990:0:b0:320:a16:7028 with SMTP id r16-20020a5d4990000000b003200a167028mr5185033wrq.31.1696513546176; Thu, 05 Oct 2023 06:45:46 -0700 (PDT) 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 d7-20020adfef87000000b0032326908972sm1840961wro.17.2023.10.05.06.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 06:45:45 -0700 (PDT) From: Naresh Solanki <naresh.solanki@9elements.com> To: Peter Rosin <peda@axentia.se> Cc: Patrick Rudolph <patrick.rudolph@9elements.com>, Naresh Solanki <naresh.solanki@9elements.com>, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/2] i2c: muxes: pca954x: Enable features on MAX7357 Date: Thu, 5 Oct 2023 15:45:40 +0200 Message-ID: <20231005134541.947727-2-naresh.solanki@9elements.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231005134541.947727-1-naresh.solanki@9elements.com> References: <20231005134541.947727-1-naresh.solanki@9elements.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:21:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778925687514172919 X-GMAIL-MSGID: 1778925687514172919 |
Series |
[v4,1/2] dt-bindings: i2c: pca954x: Add custom properties for MAX7357
|
|
Commit Message
Naresh Solanki
Oct. 5, 2023, 1:45 p.m. UTC
From: Patrick Rudolph <patrick.rudolph@9elements.com> 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 & 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. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> --- 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 | 44 ++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)
Comments
Hi Patrick, On Thu, Oct 05, 2023 at 03:45:40PM +0200, Naresh Solanki wrote: > From: Patrick Rudolph <patrick.rudolph@9elements.com> > > 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 & its up to board designer /&/and/ /its/it's/ > to enable the same as it may have unexpected side effects. which side effects? > These should be validated for proper functioning & detection of devices /&/and/ it ain't WhatsApp :-) > in secondary bus as sometimes it can cause secondary bus being disabled. Is this latest sentence a related to this patch or is it a free information? > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> > Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> [...] > 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. > + * The interrupt isn't serviced yet. > + */ > + conf |= MAX7357_CONF_RELEASE_INT; This setting comes as default, what about the dedicated reset gpio pin? How is the driver going to understand whether from the irq pin is coming a reset or an interrupt? > + 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; How are these properties affecting the economy of the driver? Can we have a brief description? Andi
Hi! 2023-10-05 at 15:45, Naresh Solanki wrote: > From: Patrick Rudolph <patrick.rudolph@9elements.com> > > 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 & 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. > > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> > Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> > --- > 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 | 44 ++++++++++++++++++++++++++++- > 1 file changed, 43 insertions(+), 1 deletion(-) > > diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c > index 2219062104fb..f37ce332078c 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,35 @@ 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. > + * The interrupt isn't serviced yet. I'd suggest dropping the word "yet". The interrupt isn't serviced for max7357, period. The "yet" in combination with that 1.6 second window is a bit cunfusing and readers might think that the interrupt is serviced at some later stage or something, when I think the intention of "The interrupt isn't serviced yet" comes with the silent implication that it is simply not implemented yet. > + */ > + 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 not supported. Cannot enable enhanced mode features"); Missing \n at the end of the string. Cheers, Peter > + 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; >
Hi again! [sorry for replying to self] 2023-10-06 at 09:46, Peter Rosin wrote: > 2023-10-05 at 15:45, Naresh Solanki wrote: >> From: Patrick Rudolph <patrick.rudolph@9elements.com> >> ... >> + dev_warn(&client->dev, >> + "Write byte not supported. Cannot enable enhanced mode features"); > > Missing \n at the end of the string. > Also, I2C_FUNC_SMBUS_WRITE_BYTE is separate from I2C_FUNC_SMBUS_WRITE_BYTE_DATA, which makes that "Write byte" misleading. Cheers, Peter
Hi Andi, On Fri, 6 Oct 2023 at 04:30, Andi Shyti <andi.shyti@kernel.org> wrote: > > Hi Patrick, > > On Thu, Oct 05, 2023 at 03:45:40PM +0200, Naresh Solanki wrote: > > From: Patrick Rudolph <patrick.rudolph@9elements.com> > > > > 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 & its up to board designer > > /&/and/ > /its/it's/ Ack > > > to enable the same as it may have unexpected side effects. > > which side effects? > > > These should be validated for proper functioning & detection of devices > > /&/and/ > > it ain't WhatsApp :-) Ack > > > in secondary bus as sometimes it can cause secondary bus being disabled. > > Is this latest sentence a related to this patch or is it a free > information? Its related to the potential side effect of the feature if enabled. > > > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> > > Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> > > [...] > > > 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. > > + * The interrupt isn't serviced yet. > > + */ > > + conf |= MAX7357_CONF_RELEASE_INT; > > This setting comes as default, what about the dedicated reset > gpio pin? How is the driver going to understand whether from the > irq pin is coming a reset or an interrupt? As per datasheet, RELEASE_INT bit in conf is cleared at poweron. The RST/INT is dual function pin. > > > + 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; > > How are these properties affecting the economy of the driver? Can > we have a brief description? Not sure what you mean. Are you asking for impact on the driver or feature description ? Note: These are chip features & this patch is intended to enable them based on DT settings. Regards, Naresh > > Andi
Hi On Fri, 6 Oct 2023 at 13:16, Peter Rosin <peda@axentia.se> wrote: > > Hi! > > 2023-10-05 at 15:45, Naresh Solanki wrote: > > From: Patrick Rudolph <patrick.rudolph@9elements.com> > > > > 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 & 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. > > > > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> > > Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> > > --- > > 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 | 44 ++++++++++++++++++++++++++++- > > 1 file changed, 43 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c > > index 2219062104fb..f37ce332078c 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,35 @@ 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. > > + * The interrupt isn't serviced yet. > > I'd suggest dropping the word "yet". The interrupt isn't serviced for > max7357, period. The "yet" in combination with that 1.6 second window is > a bit cunfusing and readers might think that the interrupt is serviced > at some later stage or something, when I think the intention of "The > interrupt isn't serviced yet" comes with the silent implication that it > is simply not implemented yet. Sure. > > > + */ > > + 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 not supported. Cannot enable enhanced mode features"); > > Missing \n at the end of the string. Sure. Will also update it as 'Write byte data not supported. Cannot enable enhanced mode features\n' Regards, Naresh > > Cheers, > Peter > > > + 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; > >
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c index 2219062104fb..f37ce332078c 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,35 @@ 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. + * The interrupt isn't serviced yet. + */ + 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 not supported. Cannot enable enhanced mode features"); + 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;