SUPERH platform development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-sh@vger.kernel.org
Subject: Re: GPIO request failure with PCF pinmux
Date: Fri, 14 Sep 2012 20:36:34 +0000	[thread overview]
Message-ID: <8586302.f0YxvSGg1J@avalon> (raw)
In-Reply-To: <6045802.ynsOILKLIK@avalon>

On Friday 14 September 2012 22:11:00 Laurent Pinchart wrote:
> Hi Paul,
> 
> I ran into an issue with GPIO and pinmuxing in the TPU PWM driver.
> 
> The driver needs to switch the PWM pin between GPIO and function at runtime.
> To do so, I use the PWM pin GPIO (GPIO_PORT202) and the associated function
> GPIO (GPIO_FN_TPU0TO2_PORT202).
> 
> The driver configures the pin as a GPIO output when loaded with
> 
> 	gpio_request_one(GPIO_PORT202, GPIOF_INIT_LOW);
> 
> This results in a call to sh_pfc_gpio_request_enable() followed by a call to
> sh_pfc_reconfig_pin() for GPIO 202. The later changes the pinmux type from
> PINMUX_TYPE_GPIO (2) to PINMUX_TYPE_OUTPUT (3).
> 
> I then call gpio_free(GPIO_PORT202) and
> gpio_request(GPIO_FN_TPU0TO2_PORT202) to switch from GPIO to function. The
> former calls sh_pfc_gpio_disable_free:() on GPIO 202.
> 
> When I later call gpio_free(GPIO_FN_TPU0TO2_PORT202) and
> gpio_request_one(GPIO_PORT202, GPIOF_INIT_LOW), the call to
> sh_pfc_gpio_request_enable() fails with
> 
> pinctrl-sh_pfc pinctrl: Unsupported mux type (3), bailing...
> pinctrl-sh_pfc pinctrl-sh_pfc: request() failed for pin 202
> pinctrl-sh_pfc pinctrl-sh_pfc: pin-202 (pinctrl-sh_pfc) status -524
> 
> You're more familiar with pinmux than I am. Am I doing something wrong, or
> is there a bug in the PFC pinmux implementation ?

And while I'm at it, trying to set the pin to the PWM function doesn't seem to 
work anymore on v3.6. It looks like the pin stays configured as a GPIO. How am 
I supposed to configure pinmuxing from the driver ? Documentation/pinctrl.txt 
doesn't help much, and the code isn't easy to understand. There's probably no 
registered mapping (whatever a mapping is), are they supposed to come from DT 
?

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2012-09-14 20:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14 20:11 GPIO request failure with PCF pinmux Laurent Pinchart
2012-09-14 20:36 ` Laurent Pinchart [this message]
2012-09-18  7:12 ` Paul Mundt
2012-09-18  7:22 ` Paul Mundt
2012-09-19 15:19 ` Laurent Pinchart
2012-09-19 15:33 ` Paul Mundt
2012-10-02 12:24 ` Laurent Pinchart

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=8586302.f0YxvSGg1J@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-sh@vger.kernel.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