Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp201949imj; Fri, 15 Feb 2019 21:42:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IY5fy1m2EejHI1bhPqsoAiIy4/FEwVTxQVM8olsuukcRAEGMemgDlNyDTa7NtKFrKWGWR3x X-Received: by 2002:a62:9359:: with SMTP id b86mr13406375pfe.161.1550295746489; Fri, 15 Feb 2019 21:42:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550295746; cv=none; d=google.com; s=arc-20160816; b=M2duo/wGFKGAT7eiZQ2vya5XzpBvKCd/U7pZJVad2lFRlQX+/yLiDS+8/YwukfqfXS laPEoQ0JRDU35footMiU0jIRZ0OhL5PA1b2R+OvGiNXJEeNxHbwVRQEXnn6RyVAd0DJB fF0NAYTTpcFDAg+Xoctalw0knWkIhx7MlRkJIM1r1gjG39/d7tP25ypH/+j2BZLQKY7e yZOYWYxr6RKqb38U5NYA1Fws1Qp35w8rXUBwT8OC7sB/U1AyZ5TlLjlIECZrr5mNK9vX mkRt8OykDBfC4lOU3GPales62cGuKYVzM4LcgJ1+Jv29NMtK0CRgCYvyWKyMciRKfTtu yiuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=BKYER10YL3Zkfu7m63g6AmphqTkBa2UOVfeT2vMG3hc=; b=c+UaREsUHN6D6T7Nhb9po7oHS+jkKKeSYaKp0JMXD9ZBOZEWC2Z4w5umNgY9k0ge8W PR35Z5woJHz3szDrk5jiUxgT2t3cbgB10PU7Za3/Wr/az3ErSUhCtFWaiz3OwjA3Kt0X r84LimoqvXzs+3QBXb56W/N4oUVyh5zxhey2o6d6xNpjN80Ql3l7ETGV2SDlMbM9HUy9 I/HFarYkAUhUpw7XXOLQUOWShCbY/fMcsW5i5KrsWjKL93FpWlvhCg3IctA2oCu6rYaG oItLrOk9/LR8HmWK1ggQrNN3RNd1VX7IPO3MuyWBWSJ+FKI2/nHkHOCqhV5cQ5egy5Wu e7sA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l94si7614800plb.209.2019.02.15.21.42.10; Fri, 15 Feb 2019 21:42:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389912AbfBOScn (ORCPT + 99 others); Fri, 15 Feb 2019 13:32:43 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:38616 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389689AbfBOScn (ORCPT ); Fri, 15 Feb 2019 13:32:43 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 0BF9E8043F; Fri, 15 Feb 2019 19:32:33 +0100 (CET) Date: Fri, 15 Feb 2019 19:32:40 +0100 From: Pavel Machek To: Maxime Ripard Cc: Stefan Mavrodiev , Jacek Anaszewski , Rob Herring , Mark Rutland , Chen-Yu Tsai , Lee Jones , "open list:LED SUBSYSTEM" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS" , "moderated list:ARM/Allwinner sunXi SoC support" Subject: Re: [PATCH v2 1/8] leds: Add support for AXP20X CHGLED Message-ID: <20190215183239.GB3280@amd> References: <20190215115013.11098-1-stefan@olimex.com> <20190215115013.11098-2-stefan@olimex.com> <20190215155732.nmtshldcjk2qyhx4@flea> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ADZbWkCsHQ7r3kzd" Content-Disposition: inline In-Reply-To: <20190215155732.nmtshldcjk2qyhx4@flea> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ADZbWkCsHQ7r3kzd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > On Fri, Feb 15, 2019 at 01:50:06PM +0200, Stefan Mavrodiev wrote: > > +static ssize_t control_store(struct device *dev, struct device_attribu= te *attr, > > + const char *buf, size_t size) > > +{ > > + struct led_classdev *cdev =3D dev_get_drvdata(dev); > > + struct axp20x_led *priv =3D to_axp20x_led(cdev); > > + unsigned long val; > > + int ret; > > + > > + ret =3D kstrtoul(buf, 0, &val); > > + if (ret) > > + return ret; > > + > > + /** > > + * Supported values are: > > + * - 0 : Manual control > > + * - 1 : Charger control > > + */ =2E.. > > +static struct attribute *axp20x_led_attrs[] =3D { > > + &dev_attr_control.attr, > > + &dev_attr_mode.attr, > > + NULL, > > +}; > > +ATTRIBUTE_GROUPS(axp20x_led); >=20 > 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 =3D AXP20X_CHGLED_CTRL_CHARGER; > > + priv->mode =3D (value < 2) ? value : 0; > > + } else { > > + priv->ctrl =3D AXP20X_CHGLED_CTRL_MANUAL; > > + } >=20 > 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 --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --ADZbWkCsHQ7r3kzd Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlxnBccACgkQMOfwapXb+vKlTgCgwIfqaui3iA1stvAe0/CTXIh8 KCIAn1R8vkC9KvroWOwgGcFWmxzzS7wT =5x+c -----END PGP SIGNATURE----- --ADZbWkCsHQ7r3kzd--