All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolin Chen <Guangyu.Chen@freescale.com>
To: "jonsmirl@gmail.com" <jonsmirl@gmail.com>
Cc: alsa-devel mailing list <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	zengzm.kernel@gmail.com, Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: SGTL500 and its external MCLK
Date: Mon, 11 Aug 2014 13:50:17 +0800	[thread overview]
Message-ID: <20140811055015.GA12969@MrMyself> (raw)
In-Reply-To: <CAKON4OzHeB-bJKj_hB=L84jMROz-7vRgp7uqb45KLg4VHva2Zw@mail.gmail.com>

On Sat, Aug 09, 2014 at 12:42:43PM -0400, jonsmirl@gmail.com wrote:
> On Fri, Aug 8, 2014 at 1:07 PM, jonsmirl@gmail.com <jonsmirl@gmail.com> wrote:
> > On Fri, Aug 8, 2014 at 1:29 AM, Nicolin Chen <Guangyu.Chen@freescale.com> wrote:
> >> On Thu, Aug 07, 2014 at 03:37:47PM -0400, jonsmirl@gmail.com wrote:
> >>> Since the sgtl5000 driver has the handle to the clock, can't it just
> >>> ask the clock for its rate? If it directly asked the clock for its
> >>> rate it looks like this codec could be bound with simple-audio-card
> >>> and not need a machine driver.
> >>
> >> I think Simple Card should already have the capability to support
> >> this without changing sgtl5000's code. It has two properties that
> >> can make it call set_sysclk() for you during the init(). They are
> >> 'clocks' and 'system-clock-frequency'. Please refer to its binding
> >> doc for details.
> 
> Simple has a hard coded clock ID of zero. Which just happens to match
> codecs/sgtl5000.h:#define SGTL5000_SYSCLK 0x00
> 
> Lucky coincidence?

It's also pretty fair to think that Simple Card only supports CODEC
using the main sysclk -- id is 0x00. And I believe this also works
out for other CODECs whose sysclk configurations aren't complicated
since the name is Simple Card :)

> >> And the topic why not let sgtl5000 fully control the clock has been
> >> discussed in this thread:
> >> http://comments.gmane.org/gmane.linux.alsa.devel/109093
> >>
> >> So I think the change can be done as well?
> >
> > I tried hacking on it some. One problem is with clocks that aren't
> > 100% accurate. For example my clock is off a little - 22.571428. So
> > when the code divides that by 44100 it gets 511.8 which truncates to
> > 511 and the test for equal to 512 fails.

This is a clock dividing accuracy issue. We can try DIV_ROUND_UP()
instead of the truncating division.

Best regards,
Nicolin

  reply	other threads:[~2014-08-11  6:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-07 19:37 SGTL500 and its external MCLK jonsmirl
2014-08-08  5:29 ` Nicolin Chen
2014-08-08 17:07   ` jonsmirl
2014-08-09 16:42     ` jonsmirl
2014-08-11  5:50       ` Nicolin Chen [this message]
2014-08-11 12:29         ` jonsmirl
2014-08-13 20:39           ` Mark Brown

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=20140811055015.GA12969@MrMyself \
    --to=guangyu.chen@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jonsmirl@gmail.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=zengzm.kernel@gmail.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.