From patchwork Mon Apr 16 17:57:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 133485 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3840465ljb; Mon, 16 Apr 2018 10:58:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx49KRUqNIb1GkTvMkbcGlz/mha39y4y8GMW4tOYiaNdOYBTpo1e/SzZu9fWIPo7UNIozJzfa X-Received: by 10.98.34.209 with SMTP id p78mr11189341pfj.236.1523901510534; Mon, 16 Apr 2018 10:58:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523901510; cv=none; d=google.com; s=arc-20160816; b=UyJs2WfwzFK3/D/uWFTn9xAFQf0R2iA02MHUQgyYzXBz1AkbAoGIzeUi91Fe7+bAOK 7m8KwpGkEZthDTR8UxLvOr+RDp11TaQY5fgLo99OiQaPKRBEgj+wTG8EUfpmjzqoOiD3 JN6blLCKZjisIxwTOK22p24geQPAI2QZ1rS0Lvf3xsQfs3vuIXlV2/RezeJYW/tSHeHN D3NXpPnZVM4XqD7LYpoxbqTU/brKTrhwvndKHDtVxTtOTLbmez+BE1Vada+D73ukalxd yQ84ZOETauGIWQoT/T2f0zjAUXfteYxMCu59TYT14IaxvM9cPzKsyst7QgXeJHa5xn1E TQWg== 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:dkim-signature:arc-authentication-results; bh=QK5C7FyUjlOaeDROn8KWGrv4GcnkTAeEBIvF6N+9eBk=; b=H8RQMP9n0zhZg77nYOUH5QDtRJqwi6Uv+MvrJM1+IlSiHAi+yoTWGQ68iP3dBYQoQz wGCovaxLfUoSiiqIJQr3FF2NkEKkBtJ0yWDrsEl6dJ6boSSZq+tsQ2XBLKQz/tPCXFtq 72byrk/0ZaO4L1SYHD/dkbfvmwf199/RiJHeglJinkmpTOTtKyyWqgTkHRFQrTtOArrF K0HnHopsDwFa/6eEmZ1CHm8Uhjj8Vg9zskPpkgH8DmD+N8Do5WQ9MLDm3yF0HGW4b6/B IiI8N1H8eimyjw1UaZUTmQcBHqC42MqEGwMJoJrjI+PnOfawIUxJitvlEVKKW1OyYPz2 3WIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=1yUfC0Cj; 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 m6-v6si3998657plt.54.2018.04.16.10.58.30; Mon, 16 Apr 2018 10:58:30 -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=1yUfC0Cj; 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 S1753241AbeDPR61 (ORCPT + 29 others); Mon, 16 Apr 2018 13:58:27 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35244 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752806AbeDPR5u (ORCPT ); Mon, 16 Apr 2018 13:57:50 -0400 Received: by mail-wr0-f194.google.com with SMTP id w3so11833242wrg.2 for ; Mon, 16 Apr 2018 10:57:49 -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; bh=QK5C7FyUjlOaeDROn8KWGrv4GcnkTAeEBIvF6N+9eBk=; b=1yUfC0CjPSIaYXiV0liljrd4sD/2oUJBppVvO/iN72eEDLHIIkaSbwjx+Pe//jM8uc e3f/7wwlYSXDJpGusmMm3syT1M8XpKYM7HsaEfLxHeDa4n+kzTt3FxLG0o3JUj9a6UZ0 A208dCjbrZDBzEiaKvUpstQWGVr8D5VaDoJw2ltZqfWX5nMnV7UH5oVwYYvsDNOuNRUZ EjXk0aiEwlEjggt9V5rNzhBC2o+6ov04MEwEy+rzaXqc4EdZdv8W94dhlXJm0GnWGVul +e+Ololp5vUGKq5wzG2W0lZcnhBEL89Vkf52UCecEetw7zW0doajXZObvgs6bjL1K20U qElA== 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; bh=QK5C7FyUjlOaeDROn8KWGrv4GcnkTAeEBIvF6N+9eBk=; b=ru8lAJlGZqurutfLmDaTsNHyP3fZNSB4Qp5fa1hsEypCVZA6oA+x+g+k11yv21Z2vQ DxN+NCbTVFBP2AijdqzUUR/txSP+JRhl1mbq4+B0ruLbdhnhNSw0/bDGs14Zp/rkNcLI YM3s8kdXxCLrgNQnzlzQjsGEgynysNZtNBlHTHsmf/wXfVgGh+O7nTQiaPKX+79okUQX gN9XAC9hsjqlEiTUkXuSpjfC2KzzjcEDDatETE5iISzJAXTRjx5YfsrrM5IWfb9WBcb9 r4Cg8TmrRkZWv4NrnMbIrRl73J3fukoNruPfUY5UJv7/QA7zxbGYkKtiGBu2lg6heSL+ ihKg== X-Gm-Message-State: ALQs6tA9GXm/xoESNtmiWsHTN98vzpk0qN8GayQIpnbDesAXcGz+tTTz JTa4dQp8ya0gBnfEPACUYnKZ6Bkg X-Received: by 10.28.174.79 with SMTP id x76mr11884066wme.41.1523901468303; Mon, 16 Apr 2018 10:57:48 -0700 (PDT) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 24sm18967123wrt.60.2018.04.16.10.57.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Apr 2018 10:57:47 -0700 (PDT) From: Jerome Brunet To: Michael Turquette , Stephen Boyd , Russell King Cc: Jerome Brunet , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] clk: add duty cycle support Date: Mon, 16 Apr 2018 19:57:41 +0200 Message-Id: <20180416175743.20826-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180416175743.20826-1-jbrunet@baylibre.com> References: <20180416175743.20826-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the possibility to apply and query the clock signal duty cycle ratio. This is useful when the duty cycle of the clock signal depends on some other parameters controlled by the clock framework. Signed-off-by: Jerome Brunet --- drivers/clk/clk.c | 196 +++++++++++++++++++++++++++++++++++++++++-- include/linux/clk-provider.h | 17 ++++ include/linux/clk.h | 32 +++++++ include/trace/events/clk.h | 36 ++++++++ 4 files changed, 276 insertions(+), 5 deletions(-) -- 2.14.3 diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 7af555f0e60c..fff7890ae355 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -68,6 +68,8 @@ struct clk_core { unsigned long max_rate; unsigned long accuracy; int phase; + unsigned int duty_num; + unsigned int duty_den; struct hlist_head children; struct hlist_node child_node; struct hlist_head clks; @@ -2401,6 +2403,164 @@ int clk_get_phase(struct clk *clk) } EXPORT_SYMBOL_GPL(clk_get_phase); +static int clk_core_update_duty_cycle_nolock(struct clk_core *core) +{ + int ret; + unsigned int num, den; + + if (!core || !core->ops->get_duty_cycle) + return 0; + + /* Update the duty cycle if the callback is available */ + ret = core->ops->get_duty_cycle(core->hw, &num, &den); + if (ret) + return ret; + + /* Don't trust the clock provider too much */ + if (den == 0 || (num > den)) + return -EINVAL; + + core->duty_num = num; + core->duty_den = den; + + return 0; +} + +static int clk_core_get_duty_cycle_nolock(struct clk_core *core, + unsigned int *num, + unsigned int *den) +{ + int ret; + + if (!core) + return 0; + + ret = clk_core_update_duty_cycle_nolock(core); + + if (!ret) { + *num = core->duty_num; + *den = core->duty_den; + } + + return ret; +} + +static int clk_core_set_duty_cycle_nolock(struct clk_core *core, + unsigned int num, + unsigned int den) +{ + int ret; + + lockdep_assert_held(&prepare_lock); + + if (!core || !core->ops->set_duty_cycle) + return 0; + + if (clk_core_rate_is_protected(core)) + return -EBUSY; + + trace_clk_set_duty_cycle(core, num, den); + + ret = core->ops->set_duty_cycle(core->hw, num, den); + if (ret) + return ret; + + core->duty_num = num; + core->duty_den = den; + + trace_clk_set_duty_cycle_complete(core, num, den); + + return ret; +} + +/** + * clk_set_duty_cycle - adjust the duty cycle ratio of a clock signal + * @clk: clock signal source + * @ratio: duty cycle ratio in milli-percent + * + * ADD BLURB HERE + */ +int clk_set_duty_cycle(struct clk *clk, unsigned int num, unsigned int den) +{ + int ret; + + if (!clk) + return 0; + + /* sanity check the ratio */ + if (den == 0 || (num > den)) + return -EINVAL; + + clk_prepare_lock(); + + if (clk->exclusive_count) + clk_core_rate_unprotect(clk->core); + + ret = clk_core_set_duty_cycle_nolock(clk->core, num, den); + + if (clk->exclusive_count) + clk_core_rate_protect(clk->core); + + clk_prepare_unlock(); + + return ret; +} +EXPORT_SYMBOL_GPL(clk_set_duty_cycle); + +static unsigned int clk_core_get_scaled_duty_cycle(struct clk_core *core, + unsigned int scale) +{ + int ret; + unsigned int duty; + + clk_prepare_lock(); + ret = clk_core_update_duty_cycle_nolock(core); + if (ret) + return 0; + + duty = DIV_ROUND_CLOSEST_ULL((u64)core->duty_num * scale, + core->duty_den); + + clk_prepare_unlock(); + + return duty; +} + +/** + * clk_get_scaled_duty_cycle - return the duty cycle ratio of a clock signal + * @clk: clock signal source + * @scale: scaling factor to be applied to represent the ratio as an integer + * + * Returns the duty cycle ratio of a clock node multiplied by the provided + * scaling factor. + */ +unsigned int clk_get_scaled_duty_cycle(struct clk *clk, unsigned int scale) +{ + if (!clk) + return 0; + + return clk_core_get_scaled_duty_cycle(clk->core, scale); +} +EXPORT_SYMBOL_GPL(clk_get_scaled_duty_cycle); + +int __clk_set_duty_cycle_passthrough(struct clk_hw *hw, unsigned int num, + unsigned int den) +{ + struct clk_core *parent = hw->core->parent; + + return clk_core_set_duty_cycle_nolock(parent, num, den); +} +EXPORT_SYMBOL_GPL(__clk_set_duty_cycle_passthrough); + +int __clk_get_duty_cycle_passthrough(struct clk_hw *hw, unsigned int *num, + unsigned int *den) +{ + struct clk_core *parent = hw->core->parent; + + return clk_core_get_duty_cycle_nolock(parent, num, den); +} +EXPORT_SYMBOL_GPL(__clk_get_duty_cycle_passthrough); + /** * clk_is_match - check if two clk's point to the same hardware clock * @p: clk compared against q @@ -2454,12 +2614,13 @@ static void clk_summary_show_one(struct seq_file *s, struct clk_core *c, if (!c) return; - seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu %-3d\n", + seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu %5d %6d\n", level * 3 + 1, "", 30 - level * 3, c->name, c->enable_count, c->prepare_count, c->protect_count, clk_core_get_rate(c), clk_core_get_accuracy(c), - clk_core_get_phase(c)); + clk_core_get_phase(c), + clk_core_get_scaled_duty_cycle(c, 100000)); } static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c, @@ -2481,9 +2642,9 @@ static int clk_summary_show(struct seq_file *s, void *data) struct clk_core *c; struct hlist_head **lists = (struct hlist_head **)s->private; - seq_puts(s, " enable prepare protect \n"); - seq_puts(s, " clock count count count rate accuracy phase\n"); - seq_puts(s, "----------------------------------------------------------------------------------------\n"); + seq_puts(s, " enable prepare protect duty\n"); + seq_puts(s, " clock count count count rate accuracy phase cycle\n"); + seq_puts(s, "---------------------------------------------------------------------------------------------\n"); clk_prepare_lock(); @@ -2510,6 +2671,8 @@ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c)); seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c)); seq_printf(s, "\"phase\": %d", clk_core_get_phase(c)); + seq_printf(s, "\"duty_cycle\": %u", + clk_core_get_scaled_duty_cycle(c, 100000)); } static void clk_dump_subtree(struct seq_file *s, struct clk_core *c, int level) @@ -2638,6 +2801,16 @@ static int clk_debug_create_one(struct clk_core *core, struct dentry *pdentry) if (!d) goto err_out; + d = debugfs_create_u32("clk_duty_num", 0444, core->dentry, + &core->duty_num); + if (!d) + goto err_out; + + d = debugfs_create_u32("clk_duty_den", 0444, core->dentry, + &core->duty_den); + if (!d) + goto err_out; + d = debugfs_create_file("clk_flags", 0444, core->dentry, core, &clk_flags_fops); if (!d) @@ -2926,6 +3099,19 @@ static int __clk_core_init(struct clk_core *core) else core->phase = 0; + /* + * Set clk's duty cycle. + */ + if (core->ops->get_duty_cycle) { + core->ops->get_duty_cycle(core->hw, &core->duty_num, + &core->duty_den); + } else { + /* if the operation is not available, assume 50% */ + core->duty_num = 1; + core->duty_den = 2; + } + + /* * Set clk's rate. The preferred method is to use .recalc_rate. For * simple clocks and lazy developers the default fallback is to use the diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 1d25e149c1c5..91e0e37e736b 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -168,6 +168,15 @@ struct clk_rate_request { * by the second argument. Valid values for degrees are * 0-359. Return 0 on success, otherwise -EERROR. * + * @get_duty_cycle: Queries the hardware to get the current duty cycle ratio + * of a clock. Returned values denominator cannot be 0 and must be + * superior or egal to the numerator. + * + * @set_duty_cycle: Apply the duty cycle ratio to this clock signal specified by + * the numerator (2nd argurment) and denominator (3rd argument). + * Argument must be a valid ratio (denominator > 0 + * and >= numerator) Return 0 on success, otherwise -EERROR. + * * @init: Perform platform-specific initialization magic. * This is not not used by any of the basic clock types. * Please consider other ways of solving initialization problems @@ -217,6 +226,10 @@ struct clk_ops { unsigned long parent_accuracy); int (*get_phase)(struct clk_hw *hw); int (*set_phase)(struct clk_hw *hw, int degrees); + int (*get_duty_cycle)(struct clk_hw *hw, unsigned int *num, + unsigned int *den); + int (*set_duty_cycle)(struct clk_hw *hw, unsigned int num, + unsigned int den); void (*init)(struct clk_hw *hw); int (*debug_init)(struct clk_hw *hw, struct dentry *dentry); }; @@ -771,6 +784,10 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw, void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent); void clk_hw_set_rate_range(struct clk_hw *hw, unsigned long min_rate, unsigned long max_rate); +int __clk_set_duty_cycle_passthrough(struct clk_hw *hw, unsigned int num, + unsigned int den); +int __clk_get_duty_cycle_passthrough(struct clk_hw *hw, unsigned int *num, + unsigned int *den); static inline void __clk_hw_set_clk(struct clk_hw *dst, struct clk_hw *src) { diff --git a/include/linux/clk.h b/include/linux/clk.h index 0dbd0885b2c2..ef363fd6218a 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -141,6 +141,26 @@ int clk_set_phase(struct clk *clk, int degrees); */ int clk_get_phase(struct clk *clk); +/** + * clk_set_duty_cycle - adjust the duty cycle ratio of a clock signal + * @clk: clock signal source + * @num: numerator of the duty cycle ratio to be applied + * @den: denominator of the duty cycle ratio to be applied + * + * Adjust the duty cycle of a clock signal by the specified ratio. Returns 0 on + * success, -EERROR otherwise. + */ +int clk_set_duty_cycle(struct clk *clk, unsigned int num, unsigned int den); + +/** + * clk_get_duty_cycle - return the duty cycle ratio of a clock signal + * @clk: clock signal source + * @scale: scaling factor to be applied to represent the ratio as an integer + * + * Returns the duty cycle ratio multiplied by the scale provided + */ +unsigned int clk_get_scaled_duty_cycle(struct clk *clk, unsigned int scale); + /** * clk_is_match - check if two clk's point to the same hardware clock * @p: clk compared against q @@ -183,6 +203,18 @@ static inline long clk_get_phase(struct clk *clk) return -ENOTSUPP; } +static inline int clk_set_duty_cycle(struct clk *clk, unsigned int num, + unsigned int den) +{ + return -ENOTSUPP; +} + +static inline unsigned int clk_get_scaled_duty_cycle(struct clk *clk, + unsigned int scale) +{ + return 0; +} + static inline bool clk_is_match(const struct clk *p, const struct clk *q) { return p == q; diff --git a/include/trace/events/clk.h b/include/trace/events/clk.h index 2cd449328aee..9625a19cc159 100644 --- a/include/trace/events/clk.h +++ b/include/trace/events/clk.h @@ -192,6 +192,42 @@ DEFINE_EVENT(clk_phase, clk_set_phase_complete, TP_ARGS(core, phase) ); +DECLARE_EVENT_CLASS(clk_duty_cycle, + + TP_PROTO(struct clk_core *core, unsigned int num, unsigned int den), + + TP_ARGS(core, num, den), + + TP_STRUCT__entry( + __string( name, core->name ) + __field( unsigned int, num ) + __field( unsigned int, den ) + ), + + TP_fast_assign( + __assign_str(name, core->name); + __entry->num = num; + __entry->den = den; + ), + + TP_printk("%s %u/%u", __get_str(name), (unsigned int)__entry->num, + (unsigned int)__entry->den) +); + +DEFINE_EVENT(clk_duty_cycle, clk_set_duty_cycle, + + TP_PROTO(struct clk_core *core, unsigned int num, unsigned int den), + + TP_ARGS(core, num, den) +); + +DEFINE_EVENT(clk_duty_cycle, clk_set_duty_cycle_complete, + + TP_PROTO(struct clk_core *core, unsigned int num, unsigned int den), + + TP_ARGS(core, num, den) +); + #endif /* _TRACE_CLK_H */ /* This part must be outside protection */ From patchwork Mon Apr 16 17:57:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 133484 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3840278ljb; Mon, 16 Apr 2018 10:58:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+r0MxsihQawRjWYz6mjgVNas75wHpJFAKX/1v0JC+cElex3JodocYFt2H8WB1e9KXpuX8C X-Received: by 10.98.166.14 with SMTP id t14mr22734931pfe.195.1523901496756; Mon, 16 Apr 2018 10:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523901496; cv=none; d=google.com; s=arc-20160816; b=djtcoL2vNi0vjI5hZNzqhEWaFBpAL9X9FgMtlLx1kYxOiq46oqFTUpOSuims3cfY4n pZffsBQuLDZc1XH+jNOoSbhRZifKbPEIT9V1sn5IPN6VRmGAcFhKYYbv/Xt1eJRVBQq2 mHlTjDNxlYbjbCB1KDKezHKotemJ7M/xnCouDAklwRfXP2z8OZK6jsmQWaLFT8jt6KAg 4fR+CODMr+1v/+srTFCpTfA1e0upqt2l9/pfw3JcKU2N6Wjda02AHAuZwXrqqAh4Riu0 kyTuUsA05VmuaEEZ2UoqX7I4dpPwFsUyrrso5hR414X2eUIdia7PLNnmYkDjTzv5rxBV tXlA== 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:dkim-signature:arc-authentication-results; bh=t2Iqj1i6NsWqfMWpBqSpHP6ftrbCb2kWdu83cHoosOM=; b=QSCxwilyJAsSEUrVjg8vuMXmcf/UdZibm1PymX9MWzBJ8aaVNUaRxrer83/ltcAixv WyMCMobIERLPyForRvoBgr00m/7Ulx38tQw6Rw8GAsy2QjgT/3eBnpK9ooJBrBTpKRaO HNoGnUqr4Ryw9Khfab5ITjFMGniLbNXNUzwhus2+db78lIuBnKEyM8rsfVK0+nPbiEdK CkbZeGTjXcRFHHwx/0/qd+N8s1Cyd3qhOuRx9b8Wkgv5Hn4aUxOUROE3A2YR0PGUkeag tZIF219d95Qu66u+LnDO+DGjxIcI/myZVRT1zz41wp1ux47r0yRlfPD2Q76kzAgL3wL5 pDbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=lcdiLQAq; 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 33-v6si12585450ply.517.2018.04.16.10.58.16; Mon, 16 Apr 2018 10:58:16 -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=lcdiLQAq; 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 S1753206AbeDPR6N (ORCPT + 29 others); Mon, 16 Apr 2018 13:58:13 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:41261 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752975AbeDPR5u (ORCPT ); Mon, 16 Apr 2018 13:57:50 -0400 Received: by mail-wr0-f193.google.com with SMTP id v24so11398774wra.8 for ; Mon, 16 Apr 2018 10:57:50 -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; bh=t2Iqj1i6NsWqfMWpBqSpHP6ftrbCb2kWdu83cHoosOM=; b=lcdiLQAqhZZA2dgQqEEFL4wwk86XC5n1rE5nKuZRSqsHEZ7CijGoIwyspj4ZRUUhFO RT3db/WfkbiOi/29MGEWZIAF63l+Xj1+Pbe6Ci5Q98t1/WrNxg73JuEkHNsV1e/NBKgo PnDMBJC0DA+YPa4KxrhbyFi3D8ABTZy30ZVHmrSdc6PVOahxu+hZn3qYTjMZQj1vfxeZ pFF5JZxJr78AMWWbeBjUzZB7Pcb5+hyEsleqABE1C6Gy+YlVw5gyeXuemwXMk8m4d9st l5e7lIs7Sf8IGoDpXEXEVyfY3RgrWi9dSMxeUa+LqyuMBPpZH2fcOVqK08GbZtbzaUUM sobg== 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; bh=t2Iqj1i6NsWqfMWpBqSpHP6ftrbCb2kWdu83cHoosOM=; b=HhybEMkadDLRancagQPCWrpzQsdOSS2FrzSM9eRy2z4oIL8WKstALng44ot6ybo5PB ww2obFv0rgDaBz2Xw3Z74qVBq+W3w+Hl2iZ6lQxa9HAOFWJhksmP6W9KHH/hgzPjklss Hz/IORIvYlcv+rJO3O8C6rh14AFk9izd5/cpNH0dvUOe9i59qYiOmjO1o2+YP1Q4LSeX P76xgPz3/Un0GUjwTgMQiAaRpYGSU/Lmgd9HDtPKSHz4Nh0CR4YL7e3Cy/cDX4smvf4L Is+K89I7Jhsc7cvWnSwnC/hoFVMbwgSysPjM3J00m0IEf+eK0UqXErkmCISaJE+uVN7W Cqug== X-Gm-Message-State: ALQs6tBHLkBCxTAyhY5wFB6PznCT35duopYK+ow6R+lwy2Ilo9bQpB8/ 1y/khkw9ZhohE7dMS8pOM3CB0A== X-Received: by 10.223.164.207 with SMTP id h15mr3808849wrb.265.1523901469251; Mon, 16 Apr 2018 10:57:49 -0700 (PDT) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 24sm18967123wrt.60.2018.04.16.10.57.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Apr 2018 10:57:48 -0700 (PDT) From: Jerome Brunet To: Michael Turquette , Stephen Boyd , Russell King Cc: Jerome Brunet , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] clk: gate: add duty cycle passthrough ops Date: Mon, 16 Apr 2018 19:57:42 +0200 Message-Id: <20180416175743.20826-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180416175743.20826-1-jbrunet@baylibre.com> References: <20180416175743.20826-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A clock gate does not resample the clock signal, it give the same signal as the parent if enabled, so it can use the duty cycle passthrough operations Signed-off-by: Jerome Brunet --- drivers/clk/clk-gate.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.14.3 diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index dd82485e09a1..eb6dcebfcd5c 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -107,6 +107,8 @@ const struct clk_ops clk_gate_ops = { .enable = clk_gate_enable, .disable = clk_gate_disable, .is_enabled = clk_gate_is_enabled, + .set_duty_cycle = __clk_set_duty_cycle_passthrough, + .get_duty_cycle = __clk_get_duty_cycle_passthrough, }; EXPORT_SYMBOL_GPL(clk_gate_ops); From patchwork Mon Apr 16 17:57:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 133483 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3840252ljb; Mon, 16 Apr 2018 10:58:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/XUyIlsgOGuZMQwCPyPGRF2+BGT65rVDzi5RSHnBZ+4TKN949yGBd/SsoR7H4oumYttE/R X-Received: by 10.99.63.1 with SMTP id m1mr12982205pga.196.1523901478939; Mon, 16 Apr 2018 10:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523901478; cv=none; d=google.com; s=arc-20160816; b=i5oZbAiTHJudFPSk+IxyC9uAjs4t7v8zyxlgk4ku6514QHtVOhHODk69mXRLL3I2S/ JK6+6baL4C3iNHmK6ZJ1+vesFDF9DV+FuJy2NC3kJK3duDvlx+BGEW7rBJeD+Kxlo7Z5 JfLQfL3QIu2DDwj6c2UC/YgX/fnFQ2liyjzW3zlrxB5KaAha6oxDaoRWc2b0ErDQgQU5 39U0fbikkqmOypmq0mImo0OE6Aw47XU7aDgZTc1dckuqQJjayRUcj1sYnVIs8LC8BQzr t+yZbmYeT5HpsBUBXidamDKPqWo5KH8mwbQ/AhoGB3O11PxmqI5xHjWS+Xk/5zFsyTJj o0wQ== 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:dkim-signature:arc-authentication-results; bh=iS2b5bARbnt7l8DpjE93h8NSx64u69XDbwh48LDG8jE=; b=wCavrBMSmwhnTZZrchE9jJdgAIomObWd5F3ktpDGOEv5XZoK1LcZedo0z5MfC0jfO8 AVtTrX5vQs1AkE0bNFX7XKdArlTDmI/AG2Ixn5KwTk6c+5+2D1+b12IFUaggnTaFL1MN hwyq8Osl3ewHV1TPpVPBbRvBwTEAYXor8HpSeBWkmfyXkuSqQRt2LHVHZFB9d/usjXfj odXUOwAP8PpPBCBBSbTcmzDW9v0T1fXRIPSX1iUcCsbcttvGJNdsNs2B+gfAHNy3RLtR ftD68mmoXDMLuZdInQBKB5HmrujeI3faUsFseKA3ySLS3W3mtxZFoEaOsPdvoIy+vleB P2Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=keM0emXc; 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 n1-v6si12470743pld.280.2018.04.16.10.57.58; Mon, 16 Apr 2018 10:57:58 -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=keM0emXc; 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 S1753201AbeDPR5z (ORCPT + 29 others); Mon, 16 Apr 2018 13:57:55 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:40055 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753165AbeDPR5w (ORCPT ); Mon, 16 Apr 2018 13:57:52 -0400 Received: by mail-wr0-f194.google.com with SMTP id v60so24571003wrc.7 for ; Mon, 16 Apr 2018 10:57:51 -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; bh=iS2b5bARbnt7l8DpjE93h8NSx64u69XDbwh48LDG8jE=; b=keM0emXcq5rbd9wjwnZKZuYs+4Dxxuo9zld+RBtKzG4ih9EevGwTiFlOy6iUsFx2Nf 7EZIqwmJC8HZJSI+ddyeCqCAhJ5qZyvxGWUPo90XF0F6cyAkS0FEE7fmVay7qWtPzBml zCD1G/rnVNMjsb95qexWAEr6HtlblB0lLvnzHckCcMD4K5s71/9pziVPqr0I0Mr2B/b4 8RZ53EWOF5ThhkGV6f4e6JWDAeWdQDgHWJiLLhTIwfs7MxYA2fqqBBwWjKv4YWkdzG2M dqG8VhJ+yPGBIt7bcX3Xykh5fVZZ8FqxRT/hILhooopedq/5fuC10Ebt5vv90QC47gpd wRbg== 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; bh=iS2b5bARbnt7l8DpjE93h8NSx64u69XDbwh48LDG8jE=; b=QwvkBGRtq2fEIZjuKV7Eofv64JbO7npN17S1z9iLclBbgk/365sI9jVTgEykegGsvm hATuP/YvQTP8SQGI7jd5oW1+YVKzry1adlF0IBtmf6kSihgr2Qe/Q04LxqHi2Uuck2Hw PV0pmblS4lZFFKZ/4KofxGOCieF9QT37YIPKfNx93Fikkvb1sD4TNb7nAR0xP8PbnCK+ lmYkc+4IkgHx7aIFFEwhiAr839kK4ByvpYHrENCgU+SoQLR6iNlxU9juVWSqJE6D6bYy JkHzpoz1jZFRdaVuNBr75+PHBOKonyEDEepG/3jV/zNhXEm+24zshvXYIiaE+MLo4N7t RRvA== X-Gm-Message-State: ALQs6tAG+pdIWqxeQJchz/CSnUymWfek2VENYoCpwE1IuLibmc+oU1ni kQCJwTXQQJEHFbAxeLFdmhrLZw== X-Received: by 10.28.110.17 with SMTP id j17mr12058863wmc.65.1523901470452; Mon, 16 Apr 2018 10:57:50 -0700 (PDT) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 24sm18967123wrt.60.2018.04.16.10.57.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Apr 2018 10:57:49 -0700 (PDT) From: Jerome Brunet To: Michael Turquette , Stephen Boyd , Russell King Cc: Jerome Brunet , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] clk: mux: add duty cycle passthrough ops Date: Mon, 16 Apr 2018 19:57:43 +0200 Message-Id: <20180416175743.20826-4-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180416175743.20826-1-jbrunet@baylibre.com> References: <20180416175743.20826-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A clock mux does not resample the clock signal, it give the same signal as the selected parent, so it can use the duty cycle passthrough operations. Signed-off-by: Jerome Brunet --- drivers/clk/clk-mux.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.14.3 diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 1628b93655ed..f7c597779928 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -124,11 +124,15 @@ const struct clk_ops clk_mux_ops = { .get_parent = clk_mux_get_parent, .set_parent = clk_mux_set_parent, .determine_rate = clk_mux_determine_rate, + .set_duty_cycle = __clk_set_duty_cycle_passthrough, + .get_duty_cycle = __clk_get_duty_cycle_passthrough, }; EXPORT_SYMBOL_GPL(clk_mux_ops); const struct clk_ops clk_mux_ro_ops = { .get_parent = clk_mux_get_parent, + .set_duty_cycle = __clk_set_duty_cycle_passthrough, + .get_duty_cycle = __clk_get_duty_cycle_passthrough, }; EXPORT_SYMBOL_GPL(clk_mux_ro_ops);