linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Stefan Mavrodiev <stefan@olimex.com>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>, Chen-Yu Tsai <wens@csie.org>,
	Lee Jones <lee.jones@linaro.org>,
	"open list:LED SUBSYSTEM" <linux-leds@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	"open list:X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS" 
	<linux-kernel@vger.kernel.org>,
	"moderated list:ARM/Allwinner sunXi SoC support" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 1/8] leds: Add support for AXP20X CHGLED
Date: Fri, 15 Feb 2019 19:32:40 +0100	[thread overview]
Message-ID: <20190215183239.GB3280@amd> (raw)
In-Reply-To: <20190215155732.nmtshldcjk2qyhx4@flea>

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

Hi!

> On Fri, Feb 15, 2019 at 01:50:06PM +0200, Stefan Mavrodiev wrote:

> > +static ssize_t control_store(struct device *dev, struct device_attribute *attr,
> > +			     const char *buf, size_t size)
> > +{
> > +	struct led_classdev *cdev = dev_get_drvdata(dev);
> > +	struct axp20x_led *priv = to_axp20x_led(cdev);
> > +	unsigned long val;
> > +	int ret;
> > +
> > +	ret = kstrtoul(buf, 0, &val);
> > +	if (ret)
> > +		return ret;
> > +
> > +	/**
> > +	 * Supported values are:
> > +	 *   - 0 : Manual control
> > +	 *   - 1 : Charger control
> > +	 */
...
> > +static struct attribute *axp20x_led_attrs[] = {
> > +	&dev_attr_control.attr,
> > +	&dev_attr_mode.attr,
> > +	NULL,
> > +};
> > +ATTRIBUTE_GROUPS(axp20x_led);
> 
> I can't really say whether adding sysfs handles for this is the right
> thing to do, but if it is you should document the interface.

It is not. See "Add Intel Cherry Trail Whiskey Cove PMIC LEDs" thread
in the last few days.

> > +	if (!of_property_read_u8(np, "x-powers,charger-mode", &value)) {
> > +		priv->ctrl = AXP20X_CHGLED_CTRL_CHARGER;
> > +		priv->mode = (value < 2) ? value : 0;
> > +	} else {
> > +		priv->ctrl = AXP20X_CHGLED_CTRL_MANUAL;
> > +	}
> 
> I'm not sure we want to make this a property of the device
> tree. Changing the device tree isn't an option for some users, so we
> need to make sure we can change it even if we can't change the device
> tree.

We want this to be configurable at run time. It can get default from
the device tree.

If we go for the "hardware" trigger, you'll get it for free.

Best regards,
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

  reply	other threads:[~2019-02-15 18:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15 11:50 [PATCH v2 0/8] leds: Add AXP20X CHGLED Stefan Mavrodiev
2019-02-15 11:50 ` [PATCH v2 1/8] leds: Add support for " Stefan Mavrodiev
2019-02-15 14:07   ` Stefan Mavrodiev
2019-02-15 15:57   ` Maxime Ripard
2019-02-15 18:32     ` Pavel Machek [this message]
2019-02-19  7:42       ` Stefan Mavrodiev
2019-02-15 11:50 ` [PATCH v2 2/8] mfd: axp20x: Add axp20x-led cell Stefan Mavrodiev
2019-03-25 10:01   ` Lee Jones
2019-02-15 11:50 ` [PATCH v2 3/8] dt-bindings: leds: Add binding for axp20x-led device driver Stefan Mavrodiev
2019-02-22 19:51   ` Rob Herring
2019-02-23 13:02     ` Jacek Anaszewski
2019-02-15 11:50 ` [PATCH v2 4/8] arm64: dts: allwinner: axp803: add charge led node Stefan Mavrodiev
2019-02-15 11:50 ` [PATCH v2 5/8] arm64: dts: allwinner: Enable AXP803 CHGLED for Olimex boards Stefan Mavrodiev
2019-02-15 18:49   ` Pavel Machek
2019-02-19  7:43     ` Stefan Mavrodiev
2019-02-15 11:50 ` [PATCH v2 6/8] arm: dts: axpxx: add charge led node Stefan Mavrodiev
2019-02-15 11:50 ` [PATCH v2 7/8] ARM: dts: sun7i: Enable AXP209 CHGLED for Olimex boards Stefan Mavrodiev
2019-02-15 11:50 ` [PATCH v2 8/8] ARM: dts: sun8i: a33: Enable AXP223 CHGLED for A33-OLinuXino Stefan Mavrodiev

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=20190215183239.GB3280@amd \
    --to=pavel@ucw.cz \
    --cc=devicetree@vger.kernel.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=robh+dt@kernel.org \
    --cc=stefan@olimex.com \
    --cc=wens@csie.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).