devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn <bjorn@sonymobile.com>
To: Bryan Wu <cooloney@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Richard Purdie <rpurdie@rpsys.net>,
	Grant Likely <grant.likely@linaro.org>,
	"Cavin, Courtney" <Courtney.Cavin@sonymobile.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Linux LED Subsystem <linux-leds@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH 2/2] leds: add Qualcomm PM8941 WLED driver
Date: Thu, 18 Dec 2014 15:43:53 -0800	[thread overview]
Message-ID: <20141218234352.GE19036@sonymobile.com> (raw)
In-Reply-To: <CAK5ve-LujSrARfyi6nvO1EDLyz_cqso93H2irUf9NPbke1XPdQ@mail.gmail.com>

On Tue 16 Dec 16:54 PST 2014, Bryan Wu wrote:

> On Mon, Dec 8, 2014 at 4:22 PM, Bjorn Andersson

[..]

> > diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig

[..]

> > +config LEDS_PM8941_WLED
> > +       tristate "LED support for the Qualcomm PM8941 WLED block"
> > +       depends on LEDS_CLASS
> > +       depends on REGMAP
> Here should be "select REGMAP"
> 

Thanks
> > +       help
> > +         This option enables support for the 'White' LED block
> > +         on Qualcomm PM8941 PMICs.
> > +

[..]

> > diff --git a/drivers/leds/leds-pm8941-wled.c b/drivers/leds/leds-pm8941-wled.c

[..]

> > +
> > +struct pm8941_wled_context {
> > +       struct pm8941_wled wled;
> > +       struct regmap *regmap;
> > +};
> > +
> 
> I think you can just add *regmap into pm8941_wled struct and
> pm8941_wled_context is redundant to me.
> 

Looks like a development leftover, I will fold it in.

[..]

> > +
> > +static int pm8941_wled_probe(struct platform_device *pdev)
> > +{
> > +       struct pm8941_wled_context *ctx;
> > +       struct regmap *regmap;
> > +       int rc;
> > +
> > +       regmap = dev_get_regmap(pdev->dev.parent, NULL);
> > +       if (!regmap) {
> > +               dev_err(&pdev->dev, "Unable to get regmap\n");
> > +               return -EINVAL;
> > +       }
> > +
> 
> Is this regmap mmio registers or i2c registers? Will the regmap
> operation sleep?
> 

It's a spmi regmap, in it's current configuration it's marked as "fast" i.e. it
will not sleep.

I discussed this with Courtney before sending the patch out and as this is used
for backlight we don't see a reason calling set_brightness() in atomic context.
If this changes I would send out a follow up patch.

> > +       ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
> > +       if (ctx == NULL)
> > +               return -ENOMEM;
> > +
> > +       ctx->regmap = regmap;
> > +
> > +       rc = pm8941_wled_configure(&ctx->wled, &pdev->dev);
> > +       if (rc)
> > +               return rc;
> > +
> > +       rc = pm8941_wled_setup(&ctx->wled);
> > +       if (rc)
> > +               return rc;
> > +
> > +       ctx->wled.cdev.brightness_set = pm8941_wled_set_brightness;
> > +
> > +       rc = led_classdev_register(&pdev->dev, &ctx->wled.cdev);
> > +       if (rc)
> > +               return rc;
> > +
> > +       platform_set_drvdata(pdev, ctx);
> > +       dev_info(&pdev->dev, "registered led \"%s\"\n", ctx->wled.cdev.name);
> > +
> > +       return 0;
> > +};
> > +

[..]

> > +MODULE_DESCRIPTION("pm8941 wled driver");
> > +MODULE_LICENSE("GPL v2");
> > +MODULE_ALIAS("platform: pm8941-wled");
> No space after ":"
> 

Oops.

Regards,
Bjorn

  reply	other threads:[~2014-12-18 23:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-09  0:22 [PATCH 1/2] leds: add DT binding for Qualcomm PM8941 WLED block Bjorn Andersson
2014-12-09  0:22 ` [PATCH 2/2] leds: add Qualcomm PM8941 WLED driver Bjorn Andersson
2014-12-17  0:54   ` Bryan Wu
2014-12-18 23:43     ` Bjorn [this message]
2014-12-19  8:15       ` Ivan T. Ivanov
2014-12-17  1:15   ` Stephen Boyd
2014-12-18 23:57     ` Bjorn
2014-12-10  1:19 ` [PATCH 1/2] leds: add DT binding for Qualcomm PM8941 WLED block Bryan Wu
2014-12-17  0:54   ` Bryan Wu
2014-12-17  1:15 ` Stephen Boyd
2014-12-18 23:36   ` Bjorn

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=20141218234352.GE19036@sonymobile.com \
    --to=bjorn@sonymobile.com \
    --cc=Courtney.Cavin@sonymobile.com \
    --cc=cooloney@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=rpurdie@rpsys.net \
    /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).