pinctrl-cs47l35.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Pinctrl for Cirrus Logic CS47L35
  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 cs47l35_aif3_pins[] = { 0, 1, 2, 3 };
  21. static const unsigned int cs47l35_spk_pins[] = { 4, 5 };
  22. static const unsigned int cs47l35_aif1_pins[] = { 7, 8, 9, 10 };
  23. static const unsigned int cs47l35_aif2_pins[] = { 11, 12, 13, 14 };
  24. static const unsigned int cs47l35_mif1_pins[] = { 6, 15 };
  25. static const struct madera_pin_groups cs47l35_pin_groups[] = {
  26. { "aif1", cs47l35_aif1_pins, ARRAY_SIZE(cs47l35_aif1_pins) },
  27. { "aif2", cs47l35_aif2_pins, ARRAY_SIZE(cs47l35_aif2_pins) },
  28. { "aif3", cs47l35_aif3_pins, ARRAY_SIZE(cs47l35_aif3_pins) },
  29. { "mif1", cs47l35_mif1_pins, ARRAY_SIZE(cs47l35_mif1_pins) },
  30. { "pdmspk1", cs47l35_spk_pins, ARRAY_SIZE(cs47l35_spk_pins) },
  31. };
  32. const struct madera_pin_chip cs47l35_pin_chip = {
  33. .n_pins = CS47L35_NUM_GPIOS,
  34. .pin_groups = cs47l35_pin_groups,
  35. .n_pin_groups = ARRAY_SIZE(cs47l35_pin_groups),
  36. };