linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/6] Separate notions of max concurrent playbacks and
@ 2024-09-17 22:14 James Ogletree
  2024-09-17 22:14 ` [RFC PATCH 1/6] Input: Add variable to track maximum concurrent playbacks James Ogletree
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: James Ogletree @ 2024-09-17 22:14 UTC (permalink / raw)
  To: jikos, bentiss, dmitry.torokhov
  Cc: linux-input, linux-kernel, linux-usb, patches, James Ogletree

Currently the notion of maximum number of effects a device can
keep in its memory is tied to the number of effects a device
can play at the same time. The same value that EVIOCGEFFECTS
ioctl reports also acts as a ceiling on the number of effects
that can be uploaded.

In order to support devices with the ability to store a
different number of effects than can be simultaneously played,
it appears necessary to separate these notions.

James Ogletree (6):
  Input: Add variable to track maximum concurrent playbacks
  HID: logitech-hidpp: Assign max concurrent playbacks
  HID: pidff: Assign max concurrent playbacks
  Input: cs40l50 - Assign max concurrent playbacks
  Input: da7280 - Assign max concurrent playbacks
  Input: uinput - Assign max concurrent playbacks

 drivers/hid/hid-logitech-hidpp.c   | 1 +
 drivers/hid/usbhid/hid-pidff.c     | 1 +
 drivers/input/evdev.c              | 2 +-
 drivers/input/misc/cs40l50-vibra.c | 3 ++-
 drivers/input/misc/da7280.c        | 1 +
 drivers/input/misc/uinput.c        | 1 +
 include/linux/input.h              | 2 ++
 7 files changed, 9 insertions(+), 2 deletions(-)

-- 
2.43.0


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

* [RFC PATCH 1/6] Input: Add variable to track maximum concurrent playbacks
  2024-09-17 22:14 [RFC PATCH 0/6] Separate notions of max concurrent playbacks and James Ogletree
@ 2024-09-17 22:14 ` James Ogletree
  2024-09-17 22:14 ` [RFC PATCH 2/6] HID: logitech-hidpp: Assign max " James Ogletree
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: James Ogletree @ 2024-09-17 22:14 UTC (permalink / raw)
  To: jikos, bentiss, dmitry.torokhov
  Cc: linux-input, linux-kernel, linux-usb, patches, James Ogletree

Add max_concurrent_playbacks to ff_device which contains
the maximum number of concurrent playbacks allowed by the
device.

Signed-off-by: James Ogletree <jogletre@opensource.cirrus.com>
---
 drivers/input/evdev.c | 2 +-
 include/linux/input.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index a8ce3d140722..42b55e03696b 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -1069,7 +1069,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
 
 	case EVIOCGEFFECTS:
 		i = test_bit(EV_FF, dev->evbit) ?
-				dev->ff->max_effects : 0;
+				dev->ff->max_concurrent_playbacks : 0;
 		if (put_user(i, ip))
 			return -EFAULT;
 		return 0;
diff --git a/include/linux/input.h b/include/linux/input.h
index 89a0be6ee0e2..6d6e450e2231 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -531,6 +531,7 @@ extern const struct class input_class;
  *	device (not emulated like ones in input_dev->ffbit)
  * @mutex: mutex for serializing access to the device
  * @max_effects: maximum number of effects supported by device
+ * @max_concurrent_playbacks: maximum number of concurrent playbacks
  * @effects: pointer to an array of effects currently loaded into device
  * @effect_owners: array of effect owners; when file handle owning
  *	an effect gets closed the effect is automatically erased
@@ -562,6 +563,7 @@ struct ff_device {
 	struct mutex mutex;
 
 	int max_effects;
+	int max_concurrent_playbacks;
 	struct ff_effect *effects;
 	struct file *effect_owners[] __counted_by(max_effects);
 };
-- 
2.43.0


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

* [RFC PATCH 2/6] HID: logitech-hidpp: Assign max concurrent playbacks
  2024-09-17 22:14 [RFC PATCH 0/6] Separate notions of max concurrent playbacks and James Ogletree
  2024-09-17 22:14 ` [RFC PATCH 1/6] Input: Add variable to track maximum concurrent playbacks James Ogletree
@ 2024-09-17 22:14 ` James Ogletree
  2024-09-17 22:14 ` [RFC PATCH 3/6] HID: pidff: " James Ogletree
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: James Ogletree @ 2024-09-17 22:14 UTC (permalink / raw)
  To: jikos, bentiss, dmitry.torokhov
  Cc: linux-input, linux-kernel, linux-usb, patches, James Ogletree

Explicitly assign the maximum number of simultaneously playable
effects.

Signed-off-by: James Ogletree <jogletre@opensource.cirrus.com>
---
 drivers/hid/hid-logitech-hidpp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 400d70e6dbe2..843697b176ef 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -2895,6 +2895,7 @@ static int hidpp_ff_init(struct hidpp_device *hidpp,
 	ff->set_gain = hidpp_ff_set_gain;
 	ff->set_autocenter = hidpp_ff_set_autocenter;
 	ff->destroy = hidpp_ff_destroy;
+	ff->max_concurrent_playbacks = num_slots;
 
 	/* Create sysfs interface */
 	error = device_create_file(&(hidpp->hid_dev->dev), &dev_attr_range);
-- 
2.43.0


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

* [RFC PATCH 3/6] HID: pidff: Assign max concurrent playbacks
  2024-09-17 22:14 [RFC PATCH 0/6] Separate notions of max concurrent playbacks and James Ogletree
  2024-09-17 22:14 ` [RFC PATCH 1/6] Input: Add variable to track maximum concurrent playbacks James Ogletree
  2024-09-17 22:14 ` [RFC PATCH 2/6] HID: logitech-hidpp: Assign max " James Ogletree
@ 2024-09-17 22:14 ` James Ogletree
  2024-09-17 22:14 ` [RFC PATCH 4/6] Input: cs40l50 - " James Ogletree
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: James Ogletree @ 2024-09-17 22:14 UTC (permalink / raw)
  To: jikos, bentiss, dmitry.torokhov
  Cc: linux-input, linux-kernel, linux-usb, patches, James Ogletree

Explicitly assign the maximum number of simultaneously playable
effects.

Signed-off-by: James Ogletree <jogletre@opensource.cirrus.com>
---
 drivers/hid/usbhid/hid-pidff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
index 3b4ee21cd811..dd260fcdad60 100644
--- a/drivers/hid/usbhid/hid-pidff.c
+++ b/drivers/hid/usbhid/hid-pidff.c
@@ -1309,6 +1309,7 @@ int hid_pidff_init(struct hid_device *hid)
 	ff->set_gain = pidff_set_gain;
 	ff->set_autocenter = pidff_set_autocenter;
 	ff->playback = pidff_playback;
+	ff->max_concurrent_playbacks = max_effects;
 
 	hid_info(dev, "Force feedback for USB HID PID devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
 
-- 
2.43.0


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

* [RFC PATCH 4/6] Input: cs40l50 - Assign max concurrent playbacks
  2024-09-17 22:14 [RFC PATCH 0/6] Separate notions of max concurrent playbacks and James Ogletree
                   ` (2 preceding siblings ...)
  2024-09-17 22:14 ` [RFC PATCH 3/6] HID: pidff: " James Ogletree
@ 2024-09-17 22:14 ` James Ogletree
  2024-09-17 22:14 ` [RFC PATCH 5/6] Input: da7280 " James Ogletree
  2024-09-17 22:14 ` [RFC PATCH 6/6] Input: uinput " James Ogletree
  5 siblings, 0 replies; 8+ messages in thread
From: James Ogletree @ 2024-09-17 22:14 UTC (permalink / raw)
  To: jikos, bentiss, dmitry.torokhov
  Cc: linux-input, linux-kernel, linux-usb, patches, James Ogletree

Explicitly assign the maximum number of simultaneously playable
effects.

Signed-off-by: James Ogletree <jogletre@opensource.cirrus.com>
---
 drivers/input/misc/cs40l50-vibra.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/input/misc/cs40l50-vibra.c b/drivers/input/misc/cs40l50-vibra.c
index 03bdb7c26ec0..733f2989183b 100644
--- a/drivers/input/misc/cs40l50-vibra.c
+++ b/drivers/input/misc/cs40l50-vibra.c
@@ -508,7 +508,7 @@ static int cs40l50_vibra_probe(struct platform_device *pdev)
 	input_set_capability(vib->input, EV_FF, FF_PERIODIC);
 	input_set_capability(vib->input, EV_FF, FF_CUSTOM);
 
-	error = input_ff_create(vib->input, CS40L50_EFFECTS_MAX);
+	error = input_ff_create(vib->input, FF_MAX_EFFECTS);
 	if (error) {
 		dev_err(vib->dev, "Failed to create input device\n");
 		return error;
@@ -517,6 +517,7 @@ static int cs40l50_vibra_probe(struct platform_device *pdev)
 	vib->input->ff->upload = cs40l50_add;
 	vib->input->ff->playback = cs40l50_playback;
 	vib->input->ff->erase = cs40l50_erase;
+	vib->input->ff->max_concurrent_playbacks = CS40L50_EFFECTS_MAX;
 
 	INIT_LIST_HEAD(&vib->effect_head);
 
-- 
2.43.0


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

* [RFC PATCH 5/6] Input: da7280 - Assign max concurrent playbacks
  2024-09-17 22:14 [RFC PATCH 0/6] Separate notions of max concurrent playbacks and James Ogletree
                   ` (3 preceding siblings ...)
  2024-09-17 22:14 ` [RFC PATCH 4/6] Input: cs40l50 - " James Ogletree
@ 2024-09-17 22:14 ` James Ogletree
  2024-09-17 22:14 ` [RFC PATCH 6/6] Input: uinput " James Ogletree
  5 siblings, 0 replies; 8+ messages in thread
From: James Ogletree @ 2024-09-17 22:14 UTC (permalink / raw)
  To: jikos, bentiss, dmitry.torokhov
  Cc: linux-input, linux-kernel, linux-usb, patches, James Ogletree

Explicitly assign the maximum number of simultaneously playable
effects.

Signed-off-by: James Ogletree <jogletre@opensource.cirrus.com>
---
 drivers/input/misc/da7280.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/misc/da7280.c b/drivers/input/misc/da7280.c
index 1629b7ea4cbd..3d892ba343d0 100644
--- a/drivers/input/misc/da7280.c
+++ b/drivers/input/misc/da7280.c
@@ -1239,6 +1239,7 @@ static int da7280_probe(struct i2c_client *client)
 	ff = input_dev->ff;
 	ff->upload = da7280_haptics_upload_effect;
 	ff->playback = da7280_haptics_playback;
+	ff->max_concurrent_playbacks = DA7280_FF_EFFECT_COUNT_MAX;
 
 	error = input_register_device(input_dev);
 	if (error) {
-- 
2.43.0


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

* [RFC PATCH 6/6] Input: uinput - Assign max concurrent playbacks
  2024-09-17 22:14 [RFC PATCH 0/6] Separate notions of max concurrent playbacks and James Ogletree
                   ` (4 preceding siblings ...)
  2024-09-17 22:14 ` [RFC PATCH 5/6] Input: da7280 " James Ogletree
@ 2024-09-17 22:14 ` James Ogletree
  5 siblings, 0 replies; 8+ messages in thread
From: James Ogletree @ 2024-09-17 22:14 UTC (permalink / raw)
  To: jikos, bentiss, dmitry.torokhov
  Cc: linux-input, linux-kernel, linux-usb, patches, James Ogletree

Explicitly assign the maximum number of simultaneously playable
effects.

Signed-off-by: James Ogletree <jogletre@opensource.cirrus.com>
---
 drivers/input/misc/uinput.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 445856c9127a..81372e942ba4 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -350,6 +350,7 @@ static int uinput_create_device(struct uinput_device *udev)
 		dev->ff->playback = uinput_dev_playback;
 		dev->ff->set_gain = uinput_dev_set_gain;
 		dev->ff->set_autocenter = uinput_dev_set_autocenter;
+		dev->ff->max_concurrent_playbacks = udev->ff_effects_max;
 		/*
 		 * The standard input_ff_flush() implementation does
 		 * not quite work for uinput as we can't reasonably
-- 
2.43.0


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

* [RFC PATCH 3/6] HID: pidff: Assign max concurrent playbacks
  2024-10-09 15:40 [RFC PATCH 0/6] Separate notions of max concurrent playbacks and James Ogletree
@ 2024-10-09 15:40 ` James Ogletree
  0 siblings, 0 replies; 8+ messages in thread
From: James Ogletree @ 2024-10-09 15:40 UTC (permalink / raw)
  To: jikos, bentiss, dmitry.torokhov
  Cc: linux-input, linux-kernel, linux-usb, patches, James Ogletree

Explicitly assign the maximum number of simultaneously playable
effects.

Signed-off-by: James Ogletree <jogletre@opensource.cirrus.com>
---
 drivers/hid/usbhid/hid-pidff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
index 3b4ee21cd811..dd260fcdad60 100644
--- a/drivers/hid/usbhid/hid-pidff.c
+++ b/drivers/hid/usbhid/hid-pidff.c
@@ -1309,6 +1309,7 @@ int hid_pidff_init(struct hid_device *hid)
 	ff->set_gain = pidff_set_gain;
 	ff->set_autocenter = pidff_set_autocenter;
 	ff->playback = pidff_playback;
+	ff->max_concurrent_playbacks = max_effects;
 
 	hid_info(dev, "Force feedback for USB HID PID devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
 
-- 
2.43.0


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

end of thread, other threads:[~2024-10-09 15:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-17 22:14 [RFC PATCH 0/6] Separate notions of max concurrent playbacks and James Ogletree
2024-09-17 22:14 ` [RFC PATCH 1/6] Input: Add variable to track maximum concurrent playbacks James Ogletree
2024-09-17 22:14 ` [RFC PATCH 2/6] HID: logitech-hidpp: Assign max " James Ogletree
2024-09-17 22:14 ` [RFC PATCH 3/6] HID: pidff: " James Ogletree
2024-09-17 22:14 ` [RFC PATCH 4/6] Input: cs40l50 - " James Ogletree
2024-09-17 22:14 ` [RFC PATCH 5/6] Input: da7280 " James Ogletree
2024-09-17 22:14 ` [RFC PATCH 6/6] Input: uinput " James Ogletree
  -- strict thread matches above, loose matches on Subject: below --
2024-10-09 15:40 [RFC PATCH 0/6] Separate notions of max concurrent playbacks and James Ogletree
2024-10-09 15:40 ` [RFC PATCH 3/6] HID: pidff: Assign max concurrent playbacks James Ogletree

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).