From patchwork Mon Jul 26 08:30:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Lin <00601wayne@gmail.com> X-Patchwork-Id: 114231 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6Q8XEhJ032210 for ; Mon, 26 Jul 2010 08:33:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754038Ab0GZIdh (ORCPT ); Mon, 26 Jul 2010 04:33:37 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:52573 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753954Ab0GZId0 (ORCPT ); Mon, 26 Jul 2010 04:33:26 -0400 Received: by pwi5 with SMTP id 5so4323272pwi.19 for ; Mon, 26 Jul 2010 01:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=8dRF3Ai/x7CkYg6AtzProPnF6gqfVt8ozjzKKMK6MJ8=; b=mULLONd1cG+KIp7XWs1i9IAmaTKgsyLjenJojKwmCBKIL0NrFPc0sT3KwlDBYaC7A+ QN43VF3EH4SdrxZaH0RyNIJi6RVbpiX0r6NDn6CKT7FIz+JbkFavYUWrIEb5K5E8KqK6 v3XdaEniWFwihluqQDYAd6RpIH1bIwHvB9eVg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=GtwV43e2hnSweC5ShBG8zaYpDIazg1SgbE6HP4dlCo5aJqh3mUJz9XSaq8dNN/CzN/ b5KNuiqgJ7Grzwv9Nw57kML0JjNEHKs6IsM9VIuZRbrWb43DPPtDf7bc0uTYVj8r+qry TfjuP9Nk8LCMdWyF0fEylKmXaXWO5Ru89ufaI= Received: by 10.142.216.21 with SMTP id o21mr8640120wfg.282.1280133206478; Mon, 26 Jul 2010 01:33:26 -0700 (PDT) Received: from localhost.localdomain (60-250-56-66.HINET-IP.hinet.net [60.250.56.66]) by mx.google.com with ESMTPS id w27sm3846304wfd.5.2010.07.26.01.33.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 26 Jul 2010 01:33:26 -0700 (PDT) From: Wayne Lin <00601wayne@gmail.com> To: linux-input@vger.kernel.org Cc: wayne Subject: [RFC 26/36] [Driver][Qualcomm 1070][EC_BL] New EC backlight driver porting Date: Mon, 26 Jul 2010 16:30:35 +0800 Message-Id: <1280133045-25945-26-git-send-email-wayne.lin@quantatw.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1280133045-25945-1-git-send-email-wayne.lin@quantatw.com> References: <1280133045-25945-1-git-send-email-wayne.lin@quantatw.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 26 Jul 2010 08:33:38 +0000 (UTC) diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index e4f599f..7d29ec7 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -150,9 +150,9 @@ config LEDS_LP3944 tristate "LED Support for N.S. LP3944 (Fun Light) I2C chip" depends on LEDS_CLASS && I2C help - This option enables support for LEDs connected to the National - Semiconductor LP3944 Lighting Management Unit (LMU) also known as - Fun Light Chip. + This option enables support for LEDs connected to the National + Semiconductor LP3944 Lighting Management Unit (LMU) also known as + Fun Light Chip. To compile this driver as a module, choose M here: the module will be called leds-lp3944. @@ -195,13 +195,6 @@ config LEDS_PCA955X LED driver chips accessed via the I2C bus. Supported devices include PCA9550, PCA9551, PCA9552, and PCA9553. -config LEDS_WM831X_STATUS - tristate "LED support for status LEDs on WM831x PMICs" - depends on LEDS_CLASS && MFD_WM831X - help - This option enables support for the status LEDs of the WM831x - series of PMICs. - config LEDS_WM8350 tristate "LED Support for WM8350 AudioPlus PMIC" depends on LEDS_CLASS && MFD_WM8350 @@ -236,6 +229,13 @@ config LEDS_BD2802 This option enables support for BD2802GU RGB LED driver chips accessed via the I2C bus. +config LEDS_QCIBL + tristate "LED Support for Quanta LCD backlight" + depends on SENSORS_NPCE781X + default n + help + Say Y here if you want to use the Quanta backlight driver for ST 1.5 platform. + comment "LED Triggers" config LEDS_TRIGGERS diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 46d7270..a7a8df8 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -29,6 +29,7 @@ obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o obj-$(CONFIG_LEDS_PWM) += leds-pwm.o +obj-$(CONFIG_LEDS_QCIBL) += leds-qci-backlight.o # LED SPI Drivers obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o diff --git a/drivers/leds/leds-qci-backlight.c b/drivers/leds/leds-qci-backlight.c new file mode 100755 index 0000000..d4b404d --- /dev/null +++ b/drivers/leds/leds-qci-backlight.c @@ -0,0 +1,77 @@ +/*Quanta I2C Backlight Driver + * + * Copyright (C) 2009 Quanta Computer Inc. + * Author: Austin Lai + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +/* + * + * The Driver with I/O communications via the I2C Interface for ON2 of AP BU. + * And it is only working on the nuvoTon WPCE775x Embedded Controller. + * + */ + +#include +#include +#include +#include +#include "leds-qci-backlight.h" + +static void qci_backlight_store(struct led_classdev *led_cdev, + enum led_brightness val); +static int qci_backlight_show(struct led_classdev *led_cdev); + +static struct platform_device *bl_pdev; +static struct led_classdev lcd_backlight = { + .name = "lcd-backlight", + .brightness = 147, + .brightness_get = qci_backlight_show, + .brightness_set = qci_backlight_store, +}; + +static int qci_backlight_show(struct led_classdev *led_cdev) +{ + return npce_read_ecram(EC_CMD_SET_BACKLIGHT); +} + +static void qci_backlight_store(struct led_classdev *led_cdev, + enum led_brightness val) +{ + u16 value = val; + npce_smbus_write_word_data(EC_CMD_SET_BACKLIGHT, value); + mdelay(10); + + pr_info("[backlight_store] : value = %d\n", value); +} + +static int __init qci_backlight_init(void) +{ + int err = 0; + bl_pdev = platform_device_register_simple("backlight", 0, NULL, 0); + err = led_classdev_register(&bl_pdev->dev, &lcd_backlight); + return err; +} + +static void __exit qci_backlight_exit(void) +{ + led_classdev_unregister(&lcd_backlight); + platform_device_unregister(bl_pdev); +} + +module_init(qci_backlight_init); +module_exit(qci_backlight_exit); + +MODULE_AUTHOR("Quanta Computer Inc."); +MODULE_DESCRIPTION("Quanta Embedded Controller I2C Touch Pad Driver"); +MODULE_LICENSE("GPL v2"); + diff --git a/drivers/leds/leds-qci-backlight.h b/drivers/leds/leds-qci-backlight.h new file mode 100755 index 0000000..b6ccfd5 --- /dev/null +++ b/drivers/leds/leds-qci-backlight.h @@ -0,0 +1,34 @@ +/* arm\mach-msm\include\mach\leds-qci-backlight.h + * Header file for Quanta lcd backlight Driver + * + * Copyright (C) 2009 Quanta Computer Inc. + * Author: Austin Lai + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + + /* + * + * The Driver with I/O communications via the I2C Interface for ON2 of AP BU. + * And it is only working on the nuvoTon WPCE775x Embedded Controller. + * + */ + +#ifndef __LEDS_QCI_BACKLIGHT_H__ +#define __LEDS_QCI_BACKLIGHT_H__ + +//#define EC_CMD_SET_BACKLIGHT 0xB1 +#define EC_CMD_SET_BACKLIGHT 0xC4 + +extern int npce_smbus_write_word_data(u8 command, u16 value); +extern int npce_read_ecram(u8 ecram); + +#endif