All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: "Marek Behún" <kabel@kernel.org>
Cc: Pavel Machek <pavel@ucw.cz>,
	linux-leds@vger.kernel.org, jacek.anaszewski@gmail.com
Subject: Re: [PATCH v3 5/6] leds: turris-omnia: support HW controlled mode via private trigger
Date: Fri, 18 Aug 2023 09:00:54 +0100	[thread overview]
Message-ID: <20230818080054.GN986605@google.com> (raw)
In-Reply-To: <20230802181345.59d0b0bb@dellmb>

On Wed, 02 Aug 2023, Marek Behún wrote:

> On Wed,  2 Aug 2023 18:07:47 +0200
> Marek Behún <kabel@kernel.org> wrote:
> 
> > +static int omnia_hwtrig_activate(struct led_classdev *cdev)
> > +{
> > +	struct led_classdev_mc *mc_cdev = lcdev_to_mccdev(cdev);
> > +	struct omnia_leds *leds = dev_get_drvdata(cdev->dev->parent);
> > +	struct omnia_led *led = to_omnia_led(mc_cdev);
> > +	int err = 0;
> > +
> > +	mutex_lock(&leds->lock);
> > +
> > +	if (!led->on) {
> > +		/*
> > +		 * If the LED is off (brightness was set to 0), the last
> > +		 * configured color was not necessarily sent to the MCU.
> > +		 * Recompute with max_brightness and send if needed.
> > +		 */
> > +		led_mc_calc_color_components(mc_cdev, cdev->max_brightness);
> > +
> > +		if (omnia_led_channels_changed(led))
> > +			err = omnia_led_send_color_cmd(leds->client, led);
> > +	}
> > +
> > +	if (!err) {
> > +		/* put the LED into MCU controlled mode */
> > +		err = omnia_cmd_write(leds->client, CMD_LED_MODE,
> > +				      CMD_LED_MODE_LED(led->reg));
> > +		if (!err)
> > +			led->hwtrig = true;
> > +	}
> > +
> > +	mutex_unlock(&leds->lock);
> > +
> > +	return err;
> > +}
> 
> Pavel, Lee, here I wanted to ask: can the .activate() method of a LED
> trigger sleep? The .brightness_set() method of a LED cannot sleep, and
> therefore we have .brightness_set_blocking() method, which schedules
> the potentially sleeping call into a work. But there is no such
> mechanism for the LED trigger .activate() method.
> 
> I looked at the LED core code, and it does not seem to me that
> .activate() sleeping would cause issues, besides keeping trigger list
> lock locked...
> 
> Note that previously none of the LED triggers in drivers/leds/trigger
> sleeped in .activate(), but recently the ethernet PHY subsystem was
> wired into the netdev trigger, which may cause the .activate() method
> to do a PHY transfer, which AFAIK may sleep...

I suspect you know more than I do at this point.  I could take a
deep-dive into the code however a) I'm presently swamped with incoming
reviews and b) I do not have any additional resources at my disposable
than you do - it would consist of reading through and brain-grepping the
code.

Pavel or Jacek may have more knowledge at-hand though.

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2023-08-18  8:02 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02 16:07 [PATCH v3 0/6] leds: turris-omnia: updates Marek Behún
2023-08-02 16:07 ` [PATCH v3 1/6] leds: turris-omnia: drop unnecessary mutex locking Marek Behún
2023-08-18  8:09   ` Lee Jones
2023-08-18  9:23   ` (subset) " Lee Jones
2023-08-02 16:07 ` [PATCH v3 2/6] leds: turris-omnia: do not use SMBUS calls Marek Behún
2023-08-18  8:08   ` Lee Jones
2023-08-21 10:01     ` Marek Behún
2023-08-21 12:45       ` Lee Jones
2023-08-02 16:07 ` [PATCH v3 3/6] leds: turris-omnia: use sysfs_emit() instead of sprintf() Marek Behún
2023-08-18  9:18   ` (subset) " Lee Jones
2023-08-02 16:07 ` [PATCH v3 4/6] leds: turris-omnia: make set_brightness() more efficient Marek Behún
2023-08-18  9:42   ` Lee Jones
2023-08-21 10:14     ` Marek Behún
2023-08-21 12:39       ` Lee Jones
2023-08-02 16:07 ` [PATCH v3 5/6] leds: turris-omnia: support HW controlled mode via private trigger Marek Behún
2023-08-02 16:13   ` Marek Behún
2023-08-18  8:00     ` Lee Jones [this message]
2023-08-18 21:12     ` Jacek Anaszewski
2023-08-21  8:15       ` Lee Jones
2023-08-18  9:09   ` Lee Jones
2023-08-21 10:34     ` Marek Behún
2023-08-21 12:36       ` Lee Jones
2023-08-02 16:07 ` [PATCH v3 6/6] leds: turris-omnia: add support for enabling/disabling HW gamma correction Marek Behún
2023-08-18 10:30   ` Lee Jones
2023-08-21 10:46     ` Marek Behún
2023-08-21 12:26       ` Lee Jones
2023-08-14  7:33 ` [PATCH v3 0/6] leds: turris-omnia: updates Marek Behún

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=20230818080054.GN986605@google.com \
    --to=lee@kernel.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=kabel@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.