From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC6C73CBE84 for ; Sun, 3 May 2026 18:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777832395; cv=none; b=GLVj/NbImXHMSIfKFMqG/It5g6yHkY2AFKI6O/d7x5GtyUj7M8aUrZ3Ub1i9uK7pgxAV9fIdYNwVByKEYN0UT4XrTnI0STk5fmNWi3dq7Vb6Ig8YgPHiwULmpRw+5X9sSvqFp0DK07UqQ4afzRvuOH1gpiS/zvH3oY+xlGfAlFw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777832395; c=relaxed/simple; bh=EwfUIgf1uwwZUx1klfb7s5OuRBYwXyEZ7OfAHCLmM6Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=fa5+6ZF9vZsbqVdW1LJwbhtQykMECplY7xXZLmvE2fBsNBhGG3mVenKZ376iLAwlVK88DF5MpozS9RKDY1M65EswCCyyNH4ywwsB+Lg/rZf7bdlGz78mseOfKDonCBKDRX0tueostQFhsMWVbsQIUDACXMl3CRQvxtADuKZ7W6A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=ratatoskr.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1wJbPt-0005PX-1M; Sun, 03 May 2026 20:19:45 +0200 From: Steffen Trumtrar To: Jacek Anaszewski Cc: Nam Tran , Lee Jones , Pavel Machek , linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org Subject: Re: [PATCH v9] leds: add support for TI LP5860 LED driver chip In-Reply-To: (Jacek Anaszewski's message of "Sun, 26 Apr 2026 14:41:09 +0200") References: <20260424-v6-14-topic-ti-lp5860-v9-1-b44d7025d741@pengutronix.de> User-Agent: mu4e 1.12.13; emacs 30.2 Date: Sun, 03 May 2026 20:19:44 +0200 Message-ID: <87zf2gqrsv.fsf@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: s.trumtrar@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On 2026-04-26 at 14:41 +02, Jacek Anaszewski wrote: Hi, > Hi Steffen, > > On 4/24/26 3:28 PM, Steffen Trumtrar wrote: > > Add support for the Texas Instruments LP5860 LED driver chip > > via SPI interfaces. > > The LP5860 is an LED matrix driver for up to 196 LEDs, which supports > > short and open detection of the individual channel select lines. > > It can be connected to SPI or I2C bus. For now add support for SPI only. > > Signed-off-by: Steffen Trumtrar > > --- > [...] > > diff --git a/drivers/leds/rgb/leds-lp5860-core.c b/drivers/leds/rgb/leds-lp5860-core.c > > new file mode 100644 > > index 0000000000000..648bf168f94bf > > --- /dev/null > > +++ b/drivers/leds/rgb/leds-lp5860-core.c > > @@ -0,0 +1,231 @@ > > +// SPDX-License-Identifier: GPL-2.0-only > > +/* > > + * Copyright (c) 2025 Pengutronix > > + * > > + * Author: Steffen Trumtrar > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include "leds-lp5860.h" > > + > > +static struct lp5860_led *mcled_cdev_to_led(struct led_classdev_mc *mc_cdev) > > +{ > > + return container_of(mc_cdev, struct lp5860_led, mc_cdev); > > +} > > + > > +static int lp5860_set_dot_onoff(struct lp5860_led *led, unsigned int dot, bool enable) > > +{ > > + unsigned int offset = dot / LP5860_MAX_DOT_ONOFF_GROUP_NUM; > > + unsigned int mask = BIT(dot % LP5860_MAX_DOT_ONOFF_GROUP_NUM); > > + > > + if (dot > LP5860_MAX_LED) > > + return -EINVAL; > > + > > + return regmap_update_bits(led->chip->regmap, > > + LP5860_REG_DOT_ONOFF_START + offset, mask, > > + enable ? LP5860_DOT_ALL_ON : LP5860_DOT_ALL_OFF); > > +} > > + > > +static int lp5860_set_mc_brightness(struct led_classdev *cdev, > > + enum led_brightness brightness) > > +{ > > + struct led_classdev_mc *mc_cdev = lcdev_to_mccdev(cdev); > > + struct lp5860_led *led = mcled_cdev_to_led(mc_cdev); > > You need mutex locking while accessing hw to avoid leaving the > device in an inconsistent state in case of two parallel requests from > different processes. > The hw is only accessed via regmap. It handles locking AFAIK or do I misunderstand you? Best regards, Steffen -- Pengutronix e.K. | Dipl.-Inform. Steffen Trumtrar | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |