Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4630847rdb; Fri, 15 Sep 2023 07:55:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1du9y1XtBhWbpGo+FbLky+AcbZJfyWc8SDTn4NO3+oPK03V17mtcm/dX5Ic7fpW1Y8JQl X-Received: by 2002:a17:902:e74f:b0:1c4:1cd3:8068 with SMTP id p15-20020a170902e74f00b001c41cd38068mr5580279plf.5.1694789731795; Fri, 15 Sep 2023 07:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694789731; cv=none; d=google.com; s=arc-20160816; b=XjusJPPmKVuvT24iTpjM/DF6Ql301JvSHNPX10xWUpET9NSG7X/m+gmFr3NCrbihDV oW+W3RRPA0GoT7HHT5pieVRbbcI3pt1lpfeOSIutO5qrP89t6ZSGNll07J6mXasIUtTe hEk9oHpzqrDtv7tvLoa4WMaAQUDzJHZlFT+IglS1xdTe7Da05KqZu/6U/zc38hQ9bh7f gllD/31EL++lsbOCpLdH12mdqknmGmzEWTBB/um8n27MG9NaZi+d44aU8cqZFvPqmLgB 6I3vWJRcjgRmb2QVQS0M8eoAnwXGb/wXqkhOLhAA68ENjsMQwTwp35kpCSpAxQ3oHI6b qdlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=hrWZrC7VA07vTu2VYx3e4Tz7ds8I9QblZBEXqmyJTtI=; fh=QdYvz/W5Lu6aa86b1WZvRC6c5qIQtDoEtXO26C9DRiA=; b=jMHgz89ql9NOPHDNdblqVqNFRTRJ1SJSibVrmHGg5KiHm6+AeCMg3ftQ5aMpDp/7zb yquMXm2AUdbxY4KLArtl/t5EWhBb2xeN9+kadPGNgfpGp/jazRHwsgnvGJ10GMaet6Mr PrP+XwNgmmrZczh3+GjZeTDdNSqSWoVxcKY+oKt/pR1Zqibquwnjr7QxxQk4C6qIfWkw kSaPhprKnp0RgP5v6lNr9jzQ00etFyNZWGr/4GzYB6YkTHk/5FN28TSw6eSA9l76REKv eBWZQBfsU3kR8Rtb/qZzOEsZfgO4c+/5LfpsnKRvGmc4TxOtnh5hzB86dBgjtu1EQhE3 w8Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kK987kB0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ld3-20020a170902fac300b001bbab2e5a27si3340423plb.290.2023.09.15.07.55.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:55:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kK987kB0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3581282F9262; Fri, 15 Sep 2023 03:05:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234135AbjIOKFy (ORCPT + 99 others); Fri, 15 Sep 2023 06:05:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234129AbjIOKFx (ORCPT ); Fri, 15 Sep 2023 06:05:53 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F84A3596 for ; Fri, 15 Sep 2023 03:03:32 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-502153ae36cso3125683e87.3 for ; Fri, 15 Sep 2023 03:03:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694772211; x=1695377011; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=hrWZrC7VA07vTu2VYx3e4Tz7ds8I9QblZBEXqmyJTtI=; b=kK987kB0wWsGRzVZoQkfrGsK51z95+8bf6SKy11lddIulYxKlughHj82on9iZmEwnR gCbpSSBEWJc6Wc17kSRyoDlG98d9Y+c9SdyWA2L0n88k+BAxUie2BLWfs7+jkUN1w25o ZfNjA0u66c8i/I9YGoxxKJEVXQ11EUTxiRRmSpuKYqr93L921X0ZhtnpmN1B3sKVFGqK kstfGJxIH3c+jNk1PhRmznFc2WzMbH5TU+xR/UIgQeqjLTKGSGUJFSNmjKaL/6pJ54wX t+tmkgVu9KbT+9sbmJ2HJ7gKz5cKXdYUSqfB/yxeAbHuKVG+sZqadyDCPTjwG80CRe52 y7Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694772211; x=1695377011; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hrWZrC7VA07vTu2VYx3e4Tz7ds8I9QblZBEXqmyJTtI=; b=PSpRgxaLAsuibswsvSBk6cg/tDvQGBU4TVflA0TaIHbNJVVfp1un+so+tZXzgqWiAk VEEXzQ7aYywlJzrBJKK7EQ5i5Cy6XOqa9AAQDLZ4JzrLnJipsRAaNGnK1NhW5yoZScIn 63fTOgo/WeG2dzK6PgtcQmuNETR2aHDGcjQap0DdyAro3EOfyaWjM7/RuJL6+Wctp2og iSoXX7kD2QxwE0CcMMETzfZO5nKljceMPV0QhihT4R72vNgGGuW0gtZCZuFrXoTbrKtl neQ5Zsv+SsUTWyao8Jq4GkdEOV3olapCx3l6hoMgK+85zdCLSsPCbjxhRHQFlnlg3vfd gqLw== X-Gm-Message-State: AOJu0YyH7XjGrtoJCI7DBOE2A0zk6coCSniAlxFVIerLiqd03kF5P8TK lOw5t4tvzMFq1oAiUgTwK+FHVKC7suIykr3Ns9o= X-Received: by 2002:ac2:5e22:0:b0:4fb:caed:95c3 with SMTP id o2-20020ac25e22000000b004fbcaed95c3mr1115977lfg.53.1694772210725; Fri, 15 Sep 2023 03:03:30 -0700 (PDT) Received: from [192.168.1.20] ([178.197.214.188]) by smtp.gmail.com with ESMTPSA id i8-20020a0564020f0800b005309eb7544fsm315907eda.45.2023.09.15.03.03.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Sep 2023 03:03:30 -0700 (PDT) Message-ID: Date: Fri, 15 Sep 2023 12:03:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH 1/2] usb: typec: tps6598x: add reset gpio support Content-Language: en-US To: Bryan O'Donoghue , Javier Carrasco , Heikki Krogerus , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20230912-topic-tps6598x_reset-v1-0-78dc0bf61790@wolfvision.net> <20230912-topic-tps6598x_reset-v1-1-78dc0bf61790@wolfvision.net> From: Krzysztof Kozlowski In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 15 Sep 2023 03:05:57 -0700 (PDT) On 15/09/2023 11:52, Bryan O'Donoghue wrote: >> + struct gpio_desc *reset; >> struct typec_port *port; >> struct typec_partner *partner; >> struct usb_pd_identity partner_identity; >> @@ -717,6 +722,13 @@ static int tps6598x_probe(struct i2c_client *client) >> mutex_init(&tps->lock); >> tps->dev = &client->dev; >> >> + tps->reset = devm_gpiod_get_optional(tps->dev, "reset", GPIOD_OUT_LOW); >> + if (IS_ERR(tps->reset)) >> + return dev_err_probe(tps->dev, PTR_ERR(tps->reset), >> + "failed to get reset GPIO\n"); >> + if (tps->reset) >> + msleep(SETUP_MS); >> + > > This looks a bit odd to me, shouldn't you drive reset to zero ? > > if (tps->reset) { > gpiod_set_value_cansleep(tps->reset, 0); It is driven by GPIOD_OUT_LOW. > msleep(SETUP_MS); > } > > also wouldn't it make sense to functionally decompose that and reuse in > probe() and tps6598x_resume() ? > > tps6598x_reset() { > if (tps->reset) { > gpiod_set_value_cansleep(tps->reset, 0); > msleep(SETUP_MS); > } > } Best regards, Krzysztof