From patchwork Tue Nov 2 11:27:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 297132 X-Patchwork-Delegate: lethal@linux-sh.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA2BRnnx029875 for ; Tue, 2 Nov 2010 11:27:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752554Ab0KBL1a (ORCPT ); Tue, 2 Nov 2010 07:27:30 -0400 Received: from mailout-de.gmx.net ([213.165.64.23]:52928 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with SMTP id S1752584Ab0KBL13 (ORCPT ); Tue, 2 Nov 2010 07:27:29 -0400 Received: (qmail invoked by alias); 02 Nov 2010 11:27:28 -0000 Received: from p5089880D.dip0.t-ipconnect.de (EHLO axis700.grange) [80.137.136.13] by mail.gmx.net (mp067) with SMTP; 02 Nov 2010 12:27:28 +0100 X-Authenticated: #20450766 X-Provags-ID: V01U2FsdGVkX1+OqSgy/1GOnYRV9SMxwgGVWGEmI6HtjtOXu0Q5Ef A7sLn+WDS2u0Rz Received: from lyakh (helo=localhost) by axis700.grange with local-esmtp (Exim 4.63) (envelope-from ) id 1PDF1a-0001fQ-JJ; Tue, 02 Nov 2010 12:27:34 +0100 Date: Tue, 2 Nov 2010 12:27:34 +0100 (CET) From: Guennadi Liakhovetski To: linux-sh@vger.kernel.org cc: linux-fbdev@vger.kernel.org, Paul Mundt Subject: [PATCH 4/4 v2] ARM: mach-shmobile: optimize PLLC2 frequency for HDMI In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Y-GMX-Trusted: 0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 02 Nov 2010 11:27:50 +0000 (UTC) diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 46ca4d4..f01ba9f 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -631,9 +631,13 @@ static struct platform_device lcdc1_device = { }, }; +static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq, + unsigned long *parent_freq); + static struct sh_mobile_hdmi_info hdmi_info = { .lcd_chan = &sh_mobile_lcdc1_info.ch[0], .lcd_dev = &lcdc1_device.dev, + .clk_optimize_parent = ap4evb_clk_optimize, }; static struct resource hdmi_resources[] = { @@ -660,6 +664,25 @@ static struct platform_device hdmi_device = { }, }; +static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq, + unsigned long *parent_freq) +{ + struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick"); + long error; + + if (IS_ERR(hdmi_ick)) { + int ret = PTR_ERR(hdmi_ick); + pr_err("Cannot get HDMI ICK: %d\n", ret); + return ret; + } + + error = clk_round_parent(hdmi_ick, target, best_freq, parent_freq, 1, 64); + + clk_put(hdmi_ick); + + return error; +} + static struct gpio_led ap4evb_leds[] = { { .name = "led4",