From: Varka Bhadram <varkabhadram@gmail.com>
To: Nicolin Chen <nicoleotsuka@gmail.com>, broonie@kernel.org
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
alsa-devel@alsa-project.org, b42378@freescale.com,
timur@tabi.org, pawel.moll@arm.com,
ijc+devicetree@hellion.org.uk, tiwai@suse.de,
linux-kernel@vger.kernel.org, rdunlap@infradead.org,
b02247@freescale.com, lgirdwood@gmail.com, perex@perex.cz,
robh+dt@kernel.org, galak@codeaurora.org,
grant.likely@linaro.org, tklauser@distanz.ch,
shawn.guo@linaro.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v3 2/2] ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers
Date: Fri, 25 Jul 2014 09:54:43 +0530 [thread overview]
Message-ID: <53D1DC0B.1000905@gmail.com> (raw)
In-Reply-To: <f4ff79269a1680f9ce128e0e98fea926d3a41834.1406259578.git.nicoleotsuka@gmail.com>
On 07/25/2014 09:33 AM, Nicolin Chen wrote:
> The Asynchronous Sample Rate Converter (ASRC) converts the sampling rate of a
> signal associated with an input clock into a signal associated with a different
> output clock. The driver currently works as a Front End of DPCM with other Back
> Ends DAI links such as ESAI<->CS42888 and SSI<->WM8962 and SAI. It converts the
> original sample rate to a common rate supported by Back Ends for playback while
> converts the common rate of Back Ends to a desired rate for capture. It has 3
> pairs to support three different substreams within totally 10 channels.
>
(...)
> +Required properties:
> +
> + - compatible : Compatible list, must contain "fsl,imx35-asrc" or
> + "fsl,imx53-asrc".
> +
> + - reg : Offset and length of the register set for the device.
> +
> + - interrupts : Contains the spdif interrupt.
> +
> + - dmas : Generic dma devicetree binding as described in
> + Documentation/devicetree/bindings/dma/dma.txt.
> +
> + - dma-names : Six dmas have to be defined: "rxa", "rxb", "rxc", "txa", "txb",
> + and "txc".
> +
> + - clocks : Contains an entry for each entry in clock-names.
> +
> + - clock-names : Includes the following entries:
> + "mem" Peripheral access clock to access registers.
> + "ipg" Peripheral clock to driver module.
> + "asrck_<0-f>" Clock sources for input and output clock.
> +
> + - big-endian : If this property is absent, the native endian mode will
> + be in use as default, or the big endian mode will be in use
> + for all the device registers.
> +
> + - fsl,asrc-rate : Defines a mutual sample rate used by Back End DAI link.
> +
> + - fsl,asrc-width : Defines a mutual sample width used by Back End DAI link.
> +
indentation for the properties....
- compatible : Should be "fsl,imx35-asrc" or "fsl,imx53-asrc".
- reg : Offset and length of the register set for the device.
....
(...)
> +
> +static const struct platform_device_id fsl_asrc_devtype[] = {
> + {
> + .name = "imx35-asrc",
> + .driver_data = IMX35_ASRC,
> + }, {
> + .name = "imx53-asrc",
> + .driver_data = IMX53_ASRC,
> + }, {
> + /* sentinel */
> + }
> +};
> +MODULE_DEVICE_TABLE(platform, fsl_asrc_devtype);
> +
> +static const struct of_device_id fsl_asrc_ids[] = {
> + {
> + .compatible = "fsl,imx35-asrc",
> + .data = &fsl_asrc_devtype[IMX35_ASRC],
> + }, {
> + .compatible = "fsl,imx53-asrc",
> + .data = &fsl_asrc_devtype[IMX53_ASRC],
> + }, {
> + /* sentinel */
> + }
> +};
> +MODULE_DEVICE_TABLE(of, fsl_asrc_ids);
> +
move these ids after probe/remove... every driver follows same thing...
> +static irqreturn_t fsl_asrc_isr(int irq, void *dev_id)
> +{
> + struct fsl_asrc *asrc_priv = (struct fsl_asrc *)dev_id;
> + struct device *dev = &asrc_priv->pdev->dev;
> + enum asrc_pair_index index;
> + u32 status;
> +
> + regmap_read(asrc_priv->regmap, REG_ASRSTR, &status);
> +
> + /* Clean overload error */
> + regmap_write(asrc_priv->regmap, REG_ASRSTR, ASRSTR_AOLE);
> +
> + /*
> + * We here use dev_dbg() for all exceptions because ASRC itself does
> + * not care if FIFO overflowed or underrun while a warning in the
> + * interrupt would result a ridged conversion.
> + */
> + for (index = ASRC_PAIR_A; index < ASRC_PAIR_MAX_NUM; index++) {
> + if (!asrc_priv->pair[index])
> + continue;
> +
> + if (status & ASRSTR_ATQOL) {
> + asrc_priv->pair[index]->error |= ASRC_TASK_Q_OVERLOAD;
> + dev_dbg(dev, "ASRC Task Queue FIFO overload");
missed terminating new line (\n)...
> + }
> +
> + if (status & ASRSTR_AOOL(index)) {
> + asrc_priv->pair[index]->error |= ASRC_OUTPUT_TASK_OVERLOAD;
> + pair_dbg("Output Task Overload");
same
> + }
> +
> + if (status & ASRSTR_AIOL(index)) {
> + asrc_priv->pair[index]->error |= ASRC_INPUT_TASK_OVERLOAD;
> + pair_dbg("Input Task Overload");
same
> + }
> +
> + if (status & ASRSTR_AODO(index)) {
> + asrc_priv->pair[index]->error |= ASRC_OUTPUT_BUFFER_OVERFLOW;
> + pair_dbg("Output Data Buffer has overflowed");
same
> + }
> +
> + if (status & ASRSTR_AIDU(index)) {
> + asrc_priv->pair[index]->error |= ASRC_INPUT_BUFFER_UNDERRUN;
> + pair_dbg("Input Data Buffer has underflowed");
same..
> + }
> + }
> +
> + return IRQ_HANDLED;
> +}
> +
(...)
> +/**
> + * Configure input and output thresholds
> + */
> +static int fsl_asrc_set_watermarks(struct fsl_asrc_pair *pair, u32 in, u32 out)
> +{
static void for function..?
> + struct fsl_asrc *asrc_priv = pair->asrc_priv;
> + enum asrc_pair_index index = pair->index;
> +
> + regmap_update_bits(asrc_priv->regmap, REG_ASRMCR(index),
> + ASRMCRi_EXTTHRSHi_MASK |
> + ASRMCRi_INFIFO_THRESHOLD_MASK |
> + ASRMCRi_OUTFIFO_THRESHOLD_MASK,
> + ASRMCRi_EXTTHRSHi |
> + ASRMCRi_INFIFO_THRESHOLD(in) |
> + ASRMCRi_OUTFIFO_THRESHOLD(out));
> +
> + return 0;
> +}
(...)
> +static const struct dev_pm_ops fsl_asrc_pm = {
> + SET_RUNTIME_PM_OPS(fsl_asrc_runtime_suspend, fsl_asrc_runtime_resume, NULL)
> + SET_SYSTEM_SLEEP_PM_OPS(fsl_asrc_suspend, fsl_asrc_resume)
> +};
> +
move device ids to here...
> +static struct platform_driver fsl_asrc_driver = {
> + .probe = fsl_asrc_probe,
> + .driver = {
> + .name = "fsl-asrc",
> + .of_match_table = fsl_asrc_ids,
> + .pm = &fsl_asrc_pm,
> + },
> +};
> +module_platform_driver(fsl_asrc_driver);
Thanks...
--
Regards,
Varka Bhadram.
next prev parent reply other threads:[~2014-07-25 4:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 4:03 [PATCH v3 0/2] Add Freescale ASRC driver Nicolin Chen
2014-07-25 4:03 ` [PATCH v3 1/2] ARM: imx: Add the secondary request into the structure for imx-sdma Nicolin Chen
2014-07-25 4:03 ` [PATCH v3 2/2] ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers Nicolin Chen
2014-07-25 4:24 ` Varka Bhadram [this message]
2014-07-25 5:30 ` Nicolin Chen
2014-07-25 5:54 ` Nicolin Chen
2014-07-25 6:17 ` Varka Bhadram
2014-07-25 6:09 ` Nicolin Chen
2014-07-29 9:46 ` Mark Rutland
2014-07-29 10:13 ` Nicolin Chen
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=53D1DC0B.1000905@gmail.com \
--to=varkabhadram@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=b02247@freescale.com \
--cc=b42378@freescale.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mark.rutland@arm.com \
--cc=nicoleotsuka@gmail.com \
--cc=pawel.moll@arm.com \
--cc=perex@perex.cz \
--cc=rdunlap@infradead.org \
--cc=robh+dt@kernel.org \
--cc=shawn.guo@linaro.org \
--cc=timur@tabi.org \
--cc=tiwai@suse.de \
--cc=tklauser@distanz.ch \
/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).