From patchwork Wed Jul 31 20:29:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 170237 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4463173ile; Wed, 31 Jul 2019 13:30:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHnD6pgIW5N5PO3NJxIUBPnSACCI1kBb8TvE00kwtrtNrCJECYfxKg5i4Mk4C/TE95fwyC X-Received: by 2002:a63:1d0e:: with SMTP id d14mr115405365pgd.324.1564605025377; Wed, 31 Jul 2019 13:30:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564605025; cv=none; d=google.com; s=arc-20160816; b=RTX/7vJSKawPha3u6dKIDdQuMjhh5AISpBwvvgKr2XF2tC5Xi7LgSSbIrYbenqjOa5 XmACyZP3eeMnuCMbwWOnd9yRZUvw9ZY7NWb6fZ5PVtwJFDKpyxa9CXd9qrxtF5Q4aoc0 /u4Ik0JDOzOXeB0KeLl/PMWCgT70br9VnDAxg4yiY4CjICLd98eqUw5ZYgPCqQZS8MM2 Pol8bEmTyMVjEgNxw1WLknZcaGV6PCsST6FXTlKYa/bsktJSZv3LaSGY/8nGf7QLa9q/ jCaVUV+tjPA7BvpQpWA6xPrBUY1FUDMc4hA5EaI7/L5LDQf13xpJJbaKG9gyosVRFoTp oRqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Cw8s/YHZ7PvnoGSE9VFOJmJ7OcBZMxXJRhzFX2CFS/0=; b=cQBY35ZYdURWnj9DJBsIGc7gBEoE0qzBXg1wRSu75TfqJdb357Fots7gHNIXwISv3y u3Ir10owZRTEJMB6vMi9hGqi8IQJDldExUzL9MuIjTm6zElRVNsNSEi2+CKw0GWK3eyi +UwzA/4UVnP5aiFc1/ApWWdpz/5D9Il/xCsIhsYzkFHihtlhApEN8OC7ViSObss3UWdr 9WHBwW1IYBUjPcwCh0qWqxDwf/UErtcazHavzioU7xF8HPHU8K+C2uMm72AwMp3R6ruY 94UHEDdR9P/hNs1Tapteqfz6bsb1BI+9ypTm16EtNk5ZoKxz3omQZMxPnbBh6HeyYIXA K/Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kJBbacS2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m7si34035957pls.110.2019.07.31.13.30.25; Wed, 31 Jul 2019 13:30:25 -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; dkim=pass header.i=@linaro.org header.s=google header.b=kJBbacS2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730694AbfGaU3r (ORCPT + 29 others); Wed, 31 Jul 2019 16:29:47 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:41681 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730634AbfGaU3p (ORCPT ); Wed, 31 Jul 2019 16:29:45 -0400 Received: by mail-wr1-f68.google.com with SMTP id c2so67860700wrm.8 for ; Wed, 31 Jul 2019 13:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cw8s/YHZ7PvnoGSE9VFOJmJ7OcBZMxXJRhzFX2CFS/0=; b=kJBbacS2TtjQjea5DOSAjsJqE9hdo66q0l+7PzEll27w7q2r/d3YlPmTw2TF+R9F50 nxMbp/GkwT9xXklzWopx3j9i4mqwpQ4GrczTIW0U0b2rSs6PQLQaMXx4zxRC2ynE3XR2 IAwl84EixvDnxH2WjroG/fnGDRU0MzvSiDsWpWVFqHjp+ZaOIEfUIlqFdgo6sMYm3CAH 9mHO9XkRvHiBorUPFRfV8XrECgEXQ8+dMwzjSK/dU41Vu0Q/I0VZwYvPchiZgVo0In0R bUIWldv0tSwXUyewOppqEFoqvdnS6RhWIrFJeeZslX4mTf+w6DSTCBaC9FAFYqpMo0+U BkqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cw8s/YHZ7PvnoGSE9VFOJmJ7OcBZMxXJRhzFX2CFS/0=; b=H8Xf+c/OQoWMkwsUs8gZ4LZZK1wFmD8BafdVoF6XozrsArhsZReFrg7lLTkhebq9VG HkzUeC1kYCrhORlAEk1uj3h2l/hBxVsxRUd7YdFgmcDFbejjF1E2dlHMWNoCPyjhJw4E Hl5DUhrF71+2yTTYrp1w4d3jPjMZQKhw1MvjSiYsHw4qIhLrVSMHna6iu+HyEQCG9lQl zqxl3ryp7CwIj7UnVqwYOEo8NfujKFdjxiRXMNatZAx+HblTj2uU3h1FeiNgQTCmeef6 HJOhXTu3xsNrFRZkyuEV/qyZ3lx3OuRrR5RvgL8Mxns8T/s1cnBIr5sG6mLgox06Z9bM sKSw== X-Gm-Message-State: APjAAAUNzYHLM1u5PdgOWJ4qSI6zpqdgS0sv1rHIPf6YoQ4KYLp7b90s vqRUynt4V/ClkUn1PjRC2kxI3A== X-Received: by 2002:adf:ef49:: with SMTP id c9mr7935008wrp.188.1564604983627; Wed, 31 Jul 2019 13:29:43 -0700 (PDT) Received: from localhost.localdomain (19.red-176-86-136.dynamicip.rima-tde.net. [176.86.136.19]) by smtp.gmail.com with ESMTPSA id i18sm91905591wrp.91.2019.07.31.13.29.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jul 2019 13:29:43 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, bjorn.andersson@linaro.org, sboyd@kernel.org, david.brown@linaro.org, jassisinghbrar@gmail.com, mark.rutland@arm.com, mturquette@baylibre.com, robh+dt@kernel.org, will.deacon@arm.com, arnd@arndb.de, horms+renesas@verge.net.au, heiko@sntech.de, sibis@codeaurora.org, enric.balletbo@collabora.com, jagan@amarulasolutions.com, olof@lixom.net Cc: vkoul@kernel.org, niklas.cassel@linaro.org, georgi.djakov@linaro.org, amit.kucheria@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-msm@vger.kernel.org, khasim.mohammed@linaro.org Subject: [PATCH v4 05/13] clk: qcom: apcs-msm8916: get parent clock names from DT Date: Wed, 31 Jul 2019 22:29:21 +0200 Message-Id: <20190731202929.16443-6-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190731202929.16443-1-jorge.ramirez-ortiz@linaro.org> References: <20190731202929.16443-1-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow accessing the parent clock names required for the driver operation by using the device tree node. This permits extending the driver to other platforms without having to modify its source code. For backwards compatibility leave previous values as default. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson --- drivers/clk/qcom/apcs-msm8916.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) -- 2.22.0 diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c index a6c89a310b18..dd82eb1e5202 100644 --- a/drivers/clk/qcom/apcs-msm8916.c +++ b/drivers/clk/qcom/apcs-msm8916.c @@ -19,7 +19,7 @@ static const u32 gpll0_a53cc_map[] = { 4, 5 }; -static const char * const gpll0_a53cc[] = { +static const char *gpll0_a53cc[] = { "gpll0_vote", "a53pll", }; @@ -50,6 +50,8 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) struct regmap *regmap; struct clk_init_data init = { }; int ret = -ENODEV; + const char *parents[2]; + int pll_index = 0; regmap = dev_get_regmap(parent, NULL); if (!regmap) { @@ -61,6 +63,16 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) if (!a53cc) return -ENOMEM; + /* legacy bindings only defined the pll parent clock (index = 0) with no + * name; when both of the parents are specified in the bindings, the + * pll is the second one (index = 1). + */ + if (of_clk_parent_fill(parent->of_node, parents, 2) == 2) { + gpll0_a53cc[0] = parents[0]; + gpll0_a53cc[1] = parents[1]; + pll_index = 1; + } + init.name = "a53mux"; init.parent_names = gpll0_a53cc; init.num_parents = ARRAY_SIZE(gpll0_a53cc); @@ -76,10 +88,11 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) a53cc->src_shift = 8; a53cc->parent_map = gpll0_a53cc_map; - a53cc->pclk = devm_clk_get(parent, NULL); + a53cc->pclk = of_clk_get(parent->of_node, pll_index); if (IS_ERR(a53cc->pclk)) { ret = PTR_ERR(a53cc->pclk); - dev_err(dev, "failed to get clk: %d\n", ret); + if (ret != -EPROBE_DEFER) + dev_err(dev, "failed to get clk: %d\n", ret); return ret; } @@ -87,6 +100,7 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) ret = clk_notifier_register(a53cc->pclk, &a53cc->clk_nb); if (ret) { dev_err(dev, "failed to register clock notifier: %d\n", ret); + clk_put(a53cc->pclk); return ret; } @@ -109,6 +123,8 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) err: clk_notifier_unregister(a53cc->pclk, &a53cc->clk_nb); + clk_put(a53cc->pclk); + return ret; } @@ -117,6 +133,7 @@ static int qcom_apcs_msm8916_clk_remove(struct platform_device *pdev) struct clk_regmap_mux_div *a53cc = platform_get_drvdata(pdev); clk_notifier_unregister(a53cc->pclk, &a53cc->clk_nb); + clk_put(a53cc->pclk); return 0; }