From patchwork Fri Oct 18 12:25:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176814 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp788672ill; Fri, 18 Oct 2019 05:26:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/2P+g7zrWa7LldQJoBerQcDZS6v9yeDL2Y6pgQ58gOoAE1FLCStLpHkKrNeNSyODvtpfc X-Received: by 2002:aa7:ccd3:: with SMTP id y19mr9373959edt.122.1571401612234; Fri, 18 Oct 2019 05:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401612; cv=none; d=google.com; s=arc-20160816; b=MGFdWzdJOzYcIzH2F7HfcTrkL+Wb5t2dwhL5UakY9swHkH95zVgEuIaRFdeL1FgIrq ELm7E6vXnCt2PiK6zqFuvnSyZRSXLmjRtoo5ra+ejYURBrBvmGgurKth/vsdUx2WIMrn P5Cyh3MYVpqm6E8AOdSWGX3H6MvvAhcI56g1dQRZe+fBOKydZhMFPZJSbtgkO0V/ckKI NpmYUAzvdf7SS1663uVu1T1uc0aCNMOIQWxhoMQGD4x1twRMt9kLVHOkFqjOj/0qDj8T U5jO0vO9pFj3YTCqrz+1uPbeLjEC3WTSSLXDa/Ewx31/GusOWjVkAQpsirleYAJ7HHgl cRMg== 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=ptd9/47dYiWP3O8EesAD1PuDv716F1rLCMPl0qU/wSw=; b=KhFHbNT/zYvOBndQ+4ezNrGJ1Rdn7E2TrF33yn8e3x7GvjxXMYyecaBHrbDpzLtDl1 kmo7DYHzxf9f0zixFMQg8U+rDdNbZn6/O+PpiKilsWRIe8HGiLKXJ+iIRqvDP53ESQeT TxCCvnKSIK2UCJXYTpk9vQTg76CM6OTfhuAGhi0O8+2hRdT4mYetl62+J3rk28rjQ0lS dZRlnW9ElsS/YwrBwbVh6HvKGM6t2WqHaAX0DUFfKn3esKZkI82Hj15NHxKiZLkUPcPl fijhGc6x1ogWZqwzMrQepDLxVCjVsPj4NspMOg7RPCpis5twCbBkIo7uMOQmm+yVk4tW XqRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=G35YWps+; 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 d3si3321716ejw.31.2019.10.18.05.26.52; Fri, 18 Oct 2019 05:26:52 -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=G35YWps+; 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 S2633849AbfJRM0u (ORCPT + 26 others); Fri, 18 Oct 2019 08:26:50 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:40850 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387657AbfJRM0A (ORCPT ); Fri, 18 Oct 2019 08:26:00 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9ICPwvt013945; Fri, 18 Oct 2019 07:25:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401558; bh=ptd9/47dYiWP3O8EesAD1PuDv716F1rLCMPl0qU/wSw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=G35YWps+Eg/W38PIOMaqv1VoizIBS3d2Mrg+HP/vcvPDSxNx9rRtyYkrgZTwnNwuf NwfjlJX8pJeiVv0/k8rsTCStEHWVl29Ahr2g+qMydyKUfOqfjOpHkbvozPm4OZ6dzs iir++0RYrxXnl6nwqwJn1qGhQGuCy4OSNn+JoPz0= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9ICPw4N060753 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Oct 2019 07:25:58 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 18 Oct 2019 07:25:49 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE102.ent.ti.com (157.170.170.32) 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; Fri, 18 Oct 2019 07:25:49 -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 x9ICPvjc092024; Fri, 18 Oct 2019 07:25:57 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v14 15/19] leds: lp5521: Add multicolor framework multicolor brightness support Date: Fri, 18 Oct 2019 07:25:17 -0500 Message-ID: <20191018122521.6757-16-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-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 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 6d2163c0f625..0ae7e4116859 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,