pinctrl-cs47l85.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Pinctrl for Cirrus Logic CS47L85
  4. *
  5. * Copyright (C) 2016-2017 Cirrus Logic
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; version 2.
  10. */
  11. #include <linux/err.h>
  12. #include <linux/mfd/madera/core.h>
  13. #include "pinctrl-madera.h"
  14. /*
  15. * The alt func groups are the most commonly used functions we place these at
  16. * the lower function indexes for convenience, and the less commonly used gpio
  17. * functions at higher indexes.
  18. *
  19. * To stay consistent with the datasheet the function names are the same as
  20. * the group names for that function's pins
  21. *
  22. * Note - all 1 less than in datasheet because these are zero-indexed
  23. */
  24. static const unsigned int cs47l85_mif1_pins[] = { 8, 9 };
  25. static const unsigned int cs47l85_mif2_pins[] = { 10, 11 };
  26. static const unsigned int cs47l85_mif3_pins[] = { 12, 13 };
  27. static const unsigned int cs47l85_aif1_pins[] = { 14, 15, 16, 17 };
  28. static const unsigned int cs47l85_aif2_pins[] = { 18, 19, 20, 21 };
  29. static const unsigned int cs47l85_aif3_pins[] = { 22, 23, 24, 25 };
  30. static const unsigned int cs47l85_aif4_pins[] = { 26, 27, 28, 29 };
  31. static const unsigned int cs47l85_dmic4_pins[] = { 30, 31 };
  32. static const unsigned int cs47l85_dmic5_pins[] = { 32, 33 };
  33. static const unsigned int cs47l85_dmic6_pins[] = { 34, 35 };
  34. static const unsigned int cs47l85_spk1_pins[] = { 36, 38 };
  35. static const unsigned int cs47l85_spk2_pins[] = { 37, 39 };
  36. static const struct madera_pin_groups cs47l85_pin_groups[] = {
  37. { "aif1", cs47l85_aif1_pins, ARRAY_SIZE(cs47l85_aif1_pins) },
  38. { "aif2", cs47l85_aif2_pins, ARRAY_SIZE(cs47l85_aif2_pins) },
  39. { "aif3", cs47l85_aif3_pins, ARRAY_SIZE(cs47l85_aif3_pins) },
  40. { "aif4", cs47l85_aif4_pins, ARRAY_SIZE(cs47l85_aif4_pins) },
  41. { "mif1", cs47l85_mif1_pins, ARRAY_SIZE(cs47l85_mif1_pins) },
  42. { "mif2", cs47l85_mif2_pins, ARRAY_SIZE(cs47l85_mif2_pins) },
  43. { "mif3", cs47l85_mif3_pins, ARRAY_SIZE(cs47l85_mif3_pins) },
  44. { "dmic4", cs47l85_dmic4_pins, ARRAY_SIZE(cs47l85_dmic4_pins) },
  45. { "dmic5", cs47l85_dmic5_pins, ARRAY_SIZE(cs47l85_dmic5_pins) },
  46. { "dmic6", cs47l85_dmic6_pins, ARRAY_SIZE(cs47l85_dmic6_pins) },
  47. { "pdmspk1", cs47l85_spk1_pins, ARRAY_SIZE(cs47l85_spk1_pins) },
  48. { "pdmspk2", cs47l85_spk2_pins, ARRAY_SIZE(cs47l85_spk2_pins) },
  49. };
  50. const struct madera_pin_chip cs47l85_pin_chip = {
  51. .n_pins = CS47L85_NUM_GPIOS,
  52. .pin_groups = cs47l85_pin_groups,
  53. .n_pin_groups = ARRAY_SIZE(cs47l85_pin_groups),
  54. };