From patchwork Mon Oct 28 18:36:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 177962 Delivered-To: patch@linaro.org Received: by 2002:ac9:3c86:0:0:0:0:0 with SMTP id w6csp3418356ocf; Mon, 28 Oct 2019 11:38:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeqBBa784ofWp6w1X7m6ljxTXBF9ZmE7lgDLqpyySD3279CWp2dyjohgEM6O/Cs9nQ1Ve+ X-Received: by 2002:a05:6402:1156:: with SMTP id g22mr21468777edw.233.1572287923616; Mon, 28 Oct 2019 11:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572287923; cv=none; d=google.com; s=arc-20160816; b=R34pLUGo+3kLkOjX/vyALTRsI3abuf4WgQGtBjdcLROPg3EEzkMwJRNopjapJ47C98 YRdfxRn4GlQ/AzkyI975rm6aam9nxq6y2FTJ3mOroQKadpCNZ22CI/Uq4tUdqw66NAHT 4ZS5m0veFtYCXenE+AUC8rk/yB0qJ4T3Xd6RrB+Ipd+uyyaIY++55TocTtBxF5W/k6jU k8HtM/2hS4ptC/daXaHOu4Q0wPZPpOvjtLsShT3NnbgoRWQL5S5FYSYPJiFIKyaYhemM HGykfc1B8ElQ1URnEQ3g2amPULLrgb3HNLUrBMqQpDZ2/pXZC90h1ChECRBbB2cl/Flt hv+A== 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=g7UL6cJtcQdVkWq2mI0FrMGiupDZ0AbMcCYXx+3Cao4=; b=O51ZAVct8cMqy/jAm38ljvZ6LrmOCMR3eBmdF6JSMUb8ABtzOfqTfj+d/aZNTB2La5 cFVc+G84Xt73EWf+PeIHu+AML/YNunLjyq3JfL/leTwPcuQRg3sLuDG7YOCLThFpTAJA may/C8qZ863I8JhR8pyZ3k7Etd8pkpEnlTBfnUDjXu6O1uohdETS8xLxDmEXfVI8+LfI FPcvTnOcFbi9i0iUpaKhHUqjdXR2yjNOKO9Kun/+r7ShpVYI/pwLkds5h4M7v0OgN3p2 zc96UMTOwVxZNlSnKZ4q6go9o8Hypd5b5gyhQHUw24Rz7oTFNFzvvAoRUWiOBJ1IdZ0p wk3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RfTIGGTQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 cb1si7118718ejb.200.2019.10.28.11.38.43; Mon, 28 Oct 2019 11:38:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=RfTIGGTQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1727913AbfJ1Sim (ORCPT + 26 others); Mon, 28 Oct 2019 14:38:42 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:43368 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727847AbfJ1Sil (ORCPT ); Mon, 28 Oct 2019 14:38:41 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9SIccRk066065; Mon, 28 Oct 2019 13:38:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1572287918; bh=g7UL6cJtcQdVkWq2mI0FrMGiupDZ0AbMcCYXx+3Cao4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=RfTIGGTQskUddENG1zSPDWsxJuy02u9LcQwJwFlRMQJypbP1l2cY4Ub2DB8kYYi4P 8NtvfWft4fbVqW/ttu9FeBwYxN1/Yi+o+p2xsTLRy8Yntj4YV5hc3tnO3pUSfQg8J5 CazTuGH3mTR5Csg4SDknWE5sjjRGF0dzZZMYOdtI= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9SIccuA097495; Mon, 28 Oct 2019 13:38:38 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 28 Oct 2019 13:38:38 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) 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.1713.5 via Frontend Transport; Mon, 28 Oct 2019 13:38:26 -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 x9SIcbPL107173; Mon, 28 Oct 2019 13:38:37 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v15 14/19] leds: lp5523: Update the lp5523 code to add multicolor brightness function Date: Mon, 28 Oct 2019 13:36:24 -0500 Message-ID: <20191028183629.11779-15-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191028183629.11779-1-dmurphy@ti.com> References: <20191028183629.11779-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. 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 b076c16df9ab..609288077917 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_leds; i++) { + ret = lp55xx_write(chip, + LP5523_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 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,