From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Szyprowski Subject: Re: [PATCH 3/4] ARM: S5PC110: add common FIMC setup code Date: Mon, 06 Sep 2010 13:34:28 +0900 Message-ID: <4C846F54.6070406@samsung.com> References: <1283745044-15514-1-git-send-email-m.szyprowski@samsung.com> <1283745044-15514-4-git-send-email-m.szyprowski@samsung.com> <201009060616.18100.marek.vasut@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mailout1.w1.samsung.com ([210.118.77.11]:19377 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750975Ab0IFEen (ORCPT ); Mon, 6 Sep 2010 00:34:43 -0400 Received: from eu_spt2 (mailout1.w1.samsung.com [210.118.77.11]) by mailout1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0L8B002OA61T60@mailout1.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Mon, 06 Sep 2010 05:34:41 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0L8B00EZQ61S32@spt2.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Mon, 06 Sep 2010 05:34:41 +0100 (BST) In-reply-to: <201009060616.18100.marek.vasut@gmail.com> Sender: linux-samsung-soc-owner@vger.kernel.org List-Id: linux-samsung-soc@vger.kernel.org To: Marek Vasut Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kyungmin.park@samsung.com, kgene.kim@samsung.com, ben-linux@fluff.org Hello, On 2010-09-06 13:16 Marek Vasut wrote: > Dne Po 6. z=C3=A1=C5=99=C3=AD 2010 05:50:43 Marek Szyprowski napsal(a= ): >> Add common clocks setup code for FIMC devices on S5PV210 SoCs. >> >> Signed-off-by: Marek Szyprowski >> Signed-off-by: Kyungmin Park >> --- >> arch/arm/mach-s5pv210/Kconfig | 6 ++++ >> arch/arm/mach-s5pv210/Makefile | 1 + >> arch/arm/mach-s5pv210/setup-fimc.c | 46 >> +++++++++++++++++++++++++++++ arch/arm/plat-samsung/include/plat/fim= c.h | >> 24 +++++++++++++++ >> 4 files changed, 77 insertions(+), 0 deletions(-) >> create mode 100644 arch/arm/mach-s5pv210/setup-fimc.c >> create mode 100644 arch/arm/plat-samsung/include/plat/fimc.h >> >> diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/K= config >> index d3a3895..48489bb 100644 >> --- a/arch/arm/mach-s5pv210/Kconfig >> +++ b/arch/arm/mach-s5pv210/Kconfig >> @@ -37,6 +37,12 @@ config S5PV210_SETUP_FB_24BPP >> help >> Common setup code for S5PV210 with an 24bpp RGB display = helper. >> >> +config S5PV210_SETUP_FIMC >> + bool >> + help >> + Compile common code for S5PV210 based machines to setup correct >> + FIMC clock parameters. >> + >> config S5PV210_SETUP_KEYPAD >> bool >> help >> diff --git a/arch/arm/mach-s5pv210/Makefile >> b/arch/arm/mach-s5pv210/Makefile index 05048c5..c13aef1 100644 >> --- a/arch/arm/mach-s5pv210/Makefile >> +++ b/arch/arm/mach-s5pv210/Makefile >> @@ -29,6 +29,7 @@ obj-$(CONFIG_S3C64XX_DEV_SPI) +=3D dev-spi.o >> obj-$(CONFIG_S5PC110_DEV_ONENAND) +=3D dev-onenand.o >> >> obj-$(CONFIG_S5PV210_SETUP_FB_24BPP) +=3D setup-fb-24bpp.o >> +obj-$(CONFIG_S5PV210_SETUP_FIMC) +=3D setup-fimc.o >> obj-$(CONFIG_S5PV210_SETUP_I2C1) +=3D setup-i2c1.o >> obj-$(CONFIG_S5PV210_SETUP_I2C2) +=3D setup-i2c2.o >> obj-$(CONFIG_S5PV210_SETUP_IDE) +=3D setup-ide.o >> diff --git a/arch/arm/mach-s5pv210/setup-fimc.c >> b/arch/arm/mach-s5pv210/setup-fimc.c new file mode 100644 >> index 0000000..80c1ffe >> --- /dev/null >> +++ b/arch/arm/mach-s5pv210/setup-fimc.c >> @@ -0,0 +1,46 @@ >> +/* >> + * Copyright (c) 2010 Samsung Electronics Co., Ltd. >> + * http://www.samsung.com/ >> + * >> + * S5PV210 clock setup code for FIMC devices >> + * >> + * This program is free software; you can redistribute it and/or mo= dify >> + * it under the terms of the GNU General Public License version 2 a= s >> + * published by the Free Software Foundation. >> + */ >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +int __init s5pv210_fimc_setup_clks(void) >> +{ >> + int err =3D 0; >> + int i; >> + struct clk *clk_fimc, *parent; >> + >> + struct device *fimc_devs[] =3D { >> + &s5p_device_fimc0.dev, >> + &s5p_device_fimc1.dev, >> + &s5p_device_fimc2.dev >> + }; >> + >> + parent =3D clk_get(NULL, "mout_epll"); >> + if (IS_ERR(parent)) >> + return PTR_ERR(parent); >> + >> + for (i =3D 0; err =3D=3D 0&& i< ARRAY_SIZE(fimc_devs); i++) { >> + if (fimc_devs[i]) { >> + clk_fimc =3D clk_get(fimc_devs[i], "sclk_fimc"); >> + if (IS_ERR(clk_fimc)) { >> + err =3D PTR_ERR(clk_fimc); > > I believe you should clk_put() the clocks that were already clk_get()= -ed here. They are, see clk_put after clk_set_parent. > Cheers >> + break; >> + } >> + clk_set_parent(clk_fimc, parent); >> + clk_put(clk_fimc); >> + } >> + } >> + clk_put(parent); >> + return err; >> +} >> diff --git a/arch/arm/plat-samsung/include/plat/fimc.h >> b/arch/arm/plat-samsung/include/plat/fimc.h new file mode 100644 >> index 0000000..2c06f37 >> --- /dev/null >> +++ b/arch/arm/plat-samsung/include/plat/fimc.h >> @@ -0,0 +1,24 @@ >> +/* >> + * Copyright (c) 2010 Samsung Electronics Co., Ltd. >> + * http://www.samsung.com/ >> + * >> + * Common FIMC devices definitions and helper functions >> + * >> + * This program is free software; you can redistribute it and/or mo= dify >> + * it under the terms of the GNU General Public License version 2 a= s >> + * published by the Free Software Foundation. >> +*/ >> + >> +#ifndef __PLAT_SAMSUNG_FIMC_H >> +#define __PLAT_SAMSUNG_FIMC_H __FILE__ >> + >> +/** >> + * s5pv210_fimc_setup_clks() - S5PV210/S5PC110 fimc clocks setup fu= nction >> + * >> + * Set correct parent clocks on machines which bootloaded did not >> configured + * fimc clocks correctly. FIMC devices works properly on= ly if >> sourced from + * certain clock sources. "mout_epll" clock is the >> recommended one. + */ >> +extern int s5pv210_fimc_setup_clks(void); >> + >> +#endif /* __PLAT_SAMSUNG_FIMC_H */ > Best regards --=20 Marek Szyprowski Samsung Poland R&D Center From mboxrd@z Thu Jan 1 00:00:00 1970 From: m.szyprowski@samsung.com (Marek Szyprowski) Date: Mon, 06 Sep 2010 13:34:28 +0900 Subject: [PATCH 3/4] ARM: S5PC110: add common FIMC setup code In-Reply-To: <201009060616.18100.marek.vasut@gmail.com> References: <1283745044-15514-1-git-send-email-m.szyprowski@samsung.com> <1283745044-15514-4-git-send-email-m.szyprowski@samsung.com> <201009060616.18100.marek.vasut@gmail.com> Message-ID: <4C846F54.6070406@samsung.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hello, On 2010-09-06 13:16 Marek Vasut wrote: > Dne Po 6. z??? 2010 05:50:43 Marek Szyprowski napsal(a): >> Add common clocks setup code for FIMC devices on S5PV210 SoCs. >> >> Signed-off-by: Marek Szyprowski >> Signed-off-by: Kyungmin Park >> --- >> arch/arm/mach-s5pv210/Kconfig | 6 ++++ >> arch/arm/mach-s5pv210/Makefile | 1 + >> arch/arm/mach-s5pv210/setup-fimc.c | 46 >> +++++++++++++++++++++++++++++ arch/arm/plat-samsung/include/plat/fimc.h | >> 24 +++++++++++++++ >> 4 files changed, 77 insertions(+), 0 deletions(-) >> create mode 100644 arch/arm/mach-s5pv210/setup-fimc.c >> create mode 100644 arch/arm/plat-samsung/include/plat/fimc.h >> >> diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig >> index d3a3895..48489bb 100644 >> --- a/arch/arm/mach-s5pv210/Kconfig >> +++ b/arch/arm/mach-s5pv210/Kconfig >> @@ -37,6 +37,12 @@ config S5PV210_SETUP_FB_24BPP >> help >> Common setup code for S5PV210 with an 24bpp RGB display helper. >> >> +config S5PV210_SETUP_FIMC >> + bool >> + help >> + Compile common code for S5PV210 based machines to setup correct >> + FIMC clock parameters. >> + >> config S5PV210_SETUP_KEYPAD >> bool >> help >> diff --git a/arch/arm/mach-s5pv210/Makefile >> b/arch/arm/mach-s5pv210/Makefile index 05048c5..c13aef1 100644 >> --- a/arch/arm/mach-s5pv210/Makefile >> +++ b/arch/arm/mach-s5pv210/Makefile >> @@ -29,6 +29,7 @@ obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o >> obj-$(CONFIG_S5PC110_DEV_ONENAND) += dev-onenand.o >> >> obj-$(CONFIG_S5PV210_SETUP_FB_24BPP) += setup-fb-24bpp.o >> +obj-$(CONFIG_S5PV210_SETUP_FIMC) += setup-fimc.o >> obj-$(CONFIG_S5PV210_SETUP_I2C1) += setup-i2c1.o >> obj-$(CONFIG_S5PV210_SETUP_I2C2) += setup-i2c2.o >> obj-$(CONFIG_S5PV210_SETUP_IDE) += setup-ide.o >> diff --git a/arch/arm/mach-s5pv210/setup-fimc.c >> b/arch/arm/mach-s5pv210/setup-fimc.c new file mode 100644 >> index 0000000..80c1ffe >> --- /dev/null >> +++ b/arch/arm/mach-s5pv210/setup-fimc.c >> @@ -0,0 +1,46 @@ >> +/* >> + * Copyright (c) 2010 Samsung Electronics Co., Ltd. >> + * http://www.samsung.com/ >> + * >> + * S5PV210 clock setup code for FIMC devices >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License version 2 as >> + * published by the Free Software Foundation. >> + */ >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +int __init s5pv210_fimc_setup_clks(void) >> +{ >> + int err = 0; >> + int i; >> + struct clk *clk_fimc, *parent; >> + >> + struct device *fimc_devs[] = { >> + &s5p_device_fimc0.dev, >> + &s5p_device_fimc1.dev, >> + &s5p_device_fimc2.dev >> + }; >> + >> + parent = clk_get(NULL, "mout_epll"); >> + if (IS_ERR(parent)) >> + return PTR_ERR(parent); >> + >> + for (i = 0; err == 0&& i< ARRAY_SIZE(fimc_devs); i++) { >> + if (fimc_devs[i]) { >> + clk_fimc = clk_get(fimc_devs[i], "sclk_fimc"); >> + if (IS_ERR(clk_fimc)) { >> + err = PTR_ERR(clk_fimc); > > I believe you should clk_put() the clocks that were already clk_get()-ed here. They are, see clk_put after clk_set_parent. > Cheers >> + break; >> + } >> + clk_set_parent(clk_fimc, parent); >> + clk_put(clk_fimc); >> + } >> + } >> + clk_put(parent); >> + return err; >> +} >> diff --git a/arch/arm/plat-samsung/include/plat/fimc.h >> b/arch/arm/plat-samsung/include/plat/fimc.h new file mode 100644 >> index 0000000..2c06f37 >> --- /dev/null >> +++ b/arch/arm/plat-samsung/include/plat/fimc.h >> @@ -0,0 +1,24 @@ >> +/* >> + * Copyright (c) 2010 Samsung Electronics Co., Ltd. >> + * http://www.samsung.com/ >> + * >> + * Common FIMC devices definitions and helper functions >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License version 2 as >> + * published by the Free Software Foundation. >> +*/ >> + >> +#ifndef __PLAT_SAMSUNG_FIMC_H >> +#define __PLAT_SAMSUNG_FIMC_H __FILE__ >> + >> +/** >> + * s5pv210_fimc_setup_clks() - S5PV210/S5PC110 fimc clocks setup function >> + * >> + * Set correct parent clocks on machines which bootloaded did not >> configured + * fimc clocks correctly. FIMC devices works properly only if >> sourced from + * certain clock sources. "mout_epll" clock is the >> recommended one. + */ >> +extern int s5pv210_fimc_setup_clks(void); >> + >> +#endif /* __PLAT_SAMSUNG_FIMC_H */ > Best regards -- Marek Szyprowski Samsung Poland R&D Center