Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2139289ybb; Thu, 2 Apr 2020 14:00:21 -0700 (PDT) X-Google-Smtp-Source: APiQypJMJbryDnGQfHOOtKm0KSycnipSK696MIc42IZiBtPEQZGUjNcTCoCrGMwxB5v841hPe7ZA X-Received: by 2002:aca:ebca:: with SMTP id j193mr730130oih.124.1585861221248; Thu, 02 Apr 2020 14:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585861221; cv=none; d=google.com; s=arc-20160816; b=aQ9E0kzkr//PC7rfwH14W4giSw3E47eHTOwzF9eYdb/y0I0Gz+rJutTSprSj6E/Kuf 5XJ+xysRe8vxaPt6diDW0hyTnwNj21LLLW0mcTf4SQSTYlWecGqtdUZtwx4RToRapweT ZAISFFNUPQDDdWRy4j50fyBI0iwOcz8DB/bkIJoC+fsX0lOO5AcM+om4MKnhNHqL/Asw EfQ1BHoWG2xNcN3tnNOymmLQVrS+ECKiZmQlk08FDFXy9hqeXGphjXwrbEGP3kHicqeO XxUKGTWn09TMuKRAqELzR5w3m3hIvqLw6HeWJmB7mi47xj/jx7Jis3RK+E/zdPq6fHaM 1CMA== 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=AkNzSOM+cfzfMgPFZCofsyuNFkmoUeBEW5VcELdPpsA=; b=mFEs5gNQbRiEwEF1KZ9K9RayoIR7jqN1kt8QrCxC6b8HMS7SC8n3RIDC7WEx9J9zWf a51Naf3vu+VRrBihXaJON7tndf3SEWtBXOb1YY6Tv88UkViom62+HD0ZdHnyQpuvOvNC hQfSuT1Hy6dP+fsLpGdLSZj7ucYtoyjXb+qr7BoEpmxymMr764U4Vj/64jiLoQyEPJWu 8HB1i0Y/0gS9Dh4Px+VSR2fevjGRG03iYZFlDP8Q4N5KlIi+6P0gtpxr7guab9B86Lkk Ni3Ow0PRqVpUAQ7i6ZsBm/ZiqChLeINk8VZMReFGvP4bA+M33JXT8KWSM5EH6MIQBpRF B8iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=b73bz3sQ; 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 u12si409534otg.7.2020.04.02.14.00.08; Thu, 02 Apr 2020 14:00:21 -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=b73bz3sQ; 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 S2390050AbgDBUuM (ORCPT + 99 others); Thu, 2 Apr 2020 16:50:12 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:46958 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727412AbgDBUuM (ORCPT ); Thu, 2 Apr 2020 16:50:12 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 032Ko9eR088578; Thu, 2 Apr 2020 15:50:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1585860609; bh=AkNzSOM+cfzfMgPFZCofsyuNFkmoUeBEW5VcELdPpsA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=b73bz3sQBZRdvRvSZr8PEXE5qVE3lWzQOEAnKS6z4fYuJA8ccP2OSecQ3XO54HcFy W+RHIObC4mELZ+0KRG1ycI2Wrqaex0kOUV1jcOISQNyu2HTEIQkXEqkXmXFGB3RMpg fHPC/6lWTsV2iaKSERtKN7MJ1YxvKXpGsT4UE43A= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 032Ko9CJ048720 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 2 Apr 2020 15:50:09 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Thu, 2 Apr 2020 15:50:09 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) 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, 2 Apr 2020 15:50:09 -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 032Ko94l010393; Thu, 2 Apr 2020 15:50:09 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v19 15/18] leds: lp5521: Add multicolor framework multicolor brightness support Date: Thu, 2 Apr 2020 15:43:08 -0500 Message-ID: <20200402204311.14998-16-dmurphy@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402204311.14998-1-dmurphy@ti.com> References: <20200402204311.14998-1-dmurphy@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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(+) diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 6ff81d6be789..26498d5d3bb3 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_colors; i++) { + ret = lp55xx_write(chip, + LP5521_REG_LED_PWM_BASE + + led->mc_cdev.multicolor_info[i].color_channel, + led->mc_cdev.multicolor_info[i].color_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, -- 2.25.1