• Takashi Sakamoto's avatar
    ALSA: control: move layout of TLV payload to UAPI header · 398fa4db
    Takashi Sakamoto authored
    In ALSA control interface, each element set can have threshold level
    information. This information is transferred between drivers/applications,
    in a shape of tlv packet. The layout of this packet is defined in
    'uapi/sound/asound.h' (struct snd_ctl_tlv):
    
    struct snd_ctl_tlv {
        unsigned int numid;
        unsigned int length;
        unsigned int tlv[0];
    };
    
    Data in the payload (struct snd_ctl_tlv.tlv) is expected to be filled
    according to our own protocol. This protocol is described in
    'include/sound/tlv.h'. A layout of the payload is expected as:
    
    struct snd_ctl_tlv.tlv[0]: one of SNDRV_CTL_TLVT_XXX
    struct snd_ctl_tlv.tlv[1]: Length of data
    struct snd_ctl_tlv.tlv[2...]: data
    
    Unfortunately, the macro is not exported to user land yet, thus
    applications cannot get to know the protocol.
    
    Additionally, ALSA control core has a feature called as 'user-defined'
    element set. This allows applications to add/remove arbitrary element sets
    with elements to control devices. Elements in the element set can be
    operated by the same way as the ones added by in-kernel implementation.
    
    For threshold level information of 'user-defined' element set, applications
    need to register the information to an element set. However, as described
    above, layout of the payload is closed in kernel land. This is quite
    inconvenient, too.
    
    This commit moves the protocol to UAPI header for TLV.
    Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    398fa4db
tlv.h 3.67 KB