Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. diff --git a/arch/arm/boot/dts/omap2420-n810.dts b/arch/arm/boot/dts/omap2420-n810.dts
  2. index 7c485fbfa535..4f44c6271cc0 100644
  3. --- a/arch/arm/boot/dts/omap2420-n810.dts
  4. +++ b/arch/arm/boot/dts/omap2420-n810.dts
  5. @@ -6,11 +6,57 @@
  6. / {
  7. model = "Nokia N810";
  8. compatible = "nokia,n810", "nokia,n8x0", "ti,omap2420", "ti,omap2";
  9. +
  10. + sound: n810-audio {
  11. + compatible = "nokia,n810-audio";
  12. +
  13. + nokia,cpu-dai = <&mcbsp2>;
  14. + nokia,audio-codec = <&aic3x>;
  15. +
  16. + headset-amplifier-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; /* gpio10 */
  17. + speaker-amplifier-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; /* gpio101 */
  18. + };
  19. +};
  20. +
  21. +&omap2420_pmx {
  22. + mcbsp2_pins: mcbsp2_pins {
  23. + pinctrl-single,pins = <
  24. + OMAP2420_CORE_IOPAD(0x0124, PIN_INPUT | MUX_MODE1) /* eac_ac_sclk.mcbsp2_clkx */
  25. + OMAP2420_CORE_IOPAD(0x0125, PIN_INPUT | MUX_MODE1) /* eac_ac_fs.mcbsp2_fsx */
  26. + OMAP2420_CORE_IOPAD(0x0126, PIN_INPUT | MUX_MODE1) /* eac_ac_din.mcbsp2_dr */
  27. + OMAP2420_CORE_IOPAD(0x0127, PIN_OUTPUT | MUX_MODE1) /* eac_ac_dout.mcbsp2_dx */
  28. + >;
  29. + };
  30. +
  31. + aic3x_pins: aic3x_pins {
  32. + pinctrl-single,pins = <
  33. + OMAP2420_CORE_IOPAD(0x0129, PIN_OUTPUT | MUX_MODE3) /* eac_ac_rst.gpio118 */
  34. + >;
  35. + };
  36. };
  37.  
  38. &i2c2 {
  39. - aic3x@18 {
  40. - compatible = "tlv320aic3x";
  41. + aic3x: aic3x@18 {
  42. + compatible = "ti,tlv320aic3x";
  43. reg = <0x18>;
  44. +
  45. + pinctrl-names = "default";
  46. + pinctrl-0 = <&aic3x_pins>;
  47. +
  48. + gpio-reset = <&gpio4 22 GPIO_ACTIVE_LOW>; /* gpio118 */
  49. + clocks = <&sys_clkout2>;
  50. + clock-names = "mclk";
  51. +
  52. + assigned-clocks = <&sys_clkout2_src>, <&sys_clkout2>;
  53. + assigned-clock-parents = <&func_96m_ck>;
  54. + assigned-clock-rates = <0>, <12000000>;
  55. +
  56. };
  57. };
  58. +
  59. +&mcbsp2 {
  60. + pinctrl-names = "default";
  61. + pinctrl-0 = <&mcbsp2_pins>;
  62. +
  63. + status = "okay";
  64. +};
  65. diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
  66. index 538da20bb480..1efbad8d4fe3 100644
  67. --- a/sound/soc/codecs/tlv320aic3x.c
  68. +++ b/sound/soc/codecs/tlv320aic3x.c
  69. @@ -40,6 +40,7 @@
  70. #include <linux/i2c.h>
  71. #include <linux/gpio.h>
  72. #include <linux/regulator/consumer.h>
  73. +#include <linux/clk.h>
  74. #include <linux/of.h>
  75. #include <linux/of_gpio.h>
  76. #include <linux/slab.h>
  77. @@ -75,6 +76,7 @@ struct aic3x_priv {
  78. struct snd_soc_component *component;
  79. struct regmap *regmap;
  80. struct regulator_bulk_data supplies[AIC3X_NUM_SUPPLIES];
  81. + struct clk *mclk;
  82. struct aic3x_disable_nb disable_nb[AIC3X_NUM_SUPPLIES];
  83. struct aic3x_setup_data *setup;
  84. unsigned int sysclk;
  85. @@ -1379,10 +1381,17 @@ static int aic3x_set_power(struct snd_soc_component *component, int power)
  86. int ret;
  87.  
  88. if (power) {
  89. + ret = clk_prepare_enable(aic3x->mclk);
  90. + if (ret)
  91. + goto out;
  92. +
  93. ret = regulator_bulk_enable(ARRAY_SIZE(aic3x->supplies),
  94. aic3x->supplies);
  95. - if (ret)
  96. + if (ret) {
  97. + clk_disable_unprepare(aic3x->mclk);
  98. goto out;
  99. + }
  100. +
  101. aic3x->power = 1;
  102.  
  103. if (gpio_is_valid(aic3x->gpio_reset)) {
  104. @@ -1864,6 +1873,17 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
  105. gpio_direction_output(aic3x->gpio_reset, 0);
  106. }
  107.  
  108. + aic3x->mclk = devm_clk_get(&i2c->dev, "mclk");
  109. + if (IS_ERR(aic3x->mclk)) {
  110. + /*The mclk clock is optional */
  111. + if (PTR_ERR(aic3x->mclk) != -ENOENT) {
  112. + ret = PTR_ERR(aic3x->mclk);
  113. + goto err_gpio;
  114. + }
  115. +
  116. + aic3x->mclk = NULL;
  117. + }
  118. +
  119. for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++)
  120. aic3x->supplies[i].supply = aic3x_supply_names[i];
  121.  
  122. diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
  123. index da81f730697c..03f4f4f8a17e 100644
  124. --- a/sound/soc/omap/Kconfig
  125. +++ b/sound/soc/omap/Kconfig
  126. @@ -47,7 +47,6 @@ config SND_OMAP_SOC_HDMI_AUDIO
  127. config SND_OMAP_SOC_N810
  128. tristate "SoC Audio support for Nokia N810"
  129. depends on SND_SDMA_SOC && MACH_NOKIA_N810 && I2C
  130. - depends on OMAP_MUX
  131. select SND_OMAP_SOC_MCBSP
  132. select SND_SOC_TLV320AIC3X
  133. help
  134. diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
  135. index 71e5f31fa306..fb8b3db988b8 100644
  136. --- a/sound/soc/omap/n810.c
  137. +++ b/sound/soc/omap/n810.c
  138. @@ -38,6 +38,11 @@
  139. #define N810_HEADSET_AMP_GPIO 10
  140. #define N810_SPEAKER_AMP_GPIO 101
  141.  
  142. +struct n810_audio_data {
  143. + struct gpio_desc *headset_amp_gpio;
  144. + struct gpio_desc *speaker_amp_gpio;
  145. +};
  146. +
  147. enum {
  148. N810_JACK_DISABLED,
  149. N810_JACK_HP,
  150. @@ -257,9 +262,9 @@ static const struct snd_kcontrol_new aic33_n810_controls[] = {
  151. static struct snd_soc_dai_link n810_dai = {
  152. .name = "TLV320AIC33",
  153. .stream_name = "AIC33",
  154. - .cpu_dai_name = "omap-mcbsp.2",
  155. - .platform_name = "omap-mcbsp.2",
  156. - .codec_name = "tlv320aic3x-codec.2-0018",
  157. + .cpu_dai_name = "48076000.mcbsp",
  158. + .platform_name = "48076000.mcbsp",
  159. + .codec_name = "tlv320aic3x-codec.1-0018",
  160. .codec_dai_name = "tlv320aic3x-hifi",
  161. .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
  162. SND_SOC_DAIFMT_CBM_CFM,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement