Received: by 10.192.165.148 with SMTP id m20csp4332402imm; Tue, 8 May 2018 06:53:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo/VCNBDlwAs18xSE5+DlFDmtEG97IFauPyYW0T88zd/E1tMJxiQk8tnD+Fw1J2Q3tKLE8f X-Received: by 2002:a65:4c4f:: with SMTP id l15-v6mr33132134pgr.61.1525787631491; Tue, 08 May 2018 06:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525787631; cv=none; d=google.com; s=arc-20160816; b=xEtMNlXTPalLffXXJCZVt3upzqne4uazkGvX5r+qf2OcMvKBAg+iePWnqXTQA2JKnX ioimhiVwTmmvUn2eeMq1ON8ohj3Avw+a4NLWCSwgeRXruY0vSzM82lvCGq4czPnybSg+ wjGKDfNGlyXgvVTA/Wq6IQK2HAaze/knjRQz8EpxemGHfBZ6fIXoyPyMnqPhLTXiW/u1 SZKE95oycfUQMKo85OiEurX6/klYx/+QBfzB9SLlDq2Elqv7cpgay1R4lXhJxkPL6Jp6 QfwHPq3Ua4cIHeyw1OTeZ1wG+DqCyCaJOztJYqmz6JAGA80EspShr4Wu5AEk9qCsSHr5 B1Pw== 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:to:subject:dkim-signature :arc-authentication-results; bh=bozIghHIKvLkHaFCqcLxY4mdC06ih+PgQT/y6V2ybxE=; b=ZHTbID1vYHgw1AZA/XWTAbmGCxkSJcPNvOJMivIPN5AFW83VLRmLdXJHIv7X9rt0LS iQTRdWyQDg0Ysmm0yK3buqufYVZaTe1R9E8aU9QwKG8v+acjemJewqH+Qk4Mp1tfFMIG OBkLqYXqi6pdMmClvmLEr7LoHm9+QjuUhtZOrGGy+eBiZ37C2s1fqzV8875FC3Qc4q8Q owHZkyb1WmkQkPhz2+O9XwOZvfvz1BmvgubKumcR+h2VoBmhfO/lg7tlPOc4R6tysDc6 /s5BNVAMreq9kfsDMS01r7LWivAcrcv517uowgjj8TkEx+EJ2vTavocWUo7CtB00z5Rh /Cow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=gIn66HNe; 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 o189si23888560pfo.20.2018.05.08.06.53.37; Tue, 08 May 2018 06:53:51 -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=gIn66HNe; 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 S1755315AbeEHNwL (ORCPT + 99 others); Tue, 8 May 2018 09:52:11 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:35458 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755277AbeEHNv4 (ORCPT ); Tue, 8 May 2018 09:51:56 -0400 Received: by mail-pl0-f67.google.com with SMTP id i5-v6so2278272plt.2; Tue, 08 May 2018 06:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=bozIghHIKvLkHaFCqcLxY4mdC06ih+PgQT/y6V2ybxE=; b=gIn66HNeiRNiaDPRteaJIfRGjk3RkmpCnBClf7V8NUv2/Lqpdcr34SxQrzx+S4UJJS ogqJsrfUFQaDvemQP7DqscnQKplQ/Er3vLDZuWsFTa7jUjR9Y5K9GhbCBdmoQMHnybGt vKsEmRl8+cSt/SGxzOoA3NI/Pu8nUlmlw+YhXL0kMfDDk4v99h4FPtcYre68QIWEuX2w rnwht9+47MPEVdNXHbxSyB2WL0h3RLN4mnbc2l6BNb61hVcQ9KrArNmJQFp3jg0bL/KF 5K1uSuq/55dv2D/6N1e2+Vf+bMJ0CyyaqTvUquo/zTuPqnqUs4t0M/Y23L4EQpWJFV21 Ky3A== 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:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bozIghHIKvLkHaFCqcLxY4mdC06ih+PgQT/y6V2ybxE=; b=F0HlPDDDsmTMOFFWBZhChvobBl4u511rXclx7ekoeYswMg6RkQBGsiQXaV9hh6KU2E GZEnAE02GMepyQ3Kn6hMgnpAxWr1vWj/rroiH+FJ+C9SIA/PZQY6aD6FxNngAqz4hDE4 ZAOuFCQZ39UDJBPdeGotUfKuyK3TPubwKZWf2v7/C9iJiHq2aRdMo3XL+t1X9EnavQcT mfl3+CwMKd6hRp+rVuqNcnqVYAzxoV3oG6fsOJL2wJNiymrZgiISokn1BjzPg2Ws7NOR 9Y8GWQds+oJXU4masoWiVdPcxj8HI5eC72P+8EsD/SExLL1EPqNwL43OnicJkQoo+IVn fnXw== X-Gm-Message-State: ALQs6tBsWo0ZtLwpMOWHriQKXxMwEqJHa45kuC3TbcKlzr9kWCoSaS/S Q7aDEVcMOu51yhxu/hxI9VXv9A== X-Received: by 2002:a17:902:7446:: with SMTP id e6-v6mr22481363plt.369.1525787515440; Tue, 08 May 2018 06:51:55 -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 g9-v6sm40791243pgo.22.2018.05.08.06.51.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 06:51:54 -0700 (PDT) Subject: Re: [PATCH] hwmon: (aspeed-pwm-tacho) Use 24MHz clock To: Lei YU , Jean Delvare , Joel Stanley , Andrew Jeffery , linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <1525772367-20627-1-git-send-email-mine260309@gmail.com> From: Guenter Roeck Message-ID: <8a801894-4293-d2e8-4673-3d9ff5c2a5bb@roeck-us.net> Date: Tue, 8 May 2018 06:51:52 -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: <1525772367-20627-1-git-send-email-mine260309@gmail.com> 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 02:39 AM, Lei YU wrote: > The clock source for aspeed pwm is set to 24MHz, so use the hard-coded > clock frequency instead of the one in device tree. > > Otherwise, in case of the clock specified in device tree is not 24MHz, > the fan speed will be incorrect. > > Signed-off-by: Lei YU > --- > drivers/hwmon/aspeed-pwm-tacho.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c > index 693a3d5..e83b8df 100644 > --- a/drivers/hwmon/aspeed-pwm-tacho.c > +++ b/drivers/hwmon/aspeed-pwm-tacho.c > @@ -922,7 +922,6 @@ static int aspeed_pwm_tacho_probe(struct platform_device *pdev) > void __iomem *regs; > struct resource *res; > struct device *hwmon; > - struct clk *clk; > int ret; > > np = dev->of_node; > @@ -956,12 +955,10 @@ static int aspeed_pwm_tacho_probe(struct platform_device *pdev) > regmap_write(priv->regmap, ASPEED_PTCR_TACH_SOURCE, 0); > regmap_write(priv->regmap, ASPEED_PTCR_TACH_SOURCE_EXT, 0); > > - clk = devm_clk_get(dev, NULL); > - if (IS_ERR(clk)) > - return -ENODEV; > - priv->clk_freq = clk_get_rate(clk); > aspeed_set_clock_enable(priv->regmap, true); > + // The clock source is set to 24MHz 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. 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 ? Really, please fix the DT. Guenter > aspeed_create_type(priv); > >