devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
To: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	David Collins <collinsd@codeaurora.org>,
	Wu Fenglin <fenglinw@qti.qualcomm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH v4 3/4] pinctrl: Qualcomm SPMI PMIC GPIO pin controller driver
Date: Wed, 24 Sep 2014 16:09:32 +0300	[thread overview]
Message-ID: <1411564172.18580.69.camel@iivanov-dev> (raw)
In-Reply-To: <20140924041852.GO10179@sonymobile.com>

On Tue, 2014-09-23 at 21:18 -0700, Bjorn Andersson wrote:
> On Mon 15 Sep 07:44 PDT 2014, Ivan T. Ivanov wrote:
> 

<snip>

> > +static int pmic_gpio_of_xlate(struct gpio_chip *chip,
> > +                             const struct of_phandle_args *gpio_desc,
> > +                             u32 *flags)
> > +{
> > +       if (chip->of_gpio_n_cells < 2)
> > +               return -EINVAL;
> > +
> > +       if (flags)
> > +               *flags = gpio_desc->args[1];
> > +
> > +       return gpio_desc->args[0] - PMIC_GPIO_PHYSICAL_OFFSET;
> > +}
> 
> If you change:
>  gpiochip_add_pin_range(&state->chip, dev_name(dev), 0, 0, npins);
> to:
>  gpiochip_add_pin_range(&state->chip, dev_name(dev), 1, 0, npins);
> 
> And you treat the gpio functions as taking the gpio number instead of pinctrl
> number (i.e. subtract 1 in those), then gpiolib will provide this function for
> you.
> 

I am unable to make this work. of_gpio_simple_xlate() didn't know that
GPIO range is offset with 1. Requesting last GPIO return error. And
debug output looks weird, for example:

# cat /sys/kernel/debug/gpio
...
GPIOs 220-255, platform/0.c000.gpios, 0.c000.gpios:
...

# cat /sys/kernel/debug/pinctrl/0.c000.gpios/gpio-ranges 
GPIO ranges handled:
1: 0.c000.gpios GPIOS [221 - 256] PINS [0 - 35]

Advice, please.

> [..]
> > +
> > +static const struct of_device_id pmic_gpio_of_match[] = {
> > +       { .compatible = "qcom,spmi-pmic-gpio" },
> 
> I think this should be more specific, because hopefully the spmi specification
> will outlive the current pmic gpio block.
> 
> So I think you need to list the pmic blocks here (e.g. "qcom,pm8941-gpio").

I can rename this to lovely "qcom,qpnp-gpio" :-), in this way driver
can outlive bus on which device is connected this time.

Regards,
Ivan

  parent reply	other threads:[~2014-09-24 13:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15 14:44 [PATCH v4 0/4] Qualcomm SPMI PMIC pin controller drivers Ivan T. Ivanov
2014-09-15 14:44 ` [PATCH v4 1/4] pinctrl: Device tree bindings for Qualcomm PMIC GPIO block Ivan T. Ivanov
2014-09-15 14:44 ` [PATCH v4 2/4] pinctrl: Device tree bindings for Qualcomm PMIC MPP block Ivan T. Ivanov
2014-09-15 14:44 ` [PATCH v4 3/4] pinctrl: Qualcomm SPMI PMIC GPIO pin controller driver Ivan T. Ivanov
2014-09-24  4:18   ` Bjorn Andersson
2014-09-24  8:14     ` Ivan T. Ivanov
2014-09-24 13:09     ` Ivan T. Ivanov [this message]
2014-09-30 17:02       ` Bjorn Andersson
2014-10-07 14:14         ` Linus Walleij
2014-09-15 14:44 ` [PATCH v4 4/4] pinctrl: Qualcomm SPMI PMIC MPP " Ivan T. Ivanov
2014-09-23 15:16 ` [PATCH v4 0/4] Qualcomm SPMI PMIC pin controller drivers Linus Walleij

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=1411564172.18580.69.camel@iivanov-dev \
    --to=iivanov@mm-sol.com \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=collinsd@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fenglinw@qti.qualcomm.com \
    --cc=grant.likely@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).