Received: by 10.213.65.68 with SMTP id h4csp546821imn; Fri, 30 Mar 2018 10:27:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+AFVuUDeQ6/Jw/aVkJybLiNeZgY+LATkSnrV2sDplGxubPauxg0L5uwo9RQdsHSKmZuDEX X-Received: by 10.98.14.215 with SMTP id 84mr10418565pfo.168.1522430827688; Fri, 30 Mar 2018 10:27:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522430827; cv=none; d=google.com; s=arc-20160816; b=ZiW6M2v51YJf+9xrvoV54IIsyGdsHDgyQmyvL8c1pBuu2dCgilJqVrn36270WZexXT FxexB0uP9z/AJ/Gkza+bBtSZ1lQg/GwepFR/iDvrk0o1y/0RjoxmSbPWDbHfkeKGeo/P PaZ+u1rjcPhT0szIkXTRIAPeJaUrHYpUhynCJLaBzEtvPXCMEPvhltUOM2A2LtTeYtLu TLPsdz1O+v6joVzwxzwmg2DB+uPxzY3tYoGXg00LDx9MAGr9ItyPZO+awkkFXKnGXzUZ j5+qEGIDE9Bt1HXAn2AyxNeSlfEooubqvI33mIb6NuiydYNA94mG0BhxN1bySX+74rlk 7Yiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=1wf0KcoKBBi6/GxMjacgCCMMa1I82keOfOtt0GZEuQs=; b=hXz/SGFb4DGkGGaq2hJ6Z45fJZkaPRi5dPqMyrECzb9nyOHzXsOc0hcKeCNBB/10Bw LeoIdEKe8OaeWUF66fg48hy2uMVhArRcNH17fWnI4gTAcmiBPC3Fu5xB1AjGHe6FJJXQ 49uy51/0bfeOOt14t8Hzk/NNhqporDgqpxo+vP9B2MX4yiVd6gnexLomgtJtDWdy72i1 LT8UCJDCg0y1gy3+5xEe46ARZmJjsbLJUsnBIsvj24GeuwXcmtlaXa2nYUX0ZtFW5pFe aSQUFKcEB63TiDwfhj2cDiE7rr2MwC5v0DxkuxFGcuDGgx9bJXZzDG1lMCslEeFxmC1J y4QA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u59-v6si8697203plb.177.2018.03.30.10.26.53; Fri, 30 Mar 2018 10:27:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752592AbeC3RYc (ORCPT + 99 others); Fri, 30 Mar 2018 13:24:32 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58894 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752431AbeC3RYZ (ORCPT ); Fri, 30 Mar 2018 13:24:25 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id A899A260BD3 From: Sebastian Reichel To: Sebastian Reichel , Milo Kim , Lee Jones , Daniel Thompson , Rob Herring , Tony Lindgren Cc: Jingoo Han , Mark Rutland , linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, devicetree@vger.kernel.org, linux-omap@vger.kernel.org, Sebastian Reichel Subject: [PATCHv4 02/10] mfd: ti-lmu: switch to gpiod Date: Fri, 30 Mar 2018 19:24:06 +0200 Message-Id: <20180330172414.26575-3-sebastian.reichel@collabora.co.uk> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180330172414.26575-1-sebastian.reichel@collabora.co.uk> References: <20180330172414.26575-1-sebastian.reichel@collabora.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use new descriptor based API instead of the legacy one. Signed-off-by: Sebastian Reichel --- drivers/mfd/ti-lmu.c | 28 ++++++++++++---------------- include/linux/mfd/ti-lmu.h | 3 ++- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/mfd/ti-lmu.c b/drivers/mfd/ti-lmu.c index 990437e5ed0a..e14cb9f41b44 100644 --- a/drivers/mfd/ti-lmu.c +++ b/drivers/mfd/ti-lmu.c @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include @@ -21,7 +21,6 @@ #include #include #include -#include #include struct ti_lmu_data { @@ -32,17 +31,8 @@ struct ti_lmu_data { static int ti_lmu_enable_hw(struct ti_lmu *lmu, enum ti_lmu_id id) { - int ret; - - if (gpio_is_valid(lmu->en_gpio)) { - ret = devm_gpio_request_one(lmu->dev, lmu->en_gpio, - GPIOF_OUT_INIT_HIGH, "lmu_hwen"); - if (ret) { - dev_err(lmu->dev, "Can not request enable GPIO: %d\n", - ret); - return ret; - } - } + if (lmu->en_gpio) + gpiod_set_value(lmu->en_gpio, 1); /* Delay about 1ms after HW enable pin control */ usleep_range(1000, 1500); @@ -59,8 +49,8 @@ static int ti_lmu_enable_hw(struct ti_lmu *lmu, enum ti_lmu_id id) static void ti_lmu_disable_hw(struct ti_lmu *lmu) { - if (gpio_is_valid(lmu->en_gpio)) - gpio_set_value(lmu->en_gpio, 0); + if (lmu->en_gpio) + gpiod_set_value(lmu->en_gpio, 0); } static const struct mfd_cell lm3532_devices[] = { @@ -204,7 +194,13 @@ static int ti_lmu_probe(struct i2c_client *cl, const struct i2c_device_id *id) return PTR_ERR(lmu->regmap); /* HW enable pin control and additional power up sequence if required */ - lmu->en_gpio = of_get_named_gpio(dev->of_node, "enable-gpios", 0); + lmu->en_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH); + if (IS_ERR(lmu->en_gpio)) { + ret = PTR_ERR(lmu->en_gpio); + dev_err(dev, "Can not request enable GPIO: %d\n", ret); + return ret; + } + ret = ti_lmu_enable_hw(lmu, id->driver_data); if (ret) return ret; diff --git a/include/linux/mfd/ti-lmu.h b/include/linux/mfd/ti-lmu.h index 09d5f30384e5..1ef51ed36be5 100644 --- a/include/linux/mfd/ti-lmu.h +++ b/include/linux/mfd/ti-lmu.h @@ -16,6 +16,7 @@ #include #include #include +#include /* Notifier event */ #define LMU_EVENT_MONITOR_DONE 0x01 @@ -81,7 +82,7 @@ enum lm363x_regulator_id { struct ti_lmu { struct device *dev; struct regmap *regmap; - int en_gpio; + struct gpio_desc *en_gpio; struct blocking_notifier_head notifier; }; #endif -- 2.16.2