-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
labs: yocto: beaglebone: update lab5 to scarthgap
* Update the kernel name from linux-ti-staging to linux-bb.org. * Update the driver using the one from stm32 (the stm32 is also on 6.1). * Refresh the patch that configures the device tree. Signed-off-by: Antonin Godard <[email protected]>
- Loading branch information
Showing
3 changed files
with
54 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
From 3401d8d5b923753e54bce3581a1fcea73305bf0a Mon Sep 17 00:00:00 2001 | ||
From 166d9d67c137809a9cb596789c8f50263ade3102 Mon Sep 17 00:00:00 2001 | ||
From: Alexandre Belloni <[email protected]> | ||
Date: Mon, 7 Apr 2014 11:55:31 +0200 | ||
Subject: [PATCH 1/2] Add nunchuk driver | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
Subject: [PATCH] Add nunchuk driver | ||
|
||
Signed-off-by: Alexandre Belloni <[email protected]> | ||
--- | ||
drivers/input/joystick/Kconfig | 13 + | ||
drivers/input/joystick/Makefile | 1 + | ||
drivers/input/joystick/wiichuck.c | 423 ++++++++++++++++++++++++++++++ | ||
3 files changed, 437 insertions(+) | ||
drivers/input/joystick/wiichuck.c | 404 ++++++++++++++++++++++++++++++ | ||
3 files changed, 418 insertions(+) | ||
create mode 100644 drivers/input/joystick/wiichuck.c | ||
|
||
diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig | ||
index 312b854b5506..95dfbe49de75 100644 | ||
index 04ca3d1c2816..b9640d8cc3d9 100644 | ||
--- a/drivers/input/joystick/Kconfig | ||
+++ b/drivers/input/joystick/Kconfig | ||
@@ -194,6 +194,19 @@ config JOYSTICK_TWIDJOY | ||
@@ -207,6 +207,19 @@ config JOYSTICK_TWIDJOY | ||
To compile this driver as a module, choose M here: the | ||
module will be called twidjoy. | ||
|
||
|
@@ -39,23 +36,22 @@ index 312b854b5506..95dfbe49de75 100644 | |
tristate "5-byte Zhenhua RC transmitter" | ||
select SERIO | ||
diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile | ||
index 8656023f6ef5..75483596c895 100644 | ||
index 3937535f0098..7dee2e46303d 100644 | ||
--- a/drivers/input/joystick/Makefile | ||
+++ b/drivers/input/joystick/Makefile | ||
@@ -34,6 +34,7 @@ obj-$(CONFIG_JOYSTICK_TURBOGRAFX) += turbografx.o | ||
@@ -38,5 +38,6 @@ obj-$(CONFIG_JOYSTICK_TURBOGRAFX) += turbografx.o | ||
obj-$(CONFIG_JOYSTICK_TWIDJOY) += twidjoy.o | ||
obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o | ||
obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o | ||
+obj-$(CONFIG_JOYSTICK_WIICHUCK) += wiichuck.o | ||
obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o | ||
obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o | ||
|
||
diff --git a/drivers/input/joystick/wiichuck.c b/drivers/input/joystick/wiichuck.c | ||
new file mode 100644 | ||
index 000000000000..865f5ca9d941 | ||
index 000000000000..4cb05989a2a0 | ||
--- /dev/null | ||
+++ b/drivers/input/joystick/wiichuck.c | ||
@@ -0,0 +1,423 @@ | ||
@@ -0,0 +1,404 @@ | ||
+/* | ||
+ * i2c Wiichuck driver (Nintendo Wiimote accessory connector) | ||
+ * | ||
|
@@ -68,7 +64,7 @@ index 000000000000..865f5ca9d941 | |
+ * it under the terms of version 2 of the GNU General Public License as | ||
+ * published by the Free Software Foundation. | ||
+ * | ||
+ * This driver uses the polled input device abstraction to implement an | ||
+ * This driver uses the input subsystem to implement an | ||
+ * input driver for Nintendo expansion devices wired up to an i2c bus. | ||
+ * | ||
+ * A state machine implements the protocol handling. It starts in the | ||
|
@@ -91,7 +87,6 @@ index 000000000000..865f5ca9d941 | |
+#include <linux/i2c.h> | ||
+#include <linux/interrupt.h> | ||
+#include <linux/input.h> | ||
+#include <linux/input-polldev.h> | ||
+#include <linux/mod_devicetable.h> | ||
+#include <linux/slab.h> | ||
+ | ||
|
@@ -112,7 +107,7 @@ index 000000000000..865f5ca9d941 | |
+}; | ||
+ | ||
+struct wiichuck_device { | ||
+ struct input_polled_dev *poll_dev; | ||
+ struct input_dev *input_dev; | ||
+ struct i2c_client *i2c_client; | ||
+ int (*process)(struct wiichuck_device *wiichuck); | ||
+ enum wiichuck_state state; | ||
|
@@ -165,7 +160,7 @@ index 000000000000..865f5ca9d941 | |
+ | ||
+static int wiichuck_process_nunchuk(struct wiichuck_device *wiichuck) | ||
+{ | ||
+ struct input_dev *input_dev = wiichuck->poll_dev->input; | ||
+ struct input_dev *input_dev = wiichuck->input_dev; | ||
+ uint8_t *b = wiichuck->buf; | ||
+ int ax, ay, az, rc; | ||
+ | ||
|
@@ -194,7 +189,7 @@ index 000000000000..865f5ca9d941 | |
+ | ||
+static int wiichuck_process_classic(struct wiichuck_device *wiichuck) | ||
+{ | ||
+ struct input_dev *input_dev = wiichuck->poll_dev->input; | ||
+ struct input_dev *input_dev = wiichuck->input_dev; | ||
+ uint8_t *b = wiichuck->buf; | ||
+ int lx, ly, lt, rx, ry, rt, rc; | ||
+ | ||
|
@@ -252,9 +247,9 @@ index 000000000000..865f5ca9d941 | |
+ * back. Using a state machine means the poll function can return and | ||
+ * free up the worker thread while waiting for the data. | ||
+ */ | ||
+static void wiichuck_poll(struct input_polled_dev *poll_dev) | ||
+static void wiichuck_poll(struct input_dev *input_dev) | ||
+{ | ||
+ struct wiichuck_device *wiichuck = poll_dev->private; | ||
+ struct wiichuck_device *wiichuck = input_get_drvdata(input_dev); | ||
+ int id; | ||
+ | ||
+ switch (wiichuck->state) { | ||
|
@@ -297,7 +292,7 @@ index 000000000000..865f5ca9d941 | |
+ return; | ||
+ | ||
+ wiichuck->state = WIICHUCK_STATE_DATA; | ||
+ poll_dev->poll_interval = WIICHUCK_CAPTURE_PERIOD; | ||
+ input_set_poll_interval(input_dev, WIICHUCK_CAPTURE_PERIOD); | ||
+ break; | ||
+ | ||
+ case WIICHUCK_STATE_DATA: | ||
|
@@ -318,7 +313,7 @@ index 000000000000..865f5ca9d941 | |
+ disconnect: | ||
+ dev_info(&wiichuck->i2c_client->dev, "disconnected\n"); | ||
+ wiichuck->state = WIICHUCK_STATE_DISCONNECTED; | ||
+ poll_dev->poll_interval = WIICHUCK_POLL_PERIOD; | ||
+ input_set_poll_interval(input_dev, WIICHUCK_POLL_PERIOD); | ||
+} | ||
+ | ||
+/** | ||
|
@@ -329,42 +324,37 @@ index 000000000000..865f5ca9d941 | |
+ * before reopening. This simply clears the state to disconnected and | ||
+ * sets the poll rate back to the slow speed | ||
+ */ | ||
+static void wiichuck_open(struct input_polled_dev *poll_dev) | ||
+static int wiichuck_open(struct input_dev *input_dev) | ||
+{ | ||
+ struct wiichuck_device *wiichuck = poll_dev->private; | ||
+ struct wiichuck_device *wiichuck = input_get_drvdata(input_dev); | ||
+ | ||
+ wiichuck->process = wiichuck_process_unknown; | ||
+ wiichuck->state = WIICHUCK_STATE_DISCONNECTED; | ||
+ wiichuck->poll_dev->poll_interval = WIICHUCK_POLL_PERIOD; | ||
+ input_set_poll_interval(input_dev, WIICHUCK_POLL_PERIOD); | ||
+ | ||
+ return 0; | ||
+} | ||
+ | ||
+static int wiichuck_probe(struct i2c_client *client, | ||
+ const struct i2c_device_id *id) | ||
+{ | ||
+ struct wiichuck_device *wiichuck; | ||
+ struct input_polled_dev *poll_dev; | ||
+ struct input_dev *input_dev; | ||
+ int rc; | ||
+ | ||
+ wiichuck = kzalloc(sizeof(*wiichuck), GFP_KERNEL); | ||
+ wiichuck = devm_kzalloc(&client->dev, sizeof(*wiichuck), GFP_KERNEL); | ||
+ if (!wiichuck) | ||
+ return -ENOMEM; | ||
+ | ||
+ poll_dev = input_allocate_polled_device(); | ||
+ if (!poll_dev) { | ||
+ rc = -ENOMEM; | ||
+ goto err_alloc; | ||
+ } | ||
+ input_dev = devm_input_allocate_device(&client->dev); | ||
+ if (!input_dev) | ||
+ return -ENOMEM; | ||
+ | ||
+ wiichuck->i2c_client = client; | ||
+ wiichuck->poll_dev = poll_dev; | ||
+ wiichuck->input_dev = input_dev; | ||
+ | ||
+ poll_dev->private = wiichuck; | ||
+ poll_dev->poll = wiichuck_poll; | ||
+ poll_dev->open = wiichuck_open; | ||
+ | ||
+ input_dev = poll_dev->input; | ||
+ input_dev->name = "Wiichuck expansion connector"; | ||
+ input_dev->open = wiichuck_open; | ||
+ input_dev->id.bustype = BUS_I2C; | ||
+ input_dev->dev.parent = &client->dev; | ||
+ | ||
|
@@ -424,23 +414,22 @@ index 000000000000..865f5ca9d941 | |
+ __set_bit(BTN_TR2, input_dev->keybit); | ||
+ | ||
+ i2c_set_clientdata(client, wiichuck); | ||
+ input_set_drvdata(input_dev, wiichuck); | ||
+ | ||
+ rc = input_setup_polling(input_dev, wiichuck_poll); | ||
+ if (rc) { | ||
+ dev_err(&client->dev, "Failed to setup polling\n"); | ||
+ return rc; | ||
+ } | ||
+ | ||
+ /* Register the device; it is 'live' after this point */ | ||
+ rc = input_register_polled_device(wiichuck->poll_dev); | ||
+ rc = input_register_device(input_dev); | ||
+ if (rc) { | ||
+ dev_err(&client->dev, "Failed to register input device\n"); | ||
+ goto err_register; | ||
+ return rc; | ||
+ } | ||
+ | ||
+ return 0; | ||
+ | ||
+ err_register: | ||
+ i2c_set_clientdata(client, NULL); | ||
+ input_free_polled_device(poll_dev); | ||
+ err_alloc: | ||
+ kfree(wiichuck); | ||
+ | ||
+ return rc; | ||
+} | ||
+ | ||
+static const struct i2c_device_id wiichuck_id[] = { | ||
|
@@ -454,31 +443,19 @@ index 000000000000..865f5ca9d941 | |
+ { .compatible = "nintendo,wiimote-extension", }, | ||
+ { } | ||
+}; | ||
+#else | ||
+#define wiichuck_match_table NULL | ||
+MODULE_DEVICE_TABLE(of, nunchuk_dt_match); | ||
+#endif | ||
+ | ||
+static struct i2c_driver wiichuck_driver = { | ||
+ .driver = { | ||
+ .name = "wiichuck", | ||
+ .owner = THIS_MODULE, | ||
+ .of_match_table = wiichuck_match_table, | ||
+ .of_match_table = of_match_ptr(wiichuck_match_table), | ||
+ }, | ||
+ .probe = wiichuck_probe, | ||
+ .id_table = wiichuck_id, | ||
+}; | ||
+ | ||
+static int __init wiichuck_init(void) | ||
+{ | ||
+ return i2c_add_driver(&wiichuck_driver); | ||
+} | ||
+module_init(wiichuck_init); | ||
+ | ||
+static void __exit wiichuck_exit(void) | ||
+{ | ||
+ i2c_del_driver(&wiichuck_driver); | ||
+} | ||
+module_exit(wiichuck_exit); | ||
+module_i2c_driver(wiichuck_driver); | ||
-- | ||
2.25.1 | ||
2.46.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From ef99fb27bd349d247334c636d96c0deccd0a04f4 Mon Sep 17 00:00:00 2001 | ||
From 72551ba8e0d34167db1e49de86fbefb27aef0859 Mon Sep 17 00:00:00 2001 | ||
From: Alexandre Belloni <[email protected]> | ||
Date: Thu, 26 Jul 2018 11:39:17 +0200 | ||
Subject: [PATCH 2/2] Add i2c1 and nunchuk nodes in dts | ||
Subject: [PATCH] Add i2c1 and nunchuk nodes in dts | ||
|
||
Signed-off-by: Alexandre Belloni <[email protected]> | ||
--- | ||
|
@@ -10,10 +10,10 @@ Signed-off-by: Alexandre Belloni <[email protected]> | |
2 files changed, 20 insertions(+) | ||
|
||
diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi | ||
index ee04b7dd07ac..462ede7831e7 100644 | ||
index ab323df700bb..c6d9eff27319 100644 | ||
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi | ||
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi | ||
@@ -82,6 +82,13 @@ | ||
@@ -81,6 +81,13 @@ AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0) /* i2c0_scl.i2c | ||
>; | ||
}; | ||
|
||
|
@@ -24,17 +24,18 @@ index ee04b7dd07ac..462ede7831e7 100644 | |
+ >; | ||
+ }; | ||
+ | ||
i2c2_pins: pinmux_i2c2_pins { | ||
i2c2_pins: i2c2-pins { | ||
pinctrl-single,pins = < | ||
AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLUP, MUX_MODE3) /* uart1_ctsn.i2c2_sda */ | ||
diff --git a/arch/arm/boot/dts/am335x-boneblack-common.dtsi b/arch/arm/boot/dts/am335x-boneblack-common.dtsi | ||
index 91f93bc89716..3d6b019cbc36 100644 | ||
index a7a8c61ef9b2..1d72294f61d5 100644 | ||
--- a/arch/arm/boot/dts/am335x-boneblack-common.dtsi | ||
+++ b/arch/arm/boot/dts/am335x-boneblack-common.dtsi | ||
@@ -112,6 +112,19 @@ | ||
@@ -28,3 +28,16 @@ memory@80000000 { | ||
reg = <0x80000000 0x20000000>; /* 512 MB */ | ||
}; | ||
}; | ||
+ | ||
+&i2c1 { | ||
+ status = "okay"; | ||
+ clock-frequency = <100000>; | ||
|
@@ -47,10 +48,6 @@ index 91f93bc89716..3d6b019cbc36 100644 | |
+ reg = <0x52>; | ||
+ }; | ||
+}; | ||
+ | ||
&rtc { | ||
system-power-controller; | ||
}; | ||
-- | ||
2.25.1 | ||
2.46.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters