From patchwork Thu Nov 14 13:30:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 179424 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp11064890ilf; Thu, 14 Nov 2019 05:32:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzG0pmwbMuPGEAvduHk+6veDCr4uMLLi61qENFF2jObUE91EbE/g8TITR3LI9AAtIHdwoDy X-Received: by 2002:a50:ef17:: with SMTP id m23mr1244695eds.81.1573738366174; Thu, 14 Nov 2019 05:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573738366; cv=none; d=google.com; s=arc-20160816; b=z7F9nk4a6cq9p3yCAcxMNOIJJ8lpxs9yKotOWikY4Jb5EkWEhz8/8uXEEL2DZ3SVJN wwh7ywIK350Hv0xrEHE9Wd9OnGMhug3T3zo9m5ecmmhqfcecLlCA2ykBiOB+Dz5amzEr jaTPDTkswAUQFIS5xPnFZmKK7ajxudRxL+QEn0SJvj3JuBObTJBJE6wEcC6p1Dc61Q1e cS+4msLGaE1H9dwRgbvL3QfigNWrUXqbjxuUf9L3zk0HMdgptKdKKjWCLuizU4e/jY2O 32I40weTzwkEzkWzrqIjHFWgv0HYmup4XZxBxP8JzcECmcN6kUldGn03U+wC/zKC3/ez +rsQ== 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=5oPRgd9y4fLZAUSx3Us0YBQ1cAUc/cf63XhWxENhBFk=; b=A2cOK/7DyujYZxnqiGX7rpUrZQT5EPBc+UT5GNvf7iHWHjg810yqhHbS2CjphfBJjH Hd4iH8tllYIDV4nkrZc2L5Q003MmV72OaVWKrYGf/O0hr8Tq8xfL4HPrMK9X+F8/Q9my Ci07tMaP8gc8oPPbdFhfWUSMEkEoOVQf4QIVguJwqzgnD0CRkh1MvW3qsRt/OxdOKBRX LtQju5/v0gsP9VCmz1YVYyzG5AFOI4AY5QcIw5ofmk0U84NaK9rbTrqRs7toPc01zHWx l9bjnazH+of0j5ewOVMK0zXGpatYhNezVdZrLqlgLTiQ74Gws46dwk0QqMxPFWF2GI2I 2xmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ZaMJK7yj; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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. [209.132.180.67]) by mx.google.com with ESMTP id la4si3457370ejb.297.2019.11.14.05.32.46; Thu, 14 Nov 2019 05:32:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ZaMJK7yj; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 S1727217AbfKNNcn (ORCPT + 1 other); Thu, 14 Nov 2019 08:32:43 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:48226 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726980AbfKNNcn (ORCPT ); Thu, 14 Nov 2019 08:32:43 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id xAEDWeYA007676; Thu, 14 Nov 2019 07:32:40 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1573738360; bh=5oPRgd9y4fLZAUSx3Us0YBQ1cAUc/cf63XhWxENhBFk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZaMJK7yjSnY+/X3mdQThJ1etWwZ4VdMxwEt0ZRE8JeW3TWs4nBsv+dW4JKDx37wD0 LlHpBfGk9Ta0OYRPqFtXx1X9pYsjJjTp4mc0M9wfSAz3CBttBsVacvcnsdMXdgNrGZ axxkGCyv/1b63YnXAbun2BoNJufiBpjpkAUipA9Q= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xAEDWe1E064188 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 14 Nov 2019 07:32:40 -0600 Received: from DFLE107.ent.ti.com (10.64.6.28) 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.1847.3; Thu, 14 Nov 2019 07:32:40 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Thu, 14 Nov 2019 07:32:40 -0600 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 xAEDWdi7081228; Thu, 14 Nov 2019 07:32:39 -0600 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v17 15/19] leds: lp5521: Add multicolor framework multicolor brightness support Date: Thu, 14 Nov 2019 07:30:19 -0600 Message-ID: <20191114133023.32185-16-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191114133023.32185-1-dmurphy@ti.com> References: <20191114133023.32185-1-dmurphy@ti.com> MIME-Version: 1.0 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 function allows setting the brightness across grouped LED channels in a single call. Signed-off-by: Dan Murphy --- drivers/leds/leds-lp5521.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 6ff81d6be789..f8bdd55e8349 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_leds; i++) { + ret = lp55xx_write(chip, + LP5521_REG_LED_PWM_BASE + + led->color_components[i].output_num, + led->color_components[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,