1 From b20fa9e7d54d8dfc40be78ccb4c5bafdfaf2ad15 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Sun, 13 Apr 2008 07:25:52 +0100
4 Subject: [PATCH] add-pcb-rev-sysfs.patch
5 Signed-off-by: Andy Green <andy@openmoko.com>
8 arch/arm/mach-s3c2440/mach-gta02.c | 6 ++
9 arch/arm/plat-s3c24xx/Makefile | 6 ++-
10 arch/arm/plat-s3c24xx/neo1973_version.c | 90 +++++++++++++++++++++++++++++++
11 3 files changed, 101 insertions(+), 1 deletions(-)
12 create mode 100644 arch/arm/plat-s3c24xx/neo1973_version.c
14 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
15 index a2a63fe..3574375 100644
16 --- a/arch/arm/mach-s3c2440/mach-gta02.c
17 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
18 @@ -372,6 +372,11 @@ int gta02_get_pcb_revision(void)
22 +struct platform_device gta02_version_device = {
23 + .name = "neo1973-version",
28 static struct map_desc gta02_iodesc[] __initdata = {
30 @@ -724,6 +729,7 @@ static struct platform_device *gta02_devices[] __initdata = {
34 + >a02_version_device,
37 static struct s3c2410_nand_set gta02_nand_sets[] = {
38 diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile
39 index e1686a0..e667105 100644
40 --- a/arch/arm/plat-s3c24xx/Makefile
41 +++ b/arch/arm/plat-s3c24xx/Makefile
42 @@ -28,4 +28,8 @@ obj-$(CONFIG_PM) += pm.o
43 obj-$(CONFIG_PM) += sleep.o
44 obj-$(CONFIG_S3C2410_DMA) += dma.o
45 obj-$(CONFIG_MACH_SMDK) += common-smdk.o
46 -obj-$(CONFIG_MACH_NEO1973) += neo1973_pm_host.o neo1973_pm_gsm.o neo1973_pm_gps.o neo1973_pm_bt.o
47 +obj-$(CONFIG_MACH_NEO1973) += neo1973_version.o \
52 diff --git a/arch/arm/plat-s3c24xx/neo1973_version.c b/arch/arm/plat-s3c24xx/neo1973_version.c
54 index 0000000..ad41a0f
56 +++ b/arch/arm/plat-s3c24xx/neo1973_version.c
59 + * PCB version sysfs for the FIC Neo1973 GSM Phone
61 + * (C) 2007 by OpenMoko Inc.
62 + * Author: Andy Green <andy@openmoko.com>
63 + * All rights reserved.
65 + * This program is free software; you can redistribute it and/or modify
66 + * it under the terms of the GNU General Public License version 2 as
67 + * published by the Free Software Foundation
71 +#include <linux/module.h>
72 +#include <linux/init.h>
73 +#include <linux/kernel.h>
74 +#include <linux/platform_device.h>
76 +#include <asm/hardware.h>
77 +#include <asm/mach-types.h>
79 +#ifdef CONFIG_MACH_NEO1973_GTA02
80 +#include <asm/arch/gta02.h>
82 +static ssize_t version_read(struct device *dev, struct device_attribute *attr,
85 + return sprintf(buf, "0x%03X\n", gta02_get_pcb_revision());
89 +static DEVICE_ATTR(pcb, 0644, version_read, NULL);
91 +static struct attribute *neo1973_version_sysfs_entries[] = {
96 +static struct attribute_group neo1973_version_attr_group = {
98 + .attrs = neo1973_version_sysfs_entries,
101 +static int __init neo1973_version_probe(struct platform_device *pdev)
103 + dev_info(&pdev->dev, "starting\n");
105 + switch (machine_arch_type) {
106 +#ifdef CONFIG_MACH_NEO1973_GTA01
107 + case MACH_TYPE_NEO1973_GTA01:
109 +#endif /* CONFIG_MACH_NEO1973_GTA01 */
114 + return sysfs_create_group(&pdev->dev.kobj, &neo1973_version_attr_group);
117 +static int neo1973_version_remove(struct platform_device *pdev)
119 + sysfs_remove_group(&pdev->dev.kobj, &neo1973_version_attr_group);
123 +static struct platform_driver neo1973_version_driver = {
124 + .probe = neo1973_version_probe,
125 + .remove = neo1973_version_remove,
127 + .name = "neo1973-version",
131 +static int __devinit neo1973_version_init(void)
133 + return platform_driver_register(&neo1973_version_driver);
136 +static void neo1973_version_exit(void)
138 + platform_driver_unregister(&neo1973_version_driver);
141 +module_init(neo1973_version_init);
142 +module_exit(neo1973_version_exit);
144 +MODULE_LICENSE("GPL");
145 +MODULE_AUTHOR("Andy Green <andy@openmoko.com>");
146 +MODULE_DESCRIPTION("Neo1973 PCB version");