Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp389110rdb; Thu, 5 Oct 2023 08:46:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHT7ciC1Vam79bBXfjQ9vexh4Xm5wPU5vSCUOwjS5lOLz3uI+FsA3kmT5hqhMwMxvuYLzjX X-Received: by 2002:a17:903:41d2:b0:1c7:71d2:a96a with SMTP id u18-20020a17090341d200b001c771d2a96amr6395981ple.12.1696520766275; Thu, 05 Oct 2023 08:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696520766; cv=none; d=google.com; s=arc-20160816; b=Lfuhywt4GficZlyHLKnIfAR4f5xL2U8kjpz2jys6ndmXu3ejBGjionciaKaoDtq5gX N2lpflEcUDcRiJZRk8YUjudWJygygbNc9Q+zPMmGRaQzy6FM933rAR630wQcjhmhXnf4 a3X29wmf8ZS2VLkxR3LhNKpTiZQ5mvMQeMZa3QuX4uJ4AZN2Lp80BP5NNcnXHFd6eLIp VM7h+ubD4TqLJT1VBSk6j0+PWJkb2JNwrZ3opjN2Hdx7kO4Aj+eD6GAce7PqgSkX89mo TyRN9L1HNtNrjoqQ5RTznE+uykXTR3stWG7dhXs4qebYvGPw8XuhbGL/pwfsXl0f0MH0 INMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=IDS4naPGQ1FxN0B/REXVrwAINqUy2DgeZ+fVL1m8k2o=; fh=dOm26d9WdwdXzbLIJs1gP/Nz3sQ32tWN9JaCg2IU+7Q=; b=URB++KACNYgsNkv5CxokvWqdrx2bxQtuPYqLUi3xP3oyQKUuH4bBzKwHxxKHOjBs2P 7GoQHkvuN6ct05L5vDWtWuWFOuWlsJX85EK30QU17VWlEH5hJ5GvftJwbkjCjLUtolNE vYitlD0nBtKo0kyoPNb68QttEeS64+xpNOQMyEkgzir2mqJO1JNIzZAWx1ROLhP+Oryw ASIeLD1QCMkR37rL4y/mbPin3Ck1nkqHHbYLza9NsCJsYyveEV0twUAAktfybcyqOC+I IJbjB8lS4x85/GcJHgmnyDYilaVliCLF5E57RpDBsPmlNzCnBjU6noQ6TsegbjT2gm7j OSsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=cggttsFn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b3-20020a170902d40300b001bf0e15c0a9si1586781ple.269.2023.10.05.08.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 08:46:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=cggttsFn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 83ECD8375CB2; Thu, 5 Oct 2023 08:45:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233905AbjJEPpQ (ORCPT + 99 others); Thu, 5 Oct 2023 11:45:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232943AbjJEPox (ORCPT ); Thu, 5 Oct 2023 11:44:53 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 125ED8A78 for ; Thu, 5 Oct 2023 01:33:42 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-27763c2c22eso475859a91.3 for ; Thu, 05 Oct 2023 01:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1696494821; x=1697099621; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IDS4naPGQ1FxN0B/REXVrwAINqUy2DgeZ+fVL1m8k2o=; b=cggttsFnCUTsEuuVbgzK+zamBA1LzeVLHMiEb72fq23GDIE0OljuPjI482iFp5EeQi mSQ7eVtYZJ6gEeQiUZkooJIxnZXxLkW678/ML/LRcX8Nq3nz08Wi3zrMEN1s5Dwve1Rv MGQv8OJl5WTI0dHofRtRVDUypQL0jIeS0B2fwUbRapfWEvecf6PGF0ChW1tXc7o67Zoj sfW76H6k1Fnl5CHHHTnYvhroPNXdBy4jrdi+kodafLXLtqum31/jacy3rajaw2q6M//A MAHc8cZ4/DSnR2pZOWuaKhG7xDSlLfSYY28SVAtOGqkoSY934xZpOI5r5N8jXL2e8aWV eudA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696494821; x=1697099621; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IDS4naPGQ1FxN0B/REXVrwAINqUy2DgeZ+fVL1m8k2o=; b=NIZu77jX0ilNDAISgeI/2A74tCR7s5EN/ObBtLwBudm5sL3mIVvI92JdlVJQiBNkMd dAvLIy9w6jfLlt8SYubpzWEZA+GnZQkXujkZ3PXcpe/zDTgaD000MD4PT21twLnLKbkV 4AMaGIGnbDxJh4JvBY2A2eDYd8goaWeVUX2Bi86RlkDLNK623YtPQuf36iV6+Uqsjyp/ HNwxInNPG1HJBOx81L6H+H+DP03NRExFVAkGQckFJqtcWUkMgJWRay8cLumXo3arsp0j RlpN7nJWgg4eP6qaUQg+TPMbW9cPfKOIbVSPYVAhaPceyw66PFfdycESKT9AIaabKf+X KC1g== X-Gm-Message-State: AOJu0Ywf+b396fnkelgF2/ObSQ/xu3hRzRIci6WzCWc+rVzVSQAlAzkW uqFp2el5fxeubZVJ6p4RdQd6HIV1e4oKmHRNoeP5lg== X-Received: by 2002:a17:90b:1056:b0:274:67d0:f57 with SMTP id gq22-20020a17090b105600b0027467d00f57mr3666854pjb.48.1696494821447; Thu, 05 Oct 2023 01:33:41 -0700 (PDT) MIME-Version: 1.0 References: <20230922093117.3030977-2-naresh.solanki@9elements.com> <8ec35702-54a7-ad6e-99c5-7ed49667c94b@axentia.se> In-Reply-To: <8ec35702-54a7-ad6e-99c5-7ed49667c94b@axentia.se> From: Naresh Solanki Date: Thu, 5 Oct 2023 14:03:30 +0530 Message-ID: Subject: Re: [RESEND PATCH v3 2/2] i2c: muxes: pca954x: Enable features on MAX7357/MAX7358 To: Peter Rosin Cc: Patrick Rudolph , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 05 Oct 2023 08:45:37 -0700 (PDT) Hi Peter, On Fri, 22 Sept 2023 at 16:02, Peter Rosin wrote: > > Hi! > > Sorry for being unresponsive... > > The subject, description and the bindings patch talk about MAX7358, but > since it not actually handled it is misleading for the subject to say > that features are enabled on MAX7358. Yes will remove reference to max7358. > > 2023-09-22 at 11:31, Naresh Solanki wrote: > > From: Patrick Rudolph > > > > Detect that max7357 is being used and run custom init sequence. > > 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. > > > > The init sequence is not run for max7358 that needs to be unlocked > > first, but that would need the unimplemented function > > i2c_probe_func_quick_write(). > > Is that correct? If that is all that missing, why is it not sufficient to > open-code it instead? > > i2c_smbus_xfer(client->adapter, client->addr, client->flags, > I2C_SMBUS_WRITE, 0, I2C_SMBUS_QUICK, NULL); will drop max7358 for now in this patch series. > > > > > Signed-off-by: Patrick Rudolph > > Signed-off-by: Naresh Solanki > > --- > > 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 | 38 ++++++++++++++++++++++++++++- > > 1 file changed, 37 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c > > index 2219062104fb..91c7c1d13c89 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) > > This define isn't used. Its indirectly used for default POR config. Will use it there. > > > +#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 BIT(0) > > + > > enum pca_type { > > max_7356, > > max_7357, > > @@ -463,6 +477,7 @@ static void pca954x_cleanup(struct i2c_mux_core *muxc) > > > > static int pca954x_init(struct i2c_client *client, struct pca954x *data) > > { > > + u8 conf = MAX7357_POR_DEFAULT_CONF; > > This line can be moved inside the block below handling max7357. The POR > default conf is not the same for max7358 anyway. Sure. > > > int ret; > > > > if (data->idle_state >= 0) > > @@ -470,7 +485,28 @@ 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") && > > + i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { > > I would have liked a message that any requested extra features cannot > be enabled if the chip happens to be connected to a bus not capable of > ...write_byte_data(). That might be plenty helpful for anybody who > happens to find themself in that hole... Sure will add that. > > > + /* > > + * 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 { > > + ret = i2c_smbus_write_byte(client, data->last_chan); > > + } > > + > > if (ret < 0) > > data->last_chan = 0; > > > > Would there be any point in configuring max7357 to be in basic mode? If the above features arent needed then basic mode will serve the purpose. > > Cheers, > Peter