From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kukjin Kim Subject: Re: [PATCH] ARM: S3C24XX: Add .get_rate callback for "camif-upll" clock Date: Mon, 27 Aug 2012 15:58:14 -0700 Message-ID: <503BFB86.20607@samsung.com> References: <1346098329-32059-1-git-send-email-sylvester.nawrocki@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mail-pz0-f46.google.com ([209.85.210.46]:33116 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753150Ab2H0W6R (ORCPT ); Mon, 27 Aug 2012 18:58:17 -0400 Received: by dady13 with SMTP id y13so2856444dad.19 for ; Mon, 27 Aug 2012 15:58:17 -0700 (PDT) In-Reply-To: <1346098329-32059-1-git-send-email-sylvester.nawrocki@gmail.com> Sender: linux-samsung-soc-owner@vger.kernel.org List-Id: linux-samsung-soc@vger.kernel.org To: Sylwester Nawrocki Cc: kgene.kim@samsung.com, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org On 08/27/12 13:12, Sylwester Nawrocki wrote: > Add missing get_rate callback for the "camif-upll" clock, so frequency > of this clock is properly reported with clk_get_rate(). > > Signed-off-by: Sylwester Nawrocki > --- > arch/arm/mach-s3c24xx/clock-s3c2440.c | 14 ++++++++++++++ > 1 files changed, 14 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/mach-s3c24xx/clock-s3c2440.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c > index cb2883d..749220f 100644 > --- a/arch/arm/mach-s3c24xx/clock-s3c2440.c > +++ b/arch/arm/mach-s3c24xx/clock-s3c2440.c > @@ -87,6 +87,19 @@ static int s3c2440_camif_upll_setrate(struct clk *clk, unsigned long rate) > return 0; > } > > +static unsigned long s3c2440_camif_upll_getrate(struct clk *clk) > +{ > + unsigned long parent_rate = clk_get_rate(clk->parent); > + unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); > + > + if (!(camdivn& S3C2440_CAMDIVN_CAMCLK_SEL)) > + return parent_rate; > + > + camdivn&= S3C2440_CAMDIVN_CAMCLK_MASK; > + > + return parent_rate / (camdivn + 1) / 2; Well, why do we need '/ 2' here? > +} > + > /* Extra S3C2440 clocks */ > > static struct clk s3c2440_clk_cam = { > @@ -99,6 +112,7 @@ static struct clk s3c2440_clk_cam_upll = { > .name = "camif-upll", > .ops =&(struct clk_ops) { > .set_rate = s3c2440_camif_upll_setrate, > + .get_rate = s3c2440_camif_upll_getrate, > .round_rate = s3c2440_camif_upll_round, > }, > }; Thanks. Best regards, Kgene. -- Kukjin Kim , Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd. From mboxrd@z Thu Jan 1 00:00:00 1970 From: kgene.kim@samsung.com (Kukjin Kim) Date: Mon, 27 Aug 2012 15:58:14 -0700 Subject: [PATCH] ARM: S3C24XX: Add .get_rate callback for "camif-upll" clock In-Reply-To: <1346098329-32059-1-git-send-email-sylvester.nawrocki@gmail.com> References: <1346098329-32059-1-git-send-email-sylvester.nawrocki@gmail.com> Message-ID: <503BFB86.20607@samsung.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 08/27/12 13:12, Sylwester Nawrocki wrote: > Add missing get_rate callback for the "camif-upll" clock, so frequency > of this clock is properly reported with clk_get_rate(). > > Signed-off-by: Sylwester Nawrocki > --- > arch/arm/mach-s3c24xx/clock-s3c2440.c | 14 ++++++++++++++ > 1 files changed, 14 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/mach-s3c24xx/clock-s3c2440.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c > index cb2883d..749220f 100644 > --- a/arch/arm/mach-s3c24xx/clock-s3c2440.c > +++ b/arch/arm/mach-s3c24xx/clock-s3c2440.c > @@ -87,6 +87,19 @@ static int s3c2440_camif_upll_setrate(struct clk *clk, unsigned long rate) > return 0; > } > > +static unsigned long s3c2440_camif_upll_getrate(struct clk *clk) > +{ > + unsigned long parent_rate = clk_get_rate(clk->parent); > + unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); > + > + if (!(camdivn& S3C2440_CAMDIVN_CAMCLK_SEL)) > + return parent_rate; > + > + camdivn&= S3C2440_CAMDIVN_CAMCLK_MASK; > + > + return parent_rate / (camdivn + 1) / 2; Well, why do we need '/ 2' here? > +} > + > /* Extra S3C2440 clocks */ > > static struct clk s3c2440_clk_cam = { > @@ -99,6 +112,7 @@ static struct clk s3c2440_clk_cam_upll = { > .name = "camif-upll", > .ops =&(struct clk_ops) { > .set_rate = s3c2440_camif_upll_setrate, > + .get_rate = s3c2440_camif_upll_getrate, > .round_rate = s3c2440_camif_upll_round, > }, > }; Thanks. Best regards, Kgene. -- Kukjin Kim , Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.