Received: by 10.192.165.148 with SMTP id m20csp5040690imm; Tue, 8 May 2018 20:46:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpNnMUlGc5nzgPIAJBwpN98OlPyL40pRxlbwjmh+EOaQqyHbmGmCtIprUJk5gDjbIYFErkH X-Received: by 2002:a17:902:b485:: with SMTP id y5-v6mr12193447plr.381.1525837560085; Tue, 08 May 2018 20:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525837560; cv=none; d=google.com; s=arc-20160816; b=G1XsrUsmBDU4IzzKtSmj2tVGO/4RVlFzvX8UtuY7g3xVplkIeRry3/VGlaDpDKmKhz PREi2Zay5oSemwXudByTvWXQiSwMXAyevdfe3Zl+cEN29WDUIxiuT7Zz2fA2GKncBzdV 55vbUPn/hfkxAnlusYpmOcy+50FYFWQg0+A5nt7iJns0Q2Lj/Umjhl2Yy16kVrfbvUkT pgAsT99j7JqaB+V3iCmBXGB8/O6Yfl4+bmNVmq7zD45yMcMasR+8mH3Pnqk638EYLARr H1EpejNcw8dDexZMUEnoVBfEwo+Rceu7gDqSzUpL8uATtvDKcQS2zXvRPwnuCrH1jb7d glWQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=RgCOR54rWxf+mDXCH+j3/gov1u3DB1JWyA2PfD+1nVw=; b=GWgoLKqOVyGdTIqlXh0L0+19peSXe8ffqyMiDfBztNx1vxb50OwHlAe3WCYas8RbHY Jv+LUFj94Ua250tH5fEKz2O2SRjAnU3DIZdos+lM/m97OqOFp3R2lsi3a8i06SbmI6kP FZv2duCb9kKvhuVkCUnYvCdeGLLJpnV4OsdYotlU7Xs+53T4F46DZROfkzfO4aMiCtQO a76Zu+aZS/sN8ZayQxEvhbVyjgzyIJJlAVPkg6Pr63lx/cFBq4bGDndESJYtLvxkV/ba gRaH4om9Aed3qioLM/NS6pJZQ/ZqMCHtUYuJZc/JleAXhbT44Vn43quy3S6HxXJ5Tev0 qEXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=gt9DwVp1; 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 j91-v6si19268042pld.402.2018.05.08.20.45.45; Tue, 08 May 2018 20:46:00 -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=fail header.i=@gmail.com header.s=20161025 header.b=gt9DwVp1; 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 S933720AbeEIDns (ORCPT + 99 others); Tue, 8 May 2018 23:43:48 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:43014 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932115AbeEIDnq (ORCPT ); Tue, 8 May 2018 23:43:46 -0400 Received: by mail-pl0-f66.google.com with SMTP id a39-v6so3465845pla.10; Tue, 08 May 2018 20:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=RgCOR54rWxf+mDXCH+j3/gov1u3DB1JWyA2PfD+1nVw=; b=gt9DwVp1qnIq/V49AeyNLcWtXY5P0QSs4SlGf/biGOpRaEGN3DzzKvCMDqR9NJmELK DZFFmEDV+Lizg0oo7QOvaYMyZfpWIpOxTHH/S6nSWozXTUeyGPtnVzlk84Zo4UIeLgYb ZJ7aTi2ZEwoCWkiN6AZCH3L/RRXQ70yYPCLoLQ54CSvYVmtINbNAvzNW28NK27lulbds X17cmYaJxl9Mic0SV4Oic8R9V0qgC1rz/Fo7Gg4E0po3GklAUpCLXLXFghZ2AINlwVFq ETpsLIEWzY5GyewBvaudfpPDRRL7OXPtG02BSFcWWmSX4LIvn4Pk1jEgq2IDrjpxyiTt 16qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RgCOR54rWxf+mDXCH+j3/gov1u3DB1JWyA2PfD+1nVw=; b=aUNt13vjieA+wivdU6ppWgFrifNjSUGM8VJZyHJqwKA4p/98ZTBu5ca18sTcXRiWcu z4ZNlZREpjTqKqb5HHgFQB/eHx0L5QdMT3hlm0vrujPicQKkLNzqRXsMXJNxYXu0IDwN y7VTcJBNSgS6+Sew8eTPsJUX9hCMRWZmQ5jIO70m5gxGL3ypuy09cg6TgnQmRLbcA82k iYvOzvzhMMSoIiLgsHUM+ImXGdQ3dPyKs2qdpn7zRPSPfgqo/1RrypI7wDBaycEqWReq zoQtrSA6nVx2v2oKDXUBb8mJ38BoCKrU1JYg2uoggnbO3mscy9hXX+FDUVhMdITBCVMD 3E8w== X-Gm-Message-State: ALQs6tD7syJdIvINPRN65e1/WpB6GWV7HJrLcfcGpcTGks9izhIaVWYW 2Pwcdboh4WMkVkvQeAER2JttMg== X-Received: by 2002:a17:902:8c83:: with SMTP id t3-v6mr40398235plo.357.1525837425559; Tue, 08 May 2018 20:43:45 -0700 (PDT) Received: from server.roeck-us.net (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id 73sm14403271pfo.153.2018.05.08.20.43.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 20:43:44 -0700 (PDT) Subject: Re: [PATCH] hwmon: (aspeed-pwm-tacho) Use 24MHz clock To: Lei YU Cc: Jean Delvare , Joel Stanley , Andrew Jeffery , Hardware Monitoring , linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, Linux Kernel Mailing List References: <1525772367-20627-1-git-send-email-mine260309@gmail.com> <8a801894-4293-d2e8-4673-3d9ff5c2a5bb@roeck-us.net> From: Guenter Roeck Message-ID: Date: Tue, 8 May 2018 20:43:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/08/2018 08:18 PM, Lei YU wrote: > On Tue, May 8, 2018 at 9:51 PM, Guenter Roeck wrote: >> No mixed C/C++ comments in hwmon drivers. >> >>> aspeed_set_clock_source(priv->regmap, 0); >>> + priv->clk_freq = 24000000; >>> >> >> >> Are you saying that clk_get_rate() is wrong ? Anyway, if the DT is bad, it >> should be fixed. > Nope, clk_get_rate() is OK. > The reason I make this change is because the PWM supports two types of clock > source, the 24MHz or the clock from memory controller. > If the DT uses 24MHz clock, this code is OK. > But if the DT configs this pwm to use mclk (memory controller clk), this piece > of code becomes wrong, because the code > `aspeed_set_clock_source(priv->regmap, 0)` configs the device to use the 24MHz > clock. > So no matter what DT configs the clk, this driver *always* uses 24MHz clock. > > That's why I want to make this change. > >> I am not a friend of hacking drivers to fix up bad DTs, and much less so >> without explanation. >> Plus, how do we know that the next chip supported by the driver doesn't have >> a 32MHz clock ? > This driver currently supports ast2400 and ast2500, and they both use 24MHz > clock. > In case future device uses a different clock, we can update this code, right? > I am not going to accept this change, period. This is not one, it is five steps backward. If "aspeed_set_clock_source(priv->regmap, 0)" changes the clock speed, or the clock source, read it later, and attach to the correct clock. If that doesn't work, fix the problem in the clock subsystem. Hacking the driver is just plain wrong. Also, if the idea in DT is to provide a different clock to the watchdog on purpose, maybe the call to "aspeed_set_clock_source(priv->regmap, 0)" is wrong. Guenter >> Really, please fix the DT. > Sure, I will send patch to config the clock to use fixed 24MHz clock as well. > >> >> Guenter >> >>> aspeed_create_type(priv); >>> >> >> >