From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755347AbbCEK7Y (ORCPT ); Thu, 5 Mar 2015 05:59:24 -0500 Received: from metis.ext.pengutronix.de ([92.198.50.35]:39180 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755300AbbCEK7V (ORCPT ); Thu, 5 Mar 2015 05:59:21 -0500 Date: Thu, 5 Mar 2015 11:59:05 +0100 From: Sascha Hauer To: Viresh Kumar Cc: Pi-Cheng Chen , Mike Turquette , Stephen Boyd , Matthias Brugger , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Henry Chen , James Liao , Chen Fan , Eddie Huang , "Joe.C" , Linux Kernel Mailing List , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , Linaro Kernel Mailman List , linux-mediatek@lists.infradead.org Subject: Re: [PATCH] clk: mediatek: Export CPU mux clocks for CPU frequency control Message-ID: <20150305105905.GK11010@pengutronix.de> References: <1425466152-7867-1-git-send-email-pi-cheng.chen@linaro.org> <20150304112109.GB11010@pengutronix.de> <20150305074207.GC11010@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 11:51:30 up 4 days, 23:05, 56 users, load average: 0.12, 0.23, 0.22 User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 05, 2015 at 02:29:50PM +0530, Viresh Kumar wrote: > On 5 March 2015 at 13:12, Sascha Hauer wrote: > > We have clk_set_parent for changing the parent and clk_set_rate to > > change the rate. Use the former for changing the parent and the latter > > for changing the rate. What you are interested in is changing the > > parent, so use clk_set_parent for this and not abuse a side effect > > of clk_set_rate. > > clk_set_rate() for CPUs clock is responsible to change clock rate > of the CPU. Whether it plays with PLLs or muxes, its not that relevant. > > > My suggestion is to take another approach. Implement clk_set_rate for > > these muxes and in the set_rate hook: > > > > - switch mux to intermediate PLL parent > > - call clk_set_rate() for the real parent PLL > > - switch mux back to real parent PLL > > > > This way the things happening behind the scenes are completely transparent > > to the cpufreq driver and you can use cpufreq-dt as is without changes. > > CPUFreq wants to change to intermediate frequency by itself against > some magic change behind the scene. The major requirement for that > comes from the fact that we want to send PRE/POST freq notifiers on > which loops-per-jiffie depends. You could register a clk notifier using clk_notifier_register(). The notifer callback can then call the cpufreq notifiers. The clk notifiers can also be used to change the CPU voltage. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |