All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Add vibration motor support to U-Boot
@ 2021-12-22 22:36 Samuel Dionne-Riel
  2021-12-22 22:36 ` [PATCH 1/4] drivers: Introduce vibrator uclass Samuel Dionne-Riel
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Samuel Dionne-Riel @ 2021-12-22 22:36 UTC (permalink / raw)
  To: u-boot; +Cc: Samuel Dionne-Riel

This series of patch adds support for vibration motors (often called
vibrators) to U-Boot.

The support adds the necessary plumbing to support SPL usage of
vibration motors. This can be used to vibrate the device, like a phone,
as early as possible during the boot process.

A `vibrator` command allows scripts, or customised boot commands, to
vibrate the device. This can be used to provide feedback to the end-user
about failure state, or boot stage.

An example use case of the command is, in a customized boot command, to
signify that an error happend, by synchronizing red LED flashes with a
few short vibrations.

Samuel Dionne-Riel (4):
  drivers: Introduce vibrator uclass
  vibrator: Add vibrator_gpio driver
  cmd: Add vibrator command
  pinephone_defconfig: Add gpio vibrator support

 arch/sandbox/dts/test.dts          |  10 ++
 cmd/Kconfig                        |  10 ++
 cmd/Makefile                       |   1 +
 cmd/vibrator.c                     | 148 +++++++++++++++++++++++++++++
 configs/pinephone_defconfig        |   2 +
 configs/sandbox_defconfig          |   2 +
 drivers/Kconfig                    |   2 +
 drivers/Makefile                   |   1 +
 drivers/vibrator/Kconfig           |  37 ++++++++
 drivers/vibrator/Makefile          |   6 ++
 drivers/vibrator/vibrator-uclass.c |  62 ++++++++++++
 drivers/vibrator/vibrator_gpio.c   | 122 ++++++++++++++++++++++++
 include/dm/uclass-id.h             |   1 +
 include/vibrator.h                 |  87 +++++++++++++++++
 test/dm/Makefile                   |   1 +
 test/dm/vibrator.c                 |  97 +++++++++++++++++++
 16 files changed, 589 insertions(+)
 create mode 100644 cmd/vibrator.c
 create mode 100644 drivers/vibrator/Kconfig
 create mode 100644 drivers/vibrator/Makefile
 create mode 100644 drivers/vibrator/vibrator-uclass.c
 create mode 100644 drivers/vibrator/vibrator_gpio.c
 create mode 100644 include/vibrator.h
 create mode 100644 test/dm/vibrator.c

-- 
2.34.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] drivers: Introduce vibrator uclass
  2021-12-22 22:36 [PATCH 0/4] Add vibration motor support to U-Boot Samuel Dionne-Riel
@ 2021-12-22 22:36 ` Samuel Dionne-Riel
  2021-12-28  8:34   ` Simon Glass
  2022-01-28 22:39   ` Tom Rini
  2021-12-22 22:36 ` [PATCH 2/4] vibrator: Add vibrator_gpio driver Samuel Dionne-Riel
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Samuel Dionne-Riel @ 2021-12-22 22:36 UTC (permalink / raw)
  To: u-boot; +Cc: Samuel Dionne-Riel

Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
---
 arch/sandbox/dts/test.dts          | 10 +++
 configs/sandbox_defconfig          |  2 +
 drivers/Kconfig                    |  2 +
 drivers/Makefile                   |  1 +
 drivers/vibrator/Kconfig           | 21 +++++++
 drivers/vibrator/Makefile          |  5 ++
 drivers/vibrator/vibrator-uclass.c | 62 +++++++++++++++++++
 include/dm/uclass-id.h             |  1 +
 include/vibrator.h                 | 87 +++++++++++++++++++++++++++
 test/dm/Makefile                   |  1 +
 test/dm/vibrator.c                 | 97 ++++++++++++++++++++++++++++++
 11 files changed, 289 insertions(+)
 create mode 100644 drivers/vibrator/Kconfig
 create mode 100644 drivers/vibrator/Makefile
 create mode 100644 drivers/vibrator/vibrator-uclass.c
 create mode 100644 include/vibrator.h
 create mode 100644 test/dm/vibrator.c

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 2cea4a43c8..3633b8fb9f 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -1608,6 +1608,16 @@
 			compatible = "sandbox,regmap_test";
 		};
 	};
+
+	vibrator_left {
+		compatible = "gpio-vibrator";
+		enable-gpios = <&gpio_a 1 0 GPIO_ACTIVE_HIGH>;
+	};
+
+	vibrator_right {
+		compatible = "gpio-vibrator";
+		enable-gpios = <&gpio_a 2 0 GPIO_ACTIVE_HIGH>;
+	};
 };
 
 #include "sandbox_pmic.dtsi"
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index c390afe9de..43f9972178 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -273,6 +273,8 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_ETHER=y
 CONFIG_USB_ETH_CDC=y
+CONFIG_VIBRATOR=y
+CONFIG_VIBRATOR_GPIO=y
 CONFIG_DM_VIDEO=y
 CONFIG_VIDEO_COPY=y
 CONFIG_CONSOLE_ROTATION=y
diff --git a/drivers/Kconfig b/drivers/Kconfig
index b26ca8cf70..a15674f22c 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -134,6 +134,8 @@ source "drivers/usb/Kconfig"
 
 source "drivers/ufs/Kconfig"
 
+source "drivers/vibrator/Kconfig"
+
 source "drivers/video/Kconfig"
 
 source "drivers/virtio/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 4e7cf28440..2290d4a5d8 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_$(SPL_TPL_)RTC) += rtc/
 obj-$(CONFIG_$(SPL_TPL_)SERIAL) += serial/
 obj-$(CONFIG_$(SPL_TPL_)SPI) += spi/
 obj-$(CONFIG_$(SPL_TPL_)TIMER) += timer/
+obj-$(CONFIG_$(SPL_TPL_)VIBRATOR) += vibrator/
 obj-$(CONFIG_$(SPL_TPL_)VIRTIO) += virtio/
 obj-$(CONFIG_$(SPL_)DM_MAILBOX) += mailbox/
 obj-$(CONFIG_$(SPL_)REMOTEPROC) += remoteproc/
diff --git a/drivers/vibrator/Kconfig b/drivers/vibrator/Kconfig
new file mode 100644
index 0000000000..f988aa63b9
--- /dev/null
+++ b/drivers/vibrator/Kconfig
@@ -0,0 +1,21 @@
+menu "Vibrator Feedback Support"
+
+config VIBRATOR
+	bool "Enable vibration motor support"
+	depends on DM
+	help
+	  Many boards have vibration motorss which can be used to signal status or
+	  alerts. U-Boot provides a uclass API to implement this feature. Vibration
+	  motor drivers can provide access to board-specific vibration motors. Use
+	  of the device tree for configuration is encouraged.
+
+config SPL_VIBRATOR
+	bool "Enable vibration motor support in SPL"
+	depends on SPL && SPL_DM
+	help
+	  The vibration motor subsystem adds a small amount of overhead to the image.
+	  If this is acceptable and you have a need to use vibration motors in SPL,
+	  enable this option. You will need to enable device tree in SPL
+	  for this to work.
+
+endmenu
diff --git a/drivers/vibrator/Makefile b/drivers/vibrator/Makefile
new file mode 100644
index 0000000000..326838ff7a
--- /dev/null
+++ b/drivers/vibrator/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (c) 2021 Samuel Dionne-Riel <samuel@dionne-riel.com>
+
+obj-y += vibrator-uclass.o
diff --git a/drivers/vibrator/vibrator-uclass.c b/drivers/vibrator/vibrator-uclass.c
new file mode 100644
index 0000000000..ffb6522a19
--- /dev/null
+++ b/drivers/vibrator/vibrator-uclass.c
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2021 Samuel Dionne-Riel <samuel@dionne-riel.com>
+ * Copyright (c) 2015 Google, Inc
+ * Largely derived from `drivers/led/led-uclass.c`
+ * Original written by Simon Glass <sjg@chromium.org>
+ */
+
+#define LOG_CATEGORY UCLASS_VIBRATOR
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <vibrator.h>
+#include <dm/device-internal.h>
+#include <dm/root.h>
+#include <dm/uclass-internal.h>
+
+int vibrator_get_by_label(const char *label, struct udevice **devp)
+{
+	struct udevice *dev;
+	struct uclass *uc;
+	int ret;
+
+	ret = uclass_get(UCLASS_VIBRATOR, &uc);
+	if (ret)
+		return ret;
+	uclass_foreach_dev(dev, uc) {
+		struct vibrator_uc_plat *uc_plat = dev_get_uclass_plat(dev);
+
+		if (uc_plat->label && strcmp(label, uc_plat->label) == 0)
+			return uclass_get_device_tail(dev, 0, devp);
+	}
+
+	return -ENODEV;
+}
+
+int vibrator_set_state(struct udevice *dev, enum vibrator_state_t state)
+{
+	struct vibrator_ops *ops = vibrator_get_ops(dev);
+
+	if (!ops->set_state)
+		return -ENOSYS;
+
+	return ops->set_state(dev, state);
+}
+
+enum vibrator_state_t vibrator_get_state(struct udevice *dev)
+{
+	struct vibrator_ops *ops = vibrator_get_ops(dev);
+
+	if (!ops->get_state)
+		return -ENOSYS;
+
+	return ops->get_state(dev);
+}
+
+UCLASS_DRIVER(vibrator) = {
+	.id		= UCLASS_VIBRATOR,
+	.name		= "vibrator",
+	.per_device_plat_auto	= sizeof(struct vibrator_uc_plat),
+};
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index 0e26e1d138..265369d07b 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -125,6 +125,7 @@ enum uclass_id {
 	UCLASS_USB_DEV_GENERIC,	/* USB generic device */
 	UCLASS_USB_HUB,		/* USB hub */
 	UCLASS_USB_GADGET_GENERIC,	/* USB generic device */
+	UCLASS_VIBRATOR,	/* Vibration feedback devices (phone vibration) */
 	UCLASS_VIDEO,		/* Video or LCD device */
 	UCLASS_VIDEO_BRIDGE,	/* Video bridge, e.g. DisplayPort to LVDS */
 	UCLASS_VIDEO_CONSOLE,	/* Text console driver for video device */
diff --git a/include/vibrator.h b/include/vibrator.h
new file mode 100644
index 0000000000..9b04c7303a
--- /dev/null
+++ b/include/vibrator.h
@@ -0,0 +1,87 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2021 Samuel Dionne-Riel <samuel@dionne-riel.com>
+ * Copyright (c) 2015 Google, Inc
+ * Largely derived from `include/led.h`
+ * Original written by Simon Glass <sjg@chromium.org>
+ */
+
+#ifndef __VIBRATOR_H
+#define __VIBRATOR_H
+
+struct udevice;
+
+/**
+ * struct vibrator_uc_plat - Platform data the uclass stores about each device
+ *
+ * @label:	VIBRATOR label
+ */
+struct vibrator_uc_plat {
+	const char *label;
+};
+
+/**
+ * struct vibrator_uc_priv - Private data the uclass stores about each device
+ *
+ * @period_ms:	Flash period in milliseconds
+ */
+struct vibrator_uc_priv {
+	int period_ms;
+};
+
+enum vibrator_state_t {
+	VIBRATOR_STATE_OFF = 0,
+	VIBRATOR_STATE_ON = 1,
+	VIBRATOR_STATE_TOGGLE,
+
+	VIBRATOR_STATE_COUNT,
+};
+
+struct vibrator_ops {
+	/**
+	 * set_state() - set the state of an VIBRATOR
+	 *
+	 * @dev:	VIBRATOR device to change
+	 * @state:	VIBRATOR state to set
+	 * @return 0 if OK, -ve on error
+	 */
+	int (*set_state)(struct udevice *dev, enum vibrator_state_t state);
+
+	/**
+	 * vibrator_get_state() - get the state of an VIBRATOR
+	 *
+	 * @dev:	VIBRATOR device to change
+	 * @return VIBRATOR state vibrator_state_t, or -ve on error
+	 */
+	enum vibrator_state_t (*get_state)(struct udevice *dev);
+};
+
+#define vibrator_get_ops(dev)	((struct vibrator_ops *)(dev)->driver->ops)
+
+/**
+ * vibrator_get_by_label() - Find an VIBRATOR device by label
+ *
+ * @label:	VIBRATOR label to look up
+ * @devp:	Returns the associated device, if found
+ * @return 0 if found, -ENODEV if not found, other -ve on error
+ */
+int vibrator_get_by_label(const char *label, struct udevice **devp);
+
+/**
+ * vibrator_set_state() - set the state of an VIBRATOR
+ *
+ * @dev:	VIBRATOR device to change
+ * @state:	VIBRATOR state to set
+ * @return 0 if OK, -ve on error
+ */
+int vibrator_set_state(struct udevice *dev, enum vibrator_state_t state);
+
+/**
+ * vibrator_get_state() - get the state of an VIBRATOR
+ *
+ * @dev:	VIBRATOR device to change
+ * @return VIBRATOR state vibrator_state_t, or -ve on error
+ */
+enum vibrator_state_t vibrator_get_state(struct udevice *dev);
+
+#endif
diff --git a/test/dm/Makefile b/test/dm/Makefile
index d46552fbf3..dffed0e7fc 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -106,6 +106,7 @@ obj-$(CONFIG_TEE) += tee.o
 obj-$(CONFIG_TIMER) += timer.o
 obj-$(CONFIG_DM_USB) += usb.o
 obj-$(CONFIG_DM_VIDEO) += video.o
+obj-$(CONFIG_VIBRATOR) += vibrator.o
 obj-$(CONFIG_VIRTIO_SANDBOX) += virtio.o
 ifeq ($(CONFIG_WDT_GPIO)$(CONFIG_WDT_SANDBOX),yy)
 obj-y += wdt.o
diff --git a/test/dm/vibrator.c b/test/dm/vibrator.c
new file mode 100644
index 0000000000..ab5b548431
--- /dev/null
+++ b/test/dm/vibrator.c
@@ -0,0 +1,97 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2021 Samuel Dionne-Riel <samuel@dionne-riel.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <vibrator.h>
+#include <asm/gpio.h>
+#include <dm/test.h>
+#include <test/test.h>
+#include <test/ut.h>
+
+/* Base test of the vibrator uclass */
+static int dm_test_vibrator_base(struct unit_test_state *uts)
+{
+	struct udevice *dev;
+
+	ut_assertok(uclass_get_device(UCLASS_VIBRATOR, 0, &dev));
+	ut_assertok(uclass_get_device(UCLASS_VIBRATOR, 1, &dev));
+	ut_asserteq(-ENODEV, uclass_get_device(UCLASS_VIBRATOR, 2, &dev));
+
+	return 0;
+}
+DM_TEST(dm_test_vibrator_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
+/* Test of the vibrator uclass using the vibrator_gpio driver */
+static int dm_test_vibrator_gpio(struct unit_test_state *uts)
+{
+	const int offset = 1;
+	struct udevice *dev, *gpio;
+
+	/*
+	 * Check that we can manipulate a vibration motor. Vibrator 1 is connected to GPIO
+	 * bank gpio_a, offset 1.
+	 */
+	ut_assertok(uclass_get_device(UCLASS_VIBRATOR, 0, &dev));
+	ut_assertok(uclass_get_device(UCLASS_GPIO, 1, &gpio));
+	ut_asserteq(0, sandbox_gpio_get_value(gpio, offset));
+	ut_assertok(vibrator_set_state(dev, VIBRATOR_STATE_ON));
+	ut_asserteq(1, sandbox_gpio_get_value(gpio, offset));
+	ut_asserteq(VIBRATOR_STATE_ON, vibrator_get_state(dev));
+
+	ut_assertok(vibrator_set_state(dev, VIBRATOR_STATE_OFF));
+	ut_asserteq(0, sandbox_gpio_get_value(gpio, offset));
+	ut_asserteq(VIBRATOR_STATE_OFF, vibrator_get_state(dev));
+
+	return 0;
+}
+DM_TEST(dm_test_vibrator_gpio, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
+/* Test that we can toggle vibration motors */
+static int dm_test_vibrator_toggle(struct unit_test_state *uts)
+{
+	const int offset = 1;
+	struct udevice *dev, *gpio;
+
+	/*
+	 * Check that we can manipulate a vibration motor. Vibrator 1 is connected to GPIO
+	 * bank gpio_a, offset 1.
+	 */
+	ut_assertok(uclass_get_device(UCLASS_VIBRATOR, 0, &dev));
+	ut_assertok(uclass_get_device(UCLASS_GPIO, 1, &gpio));
+	ut_asserteq(0, sandbox_gpio_get_value(gpio, offset));
+	ut_assertok(vibrator_set_state(dev, VIBRATOR_STATE_TOGGLE));
+	ut_asserteq(1, sandbox_gpio_get_value(gpio, offset));
+	ut_asserteq(VIBRATOR_STATE_ON, vibrator_get_state(dev));
+
+	ut_assertok(vibrator_set_state(dev, VIBRATOR_STATE_TOGGLE));
+	ut_asserteq(0, sandbox_gpio_get_value(gpio, offset));
+	ut_asserteq(VIBRATOR_STATE_OFF, vibrator_get_state(dev));
+
+	return 0;
+}
+DM_TEST(dm_test_vibrator_toggle, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
+/* Test obtaining a vibration motor by label */
+static int dm_test_vibrator_label(struct unit_test_state *uts)
+{
+	struct udevice *dev, *cmp;
+
+	ut_assertok(vibrator_get_by_label("vibrator_left", &dev));
+	ut_asserteq(1, device_active(dev));
+	ut_assertok(uclass_get_device(UCLASS_VIBRATOR, 0, &cmp));
+	ut_asserteq_ptr(dev, cmp);
+
+	ut_assertok(vibrator_get_by_label("vibrator_right", &dev));
+	ut_asserteq(1, device_active(dev));
+	ut_assertok(uclass_get_device(UCLASS_VIBRATOR, 1, &cmp));
+	ut_asserteq_ptr(dev, cmp);
+
+	ut_asserteq(-ENODEV, vibrator_get_by_label("doesnotexist", &dev));
+
+	return 0;
+}
+DM_TEST(dm_test_vibrator_label, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] vibrator: Add vibrator_gpio driver
  2021-12-22 22:36 [PATCH 0/4] Add vibration motor support to U-Boot Samuel Dionne-Riel
  2021-12-22 22:36 ` [PATCH 1/4] drivers: Introduce vibrator uclass Samuel Dionne-Riel
@ 2021-12-22 22:36 ` Samuel Dionne-Riel
  2021-12-28  8:34   ` Simon Glass
  2021-12-22 22:36 ` [PATCH 3/4] cmd: Add vibrator command Samuel Dionne-Riel
  2021-12-22 22:36 ` [PATCH 4/4] pinephone_defconfig: Add gpio vibrator support Samuel Dionne-Riel
  3 siblings, 1 reply; 9+ messages in thread
From: Samuel Dionne-Riel @ 2021-12-22 22:36 UTC (permalink / raw)
  To: u-boot; +Cc: Samuel Dionne-Riel

Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
---
 drivers/vibrator/Kconfig         |  16 ++++
 drivers/vibrator/Makefile        |   1 +
 drivers/vibrator/vibrator_gpio.c | 122 +++++++++++++++++++++++++++++++
 3 files changed, 139 insertions(+)
 create mode 100644 drivers/vibrator/vibrator_gpio.c

diff --git a/drivers/vibrator/Kconfig b/drivers/vibrator/Kconfig
index f988aa63b9..88e84ffb6c 100644
--- a/drivers/vibrator/Kconfig
+++ b/drivers/vibrator/Kconfig
@@ -18,4 +18,20 @@ config SPL_VIBRATOR
 	  enable this option. You will need to enable device tree in SPL
 	  for this to work.
 
+config VIBRATOR_GPIO
+	bool "VIBRATOR support for GPIO-connected VIBRATORs"
+	depends on VIBRATOR && DM_GPIO
+	help
+	  Enable support for vibration motors which are connected to GPIO lines.
+	  These GPIOs may be on the SoC or some other device which provides GPIOs.
+	  The GPIO driver must used driver model. vibration motors are configured
+	  using the device tree.
+
+config SPL_VIBRATOR_GPIO
+	bool "Vibration motor support for GPIO-connected vibration motors in SPL"
+        depends on SPL_VIBRATOR && DM_GPIO
+	help
+	  This option is an SPL-variant of the VIBRATOR_GPIO option.
+	  See the help of VIBRATOR_GPIO for details.
+
 endmenu
diff --git a/drivers/vibrator/Makefile b/drivers/vibrator/Makefile
index 326838ff7a..cc5fc14fbf 100644
--- a/drivers/vibrator/Makefile
+++ b/drivers/vibrator/Makefile
@@ -3,3 +3,4 @@
 # Copyright (c) 2021 Samuel Dionne-Riel <samuel@dionne-riel.com>
 
 obj-y += vibrator-uclass.o
+obj-$(CONFIG_$(SPL_)VIBRATOR_GPIO) += vibrator_gpio.o
diff --git a/drivers/vibrator/vibrator_gpio.c b/drivers/vibrator/vibrator_gpio.c
new file mode 100644
index 0000000000..95648a7231
--- /dev/null
+++ b/drivers/vibrator/vibrator_gpio.c
@@ -0,0 +1,122 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2021 Samuel Dionne-Riel <samuel@dionne-riel.com>
+ * Copyright (c) 2015 Google, Inc
+ * Largely derived from `drivers/led/led_gpio.c`
+ * Original written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <vibrator.h>
+#include <log.h>
+#include <malloc.h>
+#include <asm/gpio.h>
+#include <dm/lists.h>
+
+struct vibrator_gpio_priv {
+	struct gpio_desc gpio;
+};
+
+static int gpio_vibrator_set_state(struct udevice *dev, enum vibrator_state_t state)
+{
+	struct vibrator_gpio_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	if (!dm_gpio_is_valid(&priv->gpio))
+		return -EREMOTEIO;
+	switch (state) {
+	case VIBRATOR_STATE_OFF:
+	case VIBRATOR_STATE_ON:
+		break;
+	case VIBRATOR_STATE_TOGGLE:
+		ret = dm_gpio_get_value(&priv->gpio);
+		if (ret < 0)
+			return ret;
+		state = !ret;
+		break;
+	default:
+		return -ENOSYS;
+	}
+
+	return dm_gpio_set_value(&priv->gpio, state);
+}
+
+static enum vibrator_state_t gpio_vibrator_get_state(struct udevice *dev)
+{
+	struct vibrator_gpio_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	if (!dm_gpio_is_valid(&priv->gpio))
+		return -EREMOTEIO;
+	ret = dm_gpio_get_value(&priv->gpio);
+	if (ret < 0)
+		return ret;
+
+	return ret ? VIBRATOR_STATE_ON : VIBRATOR_STATE_OFF;
+}
+
+static int vibrator_gpio_probe(struct udevice *dev)
+{
+	struct vibrator_gpio_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	ret = gpio_request_by_name(dev, "enable-gpios", 0, &priv->gpio, GPIOD_IS_OUT);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static int vibrator_gpio_remove(struct udevice *dev)
+{
+	/*
+	 * The GPIO driver may have already been removed. We will need to
+	 * address this more generally.
+	 */
+	if (!IS_ENABLED(CONFIG_SANDBOX)) {
+		struct vibrator_gpio_priv *priv = dev_get_priv(dev);
+
+		if (dm_gpio_is_valid(&priv->gpio))
+			dm_gpio_free(dev, &priv->gpio);
+	}
+
+	return 0;
+}
+
+static int vibrator_gpio_bind(struct udevice *dev)
+{
+	ofnode node;
+	struct vibrator_uc_plat *uc_plat;
+	const char *label;
+
+	node = dev_ofnode(dev);
+	label = ofnode_get_name(node);
+
+	uc_plat = dev_get_uclass_plat(dev);
+	uc_plat->label = label;
+
+	return 0;
+}
+
+static const struct vibrator_ops gpio_vibrator_ops = {
+	.set_state	= gpio_vibrator_set_state,
+	.get_state	= gpio_vibrator_get_state,
+};
+
+static const struct udevice_id vibrator_gpio_ids[] = {
+	{ .compatible = "gpio-vibrator" },
+	{ }
+};
+
+U_BOOT_DRIVER(vibrator_gpio) = {
+	.name	= "gpio_vibrator",
+	.id	= UCLASS_VIBRATOR,
+	.of_match = vibrator_gpio_ids,
+	.ops	= &gpio_vibrator_ops,
+	.priv_auto	= sizeof(struct vibrator_gpio_priv),
+	.bind	= vibrator_gpio_bind,
+	.probe	= vibrator_gpio_probe,
+	.remove	= vibrator_gpio_remove,
+};
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] cmd: Add vibrator command
  2021-12-22 22:36 [PATCH 0/4] Add vibration motor support to U-Boot Samuel Dionne-Riel
  2021-12-22 22:36 ` [PATCH 1/4] drivers: Introduce vibrator uclass Samuel Dionne-Riel
  2021-12-22 22:36 ` [PATCH 2/4] vibrator: Add vibrator_gpio driver Samuel Dionne-Riel
@ 2021-12-22 22:36 ` Samuel Dionne-Riel
  2021-12-28  8:34   ` Simon Glass
  2021-12-22 22:36 ` [PATCH 4/4] pinephone_defconfig: Add gpio vibrator support Samuel Dionne-Riel
  3 siblings, 1 reply; 9+ messages in thread
From: Samuel Dionne-Riel @ 2021-12-22 22:36 UTC (permalink / raw)
  To: u-boot; +Cc: Samuel Dionne-Riel

Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
---
 cmd/Kconfig    |  10 ++++
 cmd/Makefile   |   1 +
 cmd/vibrator.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 159 insertions(+)
 create mode 100644 cmd/vibrator.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index e538e69a11..51e79ad806 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1391,6 +1391,16 @@ config CMD_PVBLOCK
 	help
 	  Xen para-virtualized block device support
 
+config CMD_VIBRATOR
+	bool "vibrator"
+	depends on VIBRATOR
+	default y if VIBRATOR
+	help
+	  Enable the 'vibrator' command which allows for control of vibrator
+	  motors available on the board. The vibrator motors can be listed with
+	  'vibrator list' and controlled with vibrator on/off/time. Any
+	  vibrator driver can be controlled with this command.
+
 config CMD_VIRTIO
 	bool "virtio"
 	depends on VIRTIO
diff --git a/cmd/Makefile b/cmd/Makefile
index 6c4db4ed2e..49bf184bd9 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -164,6 +164,7 @@ obj-$(CONFIG_CMD_UBIFS) += ubifs.o
 obj-$(CONFIG_CMD_UNIVERSE) += universe.o
 obj-$(CONFIG_CMD_UNLZ4) += unlz4.o
 obj-$(CONFIG_CMD_UNZIP) += unzip.o
+obj-$(CONFIG_CMD_VIBRATOR) += vibrator.o
 obj-$(CONFIG_CMD_VIRTIO) += virtio.o
 obj-$(CONFIG_CMD_WDT) += wdt.o
 obj-$(CONFIG_CMD_LZMADEC) += lzmadec.o
diff --git a/cmd/vibrator.c b/cmd/vibrator.c
new file mode 100644
index 0000000000..b77cb4867a
--- /dev/null
+++ b/cmd/vibrator.c
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2021 Samuel Dionne-Riel <samuel@dionne-riel.com>
+ * Copyright (c) 2017 Google, Inc
+ * Largely derived from `cmd/led.c`
+ * Original written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <common.h>
+#include <command.h>
+#include <dm.h>
+#include <vibrator.h>
+#include <dm/uclass-internal.h>
+#include <linux/delay.h>
+
+static const char *const state_label[] = {
+	[VIBRATOR_STATE_OFF]	= "off",
+	[VIBRATOR_STATE_ON]	= "on",
+	[VIBRATOR_STATE_TOGGLE]	= "toggle",
+};
+
+enum vibrator_state_t get_vibrator_cmd(char *var)
+{
+	int i;
+
+	for (i = 0; i < VIBRATOR_STATE_COUNT; i++) {
+		if (!strncmp(var, state_label[i], strlen(var)))
+			return i;
+	}
+
+	return -1;
+}
+
+static int show_vibrator_state(struct udevice *dev)
+{
+	int ret;
+
+	ret = vibrator_get_state(dev);
+	if (ret >= VIBRATOR_STATE_COUNT)
+		ret = -EINVAL;
+	if (ret >= 0)
+		printf("%s\n", state_label[ret]);
+
+	return ret;
+}
+
+static int list_vibrators(void)
+{
+	struct udevice *dev;
+	int ret;
+
+	for (uclass_find_first_device(UCLASS_VIBRATOR, &dev);
+	     dev;
+	     uclass_find_next_device(&dev)) {
+		struct vibrator_uc_plat *plat = dev_get_uclass_plat(dev);
+
+		if (!plat->label)
+			continue;
+		printf("%-15s ", plat->label);
+		if (device_active(dev)) {
+			ret = show_vibrator_state(dev);
+			if (ret < 0)
+				printf("Error %d\n", ret);
+		} else {
+			printf("<inactive>\n");
+		}
+	}
+
+	return 0;
+}
+
+int timed_vibration(struct udevice *dev, int duration_ms)
+{
+	int ret;
+
+	ret = vibrator_set_state(dev, VIBRATOR_STATE_ON);
+	if (ret < 0) {
+		printf("Vibrator operation failed (err=%d)\n", ret);
+		return CMD_RET_FAILURE;
+	}
+
+	udelay(duration_ms * 1000);
+
+	ret = vibrator_set_state(dev, VIBRATOR_STATE_OFF);
+	if (ret < 0) {
+		printf("Vibrator operation failed (err=%d)\n", ret);
+		return CMD_RET_FAILURE;
+	}
+
+	return CMD_RET_SUCCESS;
+}
+
+int do_vibrator(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+	enum vibrator_state_t cmd;
+	const char *vibrator_label;
+	struct udevice *dev;
+	int ret;
+	int duration_ms = 0;
+
+	/* Validate arguments */
+	if (argc < 2)
+		return CMD_RET_USAGE;
+	vibrator_label = argv[1];
+	if (strncmp(vibrator_label, "list", 4) == 0)
+		return list_vibrators();
+
+	cmd = argc > 2 ? get_vibrator_cmd(argv[2]) : VIBRATOR_STATE_COUNT;
+	ret = vibrator_get_by_label(vibrator_label, &dev);
+	if (ret) {
+		printf("Vibrator '%s' not found (err=%d)\n", vibrator_label, ret);
+		return CMD_RET_FAILURE;
+	}
+
+	if (strncmp(argv[2], "timed", 5) == 0) {
+		if (argc < 4)
+			return CMD_RET_USAGE;
+		duration_ms = dectoul(argv[3], NULL);
+
+		return timed_vibration(dev, duration_ms);
+	}
+
+	switch (cmd) {
+	case VIBRATOR_STATE_OFF:
+	case VIBRATOR_STATE_ON:
+	case VIBRATOR_STATE_TOGGLE:
+		ret = vibrator_set_state(dev, cmd);
+		break;
+	case VIBRATOR_STATE_COUNT:
+		printf("Vibrator '%s': ", vibrator_label);
+		ret = show_vibrator_state(dev);
+		break;
+	}
+	if (ret < 0) {
+		printf("Vibrator '%s' operation failed (err=%d)\n", vibrator_label, ret);
+		return CMD_RET_FAILURE;
+	}
+
+	return 0;
+}
+
+U_BOOT_CMD(vibrator, 4, 1, do_vibrator,
+	   "manage vibration motors",
+	   "<vibrator_label> on|off\tChange vibration motor state\n"
+	   "vibrator <vibrator_label> timed <ms duration>\t\tVibrate for the given duration (will block)\n"
+	   "vibrator <vibrator_label>\tGet vibration motor state\n"
+	   "vibrator list\t\tShow a list of vibration motors"
+);
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] pinephone_defconfig: Add gpio vibrator support
  2021-12-22 22:36 [PATCH 0/4] Add vibration motor support to U-Boot Samuel Dionne-Riel
                   ` (2 preceding siblings ...)
  2021-12-22 22:36 ` [PATCH 3/4] cmd: Add vibrator command Samuel Dionne-Riel
@ 2021-12-22 22:36 ` Samuel Dionne-Riel
  3 siblings, 0 replies; 9+ messages in thread
From: Samuel Dionne-Riel @ 2021-12-22 22:36 UTC (permalink / raw)
  To: u-boot; +Cc: Samuel Dionne-Riel, Samuel Holland

Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
Cc: Samuel Holland <samuel@sholland.org>
---
 configs/pinephone_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/pinephone_defconfig b/configs/pinephone_defconfig
index 9d39204a43..72aaa4ea94 100644
--- a/configs/pinephone_defconfig
+++ b/configs/pinephone_defconfig
@@ -16,3 +16,5 @@ CONFIG_LED_STATUS_GPIO=y
 CONFIG_LED_STATUS0=y
 CONFIG_LED_STATUS_BIT=114
 CONFIG_LED_STATUS_STATE=2
+CONFIG_VIBRATOR=y
+CONFIG_VIBRATOR_GPIO=y
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] drivers: Introduce vibrator uclass
  2021-12-22 22:36 ` [PATCH 1/4] drivers: Introduce vibrator uclass Samuel Dionne-Riel
@ 2021-12-28  8:34   ` Simon Glass
  2022-01-28 22:39   ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Simon Glass @ 2021-12-28  8:34 UTC (permalink / raw)
  To: Samuel Dionne-Riel; +Cc: U-Boot Mailing List

On Wed, 22 Dec 2021 at 15:37, Samuel Dionne-Riel <samuel@dionne-riel.com> wrote:
>
> Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
> ---
>  arch/sandbox/dts/test.dts          | 10 +++
>  configs/sandbox_defconfig          |  2 +
>  drivers/Kconfig                    |  2 +
>  drivers/Makefile                   |  1 +
>  drivers/vibrator/Kconfig           | 21 +++++++
>  drivers/vibrator/Makefile          |  5 ++
>  drivers/vibrator/vibrator-uclass.c | 62 +++++++++++++++++++
>  include/dm/uclass-id.h             |  1 +
>  include/vibrator.h                 | 87 +++++++++++++++++++++++++++
>  test/dm/Makefile                   |  1 +
>  test/dm/vibrator.c                 | 97 ++++++++++++++++++++++++++++++
>  11 files changed, 289 insertions(+)
>  create mode 100644 drivers/vibrator/Kconfig
>  create mode 100644 drivers/vibrator/Makefile
>  create mode 100644 drivers/vibrator/vibrator-uclass.c
>  create mode 100644 include/vibrator.h
>  create mode 100644 test/dm/vibrator.c

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] vibrator: Add vibrator_gpio driver
  2021-12-22 22:36 ` [PATCH 2/4] vibrator: Add vibrator_gpio driver Samuel Dionne-Riel
@ 2021-12-28  8:34   ` Simon Glass
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2021-12-28  8:34 UTC (permalink / raw)
  To: Samuel Dionne-Riel; +Cc: U-Boot Mailing List

Hi Samuel,

On Wed, 22 Dec 2021 at 15:37, Samuel Dionne-Riel <samuel@dionne-riel.com> wrote:
>
> Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
> ---
>  drivers/vibrator/Kconfig         |  16 ++++
>  drivers/vibrator/Makefile        |   1 +
>  drivers/vibrator/vibrator_gpio.c | 122 +++++++++++++++++++++++++++++++
>  3 files changed, 139 insertions(+)
>  create mode 100644 drivers/vibrator/vibrator_gpio.c
>

Reviewed-by: Simon Glass <sjg@chromium.org>

This is fine...but I suggest in future code it might be a good idea to
use log_msg_ret() when returning errors. This helps people figure out
where they came from.

Regards,
Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] cmd: Add vibrator command
  2021-12-22 22:36 ` [PATCH 3/4] cmd: Add vibrator command Samuel Dionne-Riel
@ 2021-12-28  8:34   ` Simon Glass
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2021-12-28  8:34 UTC (permalink / raw)
  To: Samuel Dionne-Riel; +Cc: U-Boot Mailing List

Hi Samuel,

On Wed, 22 Dec 2021 at 15:37, Samuel Dionne-Riel <samuel@dionne-riel.com> wrote:
>
> Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
> ---
>  cmd/Kconfig    |  10 ++++
>  cmd/Makefile   |   1 +
>  cmd/vibrator.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 159 insertions(+)
>  create mode 100644 cmd/vibrator.c

This looks fine but needs doc/usage and a simple test (see acpi.c for example).

Some nits below.

>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index e538e69a11..51e79ad806 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -1391,6 +1391,16 @@ config CMD_PVBLOCK
>         help
>           Xen para-virtualized block device support
>
> +config CMD_VIBRATOR
> +       bool "vibrator"
> +       depends on VIBRATOR
> +       default y if VIBRATOR
> +       help
> +         Enable the 'vibrator' command which allows for control of vibrator
> +         motors available on the board. The vibrator motors can be listed with
> +         'vibrator list' and controlled with vibrator on/off/time. Any
> +         vibrator driver can be controlled with this command.
> +
>  config CMD_VIRTIO
>         bool "virtio"
>         depends on VIRTIO
> diff --git a/cmd/Makefile b/cmd/Makefile
> index 6c4db4ed2e..49bf184bd9 100644
> --- a/cmd/Makefile
> +++ b/cmd/Makefile
> @@ -164,6 +164,7 @@ obj-$(CONFIG_CMD_UBIFS) += ubifs.o
>  obj-$(CONFIG_CMD_UNIVERSE) += universe.o
>  obj-$(CONFIG_CMD_UNLZ4) += unlz4.o
>  obj-$(CONFIG_CMD_UNZIP) += unzip.o
> +obj-$(CONFIG_CMD_VIBRATOR) += vibrator.o
>  obj-$(CONFIG_CMD_VIRTIO) += virtio.o
>  obj-$(CONFIG_CMD_WDT) += wdt.o
>  obj-$(CONFIG_CMD_LZMADEC) += lzmadec.o
> diff --git a/cmd/vibrator.c b/cmd/vibrator.c
> new file mode 100644
> index 0000000000..b77cb4867a
> --- /dev/null
> +++ b/cmd/vibrator.c
> @@ -0,0 +1,148 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (c) 2021 Samuel Dionne-Riel <samuel@dionne-riel.com>
> + * Copyright (c) 2017 Google, Inc
> + * Largely derived from `cmd/led.c`
> + * Original written by Simon Glass <sjg@chromium.org>
> + */
> +
> +#include <common.h>
> +#include <command.h>
> +#include <dm.h>
> +#include <vibrator.h>
> +#include <dm/uclass-internal.h>
> +#include <linux/delay.h>
> +
> +static const char *const state_label[] = {
> +       [VIBRATOR_STATE_OFF]    = "off",
> +       [VIBRATOR_STATE_ON]     = "on",
> +       [VIBRATOR_STATE_TOGGLE] = "toggle",
> +};
> +
> +enum vibrator_state_t get_vibrator_cmd(char *var)
> +{
> +       int i;
> +
> +       for (i = 0; i < VIBRATOR_STATE_COUNT; i++) {
> +               if (!strncmp(var, state_label[i], strlen(var)))
> +                       return i;
> +       }
> +
> +       return -1;
> +}
> +
> +static int show_vibrator_state(struct udevice *dev)
> +{
> +       int ret;
> +
> +       ret = vibrator_get_state(dev);
> +       if (ret >= VIBRATOR_STATE_COUNT)
> +               ret = -EINVAL;
> +       if (ret >= 0)
> +               printf("%s\n", state_label[ret]);
> +
> +       return ret;
> +}
> +
> +static int list_vibrators(void)
> +{
> +       struct udevice *dev;
> +       int ret;
> +
> +       for (uclass_find_first_device(UCLASS_VIBRATOR, &dev);
> +            dev;
> +            uclass_find_next_device(&dev)) {

struct uclass *uc;
uclass_id_foreach_dev(UCLASS_VIBRATOR, dev, uc)

> +               struct vibrator_uc_plat *plat = dev_get_uclass_plat(dev);
> +
> +               if (!plat->label)
> +                       continue;
> +               printf("%-15s ", plat->label);
> +               if (device_active(dev)) {
> +                       ret = show_vibrator_state(dev);
> +                       if (ret < 0)
> +                               printf("Error %d\n", ret);
> +               } else {
> +                       printf("<inactive>\n");
> +               }
> +       }
> +
> +       return 0;
> +}
> +
> +int timed_vibration(struct udevice *dev, int duration_ms)
> +{
> +       int ret;
> +
> +       ret = vibrator_set_state(dev, VIBRATOR_STATE_ON);
> +       if (ret < 0) {

If (ret)

? Same below

> +               printf("Vibrator operation failed (err=%d)\n", ret);
> +               return CMD_RET_FAILURE;
> +       }
> +
> +       udelay(duration_ms * 1000);
> +
> +       ret = vibrator_set_state(dev, VIBRATOR_STATE_OFF);
> +       if (ret < 0) {
> +               printf("Vibrator operation failed (err=%d)\n", ret);
> +               return CMD_RET_FAILURE;
> +       }
> +
> +       return CMD_RET_SUCCESS;
> +}
> +
> +int do_vibrator(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
> +{
> +       enum vibrator_state_t cmd;
> +       const char *vibrator_label;
> +       struct udevice *dev;
> +       int ret;
> +       int duration_ms = 0;
> +
> +       /* Validate arguments */
> +       if (argc < 2)
> +               return CMD_RET_USAGE;
> +       vibrator_label = argv[1];
> +       if (strncmp(vibrator_label, "list", 4) == 0)

!strncmp

Same below

> +               return list_vibrators();
> +
> +       cmd = argc > 2 ? get_vibrator_cmd(argv[2]) : VIBRATOR_STATE_COUNT;
> +       ret = vibrator_get_by_label(vibrator_label, &dev);
> +       if (ret) {
> +               printf("Vibrator '%s' not found (err=%d)\n", vibrator_label, ret);
> +               return CMD_RET_FAILURE;
> +       }
> +
> +       if (strncmp(argv[2], "timed", 5) == 0) {
> +               if (argc < 4)
> +                       return CMD_RET_USAGE;
> +               duration_ms = dectoul(argv[3], NULL);
> +
> +               return timed_vibration(dev, duration_ms);
> +       }
> +
> +       switch (cmd) {
> +       case VIBRATOR_STATE_OFF:
> +       case VIBRATOR_STATE_ON:
> +       case VIBRATOR_STATE_TOGGLE:
> +               ret = vibrator_set_state(dev, cmd);
> +               break;
> +       case VIBRATOR_STATE_COUNT:
> +               printf("Vibrator '%s': ", vibrator_label);
> +               ret = show_vibrator_state(dev);
> +               break;
> +       }
> +       if (ret < 0) {
> +               printf("Vibrator '%s' operation failed (err=%d)\n", vibrator_label, ret);
> +               return CMD_RET_FAILURE;
> +       }
> +
> +       return 0;
> +}
> +
> +U_BOOT_CMD(vibrator, 4, 1, do_vibrator,
> +          "manage vibration motors",
> +          "<vibrator_label> on|off\tChange vibration motor state\n"
> +          "vibrator <vibrator_label> timed <ms duration>\t\tVibrate for the given duration (will block)\n"
> +          "vibrator <vibrator_label>\tGet vibration motor state\n"
> +          "vibrator list\t\tShow a list of vibration motors"
> +);
> --
> 2.34.0
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] drivers: Introduce vibrator uclass
  2021-12-22 22:36 ` [PATCH 1/4] drivers: Introduce vibrator uclass Samuel Dionne-Riel
  2021-12-28  8:34   ` Simon Glass
@ 2022-01-28 22:39   ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2022-01-28 22:39 UTC (permalink / raw)
  To: Samuel Dionne-Riel, Simon Glass; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]

On Wed, Dec 22, 2021 at 05:36:04PM -0500, Samuel Dionne-Riel wrote:

> Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>  arch/sandbox/dts/test.dts          | 10 +++
>  configs/sandbox_defconfig          |  2 +
>  drivers/Kconfig                    |  2 +
>  drivers/Makefile                   |  1 +
>  drivers/vibrator/Kconfig           | 21 +++++++
>  drivers/vibrator/Makefile          |  5 ++
>  drivers/vibrator/vibrator-uclass.c | 62 +++++++++++++++++++
>  include/dm/uclass-id.h             |  1 +
>  include/vibrator.h                 | 87 +++++++++++++++++++++++++++
>  test/dm/Makefile                   |  1 +
>  test/dm/vibrator.c                 | 97 ++++++++++++++++++++++++++++++
>  11 files changed, 289 insertions(+)
>  create mode 100644 drivers/vibrator/Kconfig
>  create mode 100644 drivers/vibrator/Makefile
>  create mode 100644 drivers/vibrator/vibrator-uclass.c
>  create mode 100644 include/vibrator.h
>  create mode 100644 test/dm/vibrator.c

I don't know how, but this is breaking the SDL-based test on sandbox for
me.  It runs fine before, and then with this applied I get the "SDL
renderer does not exist" error message.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-01-28 22:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22 22:36 [PATCH 0/4] Add vibration motor support to U-Boot Samuel Dionne-Riel
2021-12-22 22:36 ` [PATCH 1/4] drivers: Introduce vibrator uclass Samuel Dionne-Riel
2021-12-28  8:34   ` Simon Glass
2022-01-28 22:39   ` Tom Rini
2021-12-22 22:36 ` [PATCH 2/4] vibrator: Add vibrator_gpio driver Samuel Dionne-Riel
2021-12-28  8:34   ` Simon Glass
2021-12-22 22:36 ` [PATCH 3/4] cmd: Add vibrator command Samuel Dionne-Riel
2021-12-28  8:34   ` Simon Glass
2021-12-22 22:36 ` [PATCH 4/4] pinephone_defconfig: Add gpio vibrator support Samuel Dionne-Riel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.