From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752798AbcIOOzS (ORCPT ); Thu, 15 Sep 2016 10:55:18 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:19176 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752924AbcIOOyr (ORCPT ); Thu, 15 Sep 2016 10:54:47 -0400 MIME-version: 1.0 Content-type: text/plain; charset=utf-8; format=flowed X-AuditID: cbfec7f2-f79556d000002c42-9d-57dab6334f5a Subject: Re: [PATCH V5] leds: trigger: Introduce a USB port trigger To: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Pavel Machek Cc: Greg KH , Peter Chen , Richard Purdie , Felipe Balbi , "linux-usb@vger.kernel.org" , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Jonathan Corbet , Ezequiel Garcia , Matthias Brugger , Stephan Linz , Boris Brezillon , open list , "open list:DOCUMENTATION" , "open list:LED SUBSYSTEM" From: Jacek Anaszewski Message-id: <2d537b69-0d46-6eaf-9451-375a7d898f9e@samsung.com> Date: Thu, 15 Sep 2016 16:54:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 In-reply-to: Content-transfer-encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SbUhTYRTHe3ZfdrdaPc1ZJ3sx1iuillhwqZDeiBv1oYhU+pJDL2pNrV1n WRTrRc1ZYo0sVuJcKZKmOWyoM7OVlkWZqEiSSmlqzgocvcxI83YN/PY75/8//4dzeBhC/Z4K YBKTU3lDsk6vpZWks9n3JiTc2R21fuwCwTZnDsjZxuEikh1ozEJs1bCXZC/cqaRZc6eDZosy 75Jse91tmn04WoFYe0kGwXZ67CRrswxQbM/LJpp13bfLWFfdJ4otb+G3Ym7A0Ya4WmuPnHPc y6Y51xeee1xQLufu5FoorvX6bq6+8B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YJbxo4VK9gLZklWfN7xm6WBcaFI FyMnh4SAicTrbRvYIGwxiQv31gPZXBxCAksYJQ43NrODJHgFBCV+TL7HAmIzC5hJfHl5mBWi 6BmjxL57D5hBEsICzhL3/j4DmyQiECZxcHofE0RRE7PEmnVLWEAcZoHfLBI3HrSxglSxCRhK /HzxGqiKA2iFncS/njqQMIuAqsS6Y3PBhooKREjcWvWREcTmFAiWWL9kMjPEFfISB688Z5nA KDALyYGzkBw4C0nZAkbmVYwiqaXFuem5xUZ6xYm5xaV56XrJ+bmbGIGRv+3Yzy07GLveBR9i FOBgVOLhXTH3VrgQa2JZcWXuIUYJDmYlEd5tW4BCvCmJlVWpRfnxRaU5qcWHGE2Bjp3ILCWa nA9MSnkl8YYmhuaWhkbGFhbmRkZK4rxTP1wJFxJITyxJzU5NLUgtgulj4uCUamA8qHP5zj6O mzp2AvNmcQpkr3lR7+edGDnnxYyHXxZv5PrrNjn2iv3n2PNO3RWqaTfWHPkwr65g+4GTNbMU TqyZFz8tPt/sxtGvgsZ5fyT8NjK5HeOdGiTRz8jyyXXpBpXM1ffn/BO4rjDr9Ytk5QmiU0xT A/nP9t5ZNcVEhV1qZ6+X3Ya90/x5lFiKMxINtZiLihMBCAYihxIDAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20160915145442eucas1p23e5e70f991adfffe3a4e9a1b7aec73a7 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?SmFjZWsgQW5hc3pld3NraRtTUlBPTC1TeXN0ZW0gRlcgIChN?= =?UTF-8?B?Qikb7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?SmFjZWsgQW5hc3pld3NraRtTUlBPTC1TeXN0ZW0gRlcgIChN?= =?UTF-8?B?QikbU2Ftc3VuZyBFbGVjdHJvbmljcxtTZW5pb3IgU29mdHdhcmUgRW5naW5l?= =?UTF-8?B?ZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjc1MjY=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20160915133322eucas1p1033af4403ce3eb51925bb9367507a6a8 X-RootMTR: 20160915133322eucas1p1033af4403ce3eb51925bb9367507a6a8 References: <20160908160904.31719-1-zajec5@gmail.com> <20160909093440.GF15637@b29397-desktop> <20160909110509.GB6356@kroah.com> <20160915125629.GH13132@amd> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/15/2016 03:33 PM, Rafał Miłecki wrote: > On 15 September 2016 at 14:56, Pavel Machek wrote: >> On Fri 2016-09-09 13:31:10, Rafał Miłecki wrote: >>> On 9 September 2016 at 13:05, Greg KH wrote: >>>> On Fri, Sep 09, 2016 at 05:34:40PM +0800, Peter Chen wrote: >>>>> On Thu, Sep 08, 2016 at 06:08:24PM +0200, Rafał Miłecki wrote: >>>>>> From: Rafał Miłecki >>>>>> >>>>>> This commit adds a new trigger responsible for turning on LED when USB >>>>>> device gets connected to the selected USB port. This can can useful for >>>>>> various home routers that have USB port(s) and a proper LED telling user >>>>>> a device is connected. >>>>>> >>>>>> The trigger gets its documentation file but basically it just requires >>>>>> enabling it and selecting USB ports (e.g. echo 1 > ports/usb1-1). >>>>>> >>>>>> There was a long discussion on design of this driver. Its current state >>>>>> is a result of picking them most adjustable solution as others couldn't >>>>>> handle all cases. >>>>>> >>>>>> 1) It wasn't possible for the driver to register separated trigger for >>>>>> each USB port. Some physical USB ports are handled by more than one >>>>>> controller and so by more than one USB port. E.g. USB 2.0 physical >>>>>> port may be handled by OHCI's port and EHCI's port. >>>>>> It's also not possible to assign more than 1 trigger to a single LED >>>>>> and implementing such feature would be tricky due to syncing triggers >>>>>> and sysfs conflicts with old triggers. >>>>>> >>>>>> 2) Another idea was to register trigger per USB hub. This wouldn't allow >>>>>> handling devices with multiple USB LEDs and controllers (hubs) >>>>>> controlling more than 1 physical port. It's common for hubs to have >>>>>> few ports and each may have its own LED. >>>>>> >>>>>> This final trigger is highly flexible. It allows selecting any USB ports >>>>>> for any LED. It was also modified (compared to the initial version) to >>>>>> allow choosing ports rather than having user /guess/ proper names. It >>>>>> was successfully tested on SmartRG SR400ac which has 3 USB LEDs, >>>>>> 2 physical ports and 3 controllers. >>>>>> >>>>>> Another planned feature is support for LED reacting to the USB activity. >>>>>> This can be implemented with another sysfs file for setting mode. The >>>>>> default mode wouldn't change so there won't be ABI breakage and such >>>>>> feature can be safely implemented later. >>>>>> >>>>> >>>>> It has such driver at: drivers/usb/common/led.c >>>> >>>> Ugh, I thought I had seen something like this before... >>>> >>>> Rafał, can you just use this in-kernel code instead? >>> >>> I really don't think I can because of all the reasons I carefully >>> listed in the commit message. >>> >>> Have you took a look at that simple driver? It does nothing I need. >>> Its design doesn't allow implementing features I clearly listed in the >>> commit message. >> >> In any case, the new driver should probably go near the old one, at >> the very least. > > I can do that. Anyone objects? > It's OK with me. -- Best regards, Jacek Anaszewski