1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
diff -Naru linux-4.9.87.orig/drivers/pinctrl/pinctrl-at91.c linux-4.9.87/drivers/pinctrl/pinctrl-at91.c
--- linux-4.9.87.orig/drivers/pinctrl/pinctrl-at91.c 2018-12-06 17:41:59.621200529 -0600
+++ linux-4.9.87/drivers/pinctrl/pinctrl-at91.c 2018-12-06 18:06:37.437156779 -0600
@@ -29,7 +29,7 @@
#define MAX_GPIO_BANKS 5
#define MAX_NB_GPIO_PER_BANK 32
-
+#define PLATFORM_NAME "at91_pinctrl"
struct at91_pinctrl_mux_ops;
struct at91_gpio_chip {
@@ -1224,12 +1224,17 @@
return 0;
}
+static struct platform_device *at91_pinctrl_platform_device = NULL;
+
static int at91_pinctrl_probe(struct platform_device *pdev)
{
struct at91_pinctrl *info;
struct pinctrl_pin_desc *pdesc;
int ret, i, j, k, ngpio_chips_enabled = 0;
+ if (!at91_pinctrl_platform_device)
+ at91_pinctrl_platform_device = pdev;
+
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
@@ -1833,8 +1838,29 @@
&at91_pinctrl_driver,
};
+static ssize_t do_at91_pinctrl_probe(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
+{
+ /* Do Probe */
+ if(at91_pinctrl_platform_device)
+ at91_pinctrl_probe(at91_pinctrl_platform_device);
+ else
+ printk(KERN_ALERT "at91pinctrl_platform_device is undefined!\n");
+ return count;
+}
+
+static struct kobj_attribute at91_pinctrl_attr =
+__ATTR(do_at91_pinctrl_probe, 0200, NULL, do_at91_pinctrl_probe);
+
static int __init at91_pinctrl_init(void)
{
+ int ret;
+ struct kobject *kobj;
+ kobj = kobject_create_and_add(PLATFORM_NAME, kernel_kobj);
+ if(kobj)
+ {
+ ret = sysfs_create_file(kobj,&at91_pinctrl_attr.attr);
+ } else
+ printk(KERN_ALERT "Could not create platform name %s\n",PLATFORM_NAME);
return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
}
arch_initcall(at91_pinctrl_init);
|