5f42184cf299e88c9f5f4c8673611a6cec397645
[openwrt/svn-archive/archive.git] / target / linux / ps3 / patches-2.6.28 / 0003-powerpc-ps3-Add-sub-match-id-modalias-support.patch
1 From 46d01492b2c50791b9b66f9b9154ac8d25acaeb9 Mon Sep 17 00:00:00 2001
2 From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
3 Date: Wed, 3 Dec 2008 13:52:21 +0000
4 Subject: powerpc/ps3: Add sub-match id modalias support
5
6 commit 059e4938f8b060b10c4352e6c45739473bc73267 ("powerpc/ps3: Add a sub-match
7 id to ps3_system_bus") forgot to update the module alias support:
8 - Add the sub-match ids to the module aliases, so udev can distinguish
9 between different types of sub-devices.
10 - Rename PS3_MODULE_ALIAS_GRAPHICS to PS3_MODULE_ALIAS_GPU_FB, as ps3fb
11 binds to the "FB" sub-device.
12
13 Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
14 Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
15 Signed-off-by: Paul Mackerras <paulus@samba.org>
16 ---
17 arch/powerpc/include/asm/ps3.h | 53 ++++++++++++++---------------
18 arch/powerpc/platforms/ps3/device-init.c | 4 +-
19 arch/powerpc/platforms/ps3/system-bus.c | 10 +++--
20 drivers/video/ps3fb.c | 6 ++--
21 4 files changed, 37 insertions(+), 36 deletions(-)
22
23 diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
24 index 4299365..cff30c0 100644
25 --- a/arch/powerpc/include/asm/ps3.h
26 +++ b/arch/powerpc/include/asm/ps3.h
27 @@ -305,30 +305,34 @@ static inline const char* ps3_result(int result)
28 /* system bus routines */
29
30 enum ps3_match_id {
31 - PS3_MATCH_ID_EHCI = 1,
32 - PS3_MATCH_ID_OHCI = 2,
33 - PS3_MATCH_ID_GELIC = 3,
34 - PS3_MATCH_ID_AV_SETTINGS = 4,
35 - PS3_MATCH_ID_SYSTEM_MANAGER = 5,
36 - PS3_MATCH_ID_STOR_DISK = 6,
37 - PS3_MATCH_ID_STOR_ROM = 7,
38 - PS3_MATCH_ID_STOR_FLASH = 8,
39 - PS3_MATCH_ID_SOUND = 9,
40 - PS3_MATCH_ID_GRAPHICS = 10,
41 - PS3_MATCH_ID_LPM = 11,
42 + PS3_MATCH_ID_EHCI = 1,
43 + PS3_MATCH_ID_OHCI = 2,
44 + PS3_MATCH_ID_GELIC = 3,
45 + PS3_MATCH_ID_AV_SETTINGS = 4,
46 + PS3_MATCH_ID_SYSTEM_MANAGER = 5,
47 + PS3_MATCH_ID_STOR_DISK = 6,
48 + PS3_MATCH_ID_STOR_ROM = 7,
49 + PS3_MATCH_ID_STOR_FLASH = 8,
50 + PS3_MATCH_ID_SOUND = 9,
51 + PS3_MATCH_ID_GPU = 10,
52 + PS3_MATCH_ID_LPM = 11,
53 };
54
55 -#define PS3_MODULE_ALIAS_EHCI "ps3:1"
56 -#define PS3_MODULE_ALIAS_OHCI "ps3:2"
57 -#define PS3_MODULE_ALIAS_GELIC "ps3:3"
58 -#define PS3_MODULE_ALIAS_AV_SETTINGS "ps3:4"
59 -#define PS3_MODULE_ALIAS_SYSTEM_MANAGER "ps3:5"
60 -#define PS3_MODULE_ALIAS_STOR_DISK "ps3:6"
61 -#define PS3_MODULE_ALIAS_STOR_ROM "ps3:7"
62 -#define PS3_MODULE_ALIAS_STOR_FLASH "ps3:8"
63 -#define PS3_MODULE_ALIAS_SOUND "ps3:9"
64 -#define PS3_MODULE_ALIAS_GRAPHICS "ps3:10"
65 -#define PS3_MODULE_ALIAS_LPM "ps3:11"
66 +enum ps3_match_sub_id {
67 + PS3_MATCH_SUB_ID_GPU_FB = 1,
68 +};
69 +
70 +#define PS3_MODULE_ALIAS_EHCI "ps3:1:0"
71 +#define PS3_MODULE_ALIAS_OHCI "ps3:2:0"
72 +#define PS3_MODULE_ALIAS_GELIC "ps3:3:0"
73 +#define PS3_MODULE_ALIAS_AV_SETTINGS "ps3:4:0"
74 +#define PS3_MODULE_ALIAS_SYSTEM_MANAGER "ps3:5:0"
75 +#define PS3_MODULE_ALIAS_STOR_DISK "ps3:6:0"
76 +#define PS3_MODULE_ALIAS_STOR_ROM "ps3:7:0"
77 +#define PS3_MODULE_ALIAS_STOR_FLASH "ps3:8:0"
78 +#define PS3_MODULE_ALIAS_SOUND "ps3:9:0"
79 +#define PS3_MODULE_ALIAS_GPU_FB "ps3:10:1"
80 +#define PS3_MODULE_ALIAS_LPM "ps3:11:0"
81
82 enum ps3_system_bus_device_type {
83 PS3_DEVICE_TYPE_IOC0 = 1,
84 @@ -337,11 +341,6 @@ enum ps3_system_bus_device_type {
85 PS3_DEVICE_TYPE_LPM,
86 };
87
88 -enum ps3_match_sub_id {
89 - /* for PS3_MATCH_ID_GRAPHICS */
90 - PS3_MATCH_SUB_ID_FB = 1,
91 -};
92 -
93 /**
94 * struct ps3_system_bus_device - a device on the system bus
95 */
96 diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
97 index 43816da..dbc124e 100644
98 --- a/arch/powerpc/platforms/ps3/device-init.c
99 +++ b/arch/powerpc/platforms/ps3/device-init.c
100 @@ -497,8 +497,8 @@ static int __init ps3_register_graphics_devices(void)
101 if (!p)
102 return -ENOMEM;
103
104 - p->dev.match_id = PS3_MATCH_ID_GRAPHICS;
105 - p->dev.match_sub_id = PS3_MATCH_SUB_ID_FB;
106 + p->dev.match_id = PS3_MATCH_ID_GPU;
107 + p->dev.match_sub_id = PS3_MATCH_SUB_ID_GPU_FB;
108 p->dev.dev_type = PS3_DEVICE_TYPE_IOC0;
109
110 result = ps3_system_bus_device_register(&p->dev);
111 diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
112 index 661e9f7..d3da1e6 100644
113 --- a/arch/powerpc/platforms/ps3/system-bus.c
114 +++ b/arch/powerpc/platforms/ps3/system-bus.c
115 @@ -175,7 +175,7 @@ int ps3_open_hv_device(struct ps3_system_bus_device *dev)
116 return ps3_open_hv_device_sb(dev);
117
118 case PS3_MATCH_ID_SOUND:
119 - case PS3_MATCH_ID_GRAPHICS:
120 + case PS3_MATCH_ID_GPU:
121 return ps3_open_hv_device_gpu(dev);
122
123 case PS3_MATCH_ID_AV_SETTINGS:
124 @@ -213,7 +213,7 @@ int ps3_close_hv_device(struct ps3_system_bus_device *dev)
125 return ps3_close_hv_device_sb(dev);
126
127 case PS3_MATCH_ID_SOUND:
128 - case PS3_MATCH_ID_GRAPHICS:
129 + case PS3_MATCH_ID_GPU:
130 return ps3_close_hv_device_gpu(dev);
131
132 case PS3_MATCH_ID_AV_SETTINGS:
133 @@ -453,7 +453,8 @@ static int ps3_system_bus_uevent(struct device *_dev, struct kobj_uevent_env *en
134 {
135 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
136
137 - if (add_uevent_var(env, "MODALIAS=ps3:%d", dev->match_id))
138 + if (add_uevent_var(env, "MODALIAS=ps3:%d:%d", dev->match_id,
139 + dev->match_sub_id))
140 return -ENOMEM;
141 return 0;
142 }
143 @@ -462,7 +463,8 @@ static ssize_t modalias_show(struct device *_dev, struct device_attribute *a,
144 char *buf)
145 {
146 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
147 - int len = snprintf(buf, PAGE_SIZE, "ps3:%d\n", dev->match_id);
148 + int len = snprintf(buf, PAGE_SIZE, "ps3:%d:%d\n", dev->match_id,
149 + dev->match_sub_id);
150
151 return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
152 }
153 diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
154 index bd3e39b..38ac805 100644
155 --- a/drivers/video/ps3fb.c
156 +++ b/drivers/video/ps3fb.c
157 @@ -1289,8 +1289,8 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
158 }
159
160 static struct ps3_system_bus_driver ps3fb_driver = {
161 - .match_id = PS3_MATCH_ID_GRAPHICS,
162 - .match_sub_id = PS3_MATCH_SUB_ID_FB,
163 + .match_id = PS3_MATCH_ID_GPU,
164 + .match_sub_id = PS3_MATCH_SUB_ID_GPU_FB,
165 .core.name = DEVICE_NAME,
166 .core.owner = THIS_MODULE,
167 .probe = ps3fb_probe,
168 @@ -1348,4 +1348,4 @@ module_exit(ps3fb_exit);
169 MODULE_LICENSE("GPL");
170 MODULE_DESCRIPTION("PS3 GPU Frame Buffer Driver");
171 MODULE_AUTHOR("Sony Computer Entertainment Inc.");
172 -MODULE_ALIAS(PS3_MODULE_ALIAS_GRAPHICS);
173 +MODULE_ALIAS(PS3_MODULE_ALIAS_GPU_FB);
174 --
175 1.6.0.4
176