Skip to content

Commit bf4d668

Browse files
Yaojen_Changalex3788
authored andcommitted
Add PPID and other hwinfo for lshw package (1/2)
Change-Id: I4cb3486d191f644108bb99cfb26e21573c6f8c1a Reviewed-on: https://tp-biosrd-v02/gerrit/80794 Reviewed-by: Alex Cheng(鄭富元) <Alex_Cheng@asus.com> Tested-by: Alex Cheng(鄭富元) <Alex_Cheng@asus.com>
1 parent a6d3344 commit bf4d668

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

arch/arm/boot/dts/rk3288-miniarm.dts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444

4545
/ {
4646
compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288";
47+
model = "Tinker Board";
48+
copyright = "ASUS";
49+
system-id = " "; /*For ASUS PPID*/
4750

4851
ion {
4952
compatible = "rockchip,ion";

drivers/of/base.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ DEFINE_MUTEX(of_mutex);
5454
*/
5555
DEFINE_RAW_SPINLOCK(devtree_lock);
5656

57+
/*------------------ For ASUS write system-id---------------------*/
58+
static ssize_t asus_write_systemid(struct file *filp, struct kobject *kobj,
59+
struct bin_attribute *bin_attr, char *buf,
60+
loff_t offset, size_t count)
61+
{
62+
struct property *pp = container_of(bin_attr, struct property, attr);
63+
sscanf(buf, "%s", (char *)pp->value);
64+
return count;
65+
}
66+
/*----------------------------------------------------------------*/
67+
5768
int of_n_addr_cells(struct device_node *np)
5869
{
5970
const __be32 *ip;
@@ -151,9 +162,16 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp)
151162

152163
sysfs_bin_attr_init(&pp->attr);
153164
pp->attr.attr.name = safe_name(&np->kobj, pp->name);
165+
//For ASUS PPID (system-id)
166+
if (!(strcmp(pp->attr.attr.name, "system-id"))) {
167+
pp->attr.attr.mode = S_IRUGO|S_IWUSR;
168+
pp->attr.read = of_node_property_read;
169+
pp->attr.write = asus_write_systemid;
170+
} else {
154171
pp->attr.attr.mode = secure ? S_IRUSR : S_IRUGO;
155172
pp->attr.size = secure ? 0 : pp->length;
156173
pp->attr.read = of_node_property_read;
174+
}
157175

158176
rc = sysfs_create_bin_file(&np->kobj, &pp->attr);
159177
WARN(rc, "error adding attribute %s to node %s\n", pp->name, np->full_name);

0 commit comments

Comments
 (0)