@@ -59,18 +59,35 @@ static int info_show(struct seq_file *m, void *v)
5959 else if (pid == 1 )
6060 boardinfo = "Tinker Board S/HV" ;
6161 else if (pid == 2 )
62- boardinfo = "Tinker Board S/CGW " ;
62+ boardinfo = "Tinker Board S" ;
6363 else if (pid == 3 )
6464 boardinfo = "Tinker Board R2" ;
6565 else if (pid == 4 )
6666 boardinfo = "Tinker R/BR" ;
67+ else if (pid == 7 )
68+ boardinfo = "Tinker Board" ;
6769 else
6870 boardinfo = "unknown" ;
6971
7072 seq_printf (m , "%s\n" , boardinfo );
7173 return 0 ;
7274}
7375
76+ static int pid_show (struct seq_file * m , void * v )
77+ {
78+ int id0 , id1 , id2 ;
79+ int pid = -1 ;
80+
81+ id0 = gpio_get_value (pid_id0 );
82+ id1 = gpio_get_value (pid_id1 );
83+ id2 = gpio_get_value (pid_id2 );
84+
85+ pid = (id2 << 2 ) + (id1 << 1 ) + id0 ;
86+
87+ seq_printf (m , "%d\n" , pid );
88+ return 0 ;
89+ }
90+
7491static int ddr_show (struct seq_file * m , void * v )
7592{
7693 int id0 , id1 , id2 ;
@@ -106,6 +123,11 @@ static int info_open(struct inode *inode, struct file *file)
106123 return single_open (file , info_show , NULL );
107124}
108125
126+ static int pid_open (struct inode * inode , struct file * file )
127+ {
128+ return single_open (file , pid_show , NULL );
129+ }
130+
109131static int ddr_open (struct inode * inode , struct file * file )
110132{
111133 return single_open (file , ddr_show , NULL );
@@ -123,6 +145,12 @@ static struct file_operations boardinfo_ops = {
123145 .read = seq_read ,
124146};
125147
148+ static struct file_operations projectid_ops = {
149+ .owner = THIS_MODULE ,
150+ .open = pid_open ,
151+ .read = seq_read ,
152+ };
153+
126154static struct file_operations ddr_ops = {
127155 .owner = THIS_MODULE ,
128156 .open = ddr_open ,
@@ -251,6 +279,10 @@ static int board_info_probe(struct platform_device *pdev)
251279 if (!file )
252280 return - ENOMEM ;
253281
282+ file = proc_create ("projectid" , 0444 , NULL , & projectid_ops );
283+ if (!file )
284+ return - ENOMEM ;
285+
254286 file = proc_create ("ddr" , 0444 , NULL , & ddr_ops );
255287 if (!file )
256288 return - ENOMEM ;
0 commit comments