Message ID | 20230527112854.2366-1-ansuelsmth@gmail.com |
---|---|
Headers | show |
Series | leds: introduce new LED hw control APIs | expand |
On Sat, May 27, 2023 at 01:28:44PM +0200, Christian Marangi wrote: > + - hw_control_set: > + activate hw control. LED driver will use the provided > + flags passed from the supported trigger, parse them to > + a set of mode and setup the LED to be driven by hardware > + following the requested modes. > + > + Set LED_OFF via the brightness_set to deactivate hw control. > + > + Return 0 on success, a negative error number on flags apply > + fail. "... on failing to apply flags." > + - hw_control_get_device: > + return the device associated with the LED driver in > + hw control. A trigger might use this to match the > + returned device from this function with a configured > + device for the trigger as the source for blinking > + events and correctly enable hw control. > + (example a netdev trigger configured to blink for a > + particular dev match the returned dev from get_device > + to set hw control) > + > + Return a device or NULL if nothing is currently attached. Returns a device name? > + > +LED driver can activate additional modes by default to workaround the > +impossibility of supporting each different mode on the supported trigger. > +Example are hardcoding the blink speed to a set interval, enable special "Examples are hardcoding ..." Thanks.
On Mon, May 29, 2023 at 08:12:42AM -0600, Jonathan Corbet wrote: > Bagas Sanjaya <bagasdotme@gmail.com> writes: > > >> + - hw_control_get_device: > >> + return the device associated with the LED driver in > >> + hw control. A trigger might use this to match the > >> + returned device from this function with a configured > >> + device for the trigger as the source for blinking > >> + events and correctly enable hw control. > >> + (example a netdev trigger configured to blink for a > >> + particular dev match the returned dev from get_device > >> + to set hw control) > >> + > >> + Return a device or NULL if nothing is currently attached. > > Returns a device name? > > The return type of this function is struct device * - how would you > expect it to return a name? > Just to clarify, a device name can't be returned. Not every device have a name and such name can be changed. An example is network device where you can change the name of the interface. Using the device prevents all of this problem.
Bagas Sanjaya <bagasdotme@gmail.com> writes: >> + - hw_control_get_device: >> + return the device associated with the LED driver in >> + hw control. A trigger might use this to match the >> + returned device from this function with a configured >> + device for the trigger as the source for blinking >> + events and correctly enable hw control. >> + (example a netdev trigger configured to blink for a >> + particular dev match the returned dev from get_device >> + to set hw control) >> + >> + Return a device or NULL if nothing is currently attached. > Returns a device name? The return type of this function is struct device * - how would you expect it to return a name? jon
On Mon, May 29, 2023 at 03:10:15PM +0700, Bagas Sanjaya wrote: > On Sat, May 27, 2023 at 01:28:44PM +0200, Christian Marangi wrote: > > + - hw_control_set: > > + activate hw control. LED driver will use the provided > > + flags passed from the supported trigger, parse them to > > + a set of mode and setup the LED to be driven by hardware > > + following the requested modes. > > + > > + Set LED_OFF via the brightness_set to deactivate hw control. > > + > > + Return 0 on success, a negative error number on flags apply > > + fail. > "... on failing to apply flags." > > > + - hw_control_get_device: > > + return the device associated with the LED driver in > > + hw control. A trigger might use this to match the > > + returned device from this function with a configured > > + device for the trigger as the source for blinking > > + events and correctly enable hw control. > > + (example a netdev trigger configured to blink for a > > + particular dev match the returned dev from get_device > > + to set hw control) > > + > > + Return a device or NULL if nothing is currently attached. > Returns a device name? How about "Returns a pointer to a struct device ..." Andrew
On Sat, May 27, 2023 at 01:28:42PM +0200, Christian Marangi wrote: > Add an option to permit LED driver to declare support for a specific > trigger to use hw control and setup the LED to blink based on specific > provided modes. > > Add APIs for LEDs hw control. These functions will be used to activate > hardware control where a LED will use the provided flags, from an > unique defined supported trigger, to setup the LED to be driven by > hardware. > > Add hw_control_is_supported() to ask the LED driver if the requested > mode by the trigger are supported and the LED can be setup to follow > the requested modes. > > Deactivate hardware blink control by setting brightness to LED_OFF via > the brightness_set() callback. > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
On Sat, May 27, 2023 at 01:28:48PM +0200, Christian Marangi wrote: > Reject interval store with hw_control enabled. It's are currently not > supported and MUST be set to the default value with hw control enabled. > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
On 5/29/23 21:09, Christian Marangi wrote: > Just to clarify, a device name can't be returned. Not every device have > a name and such name can be changed. An example is network device where > you can change the name of the interface. > > Using the device prevents all of this problem. > Oh, I guess it was /dev/something.
On Tue, May 30, 2023 at 10:09:28AM +0700, Bagas Sanjaya wrote: > On 5/29/23 21:09, Christian Marangi wrote: > > Just to clarify, a device name can't be returned. Not every device have > > a name and such name can be changed. An example is network device where > > you can change the name of the interface. > > > > Using the device prevents all of this problem. > > > > Oh, I guess it was /dev/something. Network devices don't appear in /dev. At least not in Linux. Some other Unix implementations do, i think SunOS used to have an entry in /dev, but i could be remembering wrongly. But within the kernel, you generally don't refer to a device by its /dev/foo name. That is a user space abstraction. In the kernel, each device in the system has a struct device representing it. Andrew