linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: w.sang@pengutronix.de (Wolfram Sang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] ASoC: mxs-saif: add record function
Date: Fri, 2 Sep 2011 16:58:33 +0200	[thread overview]
Message-ID: <20110902145833.GI1901@pengutronix.de> (raw)
In-Reply-To: <1314015630-25022-1-git-send-email-b29396@freescale.com>

On Mon, Aug 22, 2011 at 08:20:29PM +0800, Dong Aisheng wrote:
> 1. add different clkmux mode handling for record.
> SAIF can use two instances to implement full duplex (playback &
> recording) and record saif may work on EXTMASTER mode that is
> using other saif's BITCLK&LRCLK.
> The clkmux mode is determined by saif's platform data and machine
> specific clkmux setting is done in pdata->init().
> 2. support playback and capture simutaneously however the sample
> rates can not be different due to hw limitation.
> 
> Signed-off-by: Dong Aisheng <b29396@freescale.com>

First thanks to Aisheng for doing this and the discussions we had so
far :) It is what we agreed one, yet there is one detail we had
overlooked and we need to sort it out. After that, I think the patch can
go in, because it works fine on my side.

>  /*
> + * Since SAIF may work on EXTMASTER mode, IOW, it's working BITCLK&LRCLK
> + * is provided by other SAIF, we provide a interface here to get its master.
> + * Note that for DIRECT mode, it's master is itself.
> + */
> +static struct mxs_saif *mxs_saif_get_master(struct mxs_saif * saif)
> +{
> +	struct mxs_saif *master_saif;
> +
> +	/* get master saif according to different clkmux setting */
> +	switch (saif->clkmux) {
> +	case MXS_DIGCTL_SAIF_CLKMUX_DIRECT:
> +		master_saif = saif;
> +		break;
> +	case MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT:
> +		master_saif = saif->id ? mxs_saif[1] : mxs_saif[0];
> +		break;
> +	case MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0:
> +		master_saif = mxs_saif[0];
> +		break;
> +	case MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1:
> +		master_saif = mxs_saif[1];
> +		break;
> +	default:
> +		return NULL;
> +	}
> +
> +	return master_saif;
> +}

A get_master() function is probably the best we can do; yet we pull in
some mach-specific details here, namely the MXS_DIGCTL_SAIF_CLKMUX_*
macros. So, either

a) we keep going the way that mach-specific stuff has to live outside
the generic driver. Then, we probably need some custom
get_master()-callback (like we have an init()-callback already) which
basically works like

	master_id = pdata->get_saif_master(saif->id);

or b) we accept for now that this driver is heavily mxs specific and
keep this code in the driver. Then, we could also get rid of the
init()-callback, because it usually only calls mxs_saif_clkmux_select()
which could also happen here.

According to Aisheng, saif-devices will not be used in later SoC, but we
all probably know that things pop up unexpectedly, right? ;)

Comments,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110902/6cba60cc/attachment.sig>

  parent reply	other threads:[~2011-09-02 14:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 12:20 [PATCH v2 1/2] ASoC: mxs-saif: add record function Dong Aisheng
2011-08-22 12:20 ` [PATCH v2 2/2] ASoC: mxs-sgtl5000: " Dong Aisheng
2011-09-02 15:07   ` Wolfram Sang
2011-09-02 14:58 ` Wolfram Sang [this message]
2011-09-06 14:25   ` [PATCH v2 1/2] ASoC: mxs-saif: " Dong Aisheng-B29396

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=20110902145833.GI1901@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).