From patchwork Thu Mar 24 03:01:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feng Xiao X-Patchwork-Id: 8656801 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 88BE9C0553 for ; Thu, 24 Mar 2016 03:01:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 95B632035B for ; Thu, 24 Mar 2016 03:01:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A8037202E5 for ; Thu, 24 Mar 2016 03:01:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aivWl-0006oh-HT; Thu, 24 Mar 2016 03:01:39 +0000 Received: from regular1.263xmail.com ([211.150.99.131]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aivWZ-00068c-4A; Thu, 24 Mar 2016 03:01:29 +0000 Received: from xf?rock-chips.com (unknown [192.168.167.84]) by regular1.263xmail.com (Postfix) with SMTP id 1CAC93D84; Thu, 24 Mar 2016 11:01:01 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from [172.16.12.15] (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 087611EC4C; Thu, 24 Mar 2016 11:00:54 +0800 (CST) X-RL-SENDER: xf@rock-chips.com X-FST-TO: rjw@rjwysocki.net X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: xf@rock-chips.com X-UNIQUE-TAG: <86352e34b6b1d35bc08d0fb89a4e9045> X-ATTACHMENT-NUM: 0 X-SENDER: xf@rock-chips.com X-DNS-TYPE: 0 Received: from [172.16.12.15] (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 26885PHNNGE; Thu, 24 Mar 2016 11:00:58 +0800 (CST) Subject: Re: [PATCH v2] cpufreq: rockchip: add driver To: Viresh Kumar References: <1458647848-48999-1-git-send-email-xf@rock-chips.com> <1458699487-58470-1-git-send-email-xf@rock-chips.com> <20160323044033.GQ5272@vireshk-i7> From: Feng Xiao Message-ID: <56F35894.3020106@rock-chips.com> Date: Thu, 24 Mar 2016 11:01:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <20160323044033.GQ5272@vireshk-i7> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160323_200128_284544_2951A578 X-CRM114-Status: GOOD ( 14.48 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangtao@rock-chips.com, tim.chen@rock-chips.com, linux@arm.linux.org.uk, heiko@sntech.de, linux-pm@vger.kernel.org, xxx@rock-chips.com, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, zyw@rock-chips.com, jay.xu@rock-chips.com, linux-arm-kernel@lists.infradead.org, wxt@rock-chips.com Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP hi all, I found that it could match the cpufreq-dt driver succesfully only with the following changes. commit 07e461cd7e73a84f0e3757932b93cc80976fd749 Author: Grant Likely Date: Wed May 21 15:40:31 2014 +0900 of: Ensure unique names without sacrificing determinism The way the driver core is implemented, every device using the same bus type is required to have a unique name because a symlink to each device is created in the appropriate /sys/bus/*/devices directory, and two identical names causes a collision. The current code handles the requirement by using an globally incremented counter that is appended to the device name. It works, but it means any change to device registration will change the assigned numbers. Instead, if we build up the name by using information from the parent nodes, then it can be guaranteed to be unique without adding a random number to the end of it. Signed-off-by: Grant Likely Cc: Ezequiel Garcia Cc: Rob Herring If so, do I need to continue to add the new cpufreq driver ? ? 2016/3/23 12:40, Viresh Kumar ??: > On 23-03-16, 10:18, Feng Xiao wrote: >> diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm >> index 14b1f93..1786315 100644 >> --- a/drivers/cpufreq/Kconfig.arm >> +++ b/drivers/cpufreq/Kconfig.arm >> @@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ >> depends on ARCH_OMAP2PLUS >> default ARCH_OMAP2PLUS >> >> +config ARM_ROCKCHIP_CPUFREQ >> + tristate "Rockchip CPUfreq driver" > Since you are allowing it to be built as a module ... > >> + depends on ARCH_ROCKCHIP && CPUFREQ_DT >> + select PM_OPP >> + help >> + This adds the CPUFreq driver support for Rockchip SoCs. >> + The driver will directly use cpufreq-dt driver as backend. >> + >> + If in doubt, say N. >> +++ b/drivers/cpufreq/rockchip-cpufreq.c >> +static int __init rockchip_cpufreq_driver_init(void) >> +{ >> + struct platform_device *pdev; >> + int i; >> + >> + for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) { >> + if (of_machine_is_compatible(rockchip_compat[i])) { >> + pdev = platform_device_register_simple("cpufreq-dt", >> + -1, NULL, 0); >> + return PTR_ERR_OR_ZERO(pdev); >> + } >> + } >> + >> + return -ENODEV; >> +} >> +module_init(rockchip_cpufreq_driver_init); > You need a module exit as well to remove the device. Otherwise following > sequence will give you errors: > > insmod rockchip-cpufreq.ko > rmmod rockchip-cpufreq.ko > insmod rockchip-cpufreq.ko //Errors on this.. > > So, either don't allow it to be built as a module or fix the module-exit path. > --- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi @@ -139,6 +139,10 @@ }; }; + cpufreq-dt { //the node name must be cpufreq-dt + compatible = "rockchip,cpufreq"; // the compatible name is insignificant + }; + This was supported by the commit 07e461cd7e73a84f0e3757932b93cc80976fd749