Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp481986lqt; Mon, 18 Mar 2024 13:39:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXJd32crMEEnArer/fgXwOF4Wsg+VsHkF5Dl09sQ5Yv8xaItbiDLTt6qCNX8Pl4ca2fLNQv4ck//LiRii5dZ3Z0gSdM+PZIGAv3kXhGpw== X-Google-Smtp-Source: AGHT+IFwedGdugPSFPyqFXISULDUEAKVeD3s+BKkVdXxYvyOkzJoGc71vTadXmjiGnsdWN2YwRDF X-Received: by 2002:a17:90a:c095:b0:29a:5c44:2d03 with SMTP id o21-20020a17090ac09500b0029a5c442d03mr8304526pjs.27.1710794381215; Mon, 18 Mar 2024 13:39:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710794381; cv=pass; d=google.com; s=arc-20160816; b=gTTC+skL1sh6MJRMovj+C059CGn5bOSEhf+VmK5w/kfmAHASZOadxPsQEYetG5enFt vkAGJfLsjXrH+68hGvAsUoBloinqsssWqLMc7nFOwzheYweU1VG33zEaA8jqDZW5tyv0 qHvtHWsNuCP4gveP8MOCfXqV1arA8f3TSuwsgDa3rLVZgt4f/yN1M4ntF5Nox34fmXfy R1VvaxFxpfBQqrAT+qggzuOKKwjTUiGVmP/vzC9tXmLYEqu2zBFJu4wDwfCafELzvoXI BanWw/9pieuVC9zOGd19W+qAVvcHao8QroDi6X+UNhZZSnL9puuLgEUXEEMblMczDKxJ l4qA== 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=hfIzQAikq73utBE8ycdZOq+pJpkgiZcOKS4gXxn7BGg=; fh=Rc3RHZ+2QjjkMVCb4vfYfw43EmSP2dE+G1f1dOO4BiA=; b=Tw4TwU5OtJPxA6j+ftS7F+JPuTnZ6ZqAE/B9hv4x6i9Kt9foDvy0LNmxh55bG2W8G8 VEMHmVsAE6UddpvPwsGr5xqeBpsu3pcRj6ijUvLt5KaNr3iUltHUt5NOZpKbZGUbziin GTcYuAPzy+1R8hVp97ooyNV4+LhXk0FbRvx/G5q34SrFKpNAvpSomHblp05UBqyK1kcN k27eeHRoRmsHSblCjbO/GjGuAQcO42b+6MYOTlrKKyaSa8MqOh/9DPVvaHZ1GbWkst/K IKiqavnWnCv5zdEQn2rrX0wUmwqsEqQhTBaLW0DDP4mCGAebbufhrojQGwNbjuogNUnr 6DNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gOeTv3G7; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-106636-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106636-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 y12-20020a17090aa40c00b00295e3413670si8790680pjp.131.2024.03.18.13.39.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 13:39:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106636-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=@intel.com header.s=Intel header.b=gOeTv3G7; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-106636-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106636-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 C5767284835 for ; Mon, 18 Mar 2024 20:39:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 870D33307B; Mon, 18 Mar 2024 20:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gOeTv3G7" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 2339E58AB6; Mon, 18 Mar 2024 20:39:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710794368; cv=none; b=J6+7YUmOP2bVIfY1Yf/WSyCS2dnciiW47JM/EJUxGFbAu926AmEOH3LQHxcn1MsYs9AEp3ZV1k3HX/p+N+lJUba1vZW9DtG0EqBjFjAzNlpXgHjQV+wEEu79jrZeqSgteKmb4RYwrN2zUP6Ph7ouRPjjXNeEYGuNrzDn2awCyT0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710794368; c=relaxed/simple; bh=2h5jo8wEAkXTw9G7gniyt7zf6JOSZSqfam+jr8qgV0c=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qs2G2rRuZAqTmcnBCKLw9S5a2rmqrkFVFG2dpvv2SVZKxe12mzQbfSLr/oB2mQiDN6MXN3Hw7DJW/6P3k7XUTD6DSICEiAXejqYhdrKev2J1UC8jSeTVFduNU9rm+bfUVngwb4VmUvpR2B4S0oVgVkkGDR+k4VLhX545gAOKo6w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gOeTv3G7; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710794367; x=1742330367; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=2h5jo8wEAkXTw9G7gniyt7zf6JOSZSqfam+jr8qgV0c=; b=gOeTv3G7SZwueLHzeNdOioPGWYG9jh4g76hZlsrBiC9ZofVMkDzlBvC5 D9vWq8jIFkMRi7d7PqpWtvuXmdZikEW0EKzQWJbGJblDoFaZBBefsx+CS riNMruYeBSnh44IhllDCfljqafhu+rHKkkFd1z0CLnmDTr45onApq8LrY bdyb4Oh97LZYzMOV+R5g1pnWGCtWt/RxTpugz28+hSrm0LyjNUuZUSjgV 3fzDMha415LloXhemuMm+MLD3KfaYl57t3t98gCTxLuwJRAVDrQl71Prx R0SnfQBPhAB68Y+vjqPBDzmdICrfi8AH01KlDVUbOkmDosY9+lKanHF0b Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11017"; a="5482171" X-IronPort-AV: E=Sophos;i="6.07,135,1708416000"; d="scan'208";a="5482171" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2024 13:39:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11017"; a="937060676" X-IronPort-AV: E=Sophos;i="6.07,135,1708416000"; d="scan'208";a="937060676" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 18 Mar 2024 13:39:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2767C241; Mon, 18 Mar 2024 22:39:24 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH net-next v1 1/1] nfc: st95hf: Switch to using gpiod API Date: Mon, 18 Mar 2024 22:39:23 +0200 Message-ID: <20240318203923.183943-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This updates the driver to gpiod API, and removes yet another use of of_get_named_gpio(). Signed-off-by: Andy Shevchenko --- drivers/nfc/st95hf/core.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c index ed704bb77226..067e0ec31d2d 100644 --- a/drivers/nfc/st95hf/core.c +++ b/drivers/nfc/st95hf/core.c @@ -7,14 +7,13 @@ */ #include -#include +#include #include #include #include #include #include #include -#include #include #include #include @@ -196,7 +195,7 @@ struct st95_digital_cmd_complete_arg { * for spi communication between st95hf and host. * @ddev: nfc digital device object. * @nfcdev: nfc device object. - * @enable_gpio: gpio used to enable st95hf transceiver. + * @enable_gpiod: gpio used to enable st95hf transceiver. * @complete_cb_arg: structure to store various context information * that is passed from nfc requesting thread to the threaded ISR. * @st95hf_supply: regulator "consumer" for NFC device. @@ -219,7 +218,7 @@ struct st95hf_context { struct st95hf_spi_context spicontext; struct nfc_digital_dev *ddev; struct nfc_dev *nfcdev; - unsigned int enable_gpio; + struct gpio_desc *enable_gpiod; struct st95_digital_cmd_complete_arg complete_cb_arg; struct regulator *st95hf_supply; unsigned char sendrcv_trflag; @@ -451,19 +450,19 @@ static int st95hf_select_protocol(struct st95hf_context *stcontext, int type) static void st95hf_send_st95enable_negativepulse(struct st95hf_context *st95con) { /* First make irq_in pin high */ - gpio_set_value(st95con->enable_gpio, HIGH); + gpiod_set_value(st95con->enable_gpiod, HIGH); /* wait for 1 milisecond */ usleep_range(1000, 2000); /* Make irq_in pin low */ - gpio_set_value(st95con->enable_gpio, LOW); + gpiod_set_value(st95con->enable_gpiod, LOW); /* wait for minimum interrupt pulse to make st95 active */ usleep_range(1000, 2000); /* At end make it high */ - gpio_set_value(st95con->enable_gpio, HIGH); + gpiod_set_value(st95con->enable_gpiod, HIGH); } /* @@ -1063,6 +1062,7 @@ MODULE_DEVICE_TABLE(of, st95hf_spi_of_match); static int st95hf_probe(struct spi_device *nfc_spi_dev) { + struct device *dev = &nfc_spi_dev->dev; int ret; struct st95hf_context *st95context; @@ -1108,19 +1108,14 @@ static int st95hf_probe(struct spi_device *nfc_spi_dev) */ dev_set_drvdata(&nfc_spi_dev->dev, spicontext); - st95context->enable_gpio = - of_get_named_gpio(nfc_spi_dev->dev.of_node, - "enable-gpio", - 0); - if (!gpio_is_valid(st95context->enable_gpio)) { + st95context->enable_gpiod = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH); + if (IS_ERR(st95context->enable_gpiod)) { + ret = PTR_ERR(st95context->enable_gpiod); dev_err(&nfc_spi_dev->dev, "No valid enable gpio\n"); - ret = st95context->enable_gpio; goto err_disable_regulator; } - ret = devm_gpio_request_one(&nfc_spi_dev->dev, st95context->enable_gpio, - GPIOF_DIR_OUT | GPIOF_INIT_HIGH, - "enable_gpio"); + ret = gpiod_set_consumer_name(st95context->enable_gpiod, "enable_gpio"); if (ret) goto err_disable_regulator; -- 2.43.0.rc1.1.gbec44491f096