devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: caesar <caesar.wang@rock-chips.com>
Cc: heiko@sntech.de, b.galvani@gmail.com, cf@rock-chips.com,
	huangtao@rock-chips.com, addy.ke@rock-chips.com,
	xjq@rock-chips.com, linux-pwm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] pwm: add this patch to support the new pwm of Rockchip SoCs
Date: Mon, 21 Jul 2014 15:27:24 +0200	[thread overview]
Message-ID: <20140721132723.GH15238@ulmo> (raw)
In-Reply-To: <53CD0E82.6030901@rock-chips.com>

[-- Attachment #1: Type: text/plain, Size: 2683 bytes --]

On Mon, Jul 21, 2014 at 08:58:42PM +0800, caesar wrote:
> 于 2014年07月21日 16:50, Thierry Reding 写道:
> >On Sat, Jul 19, 2014 at 08:55:29PM +0800, Caesar Wang wrote:
[...]
> >>  	struct rockchip_pwm_chip *pc;
> >>  	struct resource *r;
> >>  	int ret;
> >>@@ -119,7 +182,10 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
> >>  		return -ENOMEM;
> >>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >>-	pc->base = devm_ioremap_resource(&pdev->dev, r);
> >>+	if (!strcmp(of_id->compatible, "rockchip,vop-pwm"))
> >>+		pc->base = devm_ioremap(&pdev->dev, r->start, resource_size(r));
> >>+	else
> >>+		pc->base = devm_ioremap_resource(&pdev->dev, r);
> >Sorry, this still isn't an option. You really shouldn't remap I/O
> >regions that other drivers may be using. You hinted at a shared register
> >space during the review of the initial version. Can you provide more
> >detail about what exactly the memory map looks like of the rk3288? Is
> >there some kind of technical reference manual that I could look at? Or
> >do you have a device tree extract that shows what the memory map looks
> >like?
> >
> >Thierry
> Maybe,you can look at the ARM: dts: rk3288:
> https://github.com/rkchrome/kernel/blob/master/arch/arm/boot/dts/rk3288.dtsi
> There is some lcdc and vop-pwm map address for rk3288.
> 
> ,and you can look at the vop-introduce.pdf and vop-register.pdf in Annex.
> 
> Maybe,I should put the vop-pwm in lcdc driver,but I don't hope do so it.
> 
> Could you give a suggestion to solve it? Thanks.

It looks like you could turn the lcdc device into an MFD device so that
it can instantiate two devices, one for the display controller, the
other for the PWM. Or perhaps it would even work with only a single
child device.

The device tree would become something like this:

	lcdc@ff930000 {
		compatible = "rockchip,rk3288-lcdc";
		...

		pwm@ff9301a0 {
			compatible = "rockchip,vop-pwm";
			...
		};
	};

And your driver would do something like:

	static const struct resource pwm_resources[] = {
		{
			.start = 0x1a0,
			.end = 0x1af,
			.flags = IORESOURCE_MEM,
		},
	};

	static const struct mfd_cell subdevices[] = {
		{
			.name = "pwm",
			.id = 1,
			.of_compatible = "rockchip,vop-pwm",
			.num_resources = ARRAY_SIZE(pwm_resources),
			.resources = pwm_resources,
		},
	};

	static int lcdc_probe(struct platform_device *pdev)
	{
		struct resource *regs;
		...

		regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);

		...

		err = mfd_add_devices(&pdev->dev, 0, subdevices, ARRAY_SIZE(subdevices),
				      regs, NULL, NULL);
		...
	}

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2014-07-21 13:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-19 12:55 [PATCH v2 0/2] This series adds support for Rockchip SoCs integrated PWM Caesar Wang
2014-07-19 12:55 ` [PATCH v2 1/2] pwm: add this patch to introduce for rk-pwm and vop-pwm Caesar Wang
2014-07-21  8:57   ` Thierry Reding
2014-07-21 10:39     ` caesar
2014-07-19 12:55 ` [PATCH v2 2/2] pwm: add this patch to support the new pwm of Rockchip SoCs Caesar Wang
2014-07-21  8:50   ` Thierry Reding
     [not found]     ` <53CD0E82.6030901@rock-chips.com>
2014-07-21 13:27       ` Thierry Reding [this message]
2014-07-21 14:10         ` caesar
2014-07-25 10:29         ` caesar
2014-07-27  4:59           ` Doug Anderson
     [not found]             ` <53D50601.1020106@rock-chips.com>
2014-07-28  4:01               ` Doug Anderson
2014-07-28 11:19                 ` caesar
     [not found]                   ` <53D631B6.1050603-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-07-28 16:58                     ` Olof Johansson
2014-07-29  9:35                       ` caesar
2014-07-29 10:23                       ` Thierry Reding
2014-07-29 10:22                   ` Thierry Reding
2014-07-29 11:09                     ` caesar
2014-07-29 11:38                       ` Thierry Reding
2014-07-29 14:17                         ` caesar
2014-07-29 10:25             ` Thierry Reding

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=20140721132723.GH15238@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=addy.ke@rock-chips.com \
    --cc=b.galvani@gmail.com \
    --cc=caesar.wang@rock-chips.com \
    --cc=cf@rock-chips.com \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=huangtao@rock-chips.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=xjq@rock-chips.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 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).