diff options
author | himansh <himanshu.agrawal@stericsson.com> | 2011-12-28 19:50:41 +0530 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 11:07:06 +0200 |
commit | eb4ef6da1a08940f1044ea021e037b083c75e0d6 (patch) | |
tree | 4f0785f27e8496cfac420288633229a36892fdb6 | |
parent | cd01a620f6629ff56aa0067d62d32ab431592ca7 (diff) |
Ux500 CM: Exported cm_writeAttribute to user side
ST-Ericsson ID: 373536
ST-Ericsson FOSS-OUT ID: Trivial
ST-Ericsson Linux next: NA
Change-Id: Ifc873304b8f9ec73fc3c34cec32e53e8c84bd89e
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/43927
Reviewed-by: Pierre PEIFFER <pierre.peiffer@stericsson.com>
Reviewed-by: Ashish Kumar TANWER <ashish.tanwer@stericsson.com>
Tested-by: Ashish Kumar TANWER <ashish.tanwer@stericsson.com>
-rw-r--r-- | drivers/staging/nmf-cm/cm/engine/api/component_engine.h | 15 | ||||
-rw-r--r-- | drivers/staging/nmf-cm/cm/engine/component/src/component_wrapper.c | 33 | ||||
-rw-r--r-- | drivers/staging/nmf-cm/cm/engine/component/src/introspection.c | 2 | ||||
-rw-r--r-- | drivers/staging/nmf-cm/cm_syscall.c | 27 | ||||
-rw-r--r-- | drivers/staging/nmf-cm/cmioctl.h | 12 | ||||
-rw-r--r-- | drivers/staging/nmf-cm/cmld.c | 5 | ||||
-rw-r--r-- | drivers/staging/nmf-cm/cmld.h | 1 |
7 files changed, 94 insertions, 1 deletions
diff --git a/drivers/staging/nmf-cm/cm/engine/api/component_engine.h b/drivers/staging/nmf-cm/cm/engine/api/component_engine.h index cbd61769597..a1e9defda7e 100644 --- a/drivers/staging/nmf-cm/cm/engine/api/component_engine.h +++ b/drivers/staging/nmf-cm/cm/engine/api/component_engine.h @@ -223,6 +223,21 @@ PUBLIC IMPORT_SHARED t_cm_error CM_ENGINE_ReadComponentAttribute( t_uint24 *value); /*! + * \brief Write a value on an attribute exported by a component instance. + * + * \param[in] component + * \param[in] attrName Null terminated string (Max size=\ref MAX_ATTRIBUTE_NAME_LENGTH). + * \param[out] value + * + * \ingroup CM_ENGINE_API + */ +PUBLIC IMPORT_SHARED t_cm_error CM_ENGINE_WriteComponentAttribute( + const t_cm_instance_handle component, + const char* attrName, + t_uint24 value); + + +/*! * \brief Get the older component. * * \param[in] client diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/component_wrapper.c b/drivers/staging/nmf-cm/cm/engine/component/src/component_wrapper.c index 88e6b4749ec..9a5c683ed1f 100644 --- a/drivers/staging/nmf-cm/cm/engine/component/src/component_wrapper.c +++ b/drivers/staging/nmf-cm/cm/engine/component/src/component_wrapper.c @@ -906,6 +906,39 @@ out: return error; } +/* + * Get a reference on a given attribute of a given component + */ + +PUBLIC EXPORT_SHARED t_cm_error CM_ENGINE_WriteComponentAttribute( + const t_cm_instance_handle instance, + const char* attrName, + t_uint24 attrValue) +{ + t_cm_error error; + t_component_instance* component; + + OSAL_LOCK_API(); + + component = cm_lookupComponent(instance); + if (NULL == component) + error = CM_INVALID_COMPONENT_HANDLE; + else + { + if ((error = cm_EEM_ForceWakeup(component->Template->dspId)) != CM_OK) + goto out; + + //t_uint24 -> t_uint32 possible since we know it same size + error = cm_writeAttribute(component, attrName, attrValue); + + cm_EEM_AllowSleep(component->Template->dspId); + } + +out: + OSAL_UNLOCK_API(); + return error; +} + /*=============================================================================== * Introspection API *===============================================================================*/ diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/introspection.c b/drivers/staging/nmf-cm/cm/engine/component/src/introspection.c index 4aaf8dff889..7e2f7cd65d0 100644 --- a/drivers/staging/nmf-cm/cm/engine/component/src/introspection.c +++ b/drivers/staging/nmf-cm/cm/engine/component/src/introspection.c @@ -142,7 +142,7 @@ t_cm_error cm_writeAttribute( attribute->memory.offset * attribute->memory.memory->memEntSize; if(attribute->memory.memory->memEntSize != 2) - *((t_uint32 *)hostAddr) = value & ~MASK_BYTE3; + *((t_uint32 *)hostAddr) = value & ~MASK_BYTE3; else *((t_uint16 *)hostAddr) = value; diff --git a/drivers/staging/nmf-cm/cm_syscall.c b/drivers/staging/nmf-cm/cm_syscall.c index ca8d664abb4..304b86ffee7 100644 --- a/drivers/staging/nmf-cm/cm_syscall.c +++ b/drivers/staging/nmf-cm/cm_syscall.c @@ -1115,6 +1115,33 @@ out: return 0; } + +inline int cmld_WriteComponentAttribute(struct cm_process_priv *procPriv, + CM_WriteComponentAttribute_t __user *param) +{ + CM_WriteComponentAttribute_t data; + char attrName[MAX_ATTRIBUTE_NAME_LENGTH]; + + /* Copy user input data in kernel space */ + if (copy_from_user(&data.in, ¶m->in, sizeof(data.in))) + return -EFAULT; + + if ((data.out.error = copy_string_from_user(attrName, + data.in.attrName, + sizeof(attrName)))) + goto out; + + data.out.error = CM_ENGINE_WriteComponentAttribute(data.in.component, + attrName, + data.in.value); +out: + /* Copy results back to userspace */ + if (copy_to_user(¶m->out, &data.out, sizeof(data.out))) + return -EFAULT; + return 0; +} + + inline int cmld_GetExecutiveEngineHandle(struct cm_process_priv *procPriv, CM_GetExecutiveEngineHandle_t __user *param) { diff --git a/drivers/staging/nmf-cm/cmioctl.h b/drivers/staging/nmf-cm/cmioctl.h index 5f7d5b6a349..eafeb8acff1 100644 --- a/drivers/staging/nmf-cm/cmioctl.h +++ b/drivers/staging/nmf-cm/cmioctl.h @@ -459,6 +459,17 @@ typedef struct { typedef struct { struct { + t_cm_instance_handle component; + const char *attrName; + t_uint32 value; /** < In parameter */ + } in; + struct { + t_cm_error error; /** < Out parameter */ + } out; +} CM_WriteComponentAttribute_t; + +typedef struct{ + struct { t_cm_domain_id domainId; } in; struct { @@ -580,6 +591,7 @@ typedef struct{ #define CM_GETCOMPONENTPROPERTYNAME _IOWR('c', 32, CM_GetComponentPropertyName_t) #define CM_GETCOMPONENTPROPERTYVALUE _IOWR('c', 33, CM_GetComponentPropertyValue_t) #define CM_READCOMPONENTATTRIBUTE _IOWR('c', 34, CM_ReadComponentAttribute_t) +#define CM_WRITECOMPONENTATTRIBUTE _IOWR('c', 44, CM_WriteComponentAttribute_t) #define CM_GETEXECUTIVEENGINEHANDLE _IOWR('c', 35, CM_GetExecutiveEngineHandle_t) #define CM_SETMODE _IOWR('c', 36, CM_SetMode_t) #define CM_GETREQUIREDCOMPONENTFILES _IOWR('c', 37, CM_GetRequiredComponentFiles_t) diff --git a/drivers/staging/nmf-cm/cmld.c b/drivers/staging/nmf-cm/cmld.c index d3a2f28ce4b..ac16ef6f4ee 100644 --- a/drivers/staging/nmf-cm/cmld.c +++ b/drivers/staging/nmf-cm/cmld.c @@ -602,6 +602,11 @@ static long cmld_control_ioctl(struct file *file, unsigned int cmd, unsigned lon return 0; case CM_PRIV_DEBUGFS_WAIT_DUMP: return 0; + + case CM_WRITECOMPONENTATTRIBUTE: + return cmld_WriteComponentAttribute(procPriv, + (CM_WriteComponentAttribute_t *)arg); + default: pr_err("CM(%s): unsupported command %i\n", __func__, cmd); return -EINVAL; diff --git a/drivers/staging/nmf-cm/cmld.h b/drivers/staging/nmf-cm/cmld.h index 78876bb01e6..57dc3a4e8f7 100644 --- a/drivers/staging/nmf-cm/cmld.h +++ b/drivers/staging/nmf-cm/cmld.h @@ -175,6 +175,7 @@ int cmld_GetComponentPropertyNumber(struct cm_process_priv *, int cmld_GetComponentPropertyName(struct cm_process_priv *, CM_GetComponentPropertyName_t __user *); int cmld_GetComponentPropertyValue(struct cm_process_priv *, CM_GetComponentPropertyValue_t __user *); int cmld_ReadComponentAttribute(struct cm_process_priv *, CM_ReadComponentAttribute_t __user *); +int cmld_WriteComponentAttribute(struct cm_process_priv *, CM_WriteComponentAttribute_t __user *); int cmld_GetExecutiveEngineHandle(struct cm_process_priv *, CM_GetExecutiveEngineHandle_t __user *); int cmld_SetMode(CM_SetMode_t __user *); int cmld_GetRequiredComponentFiles(struct cm_process_priv *cmPriv, |