Received: by 10.192.165.148 with SMTP id m20csp5024546imm; Tue, 8 May 2018 20:19:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo0TJHttKbZm8kC1ff4Ux8Mev1PrHfEKsHxPEWZ75Wkvd9i3Dqrhwadz8PGLMqcTlStQfrM X-Received: by 2002:a17:902:564:: with SMTP id 91-v6mr43502854plf.63.1525835982821; Tue, 08 May 2018 20:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525835982; cv=none; d=google.com; s=arc-20160816; b=K3Szi8nVgThRcBG65k9gdfxMAw7TIotWIr0ZuTMl13KZRiPDcqskG4yzHtOk1AGY8N 0/2TaIGMN79PbiIlnahfWTmmjpeXZw12SCRTsDEAe8OaMzRIJRpKksgYCEoYj+lGAh2u XF7kDdIW9aCHHN2JtHKNSsSoM/6wBVk/sObAF6yxtTo7FjgBt75jcDoA/Y3ZerxhaZdQ 0pPva9sowtey76f3XitPfvU8P9Qqe59mm3/pIGvjcQp5JH/QNMPEi+Hq1DZdc2uyDC8L vZkj2ShzC71HDTR++Xoly/jWHq7+ZD3I1eKv33xZggI0iQNeFtuV1ZoJHkSmAGClQNX2 buyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=8poegNAMpQ/2s6oLyr7F8OginlOjVwqJq/CMYM7PAWM=; b=I2DZTz5okzPtqkHwjh5oBSdv1vYvfSFNLhkG1zzCsCkN+hL8rqs5opQqFkaq7ChUGk QnFlU8J6FquYIFEL2LVqTCyRroMc1IZGWJW7g8Z/ckxBQ5903NKS+NeydNyz7J2wIzab 9vi1aNbHMK1XGBeqxM9cW0hleGavm0TqwH67yYwY/VBoI4vHyT1FqI90oAd/I2n7Vjy0 H6pX4mfGHPHIZQu9stvKFEYT/VqHS7pyy4VARDjjVBX8SRp6Go7zYRJuYhGn2ldxn3We 1XP4HzHemtaYnSyfrxh4rZJxRyB7XTILJo4wR2PTg5PF33Q5ziJD3Whlv/A5ariZYfJU fpMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aL2Cf2Qh; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6-v6si14765254pgp.534.2018.05.08.20.19.14; Tue, 08 May 2018 20:19:42 -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=@gmail.com header.s=20161025 header.b=aL2Cf2Qh; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933700AbeEIDSb (ORCPT + 99 others); Tue, 8 May 2018 23:18:31 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:35785 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933685AbeEIDS3 (ORCPT ); Tue, 8 May 2018 23:18:29 -0400 Received: by mail-io0-f194.google.com with SMTP id g1-v6so31665817iob.2; Tue, 08 May 2018 20:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8poegNAMpQ/2s6oLyr7F8OginlOjVwqJq/CMYM7PAWM=; b=aL2Cf2QhvLH8r1Iy/p8X+R835XIEsbMv4kZEuMynP0PCsH7iCYkFYiITHCNpYW3O5N NRJA35ueUHR7LzcRAEftlU8hK43a7gGUKagmLicuOGsi9Ss3/1HRt650nNdkzP/f9qdf tX2ZXNMFCtTMFfQTZCDZv9kvksM7iDqbxrykBP1MHeqGMq6I85T1UU1/znZ+8fK6nmg1 TlaO7xUF81ysGcVoSViajFA2tzn/FEe9LcFVXCCCm4+rZMl/BHKHg7UGE7MmN2pnH19C LdDTY3IY4oO7XbaVPNnucL30FHaJ4kQ6SeNgD+ZwtzCKkDwI1Z65VPduJN3ln8sb0bAX Ib9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8poegNAMpQ/2s6oLyr7F8OginlOjVwqJq/CMYM7PAWM=; b=O+sXqRmMaycPqQPjtflcm1jC2X7GRgSLLQC39eYK9OIDcuDon4CF/9cTtMOCl5djMe iYox5oH5psmhrlnhhfLxi+H+yX/a1RaRaNRiFKVogHy4wZw2ApAgIa31jLYgsqScdKSY rwD/THILSK+915Re5kPhiIOiU0PEKOV1ABusfsfvfUup4mgCgL072Lnj1ZMKudI6fDy6 oHMccdk/jyPkEssUSTi4Stp1TVsjnjFPn6deCD165S/AZQCljJgfmqVDKTPVuzV7QnZq w9aA/f9XYWix8vaP9OAvCR9MSotTP6Kw44gC79YgPx5h4wb0c8OtBjsU4g3LtU5BAp1R JImg== X-Gm-Message-State: ALQs6tB2Wg/GFT4g+OauyZSBoMg4u9fOCZr9ic1ssGPoNyJtdFRWmutu sVOgO47NNo6pU3DkJ0c3bQZ/96vJxtXwYntfT8g= X-Received: by 2002:a6b:a784:: with SMTP id q126-v6mr47826504ioe.98.1525835908549; Tue, 08 May 2018 20:18:28 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:558a:0:0:0:0:0 with HTTP; Tue, 8 May 2018 20:18:27 -0700 (PDT) In-Reply-To: <8a801894-4293-d2e8-4673-3d9ff5c2a5bb@roeck-us.net> References: <1525772367-20627-1-git-send-email-mine260309@gmail.com> <8a801894-4293-d2e8-4673-3d9ff5c2a5bb@roeck-us.net> From: Lei YU Date: Wed, 9 May 2018 11:18:27 +0800 Message-ID: Subject: Re: [PATCH] hwmon: (aspeed-pwm-tacho) Use 24MHz clock To: Guenter Roeck Cc: Jean Delvare , Joel Stanley , Andrew Jeffery , Hardware Monitoring , linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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); >> > >