From patchwork Wed Aug 31 12:34:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 1115732 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7VCYgcd015653 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 31 Aug 2011 12:35:03 GMT Received: from canuck.infradead.org ([134.117.69.58]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qyjzs-0004M7-4S; Wed, 31 Aug 2011 12:34:25 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Qyjzr-0003qR-FY; Wed, 31 Aug 2011 12:34:23 +0000 Received: from mail-ww0-f41.google.com ([74.125.82.41]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qyjzo-0003q9-VE for linux-arm-kernel@lists.infradead.org; Wed, 31 Aug 2011 12:34:22 +0000 Received: by wwj26 with SMTP id 26so109957wwj.0 for ; Wed, 31 Aug 2011 05:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding:content-type; bh=BV6OKCkMfsgpIvtUyoecCvKCe/u4J/9dmaJpDPd3cX0=; b=alVtQsXs/Zu4y2361SQWa0HDah5GpjTuKISgdZHayyhXki/Zfgwy1NuvFTDc/mmDCE rjCFHCXGkTLzdDDx/EZXa6bKKKvg4Ush49uNhT7H2360CbXUFAdlKR5QEbBrCsOrRtSG JvkIWo1m8oVosb/t1eWp5o9/zfocapOwdb4BQ= Received: by 10.227.37.17 with SMTP id v17mr366040wbd.2.1314794059712; Wed, 31 Aug 2011 05:34:19 -0700 (PDT) Received: from flatron.localnet (178-73-0-134.home.aster.pl [178.73.0.134]) by mx.google.com with ESMTPS id fy13sm3651392wbb.39.2011.08.31.05.34.17 (version=SSLv3 cipher=OTHER); Wed, 31 Aug 2011 05:34:18 -0700 (PDT) From: Tomasz Figa To: linux-arm-kernel Subject: [PATCH 1/5] ARM: Samsung: PWM: Allow to differentiate SoCs based on platform device name. Date: Wed, 31 Aug 2011 14:34:15 +0200 Message-ID: <4002702.FticUbImag@flatron> User-Agent: KMail/4.7.0 (Linux/3.0.3-gentoo; KDE/4.7.0; x86_64; ; ) In-Reply-To: <1731819.jJi37IsjvJ@flatron> References: <1731819.jJi37IsjvJ@flatron> MIME-Version: 1.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110831_083421_245665_CED80AB0 X-CRM114-Status: GOOD ( 22.42 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.41 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tomasz.figa[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Kukjin Kim , Ben Dooks X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 31 Aug 2011 12:35:03 +0000 (UTC) From 1fe2d6b0bd65d2991515647b91b954c31cd44089 Mon Sep 17 00:00:00 2001 From: Tomasz Figa Date: Sun, 28 Aug 2011 01:32:50 +0200 Subject: [PATCH 1/5] ARM: Samsung: PWM: Allow to differentiate SoCs based on platform device name. This patch is a prerequisite to adding generic time support for S3C64xx. It makes possible to differentiate SoCs, required to exclude timers 3 and 4 from PWM driver only on S3C64xx. Signed-off-by: Tomasz Figa --- arch/arm/mach-s3c64xx/s3c6400.c | 2 ++ arch/arm/mach-s3c64xx/s3c6410.c | 2 ++ arch/arm/plat-samsung/dev-pwm.c | 8 ++++++++ arch/arm/plat-samsung/include/plat/pwm-core.h | 21 +++++++++++++++++++++ arch/arm/plat-samsung/pwm.c | 19 ++++++++++++++++++- 5 files changed, 51 insertions(+), 1 deletions(-) create mode 100644 arch/arm/plat-samsung/include/plat/pwm-core.h diff --git a/arch/arm/mach-s3c64xx/s3c6400.c b/arch/arm/mach-s3c64xx/s3c6400.c index 5e93fe3..6418832 100644 --- a/arch/arm/mach-s3c64xx/s3c6400.c +++ b/arch/arm/mach-s3c64xx/s3c6400.c @@ -38,6 +38,7 @@ #include #include #include +#include #include void __init s3c6400_map_io(void) @@ -55,6 +56,7 @@ void __init s3c6400_map_io(void) s3c_onenand_setname("s3c6400-onenand"); s3c64xx_onenand1_setname("s3c6400-onenand"); + s3c_pwm_setname("s3c64xx-pwm"); } void __init s3c6400_init_clocks(int xtal) diff --git a/arch/arm/mach-s3c64xx/s3c6410.c b/arch/arm/mach-s3c64xx/s3c6410.c index 312aa6b..4f66c25 100644 --- a/arch/arm/mach-s3c64xx/s3c6410.c +++ b/arch/arm/mach-s3c64xx/s3c6410.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,7 @@ void __init s3c6410_map_io(void) s3c_onenand_setname("s3c6410-onenand"); s3c64xx_onenand1_setname("s3c6410-onenand"); s3c_cfcon_setname("s3c64xx-pata"); + s3c_pwm_setname("s3c64xx-pwm"); } void __init s3c6410_init_clocks(int xtal) diff --git a/arch/arm/plat-samsung/dev-pwm.c b/arch/arm/plat-samsung/dev-pwm.c index dab47b0..751286a 100644 --- a/arch/arm/plat-samsung/dev-pwm.c +++ b/arch/arm/plat-samsung/dev-pwm.c @@ -20,6 +20,7 @@ #include #include +#include #define TIMER_RESOURCE_SIZE (1) @@ -51,3 +52,10 @@ struct platform_device s3c_device_timer[] = { [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) }, }; EXPORT_SYMBOL(s3c_device_timer); + +void s3c_pwm_setname(const char *name) +{ + int i; + for (i = 0; i < ARRAY_SIZE(s3c_device_timer); ++i) + s3c_device_timer[i].name = name; +} diff --git a/arch/arm/plat-samsung/include/plat/pwm-core.h b/arch/arm/plat-samsung/include/plat/pwm-core.h new file mode 100644 index 0000000..651d7a4 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/pwm-core.h @@ -0,0 +1,21 @@ +/* arch/arm/plat-samsung/include/plat/pwm-core.h + * + * Copyright 2011 Tomasz Figa + * + * S3C - PWM Controller core 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 __ASM_ARCH_PWM_CORE_H +#define __ASM_ARCH_PWM_CORE_H __FILE__ + +/* These functions are only for use with the core support code, such as + * the cpu specific initialisation code + */ + +extern void s3c_pwm_setname(const char *name); + +#endif /* __ASM_ARCH_PWM_H */ diff --git a/arch/arm/plat-samsung/pwm.c b/arch/arm/plat-samsung/pwm.c index f37457c..27b5353 100644 --- a/arch/arm/plat-samsung/pwm.c +++ b/arch/arm/plat-samsung/pwm.c @@ -24,6 +24,11 @@ #include +enum soc_type { + TYPE_GENERIC, + TYPE_S3C64XX, +}; + struct pwm_device { struct list_head list; struct platform_device *pdev; @@ -380,11 +385,23 @@ static int s3c_pwm_resume(struct platform_device *pdev) #define s3c_pwm_resume NULL #endif +static struct platform_device_id s3c_pwm_driver_ids[] = { + { + .name = "s3c24xx-pwm", + .driver_data = TYPE_GENERIC, + }, { + .name = "s3c64xx-pwm", + .driver_data = TYPE_S3C64XX, + }, +}; +MODULE_DEVICE_TABLE(platform, s3c_pwm_driver_ids); + static struct platform_driver s3c_pwm_driver = { .driver = { - .name = "s3c24xx-pwm", + .name = "samsung-pwm", .owner = THIS_MODULE, }, + .id_table = s3c_pwm_driver_ids, .probe = s3c_pwm_probe, .remove = __devexit_p(s3c_pwm_remove), .suspend = s3c_pwm_suspend,