You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (57 commits) regulator: Fix 88pm8607.c printk format warning input: Add support for Qualcomm PMIC8XXX power key input: Add Qualcomm pm8xxx keypad controller driver mfd: Add omap-usbhs runtime PM support mfd: Fix ASIC3 SD Host Controller Configuration size mfd: Fix omap_usbhs_alloc_children error handling mfd: Fix omap usbhs crash when rmmoding ehci or ohci mfd: Add ASIC3 LED support leds: Add ASIC3 LED support mfd: Update twl4030-code maintainer e-mail address mfd: Correct the name and bitmask for ab8500-gpadc BTempPullUp mfd: Add manual ab8500-gpadc batt temp activation for AB8500 3.0 mfd: Provide ab8500-core enumerators for chip cuts mfd: Check twl4030-power remove script error condition after i2cwrite mfd: Fix twl6030 irq definitions mfd: Add phoenix lite (twl6025) support to twl6030 mfd: Avoid to use constraint name in 88pm860x regulator driver mfd: Remove checking on max8925 regulator[0] mfd: Remove unused parameter from 88pm860x API mfd: Avoid to allocate 88pm860x static platform data ...
This commit is contained in:
@@ -931,6 +931,8 @@ F: drivers/mmc/host/msm_sdcc.h
|
||||
F: drivers/tty/serial/msm_serial.h
|
||||
F: drivers/tty/serial/msm_serial.c
|
||||
F: drivers/platform/msm/
|
||||
F: drivers/*/pm8???-*
|
||||
F: include/linux/mfd/pm8xxx/
|
||||
T: git git://codeaurora.org/quic/kernel/davidb/linux-msm.git
|
||||
S: Maintained
|
||||
|
||||
|
||||
@@ -729,7 +729,7 @@ static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
|
||||
{ .resource = RES_RESET, .devgroup = -1,
|
||||
.type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
|
||||
},
|
||||
{ .resource = RES_Main_Ref, .devgroup = -1,
|
||||
{ .resource = RES_MAIN_REF, .devgroup = -1,
|
||||
.type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
|
||||
},
|
||||
{ 0, 0},
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <linux/timb_dma.h>
|
||||
@@ -685,7 +684,7 @@ static irqreturn_t td_irq(int irq, void *devid)
|
||||
|
||||
static int __devinit td_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct timb_dma_platform_data *pdata = mfd_get_data(pdev);
|
||||
struct timb_dma_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct timb_dma *td;
|
||||
struct resource *iomem;
|
||||
int irq;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/slab.h>
|
||||
@@ -150,7 +149,7 @@ static int __devinit ttl_probe(struct platform_device *pdev)
|
||||
struct resource *res;
|
||||
int ret;
|
||||
|
||||
pdata = mfd_get_data(pdev);
|
||||
pdata = pdev->dev.platform_data;
|
||||
if (!pdata) {
|
||||
dev_err(dev, "no platform data\n");
|
||||
ret = -ENXIO;
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/mfd/rdc321x.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
struct rdc321x_gpio {
|
||||
@@ -136,7 +135,7 @@ static int __devinit rdc321x_gpio_probe(struct platform_device *pdev)
|
||||
struct rdc321x_gpio *rdc321x_gpio_dev;
|
||||
struct rdc321x_gpio_pdata *pdata;
|
||||
|
||||
pdata = mfd_get_data(pdev);
|
||||
pdata = pdev->dev.platform_data;
|
||||
if (!pdata) {
|
||||
dev_err(&pdev->dev, "no platform data supplied\n");
|
||||
return -ENODEV;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/timb_gpio.h>
|
||||
@@ -229,7 +228,7 @@ static int __devinit timbgpio_probe(struct platform_device *pdev)
|
||||
struct gpio_chip *gc;
|
||||
struct timbgpio *tgpio;
|
||||
struct resource *iomem;
|
||||
struct timbgpio_platform_data *pdata = mfd_get_data(pdev);
|
||||
struct timbgpio_platform_data *pdata = pdev->dev.platform_data;
|
||||
int irq = platform_get_irq(pdev, 0);
|
||||
|
||||
if (!pdata || pdata->nr_pins > 32) {
|
||||
@@ -320,13 +319,14 @@ err_mem:
|
||||
static int __devexit timbgpio_remove(struct platform_device *pdev)
|
||||
{
|
||||
int err;
|
||||
struct timbgpio_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct timbgpio *tgpio = platform_get_drvdata(pdev);
|
||||
struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
int irq = platform_get_irq(pdev, 0);
|
||||
|
||||
if (irq >= 0 && tgpio->irq_base > 0) {
|
||||
int i;
|
||||
for (i = 0; i < tgpio->gpio.ngpio; i++) {
|
||||
for (i = 0; i < pdata->nr_pins; i++) {
|
||||
irq_set_chip(tgpio->irq_base + i, NULL);
|
||||
irq_set_chip_data(tgpio->irq_base + i, NULL);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/wait.h>
|
||||
@@ -306,7 +305,7 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
pdata = mfd_get_data(pdev);
|
||||
pdata = pdev->dev.platform_data;
|
||||
if (pdata) {
|
||||
i2c->regstep = pdata->regstep;
|
||||
i2c->clock_khz = pdata->clock_khz;
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/wait.h>
|
||||
@@ -705,7 +704,7 @@ static int __devinit xiic_i2c_probe(struct platform_device *pdev)
|
||||
if (irq < 0)
|
||||
goto resource_missing;
|
||||
|
||||
pdata = mfd_get_data(pdev);
|
||||
pdata = (struct xiic_i2c_platform_data *) pdev->dev.platform_data;
|
||||
if (!pdata)
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
@@ -412,6 +412,17 @@ config KEYBOARD_PXA930_ROTARY
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called pxa930_rotary.
|
||||
|
||||
config KEYBOARD_PMIC8XXX
|
||||
tristate "Qualcomm PMIC8XXX keypad support"
|
||||
depends on MFD_PM8XXX
|
||||
help
|
||||
Say Y here if you want to enable the driver for the PMIC8XXX
|
||||
keypad provided as a reference design from Qualcomm. This is intended
|
||||
to support upto 18x8 matrix based keypad design.
|
||||
|
||||
To compile this driver as a module, choose M here: the module will
|
||||
be called pmic8xxx-keypad.
|
||||
|
||||
config KEYBOARD_SAMSUNG
|
||||
tristate "Samsung keypad support"
|
||||
depends on SAMSUNG_DEV_KEYPAD
|
||||
|
||||
@@ -34,6 +34,7 @@ obj-$(CONFIG_KEYBOARD_NOMADIK) += nomadik-ske-keypad.o
|
||||
obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o
|
||||
obj-$(CONFIG_KEYBOARD_OMAP4) += omap4-keypad.o
|
||||
obj-$(CONFIG_KEYBOARD_OPENCORES) += opencores-kbd.o
|
||||
obj-$(CONFIG_KEYBOARD_PMIC8XXX) += pmic8xxx-keypad.o
|
||||
obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o
|
||||
obj-$(CONFIG_KEYBOARD_PXA930_ROTARY) += pxa930_rotary.o
|
||||
obj-$(CONFIG_KEYBOARD_QT1070) += qt1070.o
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -330,6 +330,17 @@ config INPUT_PWM_BEEPER
|
||||
To compile this driver as a module, choose M here: the module will be
|
||||
called pwm-beeper.
|
||||
|
||||
config INPUT_PMIC8XXX_PWRKEY
|
||||
tristate "PMIC8XXX power key support"
|
||||
depends on MFD_PM8XXX
|
||||
help
|
||||
Say Y here if you want support for the PMIC8XXX power key.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called pmic8xxx-pwrkey.
|
||||
|
||||
config INPUT_GPIO_ROTARY_ENCODER
|
||||
tristate "Rotary encoders connected to GPIO pins"
|
||||
depends on GPIOLIB && GENERIC_GPIO
|
||||
|
||||
@@ -33,6 +33,7 @@ obj-$(CONFIG_INPUT_PCF8574) += pcf8574_keypad.o
|
||||
obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
|
||||
obj-$(CONFIG_INPUT_POWERMATE) += powermate.o
|
||||
obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o
|
||||
obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY) += pmic8xxx-pwrkey.o
|
||||
obj-$(CONFIG_INPUT_RB532_BUTTON) += rb532_button.o
|
||||
obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o
|
||||
obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/log2.h>
|
||||
|
||||
#include <linux/mfd/pm8xxx/core.h>
|
||||
#include <linux/input/pmic8xxx-pwrkey.h>
|
||||
|
||||
#define PON_CNTL_1 0x1C
|
||||
#define PON_CNTL_PULL_UP BIT(7)
|
||||
#define PON_CNTL_TRIG_DELAY_MASK (0x7)
|
||||
|
||||
/**
|
||||
* struct pmic8xxx_pwrkey - pmic8xxx pwrkey information
|
||||
* @key_press_irq: key press irq number
|
||||
*/
|
||||
struct pmic8xxx_pwrkey {
|
||||
struct input_dev *pwr;
|
||||
int key_press_irq;
|
||||
};
|
||||
|
||||
static irqreturn_t pwrkey_press_irq(int irq, void *_pwrkey)
|
||||
{
|
||||
struct pmic8xxx_pwrkey *pwrkey = _pwrkey;
|
||||
|
||||
input_report_key(pwrkey->pwr, KEY_POWER, 1);
|
||||
input_sync(pwrkey->pwr);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static irqreturn_t pwrkey_release_irq(int irq, void *_pwrkey)
|
||||
{
|
||||
struct pmic8xxx_pwrkey *pwrkey = _pwrkey;
|
||||
|
||||
input_report_key(pwrkey->pwr, KEY_POWER, 0);
|
||||
input_sync(pwrkey->pwr);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int pmic8xxx_pwrkey_suspend(struct device *dev)
|
||||
{
|
||||
struct pmic8xxx_pwrkey *pwrkey = dev_get_drvdata(dev);
|
||||
|
||||
if (device_may_wakeup(dev))
|
||||
enable_irq_wake(pwrkey->key_press_irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pmic8xxx_pwrkey_resume(struct device *dev)
|
||||
{
|
||||
struct pmic8xxx_pwrkey *pwrkey = dev_get_drvdata(dev);
|
||||
|
||||
if (device_may_wakeup(dev))
|
||||
disable_irq_wake(pwrkey->key_press_irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(pm8xxx_pwr_key_pm_ops,
|
||||
pmic8xxx_pwrkey_suspend, pmic8xxx_pwrkey_resume);
|
||||
|
||||
static int __devinit pmic8xxx_pwrkey_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct input_dev *pwr;
|
||||
int key_release_irq = platform_get_irq(pdev, 0);
|
||||
int key_press_irq = platform_get_irq(pdev, 1);
|
||||
int err;
|
||||
unsigned int delay;
|
||||
u8 pon_cntl;
|
||||
struct pmic8xxx_pwrkey *pwrkey;
|
||||
const struct pm8xxx_pwrkey_platform_data *pdata = mfd_get_data(pdev);
|
||||
|
||||
if (!pdata) {
|
||||
dev_err(&pdev->dev, "power key platform data not supplied\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (pdata->kpd_trigger_delay_us > 62500) {
|
||||
dev_err(&pdev->dev, "invalid power key trigger delay\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pwrkey = kzalloc(sizeof(*pwrkey), GFP_KERNEL);
|
||||
if (!pwrkey)
|
||||
return -ENOMEM;
|
||||
|
||||
pwr = input_allocate_device();
|
||||
if (!pwr) {
|
||||
dev_dbg(&pdev->dev, "Can't allocate power button\n");
|
||||
err = -ENOMEM;
|
||||
goto free_pwrkey;
|
||||
}
|
||||
|
||||
input_set_capability(pwr, EV_KEY, KEY_POWER);
|
||||
|
||||
pwr->name = "pmic8xxx_pwrkey";
|
||||
pwr->phys = "pmic8xxx_pwrkey/input0";
|
||||
pwr->dev.parent = &pdev->dev;
|
||||
|
||||
delay = (pdata->kpd_trigger_delay_us << 10) / USEC_PER_SEC;
|
||||
delay = 1 + ilog2(delay);
|
||||
|
||||
err = pm8xxx_readb(pdev->dev.parent, PON_CNTL_1, &pon_cntl);
|
||||
if (err < 0) {
|
||||
dev_err(&pdev->dev, "failed reading PON_CNTL_1 err=%d\n", err);
|
||||
goto free_input_dev;
|
||||
}
|
||||
|
||||
pon_cntl &= ~PON_CNTL_TRIG_DELAY_MASK;
|
||||
pon_cntl |= (delay & PON_CNTL_TRIG_DELAY_MASK);
|
||||
if (pdata->pull_up)
|
||||
pon_cntl |= PON_CNTL_PULL_UP;
|
||||
else
|
||||
pon_cntl &= ~PON_CNTL_PULL_UP;
|
||||
|
||||
err = pm8xxx_writeb(pdev->dev.parent, PON_CNTL_1, pon_cntl);
|
||||
if (err < 0) {
|
||||
dev_err(&pdev->dev, "failed writing PON_CNTL_1 err=%d\n", err);
|
||||
goto free_input_dev;
|
||||
}
|
||||
|
||||
err = input_register_device(pwr);
|
||||
if (err) {
|
||||
dev_dbg(&pdev->dev, "Can't register power key: %d\n", err);
|
||||
goto free_input_dev;
|
||||
}
|
||||
|
||||
pwrkey->key_press_irq = key_press_irq;
|
||||
pwrkey->pwr = pwr;
|
||||
|
||||
platform_set_drvdata(pdev, pwrkey);
|
||||
|
||||
err = request_irq(key_press_irq, pwrkey_press_irq,
|
||||
IRQF_TRIGGER_RISING, "pmic8xxx_pwrkey_press", pwrkey);
|
||||
if (err < 0) {
|
||||
dev_dbg(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n",
|
||||
key_press_irq, err);
|
||||
goto unreg_input_dev;
|
||||
}
|
||||
|
||||
err = request_irq(key_release_irq, pwrkey_release_irq,
|
||||
IRQF_TRIGGER_RISING, "pmic8xxx_pwrkey_release", pwrkey);
|
||||
if (err < 0) {
|
||||
dev_dbg(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n",
|
||||
key_release_irq, err);
|
||||
|
||||
goto free_press_irq;
|
||||
}
|
||||
|
||||
device_init_wakeup(&pdev->dev, pdata->wakeup);
|
||||
|
||||
return 0;
|
||||
|
||||
free_press_irq:
|
||||
free_irq(key_press_irq, NULL);
|
||||
unreg_input_dev:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
input_unregister_device(pwr);
|
||||
pwr = NULL;
|
||||
free_input_dev:
|
||||
input_free_device(pwr);
|
||||
free_pwrkey:
|
||||
kfree(pwrkey);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int __devexit pmic8xxx_pwrkey_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct pmic8xxx_pwrkey *pwrkey = platform_get_drvdata(pdev);
|
||||
int key_release_irq = platform_get_irq(pdev, 0);
|
||||
int key_press_irq = platform_get_irq(pdev, 1);
|
||||
|
||||
device_init_wakeup(&pdev->dev, 0);
|
||||
|
||||
free_irq(key_press_irq, pwrkey);
|
||||
free_irq(key_release_irq, pwrkey);
|
||||
input_unregister_device(pwrkey->pwr);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
kfree(pwrkey);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver pmic8xxx_pwrkey_driver = {
|
||||
.probe = pmic8xxx_pwrkey_probe,
|
||||
.remove = __devexit_p(pmic8xxx_pwrkey_remove),
|
||||
.driver = {
|
||||
.name = PM8XXX_PWRKEY_DEV_NAME,
|
||||
.owner = THIS_MODULE,
|
||||
.pm = &pm8xxx_pwr_key_pm_ops,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init pmic8xxx_pwrkey_init(void)
|
||||
{
|
||||
return platform_driver_register(&pmic8xxx_pwrkey_driver);
|
||||
}
|
||||
module_init(pmic8xxx_pwrkey_init);
|
||||
|
||||
static void __exit pmic8xxx_pwrkey_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&pmic8xxx_pwrkey_driver);
|
||||
}
|
||||
module_exit(pmic8xxx_pwrkey_exit);
|
||||
|
||||
MODULE_ALIAS("platform:pmic8xxx_pwrkey");
|
||||
MODULE_DESCRIPTION("PMIC8XXX Power Key driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_AUTHOR("Trilok Soni <tsoni@codeaurora.org>");
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/i2c/twl.h>
|
||||
#include <linux/mfd/twl4030-codec.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
@@ -197,7 +196,7 @@ static SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops,
|
||||
|
||||
static int __devinit twl4030_vibra_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct twl4030_codec_vibra_data *pdata = mfd_get_data(pdev);
|
||||
struct twl4030_codec_vibra_data *pdata = pdev->dev.platform_data;
|
||||
struct vibra_info *info;
|
||||
int ret;
|
||||
|
||||
|
||||
@@ -389,6 +389,16 @@ config LEDS_NETXBIG
|
||||
and 5Big Network v2 boards. The LEDs are wired to a CPLD and are
|
||||
controlled through a GPIO extension bus.
|
||||
|
||||
config LEDS_ASIC3
|
||||
bool "LED support for the HTC ASIC3"
|
||||
depends on MFD_ASIC3
|
||||
default y
|
||||
help
|
||||
This option enables support for the LEDs on the HTC ASIC3. The HTC
|
||||
ASIC3 LED GPIOs are inputs, not outputs, thus the leds-gpio driver
|
||||
cannot be used. This driver supports hardware blinking with an on+off
|
||||
period from 62ms to 125s. Say Y to enable LEDs on the HP iPAQ hx4700.
|
||||
|
||||
config LEDS_TRIGGERS
|
||||
bool "LED Trigger support"
|
||||
depends on LEDS_CLASS
|
||||
|
||||
@@ -42,6 +42,7 @@ obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o
|
||||
obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o
|
||||
obj-$(CONFIG_LEDS_NS2) += leds-ns2.o
|
||||
obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
|
||||
obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o
|
||||
|
||||
# LED SPI Drivers
|
||||
obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <linux/leds.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/mfd/88pm860x.h>
|
||||
|
||||
#define LED_PWM_SHIFT (3)
|
||||
@@ -171,7 +170,6 @@ static int pm860x_led_probe(struct platform_device *pdev)
|
||||
struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
|
||||
struct pm860x_led_pdata *pdata;
|
||||
struct pm860x_led *data;
|
||||
struct mfd_cell *cell;
|
||||
struct resource *res;
|
||||
int ret;
|
||||
|
||||
@@ -181,10 +179,7 @@ static int pm860x_led_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cell = pdev->dev.platform_data;
|
||||
if (cell == NULL)
|
||||
return -ENODEV;
|
||||
pdata = cell->mfd_data;
|
||||
pdata = pdev->dev.platform_data;
|
||||
if (pdata == NULL) {
|
||||
dev_err(&pdev->dev, "No platform data!\n");
|
||||
return -EINVAL;
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Paul Parsons <lost.distance@yahoo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <linux/mfd/asic3.h>
|
||||
#include <linux/mfd/core.h>
|
||||
|
||||
/*
|
||||
* The HTC ASIC3 LED GPIOs are inputs, not outputs.
|
||||
* Hence we turn the LEDs on/off via the TimeBase register.
|
||||
*/
|
||||
|
||||
/*
|
||||
* When TimeBase is 4 the clock resolution is about 32Hz.
|
||||
* This driver supports hardware blinking with an on+off
|
||||
* period from 62ms (2 clocks) to 125s (4000 clocks).
|
||||
*/
|
||||
#define MS_TO_CLK(ms) DIV_ROUND_CLOSEST(((ms)*1024), 32000)
|
||||
#define CLK_TO_MS(clk) (((clk)*32000)/1024)
|
||||
#define MAX_CLK 4000 /* Fits into 12-bit Time registers */
|
||||
#define MAX_MS CLK_TO_MS(MAX_CLK)
|
||||
|
||||
static const unsigned int led_n_base[ASIC3_NUM_LEDS] = {
|
||||
[0] = ASIC3_LED_0_Base,
|
||||
[1] = ASIC3_LED_1_Base,
|
||||
[2] = ASIC3_LED_2_Base,
|
||||
};
|
||||
|
||||
static void brightness_set(struct led_classdev *cdev,
|
||||
enum led_brightness value)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(cdev->dev->parent);
|
||||
const struct mfd_cell *cell = mfd_get_cell(pdev);
|
||||
struct asic3 *asic = dev_get_drvdata(pdev->dev.parent);
|
||||
u32 timebase;
|
||||
unsigned int base;
|
||||
|
||||
timebase = (value == LED_OFF) ? 0 : (LED_EN|0x4);
|
||||
|
||||
base = led_n_base[cell->id];
|
||||
asic3_write_register(asic, (base + ASIC3_LED_PeriodTime), 32);
|
||||
asic3_write_register(asic, (base + ASIC3_LED_DutyTime), 32);
|
||||
asic3_write_register(asic, (base + ASIC3_LED_AutoStopCount), 0);
|
||||
asic3_write_register(asic, (base + ASIC3_LED_TimeBase), timebase);
|
||||
}
|
||||
|
||||
static int blink_set(struct led_classdev *cdev,
|
||||
unsigned long *delay_on,
|
||||
unsigned long *delay_off)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(cdev->dev->parent);
|
||||
const struct mfd_cell *cell = mfd_get_cell(pdev);
|
||||
struct asic3 *asic = dev_get_drvdata(pdev->dev.parent);
|
||||
u32 on;
|
||||
u32 off;
|
||||
unsigned int base;
|
||||
|
||||
if (*delay_on > MAX_MS || *delay_off > MAX_MS)
|
||||
return -EINVAL;
|
||||
|
||||
if (*delay_on == 0 && *delay_off == 0) {
|
||||
/* If both are zero then a sensible default should be chosen */
|
||||
on = MS_TO_CLK(500);
|
||||
off = MS_TO_CLK(500);
|
||||
} else {
|
||||
on = MS_TO_CLK(*delay_on);
|
||||
off = MS_TO_CLK(*delay_off);
|
||||
if ((on + off) > MAX_CLK)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
base = led_n_base[cell->id];
|
||||
asic3_write_register(asic, (base + ASIC3_LED_PeriodTime), (on + off));
|
||||
asic3_write_register(asic, (base + ASIC3_LED_DutyTime), on);
|
||||
asic3_write_register(asic, (base + ASIC3_LED_AutoStopCount), 0);
|
||||
asic3_write_register(asic, (base + ASIC3_LED_TimeBase), (LED_EN|0x4));
|
||||
|
||||
*delay_on = CLK_TO_MS(on);
|
||||
*delay_off = CLK_TO_MS(off);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devinit asic3_led_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct asic3_led *led = pdev->dev.platform_data;
|
||||
int ret;
|
||||
|
||||
ret = mfd_cell_enable(pdev);
|
||||
if (ret < 0)
|
||||
goto ret0;
|
||||
|
||||
led->cdev = kzalloc(sizeof(struct led_classdev), GFP_KERNEL);
|
||||
if (!led->cdev) {
|
||||
ret = -ENOMEM;
|
||||
goto ret1;
|
||||
}
|
||||
|
||||
led->cdev->name = led->name;
|
||||
led->cdev->default_trigger = led->default_trigger;
|
||||
led->cdev->brightness_set = brightness_set;
|
||||
led->cdev->blink_set = blink_set;
|
||||
|
||||
ret = led_classdev_register(&pdev->dev, led->cdev);
|
||||
if (ret < 0)
|
||||
goto ret2;
|
||||
|
||||
return 0;
|
||||
|
||||
ret2:
|
||||
kfree(led->cdev);
|
||||
ret1:
|
||||
(void) mfd_cell_disable(pdev);
|
||||
ret0:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __devexit asic3_led_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct asic3_led *led = pdev->dev.platform_data;
|
||||
|
||||
led_classdev_unregister(led->cdev);
|
||||
|
||||
kfree(led->cdev);
|
||||
|
||||
return mfd_cell_disable(pdev);
|
||||
}
|
||||
|
||||
static struct platform_driver asic3_led_driver = {
|
||||
.probe = asic3_led_probe,
|
||||
.remove = __devexit_p(asic3_led_remove),
|
||||
.driver = {
|
||||
.name = "leds-asic3",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
MODULE_ALIAS("platform:leds-asic3");
|
||||
|
||||
static int __init asic3_led_init(void)
|
||||
{
|
||||
return platform_driver_register(&asic3_led_driver);
|
||||
}
|
||||
|
||||
static void __exit asic3_led_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&asic3_led_driver);
|
||||
}
|
||||
|
||||
module_init(asic3_led_init);
|
||||
module_exit(asic3_led_exit);
|
||||
|
||||
MODULE_AUTHOR("Paul Parsons <lost.distance@yahoo.com>");
|
||||
MODULE_DESCRIPTION("HTC ASIC3 LED driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <linux/leds.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/mfd/mc13783.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
struct mc13783_led {
|
||||
@@ -184,7 +183,7 @@ static int __devinit mc13783_led_setup(struct mc13783_led *led, int max_current)
|
||||
|
||||
static int __devinit mc13783_leds_prepare(struct platform_device *pdev)
|
||||
{
|
||||
struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev);
|
||||
struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||
struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent);
|
||||
int ret = 0;
|
||||
int reg = 0;
|
||||
@@ -265,7 +264,7 @@ out:
|
||||
|
||||
static int __devinit mc13783_led_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev);
|
||||
struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||
struct mc13783_led_platform_data *led_cur;
|
||||
struct mc13783_led *led, *led_dat;
|
||||
int ret, i;
|
||||
@@ -352,7 +351,7 @@ err_free:
|
||||
|
||||
static int __devexit mc13783_led_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev);
|
||||
struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||
struct mc13783_led *led = platform_get_drvdata(pdev);
|
||||
struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent);
|
||||
int i;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user