From patchwork Tue Oct 8 20:47:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 175570 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6206913ill; Tue, 8 Oct 2019 13:49:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfVijeoK3Fef91OeafmGUOi90n1Nuh9TePEC8qsASB+ySR5/dixyeStiy+zFuRKtg/Em2y X-Received: by 2002:a05:6402:150a:: with SMTP id f10mr35037031edw.110.1570567743797; Tue, 08 Oct 2019 13:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570567743; cv=none; d=google.com; s=arc-20160816; b=umuEcdkAeFSi7gC4Ma/BPI7l9Aq8IWWDkVmm73PPJX8BBgkZDDaHZkpeAxkV2frhad ihamiGDLx24ZeZVenCLBPMoWgkrzAi5RHgRQNGa3UosKawHl32OwOca8BrWpn0V+xC+M 07eoRdtePUsTf/ufwSq3IpgSx0YQ9A3DnirphEjit4niTWl4qxYb1oyvRoAOrn08mXzk PINJrZ+E9BkfB8atafgQ8uFf91YaZmdJy7HPNFGg1C72Fux0KS7pmdPQuJSyXMZjV+Ys nr2S3R+CAtkpLdiqnRHBPwTgIN6E9fz1zZx0q14729if/SCF4BDE8nSiqLIIH7UcsVAI AOaQ== 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=t6ZN8MsoaN09y80TS8iaHGApS9NVGVswvlApmF+sfMA=; b=nshZRsz8x0X2smaqWDBudFrIzMNagLNQnvR8ZQTWuh3rU6Jvisu5GvJlE/+heQyof4 Jt+ohrWufuCXxz6K/Ei35wAL1rq01yV0vfft4+ksydtGugK6Cw+mszlApV4M9IpJqUqG XLM9lB98DtWidrlkuTiNB7rd4AQfAnkwUX2dvja6ofi3MYT/1eTVYW7BqUmc9T5bD9EN Ga//rIXlLWnpRBCL0t83RyC97QTqJdUjepGzCOF/00ygyjwApIOExuI1zlIZHGVe2QV/ 3Gvgnn10Cs3wwMus1TDMqndZoSeX91TX4FolifYAxHWL/LyhioQVtsEsynLttOEanNiO zOdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="LT/nDEAR"; 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 u8si115726edq.84.2019.10.08.13.49.03; Tue, 08 Oct 2019 13:49:03 -0700 (PDT) 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="LT/nDEAR"; 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 S1731216AbfJHUtC (ORCPT + 1 other); Tue, 8 Oct 2019 16:49:02 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:43378 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731122AbfJHUsY (ORCPT ); Tue, 8 Oct 2019 16:48:24 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x98KmMx3092492; Tue, 8 Oct 2019 15:48:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1570567702; bh=t6ZN8MsoaN09y80TS8iaHGApS9NVGVswvlApmF+sfMA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=LT/nDEARqicZ77dsH+MQKji9VW+iKHwrXlQKKww9AVG4lMcDqWjf/wBJEhgYRhRfG A/S8P7vLAZaE48wGe9l55v6299N0ZcYVGwvsMQnxneHoutiN9EljwEZXzdtSopf0Lu e1e/i3NvWGD9/SInAnqkcnoC8jQNZn1icC0H0p0s= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x98KmM43110747; Tue, 8 Oct 2019 15:48:22 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 8 Oct 2019 15:48:19 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 8 Oct 2019 15:48:21 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x98KmLgX066693; Tue, 8 Oct 2019 15:48:21 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v11 13/16] leds: lp5523: Update the lp5523 code to add intensity function Date: Tue, 8 Oct 2019 15:47:57 -0500 Message-ID: <20191008204800.19870-14-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191008204800.19870-1-dmurphy@ti.com> References: <20191008204800.19870-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 intensity function call back to support the multicolor framework. This function allows setting a specific brightness on a specific channel. Signed-off-by: Dan Murphy --- drivers/leds/leds-lp5523.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index d0b931a136b9..5d6002e4d657 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_led_intensity(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, + LP5523_REG_LED_PWM_BASE + + led->color_component[i].output_num, + led->color_component[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, + .color_intensity_fn = lp5523_led_intensity, .set_led_current = lp5523_set_led_current, .firmware_cb = lp5523_firmware_loaded, .run_engine = lp5523_run_engine,