mixer: Add support for TLV RW access check api

Tinyalsa doesn't expose an api to check TLV RW access

Add mixer_ctl_is_access_tlv_rw().

This api will get used by tinymix and audio HALs for checking TLV RW
access before managing the byte related mixer controls.

Upstream:
https://github.com/tinyalsa/tinyalsa/pull/92/commits/9698d03a63b89fd5a2a2d775bcfc542812da54d9

Change-Id: I65e9ad8978c666c8a4d61cad6763efe4a8bc041f
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
diff --git a/mixer.c b/mixer.c
index 3792159..0326c6a 100644
--- a/mixer.c
+++ b/mixer.c
@@ -332,6 +332,11 @@
     return 0;
 }
 
+int mixer_ctl_is_access_tlv_rw(struct mixer_ctl *ctl)
+{
+    return (ctl->info->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE);
+}
+
 int mixer_ctl_get_array(struct mixer_ctl *ctl, void *array, size_t count)
 {
     struct snd_ctl_elem_value ev;
@@ -346,7 +351,7 @@
     total_count = ctl->info->count;
 
     if ((ctl->info->type == SNDRV_CTL_ELEM_TYPE_BYTES) &&
-        (ctl->info->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE)) {
+        mixer_ctl_is_access_tlv_rw(ctl)) {
             /* Additional two words is for the TLV header */
             total_count += TLV_HEADER_SIZE;
     }
@@ -369,7 +374,7 @@
 
     case SNDRV_CTL_ELEM_TYPE_BYTES:
         /* check if this is new bytes TLV */
-        if (ctl->info->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE) {
+        if (mixer_ctl_is_access_tlv_rw(ctl)) {
             struct snd_ctl_tlv *tlv;
             int ret;
 
@@ -462,7 +467,7 @@
     total_count = ctl->info->count;
 
     if ((ctl->info->type == SNDRV_CTL_ELEM_TYPE_BYTES) &&
-        (ctl->info->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE)) {
+        mixer_ctl_is_access_tlv_rw(ctl)) {
             /* Additional two words is for the TLV header */
             total_count += TLV_HEADER_SIZE;
     }
@@ -482,7 +487,7 @@
 
     case SNDRV_CTL_ELEM_TYPE_BYTES:
         /* check if this is new bytes TLV */
-        if (ctl->info->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE) {
+        if (mixer_ctl_is_access_tlv_rw(ctl)) {
             struct snd_ctl_tlv *tlv;
             int ret = 0;
             if (count > SIZE_MAX - sizeof(*tlv))