From patchwork Sun Jun 9 17:51:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 250073 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EDFCA2C02B1 for ; Mon, 10 Jun 2013 03:53:51 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uljnu-0006rw-K8; Sun, 09 Jun 2013 17:53:22 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uljnq-0000bX-Uh; Sun, 09 Jun 2013 17:53:18 +0000 Received: from smtp11.mail.ru ([94.100.176.85]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uljnm-0000at-KT for linux-arm-kernel@lists.infradead.org; Sun, 09 Jun 2013 17:53:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=u01MuT8UTtdG4vB9x8WgkSZSis8sj4CEFPhePMf7B9k=; b=eeGlRPVZrqDzXw5ebOPXX81BAgCVqdc2glI+Yic5ujlSF2OQ/KdzmGef1cgxubFcnJcVK/snb9Eui0hh7VDftiJCJ1gTKDCSJYOxEH4mc84bJXiyCoszAVjLF3dEcRh/6qMM0prffwUWB3gDthoiYRfGRpmfQHpbFiiApm7lI0Q=; Received: from [188.134.40.128] (port=27846 helo=shc.zet) by smtp11.mail.ru with esmtpa (envelope-from ) id 1UljnQ-0007M2-AU; Sun, 09 Jun 2013 21:52:52 +0400 From: Alexander Shiyan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 2/2] leds: leds-mc13783: Add MC13892 LED support Date: Sun, 9 Jun 2013 21:51:25 +0400 Message-Id: <1370800285-18432-2-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1370800285-18432-1-git-send-email-shc_work@mail.ru> References: <1370800285-18432-1-git-send-email-shc_work@mail.ru> MIME-Version: 1.0 X-Spam: Not detected X-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130609_135315_115855_DF85F223 X-CRM114-Status: GOOD ( 12.32 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (shc_work[at]mail.ru) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [94.100.176.85 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Russell King , Alexander Shiyan , Arnd Bergmann , Bryan Wu , Richard Purdie , Sascha Hauer , Shawn Guo , linux-leds@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Signed-off-by: Alexander Shiyan --- drivers/leds/leds-mc13783.c | 60 ++++++++++++++++++++++++++++++++++++++++++++- include/linux/mfd/mc13xxx.h | 7 ++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c index 5d0b23c..33e9322 100644 --- a/drivers/leds/leds-mc13783.c +++ b/drivers/leds/leds-mc13783.c @@ -1,5 +1,5 @@ /* - * LEDs driver for Freescale MC13783 + * LEDs driver for Freescale MC13783/MC13892 * * Copyright (C) 2010 Philippe Rétornaz * @@ -85,6 +85,34 @@ static void mc13xxx_led_work(struct work_struct *work) value = led->new_brightness >> 3; mask = 0x1f; break; + case MC13892_LED_MD: + reg = MC13XXX_REG_LED_CONTROL(0); + shift = 3; + mask = 0x3f; + value = led->new_brightness >> 2; + break; + case MC13892_LED_AD: + reg = MC13XXX_REG_LED_CONTROL(0); + shift = 15; + mask = 0x3f; + value = led->new_brightness >> 2; + break; + case MC13892_LED_KP: + reg = MC13XXX_REG_LED_CONTROL(1); + shift = 3; + mask = 0x3f; + value = led->new_brightness >> 2; + break; + case MC13892_LED_R: + case MC13892_LED_G: + case MC13892_LED_B: + off = led->id - MC13892_LED_R; + bank = off / 2; + reg = MC13XXX_REG_LED_CONTROL(2) + bank; + shift = (off - bank * 2) * 12 + 3; + value = led->new_brightness >> 2; + mask = 0x3f; + break; default: BUG(); } @@ -138,6 +166,29 @@ static int __init mc13xxx_led_setup(struct mc13xxx_led *led, int max_current) shift = ((led->id - MC13783_LED_R1) - bank * 3) * 2; mask = 0x03; break; + case MC13892_LED_MD: + reg = MC13XXX_REG_LED_CONTROL(0); + shift = 9; + mask = 0x07; + break; + case MC13892_LED_AD: + reg = MC13XXX_REG_LED_CONTROL(0); + shift = 21; + mask = 0x07; + break; + case MC13892_LED_KP: + reg = MC13XXX_REG_LED_CONTROL(1); + shift = 9; + mask = 0x07; + break; + case MC13892_LED_R: + case MC13892_LED_G: + case MC13892_LED_B: + bank = (led->id - MC13892_LED_R) / 2; + reg = MC13XXX_REG_LED_CONTROL(2) + bank; + shift = ((led->id - MC13892_LED_R) - bank * 2) * 12 + 9; + mask = 0x07; + break; default: BUG(); } @@ -273,8 +324,15 @@ static const struct mc13xxx_led_devtype mc13783_led_devtype = { .num_regs = 6, }; +static const struct mc13xxx_led_devtype mc13892_led_devtype = { + .led_min = MC13892_LED_MD, + .led_max = MC13892_LED_B, + .num_regs = 4, +}; + static const struct platform_device_id mc13xxx_led_id_table[] = { { "mc13783-led", (kernel_ulong_t)&mc13783_led_devtype, }, + { "mc13892-led", (kernel_ulong_t)&mc13892_led_devtype, }, { } }; MODULE_DEVICE_TABLE(platform, mc13xxx_led_id_table); diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h index 016c684..2fd59d1 100644 --- a/include/linux/mfd/mc13xxx.h +++ b/include/linux/mfd/mc13xxx.h @@ -92,6 +92,13 @@ enum { MC13783_LED_R3, MC13783_LED_G3, MC13783_LED_B3, + /* MC13892 LED IDs */ + MC13892_LED_MD, + MC13892_LED_AD, + MC13892_LED_KP, + MC13892_LED_R, + MC13892_LED_G, + MC13892_LED_B, }; struct mc13xxx_led_platform_data {