Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp342110rbe; Thu, 29 Feb 2024 00:47:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWZpI9kBiDChwkJBVF2GDsZyO+oAMzswpglz1buYQY3PaQMA4ZdcNVt6gABvPLRSDlOhK6fCoXf47vmF+JHgDDvb3iAi9bZRMpKwY3qBA== X-Google-Smtp-Source: AGHT+IGxurAYjwJNXbt6u7qqlxpSnYFOXBzttRdWXxSGm7tTVDeEMryYaC1B73p+BFA3l+e2HMCe X-Received: by 2002:a05:6871:3413:b0:218:4be3:810a with SMTP id nh19-20020a056871341300b002184be3810amr1356362oac.37.1709196429025; Thu, 29 Feb 2024 00:47:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709196428; cv=pass; d=google.com; s=arc-20160816; b=rG7xRmqxWKpjiu+V3Y5RuAggnAVl95LvccIk4ziBKUWQcYE37DJHTnhw/yqEPHyCNd jJABUVwKRV8ZmifcOKN7PveBWdzwABeNNVg6WXxUxRV2YSWdBOUl8B6SlTnoc8ucwVt1 gYLPd3xI5TXgEQpcnMT4uj0Viw21lzpV9TQLNAfYTCWFZ1p7JMqJ7wPeC0dmXRhfx7vM H4SVyOKjoszlyu6j/44uM8kyjAr1WN1DAcpP8PqdqclUJAOOyM8TvaeDc0uGKtsqI7P/ /KM+pUTcNJrYm7QepbDiY3bpjIBgjTiHxN2vNJzcJN0hb+x30ojTfEBKXlW72Vo3td5r Y5eA== ARC-Message-Signature: i=2; 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=q9xUwc2qLxO6ucHgRQ6Y9z6Noz81Pr/8DKZ7yEqv8T0=; fh=Gj9cnSJJczUKCGeulh+0w7nfIvYLpLRkOjPatj3XMuc=; b=UbQ5YyEDq8TGu5lbAa9CgPLWw5brvxxcaPgq3MFyHbSdJxj5ap/yyqV5OoVP8UKBDj WiepGMklb6dc+Hwv5PcmKElg7ei5/U04nL4Lmx4YIRWlkkQAg+buxjL4wEg16bzv3QZH JxtJXUcrU6ti2nbPyJ+diXmVVPlSMEHNVEDa/D3PXr59hMx/Fhb6aRPsg07i9mrcrhmt ShRo/yYwbbR6gTR240FxHANGExHz18egBlJ4T5l/MTp8kLtX5Ku318q5V1Tnn4bSjlHP srzSS/FT5N4/TzgFU3S370n60PVEQH6J37Ulnmt6HNYwwB/uWpNc1NxYiAgeqjACmKMp AqgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=daPbjyxw; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-86337-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y11-20020aa79e0b000000b006e58db9df49si861814pfq.307.2024.02.29.00.47.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 00:47:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86337-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=daPbjyxw; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-86337-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B381528358A for ; Thu, 29 Feb 2024 08:47:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3275950A63; Thu, 29 Feb 2024 08:47:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="daPbjyxw" Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 BC4074EB23; Thu, 29 Feb 2024 08:47:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196423; cv=none; b=NEztAbeOelcTIcA5UD1fDVnzrrvMPRrC41EaZ9SKDN6LuqPpF1s6iBtcnfvKzfF5j9t7F38P8xJDcC4oj5a3wSkbM7m8D243kpwUCFSHsWgiMXoTf/x5QJlUC8INICynjqh+q0Cw00TsYOq0XW8NjCM0tJ/FmZC/mvw4trQMKh8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196423; c=relaxed/simple; bh=3ZhFsifEiBm8P5023gzhvbL0FCLFDrjA9snDnqTw2K4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=G9Fb2vsyzkfC0CJZWb7QB9sYF0OxNntGU5LNuDsTcQHm0Lm/5/FYMwz4+0S7JmvkYBAWwU6Ur74m/FeSG7AnBg/cToY2WGxsKAGxuTXb7nBiWt2/hU1+eDJiGdGVPNAICqDbhLmKoAryWTevefqDmhJPNkwvtcBJTNWr8YfePzI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=daPbjyxw; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-563cb3ba9daso837699a12.3; Thu, 29 Feb 2024 00:47:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709196420; x=1709801220; 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=q9xUwc2qLxO6ucHgRQ6Y9z6Noz81Pr/8DKZ7yEqv8T0=; b=daPbjyxwIggDioQCx613HMjJiXOK20Lbdu4SdACmw26jI4PsOd8I8PWRbXNf4Znbkq 5ls55AHuh/+D7/+1AgHW2d9VaWhEir3yzoEvEq5FarMVh07KLC6IJQNZowXAxjTCb1N1 PvMYJEBzBP9wo+aweBVHDMUCRuwpCKlf0ksg8q5ucNf8Ei9T0mCYDVlRXRaQeHnTjqz1 hCfkzc3GwbI3RieoGVth88s+wTS+fGMCp1WKqj12pV1T/I5qL4I6sDRXBZpMP+A5LWtQ uG1nvGpwMRzCMIm3VuzvW+bloMPyg/Rl5q3U8v0tEuueBqnzXbnH0KqNxj8CiGTVqY4y ipDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709196420; x=1709801220; 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=q9xUwc2qLxO6ucHgRQ6Y9z6Noz81Pr/8DKZ7yEqv8T0=; b=IXPyS/6qdebSijPRgEn3NcZMTjyhg7p/p5Tex4YQ5MPqbbzAh49L9M0DhSmGevLdMZ 9DgVo2l/+ILn3rKbeW5ZVN+7EqhPRdCUrYTWqUrZ67Y1OdL6GvRU4XIYbKw1/tODr12B UQKONuitfBZyrOB6ii2v8YugeIcmjhAUUqY6+1lFwsm9FKJNuSLmq2Ky4XelLsfKI45m u0TxhZDEgLfS/tpEWvj75A9pnEUndaNPDHayjj9PYAcOEXUW5Eh1w7Gce6qkIUyp72Ub VLtfsYim1GWVMRNcnbjxgsrSKGsxAdmP7beZTQgty0vjtPei7CyhDBmKyjTsjJhtzAMI 8LJw== X-Forwarded-Encrypted: i=1; AJvYcCU7RI+n8HB/NyKj1KU2c4VW5VyoDxLMNNsjNFjoBfDuMeIprs3A1kYO8KnOVXO3p3gmilYwUer7zasPYkj6/6rVI4TQHUiu6SgDOG92 X-Gm-Message-State: AOJu0Yx5XUszqph38hslX08x8XHo/dRNoDACdxfWzLpn0CcNHwaf9ZT5 g15MRfyGVkIU++HyUvxc3OYu3f0YhD52kKQBAnBJA+Rk7lX7omsb X-Received: by 2002:a50:ef07:0:b0:566:2a1a:fe18 with SMTP id m7-20020a50ef07000000b005662a1afe18mr942975eds.36.1709196420119; Thu, 29 Feb 2024 00:47:00 -0800 (PST) Received: from localhost.localdomain (IN-84-15-190-167.bitemobile.lt. [84.15.190.167]) by smtp.gmail.com with ESMTPSA id s12-20020a056402164c00b005667516866dsm404064edx.33.2024.02.29.00.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 00:46:59 -0800 (PST) From: Arturas Moskvinas To: linus.walleij@linaro.org, brgl@bgdev.pl, u.kleine-koenig@pengutronix.de, andriy.shevchenko@linux.intel.com Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Arturas Moskvinas Subject: [PATCH v2] gpio: 74x164: Enable output pins after registers are reset Date: Thu, 29 Feb 2024 10:45:56 +0200 Message-ID: <20240229084555.43701-2-arturas.moskvinas@gmail.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Chip outputs are enabled[1] before actual reset is performed[2] which might cause pin output value to flip flop if previous pin value was set to 1 in chip. Change fixes that behavior by making sure chip is fully reset before all outputs are enabled. Flip-flop can be noticed when module is removed and inserted again and one of the pins was changed to 1 before removal. 100 microsecond flipping is noticeable on oscilloscope (100khz SPI bus). For a properly reset chip - output is enabled around 100 microseconds (on 100khz SPI bus) later during probing process hence should be irrelevant behavioral change. [1] - https://elixir.bootlin.com/linux/v6.7.4/source/drivers/gpio/gpio-74x164.c#L130 [2] - https://elixir.bootlin.com/linux/v6.7.4/source/drivers/gpio/gpio-74x164.c#L150 Signed-off-by: Arturas Moskvinas --- v1 -> v2 * Updated commit message to contain more information why a change is made. --- drivers/gpio/gpio-74x164.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index e00c33310517..753e7be039e4 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c @@ -127,8 +127,6 @@ static int gen_74x164_probe(struct spi_device *spi) if (IS_ERR(chip->gpiod_oe)) return PTR_ERR(chip->gpiod_oe); - gpiod_set_value_cansleep(chip->gpiod_oe, 1); - spi_set_drvdata(spi, chip); chip->gpio_chip.label = spi->modalias; @@ -153,6 +151,8 @@ static int gen_74x164_probe(struct spi_device *spi) goto exit_destroy; } + gpiod_set_value_cansleep(chip->gpiod_oe, 1); + ret = gpiochip_add_data(&chip->gpio_chip, chip); if (!ret) return 0; base-commit: d206a76d7d2726f3b096037f2079ce0bd3ba329b -- 2.44.0