<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/sound, branch tegra</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>apalis/colibri t30: fix record/playback for sgtl5000 codec</title>
<updated>2019-09-09T12:04:37+00:00</updated>
<author>
<name>Oleksandr Suvorov</name>
<email>oleksandr.suvorov@toradex.com</email>
</author>
<published>2019-09-09T12:04:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=babaf479582f7697fbfd4c001945fbfb766d914d'/>
<id>babaf479582f7697fbfd4c001945fbfb766d914d</id>
<content type='text'>
Backported commit f997df18c0e4c988de49e984329cefdf6e13ed86

According to the manual [1], SYS_MCLK should base on SYS_FS, not on sample rate.

Calculating SYS_MCLK using sample rate only prevents playing/recording
samples with rate &lt; 16 kHz:
---------------------------------------------------------------
root@apalis-t30:~# aplay test-8k-sample.wav
Playing WAVE 'test-8k-sample.wav' : Signed 16 bit
[...] tegra-snd-apalis-tk1-sgtl5000 tegra-snd-apalis-tk1-sgtl5000.0: ASoC: machine hw_params failed: -22
Little Endian, Rate 8000 Hz, Stereo
aplay: set_params:1403: Unable to install hw params:
...
---------------------------------------------------------------

Using the helper from sgtl5000.h fixes this issue.

To keep determination of sys_fs solid, use a helper in device driver.

[1] https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdf

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Backported commit f997df18c0e4c988de49e984329cefdf6e13ed86

According to the manual [1], SYS_MCLK should base on SYS_FS, not on sample rate.

Calculating SYS_MCLK using sample rate only prevents playing/recording
samples with rate &lt; 16 kHz:
---------------------------------------------------------------
root@apalis-t30:~# aplay test-8k-sample.wav
Playing WAVE 'test-8k-sample.wav' : Signed 16 bit
[...] tegra-snd-apalis-tk1-sgtl5000 tegra-snd-apalis-tk1-sgtl5000.0: ASoC: machine hw_params failed: -22
Little Endian, Rate 8000 Hz, Stereo
aplay: set_params:1403: Unable to install hw params:
...
---------------------------------------------------------------

Using the helper from sgtl5000.h fixes this issue.

To keep determination of sys_fs solid, use a helper in device driver.

[1] https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdf

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ASoC: sgtl5000: add helpers to calculate mclk</title>
<updated>2019-09-09T11:56:07+00:00</updated>
<author>
<name>Oleksandr Suvorov</name>
<email>oleksandr.suvorov@toradex.com</email>
</author>
<published>2019-09-02T15:31:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d26e03d1e61da1ba12f0fb84d5ee13a8810c0d59'/>
<id>d26e03d1e61da1ba12f0fb84d5ee13a8810c0d59</id>
<content type='text'>
Calculate SYS_MCLK using sample rate or SYS_FS.
These helpers allow to simplify a code to set up external system clock
for different sample rates.

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Calculate SYS_MCLK using sample rate or SYS_FS.
These helpers allow to simplify a code to set up external system clock
for different sample rates.

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ASoC: sgtl5000: Fix charge pump source assignment</title>
<updated>2019-09-09T11:49:10+00:00</updated>
<author>
<name>Oleksandr Suvorov</name>
<email>oleksandr.suvorov@toradex.com</email>
</author>
<published>2019-09-09T11:49:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e90330d60bd7c0af068c43ae19374f46d6cdd7a0'/>
<id>e90330d60bd7c0af068c43ae19374f46d6cdd7a0</id>
<content type='text'>
Backported commit 8326ab1285e71e24481d8e1eee3e72a6b3abbb38

If VDDA != VDDIO and any of them is greater than 3.1V, charge pump
source can be assigned automatically [1].

[1] https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdf

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
Reviewed-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Reviewed-by: Igor Opaniuk &lt;igor.opaniuk@toradex.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Backported commit 8326ab1285e71e24481d8e1eee3e72a6b3abbb38

If VDDA != VDDIO and any of them is greater than 3.1V, charge pump
source can be assigned automatically [1].

[1] https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdf

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
Reviewed-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Reviewed-by: Igor Opaniuk &lt;igor.opaniuk@toradex.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ASoC: sgtl5000: Fix of unmute outputs on prob</title>
<updated>2019-09-09T11:42:30+00:00</updated>
<author>
<name>Oleksandr Suvorov</name>
<email>oleksandr.suvorov@toradex.com</email>
</author>
<published>2019-09-09T11:42:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=befb3f9ac53a15141c15abaf4a366655115c633e'/>
<id>befb3f9ac53a15141c15abaf4a366655115c633e</id>
<content type='text'>
Backported commit 8337f764b45e122bd17b8c84b7ac26da3086fe26

To enable "zero cross detect" for ADC/HP, change
HP_ZCD_EN/ADC_ZCD_EN bits only instead of writing the whole
CHIP_ANA_CTRL register.

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
Reviewed-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Reviewed-by: Igor Opaniuk &lt;igor.opaniuk@toradex.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Backported commit 8337f764b45e122bd17b8c84b7ac26da3086fe26

To enable "zero cross detect" for ADC/HP, change
HP_ZCD_EN/ADC_ZCD_EN bits only instead of writing the whole
CHIP_ANA_CTRL register.

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
Reviewed-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Reviewed-by: Igor Opaniuk &lt;igor.opaniuk@toradex.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ASoC: sgtl5000: add ADC/HP/LINEOUT mute control</title>
<updated>2019-09-09T11:37:01+00:00</updated>
<author>
<name>Oleksandr Suvorov</name>
<email>oleksandr.suvorov@toradex.com</email>
</author>
<published>2019-05-16T11:47:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7e270a134532cffab5229e1a280c056ea23b9548'/>
<id>7e270a134532cffab5229e1a280c056ea23b9548</id>
<content type='text'>
Backported from commit 19a1d41649f695658a67898dcb9312de02878eb1.

This control mute/unmute the ADC input of SGTL5000
using its CHIP_ANA_CTRL register.

Tuned: add Headphone and Line-Out mute/unmute controlling.

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
Reviewed-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Reviewed-by: Igor Opaniuk &lt;igor.opaniuk@toradex.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Backported from commit 19a1d41649f695658a67898dcb9312de02878eb1.

This control mute/unmute the ADC input of SGTL5000
using its CHIP_ANA_CTRL register.

Tuned: add Headphone and Line-Out mute/unmute controlling.

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
Reviewed-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Reviewed-by: Igor Opaniuk &lt;igor.opaniuk@toradex.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ASoC: sgtl5000: Fix definition of VAG Ramp Control</title>
<updated>2019-09-09T11:37:01+00:00</updated>
<author>
<name>Oleksandr Suvorov</name>
<email>oleksandr.suvorov@toradex.com</email>
</author>
<published>2019-05-03T07:58:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=25af6fc2a81365d075a5aaaa3bfa674278d18daa'/>
<id>25af6fc2a81365d075a5aaaa3bfa674278d18daa</id>
<content type='text'>
Backported from commit 55e23d488cd1367638ee304bd8bb6210f53d13db.

SGTL5000_SMALL_POP is a bit mask, not a value. Usage of
correct definition makes device probing code more clear.

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
Reviewed-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Reviewed-by: Igor Opaniuk &lt;igor.opaniuk@toradex.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Backported from commit 55e23d488cd1367638ee304bd8bb6210f53d13db.

SGTL5000_SMALL_POP is a bit mask, not a value. Usage of
correct definition makes device probing code more clear.

Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
Reviewed-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Reviewed-by: Igor Opaniuk &lt;igor.opaniuk@toradex.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ASoC: sgtl5000: Improve VAG power and mute control</title>
<updated>2019-09-09T11:01:29+00:00</updated>
<author>
<name>Oleksandr Suvorov</name>
<email>oleksandr.suvorov@toradex.com</email>
</author>
<published>2019-05-20T07:42:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f474033a6822c0a4387a351834b7c421faf56acc'/>
<id>f474033a6822c0a4387a351834b7c421faf56acc</id>
<content type='text'>
Backported from commit e6e98e2e05baa3862ac7d1d2334f88ec927c8f66.

VAG power control is improved to fit the manual [1]. This patch fixes as
minimum one bug: if customer muxes Headphone to Line-In right after boot,
the VAG power remains off that leads to poor sound quality from line-in.

I.e. after boot:
  - Connect sound source to Line-In jack;
  - Connect headphone to HP jack;
  - Run following commands:
  $ amixer set 'Headphone' 80%
  $ amixer set 'Headphone Mux' LINE_IN

Change VAG power on/off control according to the following algorithm:
  - turn VAG power ON on the 1st incoming event.
  - keep it ON if there is any active VAG consumer (ADC/DAC/HP/Line-In).
  - turn VAG power OFF when there is the latest consumer's pre-down event
    come.
  - always delay after VAG power OFF to avoid pop.
  - delay after VAG power ON if the initiative consumer is Line-In, this
    prevents pop during line-in muxing.

According to the data sheet [1], to avoid any pops/clicks,
the outputs should be muted during input/output
routing changes.

[1] https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdf

Fixes: 9b34e6cc3bc2 ("ASoC: Add Freescale SGTL5000 codec support")
Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
Reviewed-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Backported from commit e6e98e2e05baa3862ac7d1d2334f88ec927c8f66.

VAG power control is improved to fit the manual [1]. This patch fixes as
minimum one bug: if customer muxes Headphone to Line-In right after boot,
the VAG power remains off that leads to poor sound quality from line-in.

I.e. after boot:
  - Connect sound source to Line-In jack;
  - Connect headphone to HP jack;
  - Run following commands:
  $ amixer set 'Headphone' 80%
  $ amixer set 'Headphone Mux' LINE_IN

Change VAG power on/off control according to the following algorithm:
  - turn VAG power ON on the 1st incoming event.
  - keep it ON if there is any active VAG consumer (ADC/DAC/HP/Line-In).
  - turn VAG power OFF when there is the latest consumer's pre-down event
    come.
  - always delay after VAG power OFF to avoid pop.
  - delay after VAG power ON if the initiative consumer is Line-In, this
    prevents pop during line-in muxing.

According to the data sheet [1], to avoid any pops/clicks,
the outputs should be muted during input/output
routing changes.

[1] https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdf

Fixes: 9b34e6cc3bc2 ("ASoC: Add Freescale SGTL5000 codec support")
Signed-off-by: Oleksandr Suvorov &lt;oleksandr.suvorov@toradex.com&gt;
Reviewed-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>asoc: tegra: fix gcc-6 compilation</title>
<updated>2016-09-29T12:48:04+00:00</updated>
<author>
<name>Marcel Ziswiler</name>
<email>marcel.ziswiler@toradex.com</email>
</author>
<published>2016-08-18T06:41:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fc94b2d37963c4ddc43c3f78701cbf744923b7eb'/>
<id>fc94b2d37963c4ddc43c3f78701cbf744923b7eb</id>
<content type='text'>
sound/soc/tegra/tegra30_dam.c: In function 'tegra30_dam_probe':
sound/soc/tegra/tegra30_dam.c:620:3: error: this 'if' clause does not
guard... [-Werror=misleading-indentation]
   if ((i == TEGRA30_DAM_CTRL_RSVD_6) ||
   ^~
sound/soc/tegra/tegra30_dam.c:624:4: note: ...this statement, but the
latter is misleadingly indented as if it is guarded by the 'if'
    dam-&gt;reg_cache[i] =
    ^~~

Signed-off-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Acked-by: Max Krummenacher &lt;max.krummenacher@toradex.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
sound/soc/tegra/tegra30_dam.c: In function 'tegra30_dam_probe':
sound/soc/tegra/tegra30_dam.c:620:3: error: this 'if' clause does not
guard... [-Werror=misleading-indentation]
   if ((i == TEGRA30_DAM_CTRL_RSVD_6) ||
   ^~
sound/soc/tegra/tegra30_dam.c:624:4: note: ...this statement, but the
latter is misleadingly indented as if it is guarded by the 'if'
    dam-&gt;reg_cache[i] =
    ^~~

Signed-off-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
Acked-by: Max Krummenacher &lt;max.krummenacher@toradex.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ASoC: sgtl5000: Fix SMALL_POP bit definition</title>
<updated>2015-05-13T07:56:07+00:00</updated>
<author>
<name>Fabio Estevam</name>
<email>fabio.estevam@freescale.com</email>
</author>
<published>2014-11-14T04:14:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=eeea9fbe6bb8db5d0caa485652e423371209cebf'/>
<id>eeea9fbe6bb8db5d0caa485652e423371209cebf</id>
<content type='text'>
On a mx28evk with a sgtl5000 codec we notice a loud 'click' sound  to happen
5 seconds after the end of a playback.

The SMALL_POP bit should fix this, but its definition is incorrect:
according to the sgtl5000 manual it is bit 0 of CHIP_REF_CTRL register, not
bit 1.

Fix the definition accordingly and enable the bit as intended per the code
comment.

After applying this change, no loud 'click' sound is heard after playback

Signed-off-by: Fabio Estevam &lt;fabio.estevam@freescale.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Cc: stable@vger.kernel.org
(cherry picked from commit c251ea7bd7a04f1f2575467e0de76e803cf59149)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On a mx28evk with a sgtl5000 codec we notice a loud 'click' sound  to happen
5 seconds after the end of a playback.

The SMALL_POP bit should fix this, but its definition is incorrect:
according to the sgtl5000 manual it is bit 0 of CHIP_REF_CTRL register, not
bit 1.

Fix the definition accordingly and enable the bit as intended per the code
comment.

After applying this change, no loud 'click' sound is heard after playback

Signed-off-by: Fabio Estevam &lt;fabio.estevam@freescale.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Cc: stable@vger.kernel.org
(cherry picked from commit c251ea7bd7a04f1f2575467e0de76e803cf59149)
</pre>
</div>
</content>
</entry>
<entry>
<title>ASoC: sgtl5000: remove useless register write clearing</title>
<updated>2015-05-13T07:37:42+00:00</updated>
<author>
<name>Eric Nelson</name>
<email>eric.nelson@boundarydevices.com</email>
</author>
<published>2015-02-28T00:37:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=202483c148322e527b14863c59f3ffff93aeec69'/>
<id>202483c148322e527b14863c59f3ffff93aeec69</id>
<content type='text'>
 CHRGPUMP_POWERUP

The SGTL5000_CHIP_ANA_POWER register is cached. Update the cached
value instead of writing it directly.

Upstream-status: sent

Signed-off-by: Eric Nelson &lt;eric.nelson@boundarydevices.com&gt;
(cherry picked from commit 309abdeda8c9331013f25b1a1209d9ce8334237b)
(cherry picked from commit 8a8b303a7431e66a7ec6ec52bc0e04ed0a1335d0)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
 CHRGPUMP_POWERUP

The SGTL5000_CHIP_ANA_POWER register is cached. Update the cached
value instead of writing it directly.

Upstream-status: sent

Signed-off-by: Eric Nelson &lt;eric.nelson@boundarydevices.com&gt;
(cherry picked from commit 309abdeda8c9331013f25b1a1209d9ce8334237b)
(cherry picked from commit 8a8b303a7431e66a7ec6ec52bc0e04ed0a1335d0)
</pre>
</div>
</content>
</entry>
</feed>
