pinctrl-cs47l90.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Pinctrl for Cirrus Logic CS47L90
  4. *
  5. * Copyright (C) 2016-2017 Cirrus Logic
  6. */
  7. #include <linux/err.h>
  8. #include <linux/mfd/madera/core.h>
  9. #include "pinctrl-madera.h"
  10. /*
  11. * The alt func groups are the most commonly used functions we place these at
  12. * the lower function indexes for convenience, and the less commonly used gpio
  13. * functions at higher indexes.
  14. *
  15. * To stay consistent with the datasheet the function names are the same as
  16. * the group names for that function's pins
  17. *
  18. * Note - all 1 less than in datasheet because these are zero-indexed
  19. */
  20. static const unsigned int cs47l90_mif1_pins[] = { 8, 9 };
  21. static const unsigned int cs47l90_mif2_pins[] = { 10, 11 };
  22. static const unsigned int cs47l90_mif3_pins[] = { 12, 13 };
  23. static const unsigned int cs47l90_aif1_pins[] = { 14, 15, 16, 17 };
  24. static const unsigned int cs47l90_aif2_pins[] = { 18, 19, 20, 21 };
  25. static const unsigned int cs47l90_aif3_pins[] = { 22, 23, 24, 25 };
  26. static const unsigned int cs47l90_aif4_pins[] = { 26, 27, 28, 29 };
  27. static const unsigned int cs47l90_dmic4_pins[] = { 30, 31 };
  28. static const unsigned int cs47l90_dmic5_pins[] = { 32, 33 };
  29. static const unsigned int cs47l90_dmic3_pins[] = { 34, 35 };
  30. static const unsigned int cs47l90_spk1_pins[] = { 36, 37 };
  31. static const struct madera_pin_groups cs47l90_pin_groups[] = {
  32. { "aif1", cs47l90_aif1_pins, ARRAY_SIZE(cs47l90_aif1_pins) },
  33. { "aif2", cs47l90_aif2_pins, ARRAY_SIZE(cs47l90_aif2_pins) },
  34. { "aif3", cs47l90_aif3_pins, ARRAY_SIZE(cs47l90_aif3_pins) },
  35. { "aif4", cs47l90_aif4_pins, ARRAY_SIZE(cs47l90_aif4_pins) },
  36. { "mif1", cs47l90_mif1_pins, ARRAY_SIZE(cs47l90_mif1_pins) },
  37. { "mif2", cs47l90_mif2_pins, ARRAY_SIZE(cs47l90_mif2_pins) },
  38. { "mif3", cs47l90_mif3_pins, ARRAY_SIZE(cs47l90_mif3_pins) },
  39. { "dmic3", cs47l90_dmic3_pins, ARRAY_SIZE(cs47l90_dmic3_pins) },
  40. { "dmic4", cs47l90_dmic4_pins, ARRAY_SIZE(cs47l90_dmic4_pins) },
  41. { "dmic5", cs47l90_dmic5_pins, ARRAY_SIZE(cs47l90_dmic5_pins) },
  42. { "pdmspk1", cs47l90_spk1_pins, ARRAY_SIZE(cs47l90_spk1_pins) },
  43. };
  44. const struct madera_pin_chip cs47l90_pin_chip = {
  45. .n_pins = CS47L90_NUM_GPIOS,
  46. .pin_groups = cs47l90_pin_groups,
  47. .n_pin_groups = ARRAY_SIZE(cs47l90_pin_groups),
  48. };