greybus: audio_manager: Split device type into i/p & o/p devices
Currently, single field is used to report device type say SPK, MIC, HS, HP, etc. However above HAL expects separate fields for input & ouput device types. 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>
This commit is contained in:
Родитель
dc5cc72cc6
Коммит
a9234bfd6c
|
@ -22,7 +22,8 @@ struct gb_audio_manager_module_descriptor {
|
|||
int vid;
|
||||
int pid;
|
||||
int cport;
|
||||
unsigned int devices;
|
||||
unsigned int ip_devices;
|
||||
unsigned int op_devices;
|
||||
};
|
||||
|
||||
struct gb_audio_manager_module {
|
||||
|
|
|
@ -122,16 +122,27 @@ static struct gb_audio_manager_module_attribute
|
|||
gb_audio_module_cport_attribute =
|
||||
__ATTR(cport, 0664, gb_audio_module_cport_show, NULL);
|
||||
|
||||
static ssize_t gb_audio_module_devices_show(
|
||||
static ssize_t gb_audio_module_ip_devices_show(
|
||||
struct gb_audio_manager_module *module,
|
||||
struct gb_audio_manager_module_attribute *attr, char *buf)
|
||||
{
|
||||
return sprintf(buf, "0x%X", module->desc.devices);
|
||||
return sprintf(buf, "0x%X", module->desc.ip_devices);
|
||||
}
|
||||
|
||||
static struct gb_audio_manager_module_attribute
|
||||
gb_audio_module_devices_attribute =
|
||||
__ATTR(devices, 0664, gb_audio_module_devices_show, NULL);
|
||||
gb_audio_module_ip_devices_attribute =
|
||||
__ATTR(ip_devices, 0664, gb_audio_module_ip_devices_show, NULL);
|
||||
|
||||
static ssize_t gb_audio_module_op_devices_show(
|
||||
struct gb_audio_manager_module *module,
|
||||
struct gb_audio_manager_module_attribute *attr, char *buf)
|
||||
{
|
||||
return sprintf(buf, "0x%X", module->desc.op_devices);
|
||||
}
|
||||
|
||||
static struct gb_audio_manager_module_attribute
|
||||
gb_audio_module_op_devices_attribute =
|
||||
__ATTR(op_devices, 0664, gb_audio_module_op_devices_show, NULL);
|
||||
|
||||
static struct attribute *gb_audio_module_default_attrs[] = {
|
||||
&gb_audio_module_name_attribute.attr,
|
||||
|
@ -139,7 +150,8 @@ static struct attribute *gb_audio_module_default_attrs[] = {
|
|||
&gb_audio_module_vid_attribute.attr,
|
||||
&gb_audio_module_pid_attribute.attr,
|
||||
&gb_audio_module_cport_attribute.attr,
|
||||
&gb_audio_module_devices_attribute.attr,
|
||||
&gb_audio_module_ip_devices_attribute.attr,
|
||||
&gb_audio_module_op_devices_attribute.attr,
|
||||
NULL, /* need to NULL terminate the list of attributes */
|
||||
};
|
||||
|
||||
|
@ -156,7 +168,8 @@ static void send_add_uevent(struct gb_audio_manager_module *module)
|
|||
char vid_string[64];
|
||||
char pid_string[64];
|
||||
char cport_string[64];
|
||||
char devices_string[64];
|
||||
char ip_devices_string[64];
|
||||
char op_devices_string[64];
|
||||
|
||||
char *envp[] = {
|
||||
name_string,
|
||||
|
@ -164,7 +177,8 @@ static void send_add_uevent(struct gb_audio_manager_module *module)
|
|||
vid_string,
|
||||
pid_string,
|
||||
cport_string,
|
||||
devices_string,
|
||||
ip_devices_string,
|
||||
op_devices_string,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -173,7 +187,10 @@ static void send_add_uevent(struct gb_audio_manager_module *module)
|
|||
snprintf(vid_string, 64, "VID=%d", module->desc.vid);
|
||||
snprintf(pid_string, 64, "PID=%d", module->desc.pid);
|
||||
snprintf(cport_string, 64, "CPORT=%d", module->desc.cport);
|
||||
snprintf(devices_string, 64, "DEVICES=0x%X", module->desc.devices);
|
||||
snprintf(ip_devices_string, 64, "I/P DEVICES=0x%X",
|
||||
module->desc.ip_devices);
|
||||
snprintf(op_devices_string, 64, "O/P DEVICES=0x%X",
|
||||
module->desc.op_devices);
|
||||
|
||||
kobject_uevent_env(&module->kobj, KOBJ_ADD, envp);
|
||||
}
|
||||
|
@ -229,12 +246,13 @@ int gb_audio_manager_module_create(
|
|||
|
||||
void gb_audio_manager_module_dump(struct gb_audio_manager_module *module)
|
||||
{
|
||||
pr_info("audio module #%d name=%s slot=%d vid=%d pid=%d cport=%d devices=0x%X\n",
|
||||
pr_info("audio module #%d name=%s slot=%d vid=%d pid=%d cport=%d i/p devices=0x%X o/p devices=0x%X\n",
|
||||
module->id,
|
||||
module->desc.name,
|
||||
module->desc.slot,
|
||||
module->desc.vid,
|
||||
module->desc.pid,
|
||||
module->desc.cport,
|
||||
module->desc.devices);
|
||||
module->desc.ip_devices,
|
||||
module->desc.op_devices);
|
||||
}
|
||||
|
|
|
@ -20,11 +20,12 @@ static ssize_t manager_sysfs_add_store(
|
|||
|
||||
int num = sscanf(buf,
|
||||
"name=%" GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "s "
|
||||
"slot=%d vid=%d pid=%d cport=%d devices=0x%X",
|
||||
"slot=%d vid=%d pid=%d cport=%d i/p devices=0x%X"
|
||||
"o/p devices=0x%X",
|
||||
desc.name, &desc.slot, &desc.vid, &desc.pid,
|
||||
&desc.cport, &desc.devices);
|
||||
&desc.cport, &desc.ip_devices, &desc.op_devices);
|
||||
|
||||
if (num != 6)
|
||||
if (num != 7)
|
||||
return -EINVAL;
|
||||
|
||||
num = gb_audio_manager_add(&desc);
|
||||
|
|
|
@ -353,7 +353,8 @@ static int gb_audio_probe(struct gb_bundle *bundle,
|
|||
desc.vid = 2; /* todo */
|
||||
desc.pid = 3; /* todo */
|
||||
desc.cport = gbmodule->dev_id;
|
||||
desc.devices = 0x2; /* todo */
|
||||
desc.op_devices = 0x2; /* todo */
|
||||
desc.ip_devices = 0x0; /* todo */
|
||||
gbmodule->manager_id = gb_audio_manager_add(&desc);
|
||||
|
||||
dev_dbg(dev, "Add GB Audio device:%s\n", gbmodule->name);
|
||||
|
|
Загрузка…
Ссылка в новой задаче