From patchwork Mon Jul 13 15:45:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 235464 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp2951651ilg; Mon, 13 Jul 2020 08:46:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGIhr/bc3psOpBX68sGx5RKzhMTW2YcH1XvQ2sdmeyTwvoh2X4HbigkqnFmQgLTOQOiEAZ X-Received: by 2002:a17:906:5912:: with SMTP id h18mr360131ejq.259.1594655202695; Mon, 13 Jul 2020 08:46:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594655202; cv=none; d=google.com; s=arc-20160816; b=nCQZ4LZJeRGeALHxs5gw4t86Ox7BYUdEVuCTaWICSpsNR+iuzc5KQ9bvRcKOKDP6XC m8JoNLs1iBCzX0m7YxVomRcf7S4RcVVDO8+v9x/UHeG1epwlshO4UgA3T/k6vmF6ZC8r i0F6dVMLUXrib40LaZnXGRSRutEYc/3La1NNahKqD4wF74Y/nChcSVWoZDhTw2aOv0da PGhsRRgVphGNxTPk7g71cgn7ysnTxWzaSTJXq6jF/ewAULRoaS6EfjQmJ15mo2s1Q7Xu 6brDjFR9w+bldDPAb3ah7bRuVor8hAx16rMoEo3OFT+TtI3rNBG0EuU+CC+TzZEz7Lck cqdQ== 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=U9Ec1SZ9WHdA8xWsnYSa7EUaGmzMATHu33VNJgYvKfM=; b=EpsSc8215eLb64JvbUeLGS5XNmVI5p9MR5H9PjGy1LiQYwoypUqta5a/f+BFENPK9q FFBW2tS7KY236fUMyxt4kFHNZ4TYCqI9B4whoGbYh2wR6LuzhoTUk8lwYCahFGkqeyCk Lyif22jjJksB0HeNgsxHRYkAxcGCa3WWRqt8zqNyfmBx47PsVCUHjComWK3iiRu6Apbh Q9nVhFer0hfXROzALQAEEJrIn3ipm0UYDjeMUmYG18CHxcHqOWUco2cn7ahujZ78ihKV yCVa/yo3wc2YMJGYZBi4Gt+xweu3jib84TwFDujqlV7y/4uqXVfeuZ50c2TM31VgRh2b n1CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cK4mm4hf; 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 f12si9430221ejb.397.2020.07.13.08.46.42; Mon, 13 Jul 2020 08:46:42 -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=cK4mm4hf; 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 S1730310AbgGMPql (ORCPT + 6 others); Mon, 13 Jul 2020 11:46:41 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:55552 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729884AbgGMPql (ORCPT ); Mon, 13 Jul 2020 11:46:41 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06DFkTGs019041; Mon, 13 Jul 2020 10:46:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594655189; bh=U9Ec1SZ9WHdA8xWsnYSa7EUaGmzMATHu33VNJgYvKfM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cK4mm4hf1LSooOrdxQ2FhwT4BarqzjnwgHmf/tK33xKRypOjwG9Nk1lY5kpsWO70H 9VFXwrAWVrq/CXI94Ny44tg0vHEJU7JpXO+E8aSkCYTKvyLHicGkaGTbYM5TGvi6Rb XzuYpp11h5rKMAMwAh+f5cXG3AkMLtky443ZTEaY= 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 06DFkTtF068042 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 13 Jul 2020 10:46:29 -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, 13 Jul 2020 10:46:28 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) 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, 13 Jul 2020 10:46:28 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06DFkSc9034373; Mon, 13 Jul 2020 10:46:28 -0500 From: Dan Murphy To: , , , CC: , , , , Dan Murphy Subject: [PATCH v30 12/16] leds: lp5523: Update the lp5523 code to add multicolor brightness function Date: Mon, 13 Jul 2020 10:45:40 -0500 Message-ID: <20200713154544.1683-13-dmurphy@ti.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713154544.1683-1-dmurphy@ti.com> References: <20200713154544.1683-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 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/leds-lp5523.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.27.0 diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index bb97549007d7..f55d97258d5e 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c @@ -792,6 +792,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; @@ -858,6 +877,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,