Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2182325rwp; Fri, 14 Jul 2023 02:00:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlFQAS1dl3gPd9Jo5KO0pZyLeQ7II6XvaEXsb246xpth3HfuV1V9K8ifcN3PTjoQW7A9GloV X-Received: by 2002:a05:6a20:3208:b0:132:f926:5891 with SMTP id hl8-20020a056a20320800b00132f9265891mr2541904pzc.4.1689325244921; Fri, 14 Jul 2023 02:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689325244; cv=none; d=google.com; s=arc-20160816; b=ctX71y39bw24YtY94mY6R1ZLs4SqT/QpnM4NMxqwiHSzbaLIQolSm8frpI7tL1Gj5O Jc4pGMTUuX+LaPvTUd1V/hC9uES0pebDQQ+aNCXkOmyTOvubgeTwrv1uGIUEd56osJzz g6l4miqWwSWNMwUYjZ4VM+S6PMlXpIO53b80sXPkM2Z+pckvwtX9qjxQ1ppYgCGAI98f CbEGnh9Ko/Laz3vVK+QevnqPU2TAzbzO8s55Uz9Z1UDFucH0lS2YPq7d4xeeP8/RW9yT f/0u9BMyb/VIK0ve3Q4WcZw9hK5ON5aDDMm9KDhosky1LwWMILilZuhEjGU3ABSzfh5l /ngw== 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=3v4UNOf4OnfSq8XVP7LewFMWvi4W/OrdiQXVKL6e3Lc=; fh=W0yz3uN4FnN4WxfjdGzFaDkDszPfv19MionA8tc9fhY=; b=LVWDjcLiV+R4X2nqqNVAYjq57dtbyVY32mrhxrvtqNNnLmPAPbmWqKbSMXOepFOOXK DTqOwpdMgPXUy8OMM+hu39ch5GGRVuKQIazQLaMBZ4FWWjs8G59UcVOXMxBK/pTdZX2v cJpSIHa9TpKsh6gfJP2SUgjiy2PaCd4nEwv+E/NSZHG+Z1ihUDS+wYOAwLMQSQgGIXJn BUMRvC5+2FipW4/GejhUm7XUcEB93f6IYIDi69AAQgwO55pmFwcRGmdMuCpirH6UTkVm Es3k0Vp4vzUeQqQrP+1PvVdt9PZ50ZDwekFAL+mTImL8yQpEU80a5Sx3YlveJBnF8DNQ 4Efw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=Wxn72Byc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v17-20020a056a00149100b006825e062715si6915518pfu.228.2023.07.14.02.00.30; Fri, 14 Jul 2023 02:00:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=Wxn72Byc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233738AbjGNITL (ORCPT + 99 others); Fri, 14 Jul 2023 04:19:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234425AbjGNITI (ORCPT ); Fri, 14 Jul 2023 04:19:08 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D942134 for ; Fri, 14 Jul 2023 01:19:07 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbfa811667so17608515e9.1 for ; Fri, 14 Jul 2023 01:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1689322746; x=1691914746; 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=3v4UNOf4OnfSq8XVP7LewFMWvi4W/OrdiQXVKL6e3Lc=; b=Wxn72Byc9QfURzZq95Ooxfv/YMIBLXkxLZ8O1nFDt3poO3870MkNRpNv6Is8RA+0OR jyPdscPq8sC5ljqulPCax59eAaqVi8LO8denCt29u2Z1zdi7Seif5G6D2xml8dpSgoFU rVq7UcYqgErh8KHW4fbNTcX+b5TJMXzF8m/GwwJ3WyyEAMLSm95ckfq7pYDKBEHytpMe 1rrXyqqbQ+lfW6PrWoENgHeEgm8705AWNvLDO/JYQpkAua1OwSmnIrYgRItpAdrJ+1Pc TCjYGUzM31WcaUUYXBPMz3aP6nguWzlGSat2U2j8U+wdLA9XpvViPP9oNrgsjIWX31vZ sxBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689322746; x=1691914746; 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=3v4UNOf4OnfSq8XVP7LewFMWvi4W/OrdiQXVKL6e3Lc=; b=D2LSs5XgCsB5Ge6pj03q0sOoD7YvkVsn6oPczrP3UXwMHgQiU5T2x5oiUePg/vAGM1 bRnhr+wMk9AgQo+65P7iVvY8hj6XbAbyXGk3q7KhCW/lm+co7t45FBPRzL+rXlZJ7LUD RyE4J6lg9o9CnYHXQlsWaZg5A0Q51Af+opMKdv+k5eNuadviUzEwTgeRFmm0DGmZ+6be HqjZvkxNmDGaYO6fkjPCcgAq92rzqNbsDCQGc4B6PdDCNeY8Nza451FyunkH92jbV8Ao ixxpbuqlZ3p3JObYv7hJ2z6WRv/FRNhxA+/WAQVIPuJ5cYnh3YfY8RIMN9HQTGKU0qfx XH3Q== X-Gm-Message-State: ABy/qLYIUZ2pPTgY7qW8Clr32bOfOFgOhJ2EtR4GwWz5wnm1Za/NTz3L b2KJxkbUSt3WkDOOiwMkI2rsz+L8YboF56PUY4v2dA== X-Received: by 2002:a5d:6a51:0:b0:313:f38d:555f with SMTP id t17-20020a5d6a51000000b00313f38d555fmr1450399wrw.24.1689322745775; Fri, 14 Jul 2023 01:19:05 -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 w16-20020a5d6810000000b003144b50034esm10143635wru.110.2023.07.14.01.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jul 2023 01:19:05 -0700 (PDT) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: Patrick Rudolph , Linus Walleij Cc: Naresh Solanki , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] pinctrl: cy8c95x0: Add reset support Date: Fri, 14 Jul 2023 10:19:01 +0200 Message-ID: <20230714081902.2621771-2-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230714081902.2621771-1-Naresh.Solanki@9elements.com> References: <20230714081902.2621771-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 From: Patrick Rudolph This patch adds support for an optional "reset" GPIO pin in the cy8c95x0 pinctrl driver. On probe, the reset pin is pulled low to bring chip out of reset. The reset pin has an internal pull-down and can be left floating if not required. The datasheet doesn't mention any timing related to the reset pin. Based on empirical tests, it was found that the chip requires a delay of 250 milliseconds before accepting I2C transfers after driving the reset pin low. Therefore, a delay of 250ms is added before proceeding with I2C transfers. Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki --- Changes in V2: - None --- drivers/pinctrl/pinctrl-cy8c95x0.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/pinctrl/pinctrl-cy8c95x0.c b/drivers/pinctrl/pinctrl-cy8c95x0.c index 2ecc96691c55..58ca6fac7849 100644 --- a/drivers/pinctrl/pinctrl-cy8c95x0.c +++ b/drivers/pinctrl/pinctrl-cy8c95x0.c @@ -164,6 +164,7 @@ struct cy8c95x0_pinctrl { struct pinctrl_desc pinctrl_desc; char name[32]; unsigned int tpin; + struct gpio_desc *gpio_reset; }; static const struct pinctrl_pin_desc cy8c9560_pins[] = { @@ -1383,6 +1384,20 @@ static int cy8c95x0_probe(struct i2c_client *client) chip->regulator = reg; } + /* bring the chip out of reset if reset pin is provided */ + chip->gpio_reset = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(chip->gpio_reset)) { + ret = dev_err_probe(chip->dev, PTR_ERR(chip->gpio_reset), + "Failed to get GPIO 'reset'\n"); + goto err_exit; + } else if (chip->gpio_reset) { + usleep_range(1000, 2000); + gpiod_set_value_cansleep(chip->gpio_reset, 0); + usleep_range(250000, 300000); + + gpiod_set_consumer_name(chip->gpio_reset, "CY8C95X0 RESET"); + } + chip->regmap = devm_regmap_init_i2c(client, &cy8c95x0_i2c_regmap); if (IS_ERR(chip->regmap)) { ret = PTR_ERR(chip->regmap); -- 2.41.0