From patchwork Mon Jun 8 19:39:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 187616 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp5140936ilo; Mon, 8 Jun 2020 12:40:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEpGcTZU+YkLjjAAvXXn6TI/QB42jQ29LITCdhRIJBKYgTXNe7XmhdHXbgHzVn4tnkqIZo X-Received: by 2002:a17:906:cc85:: with SMTP id oq5mr21659579ejb.142.1591645235429; Mon, 08 Jun 2020 12:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591645235; cv=none; d=google.com; s=arc-20160816; b=KRccnhZFsVKqWqdWSigKO/djvQsv6JD041Kg/HfSBuA+SfEXsVAzMbvhPckBiVMhjy rO65ze/Y9LsEtU20SYtN2Ym8RVclia2+YkkoJFNCSRsJypWS8vCqELE19PiQgSjGMq/U eBAOucSQUFykPPoEfx/s2DRAySXYcomn9FAYHxXrq6v5NhLt+hSOItbK50IZtPwH/uhL g7tHlv+781Im6GctQqvHa11Pyl6YsmgyLsMN8+1PafaHyGmBuOuFtWwsRn5DVinyVfOg IQomiXFFnmQDW3eCiPu6D3otYDvC5ZShw5abu0tHLL1BxT4X8OONaqHdLG5Nrir9kgvu BqFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NFhGB7Jzovu4A0Og8qnlBwEXjUNkBEbSj+3iyIw2zGI=; b=xVNWlz441CrkdsibATwvzn8VHPog4bRzaJd90a5st1DJJQuC8Z/2vr18KLIT4GHQNV jGidV8yvp9SbkSigTbrvcAjxudeUOZAiMRmSQuAqH6zdV4PIUkaEK7eUYRaudppXqLGE mTp8cnPTDTha3yR6HPsqRNHIFc1xXjtf0fNstaE64k48P4E0fssZgqh3gba3Ut50o++Q XC4EMdCsBhyx6YulKrFjd//t0WfUOeJE/+0P+IZXn5ACxDqkX3nPDOh0h5ZHNjeOdaRl kX08kvyeVzTYMvN7+xkxpY9m+FW/oNHTEyhYrXS9/SL6wAWbeXfWJbuI+pq51p+3dqQt FtSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RHd1zycd; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b23si10061256edj.441.2020.06.08.12.40.35; Mon, 08 Jun 2020 12:40:35 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RHd1zycd; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbgFHTkc (ORCPT + 6 others); Mon, 8 Jun 2020 15:40:32 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:58360 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726753AbgFHTka (ORCPT ); Mon, 8 Jun 2020 15:40:30 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 058JeRvL102450; Mon, 8 Jun 2020 14:40:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1591645227; bh=NFhGB7Jzovu4A0Og8qnlBwEXjUNkBEbSj+3iyIw2zGI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=RHd1zycdgXdubnBzJ0dfIxzqcydh8VHina9bu+fg6bctq2HxQMIuMWHEcmgXUDVSM Jvr1iFZPYU22M8lQXh2KeFyeVSbqmFepgHVI18NPb0L9D9LL/FDlgVmgbXKWa0hilk ZCL/t0iF3Up4zF/Fx7yHGKuM63foZlpB4VtVHDHc= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 058JeRSt109942 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 8 Jun 2020 14:40:27 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 8 Jun 2020 14:40:27 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE112.ent.ti.com (157.170.170.23) 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, 8 Jun 2020 14:40:27 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 058JeRoI063930; Mon, 8 Jun 2020 14:40:27 -0500 From: Dan Murphy To: , CC: , , , Dan Murphy Subject: [PATCH v27 13/15] leds: lp5521: Add multicolor framework multicolor brightness support Date: Mon, 8 Jun 2020 14:39:15 -0500 Message-ID: <20200608193917.13084-14-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200608193917.13084-1-dmurphy@ti.com> References: <20200608193917.13084-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add the multicolor brightness call back to support the multicolor framework. This function allows setting the brightness across grouped LED channels in a single call. Acked-by: Pavel Machek Acked-by: Jacek Anaszewski Signed-off-by: Dan Murphy --- drivers/leds/Kconfig | 1 + drivers/leds/leds-lp5521.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) -- 2.26.2 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 869b299a9eed..4970bbde6ea3 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -398,6 +398,7 @@ config LEDS_LP55XX_COMMON config LEDS_LP5521 tristate "LED Support for N.S. LP5521 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 the National Semiconductor diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 6ff81d6be789..ef8c3bfa8f3c 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -349,6 +349,25 @@ static int lp5521_run_selftest(struct lp55xx_chip *chip, char *buf) return 0; } +static int lp5521_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, + LP5521_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 lp5521_led_brightness(struct lp55xx_led *led) { struct lp55xx_chip *chip = led->chip; @@ -490,6 +509,7 @@ static struct lp55xx_device_config lp5521_cfg = { .max_channel = LP5521_MAX_LEDS, .post_init_device = lp5521_post_init_device, .brightness_fn = lp5521_led_brightness, + .multicolor_brightness_fn = lp5521_multicolor_brightness, .set_led_current = lp5521_set_led_current, .firmware_cb = lp5521_firmware_loaded, .run_engine = lp5521_run_engine,