pmic-voter: improve pmic-voter api implementation

Currently the pmic-voter api assumes that the clients are represented
as unique integers. Using strings instead of integers adds flexibility.
- It enables the votable to be shared across multiple drivers without
  having a common client enum
- Debug prints become more useful

While at it
- remove the use of num_clients in the apis. All of them default to
  NUM_CLIENTS.
- Create a list of all the votables, this allows for searching for a
  specific votable.
- Error if a votable is already created with the same name earlier.
- Add debug prints about current clients and effective results
- Remove passing in last_client and last_client_id in the callback. These
  parameters go unused in all the usecases.
- Since clients are assigned sequentially and that they cannot
  unregister from a votable (clients can only disable their votes, but
  they cannot remove themselves), a null string in the client string
  array means there are no more clients. Use this to speed up result
  calculation by stopping at the id with a null string.
- Refactor the vote() implementation. Currently the SET_ANY case flows
  differently than MIN or MAX, make them uniform.
- Create an api to call the callback without casting new votes.

CRs-Fixed: 1018090
Change-Id: I8e2bc3366ec12e8485e4be86ee56ba5e4d113c3c
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
4 files changed