From patchwork Tue Mar 27 11:39:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Yan X-Patchwork-Id: 891516 X-Patchwork-Delegate: jh80.chung@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 409TZj4JWhz9s0n for ; Tue, 27 Mar 2018 22:39:57 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id EBCDFC21FE2; Tue, 27 Mar 2018 11:39:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_L3,RCVD_IN_SORBS_WEB autolearn=no autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C2048C21E7E; Tue, 27 Mar 2018 11:39:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DAACBC21E7E; Tue, 27 Mar 2018 11:39:49 +0000 (UTC) Received: from lucky1.263xmail.com (lucky1.263xmail.com [211.157.147.130]) by lists.denx.de (Postfix) with ESMTPS id F15B5C21C57 for ; Tue, 27 Mar 2018 11:39:48 +0000 (UTC) Received: from andy.yan?rock-chips.com (unknown [192.168.167.139]) by lucky1.263xmail.com (Postfix) with ESMTP id 5151E1F5AC2; Tue, 27 Mar 2018 19:39:43 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id AC7A16CB; Tue, 27 Mar 2018 19:39:44 +0800 (CST) X-RL-SENDER: andy.yan@rock-chips.com X-FST-TO: jh80.chung@samsung.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: andy.yan@rock-chips.com X-UNIQUE-TAG: <122514b70683c73e0f6fdb626253d040> X-ATTACHMENT-NUM: 0 X-SENDER: yxj@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 22359ZOCOA1; Tue, 27 Mar 2018 19:39:45 +0800 (CST) From: Andy Yan To: jh80.chung@samsung.com, u-boot@lists.denx.de Date: Tue, 27 Mar 2018 19:39:38 +0800 Message-Id: <1522150778-16364-1-git-send-email-andy.yan@rock-chips.com> X-Mailer: git-send-email 2.7.4 Cc: Andy Yan , kettenis@openbsd.org Subject: [U-Boot] [PATCH v2] power: pwm regulator: support live tree X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Use live tree compatible api for pwm regulator. Signed-off-by: Andy Yan Reviewed-by: Kever Yang --- Changes in v2: - remove unused head files drivers/power/regulator/pwm_regulator.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/power/regulator/pwm_regulator.c b/drivers/power/regulator/pwm_regulator.c index b63f941..29bceb5 100644 --- a/drivers/power/regulator/pwm_regulator.c +++ b/drivers/power/regulator/pwm_regulator.c @@ -13,9 +13,6 @@ #include #include #include -#include -#include -#include DECLARE_GLOBAL_DATA_PTR; @@ -94,13 +91,10 @@ static int pwm_regulator_set_voltage(struct udevice *dev, int uvolt) static int pwm_regulator_ofdata_to_platdata(struct udevice *dev) { struct pwm_regulator_info *priv = dev_get_priv(dev); - struct fdtdec_phandle_args args; - const void *blob = gd->fdt_blob; - int node = dev_of_offset(dev); + struct ofnode_phandle_args args; int ret; - ret = fdtdec_parse_phandle_with_args(blob, node, "pwms", "#pwm-cells", - 0, 0, &args); + ret = dev_read_phandle_with_args(dev, "pwms", "#pwm-cells", 0, 0, &args); if (ret) { debug("%s: Cannot get PWM phandle: ret=%d\n", __func__, ret); return ret; @@ -109,14 +103,13 @@ static int pwm_regulator_ofdata_to_platdata(struct udevice *dev) priv->period_ns = args.args[1]; priv->polarity = args.args[2]; - priv->init_voltage = fdtdec_get_int(blob, node, - "regulator-init-microvolt", -1); + priv->init_voltage = dev_read_u32_default(dev, "regulator-init-microvolt", -1); if (priv->init_voltage < 0) { printf("Cannot find regulator pwm init_voltage\n"); return -EINVAL; } - ret = uclass_get_device_by_of_offset(UCLASS_PWM, args.node, &priv->pwm); + ret = uclass_get_device_by_ofnode(UCLASS_PWM, args.node, &priv->pwm); if (ret) { debug("%s: Cannot get PWM: ret=%d\n", __func__, ret); return ret;