Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3256155imj; Mon, 18 Feb 2019 23:43:50 -0800 (PST) X-Google-Smtp-Source: AHgI3IYZUa25ExggC+hTH3i2BMr5Q2nfcVhbQaP9Rg9nvFqHrJwTk6Z+sOtllKKC1S3/oEo+2hD6 X-Received: by 2002:a17:902:584:: with SMTP id f4mr30372362plf.28.1550562229951; Mon, 18 Feb 2019 23:43:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550562229; cv=none; d=google.com; s=arc-20160816; b=BJEsvs2y/GKBBlVoYIs0mx7EOWVOXLXfgHuyvvZz8ayYNU6lG471tS3Qboq9cUGseC jBRVHtlKNTP/nGkEB1H2Fd3niQb1NODR6Pp2/Ar0kl85chRuHNGq6wGf+Tqqg9zKig0+ LtSFsSyfY417EPmVizYudjcm0iYon7vzgyoNYZtR7V8Cexz23x51Hvk+mGSrIcWa3dGI fKfPcXgMY5Pwl6jv7fTib03K2JvRq6LPKBTEer6FOyBzRrM/fn1SD0Kc2UCmkOQ2OV2f wuT/lUNAARWNZEUi1WFwcMmM47iDfVKguP2pJs8gVwiMPKAKtDyX9HJR9yJrY3+fDOOa YXaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=IkWVgWxpx9uczOpQjb+yrLozTftyzHSg/QVg3bdSpw4=; b=V7MAdlei35RGYpjsW2zanlKIn9eVVWXRaa9vljnw6ghPHnpMpAmaHYdd25fJ5tVaqp 3sXiGrI03kUiBsc7YJs+Nhf3hhQ00qXTk5fWSmofG2gqwcmN8b0tQnOIOb0m84b2Ir1T Q/9tG8XoOgTTDOLfG+7QrmAczueLd+kwZMMtWODy0MwcD6+1WXGlY2gISzLduWRs1vQH 7csh/VgyVUsj3Qd3frnA6JAUBYlETZkEAxEkClGgnTfvVD+o9+ax0zwYvNfRQKNojmvH 7Df7LkBCBKURtiKUQ0ts2IOAFmcYvRResibVreMVVX6VD1rhjTH/4a3f/3/XRA611xOh sy/w== 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 a5si15154836pgg.120.2019.02.18.23.43.35; Mon, 18 Feb 2019 23:43:49 -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 S1727176AbfBSHmq (ORCPT + 99 others); Tue, 19 Feb 2019 02:42:46 -0500 Received: from olimex.com ([184.105.72.32]:39524 "EHLO olimex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726546AbfBSHmq (ORCPT ); Tue, 19 Feb 2019 02:42:46 -0500 Received: from 195.238.85.143 ([195.238.85.143]) by olimex.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username stefan@olimex.com, mechanism PLAIN) for ; Mon, 18 Feb 2019 23:42:42 -0800 Subject: Re: [PATCH v2 1/8] leds: Add support for AXP20X CHGLED To: Pavel Machek , 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" References: <20190215115013.11098-1-stefan@olimex.com> <20190215115013.11098-2-stefan@olimex.com> <20190215155732.nmtshldcjk2qyhx4@flea> <20190215183239.GB3280@amd> From: Stefan Mavrodiev Message-ID: <5fdac512-947d-fd46-d953-22d6fc837423@olimex.com> Date: Tue, 19 Feb 2019 09:42:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190215183239.GB3280@amd> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/15/19 8:32 PM, Pavel Machek wrote: > 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. What I understood is that there will be changes in the LED core, exporting a new sysfs entry "hw_control". Then I should set HW_CONTROL flag for the device and add hw_control_get/set callback functions. And this can happen when the LED core is updated. Right? However I didn't understand how (in my case) hardware controlled pattern will be selected? Best regards, Stefan Mavrodiev >>> + 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