From patchwork Sun May 4 10:13:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 887344 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C40141A23BA for ; Sun, 4 May 2025 10:14:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746353650; cv=none; b=ee5yX9Fm9jFyEflpcgl/5S1coYbBVhs+dVM4+IYzeKaZ8RucN0JQ5bclf0pb3W3bOqFuPUnmOaiTg0aMLHRC2GrKqZ1DiLc+ExtvVhEJMZ4fxmEr3VslDTt7IVcXenZdwsiMXMrND+eA4dRk2dc/w42T8Mg5raBPOVdCieTNPyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746353650; c=relaxed/simple; bh=aCJXRlNiHCKdef3iolamO6INkCu0doUgW+ue4UDKKu4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ouaqJHuiPYjV9S9DbcHPt81dKfFPjVLNMn8ZqLx9pJH0IT+B4uCSl7hpJnODnper4VvOpGbQFAG1E4XFj/ZWIXNw/Esy/Dl+j3S/xfU636hteltRiu0kcU50ec0o2cZVIIBXx0mXdHEHLSXjiznPDQkILGGYMVI9EeoSKCvdzIE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=eQLTXI1I; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eQLTXI1I" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746353647; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GbEjBUZ5UDkw7aTvBxao1bCKPxFAdmSmmU19A2ESQPs=; b=eQLTXI1IDORVSa9nDEaGZanxzQtttqUVfmZLoZD4TjqoRDtJgqtw2Vh+sMQd5MlvGBwRk6 bgXZHq1gI7ph8VMbVObqTssLsY59P+0R9AwgwCRMIsUSck9LHByuhbMBOY9BzMYEmS6V1l pkb6OiTM7F27k8ZRBwAK92vDHw2/WKg= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-448-al00gUUGNyqqYBtrkduxdQ-1; Sun, 04 May 2025 06:14:04 -0400 X-MC-Unique: al00gUUGNyqqYBtrkduxdQ-1 X-Mimecast-MFC-AGG-ID: al00gUUGNyqqYBtrkduxdQ_1746353642 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CE68419560BB; Sun, 4 May 2025 10:14:02 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.45.224.28]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B06821800352; Sun, 4 May 2025 10:14:00 +0000 (UTC) From: Hans de Goede To: Laurent Pinchart , Sakari Ailus Cc: Hans de Goede , Mauro Carvalho Chehab , Mathis Foerst , linux-media@vger.kernel.org Subject: [PATCH 08/13] media: mt9m114: Avoid a reset low spike during probe() Date: Sun, 4 May 2025 12:13:29 +0200 Message-ID: <20250504101336.18748-9-hdegoede@redhat.com> In-Reply-To: <20250504101336.18748-1-hdegoede@redhat.com> References: <20250504101336.18748-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 mt9m114_probe() requests the reset GPIO in output low state: sensor->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); and then almost immediately afterwards calls mt9m114_power_on() which does: gpiod_set_value(sensor->reset, 1); fsleep(duration); gpiod_set_value(sensor->reset, 0); which means that if the reset pin was high before this code runs that it will very briefly be driven low because of passing GPIOD_OUT_LOW when requesting the GPIO only to be driven high again possibly directly after that. Such a very brief driving low of the reset pin may put the chip in a confused state. Request the GPIO in high (reset the chip) state instead to avoid this, turning the initial gpiod_set_value() in mt9m114_power_on() into a no-op. and the fsleep() ensures that it will stay high long enough to properly reset the chip. Signed-off-by: Hans de Goede --- drivers/media/i2c/mt9m114.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c index be3e7bb44ad8..43efcbdf614e 100644 --- a/drivers/media/i2c/mt9m114.c +++ b/drivers/media/i2c/mt9m114.c @@ -2412,7 +2412,7 @@ static int mt9m114_probe(struct i2c_client *client) } } - sensor->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); + sensor->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(sensor->reset)) { ret = PTR_ERR(sensor->reset); dev_err_probe(dev, ret, "Failed to get reset GPIO\n");