initialize the url field for packages
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1105-add-pcb-rev-sysfs.patch.patch
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>
6
7 ---
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
13
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)
19 return u;
20 }
21
22 +struct platform_device gta02_version_device = {
23 + .name = "neo1973-version",
24 + .num_resources = 0,
25 +};
26 +
27
28 static struct map_desc gta02_iodesc[] __initdata = {
29 {
30 @@ -724,6 +729,7 @@ static struct platform_device *gta02_devices[] __initdata = {
31 &s3c_device_ts,
32 &gta02_nor_flash,
33 &sc32440_fiq_device,
34 + &gta02_version_device,
35 };
36
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 \
48 + neo1973_pm_host.o \
49 + neo1973_pm_gsm.o \
50 + neo1973_pm_gps.o \
51 + neo1973_pm_bt.o
52 diff --git a/arch/arm/plat-s3c24xx/neo1973_version.c b/arch/arm/plat-s3c24xx/neo1973_version.c
53 new file mode 100644
54 index 0000000..ad41a0f
55 --- /dev/null
56 +++ b/arch/arm/plat-s3c24xx/neo1973_version.c
57 @@ -0,0 +1,90 @@
58 +/*
59 + * PCB version sysfs for the FIC Neo1973 GSM Phone
60 + *
61 + * (C) 2007 by OpenMoko Inc.
62 + * Author: Andy Green <andy@openmoko.com>
63 + * All rights reserved.
64 + *
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
68 + *
69 + */
70 +
71 +#include <linux/module.h>
72 +#include <linux/init.h>
73 +#include <linux/kernel.h>
74 +#include <linux/platform_device.h>
75 +
76 +#include <asm/hardware.h>
77 +#include <asm/mach-types.h>
78 +
79 +#ifdef CONFIG_MACH_NEO1973_GTA02
80 +#include <asm/arch/gta02.h>
81 +
82 +static ssize_t version_read(struct device *dev, struct device_attribute *attr,
83 + char *buf)
84 +{
85 + return sprintf(buf, "0x%03X\n", gta02_get_pcb_revision());
86 +}
87 +
88 +
89 +static DEVICE_ATTR(pcb, 0644, version_read, NULL);
90 +
91 +static struct attribute *neo1973_version_sysfs_entries[] = {
92 + &dev_attr_pcb.attr,
93 + NULL
94 +};
95 +
96 +static struct attribute_group neo1973_version_attr_group = {
97 + .name = NULL,
98 + .attrs = neo1973_version_sysfs_entries,
99 +};
100 +
101 +static int __init neo1973_version_probe(struct platform_device *pdev)
102 +{
103 + dev_info(&pdev->dev, "starting\n");
104 +
105 + switch (machine_arch_type) {
106 +#ifdef CONFIG_MACH_NEO1973_GTA01
107 + case MACH_TYPE_NEO1973_GTA01:
108 + return -EINVAL;
109 +#endif /* CONFIG_MACH_NEO1973_GTA01 */
110 + default:
111 + break;
112 + }
113 +
114 + return sysfs_create_group(&pdev->dev.kobj, &neo1973_version_attr_group);
115 +}
116 +
117 +static int neo1973_version_remove(struct platform_device *pdev)
118 +{
119 + sysfs_remove_group(&pdev->dev.kobj, &neo1973_version_attr_group);
120 + return 0;
121 +}
122 +
123 +static struct platform_driver neo1973_version_driver = {
124 + .probe = neo1973_version_probe,
125 + .remove = neo1973_version_remove,
126 + .driver = {
127 + .name = "neo1973-version",
128 + },
129 +};
130 +
131 +static int __devinit neo1973_version_init(void)
132 +{
133 + return platform_driver_register(&neo1973_version_driver);
134 +}
135 +
136 +static void neo1973_version_exit(void)
137 +{
138 + platform_driver_unregister(&neo1973_version_driver);
139 +}
140 +
141 +module_init(neo1973_version_init);
142 +module_exit(neo1973_version_exit);
143 +
144 +MODULE_LICENSE("GPL");
145 +MODULE_AUTHOR("Andy Green <andy@openmoko.com>");
146 +MODULE_DESCRIPTION("Neo1973 PCB version");
147 +#endif
148 --
149 1.5.6.5
150
This page took 0.049587 seconds and 5 git commands to generate.