From patchwork Tue Dec 21 10:46:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 424171 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 oBLAkT08009606 for ; Tue, 21 Dec 2010 10:46:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751860Ab0LUKqq (ORCPT ); Tue, 21 Dec 2010 05:46:46 -0500 Received: from moutng.kundenserver.de ([212.227.126.186]:59905 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751738Ab0LUKqp (ORCPT ); Tue, 21 Dec 2010 05:46:45 -0500 Received: from axis700.grange (pD9EB91F3.dip0.t-ipconnect.de [217.235.145.243]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0M3OD6-1QLiqq1n4C-00rbKA; Tue, 21 Dec 2010 11:46:44 +0100 Received: by axis700.grange (Postfix, from userid 1000) id 2AC23E6A77; Tue, 21 Dec 2010 11:46:44 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 281861067BC; Tue, 21 Dec 2010 11:46:44 +0100 (CET) Date: Tue, 21 Dec 2010 11:46:44 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-fbdev@vger.kernel.org cc: linux-sh@vger.kernel.org Subject: [PATCH/RFC 3/3] ARM: mach-shmobile: disable HDMI, if no driver configured Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:UK2EKNPJuzGRm2AkFA9GhQmpIYRdKglTGu11prUt4TA cYDBy1vJI56zQyp4K70y5oNic2cwEn73r/AOE5m8Ox3wR1uFDv qWpxStkDWZVJhY16LSfvoj6NXYWoy1YMBuIO4/Eo7FbszXC5Zz oGKx6CnmhCNrmQhRFQd939ngsgK3U3cg2sSNSQCxqXtAnvs6H7 bKXIoRBpUY4xXe/dFNc4yOJA/XYFQL1JIOSRAslwZQ= 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, 21 Dec 2010 10:46:47 +0000 (UTC) diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 5b07952..ed999a3 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -739,6 +739,7 @@ static struct platform_device fsi_device = { }, }; +#if defined(CONFIG_FB_SH_MOBILE_HDMI) || defined(CONFIG_FB_SH_MOBILE_HDMI_MODULE) static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = { .clock_source = LCDC_CLK_EXTERNAL, .ch[0] = { @@ -804,6 +805,61 @@ static struct platform_device hdmi_device = { }, }; +static int __init hdmi_init_pm_clock(void) +{ + struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick"); + int ret; + long rate; + + if (IS_ERR(hdmi_ick)) { + ret = PTR_ERR(hdmi_ick); + pr_err("Cannot get HDMI ICK: %d\n", ret); + goto out; + } + + ret = clk_set_parent(&sh7372_pllc2_clk, &sh7372_dv_clki_div2_clk); + if (ret < 0) { + pr_err("Cannot set PLLC2 parent: %d, %d users\n", ret, sh7372_pllc2_clk.usecount); + goto out; + } + + pr_debug("PLLC2 initial frequency %lu\n", clk_get_rate(&sh7372_pllc2_clk)); + + rate = clk_round_rate(&sh7372_pllc2_clk, 594000000); + if (rate < 0) { + pr_err("Cannot get suitable rate: %ld\n", rate); + ret = rate; + goto out; + } + + ret = clk_set_rate(&sh7372_pllc2_clk, rate); + if (ret < 0) { + pr_err("Cannot set rate %ld: %d\n", rate, ret); + goto out; + } + + ret = clk_enable(&sh7372_pllc2_clk); + if (ret < 0) { + pr_err("Cannot enable pllc2 clock\n"); + goto out; + } + pr_debug("PLLC2 set frequency %lu\n", rate); + + ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk); + if (ret < 0) { + pr_err("Cannot set HDMI parent: %d\n", ret); + goto out; + } + +out: + if (!IS_ERR(hdmi_ick)) + clk_put(hdmi_ick); + return ret; +} + +device_initcall(hdmi_init_pm_clock); +#endif + static struct gpio_led ap4evb_leds[] = { { .name = "led4", @@ -938,68 +994,16 @@ static struct platform_device *ap4evb_devices[] __initdata = { &usb1_host_device, &fsi_device, &sh_mmcif_device, +#if defined(CONFIG_FB_SH_MOBILE_HDMI) || defined(CONFIG_FB_SH_MOBILE_HDMI_MODULE) &lcdc1_device, - &lcdc_device, &hdmi_device, +#endif + &lcdc_device, &csi2_device, &ceu_device, &ap4evb_camera, }; -static int __init hdmi_init_pm_clock(void) -{ - struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick"); - int ret; - long rate; - - if (IS_ERR(hdmi_ick)) { - ret = PTR_ERR(hdmi_ick); - pr_err("Cannot get HDMI ICK: %d\n", ret); - goto out; - } - - ret = clk_set_parent(&sh7372_pllc2_clk, &sh7372_dv_clki_div2_clk); - if (ret < 0) { - pr_err("Cannot set PLLC2 parent: %d, %d users\n", ret, sh7372_pllc2_clk.usecount); - goto out; - } - - pr_debug("PLLC2 initial frequency %lu\n", clk_get_rate(&sh7372_pllc2_clk)); - - rate = clk_round_rate(&sh7372_pllc2_clk, 594000000); - if (rate < 0) { - pr_err("Cannot get suitable rate: %ld\n", rate); - ret = rate; - goto out; - } - - ret = clk_set_rate(&sh7372_pllc2_clk, rate); - if (ret < 0) { - pr_err("Cannot set rate %ld: %d\n", rate, ret); - goto out; - } - - ret = clk_enable(&sh7372_pllc2_clk); - if (ret < 0) { - pr_err("Cannot enable pllc2 clock\n"); - goto out; - } - pr_debug("PLLC2 set frequency %lu\n", rate); - - ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk); - if (ret < 0) { - pr_err("Cannot set HDMI parent: %d\n", ret); - goto out; - } - -out: - if (!IS_ERR(hdmi_ick)) - clk_put(hdmi_ick); - return ret; -} - -device_initcall(hdmi_init_pm_clock); - static int __init fsi_init_pm_clock(void) { struct clk *fsia_ick;