public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: RongJun Ying <rjying-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	workgroup.linux-kQvG35nSl+M@public.gmane.org,
	Rongjun Ying <rongjun.ying-kQvG35nSl+M@public.gmane.org>
Subject: Re: [PATCH v2 1/2] mfd: Support SiRF audio modules
Date: Tue, 11 Mar 2014 06:44:01 +0000	[thread overview]
Message-ID: <20140311064401.GB2839@lee--X1> (raw)
In-Reply-To: <1394505387-13665-2-git-send-email-rongjun.ying-kQvG35nSl+M@public.gmane.org>

> From: Rongjun Ying <rongjun.ying-kQvG35nSl+M@public.gmane.org>
> 
> The audio modules consist of an internal audio codec, internal
> audio port and i2s controller.
> 
> These modules sharing same register address space.
> sirf-audio.c provides common regmap mmio handling for all audio modules.
> The sound drivers will get regmap from sirf audio mfd driver.
> 
> Signed-off-by: Rongjun Ying <rongjun.ying-kQvG35nSl+M@public.gmane.org>
> ---
> -v2:
> 1. Fixed a lot of english syntax error
> 2. Add "OF" depend
> 3. Get codec compatible from child node of dts
> 4. Use a standard header
> 
>  drivers/mfd/Kconfig            |   10 +++
>  drivers/mfd/Makefile           |    1 +
>  drivers/mfd/sirf-audio.c       |  128 ++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/sirf/audio.h |   22 +++++++
>  4 files changed, 161 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/mfd/sirf-audio.c
>  create mode 100644 include/linux/mfd/sirf/audio.h

<snip>

> +static struct mfd_cell sirf_audio_devs[] = {
> +	{
> +		.name = "sirf-audio-codec",
> +	}, {
> +		.of_compatible = "sirf,prima2-i2s",
> +		.name = "sirf-i2s",
> +	}, {
> +		.of_compatible = "sirf,audio-port",
> +		.name = "sirf-audio-port",
> +	}
> +};

The compatible string for the CODEC is mentioned in the Documentation,
but missing here.

Nit: Also please put .name first and .of_compatible second.

<snip>

> +	regmap = devm_regmap_init_mmio(&pdev->dev, base,
> +					    &sirf_audio_regmap_config);

Odd tabbing here. It's neither tabs, nor '(' aligned.

> +	compatible = of_get_property(codec_np, "compatible", &cplen);
> +	if (!compatible)
> +		return -EINVAL;
> +
> +	/* Overwrite internal codec compatible string */
> +	sirf_audio_devs[0].of_compatible = kstrdup(compatible, GFP_KERNEL);

Oh wow, but no.

Use of_platform_populate() instead of fiddling with the DT like this.

> +	ret =  mfd_add_devices(&pdev->dev, -1, sirf_audio_devs,
> +			ARRAY_SIZE(sirf_audio_devs),
> +			NULL, 0, NULL);
> +	if (ret) {
> +		dev_err(&pdev->dev, "add mfd devices failed: %d\n", ret);
> +		goto err_add_devs;
> +	}
> +
> +	return 0;
> +
> +err_add_devs:
> +	kfree(sirf_audio_devs[0].of_compatible);

<snip>

> +static int sirf_audio_remove(struct platform_device *pdev)
> +{
> +	kfree(sirf_audio_devs[0].of_compatible);

Gross.

> +	mfd_remove_devices(&pdev->dev);
> +	return 0;
> +}

<snip>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-03-11  6:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11  2:36 [PATCH v2 0/2] mfd: Add SiRF audio MFD driver RongJun Ying
     [not found] ` <1394505387-13665-1-git-send-email-rongjun.ying-kQvG35nSl+M@public.gmane.org>
2014-03-11  2:36   ` [PATCH v2 1/2] mfd: Support SiRF audio modules RongJun Ying
     [not found]     ` <1394505387-13665-2-git-send-email-rongjun.ying-kQvG35nSl+M@public.gmane.org>
2014-03-11  6:44       ` Lee Jones [this message]
2014-03-11  2:36   ` [PATCH v2 2/2] Documentation: Describe the SiRF audio Device Tree bindings RongJun Ying

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=20140311064401.GB2839@lee--X1 \
    --to=lee.jones-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rjying-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=rongjun.ying-kQvG35nSl+M@public.gmane.org \
    --cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=workgroup.linux-kQvG35nSl+M@public.gmane.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