Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1889390ybi; Mon, 1 Jul 2019 02:13:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNjAGKVovJme1AxYXmkNlfFYYEcW0xyImi2EjNt8UqQofJIgzmbSp4j0wW8ouLU4RXzo7q X-Received: by 2002:a17:90a:35e5:: with SMTP id r92mr30461456pjb.34.1561972419913; Mon, 01 Jul 2019 02:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561972419; cv=none; d=google.com; s=arc-20160816; b=dA4BFhA6PuHYy8t1J0UGmOG4xhJjunYxECWTWUYj1C7TEfJBCz/hG5cNH+XEQf8OoL fW9x1yiPty8G3G+ZgAjXmECjWY1juxDSQ5smlhTi72n5goL3GKWrZ2vwbO4C+UVdxs2p 7sISydCKOwjCeLrc2vG4j/tpuk+GOKBdWKJQYfapRzuiRbTng9ABuAKTniW2rnAG2Z0h DKem/hIcz2/hhpPI3UuMkAhb7XHQA9HfV08tKMwiSjwx7KExU7nNeF+EG3JEe4vvnL3N QJ+P6K2p3t2KGwYtXth0JqSEu9HRvTwS5VowMFh+tX15CMQalWEbVQ7yb3UNNpT8Qui1 zzYw== 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=3PBhHywaKoqeEXor4qGKKEbTn6ANfeSg4ls1LrAVLLs=; b=0IEWuDnXPC9iGeK+eFB2/jyQirItGHbxj8u6XG5B18Gi4e50Kk1cMa314HFJt3nYrS DhKSZgXrJF0+la5dO+ihixSXNcQe5UkQatREH/1ALzJEQmacbdVByicYOg7zRluQsnQm uqB16J/RKrqsZA64CFD2XTcpEHZc+oWPUYhRR3edHDAoT1h5CEAwvTloEszDNzXojdKy nTImceQPU9D8bxQG0d+OF45bPdpgDK5ICWnBZUxtdRttdRTD+LimQx+lreMp+USui997 dg/WWPQHZTJh59o0Re/RbiOnO+qvH/xj3ImWbB++PjV3yRH5bRhF3SjvM6FNlnzk9BsE xreg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=HsAPm2yL; 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 i15si10659586pfd.259.2019.07.01.02.13.24; Mon, 01 Jul 2019 02:13:39 -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=HsAPm2yL; 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 S1728383AbfGAJNQ (ORCPT + 99 others); Mon, 1 Jul 2019 05:13:16 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:51879 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728359AbfGAJNO (ORCPT ); Mon, 1 Jul 2019 05:13:14 -0400 Received: by mail-wm1-f68.google.com with SMTP id 207so15008589wma.1 for ; Mon, 01 Jul 2019 02:13:13 -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=3PBhHywaKoqeEXor4qGKKEbTn6ANfeSg4ls1LrAVLLs=; b=HsAPm2yLJUTmVQ7VrhIS3c6633P/oVY1hyXWdRrTSY0DaJFH5bo3iwB4WDLzqoIjFb +ofZX4UV7FR6yYxUXONipQWUjI3LKOc/TveJvoc3qP8bVzL0lMb2xqRjT3Aj98RxHlB+ GpNhcY2zmaGoJcTVbOliiJ6VXhUVfeSD7wO9C2/2prWgE9+Gdr833y2faMoNUxwUOhv4 Ty6IF1dEIyHgu4lzo46tWct6hPdW3k3KdsfcG0Wy5bOHVMxjZgNe2KVsQXBtDH5beIQX zOrKkgH/T2TGdTUlj9ohM0pkt2w+MnhOGAblF+pefLHBIOfNrheg34r/1SMhDhjzwlLK yNKw== 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=3PBhHywaKoqeEXor4qGKKEbTn6ANfeSg4ls1LrAVLLs=; b=mf7rCif1nI6hKjNtEqgaXFcVgWqR2MWhPaxVO1tDbG8PCy0B+/baHG06ysqbkkAnJs 71XxUUvjTKxvsqF0bgahrWtvaCu05OyvoggKMz8xO6q77l7NLrBL9XwCDjFuZmFuVO9w iAtJgfa24LvSQ/RsG2Rj+6IsHMEhNvTxD4kuqi5/IDvAH7lxZgnp7MygkO4dw+49wSrm aaeynK2/LkQpNai+tuckW3w9eZlO+mz02gbrZ9k+kxL1qKj73d9LX6+MncyOKeqGXma0 85ie+FUkia3DVqfKGmplwhYp3Xuyaww+dfohoz424KiyVItpqLJoJ1/NK+H4Cn7OMIND 3CtQ== X-Gm-Message-State: APjAAAWXWKg81Ov1nplLXWMvW8Xe6dru85YU2+o/YllAYiYYuA14z03F NpDxHPi24vimIv80pxlPbR4oXQ== X-Received: by 2002:a1c:c14b:: with SMTP id r72mr16534969wmf.166.1561972392885; Mon, 01 Jul 2019 02:13:12 -0700 (PDT) Received: from localhost.localdomain (176-150-251-154.abo.bbox.fr. [176.150.251.154]) by smtp.gmail.com with ESMTPSA id i16sm6305659wrm.37.2019.07.01.02.13.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jul 2019 02:13:12 -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, linux-gpio@vger.kernel.org, Neil Armstrong Subject: [RFC/RFT v3 02/14] clk: core: introduce clk_hw_set_parent() Date: Mon, 1 Jul 2019 11:12:46 +0200 Message-Id: <20190701091258.3870-3-narmstrong@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190701091258.3870-1-narmstrong@baylibre.com> References: <20190701091258.3870-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 | 6 ++++++ include/linux/clk-provider.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index aa51756fd4d6..06e1abe3391c 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2490,6 +2490,12 @@ 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); +} +EXPORT_SYMBOL_GPL(clk_hw_set_parent); + /** * 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