Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2029160ybi; Thu, 20 Jun 2019 08:00:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxesbTWz2F49Xt1ejiwaL3nJ3vxZGjtABaei9GGs0lT7DGA52hlSZV5Hhl5bLtiIn33N/f7 X-Received: by 2002:a62:28b:: with SMTP id 133mr8240720pfc.251.1561042854685; Thu, 20 Jun 2019 08:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561042854; cv=none; d=google.com; s=arc-20160816; b=qGDxLNcqchxqZd30KIPNMOTyCijrqvRIsao63vwVV0frPU/HeZjVY7aOX9rCIWZ0SH ST/YLN/1PXSj5SRuvlxtYt6zAKxC3RTg7K2d+IhAEQA0kxOEf8NlmKx28brEXcjtcV0i GcxOpG86POuOr0FND1cOGkfM1KYKC01evomzKllz0AjLxE0jCUzJEwpbGGstkUsJgVPn TGMkxG49YQ/5xMYBBFswz9MVjhPCOqipRQGUuSEOhnxo+G9kkhj5rF3mnYQFfylDsY1N 9Bo+I4CGw4yGwg9PDn9WnBXbP6uTB9MIcZ1EUMlSBsC9WKMB9sT5NY6SiHWIJS8u5Yvp HgGg== 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=By2vibD8ed5SvKJiLslQhTFpnxDveNnIcoeXnTW3Wf0=; b=jh9BFPBC14h5zx4Kl7T6CSSqP3BTIH4zY27D/mfamOhUjDNM5q6e5EsRr7OO5N3NYY O5JHPjBeTtPiVJrf8hkafC7NqvfXzfSl40F+wszxUH+saTZ/x5sE07dO2mYzQbZJRSYi NUsvT5Qv6/scrxvMdSmaKRQpctC2DPIZJt9nZZ82taZrQ3J20Kkho7eMmZ1vKDnQ1wvT NV7+ySZvAqgo1Q4V7swkpbsbi0Gjr2Ad27QJMGyd1THClwKHKLJM0/JCaMgKJ4JlMMzK oDiDWVD0rma1lGuCvLVN+w5+dnxqki9KbY3L0dTjep+V/eXvlq04SglMAuH4ms9/vLG5 X35w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=aQf+Iy0n; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si5997827pgd.64.2019.06.20.08.00.38; Thu, 20 Jun 2019 08:00:54 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=aQf+Iy0n; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731980AbfFTPA2 (ORCPT + 99 others); Thu, 20 Jun 2019 11:00:28 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38848 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731743AbfFTPAY (ORCPT ); Thu, 20 Jun 2019 11:00:24 -0400 Received: by mail-wm1-f66.google.com with SMTP id s15so3503294wmj.3 for ; Thu, 20 Jun 2019 08:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=By2vibD8ed5SvKJiLslQhTFpnxDveNnIcoeXnTW3Wf0=; b=aQf+Iy0nQ0FQz8qVhHiGfNhuG8rZz4Xwl8uToXWSA9d/lK5cjgTn5CJbCx89xFVaUY zhvkAyBr0XVnDpxdj7Os7AjgRlMh3uMWCzy7V7QqvOBDr9m3wKmhkzqxgw02c/jmoZDd pkYbaHjQAE+XlY0OUqp+Tm3cMJVRI8gogX6H21TYpYDn6V0yTXXjkgr6zLhR1ccb/Qur Sy0w50kZ1kuE5m2WZZog4dyJjKa5qzizHbfwjscF+BBrU/SGTkIKzLvD9lbMoJIKyhFF vpshSB7255OsuDSy8vFEEwplNxQtoiCs3MhaVO1BfwvwWxNTNrQGApMOsLU8dmjwWgSg zkrw== 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=By2vibD8ed5SvKJiLslQhTFpnxDveNnIcoeXnTW3Wf0=; b=Xw5iZONsx0K32OigHXycmFlp361Fo4yB59YEcAnOMyfZq9w8oNlTECoPa4pXLUCazJ 2XPWPoBAsUzp+a55FniKKvYWlbzO/+dEKG+M/n+00aj6OR7bTzQOgO06g4JGQ6MUGivt UB1u3Qz92to0RvlylCn1lPI9qPp1E2hn77V8Fsv4T4ZXi+ywaLI5/ElA/B0bin0aNx+c rUmffbSRvP67OvQ4q95bq6E2RfsYILnXeG4kwG5JXdi6UFUdHxEteEtquxpnafSKQcmz 2TdcL9NDP9hEnkLo17JO9IUyl0hVSwNVmtQaxxRgE5hJsjPTX0jwIJDF1GLNDi899Ev5 7PXA== X-Gm-Message-State: APjAAAUxmqFeseZRhRyK35ryJMRmdZFHB5oGbTsAcvHuofKT3m0c2Vdc WVJIUboazRXHwf2fA2rqNvO82A== X-Received: by 2002:a1c:f205:: with SMTP id s5mr81645wmc.14.1561042822413; Thu, 20 Jun 2019 08:00:22 -0700 (PDT) Received: from bender.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id o126sm6802520wmo.1.2019.06.20.08.00.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Jun 2019 08:00:21 -0700 (PDT) From: Neil Armstrong To: jbrunet@baylibre.com, khilman@baylibre.com Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, martin.blumenstingl@googlemail.com, Neil Armstrong Subject: [RFC/RFT 02/14] clk: core: introduce clk_hw_set_parent() Date: Thu, 20 Jun 2019 17:00:01 +0200 Message-Id: <20190620150013.13462-3-narmstrong@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190620150013.13462-1-narmstrong@baylibre.com> References: <20190620150013.13462-1-narmstrong@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce the clk_hw_set_parent() provider call to change parent of a clock by using the clk_hw pointers. This eases the clock reparenting from clock rate notifiers and implementing DVFS with simpler code avoiding the boilerplates functions as __clk_lookup(clk_hw_get_name()) then clk_set_parent(). Signed-off-by: Neil Armstrong --- drivers/clk/clk.c | 5 +++++ include/linux/clk-provider.h | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index aa51756fd4d6..3e98f7dec626 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2490,6 +2490,11 @@ static int clk_core_set_parent_nolock(struct clk_core *core, return ret; } +int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *parent) +{ + return clk_core_set_parent_nolock(hw->core, parent->core); +} + /** * clk_set_parent - switch the parent of a mux clk * @clk: the mux clk whose input we are switching diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index bb6118f79784..8a453380f9a4 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -812,6 +812,7 @@ unsigned int clk_hw_get_num_parents(const struct clk_hw *hw); struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw); struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw, unsigned int index); +int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *new_parent); unsigned int __clk_get_enable_count(struct clk *clk); unsigned long clk_hw_get_rate(const struct clk_hw *hw); unsigned long __clk_get_flags(struct clk *clk); -- 2.21.0