All of lore.kernel.org
 help / color / mirror / Atom feed
From: Annaliese McDermond <nh6z@nh6z.net>
To: broonie@kernel.org, alsa-devel@alsa-project.org
Cc: team@nwdigitalradio.com, Annaliese McDermond <nh6z@nh6z.net>
Subject: [PATCH v3 00/11] ASoC: tlv320aic32x4: Rework Clock Setting
Date: Wed, 20 Mar 2019 19:38:43 -0700	[thread overview]
Message-ID: <20190321023854.16947-1-nh6z@nh6z.net> (raw)

The current tlv320aic32x4 code sets the various clock parameters by
looking in a static table in the kernel.  This works well enough,
but it has a few disadvantages.

1)  If the master clock doesn't match one of the precalculated values
    the driver cannot work.  This could be because the designer
    decided to use a different crystal, or because the clock comes
    from a PLL that can't quite achieve the proper frequency
    exactly.

2)  The driver only supports certain pre-calculated sample rates.
    The actual hardware can support many more.  These changes
    enable those rates.  Additionally, certain sample rates at
    certain clock rates were previously unavailable as
    combinations.

This patch dynamically calculates the various PLL and divider
values to find something that works.

Additionally, to enable much of this, the clock tree is
modeled as a part of the Common Clock Framework.  This allows
for easier debugigng as you can use the standard tools such as
/sys/kernel/debug/clk/clk_summary.  It also simplifies enabling
the entirety of the clock tree needed, and makes sure unused
clocks become disabled.

These patches have been tested and are working on a Raspberry Pi
with the simplecard driver.

Changes in v2:
 - Update 0002 patch to change Kconfig to add dependency on CCF
 - Update 0002 patch to correct the SPDX identifier
 - Update 0002 patch to use EXPORT_SYMBOL_GPL() instead of
   EXPORT_SYMBOL()
 - Update patches 0002, 0004 and 0005 to use prepare/unprepare
   instead of enable/disable since the i2c operations are not
   atomic
 - Update 0004 patch to fix indentation in commit message
 - Drop patch 0009 because it is a duplicate of the already
   committed patch in 667e9334
 - Update 0019 patch to keep aic32x4_set_dai_sysclk but to have
   it use clk_set_rate to set the master clock rate

Changes in v3:
 - Rebase on current for-next
 - Move "Properly Set Processing Blocks" to the start of the
   patches so that it can potentially be applied as a bug
   fix

Annaliese McDermond (11):
  ASoC: tlv320aic32x4: Properly Set Processing Blocks
  ASoC: tlv320aic32x4: Model PLL in CCF
  ASoC: tlv320aic32x4: Model CODEC_CLKIN in CCF
  ASoC: tlv320aic32x4: Model DAC/ADC dividers in CCF
  ASoC: tlv320aic32x4: Model BDIV divider in CCF
  ASoC: tlv320aic32x4: Control clock gating with CCF
  ASoC: tlv320aic32x4: Move aosr and dosr setting to separate functions
  ASoC: tlv320aic32x4: Dynamically Determine Clocking
  ASoC: tlv320aic32x4: Restructure set_dai_sysclk
  ASoC: tlv320aic32x4: Remove mclk references
  ASoC: tlv320aic32x4: Allow 192000 Sample Rate

 sound/soc/codecs/Kconfig             |   1 +
 sound/soc/codecs/Makefile            |   2 +-
 sound/soc/codecs/tlv320aic32x4-clk.c | 483 +++++++++++++++++++++++++++
 sound/soc/codecs/tlv320aic32x4.c     | 357 ++++++++++----------
 sound/soc/codecs/tlv320aic32x4.h     |  11 +
 5 files changed, 665 insertions(+), 189 deletions(-)
 create mode 100644 sound/soc/codecs/tlv320aic32x4-clk.c

-- 
2.19.1

             reply	other threads:[~2019-03-21  2:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21  2:38 Annaliese McDermond [this message]
2019-03-21  2:38 ` [PATCH v3 01/11] ASoC: tlv320aic32x4: Properly Set Processing Blocks Annaliese McDermond
2019-03-21 15:06   ` Applied "ASoC: tlv320aic32x4: Properly Set Processing Blocks" to the asoc tree Mark Brown
2019-03-21  2:38 ` [PATCH v3 02/11] ASoC: tlv320aic32x4: Model PLL in CCF Annaliese McDermond
2019-03-21 15:12   ` Mark Brown
2019-03-21 16:12     ` Annaliese McDermond
2019-03-25 11:24       ` Mark Brown
2019-03-21  2:38 ` [PATCH v3 03/11] ASoC: tlv320aic32x4: Model CODEC_CLKIN " Annaliese McDermond
2019-03-21  2:38 ` [PATCH v3 04/11] ASoC: tlv320aic32x4: Model DAC/ADC dividers " Annaliese McDermond
2019-03-21  2:38 ` [PATCH v3 05/11] ASoC: tlv320aic32x4: Model BDIV divider " Annaliese McDermond
2019-03-21  2:38 ` [PATCH v3 06/11] ASoC: tlv320aic32x4: Control clock gating with CCF Annaliese McDermond
2019-03-21  2:38 ` [PATCH v3 07/11] ASoC: tlv320aic32x4: Move aosr and dosr setting to separate functions Annaliese McDermond
2019-03-21  2:38 ` [PATCH v3 08/11] ASoC: tlv320aic32x4: Dynamically Determine Clocking Annaliese McDermond
2019-03-21  2:38 ` [PATCH v3 09/11] ASoC: tlv320aic32x4: Restructure set_dai_sysclk Annaliese McDermond
2019-03-21  2:38 ` [PATCH v3 10/11] ASoC: tlv320aic32x4: Remove mclk references Annaliese McDermond
2019-03-21  2:38 ` [PATCH v3 11/11] ASoC: tlv320aic32x4: Allow 192000 Sample Rate Annaliese McDermond

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190321023854.16947-1-nh6z@nh6z.net \
    --to=nh6z@nh6z.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=team@nwdigitalradio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.