Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, Charles, On Thu, 24 Sep 2015 08:41:07 +0100 Charles Keepax wrote: > On Thu, Sep 24, 2015 at 10:38:09AM +0900, Inha Song wrote: > > Hi, Charles, > > > > On Wed, 23 Sep 2015 15:43:12 +0100 > > Charles Keepax wrote: > > > > > On Wed, Sep 23, 2015 at 11:04:04AM +0900, Inha Song wrote: > > > > Hi, Charles, > > > > > > > > I saw the log with LOG_DEVICE in regmap. But, I'm not sure the reason > > > > that suspend noirq failed is IRQ occuring. > > > > > > > > Here is my log: > > > > -- > > > > root@localhost:~# aplay test.wav > > > > [ 41.049072] s3c64xx_spi_runtime_suspend > > > > [ 41.056043] arizona spi1.0: ASRC underclocked > > > > > > > > [ 72.308238] arizona spi1.0: Suspend, disabling IRQ > > > > [ 72.320286] arizona spi1.0: 400 <= 0 > > > > [ 72.320310] s3c64xx_spi_runtime_resume > > > > [ 72.336047] arizona spi1.0: 51a <= 0 > > > > [ 72.336217] arizona spi1.0: 101 <= 8604 > > > > [ 72.336401] arizona spi1.0: 171 <= 3 > > > > [ 72.336425] arizona spi1.0: 171 <= 2 > > > > [ 72.336731] arizona spi1.0: 171 <= 0 > > > > [ 72.336751] arizona spi1.0: SYSCLK cleared > > > > [ 72.338584] arizona spi1.0: SYSCLK cleared > > > > > > This bit looks likely related to your problem, it looks like the > > > FLL is being turned off. My guess here would be that you haven't > > > called snd_soc_dapm_ignore_suspend from your machine driver, you > > > need to call this for all end points that may want to stay > > > powered up during system suspend and also set the ignore_suspend > > > flag on any DAI links you want to remain active during system > > > suspend. > > > > But, We should call the trigger callback with SNDRV_PCM_TRIGGER_SUSPEND and > > *_RESUME command > > for support senarios what suspend during the playback and resume. > > So, I can't set the "ignore_suspend" in playback DAI. > > > > For this reason, I would have called the runtime_suspend manually in > > arizona-core when suspend. > > > > Best Reagrds, > > Inha Song. > > > > Ah ok so you want the audio to stop during suspend? Yes, I want to stop when suspend and continuous play when resume. > > Ok in that case can we get a bit more of log, your log finished > up here: > > [ 72.308238] arizona spi1.0: Suspend, disabling IRQ > [ 72.320286] arizona spi1.0: 400 <= 0 > [ 72.320310] s3c64xx_spi_runtime_resume > [ 72.336047] arizona spi1.0: 51a <= 0 > [ 72.336217] arizona spi1.0: 101 <= 8604 > [ 72.336401] arizona spi1.0: 171 <= 3 > [ 72.336425] arizona spi1.0: 171 <= 2 > [ 72.336731] arizona spi1.0: 171 <= 0 > [ 72.336751] arizona spi1.0: SYSCLK cleared > [ 72.338584] arizona spi1.0: SYSCLK cleared > [ 72.339123] s3c64xx_spi_suspend > [ 72.355866] arizona spi1.0: Late suspend, reenabling IRQ > [ 72.355893] >>> noirq failed because of spi1 > [ 72.355948] arizona spi1.0: Early resume, disabling IRQ > [ 72.416798] PM: noirq suspend of devices failed > > Which finished too early as we can't see which IRQ it was that > triggered the wakeup. But, I can't find any spi regmap log that for IRQ. -- [ 114.282681] arizona spi1.0: Late suspend, reenabling IRQ [ 114.282708] >>> noirq failed because of spi1 [ 114.282760] arizona spi1.0: Early resume, disabling IRQ [ 114.316510] PM: noirq suspend of devices failed [ 114.333590] s3c64xx_spi_resume -> set the FLL in machine for playback when resume. [ 114.334756] arizona spi1.0: FLL1: Fref=2400 Fout=135475200 [ 114.334762] arizona spi1.0: FLL1: Fvco=90316800Hz [ 114.334792] arizona spi1.0: FLL1: GCD=19200 [ 114.334798] arizona spi1.0: FLL1: N=7 THETA=149 LAMBDA=271 [ 114.334803] arizona spi1.0: FLL1: FRATIO=0(0) OUTDIV=2 REFCLK_DIV=1 [ 114.334807] arizona spi1.0: FLL1: GAIN=4 [ 114.334827] arizona spi1.0: 171 <= 1 [ 114.520724] arizona spi1.0: Late resume, reenabling IRQ [ 114.521152] arizona spi1.0: d40 => 3 [ 114.521387] arizona spi1.0: d04 <= 1 [ 114.521500] arizona spi1.0: FLL1: clock OK [ 114.521773] arizona spi1.0: SYSCLK set to 135475200Hz [ 114.522651] arizona spi1.0: SYSCLK set to 135475200Hz [ 114.522752] arizona spi1.0: 101 <= 8644 [ 114.522940] arizona spi1.0: 51a <= 1 [ 114.523057] arizona spi1.0: 400 <= 8 [ 114.909270] s3c64xx_spi_runtime_suspend [ 114.909721] done. Suspended. Trying resume. Failed. Restarting stream. Done. -> retry to enter suspend Immediately. [ 115.478349] arizona spi1.0:
Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, Charles, On Thu, 24 Sep 2015 08:41:07 +0100 Charles Keepax <ckee...@opensource.wolfsonmicro.com> wrote: > On Thu, Sep 24, 2015 at 10:38:09AM +0900, Inha Song wrote: > > Hi, Charles, > > > > On Wed, 23 Sep 2015 15:43:12 +0100 > > Charles Keepax <ckee...@opensource.wolfsonmicro.com> wrote: > > > > > On Wed, Sep 23, 2015 at 11:04:04AM +0900, Inha Song wrote: > > > > Hi, Charles, > > > > > > > > I saw the log with LOG_DEVICE in regmap. But, I'm not sure the reason > > > > that suspend noirq failed is IRQ occuring. > > > > > > > > Here is my log: > > > > -- > > > > root@localhost:~# aplay test.wav > > > > [ 41.049072] s3c64xx_spi_runtime_suspend > > > > [ 41.056043] arizona spi1.0: ASRC underclocked > > > > > > > > [ 72.308238] arizona spi1.0: Suspend, disabling IRQ > > > > [ 72.320286] arizona spi1.0: 400 <= 0 > > > > [ 72.320310] s3c64xx_spi_runtime_resume > > > > [ 72.336047] arizona spi1.0: 51a <= 0 > > > > [ 72.336217] arizona spi1.0: 101 <= 8604 > > > > [ 72.336401] arizona spi1.0: 171 <= 3 > > > > [ 72.336425] arizona spi1.0: 171 <= 2 > > > > [ 72.336731] arizona spi1.0: 171 <= 0 > > > > [ 72.336751] arizona spi1.0: SYSCLK cleared > > > > [ 72.338584] arizona spi1.0: SYSCLK cleared > > > > > > This bit looks likely related to your problem, it looks like the > > > FLL is being turned off. My guess here would be that you haven't > > > called snd_soc_dapm_ignore_suspend from your machine driver, you > > > need to call this for all end points that may want to stay > > > powered up during system suspend and also set the ignore_suspend > > > flag on any DAI links you want to remain active during system > > > suspend. > > > > But, We should call the trigger callback with SNDRV_PCM_TRIGGER_SUSPEND and > > *_RESUME command > > for support senarios what suspend during the playback and resume. > > So, I can't set the "ignore_suspend" in playback DAI. > > > > For this reason, I would have called the runtime_suspend manually in > > arizona-core when suspend. > > > > Best Reagrds, > > Inha Song. > > > > Ah ok so you want the audio to stop during suspend? Yes, I want to stop when suspend and continuous play when resume. > > Ok in that case can we get a bit more of log, your log finished > up here: > > [ 72.308238] arizona spi1.0: Suspend, disabling IRQ > [ 72.320286] arizona spi1.0: 400 <= 0 > [ 72.320310] s3c64xx_spi_runtime_resume > [ 72.336047] arizona spi1.0: 51a <= 0 > [ 72.336217] arizona spi1.0: 101 <= 8604 > [ 72.336401] arizona spi1.0: 171 <= 3 > [ 72.336425] arizona spi1.0: 171 <= 2 > [ 72.336731] arizona spi1.0: 171 <= 0 > [ 72.336751] arizona spi1.0: SYSCLK cleared > [ 72.338584] arizona spi1.0: SYSCLK cleared > [ 72.339123] s3c64xx_spi_suspend > [ 72.355866] arizona spi1.0: Late suspend, reenabling IRQ > [ 72.355893] >>> noirq failed because of spi1 > [ 72.355948] arizona spi1.0: Early resume, disabling IRQ > [ 72.416798] PM: noirq suspend of devices failed > > Which finished too early as we can't see which IRQ it was that > triggered the wakeup. But, I can't find any spi regmap log that for IRQ. -- [ 114.282681] arizona spi1.0: Late suspend, reenabling IRQ [ 114.282708] >>> noirq failed because of spi1 [ 114.282760] arizona spi1.0: Early resume, disabling IRQ [ 114.316510] PM: noirq suspend of devices failed [ 114.333590] s3c64xx_spi_resume -> set the FLL in machine for playback when resume. [ 114.334756] arizona spi1.0: FLL1: Fref=2400 Fout=135475200 [ 114.334762] arizona spi1.0: FLL1: Fvco=90316800Hz [ 114.334792] arizona spi1.0: FLL1: GCD=19200 [ 114.334798] arizona spi1.0: FLL1: N=7 THETA=149 LAMBDA=271 [ 114.334803] arizona spi1.0: FLL1: FRATIO=0(0) OUTDIV=2 REFCLK_DIV=1 [ 114.334807] arizona spi1.0: FLL1: GAIN=4 [ 114.334827] arizona spi1.0: 171 <= 1 [ 114.520724] arizona spi1.0: Late resume, reenabling IRQ [ 114.521152] arizona spi1.0: d40 => 3 [ 114.521387] arizona spi1.0: d04 <= 1 [ 114.521500] arizona spi1.0: FLL1: clock OK [ 114.521773] arizona spi1.0: SYSCLK set to 135475200Hz [ 114.522651] arizona spi1.0: SYSCLK set to 135475200Hz [ 114.522752] arizona spi1.0: 101 <= 8644 [ 114.522940] arizona spi1.0: 51a <= 1 [ 114.523057] arizona spi1.0: 400 <= 8 [ 114.909270] s3c64xx_sp
Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, Charles, On Wed, 23 Sep 2015 15:43:12 +0100 Charles Keepax wrote: > On Wed, Sep 23, 2015 at 11:04:04AM +0900, Inha Song wrote: > > Hi, Charles, > > > > I saw the log with LOG_DEVICE in regmap. But, I'm not sure the reason that > > suspend noirq failed is IRQ occuring. > > > > Here is my log: > > -- > > root@localhost:~# aplay test.wav > > [ 41.049072] s3c64xx_spi_runtime_suspend > > [ 41.056043] arizona spi1.0: ASRC underclocked > > > > [ 72.308238] arizona spi1.0: Suspend, disabling IRQ > > [ 72.320286] arizona spi1.0: 400 <= 0 > > [ 72.320310] s3c64xx_spi_runtime_resume > > [ 72.336047] arizona spi1.0: 51a <= 0 > > [ 72.336217] arizona spi1.0: 101 <= 8604 > > [ 72.336401] arizona spi1.0: 171 <= 3 > > [ 72.336425] arizona spi1.0: 171 <= 2 > > [ 72.336731] arizona spi1.0: 171 <= 0 > > [ 72.336751] arizona spi1.0: SYSCLK cleared > > [ 72.338584] arizona spi1.0: SYSCLK cleared > > This bit looks likely related to your problem, it looks like the > FLL is being turned off. My guess here would be that you haven't > called snd_soc_dapm_ignore_suspend from your machine driver, you > need to call this for all end points that may want to stay > powered up during system suspend and also set the ignore_suspend > flag on any DAI links you want to remain active during system > suspend. But, We should call the trigger callback with SNDRV_PCM_TRIGGER_SUSPEND and *_RESUME command for support senarios what suspend during the playback and resume. So, I can't set the "ignore_suspend" in playback DAI. For this reason, I would have called the runtime_suspend manually in arizona-core when suspend. Best Reagrds, Inha Song. > > Likely what is happening here is that you are disabling the FLL > and this is causing some IRQ which is then causing a wake event > thus aborting the suspend. > > Thanks, > Charles -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, Charles, On Wed, 23 Sep 2015 15:43:12 +0100 Charles Keepax <ckee...@opensource.wolfsonmicro.com> wrote: > On Wed, Sep 23, 2015 at 11:04:04AM +0900, Inha Song wrote: > > Hi, Charles, > > > > I saw the log with LOG_DEVICE in regmap. But, I'm not sure the reason that > > suspend noirq failed is IRQ occuring. > > > > Here is my log: > > -- > > root@localhost:~# aplay test.wav > > [ 41.049072] s3c64xx_spi_runtime_suspend > > [ 41.056043] arizona spi1.0: ASRC underclocked > > > > [ 72.308238] arizona spi1.0: Suspend, disabling IRQ > > [ 72.320286] arizona spi1.0: 400 <= 0 > > [ 72.320310] s3c64xx_spi_runtime_resume > > [ 72.336047] arizona spi1.0: 51a <= 0 > > [ 72.336217] arizona spi1.0: 101 <= 8604 > > [ 72.336401] arizona spi1.0: 171 <= 3 > > [ 72.336425] arizona spi1.0: 171 <= 2 > > [ 72.336731] arizona spi1.0: 171 <= 0 > > [ 72.336751] arizona spi1.0: SYSCLK cleared > > [ 72.338584] arizona spi1.0: SYSCLK cleared > > This bit looks likely related to your problem, it looks like the > FLL is being turned off. My guess here would be that you haven't > called snd_soc_dapm_ignore_suspend from your machine driver, you > need to call this for all end points that may want to stay > powered up during system suspend and also set the ignore_suspend > flag on any DAI links you want to remain active during system > suspend. But, We should call the trigger callback with SNDRV_PCM_TRIGGER_SUSPEND and *_RESUME command for support senarios what suspend during the playback and resume. So, I can't set the "ignore_suspend" in playback DAI. For this reason, I would have called the runtime_suspend manually in arizona-core when suspend. Best Reagrds, Inha Song. > > Likely what is happening here is that you are disabling the FLL > and this is causing some IRQ which is then causing a wake event > thus aborting the suspend. > > Thanks, > Charles -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, Charles, I saw the log with LOG_DEVICE in regmap. But, I'm not sure the reason that suspend noirq failed is IRQ occuring. Here is my log: -- root@localhost:~# aplay test.wav [ 40.831047] arizona spi1.0: Leaving AoD mode [ 40.834448] s3c64xx_spi_runtime_resume [ 40.834876] arizona spi1.0: d23 => 1 [ 40.835029] s3c64xx_spi_runtime_suspend [ 40.846040] s3c64xx_spi_runtime_resume [ 40.846423] arizona spi1.0: d23 => 100 [ 40.846557] s3c64xx_spi_runtime_suspend [ 40.846771] arizona spi1.0: d04 <= 100 [ 40.846956] s3c64xx_spi_runtime_resume [ 40.852145] s3c64xx_spi_runtime_suspend [ 40.852386] s3c64xx_spi_runtime_resume [ 40.852894] s3c64xx_spi_runtime_suspend [ 40.854307] s3c64xx_spi_runtime_resume [ 40.858375] arizona spi1.0: d40 => 3 [ 40.858410] s3c64xx_spi_runtime_suspend [ 40.865429] s3c64xx_spi_runtime_resume [ 40.869637] arizona spi1.0: d02 <= 2040 [ 40.869671] s3c64xx_spi_runtime_suspend [ 40.876836] s3c64xx_spi_runtime_resume [ 40.880749] arizona spi1.0: Spurious HPDET IRQ [ 40.880773] arizona spi1.0: FLL1: Fref=2400 Fout=135475200 [ 40.880787] arizona spi1.0: FLL1: Fvco=90316800Hz [ 40.880793] s3c64xx_spi_runtime_suspend [ 40.880803] arizona spi1.0: FLL1: GCD=19200 [ 40.880817] arizona spi1.0: FLL1: N=7 THETA=149 LAMBDA=271 [ 40.880831] arizona spi1.0: FLL1: FRATIO=0(0) OUTDIV=2 REFCLK_DIV=1 [ 40.880842] arizona spi1.0: FLL1: GAIN=4 [ 40.880886] arizona spi1.0: 171 <= 1 [ 40.880944] s3c64xx_spi_runtime_resume [ 40.881218] s3c64xx_spi_runtime_suspend [ 40.930152] s3c64xx_spi_runtime_resume [ 40.934071] arizona spi1.0: d26 => 1 [ 40.934140] s3c64xx_spi_runtime_suspend [ 40.941237] arizona spi1.0: Mixer dropped sample [ 40.945901] s3c64xx_spi_runtime_resume [ 40.950067] arizona spi1.0: d40 => 3 [ 40.950091] s3c64xx_spi_runtime_suspend [ 40.957025] s3c64xx_spi_runtime_resume [ 40.960971] arizona spi1.0: d04 <= 1 [ 40.961006] s3c64xx_spi_runtime_suspend [ 40.968106] s3c64xx_spi_runtime_resume [ 40.971956] arizona spi1.0: FLL1: clock OK [ 40.971987] s3c64xx_spi_runtime_suspend [ 40.979751] arizona spi1.0: SYSCLK set to 135475200Hz [ 40.984742] wm5110-codec wm5110-codec: AIF1: BCLK 1411200Hz LRCLK 44100Hz [ 40.992144] arizona spi1.0: SYSCLK set to 135475200Hz [ 40.996646] arizona spi1.0: 101 <= 8644 [ 41.000360] s3c64xx_spi_runtime_resume [ 41.004300] arizona spi1.0: 51a <= 1 [ 41.004357] s3c64xx_spi_runtime_suspend [ 41.011499] s3c64xx_spi_runtime_resume [ 41.015689] arizona spi1.0: 400 <= 8 [ 41.015692] s3c64xx_spi_runtime_suspend [ 41.022581] s3c64xx_spi_runtime_resume [ 41.026735] arizona spi1.0: d40 => 3 [ 41.026737] s3c64xx_spi_runtime_suspend [ 41.033687] s3c64xx_spi_runtime_resume [ 41.037765] arizona spi1.0: d02 <= 40 [ 41.037800] s3c64xx_spi_runtime_suspend [ 41.044883] s3c64xx_spi_runtime_resume [ 41.049054] arizona spi1.0: d26 => 8 [ 41.049072] s3c64xx_spi_runtime_suspend [ 41.056043] arizona spi1.0: ASRC underclocked [ 72.308238] arizona spi1.0: Suspend, disabling IRQ [ 72.320286] arizona spi1.0: 400 <= 0 [ 72.320310] s3c64xx_spi_runtime_resume [ 72.336047] arizona spi1.0: 51a <= 0 [ 72.336217] arizona spi1.0: 101 <= 8604 [ 72.336401] arizona spi1.0: 171 <= 3 [ 72.336425] arizona spi1.0: 171 <= 2 [ 72.336731] arizona spi1.0: 171 <= 0 [ 72.336751] arizona spi1.0: SYSCLK cleared [ 72.338584] arizona spi1.0: SYSCLK cleared [ 72.339123] s3c64xx_spi_suspend [ 72.355866] arizona spi1.0: Late suspend, reenabling IRQ [ 72.355893] >>> noirq failed because of spi1 [ 72.355948] arizona spi1.0: Early resume, disabling IRQ [ 72.416798] PM: noirq suspend of devices failed .. Best Regards, Inha Song. On Tue, 22 Sep 2015 08:46:18 +0100 Charles Keepax wrote: > On Mon, Sep 21, 2015 at 11:16:42AM +0900, Inha Song wrote: > > Hi, Charles, > > > > I've already tried to change. > > If I change to that, we can't enter the suspen during the playback. > > > > - > > [ 72.538263] arizona spi1.0: Suspend, disabling IRQ > > ... > > [ 72.585823] arizona spi1.0: Late suspend, reengabling IRQ > > [ 72.585904] arizona spi1.0: Early resume, disabling IRQ > > ... > > [ 72.646770] PM: noirq suspend of devices failed > > <- because of "spi1.0" pm_wakeup_pending() in suspend_noirq() > > Ok this looks more reasonable, suspend should fail because we do > have an IRQ waiting to be handled, so we shouldn't suspend. But > you are saying this happens every time the CODEC goes to suspend, > thus blocking the suspend from suspending? > > First step then would be to identify what IRQ is occurring, could > you set LOG_DEVICE at the top of drivers/base/regmap/regmap.c to > "spi1.0" and provide a log, so we can see what IRQ is being > as
Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, Charles, I saw the log with LOG_DEVICE in regmap. But, I'm not sure the reason that suspend noirq failed is IRQ occuring. Here is my log: -- root@localhost:~# aplay test.wav [ 40.831047] arizona spi1.0: Leaving AoD mode [ 40.834448] s3c64xx_spi_runtime_resume [ 40.834876] arizona spi1.0: d23 => 1 [ 40.835029] s3c64xx_spi_runtime_suspend [ 40.846040] s3c64xx_spi_runtime_resume [ 40.846423] arizona spi1.0: d23 => 100 [ 40.846557] s3c64xx_spi_runtime_suspend [ 40.846771] arizona spi1.0: d04 <= 100 [ 40.846956] s3c64xx_spi_runtime_resume [ 40.852145] s3c64xx_spi_runtime_suspend [ 40.852386] s3c64xx_spi_runtime_resume [ 40.852894] s3c64xx_spi_runtime_suspend [ 40.854307] s3c64xx_spi_runtime_resume [ 40.858375] arizona spi1.0: d40 => 3 [ 40.858410] s3c64xx_spi_runtime_suspend [ 40.865429] s3c64xx_spi_runtime_resume [ 40.869637] arizona spi1.0: d02 <= 2040 [ 40.869671] s3c64xx_spi_runtime_suspend [ 40.876836] s3c64xx_spi_runtime_resume [ 40.880749] arizona spi1.0: Spurious HPDET IRQ [ 40.880773] arizona spi1.0: FLL1: Fref=2400 Fout=135475200 [ 40.880787] arizona spi1.0: FLL1: Fvco=90316800Hz [ 40.880793] s3c64xx_spi_runtime_suspend [ 40.880803] arizona spi1.0: FLL1: GCD=19200 [ 40.880817] arizona spi1.0: FLL1: N=7 THETA=149 LAMBDA=271 [ 40.880831] arizona spi1.0: FLL1: FRATIO=0(0) OUTDIV=2 REFCLK_DIV=1 [ 40.880842] arizona spi1.0: FLL1: GAIN=4 [ 40.880886] arizona spi1.0: 171 <= 1 [ 40.880944] s3c64xx_spi_runtime_resume [ 40.881218] s3c64xx_spi_runtime_suspend [ 40.930152] s3c64xx_spi_runtime_resume [ 40.934071] arizona spi1.0: d26 => 1 [ 40.934140] s3c64xx_spi_runtime_suspend [ 40.941237] arizona spi1.0: Mixer dropped sample [ 40.945901] s3c64xx_spi_runtime_resume [ 40.950067] arizona spi1.0: d40 => 3 [ 40.950091] s3c64xx_spi_runtime_suspend [ 40.957025] s3c64xx_spi_runtime_resume [ 40.960971] arizona spi1.0: d04 <= 1 [ 40.961006] s3c64xx_spi_runtime_suspend [ 40.968106] s3c64xx_spi_runtime_resume [ 40.971956] arizona spi1.0: FLL1: clock OK [ 40.971987] s3c64xx_spi_runtime_suspend [ 40.979751] arizona spi1.0: SYSCLK set to 135475200Hz [ 40.984742] wm5110-codec wm5110-codec: AIF1: BCLK 1411200Hz LRCLK 44100Hz [ 40.992144] arizona spi1.0: SYSCLK set to 135475200Hz [ 40.996646] arizona spi1.0: 101 <= 8644 [ 41.000360] s3c64xx_spi_runtime_resume [ 41.004300] arizona spi1.0: 51a <= 1 [ 41.004357] s3c64xx_spi_runtime_suspend [ 41.011499] s3c64xx_spi_runtime_resume [ 41.015689] arizona spi1.0: 400 <= 8 [ 41.015692] s3c64xx_spi_runtime_suspend [ 41.022581] s3c64xx_spi_runtime_resume [ 41.026735] arizona spi1.0: d40 => 3 [ 41.026737] s3c64xx_spi_runtime_suspend [ 41.033687] s3c64xx_spi_runtime_resume [ 41.037765] arizona spi1.0: d02 <= 40 [ 41.037800] s3c64xx_spi_runtime_suspend [ 41.044883] s3c64xx_spi_runtime_resume [ 41.049054] arizona spi1.0: d26 => 8 [ 41.049072] s3c64xx_spi_runtime_suspend [ 41.056043] arizona spi1.0: ASRC underclocked [ 72.308238] arizona spi1.0: Suspend, disabling IRQ [ 72.320286] arizona spi1.0: 400 <= 0 [ 72.320310] s3c64xx_spi_runtime_resume [ 72.336047] arizona spi1.0: 51a <= 0 [ 72.336217] arizona spi1.0: 101 <= 8604 [ 72.336401] arizona spi1.0: 171 <= 3 [ 72.336425] arizona spi1.0: 171 <= 2 [ 72.336731] arizona spi1.0: 171 <= 0 [ 72.336751] arizona spi1.0: SYSCLK cleared [ 72.338584] arizona spi1.0: SYSCLK cleared [ 72.339123] s3c64xx_spi_suspend [ 72.355866] arizona spi1.0: Late suspend, reenabling IRQ [ 72.355893] >>> noirq failed because of spi1 [ 72.355948] arizona spi1.0: Early resume, disabling IRQ [ 72.416798] PM: noirq suspend of devices failed .. Best Regards, Inha Song. On Tue, 22 Sep 2015 08:46:18 +0100 Charles Keepax <ckee...@opensource.wolfsonmicro.com> wrote: > On Mon, Sep 21, 2015 at 11:16:42AM +0900, Inha Song wrote: > > Hi, Charles, > > > > I've already tried to change. > > If I change to that, we can't enter the suspen during the playback. > > > > - > > [ 72.538263] arizona spi1.0: Suspend, disabling IRQ > > ... > > [ 72.585823] arizona spi1.0: Late suspend, reengabling IRQ > > [ 72.585904] arizona spi1.0: Early resume, disabling IRQ > > ... > > [ 72.646770] PM: noirq suspend of devices failed > > <- because of "spi1.0" pm_wakeup_pending() in suspend_noirq() > > Ok this looks more reasonable, suspend should fail because we do > have an IRQ waiting to be handled, so we shouldn't suspend. But > you are saying this happens every time the CODEC goes to suspend, > thus blocking the suspend from suspending? > > First step then would be to identify what IRQ is occurring, could > you set LOG_DEVICE at the top of drivers/base/regmap/regmap.c to > "spi1.0" and
Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, Charles, I've already tried to change. If I change to that, we can't enter the suspen during the playback. - [ 72.538263] arizona spi1.0: Suspend, disabling IRQ ... [ 72.585823] arizona spi1.0: Late suspend, reengabling IRQ [ 72.585904] arizona spi1.0: Early resume, disabling IRQ ... [ 72.646770] PM: noirq suspend of devices failed <- because of "spi1.0" pm_wakeup_pending() in suspend_noirq() ... [ 72.663623] s3c64xx_spi_resume [ 72.851089] arizona spi1.0: Late resume, reenabling IRQ Best Regards, Inha Song. On Fri, 18 Sep 2015 09:24:46 +0100 Charles Keepax wrote: > On Fri, Sep 18, 2015 at 03:49:03PM +0900, Inha Song wrote: > > Hi, > > > > I just change dev_err() to dev_info() in arizona-core. > > > > > > root@localhost:~# aplay test.wav > > [ 42.731358] arizona spi1.0: Leaving AoD mode > > > > [ 42.823514] s3c64xx_spi_runtime_resume > > [ 42.828270] arizona spi1.0: ASRC underclocked > > [ 42.828281] s3c64xx_spi_runtime_suspend > > > > -> suspend () > > [ 72.398152] arizona spi1.0: Suspend, disabling IRQ > > [ 72.410471] s3c64xx_spi_runtime_resume > > [ 72.429045] s3c64xx_spi_suspend > > -> spi suspended > > [ 72.429905] PM: suspend of devices complete after 67.309 msecs > > [ 72.440084] arizona spi1.0: Late suspend, reenabling IRQ > > -> try to access spi irq after spi suspend() > > [ 72.440165] arizona spi1.0: Failed to read IRQ status: -108 > > [ 72.440174] arizona spi1.0: Failed to read main IRQ status: -108 > > [ 72.440242] arizona spi1.0: Failed to read IRQ status: -108 > > [ 72.440249] arizona spi1.0: Failed to read main IRQ status: -108 > > [ 72.440275] arizona spi1.0: Failed to read IRQ status: -108 > > [ 72.440282] arizona spi1.0: Failed to read main IRQ status: -108 > > [ 72.440304] arizona spi1.0: Failed to read IRQ status: -108 > > Ok so looking at the system PM code I think the problem here is > there is currently a small window between when we enable this IRQ > and when the suspend proceedure disables IRQs and this IRQ is > sneaking in at that point. > > Can you try the following diff and let me know what happens: > > --- a/drivers/mfd/arizona-core.c > +++ b/drivers/mfd/arizona-core.c > @@ -727,7 +727,7 @@ const struct dev_pm_ops arizona_pm_ops = { >NULL) > SET_SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume) > #ifdef CONFIG_PM_SLEEP > - .suspend_late = arizona_suspend_late, > + .suspend_noirq = arizona_suspend_late, > .resume_noirq = arizona_resume_noirq, > #endif > > Thanks, > Charles -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, Charles, I've already tried to change. If I change to that, we can't enter the suspen during the playback. - [ 72.538263] arizona spi1.0: Suspend, disabling IRQ ... [ 72.585823] arizona spi1.0: Late suspend, reengabling IRQ [ 72.585904] arizona spi1.0: Early resume, disabling IRQ ... [ 72.646770] PM: noirq suspend of devices failed <- because of "spi1.0" pm_wakeup_pending() in suspend_noirq() ... [ 72.663623] s3c64xx_spi_resume [ 72.851089] arizona spi1.0: Late resume, reenabling IRQ Best Regards, Inha Song. On Fri, 18 Sep 2015 09:24:46 +0100 Charles Keepax <ckee...@opensource.wolfsonmicro.com> wrote: > On Fri, Sep 18, 2015 at 03:49:03PM +0900, Inha Song wrote: > > Hi, > > > > I just change dev_err() to dev_info() in arizona-core. > > > > > > root@localhost:~# aplay test.wav > > [ 42.731358] arizona spi1.0: Leaving AoD mode > > > > [ 42.823514] s3c64xx_spi_runtime_resume > > [ 42.828270] arizona spi1.0: ASRC underclocked > > [ 42.828281] s3c64xx_spi_runtime_suspend > > > > -> suspend () > > [ 72.398152] arizona spi1.0: Suspend, disabling IRQ > > [ 72.410471] s3c64xx_spi_runtime_resume > > [ 72.429045] s3c64xx_spi_suspend > > -> spi suspended > > [ 72.429905] PM: suspend of devices complete after 67.309 msecs > > [ 72.440084] arizona spi1.0: Late suspend, reenabling IRQ > > -> try to access spi irq after spi suspend() > > [ 72.440165] arizona spi1.0: Failed to read IRQ status: -108 > > [ 72.440174] arizona spi1.0: Failed to read main IRQ status: -108 > > [ 72.440242] arizona spi1.0: Failed to read IRQ status: -108 > > [ 72.440249] arizona spi1.0: Failed to read main IRQ status: -108 > > [ 72.440275] arizona spi1.0: Failed to read IRQ status: -108 > > [ 72.440282] arizona spi1.0: Failed to read main IRQ status: -108 > > [ 72.440304] arizona spi1.0: Failed to read IRQ status: -108 > > Ok so looking at the system PM code I think the problem here is > there is currently a small window between when we enable this IRQ > and when the suspend proceedure disables IRQs and this IRQ is > sneaking in at that point. > > Can you try the following diff and let me know what happens: > > --- a/drivers/mfd/arizona-core.c > +++ b/drivers/mfd/arizona-core.c > @@ -727,7 +727,7 @@ const struct dev_pm_ops arizona_pm_ops = { >NULL) > SET_SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume) > #ifdef CONFIG_PM_SLEEP > - .suspend_late = arizona_suspend_late, > + .suspend_noirq = arizona_suspend_late, > .resume_noirq = arizona_resume_noirq, > #endif > > Thanks, > Charles -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, I just change dev_err() to dev_info() in arizona-core. root@localhost:~# aplay test.wav [ 42.731358] arizona spi1.0: Leaving AoD mode [ 42.823514] s3c64xx_spi_runtime_resume [ 42.828270] arizona spi1.0: ASRC underclocked [ 42.828281] s3c64xx_spi_runtime_suspend -> suspend () [ 72.398152] arizona spi1.0: Suspend, disabling IRQ [ 72.410471] s3c64xx_spi_runtime_resume [ 72.429045] s3c64xx_spi_suspend -> spi suspended [ 72.429905] PM: suspend of devices complete after 67.309 msecs [ 72.440084] arizona spi1.0: Late suspend, reenabling IRQ -> try to access spi irq after spi suspend() [ 72.440165] arizona spi1.0: Failed to read IRQ status: -108 [ 72.440174] arizona spi1.0: Failed to read main IRQ status: -108 [ 72.440242] arizona spi1.0: Failed to read IRQ status: -108 [ 72.440249] arizona spi1.0: Failed to read main IRQ status: -108 [ 72.440275] arizona spi1.0: Failed to read IRQ status: -108 [ 72.440282] arizona spi1.0: Failed to read main IRQ status: -108 [ 72.440304] arizona spi1.0: Failed to read IRQ status: -108 [ 72.465525] s3c64xx_spi_resume [ 72.650760] arizona spi1.0: Late resume, reenabling IRQ [ 72.650819] [] dump_backtrace+0x0/0x12c [ 72.650824] [] show_stack+0x10/0x1c [ 72.650832] [] dump_stack+0x78/0xc8 [ 72.650838] [] warn_slowpath_common+0x98/0xd0 [ 72.650842] [] warn_slowpath_fmt+0x4c/0x58 [ 72.650847] [] __enable_irq+0x40/0x8c [ 72.650851] [] enable_irq+0x34/0x74 [ 72.650858] [] arizona_resume+0x24/0x38 [ 72.650865] [] dpm_run_callback+0x50/0x1a0 [ 72.650870] [] device_resume+0x90/0x268 [ 72.650874] [] dpm_resume+0x120/0x350 [ 72.650878] [] dpm_resume_end+0x10/0x28 [ 72.650884] [] suspend_devices_and_enter+0x138/0x7f4 [ 72.650887] [] pm_suspend+0x314/0x5bc [ 72.650893] [] state_store+0x7c/0xf0 [ 72.650901] [] kobj_attr_store+0x10/0x24 [ 72.650910] [] sysfs_kf_write+0x40/0x4c [ 72.650914] [] kernfs_fop_write+0xb8/0x180 [ 72.650922] [] __vfs_write+0x2c/0x11c [ 72.650926] [] vfs_write+0x90/0x170 [ 72.650931] [] SyS_write+0x40/0xa0 - This irq failed errors are occured in enable_irq() that in arizona_suspend_late(). Becase of access the irq after spi suspend. (arizona->irq == spi->irq) Best Regards, Inha Song. On Thu, 17 Sep 2015 10:16:32 +0100 Charles Keepax wrote: > > OK so this is definitely that the SPI driver hasn't resumed > yet. Could we also get DEBUG turned on in arizona-core here. I am > interested to check where in the process the arizona > suspend/resume ops are being called. > > Thanks, > Charles -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, I just change dev_err() to dev_info() in arizona-core. root@localhost:~# aplay test.wav [ 42.731358] arizona spi1.0: Leaving AoD mode [ 42.823514] s3c64xx_spi_runtime_resume [ 42.828270] arizona spi1.0: ASRC underclocked [ 42.828281] s3c64xx_spi_runtime_suspend -> suspend () [ 72.398152] arizona spi1.0: Suspend, disabling IRQ [ 72.410471] s3c64xx_spi_runtime_resume [ 72.429045] s3c64xx_spi_suspend -> spi suspended [ 72.429905] PM: suspend of devices complete after 67.309 msecs [ 72.440084] arizona spi1.0: Late suspend, reenabling IRQ -> try to access spi irq after spi suspend() [ 72.440165] arizona spi1.0: Failed to read IRQ status: -108 [ 72.440174] arizona spi1.0: Failed to read main IRQ status: -108 [ 72.440242] arizona spi1.0: Failed to read IRQ status: -108 [ 72.440249] arizona spi1.0: Failed to read main IRQ status: -108 [ 72.440275] arizona spi1.0: Failed to read IRQ status: -108 [ 72.440282] arizona spi1.0: Failed to read main IRQ status: -108 [ 72.440304] arizona spi1.0: Failed to read IRQ status: -108 [ 72.465525] s3c64xx_spi_resume [ 72.650760] arizona spi1.0: Late resume, reenabling IRQ [ 72.650819] [] dump_backtrace+0x0/0x12c [ 72.650824] [] show_stack+0x10/0x1c [ 72.650832] [] dump_stack+0x78/0xc8 [ 72.650838] [] warn_slowpath_common+0x98/0xd0 [ 72.650842] [] warn_slowpath_fmt+0x4c/0x58 [ 72.650847] [] __enable_irq+0x40/0x8c [ 72.650851] [] enable_irq+0x34/0x74 [ 72.650858] [] arizona_resume+0x24/0x38 [ 72.650865] [] dpm_run_callback+0x50/0x1a0 [ 72.650870] [] device_resume+0x90/0x268 [ 72.650874] [] dpm_resume+0x120/0x350 [ 72.650878] [] dpm_resume_end+0x10/0x28 [ 72.650884] [] suspend_devices_and_enter+0x138/0x7f4 [ 72.650887] [] pm_suspend+0x314/0x5bc [ 72.650893] [] state_store+0x7c/0xf0 [ 72.650901] [] kobj_attr_store+0x10/0x24 [ 72.650910] [] sysfs_kf_write+0x40/0x4c [ 72.650914] [] kernfs_fop_write+0xb8/0x180 [ 72.650922] [] __vfs_write+0x2c/0x11c [ 72.650926] [] vfs_write+0x90/0x170 [ 72.650931] [] SyS_write+0x40/0xa0 - This irq failed errors are occured in enable_irq() that in arizona_suspend_late(). Becase of access the irq after spi suspend. (arizona->irq == spi->irq) Best Regards, Inha Song. On Thu, 17 Sep 2015 10:16:32 +0100 Charles Keepax <ckee...@opensource.wolfsonmicro.com> wrote: > > OK so this is definitely that the SPI driver hasn't resumed > yet. Could we also get DEBUG turned on in arizona-core here. I am > interested to check where in the process the arizona > suspend/resume ops are being called. > > Thanks, > Charles -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, It is a log: # aplay [ 79.590767] s3c64xx_spi_runtime_resume [ 79.592288] arizona spi1.0: ASRC underclocked [ 79.592331] s3c64xx_spi_runtime_suspend --- -> suspend () [ 83.348754] s3c64xx_spi_runtime_resume [ 83.367711] s3c64xx_spi_suspend [ 83.368420] PM: suspend of devices complete after 59.666 msecs [ 83.375584] arizona spi1.0: Failed to read IRQ status: -108 [ 83.375595] arizona spi1.0: Failed to read main IRQ status: -108 [ 83.375672] arizona spi1.0: Failed to read IRQ status: -108 [ 83.375679] arizona spi1.0: Failed to read main IRQ status: -108 [ 83.375749] arizona spi1.0: Failed to read IRQ status: -108 . [ 83.580360] Call trace: [ 83.580369] [] dump_backtrace+0x0/0x12c [ 83.580373] [] show_stack+0x10/0x1c [ 83.580380] [] dump_stack+0x78/0xc8 [ 83.580386] [] warn_slowpath_common+0x98/0xd0 [ 83.580390] [] warn_slowpath_fmt+0x4c/0x58 [ 83.580394] [] __enable_irq+0x40/0x8c [ 83.580399] [] enable_irq+0x34/0x74 [ 83.580404] [] arizona_resume+0x10/0x20 [ 83.580410] [] dpm_run_callback+0x50/0x1a0 [ 83.580414] [] device_resume+0x90/0x268 [ 83.580418] [] dpm_resume+0x120/0x350 [ 83.580422] [] dpm_resume_end+0x10/0x28 [ 83.580426] [] suspend_devices_and_enter+0x138/0x7f4 [ 83.580430] [] pm_suspend+0x314/0x5bc [ 83.580435] [] state_store+0x7c/0xf0 [ 83.580441] [] kobj_attr_store+0x10/0x24 [ 83.580448] [] sysfs_kf_write+0x40/0x4c [ 83.580452] [] kernfs_fop_write+0xb8/0x180 [ 83.580458] [] __vfs_write+0x2c/0x11c [ 83.580463] [] vfs_write+0x90/0x170 [ 83.580467] [] SyS_write+0x40/0xa0 Best Regards, Inha Song. On Thu, 17 Sep 2015 09:25:42 +0100 Charles Keepax wrote: > On Thu, Sep 17, 2015 at 05:28:47PM +0900, Inha Song wrote: > > This patch call runtiem PM function manually if the state is runtime resumed > > before enter suspend. > > > > This case has occurred when wake-up by the resume after entering to > > suspend during the playback. > > $ aplay -> runtime_resume() -> suspend() -> resume() > > > > In this case, Can occurred an error when enter suspend. > > -- > > [ 82.559234] PM: suspend of devices complete after 57.252 msecs > > [ 82.567978] arizona spi1.0: Failed to read IRQ status: -108 > > [ 82.567989] arizona spi1.0: Failed to read main IRQ status: -108 > > [ 82.568027] arizona spi1.0: Failed to read IRQ status: -108 > > [ 82.568036] arizona spi1.0: Failed to read main IRQ status: -108 > > Would it be possible to get some more detail on what is happening > here? A full log would be nice with DEBUG enabled in > arizona-core.c, also perhaps put some printk's in the SPI driver > suspend/resume as well. > > It looks like what is happening is that the system is attempting > to handle an IRQ before the SPI has been resumed. But that is > exactly what the irq enables/disables in the system PM ops in > Arizona are trying to avoid. > > > > > So, we should call runtime_suspend() manually when enter suspend > > if the state is runtime resume. > > There are many use-cases where we want to leave the CODEC enabled > whilst the system is suspended so we really don't want to be > doing a runtime suspend with every system suspend. > > Thanks, > Charles -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
This patch call runtiem PM function manually if the state is runtime resumed before enter suspend. This case has occurred when wake-up by the resume after entering to suspend during the playback. $ aplay -> runtime_resume() -> suspend() -> resume() In this case, Can occurred an error when enter suspend. -- [ 82.559234] PM: suspend of devices complete after 57.252 msecs [ 82.567978] arizona spi1.0: Failed to read IRQ status: -108 [ 82.567989] arizona spi1.0: Failed to read main IRQ status: -108 [ 82.568027] arizona spi1.0: Failed to read IRQ status: -108 [ 82.568036] arizona spi1.0: Failed to read main IRQ status: -108 So, we should call runtime_suspend() manually when enter suspend if the state is runtime resume. Also should call runtime_resume() when wake-up by resume if the state was runtime resume before entering suspend. Signed-off-by: Inha Song --- drivers/mfd/arizona-core.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index 908c69b..de55706 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c @@ -683,6 +683,10 @@ static int arizona_suspend(struct device *dev) struct arizona *arizona = dev_get_drvdata(dev); dev_dbg(arizona->dev, "Suspend, disabling IRQ\n"); + + if (!pm_runtime_status_suspended(dev)) + arizona_runtime_suspend(dev); + disable_irq(arizona->irq); return 0; @@ -713,6 +717,10 @@ static int arizona_resume(struct device *dev) struct arizona *arizona = dev_get_drvdata(dev); dev_dbg(arizona->dev, "Late resume, reenabling IRQ\n"); + + if (!pm_runtime_status_suspended(dev)) + arizona_runtime_resume(dev); + enable_irq(arizona->irq); return 0; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
This patch call runtiem PM function manually if the state is runtime resumed before enter suspend. This case has occurred when wake-up by the resume after entering to suspend during the playback. $ aplay -> runtime_resume() -> suspend() -> resume() In this case, Can occurred an error when enter suspend. -- [ 82.559234] PM: suspend of devices complete after 57.252 msecs [ 82.567978] arizona spi1.0: Failed to read IRQ status: -108 [ 82.567989] arizona spi1.0: Failed to read main IRQ status: -108 [ 82.568027] arizona spi1.0: Failed to read IRQ status: -108 [ 82.568036] arizona spi1.0: Failed to read main IRQ status: -108 So, we should call runtime_suspend() manually when enter suspend if the state is runtime resume. Also should call runtime_resume() when wake-up by resume if the state was runtime resume before entering suspend. Signed-off-by: Inha Song <ideal.s...@samsung.com> --- drivers/mfd/arizona-core.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index 908c69b..de55706 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c @@ -683,6 +683,10 @@ static int arizona_suspend(struct device *dev) struct arizona *arizona = dev_get_drvdata(dev); dev_dbg(arizona->dev, "Suspend, disabling IRQ\n"); + + if (!pm_runtime_status_suspended(dev)) + arizona_runtime_suspend(dev); + disable_irq(arizona->irq); return 0; @@ -713,6 +717,10 @@ static int arizona_resume(struct device *dev) struct arizona *arizona = dev_get_drvdata(dev); dev_dbg(arizona->dev, "Late resume, reenabling IRQ\n"); + + if (!pm_runtime_status_suspended(dev)) + arizona_runtime_resume(dev); + enable_irq(arizona->irq); return 0; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH] mfd: arizona: Call the runtime PM function if the state is runtime resumed
Hi, It is a log: # aplay [ 79.590767] s3c64xx_spi_runtime_resume [ 79.592288] arizona spi1.0: ASRC underclocked [ 79.592331] s3c64xx_spi_runtime_suspend --- -> suspend () [ 83.348754] s3c64xx_spi_runtime_resume [ 83.367711] s3c64xx_spi_suspend [ 83.368420] PM: suspend of devices complete after 59.666 msecs [ 83.375584] arizona spi1.0: Failed to read IRQ status: -108 [ 83.375595] arizona spi1.0: Failed to read main IRQ status: -108 [ 83.375672] arizona spi1.0: Failed to read IRQ status: -108 [ 83.375679] arizona spi1.0: Failed to read main IRQ status: -108 [ 83.375749] arizona spi1.0: Failed to read IRQ status: -108 . [ 83.580360] Call trace: [ 83.580369] [] dump_backtrace+0x0/0x12c [ 83.580373] [] show_stack+0x10/0x1c [ 83.580380] [] dump_stack+0x78/0xc8 [ 83.580386] [] warn_slowpath_common+0x98/0xd0 [ 83.580390] [] warn_slowpath_fmt+0x4c/0x58 [ 83.580394] [] __enable_irq+0x40/0x8c [ 83.580399] [] enable_irq+0x34/0x74 [ 83.580404] [] arizona_resume+0x10/0x20 [ 83.580410] [] dpm_run_callback+0x50/0x1a0 [ 83.580414] [] device_resume+0x90/0x268 [ 83.580418] [] dpm_resume+0x120/0x350 [ 83.580422] [] dpm_resume_end+0x10/0x28 [ 83.580426] [] suspend_devices_and_enter+0x138/0x7f4 [ 83.580430] [] pm_suspend+0x314/0x5bc [ 83.580435] [] state_store+0x7c/0xf0 [ 83.580441] [] kobj_attr_store+0x10/0x24 [ 83.580448] [] sysfs_kf_write+0x40/0x4c [ 83.580452] [] kernfs_fop_write+0xb8/0x180 [ 83.580458] [] __vfs_write+0x2c/0x11c [ 83.580463] [] vfs_write+0x90/0x170 [ 83.580467] [] SyS_write+0x40/0xa0 Best Regards, Inha Song. On Thu, 17 Sep 2015 09:25:42 +0100 Charles Keepax <ckee...@opensource.wolfsonmicro.com> wrote: > On Thu, Sep 17, 2015 at 05:28:47PM +0900, Inha Song wrote: > > This patch call runtiem PM function manually if the state is runtime resumed > > before enter suspend. > > > > This case has occurred when wake-up by the resume after entering to > > suspend during the playback. > > $ aplay -> runtime_resume() -> suspend() -> resume() > > > > In this case, Can occurred an error when enter suspend. > > -- > > [ 82.559234] PM: suspend of devices complete after 57.252 msecs > > [ 82.567978] arizona spi1.0: Failed to read IRQ status: -108 > > [ 82.567989] arizona spi1.0: Failed to read main IRQ status: -108 > > [ 82.568027] arizona spi1.0: Failed to read IRQ status: -108 > > [ 82.568036] arizona spi1.0: Failed to read main IRQ status: -108 > > Would it be possible to get some more detail on what is happening > here? A full log would be nice with DEBUG enabled in > arizona-core.c, also perhaps put some printk's in the SPI driver > suspend/resume as well. > > It looks like what is happening is that the system is attempting > to handle an IRQ before the SPI has been resumed. But that is > exactly what the irq enables/disables in the system PM ops in > Arizona are trying to avoid. > > > > > So, we should call runtime_suspend() manually when enter suspend > > if the state is runtime resume. > > There are many use-cases where we want to leave the CODEC enabled > whilst the system is suspended so we really don't want to be > doing a runtime suspend with every system suspend. > > Thanks, > Charles -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel][RESEND PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata
If we use the dev_get_platdata, pdata can be NULL in DT environments. Actually, NULL pointer exception is occurs with error messages like this: [1.226583] Unable to handle kernel NULL pointer dereference at virtual address 0044 [1.467910] [] (wm8994_irq_init) from [] (wm8994_i2c_probe+0x684/0x858) [1.476241] [] (wm8994_i2c_probe) from [] (i2c_device_probe+0x11c/0x17c) In wm8994-core, we already checked whether platform data is NULL and set the wm8994->pdata to platform data if platform data is not NULL. So, we can use wm8994->pdata instead of platform data. Signed-off-by: Inha Song Acked-by: Charles Keepax --- drivers/mfd/wm8994-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c index 55c380a..55c59d9 100644 --- a/drivers/mfd/wm8994-irq.c +++ b/drivers/mfd/wm8994-irq.c @@ -193,7 +193,7 @@ int wm8994_irq_init(struct wm8994 *wm8994) { int ret; unsigned long irqflags; - struct wm8994_pdata *pdata = dev_get_platdata(wm8994->dev); + struct wm8994_pdata *pdata = >pdata; if (!wm8994->irq) { dev_warn(wm8994->dev, -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel][RESEND PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata
If we use the dev_get_platdata, pdata can be NULL in DT environments. Actually, NULL pointer exception is occurs with error messages like this: [1.226583] Unable to handle kernel NULL pointer dereference at virtual address 0044 [1.467910] [c02f1e38] (wm8994_irq_init) from [c02f1bd4] (wm8994_i2c_probe+0x684/0x858) [1.476241] [c02f1bd4] (wm8994_i2c_probe) from [c0371c78] (i2c_device_probe+0x11c/0x17c) In wm8994-core, we already checked whether platform data is NULL and set the wm8994-pdata to platform data if platform data is not NULL. So, we can use wm8994-pdata instead of platform data. Signed-off-by: Inha Song ideal.s...@samsung.com Acked-by: Charles Keepax ckee...@opensource.wolfsonmicro.com --- drivers/mfd/wm8994-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c index 55c380a..55c59d9 100644 --- a/drivers/mfd/wm8994-irq.c +++ b/drivers/mfd/wm8994-irq.c @@ -193,7 +193,7 @@ int wm8994_irq_init(struct wm8994 *wm8994) { int ret; unsigned long irqflags; - struct wm8994_pdata *pdata = dev_get_platdata(wm8994-dev); + struct wm8994_pdata *pdata = wm8994-pdata; if (!wm8994-irq) { dev_warn(wm8994-dev, -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata
If we use the dev_get_platdata, pdata can be NULL in DT environments. Actually, NULL pointer exception is occurs with error messages like this: [1.226583] Unable to handle kernel NULL pointer dereference at virtual address 0044 [1.467910] [] (wm8994_irq_init) from [] (wm8994_i2c_probe+0x684/0x858) [1.476241] [] (wm8994_i2c_probe) from [] (i2c_device_probe+0x11c/0x17c) In wm8994-core, we already checked wheter platform data is NULL and set the wm8994->pdata to platform data if platform data is not NULL. So, we can use wm8994->pdata instead of platform data. Signed-off-by: Inha Song --- drivers/mfd/wm8994-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c index a14407e..ec2c891 100644 --- a/drivers/mfd/wm8994-irq.c +++ b/drivers/mfd/wm8994-irq.c @@ -193,7 +193,7 @@ int wm8994_irq_init(struct wm8994 *wm8994) { int ret; unsigned long irqflags; - struct wm8994_pdata *pdata = dev_get_platdata(wm8994->dev); + struct wm8994_pdata *pdata = >pdata; if (!wm8994->irq) { dev_warn(wm8994->dev, -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata
If we use the dev_get_platdata, pdata can be NULL in DT environments. Actually, NULL pointer exception is occurs with error messages like this: [1.226583] Unable to handle kernel NULL pointer dereference at virtual address 0044 [1.467910] [c02f1e38] (wm8994_irq_init) from [c02f1bd4] (wm8994_i2c_probe+0x684/0x858) [1.476241] [c02f1bd4] (wm8994_i2c_probe) from [c0371c78] (i2c_device_probe+0x11c/0x17c) In wm8994-core, we already checked wheter platform data is NULL and set the wm8994-pdata to platform data if platform data is not NULL. So, we can use wm8994-pdata instead of platform data. Signed-off-by: Inha Song ideal.s...@samsung.com --- drivers/mfd/wm8994-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c index a14407e..ec2c891 100644 --- a/drivers/mfd/wm8994-irq.c +++ b/drivers/mfd/wm8994-irq.c @@ -193,7 +193,7 @@ int wm8994_irq_init(struct wm8994 *wm8994) { int ret; unsigned long irqflags; - struct wm8994_pdata *pdata = dev_get_platdata(wm8994-dev); + struct wm8994_pdata *pdata = wm8994-pdata; if (!wm8994-irq) { dev_warn(wm8994-dev, -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v5 0/2] Add support for select accessory detect mode to HPDETL or HPDETR
This set of patches adds support for select accessory detect mode to HPDETL or HPDETR. Changes in v5: - Rebased on extcon-next branch. Changes in v4: - Set the hpdet_channel default value to HPDETL in variable declaration. - Fix the indentation in binding documentation. Changes in v3: - Set the hpdet_channel default value to HPDETL If the value is unknown or invalid. Changes in v2: - Use the value in pdata instead of hpdet_channel in extcon_info. - Wrap arizona_extcon_of_get in IS_ENABLED(CONFIG_OF). - Change hpdet_channel type to unsigned from signed in pdata. - Move ARIZONA_ACCDET_MODE_* define to dt-binding header and directly set it to pdata. Inha Song (2): extcon: arizona: Add support for select accessory detect mode when headphone detection mfd: arizona: Update DT binding to support hpdet channel Documentation/devicetree/bindings/mfd/arizona.txt | 6 drivers/extcon/extcon-arizona.c | 38 ++- include/dt-bindings/mfd/arizona.h | 4 +++ include/linux/mfd/arizona/pdata.h | 3 ++ 4 files changed, 43 insertions(+), 8 deletions(-) -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v5 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song Acked-by: Lee Jones Acked-by: Charles Keepax --- drivers/extcon/extcon-arizona.c | 38 ++ include/dt-bindings/mfd/arizona.h | 4 include/linux/mfd/arizona/pdata.h | 3 +++ 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 5e08c35..1ec06b4 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -32,13 +32,10 @@ #include #include #include +#include #define ARIZONA_MAX_MICD_RANGE 8 -#define ARIZONA_ACCDET_MODE_MIC 0 -#define ARIZONA_ACCDET_MODE_HPL 1 -#define ARIZONA_ACCDET_MODE_HPR 2 - #define ARIZONA_MICD_CLAMP_MODE_JDL 0x4 #define ARIZONA_MICD_CLAMP_MODE_JDH 0x5 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 @@ -671,9 +668,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona->regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +arizona->pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); goto err; } @@ -723,9 +720,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info->micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +arizona->pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); goto err; } @@ -1121,6 +1118,26 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona->regmap, reg, mask, level); } +static int arizona_extcon_of_get_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = >pdata; + unsigned int val = ARIZONA_ACCDET_MODE_HPL; + + of_property_read_u32(arizona->dev->of_node, "wlf,hpdet-channel", ); + switch (val) { + case ARIZONA_ACCDET_MODE_HPL: + case ARIZONA_ACCDET_MODE_HPR: + pdata->hpdet_channel = val; + break; + default: + dev_err(arizona->dev, + "Wrong wlf,hpdet-channel DT value %d\n", val); + pdata->hpdet_channel = ARIZONA_ACCDET_MODE_HPL; + } + + return 0; +} + static int arizona_extcon_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); @@ -1138,6 +1155,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info) return -ENOMEM; + if (IS_ENABLED(CONFIG_OF)) { + if (!dev_get_platdata(arizona->dev)) + arizona_extcon_of_get_pdata(arizona); + } + info->micvdd = devm_regulator_get(>dev, "MICVDD"); if (IS_ERR(info->micvdd)) { ret = PTR_ERR(info->micvdd); diff --git a/include/dt-bindings/mfd/arizona.h b/include/dt-bindings/mfd/arizona.h index c7af7c7..fee48e6 100644 --- a/include/dt-bindings/mfd/arizona.h +++ b/include/dt-bindings/mfd/arizona.h @@ -90,4 +90,8 @@ #define ARIZONA_INMODE_SE 1 #define ARIZONA_INMODE_DMIC 2 +#define ARIZONA_ACCDET_MODE_MIC 0 +#define ARIZONA_ACCDET_MODE_HPL 1 +#define ARIZONA_ACCDET_MODE_HPR 2 + #endif diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 1789cb0..aa5c48b 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -121,6 +121,9 @@ struct arizona_pdata { /** GPIO used for mic isolation with HPDET */ int hpdet_id_gpio; + /** Channel to use for headphone detection */ + unsigned int hpdet_channel; + /** Extra debounce timeout used during initial mic detection (ms) */ int micd_detect_debounce; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v5 2/2] mfd: arizona: Update DT binding to support hpdet channel
This patch add device tree bindings for the pdata needed to configure the Accessory Detect Mode select when Headphone detection. Signed-off-by: Inha Song Acked-by: Lee Jones Acked-by: Charles Keepax --- Documentation/devicetree/bindings/mfd/arizona.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index 7665aa9..32a71b7 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -62,6 +62,12 @@ Optional properties: present, the number of values should be less than or equal to the number of inputs, unspecified inputs will use the chip default. + - wlf,hpdet-channel : Headphone detection channel. +ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL +ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR +If this node is not mentioned or if the value is unknown, then +headphone detection mode is set to HPDETL. + - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if they are being externally supplied. As covered in Documentation/devicetree/bindings/regulator/regulator.txt -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v5 0/2] Add support for select accessory detect mode to HPDETL or HPDETR
This set of patches adds support for select accessory detect mode to HPDETL or HPDETR. Changes in v5: - Rebased on extcon-next branch. Changes in v4: - Set the hpdet_channel default value to HPDETL in variable declaration. - Fix the indentation in binding documentation. Changes in v3: - Set the hpdet_channel default value to HPDETL If the value is unknown or invalid. Changes in v2: - Use the value in pdata instead of hpdet_channel in extcon_info. - Wrap arizona_extcon_of_get in IS_ENABLED(CONFIG_OF). - Change hpdet_channel type to unsigned from signed in pdata. - Move ARIZONA_ACCDET_MODE_* define to dt-binding header and directly set it to pdata. Inha Song (2): extcon: arizona: Add support for select accessory detect mode when headphone detection mfd: arizona: Update DT binding to support hpdet channel Documentation/devicetree/bindings/mfd/arizona.txt | 6 drivers/extcon/extcon-arizona.c | 38 ++- include/dt-bindings/mfd/arizona.h | 4 +++ include/linux/mfd/arizona/pdata.h | 3 ++ 4 files changed, 43 insertions(+), 8 deletions(-) -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v5 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song ideal.s...@samsung.com Acked-by: Lee Jones l...@kernel.org Acked-by: Charles Keepax ckee...@opensource.wolfsonmicro.com --- drivers/extcon/extcon-arizona.c | 38 ++ include/dt-bindings/mfd/arizona.h | 4 include/linux/mfd/arizona/pdata.h | 3 +++ 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 5e08c35..1ec06b4 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -32,13 +32,10 @@ #include linux/mfd/arizona/core.h #include linux/mfd/arizona/pdata.h #include linux/mfd/arizona/registers.h +#include dt-bindings/mfd/arizona.h #define ARIZONA_MAX_MICD_RANGE 8 -#define ARIZONA_ACCDET_MODE_MIC 0 -#define ARIZONA_ACCDET_MODE_HPL 1 -#define ARIZONA_ACCDET_MODE_HPR 2 - #define ARIZONA_MICD_CLAMP_MODE_JDL 0x4 #define ARIZONA_MICD_CLAMP_MODE_JDH 0x5 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 @@ -671,9 +668,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona-regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +arizona-pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -723,9 +720,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info-micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +arizona-pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -1121,6 +1118,26 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona-regmap, reg, mask, level); } +static int arizona_extcon_of_get_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = arizona-pdata; + unsigned int val = ARIZONA_ACCDET_MODE_HPL; + + of_property_read_u32(arizona-dev-of_node, wlf,hpdet-channel, val); + switch (val) { + case ARIZONA_ACCDET_MODE_HPL: + case ARIZONA_ACCDET_MODE_HPR: + pdata-hpdet_channel = val; + break; + default: + dev_err(arizona-dev, + Wrong wlf,hpdet-channel DT value %d\n, val); + pdata-hpdet_channel = ARIZONA_ACCDET_MODE_HPL; + } + + return 0; +} + static int arizona_extcon_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev-dev.parent); @@ -1138,6 +1155,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info) return -ENOMEM; + if (IS_ENABLED(CONFIG_OF)) { + if (!dev_get_platdata(arizona-dev)) + arizona_extcon_of_get_pdata(arizona); + } + info-micvdd = devm_regulator_get(pdev-dev, MICVDD); if (IS_ERR(info-micvdd)) { ret = PTR_ERR(info-micvdd); diff --git a/include/dt-bindings/mfd/arizona.h b/include/dt-bindings/mfd/arizona.h index c7af7c7..fee48e6 100644 --- a/include/dt-bindings/mfd/arizona.h +++ b/include/dt-bindings/mfd/arizona.h @@ -90,4 +90,8 @@ #define ARIZONA_INMODE_SE 1 #define ARIZONA_INMODE_DMIC 2 +#define ARIZONA_ACCDET_MODE_MIC 0 +#define ARIZONA_ACCDET_MODE_HPL 1 +#define ARIZONA_ACCDET_MODE_HPR 2 + #endif diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 1789cb0..aa5c48b 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -121,6 +121,9 @@ struct arizona_pdata { /** GPIO used for mic isolation with HPDET */ int hpdet_id_gpio; + /** Channel to use for headphone detection */ + unsigned int hpdet_channel; + /** Extra debounce timeout used during initial mic detection (ms) */ int micd_detect_debounce; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More
[alsa-devel] [PATCH v5 2/2] mfd: arizona: Update DT binding to support hpdet channel
This patch add device tree bindings for the pdata needed to configure the Accessory Detect Mode select when Headphone detection. Signed-off-by: Inha Song ideal.s...@samsung.com Acked-by: Lee Jones l...@kernel.org Acked-by: Charles Keepax ckee...@opensource.wolfsonmicro.com --- Documentation/devicetree/bindings/mfd/arizona.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index 7665aa9..32a71b7 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -62,6 +62,12 @@ Optional properties: present, the number of values should be less than or equal to the number of inputs, unspecified inputs will use the chip default. + - wlf,hpdet-channel : Headphone detection channel. +ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL +ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR +If this node is not mentioned or if the value is unknown, then +headphone detection mode is set to HPDETL. + - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if they are being externally supplied. As covered in Documentation/devicetree/bindings/regulator/regulator.txt -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v4 2/2] mfd: arizona: Update DT binding to support hpdet channel
This patch add device tree bindings for the pdata needed to configure the Accessory Detect Mode select when Headphone detection. Signed-off-by: Inha Song --- Documentation/devicetree/bindings/mfd/arizona.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index 7bd1273..7ddeda8 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -49,6 +49,12 @@ Optional properties: input singals. If values less than the number of input signals, elements that has not been specifed are set to 0 by default. + - wlf,hpdet-channel : Headphone detection channel. +ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL +ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR +If this node is not mentioned or if the value is unknown, then +headphone detection mode is set to HPDETL. + - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if they are being externally supplied. As covered in Documentation/devicetree/bindings/regulator/regulator.txt -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v4 0/2] Add support for select accessory detect mode to HPDETL or HPDETR
This set of patches adds support for select accessory detect mode to HPDETL or HPDETR. Changes in v4: - Set the hpdet_channel default value to HPDETL in variable declaration. - Fix the indentation in binding documentation. Changes in v3: - Set the hpdet_channel default value to HPDETL If the value is unknown or invalid. Changes in v2: - Use the value in pdata instead of hpdet_channel in extcon_info. - Wrap arizona_extcon_of_get in IS_ENABLED(CONFIG_OF). - Change hpdet_channel type to unsigned from signed in pdata. - Move ARIZONA_ACCDET_MODE_* define to dt-binding header and directly set it to pdata. Inha Song (2): extcon: arizona: Add support for select accessory detect mode when headphone detection mfd: arizona: Update DT binding to support hpdet channel Documentation/devicetree/bindings/mfd/arizona.txt | 6 drivers/extcon/extcon-arizona.c | 38 ++- include/dt-bindings/mfd/arizona.h | 8 + include/linux/mfd/arizona/pdata.h | 3 ++ 4 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v4 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song --- drivers/extcon/extcon-arizona.c | 38 ++ include/dt-bindings/mfd/arizona.h | 8 include/linux/mfd/arizona/pdata.h | 3 +++ 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 63f01c4..d251e92 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -32,13 +32,10 @@ #include #include #include +#include #define ARIZONA_MAX_MICD_RANGE 8 -#define ARIZONA_ACCDET_MODE_MIC 0 -#define ARIZONA_ACCDET_MODE_HPL 1 -#define ARIZONA_ACCDET_MODE_HPR 2 - #define ARIZONA_MICD_CLAMP_MODE_JDL 0x4 #define ARIZONA_MICD_CLAMP_MODE_JDH 0x5 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 @@ -653,9 +650,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona->regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +arizona->pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); goto err; } @@ -705,9 +702,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info->micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +arizona->pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); goto err; } @@ -1103,6 +1100,26 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona->regmap, reg, mask, level); } +static int arizona_extcon_of_get_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = >pdata; + unsigned int val = ARIZONA_ACCDET_MODE_HPL; + + of_property_read_u32(arizona->dev->of_node, "wlf,hpdet-channel", ); + switch (val) { + case ARIZONA_ACCDET_MODE_HPL: + case ARIZONA_ACCDET_MODE_HPR: + pdata->hpdet_channel = val; + break; + default: + dev_err(arizona->dev, + "Wrong wlf,hpdet-channel DT value %d\n", val); + pdata->hpdet_channel = ARIZONA_ACCDET_MODE_HPL; + } + + return 0; +} + static int arizona_extcon_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); @@ -1120,6 +1137,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info) return -ENOMEM; + if (IS_ENABLED(CONFIG_OF)) { + if (!dev_get_platdata(arizona->dev)) + arizona_extcon_of_get_pdata(arizona); + } + info->micvdd = devm_regulator_get(>dev, "MICVDD"); if (IS_ERR(info->micvdd)) { ret = PTR_ERR(info->micvdd); diff --git a/include/dt-bindings/mfd/arizona.h b/include/dt-bindings/mfd/arizona.h new file mode 100644 index 000..9ecff78 --- /dev/null +++ b/include/dt-bindings/mfd/arizona.h @@ -0,0 +1,8 @@ +#ifndef __DT_BINDINGS_ARIZONA_H__ +#define __DT_BINDINGS_ARIZONA_H__ + +#define ARIZONA_ACCDET_MODE_MIC 0 +#define ARIZONA_ACCDET_MODE_HPL 1 +#define ARIZONA_ACCDET_MODE_HPR 2 + +#endif /* __DT_BINDINGS_ARIZONA_H__ */ diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 4578c72..2473a67 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -139,6 +139,9 @@ struct arizona_pdata { /** GPIO used for mic isolation with HPDET */ int hpdet_id_gpio; + /** Channel to use for headphone detection */ + unsigned int hpdet_channel; + /** Extra debounce timeout used during initial mic detection (ms) */ int micd_detect_debounce; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v4 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song ideal.s...@samsung.com --- drivers/extcon/extcon-arizona.c | 38 ++ include/dt-bindings/mfd/arizona.h | 8 include/linux/mfd/arizona/pdata.h | 3 +++ 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 63f01c4..d251e92 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -32,13 +32,10 @@ #include linux/mfd/arizona/core.h #include linux/mfd/arizona/pdata.h #include linux/mfd/arizona/registers.h +#include dt-bindings/mfd/arizona.h #define ARIZONA_MAX_MICD_RANGE 8 -#define ARIZONA_ACCDET_MODE_MIC 0 -#define ARIZONA_ACCDET_MODE_HPL 1 -#define ARIZONA_ACCDET_MODE_HPR 2 - #define ARIZONA_MICD_CLAMP_MODE_JDL 0x4 #define ARIZONA_MICD_CLAMP_MODE_JDH 0x5 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 @@ -653,9 +650,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona-regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +arizona-pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -705,9 +702,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info-micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +arizona-pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -1103,6 +1100,26 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona-regmap, reg, mask, level); } +static int arizona_extcon_of_get_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = arizona-pdata; + unsigned int val = ARIZONA_ACCDET_MODE_HPL; + + of_property_read_u32(arizona-dev-of_node, wlf,hpdet-channel, val); + switch (val) { + case ARIZONA_ACCDET_MODE_HPL: + case ARIZONA_ACCDET_MODE_HPR: + pdata-hpdet_channel = val; + break; + default: + dev_err(arizona-dev, + Wrong wlf,hpdet-channel DT value %d\n, val); + pdata-hpdet_channel = ARIZONA_ACCDET_MODE_HPL; + } + + return 0; +} + static int arizona_extcon_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev-dev.parent); @@ -1120,6 +1137,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info) return -ENOMEM; + if (IS_ENABLED(CONFIG_OF)) { + if (!dev_get_platdata(arizona-dev)) + arizona_extcon_of_get_pdata(arizona); + } + info-micvdd = devm_regulator_get(pdev-dev, MICVDD); if (IS_ERR(info-micvdd)) { ret = PTR_ERR(info-micvdd); diff --git a/include/dt-bindings/mfd/arizona.h b/include/dt-bindings/mfd/arizona.h new file mode 100644 index 000..9ecff78 --- /dev/null +++ b/include/dt-bindings/mfd/arizona.h @@ -0,0 +1,8 @@ +#ifndef __DT_BINDINGS_ARIZONA_H__ +#define __DT_BINDINGS_ARIZONA_H__ + +#define ARIZONA_ACCDET_MODE_MIC 0 +#define ARIZONA_ACCDET_MODE_HPL 1 +#define ARIZONA_ACCDET_MODE_HPR 2 + +#endif /* __DT_BINDINGS_ARIZONA_H__ */ diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 4578c72..2473a67 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -139,6 +139,9 @@ struct arizona_pdata { /** GPIO used for mic isolation with HPDET */ int hpdet_id_gpio; + /** Channel to use for headphone detection */ + unsigned int hpdet_channel; + /** Extra debounce timeout used during initial mic detection (ms) */ int micd_detect_debounce; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info
[alsa-devel] [PATCH v4 0/2] Add support for select accessory detect mode to HPDETL or HPDETR
This set of patches adds support for select accessory detect mode to HPDETL or HPDETR. Changes in v4: - Set the hpdet_channel default value to HPDETL in variable declaration. - Fix the indentation in binding documentation. Changes in v3: - Set the hpdet_channel default value to HPDETL If the value is unknown or invalid. Changes in v2: - Use the value in pdata instead of hpdet_channel in extcon_info. - Wrap arizona_extcon_of_get in IS_ENABLED(CONFIG_OF). - Change hpdet_channel type to unsigned from signed in pdata. - Move ARIZONA_ACCDET_MODE_* define to dt-binding header and directly set it to pdata. Inha Song (2): extcon: arizona: Add support for select accessory detect mode when headphone detection mfd: arizona: Update DT binding to support hpdet channel Documentation/devicetree/bindings/mfd/arizona.txt | 6 drivers/extcon/extcon-arizona.c | 38 ++- include/dt-bindings/mfd/arizona.h | 8 + include/linux/mfd/arizona/pdata.h | 3 ++ 4 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v4 2/2] mfd: arizona: Update DT binding to support hpdet channel
This patch add device tree bindings for the pdata needed to configure the Accessory Detect Mode select when Headphone detection. Signed-off-by: Inha Song ideal.s...@samsung.com --- Documentation/devicetree/bindings/mfd/arizona.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index 7bd1273..7ddeda8 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -49,6 +49,12 @@ Optional properties: input singals. If values less than the number of input signals, elements that has not been specifed are set to 0 by default. + - wlf,hpdet-channel : Headphone detection channel. +ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL +ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR +If this node is not mentioned or if the value is unknown, then +headphone detection mode is set to HPDETL. + - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if they are being externally supplied. As covered in Documentation/devicetree/bindings/regulator/regulator.txt -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH v3 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
Hi, Thanks for your comments :) On Sat, 25 Apr 2015 13:50:25 +0100 Charles Keepax wrote: > On Wed, Apr 22, 2015 at 08:23:20PM +0900, Inha Song wrote: > > This patch add support for select accessory detect mode to HPDETL or HPDETR. > > Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins > > to measure the impedance of an external load connected to the headphone. > > > > Depending on board design, headphone detect pins can change to HPDETR or > > HPDETL. > > > > Signed-off-by: Inha Song > > --- > > > > +static int arizona_extcon_of_get_pdata(struct arizona *arizona) > > +{ > > + struct arizona_pdata *pdata = >pdata; > > + unsigned int val; > > I would rather this is "unsigned int val = > ARIZONA_ACCDET_MODE_HPL;". > > > + > > + of_property_read_u32(arizona->dev->of_node, "wlf,hpdet-channel", ); > > Because this won't fill val if the DT entry isn't present. > > > + switch (val) { > > Which means we hit this with val uninitialised. > > > + case ARIZONA_ACCDET_MODE_HPL: > > + case ARIZONA_ACCDET_MODE_HPR: > > So we may select either channel at random. Opps, Ok, I will set the default value to ARIZONA_ACCDET_MODE_HPL. > > > + pdata->hpdet_channel = val; > > + break; > > + default: > > + dev_err(arizona->dev, > > + "Wrong wlf,hpdet-channel DT value %d\n", val); > > Or most likely just print an error but the DT being missing > shouldn't really be an error it is an optional entry. If the default value is set to ARIZONA_ACCDET_MODE_HPL, Only the print will be shown, when an invalid value is set by DT. So, This is a resonable error message. Best Regards, Inha Song. > > > + pdata->hpdet_channel = ARIZONA_ACCDET_MODE_HPL; > > + } > > + > > + return 0; > > +} > > Thanks, > Charles -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH v3 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
Hi, Thanks for your comments :) On Sat, 25 Apr 2015 13:50:25 +0100 Charles Keepax ckee...@opensource.wolfsonmicro.com wrote: On Wed, Apr 22, 2015 at 08:23:20PM +0900, Inha Song wrote: This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song ideal.s...@samsung.com --- +static int arizona_extcon_of_get_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = arizona-pdata; + unsigned int val; I would rather this is unsigned int val = ARIZONA_ACCDET_MODE_HPL;. + + of_property_read_u32(arizona-dev-of_node, wlf,hpdet-channel, val); Because this won't fill val if the DT entry isn't present. + switch (val) { Which means we hit this with val uninitialised. + case ARIZONA_ACCDET_MODE_HPL: + case ARIZONA_ACCDET_MODE_HPR: So we may select either channel at random. Opps, Ok, I will set the default value to ARIZONA_ACCDET_MODE_HPL. + pdata-hpdet_channel = val; + break; + default: + dev_err(arizona-dev, + Wrong wlf,hpdet-channel DT value %d\n, val); Or most likely just print an error but the DT being missing shouldn't really be an error it is an optional entry. If the default value is set to ARIZONA_ACCDET_MODE_HPL, Only the print will be shown, when an invalid value is set by DT. So, This is a resonable error message. Best Regards, Inha Song. + pdata-hpdet_channel = ARIZONA_ACCDET_MODE_HPL; + } + + return 0; +} Thanks, Charles -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song --- drivers/extcon/extcon-arizona.c | 38 ++ include/dt-bindings/mfd/arizona.h | 8 include/linux/mfd/arizona/pdata.h | 3 +++ 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 63f01c4..d9284af 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -32,13 +32,10 @@ #include #include #include +#include #define ARIZONA_MAX_MICD_RANGE 8 -#define ARIZONA_ACCDET_MODE_MIC 0 -#define ARIZONA_ACCDET_MODE_HPL 1 -#define ARIZONA_ACCDET_MODE_HPR 2 - #define ARIZONA_MICD_CLAMP_MODE_JDL 0x4 #define ARIZONA_MICD_CLAMP_MODE_JDH 0x5 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 @@ -653,9 +650,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona->regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +arizona->pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); goto err; } @@ -705,9 +702,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info->micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +arizona->pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); goto err; } @@ -1103,6 +1100,26 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona->regmap, reg, mask, level); } +static int arizona_extcon_of_get_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = >pdata; + unsigned int val; + + of_property_read_u32(arizona->dev->of_node, "wlf,hpdet-channel", ); + switch (val) { + case ARIZONA_ACCDET_MODE_HPL: + case ARIZONA_ACCDET_MODE_HPR: + pdata->hpdet_channel = val; + break; + default: + dev_err(arizona->dev, + "Wrong wlf,hpdet-channel DT value %d\n", val); + pdata->hpdet_channel = ARIZONA_ACCDET_MODE_HPL; + } + + return 0; +} + static int arizona_extcon_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); @@ -1120,6 +1137,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info) return -ENOMEM; + if (IS_ENABLED(CONFIG_OF)) { + if (!dev_get_platdata(arizona->dev)) + arizona_extcon_of_get_pdata(arizona); + } + info->micvdd = devm_regulator_get(>dev, "MICVDD"); if (IS_ERR(info->micvdd)) { ret = PTR_ERR(info->micvdd); diff --git a/include/dt-bindings/mfd/arizona.h b/include/dt-bindings/mfd/arizona.h new file mode 100644 index 000..9ecff78 --- /dev/null +++ b/include/dt-bindings/mfd/arizona.h @@ -0,0 +1,8 @@ +#ifndef __DT_BINDINGS_ARIZONA_H__ +#define __DT_BINDINGS_ARIZONA_H__ + +#define ARIZONA_ACCDET_MODE_MIC 0 +#define ARIZONA_ACCDET_MODE_HPL 1 +#define ARIZONA_ACCDET_MODE_HPR 2 + +#endif /* __DT_BINDINGS_ARIZONA_H__ */ diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 4578c72..2473a67 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -139,6 +139,9 @@ struct arizona_pdata { /** GPIO used for mic isolation with HPDET */ int hpdet_id_gpio; + /** Channel to use for headphone detection */ + unsigned int hpdet_channel; + /** Extra debounce timeout used during initial mic detection (ms) */ int micd_detect_debounce; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 0/2] Add support for select accessory detect mode to HPDETL or HPDETR
This set of patches adds support for select accessory detect mode to HPDETL or HPDETR. Changes in v3: - Set the hpdet_channel default value to HPDETL If the value is unknown or invalid. Changes in v2: - Use the value in pdata instead of hpdet_channel in extcon_info. - Wrap arizona_extcon_of_get in IS_ENABLED(CONFIG_OF). - Change hpdet_channel type to unsigned from signed in pdata. - Move ARIZONA_ACCDET_MODE_* define to dt-binding header and directly set it to pdata. Inha Song (2): extcon: arizona: Add support for select accessory detect mode when headphone detection mfd: arizona: Update DT binding to support hpdet channel Documentation/devicetree/bindings/mfd/arizona.txt | 6 drivers/extcon/extcon-arizona.c | 38 ++- include/dt-bindings/mfd/arizona.h | 8 + include/linux/mfd/arizona/pdata.h | 3 ++ 4 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 2/2] mfd: arizona: Update DT binding to support hpdet channel
This patch add device tree bindings for the pdata needed to configure the Accessory Detect Mode select when Headphone detection. Signed-off-by: Inha Song --- Documentation/devicetree/bindings/mfd/arizona.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index 7bd1273..401b0b8 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -49,6 +49,12 @@ Optional properties: input singals. If values less than the number of input signals, elements that has not been specifed are set to 0 by default. + - wlf,hpdet-channel : Headphone detection channel. + 1 or ARIZONA_ACCDET_MODE_HPL - Headphone detect mode is set to HPDETL + 2 or ARIZONA_ACCDET_MODE_HPR - Headphone detect mode is set to HPDETR + If this node is not mentioned or if the value is unknown, then + headphone detection mode is set to HPDETL. + - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if they are being externally supplied. As covered in Documentation/devicetree/bindings/regulator/regulator.txt -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 2/2] mfd: arizona: Update DT binding to support hpdet channel
This patch add device tree bindings for the pdata needed to configure the Accessory Detect Mode select when Headphone detection. Signed-off-by: Inha Song ideal.s...@samsung.com --- Documentation/devicetree/bindings/mfd/arizona.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index 7bd1273..401b0b8 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -49,6 +49,12 @@ Optional properties: input singals. If values less than the number of input signals, elements that has not been specifed are set to 0 by default. + - wlf,hpdet-channel : Headphone detection channel. + 1 or ARIZONA_ACCDET_MODE_HPL - Headphone detect mode is set to HPDETL + 2 or ARIZONA_ACCDET_MODE_HPR - Headphone detect mode is set to HPDETR + If this node is not mentioned or if the value is unknown, then + headphone detection mode is set to HPDETL. + - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if they are being externally supplied. As covered in Documentation/devicetree/bindings/regulator/regulator.txt -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 0/2] Add support for select accessory detect mode to HPDETL or HPDETR
This set of patches adds support for select accessory detect mode to HPDETL or HPDETR. Changes in v3: - Set the hpdet_channel default value to HPDETL If the value is unknown or invalid. Changes in v2: - Use the value in pdata instead of hpdet_channel in extcon_info. - Wrap arizona_extcon_of_get in IS_ENABLED(CONFIG_OF). - Change hpdet_channel type to unsigned from signed in pdata. - Move ARIZONA_ACCDET_MODE_* define to dt-binding header and directly set it to pdata. Inha Song (2): extcon: arizona: Add support for select accessory detect mode when headphone detection mfd: arizona: Update DT binding to support hpdet channel Documentation/devicetree/bindings/mfd/arizona.txt | 6 drivers/extcon/extcon-arizona.c | 38 ++- include/dt-bindings/mfd/arizona.h | 8 + include/linux/mfd/arizona/pdata.h | 3 ++ 4 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song ideal.s...@samsung.com --- drivers/extcon/extcon-arizona.c | 38 ++ include/dt-bindings/mfd/arizona.h | 8 include/linux/mfd/arizona/pdata.h | 3 +++ 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 63f01c4..d9284af 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -32,13 +32,10 @@ #include linux/mfd/arizona/core.h #include linux/mfd/arizona/pdata.h #include linux/mfd/arizona/registers.h +#include dt-bindings/mfd/arizona.h #define ARIZONA_MAX_MICD_RANGE 8 -#define ARIZONA_ACCDET_MODE_MIC 0 -#define ARIZONA_ACCDET_MODE_HPL 1 -#define ARIZONA_ACCDET_MODE_HPR 2 - #define ARIZONA_MICD_CLAMP_MODE_JDL 0x4 #define ARIZONA_MICD_CLAMP_MODE_JDH 0x5 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 @@ -653,9 +650,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona-regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +arizona-pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -705,9 +702,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info-micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +arizona-pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -1103,6 +1100,26 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona-regmap, reg, mask, level); } +static int arizona_extcon_of_get_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = arizona-pdata; + unsigned int val; + + of_property_read_u32(arizona-dev-of_node, wlf,hpdet-channel, val); + switch (val) { + case ARIZONA_ACCDET_MODE_HPL: + case ARIZONA_ACCDET_MODE_HPR: + pdata-hpdet_channel = val; + break; + default: + dev_err(arizona-dev, + Wrong wlf,hpdet-channel DT value %d\n, val); + pdata-hpdet_channel = ARIZONA_ACCDET_MODE_HPL; + } + + return 0; +} + static int arizona_extcon_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev-dev.parent); @@ -1120,6 +1137,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info) return -ENOMEM; + if (IS_ENABLED(CONFIG_OF)) { + if (!dev_get_platdata(arizona-dev)) + arizona_extcon_of_get_pdata(arizona); + } + info-micvdd = devm_regulator_get(pdev-dev, MICVDD); if (IS_ERR(info-micvdd)) { ret = PTR_ERR(info-micvdd); diff --git a/include/dt-bindings/mfd/arizona.h b/include/dt-bindings/mfd/arizona.h new file mode 100644 index 000..9ecff78 --- /dev/null +++ b/include/dt-bindings/mfd/arizona.h @@ -0,0 +1,8 @@ +#ifndef __DT_BINDINGS_ARIZONA_H__ +#define __DT_BINDINGS_ARIZONA_H__ + +#define ARIZONA_ACCDET_MODE_MIC 0 +#define ARIZONA_ACCDET_MODE_HPL 1 +#define ARIZONA_ACCDET_MODE_HPR 2 + +#endif /* __DT_BINDINGS_ARIZONA_H__ */ diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 4578c72..2473a67 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -139,6 +139,9 @@ struct arizona_pdata { /** GPIO used for mic isolation with HPDET */ int hpdet_id_gpio; + /** Channel to use for headphone detection */ + unsigned int hpdet_channel; + /** Extra debounce timeout used during initial mic detection (ms) */ int micd_detect_debounce; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org
Re: [alsa-devel] [PATCH v2 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
Hi, Thanks for your review :) On Tue, 21 Apr 2015 10:28:26 +0100 Charles Keepax wrote: > On Tue, Apr 21, 2015 at 01:11:44PM +0900, Inha Song wrote: > > This patch add support for select accessory detect mode to HPDETL or HPDETR. > > Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins > > to measure the impedance of an external load connected to the headphone. > > > > Depending on board design, headphone detect pins can change to HPDETR or > > HPDETL. > > > > Signed-off-by: Inha Song > > --- > > drivers/extcon/extcon-arizona.c | 28 > > include/dt-bindings/mfd/arizona.h | 8 > > include/linux/mfd/arizona/pdata.h | 3 +++ > > 3 files changed, 31 insertions(+), 8 deletions(-) > > create mode 100644 include/dt-bindings/mfd/arizona.h > > > > diff --git a/drivers/extcon/extcon-arizona.c > > b/drivers/extcon/extcon-arizona.c > > index 63f01c4..c827342 100644 > > --- a/drivers/extcon/extcon-arizona.c > > +++ b/drivers/extcon/extcon-arizona.c > > @@ -32,13 +32,10 @@ > > #include > > #include > > #include > > +#include > > > > #define ARIZONA_MAX_MICD_RANGE 8 > > > > -#define ARIZONA_ACCDET_MODE_MIC 0 > > -#define ARIZONA_ACCDET_MODE_HPL 1 > > -#define ARIZONA_ACCDET_MODE_HPR 2 > > - > > #define ARIZONA_MICD_CLAMP_MODE_JDL 0x4 > > #define ARIZONA_MICD_CLAMP_MODE_JDH 0x5 > > #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 > > @@ -653,9 +650,9 @@ static void arizona_identify_headphone(struct > > arizona_extcon_info *info) > > ret = regmap_update_bits(arizona->regmap, > > ARIZONA_ACCESSORY_DETECT_MODE_1, > > ARIZONA_ACCDET_MODE_MASK, > > -ARIZONA_ACCDET_MODE_HPL); > > +arizona->pdata.hpdet_channel); > > if (ret != 0) { > > - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); > > + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); > > goto err; > > } > > > > @@ -705,9 +702,9 @@ static void arizona_start_hpdet_acc_id(struct > > arizona_extcon_info *info) > > ARIZONA_ACCESSORY_DETECT_MODE_1, > > ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, > > info->micd_modes[0].src | > > -ARIZONA_ACCDET_MODE_HPL); > > +arizona->pdata.hpdet_channel); > > if (ret != 0) { > > - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); > > + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); > > goto err; > > } > > > > @@ -1103,6 +1100,16 @@ static void arizona_micd_set_level(struct arizona > > *arizona, int index, > > regmap_update_bits(arizona->regmap, reg, mask, level); > > } > > > > +static int arizona_extcon_of_get_pdata(struct arizona *arizona) > > +{ > > + struct arizona_pdata *pdata = >pdata; > > + > > + of_property_read_u32(arizona->dev->of_node, "wlf,hpdet-channel", > > +>hpdet_channel); > > I think we need to verify this is either HPL or HPR and default > it to HPL if isn't one of those. Otherwise this looks fine. > Ok, We can check hpdet_channel value to use switch-case in arizona_extcon_of_get_pdata() function. I will fix. Best Regards, Inha Song. > Thanks, > Charles -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH v2 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
Hi, Thanks for your review :) On Tue, 21 Apr 2015 10:28:26 +0100 Charles Keepax ckee...@opensource.wolfsonmicro.com wrote: On Tue, Apr 21, 2015 at 01:11:44PM +0900, Inha Song wrote: This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song ideal.s...@samsung.com --- drivers/extcon/extcon-arizona.c | 28 include/dt-bindings/mfd/arizona.h | 8 include/linux/mfd/arizona/pdata.h | 3 +++ 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 63f01c4..c827342 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -32,13 +32,10 @@ #include linux/mfd/arizona/core.h #include linux/mfd/arizona/pdata.h #include linux/mfd/arizona/registers.h +#include dt-bindings/mfd/arizona.h #define ARIZONA_MAX_MICD_RANGE 8 -#define ARIZONA_ACCDET_MODE_MIC 0 -#define ARIZONA_ACCDET_MODE_HPL 1 -#define ARIZONA_ACCDET_MODE_HPR 2 - #define ARIZONA_MICD_CLAMP_MODE_JDL 0x4 #define ARIZONA_MICD_CLAMP_MODE_JDH 0x5 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 @@ -653,9 +650,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona-regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +arizona-pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -705,9 +702,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info-micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +arizona-pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -1103,6 +1100,16 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona-regmap, reg, mask, level); } +static int arizona_extcon_of_get_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = arizona-pdata; + + of_property_read_u32(arizona-dev-of_node, wlf,hpdet-channel, +pdata-hpdet_channel); I think we need to verify this is either HPL or HPR and default it to HPL if isn't one of those. Otherwise this looks fine. Ok, We can check hpdet_channel value to use switch-case in arizona_extcon_of_get_pdata() function. I will fix. Best Regards, Inha Song. Thanks, Charles -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v2 0/2] Add support for select accessory detect mode to HPDETL or HPDETR
This set of patches adds support for select accessory detect mode to HPDETL or HPDETR. Changes in v2: - Use the value in pdata instead of hpdet_channel in extcon_info. - Wrap arizona_extcon_of_get in IS_ENABLED(CONFIG_OF). - Change hpdet_channel type to unsigned from signed in pdata. - Move ARIZONA_ACCDET_MODE_* define to dt-binding header and directly set it to pdata. Inha Song (2): extcon: arizona: Add support for select accessory detect mode when headphone detection mfd: arizona: Update DT binding to support hpdet channel Documentation/devicetree/bindings/mfd/arizona.txt | 6 + drivers/extcon/extcon-arizona.c | 28 --- include/dt-bindings/mfd/arizona.h | 8 +++ include/linux/mfd/arizona/pdata.h | 3 +++ 4 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v2 2/2] mfd: arizona: Update DT binding to support hpdet channel
This patch add device tree bindings for the pdata needed to configure the Accessory Detect Mode select when Headphone detection. Signed-off-by: Inha Song --- Documentation/devicetree/bindings/mfd/arizona.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index 7bd1273..3529592 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -49,6 +49,12 @@ Optional properties: input singals. If values less than the number of input signals, elements that has not been specifed are set to 0 by default. + - wlf,hpdet-channel : Headphone detection channel. + 1 or ARIZONA_ACCDET_MODE_HPL - Headphone detect mode is set to HPDETL + 2 or ARIZONA_ACCDET_MODE_HPR - Headphone detect mode is set to HPDETR + If this node is not mentioned or if the value is unknown, then + headphone detection mode is set to MICDET. + - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if they are being externally supplied. As covered in Documentation/devicetree/bindings/regulator/regulator.txt -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v2 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song --- drivers/extcon/extcon-arizona.c | 28 include/dt-bindings/mfd/arizona.h | 8 include/linux/mfd/arizona/pdata.h | 3 +++ 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 63f01c4..c827342 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -32,13 +32,10 @@ #include #include #include +#include #define ARIZONA_MAX_MICD_RANGE 8 -#define ARIZONA_ACCDET_MODE_MIC 0 -#define ARIZONA_ACCDET_MODE_HPL 1 -#define ARIZONA_ACCDET_MODE_HPR 2 - #define ARIZONA_MICD_CLAMP_MODE_JDL 0x4 #define ARIZONA_MICD_CLAMP_MODE_JDH 0x5 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 @@ -653,9 +650,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona->regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +arizona->pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); goto err; } @@ -705,9 +702,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info->micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +arizona->pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); goto err; } @@ -1103,6 +1100,16 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona->regmap, reg, mask, level); } +static int arizona_extcon_of_get_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = >pdata; + + of_property_read_u32(arizona->dev->of_node, "wlf,hpdet-channel", +>hpdet_channel); + + return 0; +} + static int arizona_extcon_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); @@ -1120,6 +1127,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info) return -ENOMEM; + if (IS_ENABLED(CONFIG_OF)) { + if (!dev_get_platdata(arizona->dev)) + arizona_extcon_of_get_pdata(arizona); + } + info->micvdd = devm_regulator_get(>dev, "MICVDD"); if (IS_ERR(info->micvdd)) { ret = PTR_ERR(info->micvdd); diff --git a/include/dt-bindings/mfd/arizona.h b/include/dt-bindings/mfd/arizona.h new file mode 100644 index 000..9ecff78 --- /dev/null +++ b/include/dt-bindings/mfd/arizona.h @@ -0,0 +1,8 @@ +#ifndef __DT_BINDINGS_ARIZONA_H__ +#define __DT_BINDINGS_ARIZONA_H__ + +#define ARIZONA_ACCDET_MODE_MIC 0 +#define ARIZONA_ACCDET_MODE_HPL 1 +#define ARIZONA_ACCDET_MODE_HPR 2 + +#endif /* __DT_BINDINGS_ARIZONA_H__ */ diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 4578c72..2473a67 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -139,6 +139,9 @@ struct arizona_pdata { /** GPIO used for mic isolation with HPDET */ int hpdet_id_gpio; + /** Channel to use for headphone detection */ + unsigned int hpdet_channel; + /** Extra debounce timeout used during initial mic detection (ms) */ int micd_detect_debounce; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v2 0/2] Add support for select accessory detect mode to HPDETL or HPDETR
This set of patches adds support for select accessory detect mode to HPDETL or HPDETR. Changes in v2: - Use the value in pdata instead of hpdet_channel in extcon_info. - Wrap arizona_extcon_of_get in IS_ENABLED(CONFIG_OF). - Change hpdet_channel type to unsigned from signed in pdata. - Move ARIZONA_ACCDET_MODE_* define to dt-binding header and directly set it to pdata. Inha Song (2): extcon: arizona: Add support for select accessory detect mode when headphone detection mfd: arizona: Update DT binding to support hpdet channel Documentation/devicetree/bindings/mfd/arizona.txt | 6 + drivers/extcon/extcon-arizona.c | 28 --- include/dt-bindings/mfd/arizona.h | 8 +++ include/linux/mfd/arizona/pdata.h | 3 +++ 4 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v2 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song ideal.s...@samsung.com --- drivers/extcon/extcon-arizona.c | 28 include/dt-bindings/mfd/arizona.h | 8 include/linux/mfd/arizona/pdata.h | 3 +++ 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 include/dt-bindings/mfd/arizona.h diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 63f01c4..c827342 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -32,13 +32,10 @@ #include linux/mfd/arizona/core.h #include linux/mfd/arizona/pdata.h #include linux/mfd/arizona/registers.h +#include dt-bindings/mfd/arizona.h #define ARIZONA_MAX_MICD_RANGE 8 -#define ARIZONA_ACCDET_MODE_MIC 0 -#define ARIZONA_ACCDET_MODE_HPL 1 -#define ARIZONA_ACCDET_MODE_HPR 2 - #define ARIZONA_MICD_CLAMP_MODE_JDL 0x4 #define ARIZONA_MICD_CLAMP_MODE_JDH 0x5 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 @@ -653,9 +650,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona-regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +arizona-pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -705,9 +702,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info-micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +arizona-pdata.hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -1103,6 +1100,16 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona-regmap, reg, mask, level); } +static int arizona_extcon_of_get_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = arizona-pdata; + + of_property_read_u32(arizona-dev-of_node, wlf,hpdet-channel, +pdata-hpdet_channel); + + return 0; +} + static int arizona_extcon_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev-dev.parent); @@ -1120,6 +1127,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info) return -ENOMEM; + if (IS_ENABLED(CONFIG_OF)) { + if (!dev_get_platdata(arizona-dev)) + arizona_extcon_of_get_pdata(arizona); + } + info-micvdd = devm_regulator_get(pdev-dev, MICVDD); if (IS_ERR(info-micvdd)) { ret = PTR_ERR(info-micvdd); diff --git a/include/dt-bindings/mfd/arizona.h b/include/dt-bindings/mfd/arizona.h new file mode 100644 index 000..9ecff78 --- /dev/null +++ b/include/dt-bindings/mfd/arizona.h @@ -0,0 +1,8 @@ +#ifndef __DT_BINDINGS_ARIZONA_H__ +#define __DT_BINDINGS_ARIZONA_H__ + +#define ARIZONA_ACCDET_MODE_MIC 0 +#define ARIZONA_ACCDET_MODE_HPL 1 +#define ARIZONA_ACCDET_MODE_HPR 2 + +#endif /* __DT_BINDINGS_ARIZONA_H__ */ diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 4578c72..2473a67 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -139,6 +139,9 @@ struct arizona_pdata { /** GPIO used for mic isolation with HPDET */ int hpdet_id_gpio; + /** Channel to use for headphone detection */ + unsigned int hpdet_channel; + /** Extra debounce timeout used during initial mic detection (ms) */ int micd_detect_debounce; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v2 2/2] mfd: arizona: Update DT binding to support hpdet channel
This patch add device tree bindings for the pdata needed to configure the Accessory Detect Mode select when Headphone detection. Signed-off-by: Inha Song ideal.s...@samsung.com --- Documentation/devicetree/bindings/mfd/arizona.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index 7bd1273..3529592 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -49,6 +49,12 @@ Optional properties: input singals. If values less than the number of input signals, elements that has not been specifed are set to 0 by default. + - wlf,hpdet-channel : Headphone detection channel. + 1 or ARIZONA_ACCDET_MODE_HPL - Headphone detect mode is set to HPDETL + 2 or ARIZONA_ACCDET_MODE_HPR - Headphone detect mode is set to HPDETR + If this node is not mentioned or if the value is unknown, then + headphone detection mode is set to MICDET. + - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if they are being externally supplied. As covered in Documentation/devicetree/bindings/regulator/regulator.txt -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection"
Hi, Thanks for your comments, On Fri, 17 Apr 2015 10:00:47 +0100 Charles Keepax wrote: > On Fri, Apr 17, 2015 at 05:32:58PM +0900, Inha Song wrote: > > This patch add support for select accessory detect mode to HPDETL or HPDETR. > > Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins > > to measure the impedance of an external load connected to the headphone. > > > > Depending on board design, headphone detect pins can change to HPDETR or > > HPDETL. > > > > Signed-off-by: Inha Song > > --- > > drivers/extcon/extcon-arizona.c | 34 ++ > > include/linux/mfd/arizona/pdata.h | 3 +++ > > 2 files changed, 33 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/extcon/extcon-arizona.c > > b/drivers/extcon/extcon-arizona.c > > index 63f01c4..7bc9159 100644 > > --- a/drivers/extcon/extcon-arizona.c > > +++ b/drivers/extcon/extcon-arizona.c > > @@ -95,6 +95,7 @@ struct arizona_extcon_info { > > int jack_flips; > > > > int hpdet_ip; > > + int hpdet_channel; > > Don't really think this is necessary we can just use the pdata > value where required doesn't add much copying it to extcon_info. > OK, > > > > struct extcon_dev *edev; > > }; > > @@ -653,9 +654,9 @@ static void arizona_identify_headphone(struct > > arizona_extcon_info *info) > > ret = regmap_update_bits(arizona->regmap, > > ARIZONA_ACCESSORY_DETECT_MODE_1, > > ARIZONA_ACCDET_MODE_MASK, > > -ARIZONA_ACCDET_MODE_HPL); > > +info->hpdet_channel); > > if (ret != 0) { > > - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); > > + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); > > goto err; > > } > > > > @@ -705,9 +706,9 @@ static void arizona_start_hpdet_acc_id(struct > > arizona_extcon_info *info) > > ARIZONA_ACCESSORY_DETECT_MODE_1, > > ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, > > info->micd_modes[0].src | > > -ARIZONA_ACCDET_MODE_HPL); > > +info->hpdet_channel); > > if (ret != 0) { > > - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); > > + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); > > goto err; > > } > > > > @@ -1103,6 +1104,23 @@ static void arizona_micd_set_level(struct arizona > > *arizona, int index, > > regmap_update_bits(arizona->regmap, reg, mask, level); > > } > > > > +#ifdef CONFIG_OF > > +static int arizona_of_get_extcon_pdata(struct arizona *arizona) > > +{ > > + struct arizona_pdata *pdata = >pdata; > > + > > + of_property_read_u32(arizona->dev->of_node, "wlf,hpdet-channel", > > +>hpdet_channel); > > + > > + return 0; > > +} > > +#else > > +static inline int arizona_of_get_extcon_pdata(struct arizona *arizona) > > +{ > > + return 0; > > +} > > +#endif > > + > > I believe it is preferred to leave this as not ifdef'ed... > > > static int arizona_extcon_probe(struct platform_device *pdev) > > { > > struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); > > @@ -1120,6 +1138,9 @@ static int arizona_extcon_probe(struct > > platform_device *pdev) > > if (!info) > > return -ENOMEM; > > > > + if (!dev_get_platdata(arizona->dev)) > > + arizona_of_get_extcon_pdata(arizona); > > And to wrap this in an if (IS_ENABLED(CONFIG_OF)). OK, I will fix. And I will also change to arizona_extcon_of_get_pdata(). > > > + > > info->micvdd = devm_regulator_get(>dev, "MICVDD"); > > if (IS_ERR(info->micvdd)) { > > ret = PTR_ERR(info->micvdd); > > @@ -1338,6 +1359,11 @@ static int arizona_extcon_probe(struct > > platform_device *pdev) > > > > arizona_extcon_set_mode(info, 0); > > > > + if (arizona->pdata.hpdet_channel) > > + info->hpdet_channel = ARIZONA_ACCDET_MODE_HPR; > > + else > > + info->hpdet_channel = ARIZONA_ACCDET_MODE_HPL; > > + > > Just move the two defines in include/dt-bindi
Re: [alsa-devel] [PATCH 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
Hi, Thanks for your comments, On Fri, 17 Apr 2015 10:00:47 +0100 Charles Keepax ckee...@opensource.wolfsonmicro.com wrote: On Fri, Apr 17, 2015 at 05:32:58PM +0900, Inha Song wrote: This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song ideal.s...@samsung.com --- drivers/extcon/extcon-arizona.c | 34 ++ include/linux/mfd/arizona/pdata.h | 3 +++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 63f01c4..7bc9159 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -95,6 +95,7 @@ struct arizona_extcon_info { int jack_flips; int hpdet_ip; + int hpdet_channel; Don't really think this is necessary we can just use the pdata value where required doesn't add much copying it to extcon_info. OK, struct extcon_dev *edev; }; @@ -653,9 +654,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona-regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +info-hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -705,9 +706,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info-micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +info-hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -1103,6 +1104,23 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona-regmap, reg, mask, level); } +#ifdef CONFIG_OF +static int arizona_of_get_extcon_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = arizona-pdata; + + of_property_read_u32(arizona-dev-of_node, wlf,hpdet-channel, +pdata-hpdet_channel); + + return 0; +} +#else +static inline int arizona_of_get_extcon_pdata(struct arizona *arizona) +{ + return 0; +} +#endif + I believe it is preferred to leave this as not ifdef'ed... static int arizona_extcon_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev-dev.parent); @@ -1120,6 +1138,9 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info) return -ENOMEM; + if (!dev_get_platdata(arizona-dev)) + arizona_of_get_extcon_pdata(arizona); And to wrap this in an if (IS_ENABLED(CONFIG_OF)). OK, I will fix. And I will also change to arizona_extcon_of_get_pdata(). + info-micvdd = devm_regulator_get(pdev-dev, MICVDD); if (IS_ERR(info-micvdd)) { ret = PTR_ERR(info-micvdd); @@ -1338,6 +1359,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) arizona_extcon_set_mode(info, 0); + if (arizona-pdata.hpdet_channel) + info-hpdet_channel = ARIZONA_ACCDET_MODE_HPR; + else + info-hpdet_channel = ARIZONA_ACCDET_MODE_HPL; + Just move the two defines in include/dt-bindings/mfd/arizona.h and have the pdata get set directly to one of the values. Ok, I agree. But I have a question. Should I also move ACCDET_MODE_MIC define to dt-bindings header? pm_runtime_enable(pdev-dev); pm_runtime_idle(pdev-dev); pm_runtime_get_sync(pdev-dev); diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 4578c72..feb5903 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -139,6 +139,9 @@ struct arizona_pdata { /** GPIO used for mic isolation with HPDET */ int hpdet_id_gpio; + /** Channel to use for headphone detection */ + int hpdet_channel; Lets use and unsigned here, we don't need it to be signed and it saves type issues with read_u32. OK, Best Regards, Inha Song. + /** Extra debounce timeout used during initial mic detection (ms) */ int
[alsa-devel] [PATCH 0/2] Add support for select accessory detect mode to HPDETL or HPDETR
This set of patches adds support for select accessory detect mode to HPDETL or HPDETR. Inha Song (2): extcon: arizona: Add support for select accessory detect mode when headphone detection" mfd: arizona: Update DT binding to support hpdet channel Documentation/devicetree/bindings/mfd/arizona.txt | 4 +++ drivers/extcon/extcon-arizona.c | 34 --- include/linux/mfd/arizona/pdata.h | 3 ++ 3 files changed, 37 insertions(+), 4 deletions(-) -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection"
This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song --- drivers/extcon/extcon-arizona.c | 34 ++ include/linux/mfd/arizona/pdata.h | 3 +++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 63f01c4..7bc9159 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -95,6 +95,7 @@ struct arizona_extcon_info { int jack_flips; int hpdet_ip; + int hpdet_channel; struct extcon_dev *edev; }; @@ -653,9 +654,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona->regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +info->hpdet_channel); if (ret != 0) { - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); goto err; } @@ -705,9 +706,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info->micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +info->hpdet_channel); if (ret != 0) { - dev_err(arizona->dev, "Failed to set HPDETL mode: %d\n", ret); + dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret); goto err; } @@ -1103,6 +1104,23 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona->regmap, reg, mask, level); } +#ifdef CONFIG_OF +static int arizona_of_get_extcon_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = >pdata; + + of_property_read_u32(arizona->dev->of_node, "wlf,hpdet-channel", +>hpdet_channel); + + return 0; +} +#else +static inline int arizona_of_get_extcon_pdata(struct arizona *arizona) +{ + return 0; +} +#endif + static int arizona_extcon_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); @@ -1120,6 +1138,9 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info) return -ENOMEM; + if (!dev_get_platdata(arizona->dev)) + arizona_of_get_extcon_pdata(arizona); + info->micvdd = devm_regulator_get(>dev, "MICVDD"); if (IS_ERR(info->micvdd)) { ret = PTR_ERR(info->micvdd); @@ -1338,6 +1359,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) arizona_extcon_set_mode(info, 0); + if (arizona->pdata.hpdet_channel) + info->hpdet_channel = ARIZONA_ACCDET_MODE_HPR; + else + info->hpdet_channel = ARIZONA_ACCDET_MODE_HPL; + pm_runtime_enable(>dev); pm_runtime_idle(>dev); pm_runtime_get_sync(>dev); diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 4578c72..feb5903 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -139,6 +139,9 @@ struct arizona_pdata { /** GPIO used for mic isolation with HPDET */ int hpdet_id_gpio; + /** Channel to use for headphone detection */ + int hpdet_channel; + /** Extra debounce timeout used during initial mic detection (ms) */ int micd_detect_debounce; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH 2/2] mfd: arizona: Update DT binding to support hpdet channel
This patch add device tree bindings for the pdata needed to configure the Accessory Detect Mode select when Headphone detection. Signed-off-by: Inha Song --- Documentation/devicetree/bindings/mfd/arizona.txt | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index 7bd1273..e7cb939 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -49,6 +49,10 @@ Optional properties: input singals. If values less than the number of input signals, elements that has not been specifed are set to 0 by default. + - wlf,hpdet-channel : Headphone detection channel, this filed to be used the +ACCDET_MODE bits in the ACCESSORY_DETECT_MODE_1 register. The valid values +are 0 for HPDETL and 1 for HPDETR. + - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if they are being externally supplied. As covered in Documentation/devicetree/bindings/regulator/regulator.txt -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH 0/2] Add support for select accessory detect mode to HPDETL or HPDETR
This set of patches adds support for select accessory detect mode to HPDETL or HPDETR. Inha Song (2): extcon: arizona: Add support for select accessory detect mode when headphone detection mfd: arizona: Update DT binding to support hpdet channel Documentation/devicetree/bindings/mfd/arizona.txt | 4 +++ drivers/extcon/extcon-arizona.c | 34 --- include/linux/mfd/arizona/pdata.h | 3 ++ 3 files changed, 37 insertions(+), 4 deletions(-) -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
This patch add support for select accessory detect mode to HPDETL or HPDETR. Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins to measure the impedance of an external load connected to the headphone. Depending on board design, headphone detect pins can change to HPDETR or HPDETL. Signed-off-by: Inha Song ideal.s...@samsung.com --- drivers/extcon/extcon-arizona.c | 34 ++ include/linux/mfd/arizona/pdata.h | 3 +++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 63f01c4..7bc9159 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -95,6 +95,7 @@ struct arizona_extcon_info { int jack_flips; int hpdet_ip; + int hpdet_channel; struct extcon_dev *edev; }; @@ -653,9 +654,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ret = regmap_update_bits(arizona-regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_MODE_MASK, -ARIZONA_ACCDET_MODE_HPL); +info-hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -705,9 +706,9 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK, info-micd_modes[0].src | -ARIZONA_ACCDET_MODE_HPL); +info-hpdet_channel); if (ret != 0) { - dev_err(arizona-dev, Failed to set HPDETL mode: %d\n, ret); + dev_err(arizona-dev, Failed to set HPDET mode: %d\n, ret); goto err; } @@ -1103,6 +1104,23 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, regmap_update_bits(arizona-regmap, reg, mask, level); } +#ifdef CONFIG_OF +static int arizona_of_get_extcon_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = arizona-pdata; + + of_property_read_u32(arizona-dev-of_node, wlf,hpdet-channel, +pdata-hpdet_channel); + + return 0; +} +#else +static inline int arizona_of_get_extcon_pdata(struct arizona *arizona) +{ + return 0; +} +#endif + static int arizona_extcon_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev-dev.parent); @@ -1120,6 +1138,9 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info) return -ENOMEM; + if (!dev_get_platdata(arizona-dev)) + arizona_of_get_extcon_pdata(arizona); + info-micvdd = devm_regulator_get(pdev-dev, MICVDD); if (IS_ERR(info-micvdd)) { ret = PTR_ERR(info-micvdd); @@ -1338,6 +1359,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) arizona_extcon_set_mode(info, 0); + if (arizona-pdata.hpdet_channel) + info-hpdet_channel = ARIZONA_ACCDET_MODE_HPR; + else + info-hpdet_channel = ARIZONA_ACCDET_MODE_HPL; + pm_runtime_enable(pdev-dev); pm_runtime_idle(pdev-dev); pm_runtime_get_sync(pdev-dev); diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 4578c72..feb5903 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -139,6 +139,9 @@ struct arizona_pdata { /** GPIO used for mic isolation with HPDET */ int hpdet_id_gpio; + /** Channel to use for headphone detection */ + int hpdet_channel; + /** Extra debounce timeout used during initial mic detection (ms) */ int micd_detect_debounce; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH 2/2] mfd: arizona: Update DT binding to support hpdet channel
This patch add device tree bindings for the pdata needed to configure the Accessory Detect Mode select when Headphone detection. Signed-off-by: Inha Song ideal.s...@samsung.com --- Documentation/devicetree/bindings/mfd/arizona.txt | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index 7bd1273..e7cb939 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -49,6 +49,10 @@ Optional properties: input singals. If values less than the number of input signals, elements that has not been specifed are set to 0 by default. + - wlf,hpdet-channel : Headphone detection channel, this filed to be used the +ACCDET_MODE bits in the ACCESSORY_DETECT_MODE_1 register. The valid values +are 0 for HPDETL and 1 for HPDETR. + - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if they are being externally supplied. As covered in Documentation/devicetree/bindings/regulator/regulator.txt -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v2] ASoC: wm8994: Manage wm8994's MCLK in codec driver
Previously, When we use wm8994 codec, we should control its MCLK in machine driver. But, It should be managed by wm8994 codec driver, not machine driver. This patch add MCLK clock DT parsing logic and control own MCLK. Signed-off-by: Inha Song --- sound/soc/codecs/wm8994.c | 22 +- sound/soc/codecs/wm8994.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 4fbc768..acb6b44 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -2471,6 +2472,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994 *control = wm8994->wm8994; + int i; wm_hubs_set_bias_level(codec, level); @@ -2492,8 +2494,15 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, break; } - if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) + if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) + clk_prepare_enable(wm8994->clk_mclk[i]); + active_reference(codec); + } else if (codec->dapm.bias_level == SND_SOC_BIAS_ON) { + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) + clk_disable_unprepare(wm8994->clk_mclk[i]); + } break; case SND_SOC_BIAS_STANDBY: @@ -4449,6 +4458,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { static int wm8994_probe(struct platform_device *pdev) { struct wm8994_priv *wm8994; + int i; wm8994 = devm_kzalloc(>dev, sizeof(struct wm8994_priv), GFP_KERNEL); @@ -4460,6 +4470,16 @@ static int wm8994_probe(struct platform_device *pdev) wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) { + char mclk_name[] = "MCLKx"; + + snprintf(mclk_name, sizeof(mclk_name), "MCLK%d", i + 1); + + wm8994->clk_mclk[i] = devm_clk_get(pdev->dev.parent, mclk_name); + if (IS_ERR(wm8994->clk_mclk[i])) + wm8994->clk_mclk[i] = NULL; + } + pm_runtime_enable(>dev); pm_runtime_idle(>dev); diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index dd73387..d426c44 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -79,6 +79,7 @@ struct wm8994_priv { int sysclk[2]; int sysclk_rate[2]; int mclk[2]; + struct clk *clk_mclk[2]; int aifclk[2]; int aifdiv[2]; int channels[2]; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v2] ASoC: wm8994: Manage wm8994's MCLK in codec driver
Previously, When we use wm8994 codec, we should control its MCLK in machine driver. But, It should be managed by wm8994 codec driver, not machine driver. This patch add MCLK clock DT parsing logic and control own MCLK. Signed-off-by: Inha Song ideal.s...@samsung.com --- sound/soc/codecs/wm8994.c | 22 +- sound/soc/codecs/wm8994.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 4fbc768..acb6b44 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -16,6 +16,7 @@ #include linux/init.h #include linux/delay.h #include linux/pm.h +#include linux/clk.h #include linux/gcd.h #include linux/i2c.h #include linux/platform_device.h @@ -2471,6 +2472,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994 *control = wm8994-wm8994; + int i; wm_hubs_set_bias_level(codec, level); @@ -2492,8 +2494,15 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, break; } - if (codec-dapm.bias_level == SND_SOC_BIAS_STANDBY) + if (codec-dapm.bias_level == SND_SOC_BIAS_STANDBY) { + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) + clk_prepare_enable(wm8994-clk_mclk[i]); + active_reference(codec); + } else if (codec-dapm.bias_level == SND_SOC_BIAS_ON) { + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) + clk_disable_unprepare(wm8994-clk_mclk[i]); + } break; case SND_SOC_BIAS_STANDBY: @@ -4449,6 +4458,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { static int wm8994_probe(struct platform_device *pdev) { struct wm8994_priv *wm8994; + int i; wm8994 = devm_kzalloc(pdev-dev, sizeof(struct wm8994_priv), GFP_KERNEL); @@ -4460,6 +4470,16 @@ static int wm8994_probe(struct platform_device *pdev) wm8994-wm8994 = dev_get_drvdata(pdev-dev.parent); + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) { + char mclk_name[] = MCLKx; + + snprintf(mclk_name, sizeof(mclk_name), MCLK%d, i + 1); + + wm8994-clk_mclk[i] = devm_clk_get(pdev-dev.parent, mclk_name); + if (IS_ERR(wm8994-clk_mclk[i])) + wm8994-clk_mclk[i] = NULL; + } + pm_runtime_enable(pdev-dev); pm_runtime_idle(pdev-dev); diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index dd73387..d426c44 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -79,6 +79,7 @@ struct wm8994_priv { int sysclk[2]; int sysclk_rate[2]; int mclk[2]; + struct clk *clk_mclk[2]; int aifclk[2]; int aifdiv[2]; int channels[2]; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH] ASoC: wm8994: Manage wm8994's MCLK in codec driver
Hi, Chanwoo, Thanks for your comments. On Thu, 12 Mar 2015 13:33:49 +0900 Chanwoo Choi wrote: > Hi Inha, > > On 03/12/2015 11:49 AM, Inha Song wrote: > > Previously, When we use wm8994 codec, we should control its MCLK in machine > > driver. > > But, It should be managed by wm8994 codec driver, not machine driver. > > > > This patch add MCLK clock DT parsing logic and control own MCLK. > > > > Signed-off-by: Inha Song > > --- > > sound/soc/codecs/wm8994.c | 27 ++- > > sound/soc/codecs/wm8994.h | 1 + > > 2 files changed, 27 insertions(+), 1 deletion(-) > > > > diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c > > index 247b390..d80dcc6 100644 > > --- a/sound/soc/codecs/wm8994.c > > +++ b/sound/soc/codecs/wm8994.c > > @@ -16,6 +16,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -2470,6 +2471,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec > > *codec, > > { > > struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); > > struct wm8994 *control = wm8994->wm8994; > > + int i; > > > > wm_hubs_set_bias_level(codec, level); > > > > @@ -2491,8 +2493,19 @@ static int wm8994_set_bias_level(struct > > snd_soc_codec *codec, > > break; > > } > > > > - if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) > > + if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { > > + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) { > > + if (!IS_ERR(wm8994->clk_mclk[i])) > > + clk_prepare_enable(wm8994->clk_mclk[i]); > > I think that you don't need to check error by using 'if' statement. > clk_prepare_enable() function will check the NULL state of clk instance > before preparing and enabling the clock. So that, I can handle it more concisely. Thanks, I will fix this. > > for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) > clk_prepare_enable(wm8994->clk_mclk[i]); > > But, wm8994_probe() have to initialize the NULL for wm8994->clk_mclk[i]. > I added the comment about this on below. > > > + } > > active_reference(codec); > > + } else if (codec->dapm.bias_level == SND_SOC_BIAS_ON) { > > + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) { > > + if (!IS_ERR(wm8994->clk_mclk[i])) > > + clk_disable_unprepare( > > + wm8994->clk_mclk[i]); ditto > > + } > > + } > > break; > > > > case SND_SOC_BIAS_STANDBY: > > @@ -4451,6 +4464,7 @@ static struct snd_soc_codec_driver > > soc_codec_dev_wm8994 = { > > static int wm8994_probe(struct platform_device *pdev) > > { > > struct wm8994_priv *wm8994; > > + int i; > > > > wm8994 = devm_kzalloc(>dev, sizeof(struct wm8994_priv), > > GFP_KERNEL); > > @@ -4460,6 +4474,17 @@ static int wm8994_probe(struct platform_device *pdev) > > > > wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); > > > > + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) { > > + char mclk_name[] = "MCLKx"; > > + > > + snprintf(mclk_name, sizeof(mclk_name), "MCLK%d", i + 1); > > + > > + wm8994->clk_mclk[i] = devm_clk_get(pdev->dev.parent, mclk_name); > > + if (IS_ERR(wm8994->clk_mclk[i])) > > + if (PTR_ERR(wm8994->clk_mclk) == -EPROBE_DEFER) > > + return -EPROBE_DEFER; > > I think you better to modify exception handling as following: > > if (IS_ERR(wm8994->clk_mclk[i])) { > wm8994->clk_mclk[i] = NULL; > return PTR_ERR(wm8994->clk_mclk); I will fix. (MCLK is optional properties in wm8994) if (IS_ERR(wm8994->clk_mclk[i])) wm8994->clk_mclk[i] = NULL; Best Regards, Inha Song. > } > > > + } > > + > > pm_runtime_enable(>dev); > > pm_runtime_idle(>dev); > > > > diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h > > index 6536f8d..8cf06a4 100644 > > --- a/sound/soc/codecs/wm8994.h > > +++ b/sound/soc/codecs/wm8994.h > > @@ -78,6 +78,7 @@ struct wm8994_priv { > > int sysclk[2]; > > int sysclk_rate[2]; > > int mclk[2]; > > + struct clk *clk_mclk[2]; > > int aifclk[2]; > > int aifdiv[2]; > > int channels[2]; > > > > Thanks, > Chanwoo Choi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ASoC: wm8994: Manage wm8994's MCLK in codec driver
Previously, When we use wm8994 codec, we should control its MCLK in machine driver. But, It should be managed by wm8994 codec driver, not machine driver. This patch add MCLK clock DT parsing logic and control own MCLK. Signed-off-by: Inha Song --- sound/soc/codecs/wm8994.c | 27 ++- sound/soc/codecs/wm8994.h | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 247b390..d80dcc6 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -2470,6 +2471,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994 *control = wm8994->wm8994; + int i; wm_hubs_set_bias_level(codec, level); @@ -2491,8 +2493,19 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, break; } - if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) + if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) { + if (!IS_ERR(wm8994->clk_mclk[i])) + clk_prepare_enable(wm8994->clk_mclk[i]); + } active_reference(codec); + } else if (codec->dapm.bias_level == SND_SOC_BIAS_ON) { + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) { + if (!IS_ERR(wm8994->clk_mclk[i])) + clk_disable_unprepare( + wm8994->clk_mclk[i]); + } + } break; case SND_SOC_BIAS_STANDBY: @@ -4451,6 +4464,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { static int wm8994_probe(struct platform_device *pdev) { struct wm8994_priv *wm8994; + int i; wm8994 = devm_kzalloc(>dev, sizeof(struct wm8994_priv), GFP_KERNEL); @@ -4460,6 +4474,17 @@ static int wm8994_probe(struct platform_device *pdev) wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) { + char mclk_name[] = "MCLKx"; + + snprintf(mclk_name, sizeof(mclk_name), "MCLK%d", i + 1); + + wm8994->clk_mclk[i] = devm_clk_get(pdev->dev.parent, mclk_name); + if (IS_ERR(wm8994->clk_mclk[i])) + if (PTR_ERR(wm8994->clk_mclk) == -EPROBE_DEFER) + return -EPROBE_DEFER; + } + pm_runtime_enable(>dev); pm_runtime_idle(>dev); diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index 6536f8d..8cf06a4 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -78,6 +78,7 @@ struct wm8994_priv { int sysclk[2]; int sysclk_rate[2]; int mclk[2]; + struct clk *clk_mclk[2]; int aifclk[2]; int aifdiv[2]; int channels[2]; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH] ASoC: wm8994: Manage wm8994's MCLK in codec driver
Previously, When we use wm8994 codec, we should control its MCLK in machine driver. But, It should be managed by wm8994 codec driver, not machine driver. This patch add MCLK clock DT parsing logic and control own MCLK. Signed-off-by: Inha Song --- sound/soc/codecs/wm8994.c | 27 ++- sound/soc/codecs/wm8994.h | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 247b390..d80dcc6 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -2470,6 +2471,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994 *control = wm8994->wm8994; + int i; wm_hubs_set_bias_level(codec, level); @@ -2491,8 +2493,19 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, break; } - if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) + if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) { + if (!IS_ERR(wm8994->clk_mclk[i])) + clk_prepare_enable(wm8994->clk_mclk[i]); + } active_reference(codec); + } else if (codec->dapm.bias_level == SND_SOC_BIAS_ON) { + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) { + if (!IS_ERR(wm8994->clk_mclk[i])) + clk_disable_unprepare( + wm8994->clk_mclk[i]); + } + } break; case SND_SOC_BIAS_STANDBY: @@ -4451,6 +4464,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { static int wm8994_probe(struct platform_device *pdev) { struct wm8994_priv *wm8994; + int i; wm8994 = devm_kzalloc(>dev, sizeof(struct wm8994_priv), GFP_KERNEL); @@ -4460,6 +4474,17 @@ static int wm8994_probe(struct platform_device *pdev) wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) { + char mclk_name[] = "MCLKx"; + + snprintf(mclk_name, sizeof(mclk_name), "MCLK%d", i + 1); + + wm8994->clk_mclk[i] = devm_clk_get(pdev->dev.parent, mclk_name); + if (IS_ERR(wm8994->clk_mclk[i])) + if (PTR_ERR(wm8994->clk_mclk) == -EPROBE_DEFER) + return -EPROBE_DEFER; + } + pm_runtime_enable(>dev); pm_runtime_idle(>dev); diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index 6536f8d..8cf06a4 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -78,6 +78,7 @@ struct wm8994_priv { int sysclk[2]; int sysclk_rate[2]; int mclk[2]; + struct clk *clk_mclk[2]; int aifclk[2]; int aifdiv[2]; int channels[2]; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ASoC: wm8994: Manage wm8994's MCLK in codec driver
Previously, When we use wm8994 codec, we should control its MCLK in machine driver. But, It should be managed by wm8994 codec driver, not machine driver. This patch add MCLK clock DT parsing logic and control own MCLK. Signed-off-by: Inha Song ideal.s...@samsung.com --- sound/soc/codecs/wm8994.c | 27 ++- sound/soc/codecs/wm8994.h | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 247b390..d80dcc6 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -16,6 +16,7 @@ #include linux/init.h #include linux/delay.h #include linux/pm.h +#include linux/clk.h #include linux/gcd.h #include linux/i2c.h #include linux/platform_device.h @@ -2470,6 +2471,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994 *control = wm8994-wm8994; + int i; wm_hubs_set_bias_level(codec, level); @@ -2491,8 +2493,19 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, break; } - if (codec-dapm.bias_level == SND_SOC_BIAS_STANDBY) + if (codec-dapm.bias_level == SND_SOC_BIAS_STANDBY) { + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) { + if (!IS_ERR(wm8994-clk_mclk[i])) + clk_prepare_enable(wm8994-clk_mclk[i]); + } active_reference(codec); + } else if (codec-dapm.bias_level == SND_SOC_BIAS_ON) { + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) { + if (!IS_ERR(wm8994-clk_mclk[i])) + clk_disable_unprepare( + wm8994-clk_mclk[i]); + } + } break; case SND_SOC_BIAS_STANDBY: @@ -4451,6 +4464,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { static int wm8994_probe(struct platform_device *pdev) { struct wm8994_priv *wm8994; + int i; wm8994 = devm_kzalloc(pdev-dev, sizeof(struct wm8994_priv), GFP_KERNEL); @@ -4460,6 +4474,17 @@ static int wm8994_probe(struct platform_device *pdev) wm8994-wm8994 = dev_get_drvdata(pdev-dev.parent); + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) { + char mclk_name[] = MCLKx; + + snprintf(mclk_name, sizeof(mclk_name), MCLK%d, i + 1); + + wm8994-clk_mclk[i] = devm_clk_get(pdev-dev.parent, mclk_name); + if (IS_ERR(wm8994-clk_mclk[i])) + if (PTR_ERR(wm8994-clk_mclk) == -EPROBE_DEFER) + return -EPROBE_DEFER; + } + pm_runtime_enable(pdev-dev); pm_runtime_idle(pdev-dev); diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index 6536f8d..8cf06a4 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -78,6 +78,7 @@ struct wm8994_priv { int sysclk[2]; int sysclk_rate[2]; int mclk[2]; + struct clk *clk_mclk[2]; int aifclk[2]; int aifdiv[2]; int channels[2]; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH] ASoC: wm8994: Manage wm8994's MCLK in codec driver
Previously, When we use wm8994 codec, we should control its MCLK in machine driver. But, It should be managed by wm8994 codec driver, not machine driver. This patch add MCLK clock DT parsing logic and control own MCLK. Signed-off-by: Inha Song ideal.s...@samsung.com --- sound/soc/codecs/wm8994.c | 27 ++- sound/soc/codecs/wm8994.h | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 247b390..d80dcc6 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -16,6 +16,7 @@ #include linux/init.h #include linux/delay.h #include linux/pm.h +#include linux/clk.h #include linux/gcd.h #include linux/i2c.h #include linux/platform_device.h @@ -2470,6 +2471,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994 *control = wm8994-wm8994; + int i; wm_hubs_set_bias_level(codec, level); @@ -2491,8 +2493,19 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, break; } - if (codec-dapm.bias_level == SND_SOC_BIAS_STANDBY) + if (codec-dapm.bias_level == SND_SOC_BIAS_STANDBY) { + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) { + if (!IS_ERR(wm8994-clk_mclk[i])) + clk_prepare_enable(wm8994-clk_mclk[i]); + } active_reference(codec); + } else if (codec-dapm.bias_level == SND_SOC_BIAS_ON) { + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) { + if (!IS_ERR(wm8994-clk_mclk[i])) + clk_disable_unprepare( + wm8994-clk_mclk[i]); + } + } break; case SND_SOC_BIAS_STANDBY: @@ -4451,6 +4464,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { static int wm8994_probe(struct platform_device *pdev) { struct wm8994_priv *wm8994; + int i; wm8994 = devm_kzalloc(pdev-dev, sizeof(struct wm8994_priv), GFP_KERNEL); @@ -4460,6 +4474,17 @@ static int wm8994_probe(struct platform_device *pdev) wm8994-wm8994 = dev_get_drvdata(pdev-dev.parent); + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) { + char mclk_name[] = MCLKx; + + snprintf(mclk_name, sizeof(mclk_name), MCLK%d, i + 1); + + wm8994-clk_mclk[i] = devm_clk_get(pdev-dev.parent, mclk_name); + if (IS_ERR(wm8994-clk_mclk[i])) + if (PTR_ERR(wm8994-clk_mclk) == -EPROBE_DEFER) + return -EPROBE_DEFER; + } + pm_runtime_enable(pdev-dev); pm_runtime_idle(pdev-dev); diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index 6536f8d..8cf06a4 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -78,6 +78,7 @@ struct wm8994_priv { int sysclk[2]; int sysclk_rate[2]; int mclk[2]; + struct clk *clk_mclk[2]; int aifclk[2]; int aifdiv[2]; int channels[2]; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH] ASoC: wm8994: Manage wm8994's MCLK in codec driver
Hi, Chanwoo, Thanks for your comments. On Thu, 12 Mar 2015 13:33:49 +0900 Chanwoo Choi cw00.c...@samsung.com wrote: Hi Inha, On 03/12/2015 11:49 AM, Inha Song wrote: Previously, When we use wm8994 codec, we should control its MCLK in machine driver. But, It should be managed by wm8994 codec driver, not machine driver. This patch add MCLK clock DT parsing logic and control own MCLK. Signed-off-by: Inha Song ideal.s...@samsung.com --- sound/soc/codecs/wm8994.c | 27 ++- sound/soc/codecs/wm8994.h | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 247b390..d80dcc6 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -16,6 +16,7 @@ #include linux/init.h #include linux/delay.h #include linux/pm.h +#include linux/clk.h #include linux/gcd.h #include linux/i2c.h #include linux/platform_device.h @@ -2470,6 +2471,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994 *control = wm8994-wm8994; + int i; wm_hubs_set_bias_level(codec, level); @@ -2491,8 +2493,19 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, break; } - if (codec-dapm.bias_level == SND_SOC_BIAS_STANDBY) + if (codec-dapm.bias_level == SND_SOC_BIAS_STANDBY) { + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) { + if (!IS_ERR(wm8994-clk_mclk[i])) + clk_prepare_enable(wm8994-clk_mclk[i]); I think that you don't need to check error by using 'if' statement. clk_prepare_enable() function will check the NULL state of clk instance before preparing and enabling the clock. So that, I can handle it more concisely. Thanks, I will fix this. for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) clk_prepare_enable(wm8994-clk_mclk[i]); But, wm8994_probe() have to initialize the NULL for wm8994-clk_mclk[i]. I added the comment about this on below. + } active_reference(codec); + } else if (codec-dapm.bias_level == SND_SOC_BIAS_ON) { + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) { + if (!IS_ERR(wm8994-clk_mclk[i])) + clk_disable_unprepare( + wm8994-clk_mclk[i]); ditto + } + } break; case SND_SOC_BIAS_STANDBY: @@ -4451,6 +4464,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { static int wm8994_probe(struct platform_device *pdev) { struct wm8994_priv *wm8994; + int i; wm8994 = devm_kzalloc(pdev-dev, sizeof(struct wm8994_priv), GFP_KERNEL); @@ -4460,6 +4474,17 @@ static int wm8994_probe(struct platform_device *pdev) wm8994-wm8994 = dev_get_drvdata(pdev-dev.parent); + for (i = 0; i ARRAY_SIZE(wm8994-clk_mclk); i++) { + char mclk_name[] = MCLKx; + + snprintf(mclk_name, sizeof(mclk_name), MCLK%d, i + 1); + + wm8994-clk_mclk[i] = devm_clk_get(pdev-dev.parent, mclk_name); + if (IS_ERR(wm8994-clk_mclk[i])) + if (PTR_ERR(wm8994-clk_mclk) == -EPROBE_DEFER) + return -EPROBE_DEFER; I think you better to modify exception handling as following: if (IS_ERR(wm8994-clk_mclk[i])) { wm8994-clk_mclk[i] = NULL; return PTR_ERR(wm8994-clk_mclk); I will fix. (MCLK is optional properties in wm8994) if (IS_ERR(wm8994-clk_mclk[i])) wm8994-clk_mclk[i] = NULL; Best Regards, Inha Song. } + } + pm_runtime_enable(pdev-dev); pm_runtime_idle(pdev-dev); diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index 6536f8d..8cf06a4 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -78,6 +78,7 @@ struct wm8994_priv { int sysclk[2]; int sysclk_rate[2]; int mclk[2]; + struct clk *clk_mclk[2]; int aifclk[2]; int aifdiv[2]; int channels[2]; Thanks, Chanwoo Choi -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH] ARM: dts: Support audio on Exynos5422-odroidxu3 using simple-audio-card
Add MAX98090 audio codec, I2S interface and the sound nodes to support audio on Exynos5422 SoC Based Odroid-XU3 board. Now we can support audio in Odroid-XU3 board using simple-audio-card DT binding. Signed-off-by: Inha Song --- arch/arm/boot/dts/exynos5420.dtsi | 9 + arch/arm/boot/dts/exynos5422-odroidxu3.dts | 57 ++ 2 files changed, 66 insertions(+) diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi index c0e98cf..a70005e 100644 --- a/arch/arm/boot/dts/exynos5420.dtsi +++ b/arch/arm/boot/dts/exynos5420.dtsi @@ -411,6 +411,9 @@ <_audss EXYNOS_I2S_BUS>, <_audss EXYNOS_SCLK_I2S>; clock-names = "iis", "i2s_opclk0", "i2s_opclk1"; + #clock-cells = <1>; + clock-output-names = "i2s_cdclk0"; + #sound-dai-cells = <1>; samsung,idma-addr = <0x0300>; pinctrl-names = "default"; pinctrl-0 = <_bus>; @@ -425,6 +428,9 @@ dma-names = "tx", "rx"; clocks = < CLK_I2S1>, < CLK_SCLK_I2S1>; clock-names = "iis", "i2s_opclk0"; + #clock-cells = <1>; + clock-output-names = "i2s_cdclk1"; + #sound-dai-cells = <1>; pinctrl-names = "default"; pinctrl-0 = <_bus>; status = "disabled"; @@ -438,6 +444,9 @@ dma-names = "tx", "rx"; clocks = < CLK_I2S2>, < CLK_SCLK_I2S2>; clock-names = "iis", "i2s_opclk0"; + #clock-cells = <1>; + clock-output-names = "i2s_cdclk2"; + #sound-dai-cells = <1>; pinctrl-names = "default"; pinctrl-0 = <_bus>; status = "disabled"; diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts index edc25cf..9275ad6 100644 --- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts +++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts @@ -11,6 +11,7 @@ */ /dts-v1/; +#include #include "exynos5800.dtsi" / { @@ -285,6 +286,62 @@ rtc@101E { status = "okay"; }; + + sound: sound { + compatible = "simple-audio-card"; + assigned-clocks = <_audss EXYNOS_MOUT_AUDSS>, + <_audss EXYNOS_MOUT_I2S>, + <_audss EXYNOS_DOUT_AUD_BUS>; + assigned-clock-parents = < CLK_FIN_PLL>, + <_audss EXYNOS_MOUT_AUDSS>; + assigned-clock-rates = <0>, + <0>, + <1920>; + + simple-audio-card,name = "Odroid-XU3"; + + simple-audio-card,widgets = + "Headphone", "Headphone Jack", + "Speakers", "Speakers"; + simple-audio-card,routing = + "Headphone Jack", "HPL", + "Headphone Jack", "HPR", + "Headphone Jack", "MICBIAS", + "IN1", "Headphone Jack", + "Speakers", "SPKL", + "Speakers", "SPKR"; + + simple-audio-card,format = "i2s"; + simple-audio-card,bitclock-master = <_codec>; + simple-audio-card,frame-master = <_codec>; + + simple-audio-card,cpu { + sound-dai = < 0>; + system-clock-frequency = <1920>; + }; + + link0_codec: simple-audio-card,codec { + sound-dai = <>; + clocks = < CLK_I2S_CDCLK>; + }; + }; +}; + +_5 { + status = "okay"; + max98090: max98090@10 { + compatible = "maxim,max98090"; + reg = <0x10>; + interrupt-parent = <>; + interrupts = <2 0>; + clocks = < CLK_I2S_CDCLK>; + clock-names = "mclk"; + #sound-dai-cells = <0>; + }; +}; + + { + status = "okay"; }; { -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH] ARM: dts: Support audio on Exynos5422-odroidxu3 using simple-audio-card
Add MAX98090 audio codec, I2S interface and the sound nodes to support audio on Exynos5422 SoC Based Odroid-XU3 board. Now we can support audio in Odroid-XU3 board using simple-audio-card DT binding. Signed-off-by: Inha Song ideal.s...@samsung.com --- arch/arm/boot/dts/exynos5420.dtsi | 9 + arch/arm/boot/dts/exynos5422-odroidxu3.dts | 57 ++ 2 files changed, 66 insertions(+) diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi index c0e98cf..a70005e 100644 --- a/arch/arm/boot/dts/exynos5420.dtsi +++ b/arch/arm/boot/dts/exynos5420.dtsi @@ -411,6 +411,9 @@ clock_audss EXYNOS_I2S_BUS, clock_audss EXYNOS_SCLK_I2S; clock-names = iis, i2s_opclk0, i2s_opclk1; + #clock-cells = 1; + clock-output-names = i2s_cdclk0; + #sound-dai-cells = 1; samsung,idma-addr = 0x0300; pinctrl-names = default; pinctrl-0 = i2s0_bus; @@ -425,6 +428,9 @@ dma-names = tx, rx; clocks = clock CLK_I2S1, clock CLK_SCLK_I2S1; clock-names = iis, i2s_opclk0; + #clock-cells = 1; + clock-output-names = i2s_cdclk1; + #sound-dai-cells = 1; pinctrl-names = default; pinctrl-0 = i2s1_bus; status = disabled; @@ -438,6 +444,9 @@ dma-names = tx, rx; clocks = clock CLK_I2S2, clock CLK_SCLK_I2S2; clock-names = iis, i2s_opclk0; + #clock-cells = 1; + clock-output-names = i2s_cdclk2; + #sound-dai-cells = 1; pinctrl-names = default; pinctrl-0 = i2s2_bus; status = disabled; diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts index edc25cf..9275ad6 100644 --- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts +++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts @@ -11,6 +11,7 @@ */ /dts-v1/; +#include dt-bindings/sound/samsung-i2s.h #include exynos5800.dtsi / { @@ -285,6 +286,62 @@ rtc@101E { status = okay; }; + + sound: sound { + compatible = simple-audio-card; + assigned-clocks = clock_audss EXYNOS_MOUT_AUDSS, + clock_audss EXYNOS_MOUT_I2S, + clock_audss EXYNOS_DOUT_AUD_BUS; + assigned-clock-parents = clock CLK_FIN_PLL, + clock_audss EXYNOS_MOUT_AUDSS; + assigned-clock-rates = 0, + 0, + 1920; + + simple-audio-card,name = Odroid-XU3; + + simple-audio-card,widgets = + Headphone, Headphone Jack, + Speakers, Speakers; + simple-audio-card,routing = + Headphone Jack, HPL, + Headphone Jack, HPR, + Headphone Jack, MICBIAS, + IN1, Headphone Jack, + Speakers, SPKL, + Speakers, SPKR; + + simple-audio-card,format = i2s; + simple-audio-card,bitclock-master = link0_codec; + simple-audio-card,frame-master = link0_codec; + + simple-audio-card,cpu { + sound-dai = i2s0 0; + system-clock-frequency = 1920; + }; + + link0_codec: simple-audio-card,codec { + sound-dai = max98090; + clocks = i2s0 CLK_I2S_CDCLK; + }; + }; +}; + +hsi2c_5 { + status = okay; + max98090: max98090@10 { + compatible = maxim,max98090; + reg = 0x10; + interrupt-parent = gpx3; + interrupts = 2 0; + clocks = i2s0 CLK_I2S_CDCLK; + clock-names = mclk; + #sound-dai-cells = 0; + }; +}; + +i2s0 { + status = okay; }; hdmi { -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] clk: samsung: Add CLKOUT driver support for Exynos3250 SoC.
This patch add CLKOUT driver support for Exynos3250 SoC. Exynos3250 SoC PMU_DEBUG is the same with Exynos4's PMU_DEBUG including CLKOUT mux. So, We can use the exynos4's clkout init function for Exynos3250 without the need to add new function. Signed-off-by: Inha Song --- drivers/clk/samsung/clk-exynos-clkout.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c index 3a7cb25..1c02e73 100644 --- a/drivers/clk/samsung/clk-exynos-clkout.c +++ b/drivers/clk/samsung/clk-exynos-clkout.c @@ -142,6 +142,8 @@ CLK_OF_DECLARE(exynos4212_clkout, "samsung,exynos4212-pmu", exynos4_clkout_init); CLK_OF_DECLARE(exynos4412_clkout, "samsung,exynos4412-pmu", exynos4_clkout_init); +CLK_OF_DECLARE(exynos3250_clkout, "samsung,exynos3250-pmu", + exynos4_clkout_init); static void __init exynos5_clkout_init(struct device_node *node) { -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] clk: samsung: Add CLKOUT driver support for Exynos3250 SoC.
This patch add CLKOUT driver support for Exynos3250 SoC. Exynos3250 SoC PMU_DEBUG is the same with Exynos4's PMU_DEBUG including CLKOUT mux. So, We can use the exynos4's clkout init function for Exynos3250 without the need to add new function. Signed-off-by: Inha Song ideal.s...@samsung.com --- drivers/clk/samsung/clk-exynos-clkout.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c index 3a7cb25..1c02e73 100644 --- a/drivers/clk/samsung/clk-exynos-clkout.c +++ b/drivers/clk/samsung/clk-exynos-clkout.c @@ -142,6 +142,8 @@ CLK_OF_DECLARE(exynos4212_clkout, samsung,exynos4212-pmu, exynos4_clkout_init); CLK_OF_DECLARE(exynos4412_clkout, samsung,exynos4412-pmu, exynos4_clkout_init); +CLK_OF_DECLARE(exynos3250_clkout, samsung,exynos3250-pmu, + exynos4_clkout_init); static void __init exynos5_clkout_init(struct device_node *node) { -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] clk: samsung: Add CLKOUT driver support for Exynos3250 SoC.
Hi, Tomasz, Thanks for you comment :) On Wed, 25 Feb 2015 09:54:02 +0900 Tomasz Figa wrote: > Hi Inha, > > Thanks for the patch. Please see my comments inline. > > 2015-02-24 18:22 GMT+09:00 Inha Song : > > This patch add CLKOUT driver support for Exynos3250 SoC. > > Could you please add a little more information? I know that it might > be pretty obvious to people familiar with this driver and/or hardware, > but it might be a good idea to explicitly say that the CLKOUT > controller is compatible with Exynos4, so only a new compatible string > is added. > > On the other hand, do you really need to add a new compatible string > if an existing one can be reused? The reason why the DT property is > called "compatible" is to be able to use the same compatible strings > on different devices, because they are compatible, even though the > string might have its name after only one of them. If there is some > additional reason to add a new compatible string, please write this in > commit message. In in PMU document(Document/devicetree/bindgins/arm/samsung/pmu.txt), "samsung,exynos3250-pmu" compatible string had been added. So I add this compatible in driver. > > > > > Signed-off-by: Inha Song > > --- > > drivers/clk/samsung/clk-exynos-clkout.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/clk/samsung/clk-exynos-clkout.c > > b/drivers/clk/samsung/clk-exynos-clkout.c > > index 3a7cb25..1c02e73 100644 > > --- a/drivers/clk/samsung/clk-exynos-clkout.c > > +++ b/drivers/clk/samsung/clk-exynos-clkout.c > > @@ -142,6 +142,8 @@ CLK_OF_DECLARE(exynos4212_clkout, > > "samsung,exynos4212-pmu", > > exynos4_clkout_init); > > CLK_OF_DECLARE(exynos4412_clkout, "samsung,exynos4412-pmu", > > exynos4_clkout_init); > > +CLK_OF_DECLARE(exynos3250_clkout, "samsung,exynos3250-pmu", > > + exynos4_clkout_init); > > Are you sure that the PMU DEBUG register on Exynos3250 is indeed > compatible with Exynos4 and not with newer SoCs? AFAIR, the only > difference was the number of bits (4 on Exynos4 and 5 on Exynos5?) of > the main mux. Exynos3250 PMU_DEBUG register is same with Exynos4. So I just use exynos4_clkout_init function. But, on second thought, It looks good to add exynos3_clkout_init function for Exynos3 SoC even though it's the same with exynos4_clkout_init. what is your opinion? Best Regards, Inha Song. > > Best regards, > Tomasz -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] clk: samsung: Add CLKOUT driver support for Exynos3250 SoC.
Hi, Tomasz, Thanks for you comment :) On Wed, 25 Feb 2015 09:54:02 +0900 Tomasz Figa tomasz.f...@gmail.com wrote: Hi Inha, Thanks for the patch. Please see my comments inline. 2015-02-24 18:22 GMT+09:00 Inha Song ideal.s...@samsung.com: This patch add CLKOUT driver support for Exynos3250 SoC. Could you please add a little more information? I know that it might be pretty obvious to people familiar with this driver and/or hardware, but it might be a good idea to explicitly say that the CLKOUT controller is compatible with Exynos4, so only a new compatible string is added. On the other hand, do you really need to add a new compatible string if an existing one can be reused? The reason why the DT property is called compatible is to be able to use the same compatible strings on different devices, because they are compatible, even though the string might have its name after only one of them. If there is some additional reason to add a new compatible string, please write this in commit message. In in PMU document(Document/devicetree/bindgins/arm/samsung/pmu.txt), samsung,exynos3250-pmu compatible string had been added. So I add this compatible in driver. Signed-off-by: Inha Song ideal.s...@samsung.com --- drivers/clk/samsung/clk-exynos-clkout.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c index 3a7cb25..1c02e73 100644 --- a/drivers/clk/samsung/clk-exynos-clkout.c +++ b/drivers/clk/samsung/clk-exynos-clkout.c @@ -142,6 +142,8 @@ CLK_OF_DECLARE(exynos4212_clkout, samsung,exynos4212-pmu, exynos4_clkout_init); CLK_OF_DECLARE(exynos4412_clkout, samsung,exynos4412-pmu, exynos4_clkout_init); +CLK_OF_DECLARE(exynos3250_clkout, samsung,exynos3250-pmu, + exynos4_clkout_init); Are you sure that the PMU DEBUG register on Exynos3250 is indeed compatible with Exynos4 and not with newer SoCs? AFAIR, the only difference was the number of bits (4 on Exynos4 and 5 on Exynos5?) of the main mux. Exynos3250 PMU_DEBUG register is same with Exynos4. So I just use exynos4_clkout_init function. But, on second thought, It looks good to add exynos3_clkout_init function for Exynos3 SoC even though it's the same with exynos4_clkout_init. what is your opinion? Best Regards, Inha Song. Best regards, Tomasz -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: dts: Add the source clock for CLKOUT register as xusbxti
This patch add the CLKOUT register source clock as xusbxti in PMU (Power Management Unit) dt node on Exynos3250. Cc: Kukjin Kim Signed-off-by: Inha Song --- arch/arm/boot/dts/exynos3250.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi index 277b48b..aa1eb8c 100644 --- a/arch/arm/boot/dts/exynos3250.dtsi +++ b/arch/arm/boot/dts/exynos3250.dtsi @@ -130,6 +130,9 @@ pmu_system_controller: system-controller@1002 { compatible = "samsung,exynos3250-pmu", "syscon"; reg = <0x1002 0x4000>; + #clock-cells = <1>; + clock-names = "clkout9"; + clocks = <>; }; mipi_phy: video-phy@10020710 { -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] clk: samsung: Add CLKOUT driver support for Exynos3250 SoC.
This patch add CLKOUT driver support for Exynos3250 SoC. Signed-off-by: Inha Song --- drivers/clk/samsung/clk-exynos-clkout.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c index 3a7cb25..1c02e73 100644 --- a/drivers/clk/samsung/clk-exynos-clkout.c +++ b/drivers/clk/samsung/clk-exynos-clkout.c @@ -142,6 +142,8 @@ CLK_OF_DECLARE(exynos4212_clkout, "samsung,exynos4212-pmu", exynos4_clkout_init); CLK_OF_DECLARE(exynos4412_clkout, "samsung,exynos4412-pmu", exynos4_clkout_init); +CLK_OF_DECLARE(exynos3250_clkout, "samsung,exynos3250-pmu", + exynos4_clkout_init); static void __init exynos5_clkout_init(struct device_node *node) { -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] clk: samsung: Add CLKOUT driver support for Exynos3250 SoC.
This patch add CLKOUT driver support for Exynos3250 SoC. Signed-off-by: Inha Song ideal.s...@samsung.com --- drivers/clk/samsung/clk-exynos-clkout.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c index 3a7cb25..1c02e73 100644 --- a/drivers/clk/samsung/clk-exynos-clkout.c +++ b/drivers/clk/samsung/clk-exynos-clkout.c @@ -142,6 +142,8 @@ CLK_OF_DECLARE(exynos4212_clkout, samsung,exynos4212-pmu, exynos4_clkout_init); CLK_OF_DECLARE(exynos4412_clkout, samsung,exynos4412-pmu, exynos4_clkout_init); +CLK_OF_DECLARE(exynos3250_clkout, samsung,exynos3250-pmu, + exynos4_clkout_init); static void __init exynos5_clkout_init(struct device_node *node) { -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: dts: Add the source clock for CLKOUT register as xusbxti
This patch add the CLKOUT register source clock as xusbxti in PMU (Power Management Unit) dt node on Exynos3250. Cc: Kukjin Kim kg...@kernel.org Signed-off-by: Inha Song ideal.s...@samsung.com --- arch/arm/boot/dts/exynos3250.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi index 277b48b..aa1eb8c 100644 --- a/arch/arm/boot/dts/exynos3250.dtsi +++ b/arch/arm/boot/dts/exynos3250.dtsi @@ -130,6 +130,9 @@ pmu_system_controller: system-controller@1002 { compatible = samsung,exynos3250-pmu, syscon; reg = 0x1002 0x4000; + #clock-cells = 1; + clock-names = clkout9; + clocks = xusbxti; }; mipi_phy: video-phy@10020710 { -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH v4 3/3] ARM: dts: Add sound nodes for exynos4412-trats2
Hi Kukjin, Sorry, I missed to adding in Cc. Best Regards, Inha Song. On Fri, 23 Jan 2015 14:03:30 +0900 Inha Song wrote: > This patch add WM1811 audio codec, I2S interface and the sound > machine nodes to enable audio on exynos4412-trats2 board. > > Signed-off-by: Inha Song > --- > arch/arm/boot/dts/exynos4412-trats2.dts | 42 > + > 1 file changed, 42 insertions(+) > > diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts > b/arch/arm/boot/dts/exynos4412-trats2.dts > index 29231b4..6205b98 100644 > --- a/arch/arm/boot/dts/exynos4412-trats2.dts > +++ b/arch/arm/boot/dts/exynos4412-trats2.dts > @@ -203,6 +203,25 @@ > }; > }; > > + i2c@138A { > + samsung,i2c-sda-delay = <100>; > + samsung,i2c-slave-addr = <0x10>; > + samsung,i2c-max-bus-freq = <10>; > + pinctrl-0 = <_bus>; > + pinctrl-names = "default"; > + status = "okay"; > + > + wm1811: wm1811@1a { > + compatible = "wlf,wm1811"; > + reg = <0x1a>; > + clocks = <_system_controller 0>; > + clock-names = "MCLK1"; > + DCVDD-supply = <_reg>; > + DBVDD1-supply = <_reg>; > + wlf,ldo1ena = < 4 0>; > + }; > + }; > + > i2c@138D { > samsung,i2c-sda-delay = <100>; > samsung,i2c-slave-addr = <0x10>; > @@ -838,6 +857,24 @@ > }; > }; > > + i2s0: i2s@0383 { > + pinctrl-0 = <_bus>; > + pinctrl-names = "default"; > + status = "okay"; > + }; > + > + sound { > + compatible = "samsung,trats2-audio"; > + samsung,i2s-controller = <>; > + samsung,model = "Trats2"; > + samsung,audio-codec = <>; > + samsung,audio-routing = > + "SPK", "SPKOUTLN", > + "SPK", "SPKOUTLP", > + "SPK", "SPKOUTRN", > + "SPK", "SPKOUTRP"; > + }; > + > exynos-usbphy@125B { > status = "okay"; > }; > @@ -865,6 +902,11 @@ > }; > }; > > +_system_controller { > + assigned-clocks = <_system_controller 0>; > + assigned-clock-parents = < CLK_XUSBXTI>; > +}; > + > _0 { > pinctrl-names = "default"; > pinctrl-0 = <>; > -- > 2.0.0.390.gcb682f8 > > ___ > Alsa-devel mailing list > alsa-de...@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v4 0/3] Sound support for Exynos4412 Trats2 board
This patch-set adds basic sound support for the Trats2 boards. It just support primary I2s and external speaker playback. Changes in v4: - Move to clock out parent settings in exynos4412-trats2.dts - Remove unnecessary lines in Trats2 machine driver. - Change name of dai stream to more cleary. - Add MFD_WM8994 to select in machine driver kconfig. Changes in v3: - Set clock out parent to XUSBXTI in pmu_system_controller DT node. Changes in v2: - Remove unnecessary lines in Trats2 machine driver. - move clock enable/disable to .startup / .shutdown. - Fix code style issues. - Remove mclk DT property in Trats2 sound and add MCLK1 property in WM1811 node. (MCLK1 is optional property in WM8994 node - refer: Document/devicetree/bindings/sound/wm8994.txt) - Use mclk that defined in WM1811 DT node. - Add "samsung,audio-codec" property to required properties. Inha Song (3): ASoC: samsung: Add machine driver for Trats2 ASoC: samsung: Document Trats2 audio subsystem bindings ARM: dts: Add sound nodes for exynos4412-trats2 .../bindings/sound/samsung,trats2-wm1811.txt | 25 +++ arch/arm/boot/dts/exynos4412-trats2.dts| 42 sound/soc/samsung/Kconfig | 9 + sound/soc/samsung/Makefile | 2 + sound/soc/samsung/trats2_wm1811.c | 211 + 5 files changed, 289 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt create mode 100644 sound/soc/samsung/trats2_wm1811.c -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v4 1/3] ASoC: samsung: Add machine driver for Trats2
This patch add the sound machine driver for Trats2 board. The codec operate in master mode. Signed-off-by: Inha Song --- sound/soc/samsung/Kconfig | 9 ++ sound/soc/samsung/Makefile| 2 + sound/soc/samsung/trats2_wm1811.c | 211 ++ 3 files changed, 222 insertions(+) create mode 100644 sound/soc/samsung/trats2_wm1811.c diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index fc67f97..df6734d 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -245,3 +245,12 @@ config SND_SOC_ARNDALE_RT5631_ALC5631 depends on SND_SOC_SAMSUNG select SND_SAMSUNG_I2S select SND_SOC_RT5631 + +config SND_SOC_SAMSUNG_TRATS2_WM1811 + tristate "SoC I2S Audio support for WM1811 on Tizen Trats2 board" + depends on SND_SOC_SAMSUNG + select SND_SAMSUNG_I2S + select MFD_WM8994 + select SND_SOC_WM8994 + help + Say Y if you want to add support for SoC audio on the Tizen Trats2 board. diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index 31e3dba..e2b7b1b 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile @@ -46,6 +46,7 @@ snd-soc-littlemill-objs := littlemill.o snd-soc-bells-objs := bells.o snd-soc-odroidx2-max98090-objs := odroidx2_max98090.o snd-soc-arndale-rt5631-objs := arndale_rt5631.o +snd-soc-trats2-wm1811-objs := trats2_wm1811.o obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o @@ -73,3 +74,4 @@ obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o obj-$(CONFIG_SND_SOC_BELLS) += snd-soc-bells.o obj-$(CONFIG_SND_SOC_ODROIDX2) += snd-soc-odroidx2-max98090.o obj-$(CONFIG_SND_SOC_ARNDALE_RT5631_ALC5631) += snd-soc-arndale-rt5631.o +obj-$(CONFIG_SND_SOC_SAMSUNG_TRATS2_WM1811) += snd-soc-trats2-wm1811.o diff --git a/sound/soc/samsung/trats2_wm1811.c b/sound/soc/samsung/trats2_wm1811.c new file mode 100644 index 000..e87ea1f --- /dev/null +++ b/sound/soc/samsung/trats2_wm1811.c @@ -0,0 +1,211 @@ +/* + * Copyright (C) 2015 Samsung Electronics Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include +#include "i2s.h" +#include "../codecs/wm8994.h" + +struct trats2_machine_priv { + struct clk *clk_mclk; +}; + +static struct trats2_machine_priv trats2_wm1811_priv; + +static const struct snd_kcontrol_new trats2_controls[] = { + SOC_DAPM_PIN_SWITCH("SPK"), +}; + +static const struct snd_soc_dapm_widget trats2_dapm_widgets[] = { + SND_SOC_DAPM_SPK("SPK", NULL), +}; + +static int trats2_aif1_hw_params(struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card); + unsigned int sysclk_rate; + unsigned int mclk_rate = + (unsigned int)clk_get_rate(priv->clk_mclk); + int ret; + + /* SYSCLK must be greater than 4.096MHz */ + if (params_rate(params) == 8000 || params_rate(params) == 11025) + sysclk_rate = params_rate(params) * 512; + else + sysclk_rate = params_rate(params) * 256; + + /* Set the codec FLL1 */ + ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, WM8994_FLL_SRC_MCLK1, + mclk_rate, sysclk_rate); + if (ret < 0) { + dev_err(codec_dai->dev, "Failed to set FLL1: %d\n", ret); + return ret; + } + + /* Set the codec SYSCLK */ + ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1, +sysclk_rate, SND_SOC_CLOCK_IN); + if (ret < 0) { + dev_err(codec_dai->dev, "Failed to set SYSCLK: %d\n", ret); + return ret; + } + + return 0; +} + +static int trats2_aif1_startup(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card); + int ret; + + ret = clk_prepare_enable(priv->clk_mclk); + if (ret) { + dev_err(rtd->card->dev, "Failed to enable mclk: %d\n", ret); + return ret; + } + + return 0; +} + +static void trats2_aif1_shutdown(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; +
[alsa-devel] [PATCH v4 3/3] ARM: dts: Add sound nodes for exynos4412-trats2
This patch add WM1811 audio codec, I2S interface and the sound machine nodes to enable audio on exynos4412-trats2 board. Signed-off-by: Inha Song --- arch/arm/boot/dts/exynos4412-trats2.dts | 42 + 1 file changed, 42 insertions(+) diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 29231b4..6205b98 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -203,6 +203,25 @@ }; }; + i2c@138A { + samsung,i2c-sda-delay = <100>; + samsung,i2c-slave-addr = <0x10>; + samsung,i2c-max-bus-freq = <10>; + pinctrl-0 = <_bus>; + pinctrl-names = "default"; + status = "okay"; + + wm1811: wm1811@1a { + compatible = "wlf,wm1811"; + reg = <0x1a>; + clocks = <_system_controller 0>; + clock-names = "MCLK1"; + DCVDD-supply = <_reg>; + DBVDD1-supply = <_reg>; + wlf,ldo1ena = < 4 0>; + }; + }; + i2c@138D { samsung,i2c-sda-delay = <100>; samsung,i2c-slave-addr = <0x10>; @@ -838,6 +857,24 @@ }; }; + i2s0: i2s@0383 { + pinctrl-0 = <_bus>; + pinctrl-names = "default"; + status = "okay"; + }; + + sound { + compatible = "samsung,trats2-audio"; + samsung,i2s-controller = <>; + samsung,model = "Trats2"; + samsung,audio-codec = <>; + samsung,audio-routing = + "SPK", "SPKOUTLN", + "SPK", "SPKOUTLP", + "SPK", "SPKOUTRN", + "SPK", "SPKOUTRP"; + }; + exynos-usbphy@125B { status = "okay"; }; @@ -865,6 +902,11 @@ }; }; +_system_controller { + assigned-clocks = <_system_controller 0>; + assigned-clock-parents = < CLK_XUSBXTI>; +}; + _0 { pinctrl-names = "default"; pinctrl-0 = <>; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v4 2/3] ASoC: samsung: Document Trats2 audio subsystem bindings
This patch add Trats2 audio subsystem bindings document. Signed-off-by: Inha Song --- .../bindings/sound/samsung,trats2-wm1811.txt | 25 ++ 1 file changed, 25 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt diff --git a/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt b/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt new file mode 100644 index 000..319ff07 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt @@ -0,0 +1,25 @@ +Samsung Exynos Trats2 audio with WM1811 codec + +Required properties: + + - compatible : Must be "samsung,trats2-audio" + - samsung,i2s-controller : The phandle of the I2S controller + - samsung,model : The user visible name of this sound + - samsung,audio-codec : The phandle of the WM1811 audio codec + - samsung,audio-routing : A list of the connections between audio + components. each entry is a pair of strings, the first being the + connection's sink, the second being the connection's source + +Example: + +sound { + compatible = "samsung,trats2-audio"; + samsung,i2s-controller = <>; + samsung,model = "Trats2"; + samsung,audio-codec = <>; + samsung,audio-routing = + "SPK", "SPKOUTLN", + "SPK", "SPKOUTLP", + "SPK", "SPKOUTRN", + "SPK", "SPKOUTRP"; +}; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH v3 1/4] ASoC: samsung: Add machine driver for Trats2
Hi, Thanks for your review. On Thu, 22 Jan 2015 13:16:03 +0100 Sylwester Nawrocki wrote: > On 22/01/15 12:17, Inha Song wrote: > > diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig > > index fc67f97..8031423 100644 > > --- a/sound/soc/samsung/Kconfig > > +++ b/sound/soc/samsung/Kconfig > > @@ -245,3 +245,11 @@ config SND_SOC_ARNDALE_RT5631_ALC5631 > > depends on SND_SOC_SAMSUNG > > select SND_SAMSUNG_I2S > > select SND_SOC_RT5631 > > + > > +config SND_SOC_SAMSUNG_TRATS2_WM1811 > > + tristate "SoC I2S Audio support for WM1811 on Tizen Trats2 board" > > + depends on SND_SOC_SAMSUNG > > + select SND_SOC_WM8994 > > + select SND_SAMSUNG_I2S > > Shouldn't you also select the MFD part of WM8994 here ? Maybe, I will add also "select MFD_WM8994" > > > +++ b/sound/soc/samsung/trats2_wm1811.c > > @@ -0,0 +1,218 @@ > > > +static struct snd_soc_dai_link trats2_dai[] = { > > + { > > + .name = "WM1811 AIF1", > > + .stream_name= "Pri_Dai", > > Could we have a less cryptic name here, e.g. "HiFi Primary" ? Looks like "HiFi Primary", I will fix. > > > + .codec_dai_name = "wm8994-aif1", > > + .codec_name = "wm8994-codec", > > + .ops= _aif1_ops, > > + .dai_fmt= SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | > > + SND_SOC_DAIFMT_CBM_CFM, > > + }, > > +}; > > > +static int trats2_audio_probe(struct platform_device *pdev) > > +{ > > + struct device_node *np = pdev->dev.of_node; > > + struct snd_soc_card *card = _card; > > + struct device_node *codec_node; > > + struct snd_soc_dai_link *dai_link = card->dai_link; > > + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(card); > > + int ret; > > + > > + if (!np) { > > + dev_err(>dev, "of node is missing.\n"); > > + return -ENODEV; > > I'd say this whole np test could be dropped, we will fail right below > at the snd_soc_of_parse_card_name() function call if np is NULL. > Such a situation seems highly unlikely anyway. I will remove :) > > > + } > > + > > + card->dev = >dev; > > + > > + ret = snd_soc_of_parse_card_name(card, "samsung,model"); > > + if (ret) { > > + dev_err(>dev, > > + "Card name is not provided\n"); > > I guess it would fit in a single line. Oh, Thanks. > > > + return ret; > > + } > > + > > > +static struct platform_driver trats2_audio_driver = { > > + .driver = { > > + .name = "trats2-audio", > > + .owner = THIS_MODULE, > > You can drop this .owner field assignment, it's also done in > module_platform_driver() macro. > Yes, I will fix based on your comments :) Thanks, Best Regards, Inha Song. > > + .pm = _soc_pm_ops, > > + .of_match_table = trats2_audio_of_match, > > + }, > > + .probe = trats2_audio_probe, > > + .remove = trats2_audio_remove, > > +}; > > + > > +module_platform_driver(trats2_audio_driver); > > -- > Regards, > Sylwester > -- > To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" > in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH v3 3/4] ARM: dts: set clock out parent to XUSBXTI
Hi, Thanks for your comment. On Thu, 22 Jan 2015 13:25:07 +0100 Sylwester Nawrocki wrote: > On 22/01/15 12:18, Inha Song wrote: > > This patch set clock out parent to XUSBXTI. > > > > Signed-off-by: Inha Song > > --- > > arch/arm/boot/dts/exynos4.dtsi | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi > > index b8168f1..020bbaf 100644 > > --- a/arch/arm/boot/dts/exynos4.dtsi > > +++ b/arch/arm/boot/dts/exynos4.dtsi > > @@ -141,6 +141,8 @@ > > pmu_system_controller: system-controller@1002 { > > compatible = "samsung,exynos4210-pmu", "syscon"; > > reg = <0x1002 0x4000>; > > + assigned-clocks = <_system_controller 0>; > > + assigned-clock-parents = < CLK_XUSBXTI>; > > }; > > Looks good, except it needs to be done only for the Trats2 board, i.e. > the PMU device node including these properties should be added to > exynos4412-trats2.dts. I think it's fine to make it a one patch including > all dts changes. Opps! I understand. I will move this node to exynos4412-trats2.dts. _system_controller { assigned-clocks = <_system_controller 0>; assigned-clock-parents = < CLK_XUSBXTI>; }; Thanks! Best Regards, Inha Song. > > > -- > Regards, > Sylwester > ___ > Alsa-devel mailing list > alsa-de...@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 3/4] ARM: dts: set clock out parent to XUSBXTI
This patch set clock out parent to XUSBXTI. Signed-off-by: Inha Song --- arch/arm/boot/dts/exynos4.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi index b8168f1..020bbaf 100644 --- a/arch/arm/boot/dts/exynos4.dtsi +++ b/arch/arm/boot/dts/exynos4.dtsi @@ -141,6 +141,8 @@ pmu_system_controller: system-controller@1002 { compatible = "samsung,exynos4210-pmu", "syscon"; reg = <0x1002 0x4000>; + assigned-clocks = <_system_controller 0>; + assigned-clock-parents = < CLK_XUSBXTI>; }; dsi_0: dsi@11C8 { -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 4/4] ARM: dts: Add sound nodes for exynos4412-trats2
This patch add WM1811 audio codec, I2S interface and the sound machine nodes to enable audio on exynos4412-trats2 board. Signed-off-by: Inha Song --- arch/arm/boot/dts/exynos4412-trats2.dts | 37 + 1 file changed, 37 insertions(+) diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 29231b4..ec1acaf 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -203,6 +203,25 @@ }; }; + i2c@138A { + samsung,i2c-sda-delay = <100>; + samsung,i2c-slave-addr = <0x10>; + samsung,i2c-max-bus-freq = <10>; + pinctrl-0 = <_bus>; + pinctrl-names = "default"; + status = "okay"; + + wm1811: wm1811@1a { + compatible = "wlf,wm1811"; + reg = <0x1a>; + clocks = <_system_controller 0>; + clock-names = "MCLK1"; + DCVDD-supply = <_reg>; + DBVDD1-supply = <_reg>; + wlf,ldo1ena = < 4 0>; + }; + }; + i2c@138D { samsung,i2c-sda-delay = <100>; samsung,i2c-slave-addr = <0x10>; @@ -838,6 +857,24 @@ }; }; + i2s0: i2s@0383 { + pinctrl-0 = <_bus>; + pinctrl-names = "default"; + status = "okay"; + }; + + sound { + compatible = "samsung,trats2-audio"; + samsung,i2s-controller = <>; + samsung,model = "Trats2"; + samsung,audio-codec = <>; + samsung,audio-routing = + "SPK", "SPKOUTLN", + "SPK", "SPKOUTLP", + "SPK", "SPKOUTRN", + "SPK", "SPKOUTRP"; + }; + exynos-usbphy@125B { status = "okay"; }; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 1/4] ASoC: samsung: Add machine driver for Trats2
This patch add the sound machine driver for Trats2 board. The codec operate in master mode. Signed-off-by: Inha Song --- sound/soc/samsung/Kconfig | 8 ++ sound/soc/samsung/Makefile| 2 + sound/soc/samsung/trats2_wm1811.c | 218 ++ 3 files changed, 228 insertions(+) create mode 100644 sound/soc/samsung/trats2_wm1811.c diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index fc67f97..8031423 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -245,3 +245,11 @@ config SND_SOC_ARNDALE_RT5631_ALC5631 depends on SND_SOC_SAMSUNG select SND_SAMSUNG_I2S select SND_SOC_RT5631 + +config SND_SOC_SAMSUNG_TRATS2_WM1811 + tristate "SoC I2S Audio support for WM1811 on Tizen Trats2 board" + depends on SND_SOC_SAMSUNG + select SND_SOC_WM8994 + select SND_SAMSUNG_I2S + help + Say Y if you want to add support for SoC audio on the Tizen Trats2 board. diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index 31e3dba..e2b7b1b 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile @@ -46,6 +46,7 @@ snd-soc-littlemill-objs := littlemill.o snd-soc-bells-objs := bells.o snd-soc-odroidx2-max98090-objs := odroidx2_max98090.o snd-soc-arndale-rt5631-objs := arndale_rt5631.o +snd-soc-trats2-wm1811-objs := trats2_wm1811.o obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o @@ -73,3 +74,4 @@ obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o obj-$(CONFIG_SND_SOC_BELLS) += snd-soc-bells.o obj-$(CONFIG_SND_SOC_ODROIDX2) += snd-soc-odroidx2-max98090.o obj-$(CONFIG_SND_SOC_ARNDALE_RT5631_ALC5631) += snd-soc-arndale-rt5631.o +obj-$(CONFIG_SND_SOC_SAMSUNG_TRATS2_WM1811) += snd-soc-trats2-wm1811.o diff --git a/sound/soc/samsung/trats2_wm1811.c b/sound/soc/samsung/trats2_wm1811.c new file mode 100644 index 000..b937612 --- /dev/null +++ b/sound/soc/samsung/trats2_wm1811.c @@ -0,0 +1,218 @@ +/* + * Copyright (C) 2015 Samsung Electronics Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include +#include "i2s.h" +#include "../codecs/wm8994.h" + +struct trats2_machine_priv { + struct clk *clk_mclk; +}; + +static struct trats2_machine_priv trats2_wm1811_priv; + +static const struct snd_kcontrol_new trats2_controls[] = { + SOC_DAPM_PIN_SWITCH("SPK"), +}; + +static const struct snd_soc_dapm_widget trats2_dapm_widgets[] = { + SND_SOC_DAPM_SPK("SPK", NULL), +}; + +static int trats2_aif1_hw_params(struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card); + unsigned int sysclk_rate; + unsigned int mclk_rate = + (unsigned int)clk_get_rate(priv->clk_mclk); + int ret; + + /* SYSCLK must be greater than 4.096MHz */ + if (params_rate(params) == 8000 || params_rate(params) == 11025) + sysclk_rate = params_rate(params) * 512; + else + sysclk_rate = params_rate(params) * 256; + + /* Set the codec FLL1 */ + ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, WM8994_FLL_SRC_MCLK1, + mclk_rate, sysclk_rate); + if (ret < 0) { + dev_err(codec_dai->dev, "Failed to set FLL1: %d\n", ret); + return ret; + } + + /* Set the codec SYSCLK */ + ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1, +sysclk_rate, SND_SOC_CLOCK_IN); + if (ret < 0) { + dev_err(codec_dai->dev, "Failed to set SYSCLK: %d\n", ret); + return ret; + } + + return 0; +} + +static int trats2_aif1_startup(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card); + int ret; + + ret = clk_prepare_enable(priv->clk_mclk); + if (ret) { + dev_err(rtd->card->dev, "Failed to enable mclk: %d\n", ret); + return ret; + } + + return 0; +} + +static void trats2_aif1_shutdown(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct trats2_machine_pr
[alsa-devel] [PATCH v3 0/4] Sound support for Exynos4412 Trats2 board
This patch-set adds basic sound support for the Trats2 boards. It just support primary I2s and external speaker playback. Changes in v3: - Set clock out parent to XUSBXTI in pmu_system_controller DT node. Changes in v2: - Remove unnecessary lines in Trats2 machine driver - move clock enable/disable to .startup / .shutdown - Fix code style issues - Remove mclk DT property in Trats2 sound and add MCLK1 property in WM1811 node. (MCLK1 is optional property in WM8994 node - refer: Document/devicetree/bindings/sound/wm8994.txt) - Use mclk that defined in WM1811 DT node. - Add "samsung,audio-codec" property to required properties. Inha Song (4): ASoC: samsung: Add machine driver for Trats2 ASoC: samsung: Document Trats2 audio subsystem bindings ARM: dts: set clock out parent to XUSBXTI ARM: dts: Add sound nodes for exynos4412-trats2 .../bindings/sound/samsung,trats2-wm1811.txt | 25 +++ arch/arm/boot/dts/exynos4.dtsi | 2 + arch/arm/boot/dts/exynos4412-trats2.dts| 37 sound/soc/samsung/Kconfig | 8 + sound/soc/samsung/Makefile | 2 + sound/soc/samsung/trats2_wm1811.c | 218 + 6 files changed, 292 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt create mode 100644 sound/soc/samsung/trats2_wm1811.c -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 2/4] ASoC: samsung: Document Trats2 audio subsystem bindings
This patch add Trats2 audio subsystem bindings document. Signed-off-by: Inha Song --- .../bindings/sound/samsung,trats2-wm1811.txt | 25 ++ 1 file changed, 25 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt diff --git a/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt b/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt new file mode 100644 index 000..319ff07 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt @@ -0,0 +1,25 @@ +Samsung Exynos Trats2 audio with WM1811 codec + +Required properties: + + - compatible : Must be "samsung,trats2-audio" + - samsung,i2s-controller : The phandle of the I2S controller + - samsung,model : The user visible name of this sound + - samsung,audio-codec : The phandle of the WM1811 audio codec + - samsung,audio-routing : A list of the connections between audio + components. each entry is a pair of strings, the first being the + connection's sink, the second being the connection's source + +Example: + +sound { + compatible = "samsung,trats2-audio"; + samsung,i2s-controller = <>; + samsung,model = "Trats2"; + samsung,audio-codec = <>; + samsung,audio-routing = + "SPK", "SPKOUTLN", + "SPK", "SPKOUTLP", + "SPK", "SPKOUTRN", + "SPK", "SPKOUTRP"; +}; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 0/4] Sound support for Exynos4412 Trats2 board
This patch-set adds basic sound support for the Trats2 boards. It just support primary I2s and external speaker playback. Changes in v3: - Set clock out parent to XUSBXTI in pmu_system_controller DT node. Changes in v2: - Remove unnecessary lines in Trats2 machine driver - move clock enable/disable to .startup / .shutdown - Fix code style issues - Remove mclk DT property in Trats2 sound and add MCLK1 property in WM1811 node. (MCLK1 is optional property in WM8994 node - refer: Document/devicetree/bindings/sound/wm8994.txt) - Use mclk that defined in WM1811 DT node. - Add samsung,audio-codec property to required properties. Inha Song (4): ASoC: samsung: Add machine driver for Trats2 ASoC: samsung: Document Trats2 audio subsystem bindings ARM: dts: set clock out parent to XUSBXTI ARM: dts: Add sound nodes for exynos4412-trats2 .../bindings/sound/samsung,trats2-wm1811.txt | 25 +++ arch/arm/boot/dts/exynos4.dtsi | 2 + arch/arm/boot/dts/exynos4412-trats2.dts| 37 sound/soc/samsung/Kconfig | 8 + sound/soc/samsung/Makefile | 2 + sound/soc/samsung/trats2_wm1811.c | 218 + 6 files changed, 292 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt create mode 100644 sound/soc/samsung/trats2_wm1811.c -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 2/4] ASoC: samsung: Document Trats2 audio subsystem bindings
This patch add Trats2 audio subsystem bindings document. Signed-off-by: Inha Song ideal.s...@samsung.com --- .../bindings/sound/samsung,trats2-wm1811.txt | 25 ++ 1 file changed, 25 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt diff --git a/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt b/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt new file mode 100644 index 000..319ff07 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt @@ -0,0 +1,25 @@ +Samsung Exynos Trats2 audio with WM1811 codec + +Required properties: + + - compatible : Must be samsung,trats2-audio + - samsung,i2s-controller : The phandle of the I2S controller + - samsung,model : The user visible name of this sound + - samsung,audio-codec : The phandle of the WM1811 audio codec + - samsung,audio-routing : A list of the connections between audio + components. each entry is a pair of strings, the first being the + connection's sink, the second being the connection's source + +Example: + +sound { + compatible = samsung,trats2-audio; + samsung,i2s-controller = i2s0; + samsung,model = Trats2; + samsung,audio-codec = wm1811; + samsung,audio-routing = + SPK, SPKOUTLN, + SPK, SPKOUTLP, + SPK, SPKOUTRN, + SPK, SPKOUTRP; +}; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 4/4] ARM: dts: Add sound nodes for exynos4412-trats2
This patch add WM1811 audio codec, I2S interface and the sound machine nodes to enable audio on exynos4412-trats2 board. Signed-off-by: Inha Song ideal.s...@samsung.com --- arch/arm/boot/dts/exynos4412-trats2.dts | 37 + 1 file changed, 37 insertions(+) diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 29231b4..ec1acaf 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -203,6 +203,25 @@ }; }; + i2c@138A { + samsung,i2c-sda-delay = 100; + samsung,i2c-slave-addr = 0x10; + samsung,i2c-max-bus-freq = 10; + pinctrl-0 = i2c4_bus; + pinctrl-names = default; + status = okay; + + wm1811: wm1811@1a { + compatible = wlf,wm1811; + reg = 0x1a; + clocks = pmu_system_controller 0; + clock-names = MCLK1; + DCVDD-supply = ldo3_reg; + DBVDD1-supply = ldo3_reg; + wlf,ldo1ena = gpj0 4 0; + }; + }; + i2c@138D { samsung,i2c-sda-delay = 100; samsung,i2c-slave-addr = 0x10; @@ -838,6 +857,24 @@ }; }; + i2s0: i2s@0383 { + pinctrl-0 = i2s0_bus; + pinctrl-names = default; + status = okay; + }; + + sound { + compatible = samsung,trats2-audio; + samsung,i2s-controller = i2s0; + samsung,model = Trats2; + samsung,audio-codec = wm1811; + samsung,audio-routing = + SPK, SPKOUTLN, + SPK, SPKOUTLP, + SPK, SPKOUTRN, + SPK, SPKOUTRP; + }; + exynos-usbphy@125B { status = okay; }; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v3 1/4] ASoC: samsung: Add machine driver for Trats2
This patch add the sound machine driver for Trats2 board. The codec operate in master mode. Signed-off-by: Inha Song ideal.s...@samsung.com --- sound/soc/samsung/Kconfig | 8 ++ sound/soc/samsung/Makefile| 2 + sound/soc/samsung/trats2_wm1811.c | 218 ++ 3 files changed, 228 insertions(+) create mode 100644 sound/soc/samsung/trats2_wm1811.c diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index fc67f97..8031423 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -245,3 +245,11 @@ config SND_SOC_ARNDALE_RT5631_ALC5631 depends on SND_SOC_SAMSUNG select SND_SAMSUNG_I2S select SND_SOC_RT5631 + +config SND_SOC_SAMSUNG_TRATS2_WM1811 + tristate SoC I2S Audio support for WM1811 on Tizen Trats2 board + depends on SND_SOC_SAMSUNG + select SND_SOC_WM8994 + select SND_SAMSUNG_I2S + help + Say Y if you want to add support for SoC audio on the Tizen Trats2 board. diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index 31e3dba..e2b7b1b 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile @@ -46,6 +46,7 @@ snd-soc-littlemill-objs := littlemill.o snd-soc-bells-objs := bells.o snd-soc-odroidx2-max98090-objs := odroidx2_max98090.o snd-soc-arndale-rt5631-objs := arndale_rt5631.o +snd-soc-trats2-wm1811-objs := trats2_wm1811.o obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o @@ -73,3 +74,4 @@ obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o obj-$(CONFIG_SND_SOC_BELLS) += snd-soc-bells.o obj-$(CONFIG_SND_SOC_ODROIDX2) += snd-soc-odroidx2-max98090.o obj-$(CONFIG_SND_SOC_ARNDALE_RT5631_ALC5631) += snd-soc-arndale-rt5631.o +obj-$(CONFIG_SND_SOC_SAMSUNG_TRATS2_WM1811) += snd-soc-trats2-wm1811.o diff --git a/sound/soc/samsung/trats2_wm1811.c b/sound/soc/samsung/trats2_wm1811.c new file mode 100644 index 000..b937612 --- /dev/null +++ b/sound/soc/samsung/trats2_wm1811.c @@ -0,0 +1,218 @@ +/* + * Copyright (C) 2015 Samsung Electronics Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include linux/of.h +#include linux/module.h +#include linux/clk.h +#include sound/soc.h +#include sound/pcm_params.h +#include i2s.h +#include ../codecs/wm8994.h + +struct trats2_machine_priv { + struct clk *clk_mclk; +}; + +static struct trats2_machine_priv trats2_wm1811_priv; + +static const struct snd_kcontrol_new trats2_controls[] = { + SOC_DAPM_PIN_SWITCH(SPK), +}; + +static const struct snd_soc_dapm_widget trats2_dapm_widgets[] = { + SND_SOC_DAPM_SPK(SPK, NULL), +}; + +static int trats2_aif1_hw_params(struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream-private_data; + struct snd_soc_dai *codec_dai = rtd-codec_dai; + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(rtd-card); + unsigned int sysclk_rate; + unsigned int mclk_rate = + (unsigned int)clk_get_rate(priv-clk_mclk); + int ret; + + /* SYSCLK must be greater than 4.096MHz */ + if (params_rate(params) == 8000 || params_rate(params) == 11025) + sysclk_rate = params_rate(params) * 512; + else + sysclk_rate = params_rate(params) * 256; + + /* Set the codec FLL1 */ + ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, WM8994_FLL_SRC_MCLK1, + mclk_rate, sysclk_rate); + if (ret 0) { + dev_err(codec_dai-dev, Failed to set FLL1: %d\n, ret); + return ret; + } + + /* Set the codec SYSCLK */ + ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1, +sysclk_rate, SND_SOC_CLOCK_IN); + if (ret 0) { + dev_err(codec_dai-dev, Failed to set SYSCLK: %d\n, ret); + return ret; + } + + return 0; +} + +static int trats2_aif1_startup(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream-private_data; + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(rtd-card); + int ret; + + ret = clk_prepare_enable(priv-clk_mclk); + if (ret) { + dev_err(rtd-card-dev, Failed to enable mclk: %d\n, ret); + return ret; + } + + return 0; +} + +static void trats2_aif1_shutdown(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream-private_data; + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(rtd-card
[alsa-devel] [PATCH v3 3/4] ARM: dts: set clock out parent to XUSBXTI
This patch set clock out parent to XUSBXTI. Signed-off-by: Inha Song ideal.s...@samsung.com --- arch/arm/boot/dts/exynos4.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi index b8168f1..020bbaf 100644 --- a/arch/arm/boot/dts/exynos4.dtsi +++ b/arch/arm/boot/dts/exynos4.dtsi @@ -141,6 +141,8 @@ pmu_system_controller: system-controller@1002 { compatible = samsung,exynos4210-pmu, syscon; reg = 0x1002 0x4000; + assigned-clocks = pmu_system_controller 0; + assigned-clock-parents = clock CLK_XUSBXTI; }; dsi_0: dsi@11C8 { -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v4 3/3] ARM: dts: Add sound nodes for exynos4412-trats2
This patch add WM1811 audio codec, I2S interface and the sound machine nodes to enable audio on exynos4412-trats2 board. Signed-off-by: Inha Song ideal.s...@samsung.com --- arch/arm/boot/dts/exynos4412-trats2.dts | 42 + 1 file changed, 42 insertions(+) diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 29231b4..6205b98 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -203,6 +203,25 @@ }; }; + i2c@138A { + samsung,i2c-sda-delay = 100; + samsung,i2c-slave-addr = 0x10; + samsung,i2c-max-bus-freq = 10; + pinctrl-0 = i2c4_bus; + pinctrl-names = default; + status = okay; + + wm1811: wm1811@1a { + compatible = wlf,wm1811; + reg = 0x1a; + clocks = pmu_system_controller 0; + clock-names = MCLK1; + DCVDD-supply = ldo3_reg; + DBVDD1-supply = ldo3_reg; + wlf,ldo1ena = gpj0 4 0; + }; + }; + i2c@138D { samsung,i2c-sda-delay = 100; samsung,i2c-slave-addr = 0x10; @@ -838,6 +857,24 @@ }; }; + i2s0: i2s@0383 { + pinctrl-0 = i2s0_bus; + pinctrl-names = default; + status = okay; + }; + + sound { + compatible = samsung,trats2-audio; + samsung,i2s-controller = i2s0; + samsung,model = Trats2; + samsung,audio-codec = wm1811; + samsung,audio-routing = + SPK, SPKOUTLN, + SPK, SPKOUTLP, + SPK, SPKOUTRN, + SPK, SPKOUTRP; + }; + exynos-usbphy@125B { status = okay; }; @@ -865,6 +902,11 @@ }; }; +pmu_system_controller { + assigned-clocks = pmu_system_controller 0; + assigned-clock-parents = clock CLK_XUSBXTI; +}; + pinctrl_0 { pinctrl-names = default; pinctrl-0 = sleep0; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v4 2/3] ASoC: samsung: Document Trats2 audio subsystem bindings
This patch add Trats2 audio subsystem bindings document. Signed-off-by: Inha Song ideal.s...@samsung.com --- .../bindings/sound/samsung,trats2-wm1811.txt | 25 ++ 1 file changed, 25 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt diff --git a/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt b/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt new file mode 100644 index 000..319ff07 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt @@ -0,0 +1,25 @@ +Samsung Exynos Trats2 audio with WM1811 codec + +Required properties: + + - compatible : Must be samsung,trats2-audio + - samsung,i2s-controller : The phandle of the I2S controller + - samsung,model : The user visible name of this sound + - samsung,audio-codec : The phandle of the WM1811 audio codec + - samsung,audio-routing : A list of the connections between audio + components. each entry is a pair of strings, the first being the + connection's sink, the second being the connection's source + +Example: + +sound { + compatible = samsung,trats2-audio; + samsung,i2s-controller = i2s0; + samsung,model = Trats2; + samsung,audio-codec = wm1811; + samsung,audio-routing = + SPK, SPKOUTLN, + SPK, SPKOUTLP, + SPK, SPKOUTRN, + SPK, SPKOUTRP; +}; -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[alsa-devel] [PATCH v4 1/3] ASoC: samsung: Add machine driver for Trats2
This patch add the sound machine driver for Trats2 board. The codec operate in master mode. Signed-off-by: Inha Song ideal.s...@samsung.com --- sound/soc/samsung/Kconfig | 9 ++ sound/soc/samsung/Makefile| 2 + sound/soc/samsung/trats2_wm1811.c | 211 ++ 3 files changed, 222 insertions(+) create mode 100644 sound/soc/samsung/trats2_wm1811.c diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index fc67f97..df6734d 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -245,3 +245,12 @@ config SND_SOC_ARNDALE_RT5631_ALC5631 depends on SND_SOC_SAMSUNG select SND_SAMSUNG_I2S select SND_SOC_RT5631 + +config SND_SOC_SAMSUNG_TRATS2_WM1811 + tristate SoC I2S Audio support for WM1811 on Tizen Trats2 board + depends on SND_SOC_SAMSUNG + select SND_SAMSUNG_I2S + select MFD_WM8994 + select SND_SOC_WM8994 + help + Say Y if you want to add support for SoC audio on the Tizen Trats2 board. diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index 31e3dba..e2b7b1b 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile @@ -46,6 +46,7 @@ snd-soc-littlemill-objs := littlemill.o snd-soc-bells-objs := bells.o snd-soc-odroidx2-max98090-objs := odroidx2_max98090.o snd-soc-arndale-rt5631-objs := arndale_rt5631.o +snd-soc-trats2-wm1811-objs := trats2_wm1811.o obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o @@ -73,3 +74,4 @@ obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o obj-$(CONFIG_SND_SOC_BELLS) += snd-soc-bells.o obj-$(CONFIG_SND_SOC_ODROIDX2) += snd-soc-odroidx2-max98090.o obj-$(CONFIG_SND_SOC_ARNDALE_RT5631_ALC5631) += snd-soc-arndale-rt5631.o +obj-$(CONFIG_SND_SOC_SAMSUNG_TRATS2_WM1811) += snd-soc-trats2-wm1811.o diff --git a/sound/soc/samsung/trats2_wm1811.c b/sound/soc/samsung/trats2_wm1811.c new file mode 100644 index 000..e87ea1f --- /dev/null +++ b/sound/soc/samsung/trats2_wm1811.c @@ -0,0 +1,211 @@ +/* + * Copyright (C) 2015 Samsung Electronics Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include linux/of.h +#include linux/module.h +#include linux/clk.h +#include sound/soc.h +#include sound/pcm_params.h +#include i2s.h +#include ../codecs/wm8994.h + +struct trats2_machine_priv { + struct clk *clk_mclk; +}; + +static struct trats2_machine_priv trats2_wm1811_priv; + +static const struct snd_kcontrol_new trats2_controls[] = { + SOC_DAPM_PIN_SWITCH(SPK), +}; + +static const struct snd_soc_dapm_widget trats2_dapm_widgets[] = { + SND_SOC_DAPM_SPK(SPK, NULL), +}; + +static int trats2_aif1_hw_params(struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream-private_data; + struct snd_soc_dai *codec_dai = rtd-codec_dai; + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(rtd-card); + unsigned int sysclk_rate; + unsigned int mclk_rate = + (unsigned int)clk_get_rate(priv-clk_mclk); + int ret; + + /* SYSCLK must be greater than 4.096MHz */ + if (params_rate(params) == 8000 || params_rate(params) == 11025) + sysclk_rate = params_rate(params) * 512; + else + sysclk_rate = params_rate(params) * 256; + + /* Set the codec FLL1 */ + ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, WM8994_FLL_SRC_MCLK1, + mclk_rate, sysclk_rate); + if (ret 0) { + dev_err(codec_dai-dev, Failed to set FLL1: %d\n, ret); + return ret; + } + + /* Set the codec SYSCLK */ + ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1, +sysclk_rate, SND_SOC_CLOCK_IN); + if (ret 0) { + dev_err(codec_dai-dev, Failed to set SYSCLK: %d\n, ret); + return ret; + } + + return 0; +} + +static int trats2_aif1_startup(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream-private_data; + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(rtd-card); + int ret; + + ret = clk_prepare_enable(priv-clk_mclk); + if (ret) { + dev_err(rtd-card-dev, Failed to enable mclk: %d\n, ret); + return ret; + } + + return 0; +} + +static void trats2_aif1_shutdown(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream-private_data; + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(rtd
[alsa-devel] [PATCH v4 0/3] Sound support for Exynos4412 Trats2 board
This patch-set adds basic sound support for the Trats2 boards. It just support primary I2s and external speaker playback. Changes in v4: - Move to clock out parent settings in exynos4412-trats2.dts - Remove unnecessary lines in Trats2 machine driver. - Change name of dai stream to more cleary. - Add MFD_WM8994 to select in machine driver kconfig. Changes in v3: - Set clock out parent to XUSBXTI in pmu_system_controller DT node. Changes in v2: - Remove unnecessary lines in Trats2 machine driver. - move clock enable/disable to .startup / .shutdown. - Fix code style issues. - Remove mclk DT property in Trats2 sound and add MCLK1 property in WM1811 node. (MCLK1 is optional property in WM8994 node - refer: Document/devicetree/bindings/sound/wm8994.txt) - Use mclk that defined in WM1811 DT node. - Add samsung,audio-codec property to required properties. Inha Song (3): ASoC: samsung: Add machine driver for Trats2 ASoC: samsung: Document Trats2 audio subsystem bindings ARM: dts: Add sound nodes for exynos4412-trats2 .../bindings/sound/samsung,trats2-wm1811.txt | 25 +++ arch/arm/boot/dts/exynos4412-trats2.dts| 42 sound/soc/samsung/Kconfig | 9 + sound/soc/samsung/Makefile | 2 + sound/soc/samsung/trats2_wm1811.c | 211 + 5 files changed, 289 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/samsung,trats2-wm1811.txt create mode 100644 sound/soc/samsung/trats2_wm1811.c -- 2.0.0.390.gcb682f8 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH v3 3/4] ARM: dts: set clock out parent to XUSBXTI
Hi, Thanks for your comment. On Thu, 22 Jan 2015 13:25:07 +0100 Sylwester Nawrocki s.nawro...@samsung.com wrote: On 22/01/15 12:18, Inha Song wrote: This patch set clock out parent to XUSBXTI. Signed-off-by: Inha Song ideal.s...@samsung.com --- arch/arm/boot/dts/exynos4.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi index b8168f1..020bbaf 100644 --- a/arch/arm/boot/dts/exynos4.dtsi +++ b/arch/arm/boot/dts/exynos4.dtsi @@ -141,6 +141,8 @@ pmu_system_controller: system-controller@1002 { compatible = samsung,exynos4210-pmu, syscon; reg = 0x1002 0x4000; + assigned-clocks = pmu_system_controller 0; + assigned-clock-parents = clock CLK_XUSBXTI; }; Looks good, except it needs to be done only for the Trats2 board, i.e. the PMU device node including these properties should be added to exynos4412-trats2.dts. I think it's fine to make it a one patch including all dts changes. Opps! I understand. I will move this node to exynos4412-trats2.dts. pmu_system_controller { assigned-clocks = pmu_system_controller 0; assigned-clock-parents = clock CLK_XUSBXTI; }; Thanks! Best Regards, Inha Song. -- Regards, Sylwester ___ Alsa-devel mailing list alsa-de...@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH v3 1/4] ASoC: samsung: Add machine driver for Trats2
Hi, Thanks for your review. On Thu, 22 Jan 2015 13:16:03 +0100 Sylwester Nawrocki s.nawro...@samsung.com wrote: On 22/01/15 12:17, Inha Song wrote: diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index fc67f97..8031423 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -245,3 +245,11 @@ config SND_SOC_ARNDALE_RT5631_ALC5631 depends on SND_SOC_SAMSUNG select SND_SAMSUNG_I2S select SND_SOC_RT5631 + +config SND_SOC_SAMSUNG_TRATS2_WM1811 + tristate SoC I2S Audio support for WM1811 on Tizen Trats2 board + depends on SND_SOC_SAMSUNG + select SND_SOC_WM8994 + select SND_SAMSUNG_I2S Shouldn't you also select the MFD part of WM8994 here ? Maybe, I will add also select MFD_WM8994 +++ b/sound/soc/samsung/trats2_wm1811.c @@ -0,0 +1,218 @@ +static struct snd_soc_dai_link trats2_dai[] = { + { + .name = WM1811 AIF1, + .stream_name= Pri_Dai, Could we have a less cryptic name here, e.g. HiFi Primary ? Looks like HiFi Primary, I will fix. + .codec_dai_name = wm8994-aif1, + .codec_name = wm8994-codec, + .ops= trats2_aif1_ops, + .dai_fmt= SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBM_CFM, + }, +}; +static int trats2_audio_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev-dev.of_node; + struct snd_soc_card *card = trats2_card; + struct device_node *codec_node; + struct snd_soc_dai_link *dai_link = card-dai_link; + struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(card); + int ret; + + if (!np) { + dev_err(pdev-dev, of node is missing.\n); + return -ENODEV; I'd say this whole np test could be dropped, we will fail right below at the snd_soc_of_parse_card_name() function call if np is NULL. Such a situation seems highly unlikely anyway. I will remove :) + } + + card-dev = pdev-dev; + + ret = snd_soc_of_parse_card_name(card, samsung,model); + if (ret) { + dev_err(pdev-dev, + Card name is not provided\n); I guess it would fit in a single line. Oh, Thanks. + return ret; + } + +static struct platform_driver trats2_audio_driver = { + .driver = { + .name = trats2-audio, + .owner = THIS_MODULE, You can drop this .owner field assignment, it's also done in module_platform_driver() macro. Yes, I will fix based on your comments :) Thanks, Best Regards, Inha Song. + .pm = snd_soc_pm_ops, + .of_match_table = trats2_audio_of_match, + }, + .probe = trats2_audio_probe, + .remove = trats2_audio_remove, +}; + +module_platform_driver(trats2_audio_driver); -- Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH v4 3/3] ARM: dts: Add sound nodes for exynos4412-trats2
Hi Kukjin, Sorry, I missed to adding in Cc. Best Regards, Inha Song. On Fri, 23 Jan 2015 14:03:30 +0900 Inha Song ideal.s...@samsung.com wrote: This patch add WM1811 audio codec, I2S interface and the sound machine nodes to enable audio on exynos4412-trats2 board. Signed-off-by: Inha Song ideal.s...@samsung.com --- arch/arm/boot/dts/exynos4412-trats2.dts | 42 + 1 file changed, 42 insertions(+) diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 29231b4..6205b98 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -203,6 +203,25 @@ }; }; + i2c@138A { + samsung,i2c-sda-delay = 100; + samsung,i2c-slave-addr = 0x10; + samsung,i2c-max-bus-freq = 10; + pinctrl-0 = i2c4_bus; + pinctrl-names = default; + status = okay; + + wm1811: wm1811@1a { + compatible = wlf,wm1811; + reg = 0x1a; + clocks = pmu_system_controller 0; + clock-names = MCLK1; + DCVDD-supply = ldo3_reg; + DBVDD1-supply = ldo3_reg; + wlf,ldo1ena = gpj0 4 0; + }; + }; + i2c@138D { samsung,i2c-sda-delay = 100; samsung,i2c-slave-addr = 0x10; @@ -838,6 +857,24 @@ }; }; + i2s0: i2s@0383 { + pinctrl-0 = i2s0_bus; + pinctrl-names = default; + status = okay; + }; + + sound { + compatible = samsung,trats2-audio; + samsung,i2s-controller = i2s0; + samsung,model = Trats2; + samsung,audio-codec = wm1811; + samsung,audio-routing = + SPK, SPKOUTLN, + SPK, SPKOUTLP, + SPK, SPKOUTRN, + SPK, SPKOUTRP; + }; + exynos-usbphy@125B { status = okay; }; @@ -865,6 +902,11 @@ }; }; +pmu_system_controller { + assigned-clocks = pmu_system_controller 0; + assigned-clock-parents = clock CLK_XUSBXTI; +}; + pinctrl_0 { pinctrl-names = default; pinctrl-0 = sleep0; -- 2.0.0.390.gcb682f8 ___ Alsa-devel mailing list alsa-de...@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH v2 3/3] ARM: dts: Add sound nodes for exynos4412-trats2
Hi, Thanks for your comments. On Wed, 21 Jan 2015 17:23:21 +0100 Sylwester Nawrocki wrote: > Hi, > > On 19/01/15 10:48, Inha Song wrote: > > --- a/arch/arm/boot/dts/exynos4412-trats2.dts > > +++ b/arch/arm/boot/dts/exynos4412-trats2.dts > > > + sound { > > + compatible = "samsung,trats2-audio"; > > > + assigned-clocks = <_system_controller 0>; > > + assigned-clock-parents = < CLK_XUSBXTI>; > > How about putting these properties in the pmu_system_controller > node? After all the mux clock being configured here belongs to > the PMU subsystem. Wouldn't it work that way ? OK, I will move assigned clock properties to pmu_system_controller DT node. Best Regards, Inha Song. > > > + samsung,i2s-controller = <>; > > + samsung,model = "Trats2"; > > + samsung,audio-codec = <>; > > + samsung,audio-routing = > > + "SPK", "SPKOUTLN", > > + "SPK", "SPKOUTLP", > > + "SPK", "SPKOUTRN", > > + "SPK", "SPKOUTRP"; > > + }; > > -- > Regards, > Sylwester > ___ > Alsa-devel mailing list > alsa-de...@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARM: dts: exynos5422-odroidxu3: add sound nodes
Hi, Thanks for your comment. On Wed, 21 Jan 2015 12:41:55 +0100 Sylwester Nawrocki wrote: > Hi, > > On 21/01/15 06:58, Inha Song wrote: > > Add MAX98090 audio codec, I2S interface and the sound nodes to support > > audio on Odroid-XU3 board. > > > > Signed-off-by: Inha Song > > --- > > arch/arm/boot/dts/exynos5422-odroidxu3.dts | 34 > > ++ > > 1 file changed, 34 insertions(+) > > > > diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts > > b/arch/arm/boot/dts/exynos5422-odroidxu3.dts > > index 7874da2..79493d1 100644 > > --- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts > > +++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts > > @@ -310,6 +310,40 @@ > > rtc@101E { > > status = "okay"; > > }; > > + > > + sound: sound { > > + compatible = "samsung,odroidu3-audio"; > > How about using simple-card instead ? I've been trying to switch > Odroid X2/U3 to simple card. Here a corresponding dts patch: > http://www.spinics.net/lists/linux-samsung-soc/msg41083.html > For that recent patches for the I2S driver which area already in -next > might be needed. Oh, I missed your patchs. I will rework this patch based on your patch. Best Regards, Inha Song. > > > + samsung,model = "Odroid-XU3"; > > + samsung,i2s-controller = <>; > > + samsung,audio-codec = <>; > > + assigned-clocks = <_audss EXYNOS_MOUT_AUDSS>, > > + <_audss EXYNOS_MOUT_I2S>; > > + assigned-clock-parents = < CLK_FIN_PLL>, > > + <_audss EXYNOS_MOUT_AUDSS>; > > + samsung,audio-routing = > > + "Headphone Jack", "HPL", > > + "Headphone Jack", "HPR", > > + "Headphone Jack", "MICBIAS", > > + "IN1", "Headphone Jack", > > + "Speakers", "SPKL", > > + "Speakers", "SPKR"; > > + }; > > +}; > > + > > +_5 { > > + status = "okay"; > > + max98090: max98090@10 { > > + compatible = "maxim,max98090"; > > + reg = <0x10>; > > + interrupt-parent = <>; > > + interrupts = <2 0>; > > + clocks = <_audss EXYNOS_DOUT_AUD_BUS>; > > + clock-names = "mclk"; > > + }; > > +}; > > -- > Thanks, > Sylwester -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARM: dts: exynos5422-odroidxu3: add sound nodes
Hi, Thanks for your comment. On Wed, 21 Jan 2015 12:41:55 +0100 Sylwester Nawrocki s.nawro...@samsung.com wrote: Hi, On 21/01/15 06:58, Inha Song wrote: Add MAX98090 audio codec, I2S interface and the sound nodes to support audio on Odroid-XU3 board. Signed-off-by: Inha Song ideal.s...@samsung.com --- arch/arm/boot/dts/exynos5422-odroidxu3.dts | 34 ++ 1 file changed, 34 insertions(+) diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts index 7874da2..79493d1 100644 --- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts +++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts @@ -310,6 +310,40 @@ rtc@101E { status = okay; }; + + sound: sound { + compatible = samsung,odroidu3-audio; How about using simple-card instead ? I've been trying to switch Odroid X2/U3 to simple card. Here a corresponding dts patch: http://www.spinics.net/lists/linux-samsung-soc/msg41083.html For that recent patches for the I2S driver which area already in -next might be needed. Oh, I missed your patchs. I will rework this patch based on your patch. Best Regards, Inha Song. + samsung,model = Odroid-XU3; + samsung,i2s-controller = i2s0; + samsung,audio-codec = max98090; + assigned-clocks = clock_audss EXYNOS_MOUT_AUDSS, + clock_audss EXYNOS_MOUT_I2S; + assigned-clock-parents = clock CLK_FIN_PLL, + clock_audss EXYNOS_MOUT_AUDSS; + samsung,audio-routing = + Headphone Jack, HPL, + Headphone Jack, HPR, + Headphone Jack, MICBIAS, + IN1, Headphone Jack, + Speakers, SPKL, + Speakers, SPKR; + }; +}; + +hsi2c_5 { + status = okay; + max98090: max98090@10 { + compatible = maxim,max98090; + reg = 0x10; + interrupt-parent = gpx3; + interrupts = 2 0; + clocks = clock_audss EXYNOS_DOUT_AUD_BUS; + clock-names = mclk; + }; +}; -- Thanks, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH v2 3/3] ARM: dts: Add sound nodes for exynos4412-trats2
Hi, Thanks for your comments. On Wed, 21 Jan 2015 17:23:21 +0100 Sylwester Nawrocki s.nawro...@samsung.com wrote: Hi, On 19/01/15 10:48, Inha Song wrote: --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts + sound { + compatible = samsung,trats2-audio; + assigned-clocks = pmu_system_controller 0; + assigned-clock-parents = clock CLK_XUSBXTI; How about putting these properties in the pmu_system_controller node? After all the mux clock being configured here belongs to the PMU subsystem. Wouldn't it work that way ? OK, I will move assigned clock properties to pmu_system_controller DT node. Best Regards, Inha Song. + samsung,i2s-controller = i2s0; + samsung,model = Trats2; + samsung,audio-codec = wm1811; + samsung,audio-routing = + SPK, SPKOUTLN, + SPK, SPKOUTLP, + SPK, SPKOUTRN, + SPK, SPKOUTRP; + }; -- Regards, Sylwester ___ Alsa-devel mailing list alsa-de...@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/