From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01AA9C47257 for ; Mon, 4 May 2020 21:23:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6FC120746 for ; Mon, 4 May 2020 21:23:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="sNsuuN9e" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727101AbgEDVWe (ORCPT ); Mon, 4 May 2020 17:22:34 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:46716 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726603AbgEDVWe (ORCPT ); Mon, 4 May 2020 17:22:34 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 044LMW3M037100; Mon, 4 May 2020 16:22:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1588627352; bh=KkSFZIn4PHdj7+WDXg8xzQ4XosypZYuF6FjRCXFk40g=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=sNsuuN9ezI9LAIphmIqj151jBwzIQngPrf6DA/a+lLczUV71yde3wwkY1bGZMDvuw OEbh8iuY3p2Joem4eUNRGuAiaDN7b/zzJjlFzSbeEvw6Cekhz+9CGk7/BiXUTkaAGM V8x80gM7TCGUypXN140SrtzKyDNYnCjQiPzY4dyY= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 044LMWNb088694; Mon, 4 May 2020 16:22:32 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 4 May 2020 16:22:32 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Mon, 4 May 2020 16:22:32 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 044LMWNa102087; Mon, 4 May 2020 16:22:32 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v25 12/16] leds: lp5523: Update the lp5523 code to add multicolor brightness function Date: Mon, 4 May 2020 16:13:40 -0500 Message-ID: <20200504211344.13221-13-dmurphy@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200504211344.13221-1-dmurphy@ti.com> References: <20200504211344.13221-1-dmurphy@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Add the multicolor brightness call back to support the multicolor framework. This call back allows setting brightness on grouped channels in a single function. Acked-by: Pavel Machek Acked-by: Jacek Anaszewski Signed-off-by: Dan Murphy --- drivers/leds/Kconfig | 1 + drivers/leds/leds-lp5523.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index c127a931e250..8b28f73c810c 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -408,6 +408,7 @@ config LEDS_LP5521 config LEDS_LP5523 tristate "LED Support for TI/National LP5523/55231 LED driver chip" depends on LEDS_CLASS && I2C + depends on LEDS_CLASS_MULTI_COLOR || !LEDS_CLASS_MULTI_COLOR select LEDS_LP55XX_COMMON help If you say yes here you get support for TI/National Semiconductor diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index b076c16df9ab..9776dc72a764 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c @@ -791,6 +791,25 @@ static ssize_t store_master_fader_leds(struct device *dev, return ret; } +static int lp5523_multicolor_brightness(struct lp55xx_led *led) +{ + struct lp55xx_chip *chip = led->chip; + int ret; + int i; + + mutex_lock(&chip->lock); + for (i = 0; i < led->mc_cdev.num_colors; i++) { + ret = lp55xx_write(chip, + LP5523_REG_LED_PWM_BASE + + led->mc_cdev.subled_info[i].channel, + led->mc_cdev.subled_info[i].brightness); + if (ret) + break; + } + mutex_unlock(&chip->lock); + return ret; +} + static int lp5523_led_brightness(struct lp55xx_led *led) { struct lp55xx_chip *chip = led->chip; @@ -857,6 +876,7 @@ static struct lp55xx_device_config lp5523_cfg = { .max_channel = LP5523_MAX_LEDS, .post_init_device = lp5523_post_init_device, .brightness_fn = lp5523_led_brightness, + .multicolor_brightness_fn = lp5523_multicolor_brightness, .set_led_current = lp5523_set_led_current, .firmware_cb = lp5523_firmware_loaded, .run_engine = lp5523_run_engine, -- 2.25.1