summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/audio_manager.c
AgeCommit message (Collapse)AuthorFilesLines
2016-05-19greybus: audio: gb_manager: Use valid argument while removing ida allocated id.Vaibhav Agarwal1-1/+1
module->id is used as an argument to ida_simple_remove(). Since module is already dereferenced, module->id might contain invalid data. So fix this. Fixes: da4cc2d0b066 ("audio:gb_manager: Use proper locking around kobject_xxx") Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org> Reviewed-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-05greybus: audio: Fix incorrect counting of 'ida'Dinko Mironov1-0/+1
Function gb_audio_manager_remove_all() to remove all audio modules, doesn't control correctly 'ida' counting. Signed-off-by: Dinko Mironov <dmironov@mm-sol.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-04greybus: audio:gb_manager: Use proper locking around kobject_xxxVaibhav Agarwal1-22/+15
read/write_lock_irqsave mechanism was used to protect modules list & kobject_xxx() in gb_audio_manager. Since kobject_xxx calls can sleep spin_lock variants can't be used there. So use rw_sem for protecting modules_list. Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-03greybus: audio_manager: add missing headerBartosz Golaszewski1-0/+1
There's a definition missing in audio_manager causing the kernel build to fail: CC [M] ./greybus/audio_manager.o ./greybus/audio_manager.c:22:8: warning: type defaults to 'int' in declaration of 'DEFINE_IDA' [-Wimplicit-int] error, forbidden warning: audio_manager.c:22 ./kernel/scripts/Makefile.build:308: recipe for target './greybus/audio_manager.o' failed Including linux/idr.h fixes the issue. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-03greybus: audio_manager: use an 'ida' for the module idGreg Kroah-Hartman1-4/+9
Every time we hotplug an audio module, we get a new audio module id. We should recycle them instead of just constantly incrementing the number so we don't see things like: [178016.832580] Created audio module #6124 in the kernel logs. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-14greybus: audio: Add Audio ManagerSvetlin Ankov1-0/+184
This is a simple module that keeps a list of connected GB audio modules. Whenever a device is attached, an appropriate uevent is sent to userspace: UDEV [4941.803215] add /kernel/gb_audio_manager/0 (gb_audio_manager) ACTION=add CPORT=99 DEVICES=0x10 DEVPATH=/kernel/gb_audio_manager/0 NAME=naim PID=64 SEQNUM=1828 SLOT=2 SUBSYSTEM=gb_audio_manager USEC_INITIALIZED=802416 VID=128 And whenever removed: UDEV [4941.836588] remove /kernel/gb_audio_manager/0 (gb_audio_manager) ACTION=remove DEVPATH=/kernel/gb_audio_manager/0 SEQNUM=1833 SUBSYSTEM=gb_audio_manager USEC_INITIALIZED=835681 The API consists of functions for adding, removing and inspecting added device module descriptions (struct gb_audio_module): int gb_audio_manager_add(struct gb_audio_module_descriptor *desc); int gb_audio_manager_remove(int id); int gb_audio_manager_remove_all(void); struct gb_audio_module* gb_audio_manager_get_module(int id); void gb_audio_manager_put_module(struct gb_audio_module *module); int gb_audio_manager_dump_module(int id); void gb_audio_manager_dump_all(void); Devices can be inspected through sysfs in /sys/kernel/gb_audio_manager/{id}/* If GB_AUDIO_MANAGER_SYSFS is exported as 'true', managing devices can be done via the SYSFS as well. For instance: echo name=naim slot=2 vid=128 pid=64 cport=99 devices=0x10 > /sys/kernel/gb_audio_manager/add echo all > /sys/kernel/gb_audio_manager/dump echo 2 > /sys/kernel/gb_audio_manager/dump echo 2 > /sys/kernel/gb_audio_manager/remove Signed-off-by: Svetlin Ankov <ankov_svetlin@projectara.com> Signed-off-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>