On Fri, Jan 19, 2024 at 07:28:56PM +0800, Zhu Ning wrote: > +static const char *const hpvol[] = { > + "0 dB", > + "-6 dB", > + "-24 dB", > + "+3.5 dB", > + "-3.5 dB", > + "-18 dB", > +}; > +static const unsigned int hp_vol_values[] = { 0, 1, 2, 4, 5, 6 }; Volumes should be standard volume controls with TLV information rather than enumerations. I see that you can't just use a standard volume control here since there's an invalid value that needs to be skipped over, and it doesn't help that there's no ordering to the values either. I think the best thing would probably be to open code a custom volume control - this feels weird enough that it's probably not worrying about trying for reuse. Just have put and get functions that map 0..6 into the register values for the volumes in ascending order, then you can have a control that looks normal to userspace.
Attachment:
signature.asc
Description: PGP signature