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 tag 'mfd-3.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFD changes from Samuel Ortiz:
"Besides the usual cleanups, this one brings:
* Support for 5 new chipsets: Intel's ICH LPC and SCH Centerton,
ST-E's STAX211, Samsung's MAX77693 and TI's LM3533.
* Device tree support for the twl6040, tps65910, da9502 and ab8500
drivers.
* Fairly big tps56910, ab8500 and db8500 updates.
* i2c support for mc13xxx.
* Our regular update for the wm8xxx driver from Mark."
Fix up various conflicts with other trees, largely due to ab5500 removal
etc.
* tag 'mfd-3.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (106 commits)
mfd: Fix build break of max77693 by adding REGMAP_I2C option
mfd: Fix twl6040 build failure
mfd: Fix max77693 build failure
mfd: ab8500-core should depend on MFD_DB8500_PRCMU
gpio: tps65910: dt: process gpio specific device node info
mfd: Remove the parsing of dt info for tps65910 gpio
mfd: Save device node parsed platform data for tps65910 sub devices
mfd: Add r_select to lm3533 platform data
gpio: Add Intel Centerton support to gpio-sch
mfd: Emulate active low IRQs as well as active high IRQs for wm831x
mfd: Mark two lm3533 zone registers as volatile
mfd: Fix return type of lm533 attribute is_visible
mfd: Enable Device Tree support in the ab8500-pwm driver
mfd: Enable Device Tree support in the ab8500-sysctrl driver
mfd: Add support for Device Tree to twl6040
mfd: Register the twl6040 child for the ASoC codec unconditionally
mfd: Allocate twl6040 IRQ numbers dynamically
mfd: twl6040 code cleanup in interrupt initialization part
mfd: Enable ab8500-gpadc driver for Device Tree
mfd: Prevent unassigned pointer from being used in ab8500-gpadc driver
...
This commit is contained in:
+67
-9
@@ -106,6 +106,19 @@ config UCB1400_CORE
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called ucb1400_core.
|
||||
|
||||
config MFD_LM3533
|
||||
tristate "LM3533 Lighting Power chip"
|
||||
depends on I2C
|
||||
select MFD_CORE
|
||||
select REGMAP_I2C
|
||||
help
|
||||
Say yes here to enable support for National Semiconductor / TI
|
||||
LM3533 Lighting Power chips.
|
||||
|
||||
This driver provides common support for accessing the device;
|
||||
additional drivers must be enabled in order to use the LED,
|
||||
backlight or ambient-light-sensor functionality of the device.
|
||||
|
||||
config TPS6105X
|
||||
tristate "TPS61050/61052 Boost Converters"
|
||||
depends on I2C
|
||||
@@ -177,8 +190,8 @@ config MFD_TPS65910
|
||||
bool "TPS65910 Power Management chip"
|
||||
depends on I2C=y && GPIOLIB
|
||||
select MFD_CORE
|
||||
select GPIO_TPS65910
|
||||
select REGMAP_I2C
|
||||
select IRQ_DOMAIN
|
||||
help
|
||||
if you say yes here you get support for the TPS65910 series of
|
||||
Power Management chips.
|
||||
@@ -409,6 +422,19 @@ config PMIC_ADP5520
|
||||
individual components like LCD backlight, LEDs, GPIOs and Kepad
|
||||
under the corresponding menus.
|
||||
|
||||
config MFD_MAX77693
|
||||
bool "Maxim Semiconductor MAX77693 PMIC Support"
|
||||
depends on I2C=y && GENERIC_HARDIRQS
|
||||
select MFD_CORE
|
||||
select REGMAP_I2C
|
||||
help
|
||||
Say yes here to support for Maxim Semiconductor MAX77693.
|
||||
This is a companion Power Management IC with Flash, Haptic, Charger,
|
||||
and MUIC(Micro USB Interface Controller) controls on chip.
|
||||
This driver provides common support for accessing the device;
|
||||
additional drivers must be enabled in order to use the functionality
|
||||
of the device.
|
||||
|
||||
config MFD_MAX8925
|
||||
bool "Maxim Semiconductor MAX8925 PMIC Support"
|
||||
depends on I2C=y && GENERIC_HARDIRQS
|
||||
@@ -454,9 +480,9 @@ config MFD_S5M_CORE
|
||||
of the device
|
||||
|
||||
config MFD_WM8400
|
||||
tristate "Support Wolfson Microelectronics WM8400"
|
||||
bool "Support Wolfson Microelectronics WM8400"
|
||||
select MFD_CORE
|
||||
depends on I2C
|
||||
depends on I2C=y
|
||||
select REGMAP_I2C
|
||||
help
|
||||
Support for the Wolfson Microelecronics WM8400 PMIC and audio
|
||||
@@ -473,6 +499,7 @@ config MFD_WM831X_I2C
|
||||
select MFD_CORE
|
||||
select MFD_WM831X
|
||||
select REGMAP_I2C
|
||||
select IRQ_DOMAIN
|
||||
depends on I2C=y && GENERIC_HARDIRQS
|
||||
help
|
||||
Support for the Wolfson Microelecronics WM831x and WM832x PMICs
|
||||
@@ -485,6 +512,7 @@ config MFD_WM831X_SPI
|
||||
select MFD_CORE
|
||||
select MFD_WM831X
|
||||
select REGMAP_SPI
|
||||
select IRQ_DOMAIN
|
||||
depends on SPI_MASTER && GENERIC_HARDIRQS
|
||||
help
|
||||
Support for the Wolfson Microelecronics WM831x and WM832x PMICs
|
||||
@@ -597,17 +625,32 @@ config MFD_MC13783
|
||||
tristate
|
||||
|
||||
config MFD_MC13XXX
|
||||
tristate "Support Freescale MC13783 and MC13892"
|
||||
depends on SPI_MASTER
|
||||
tristate
|
||||
depends on SPI_MASTER || I2C
|
||||
select MFD_CORE
|
||||
select MFD_MC13783
|
||||
help
|
||||
Support for the Freescale (Atlas) PMIC and audio CODECs
|
||||
MC13783 and MC13892.
|
||||
This driver provides common support for accessing the device,
|
||||
Enable support for the Freescale MC13783 and MC13892 PMICs.
|
||||
This driver provides common support for accessing the device,
|
||||
additional drivers must be enabled in order to use the
|
||||
functionality of the device.
|
||||
|
||||
config MFD_MC13XXX_SPI
|
||||
tristate "Freescale MC13783 and MC13892 SPI interface"
|
||||
depends on SPI_MASTER
|
||||
select REGMAP_SPI
|
||||
select MFD_MC13XXX
|
||||
help
|
||||
Select this if your MC13xxx is connected via an SPI bus.
|
||||
|
||||
config MFD_MC13XXX_I2C
|
||||
tristate "Freescale MC13892 I2C interface"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
select MFD_MC13XXX
|
||||
help
|
||||
Select this if your MC13xxx is connected via an I2C bus.
|
||||
|
||||
config ABX500_CORE
|
||||
bool "ST-Ericsson ABX500 Mixed Signal Circuit register functions"
|
||||
default y if ARCH_U300 || ARCH_U8500
|
||||
@@ -651,7 +694,7 @@ config EZX_PCAP
|
||||
|
||||
config AB8500_CORE
|
||||
bool "ST-Ericsson AB8500 Mixed Signal Power Management chip"
|
||||
depends on GENERIC_HARDIRQS && ABX500_CORE
|
||||
depends on GENERIC_HARDIRQS && ABX500_CORE && MFD_DB8500_PRCMU
|
||||
select MFD_CORE
|
||||
help
|
||||
Select this option to enable access to AB8500 power management
|
||||
@@ -722,6 +765,16 @@ config LPC_SCH
|
||||
LPC bridge function of the Intel SCH provides support for
|
||||
System Management Bus and General Purpose I/O.
|
||||
|
||||
config LPC_ICH
|
||||
tristate "Intel ICH LPC"
|
||||
depends on PCI
|
||||
select MFD_CORE
|
||||
help
|
||||
The LPC bridge function of the Intel ICH provides support for
|
||||
many functional units. This driver provides needed support for
|
||||
other drivers to control these functions, currently GPIO and
|
||||
watchdog.
|
||||
|
||||
config MFD_RDC321X
|
||||
tristate "Support for RDC-R321x southbridge"
|
||||
select MFD_CORE
|
||||
@@ -854,6 +907,11 @@ config MFD_RC5T583
|
||||
Additional drivers must be enabled in order to use the
|
||||
different functionality of the device.
|
||||
|
||||
config MFD_STA2X11
|
||||
bool "STA2X11 multi function device support"
|
||||
depends on STA2X11
|
||||
select MFD_CORE
|
||||
|
||||
config MFD_ANATOP
|
||||
bool "Support for Freescale i.MX on-chip ANATOP controller"
|
||||
depends on SOC_IMX6Q
|
||||
|
||||
@@ -15,6 +15,7 @@ obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o
|
||||
obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o
|
||||
obj-$(CONFIG_MFD_TI_SSP) += ti-ssp.o
|
||||
|
||||
obj-$(CONFIG_MFD_STA2X11) += sta2x11-mfd.o
|
||||
obj-$(CONFIG_MFD_STMPE) += stmpe.o
|
||||
obj-$(CONFIG_STMPE_I2C) += stmpe-i2c.o
|
||||
obj-$(CONFIG_STMPE_SPI) += stmpe-spi.o
|
||||
@@ -54,6 +55,8 @@ obj-$(CONFIG_TWL6030_PWM) += twl6030-pwm.o
|
||||
obj-$(CONFIG_TWL6040_CORE) += twl6040-core.o twl6040-irq.o
|
||||
|
||||
obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o
|
||||
obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o
|
||||
obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o
|
||||
|
||||
obj-$(CONFIG_MFD_CORE) += mfd-core.o
|
||||
|
||||
@@ -75,6 +78,7 @@ obj-$(CONFIG_PMIC_DA9052) += da9052-core.o
|
||||
obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o
|
||||
obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
|
||||
|
||||
obj-$(CONFIG_MFD_MAX77693) += max77693.o max77693-irq.o
|
||||
max8925-objs := max8925-core.o max8925-i2c.o
|
||||
obj-$(CONFIG_MFD_MAX8925) += max8925.o
|
||||
obj-$(CONFIG_MFD_MAX8997) += max8997.o max8997-irq.o
|
||||
@@ -87,15 +91,15 @@ obj-$(CONFIG_PCF50633_GPIO) += pcf50633-gpio.o
|
||||
obj-$(CONFIG_ABX500_CORE) += abx500-core.o
|
||||
obj-$(CONFIG_AB3100_CORE) += ab3100-core.o
|
||||
obj-$(CONFIG_AB3100_OTP) += ab3100-otp.o
|
||||
obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o
|
||||
obj-$(CONFIG_AB8500_DEBUG) += ab8500-debugfs.o
|
||||
obj-$(CONFIG_AB8500_GPADC) += ab8500-gpadc.o
|
||||
obj-$(CONFIG_MFD_DB8500_PRCMU) += db8500-prcmu.o
|
||||
# ab8500-i2c need to come after db8500-prcmu (which provides the channel)
|
||||
obj-$(CONFIG_AB8500_I2C_CORE) += ab8500-i2c.o
|
||||
# ab8500-core need to come after db8500-prcmu (which provides the channel)
|
||||
obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o
|
||||
obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o
|
||||
obj-$(CONFIG_PMIC_ADP5520) += adp5520.o
|
||||
obj-$(CONFIG_LPC_SCH) += lpc_sch.o
|
||||
obj-$(CONFIG_LPC_ICH) += lpc_ich.o
|
||||
obj-$(CONFIG_MFD_RDC321X) += rdc321x-southbridge.o
|
||||
obj-$(CONFIG_MFD_JANZ_CMODIO) += janz-cmodio.o
|
||||
obj-$(CONFIG_MFD_JZ4740_ADC) += jz4740-adc.o
|
||||
|
||||
+369
-54
File diff suppressed because it is too large
Load Diff
@@ -608,10 +608,16 @@ static int __devexit ab8500_debug_remove(struct platform_device *plf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id ab8500_debug_match[] = {
|
||||
{ .compatible = "stericsson,ab8500-debug", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver ab8500_debug_driver = {
|
||||
.driver = {
|
||||
.name = "ab8500-debug",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = ab8500_debug_match,
|
||||
},
|
||||
.probe = ab8500_debug_probe,
|
||||
.remove = __devexit_p(ab8500_debug_remove)
|
||||
|
||||
@@ -584,7 +584,7 @@ static int __devinit ab8500_gpadc_probe(struct platform_device *pdev)
|
||||
|
||||
gpadc->irq = platform_get_irq_byname(pdev, "SW_CONV_END");
|
||||
if (gpadc->irq < 0) {
|
||||
dev_err(gpadc->dev, "failed to get platform irq-%d\n",
|
||||
dev_err(&pdev->dev, "failed to get platform irq-%d\n",
|
||||
gpadc->irq);
|
||||
ret = gpadc->irq;
|
||||
goto fail;
|
||||
@@ -648,12 +648,18 @@ static int __devexit ab8500_gpadc_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id ab8500_gpadc_match[] = {
|
||||
{ .compatible = "stericsson,ab8500-gpadc", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver ab8500_gpadc_driver = {
|
||||
.probe = ab8500_gpadc_probe,
|
||||
.remove = __devexit_p(ab8500_gpadc_remove),
|
||||
.driver = {
|
||||
.name = "ab8500-gpadc",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = ab8500_gpadc_match,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) ST-Ericsson SA 2010
|
||||
* Author: Mattias Wallin <mattias.wallin@stericsson.com> for ST-Ericsson.
|
||||
* License Terms: GNU General Public License v2
|
||||
* This file was based on drivers/mfd/ab8500-spi.c
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mfd/abx500/ab8500.h>
|
||||
#include <linux/mfd/dbx500-prcmu.h>
|
||||
|
||||
static int ab8500_i2c_write(struct ab8500 *ab8500, u16 addr, u8 data)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = prcmu_abb_write((u8)(addr >> 8), (u8)(addr & 0xFF), &data, 1);
|
||||
if (ret < 0)
|
||||
dev_err(ab8500->dev, "prcmu i2c error %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ab8500_i2c_write_masked(struct ab8500 *ab8500, u16 addr, u8 mask,
|
||||
u8 data)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = prcmu_abb_write_masked((u8)(addr >> 8), (u8)(addr & 0xFF), &data,
|
||||
&mask, 1);
|
||||
if (ret < 0)
|
||||
dev_err(ab8500->dev, "prcmu i2c error %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ab8500_i2c_read(struct ab8500 *ab8500, u16 addr)
|
||||
{
|
||||
int ret;
|
||||
u8 data;
|
||||
|
||||
ret = prcmu_abb_read((u8)(addr >> 8), (u8)(addr & 0xFF), &data, 1);
|
||||
if (ret < 0) {
|
||||
dev_err(ab8500->dev, "prcmu i2c error %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
return (int)data;
|
||||
}
|
||||
|
||||
static int __devinit ab8500_i2c_probe(struct platform_device *plf)
|
||||
{
|
||||
const struct platform_device_id *platid = platform_get_device_id(plf);
|
||||
struct ab8500 *ab8500;
|
||||
struct resource *resource;
|
||||
int ret;
|
||||
|
||||
ab8500 = kzalloc(sizeof *ab8500, GFP_KERNEL);
|
||||
if (!ab8500)
|
||||
return -ENOMEM;
|
||||
|
||||
ab8500->dev = &plf->dev;
|
||||
|
||||
resource = platform_get_resource(plf, IORESOURCE_IRQ, 0);
|
||||
if (!resource) {
|
||||
kfree(ab8500);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ab8500->irq = resource->start;
|
||||
|
||||
ab8500->read = ab8500_i2c_read;
|
||||
ab8500->write = ab8500_i2c_write;
|
||||
ab8500->write_masked = ab8500_i2c_write_masked;
|
||||
|
||||
platform_set_drvdata(plf, ab8500);
|
||||
|
||||
ret = ab8500_init(ab8500, platid->driver_data);
|
||||
if (ret)
|
||||
kfree(ab8500);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __devexit ab8500_i2c_remove(struct platform_device *plf)
|
||||
{
|
||||
struct ab8500 *ab8500 = platform_get_drvdata(plf);
|
||||
|
||||
ab8500_exit(ab8500);
|
||||
kfree(ab8500);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct platform_device_id ab8500_id[] = {
|
||||
{ "ab8500-i2c", AB8500_VERSION_AB8500 },
|
||||
{ "ab8505-i2c", AB8500_VERSION_AB8505 },
|
||||
{ "ab9540-i2c", AB8500_VERSION_AB9540 },
|
||||
{ "ab8540-i2c", AB8500_VERSION_AB8540 },
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct platform_driver ab8500_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "ab8500-i2c",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = ab8500_i2c_probe,
|
||||
.remove = __devexit_p(ab8500_i2c_remove),
|
||||
.id_table = ab8500_id,
|
||||
};
|
||||
|
||||
static int __init ab8500_i2c_init(void)
|
||||
{
|
||||
return platform_driver_register(&ab8500_i2c_driver);
|
||||
}
|
||||
|
||||
static void __exit ab8500_i2c_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&ab8500_i2c_driver);
|
||||
}
|
||||
arch_initcall(ab8500_i2c_init);
|
||||
module_exit(ab8500_i2c_exit);
|
||||
|
||||
MODULE_AUTHOR("Mattias WALLIN <mattias.wallin@stericsson.com");
|
||||
MODULE_DESCRIPTION("AB8500 Core access via PRCMU I2C");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
@@ -61,10 +61,16 @@ static int __devexit ab8500_sysctrl_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id ab8500_sysctrl_match[] = {
|
||||
{ .compatible = "stericsson,ab8500-sysctrl", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver ab8500_sysctrl_driver = {
|
||||
.driver = {
|
||||
.name = "ab8500-sysctrl",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = ab8500_sysctrl_match,
|
||||
},
|
||||
.probe = ab8500_sysctrl_probe,
|
||||
.remove = __devexit_p(ab8500_sysctrl_remove),
|
||||
|
||||
+11
-24
@@ -41,39 +41,26 @@
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/mfd/anatop.h>
|
||||
|
||||
u32 anatop_get_bits(struct anatop *adata, u32 addr, int bit_shift,
|
||||
int bit_width)
|
||||
u32 anatop_read_reg(struct anatop *adata, u32 addr)
|
||||
{
|
||||
u32 val, mask;
|
||||
|
||||
if (bit_width == 32)
|
||||
mask = ~0;
|
||||
else
|
||||
mask = (1 << bit_width) - 1;
|
||||
|
||||
val = readl(adata->ioreg + addr);
|
||||
val = (val >> bit_shift) & mask;
|
||||
|
||||
return val;
|
||||
return readl(adata->ioreg + addr);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(anatop_get_bits);
|
||||
EXPORT_SYMBOL_GPL(anatop_read_reg);
|
||||
|
||||
void anatop_set_bits(struct anatop *adata, u32 addr, int bit_shift,
|
||||
int bit_width, u32 data)
|
||||
void anatop_write_reg(struct anatop *adata, u32 addr, u32 data, u32 mask)
|
||||
{
|
||||
u32 val, mask;
|
||||
u32 val;
|
||||
|
||||
if (bit_width == 32)
|
||||
mask = ~0;
|
||||
else
|
||||
mask = (1 << bit_width) - 1;
|
||||
data &= mask;
|
||||
|
||||
spin_lock(&adata->reglock);
|
||||
val = readl(adata->ioreg + addr) & ~(mask << bit_shift);
|
||||
writel((data << bit_shift) | val, adata->ioreg + addr);
|
||||
val = readl(adata->ioreg + addr);
|
||||
val &= ~mask;
|
||||
val |= data;
|
||||
writel(val, adata->ioreg + addr);
|
||||
spin_unlock(&adata->reglock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(anatop_set_bits);
|
||||
EXPORT_SYMBOL_GPL(anatop_write_reg);
|
||||
|
||||
static const struct of_device_id of_anatop_match[] = {
|
||||
{ .compatible = "fsl,imx6q-anatop", },
|
||||
|
||||
+29
-4
@@ -353,12 +353,28 @@ static int asic3_gpio_irq_type(struct irq_data *data, unsigned int type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int asic3_gpio_irq_set_wake(struct irq_data *data, unsigned int on)
|
||||
{
|
||||
struct asic3 *asic = irq_data_get_irq_chip_data(data);
|
||||
u32 bank, index;
|
||||
u16 bit;
|
||||
|
||||
bank = asic3_irq_to_bank(asic, data->irq);
|
||||
index = asic3_irq_to_index(asic, data->irq);
|
||||
bit = 1<<index;
|
||||
|
||||
asic3_set_register(asic, bank + ASIC3_GPIO_SLEEP_MASK, bit, !on);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct irq_chip asic3_gpio_irq_chip = {
|
||||
.name = "ASIC3-GPIO",
|
||||
.irq_ack = asic3_mask_gpio_irq,
|
||||
.irq_mask = asic3_mask_gpio_irq,
|
||||
.irq_unmask = asic3_unmask_gpio_irq,
|
||||
.irq_set_type = asic3_gpio_irq_type,
|
||||
.irq_set_wake = asic3_gpio_irq_set_wake,
|
||||
};
|
||||
|
||||
static struct irq_chip asic3_irq_chip = {
|
||||
@@ -529,7 +545,7 @@ static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
struct asic3 *asic = container_of(chip, struct asic3, gpio);
|
||||
|
||||
return (offset < ASIC3_NUM_GPIOS) ? asic->irq_base + offset : -ENXIO;
|
||||
return asic->irq_base + offset;
|
||||
}
|
||||
|
||||
static __init int asic3_gpio_probe(struct platform_device *pdev,
|
||||
@@ -894,10 +910,13 @@ static int __init asic3_mfd_probe(struct platform_device *pdev,
|
||||
asic3_mmc_resources[0].start >>= asic->bus_shift;
|
||||
asic3_mmc_resources[0].end >>= asic->bus_shift;
|
||||
|
||||
ret = mfd_add_devices(&pdev->dev, pdev->id,
|
||||
if (pdata->clock_rate) {
|
||||
ds1wm_pdata.clock_rate = pdata->clock_rate;
|
||||
ret = mfd_add_devices(&pdev->dev, pdev->id,
|
||||
&asic3_cell_ds1wm, 1, mem, asic->irq_base);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (mem_sdio && (irq >= 0)) {
|
||||
ret = mfd_add_devices(&pdev->dev, pdev->id,
|
||||
@@ -1000,6 +1019,9 @@ static int __init asic3_probe(struct platform_device *pdev)
|
||||
|
||||
asic3_mfd_probe(pdev, pdata, mem);
|
||||
|
||||
asic3_set_register(asic, ASIC3_OFFSET(EXTCF, SELECT),
|
||||
(ASIC3_EXTCF_CF0_BUF_EN|ASIC3_EXTCF_CF0_PWAIT_EN), 1);
|
||||
|
||||
dev_info(asic->dev, "ASIC3 Core driver\n");
|
||||
|
||||
return 0;
|
||||
@@ -1021,6 +1043,9 @@ static int __devexit asic3_remove(struct platform_device *pdev)
|
||||
int ret;
|
||||
struct asic3 *asic = platform_get_drvdata(pdev);
|
||||
|
||||
asic3_set_register(asic, ASIC3_OFFSET(EXTCF, SELECT),
|
||||
(ASIC3_EXTCF_CF0_BUF_EN|ASIC3_EXTCF_CF0_PWAIT_EN), 0);
|
||||
|
||||
asic3_mfd_remove(pdev);
|
||||
|
||||
ret = asic3_gpio_remove(pdev);
|
||||
|
||||
@@ -186,18 +186,7 @@ static struct pci_driver cs5535_mfd_driver = {
|
||||
.remove = __devexit_p(cs5535_mfd_remove),
|
||||
};
|
||||
|
||||
static int __init cs5535_mfd_init(void)
|
||||
{
|
||||
return pci_register_driver(&cs5535_mfd_driver);
|
||||
}
|
||||
|
||||
static void __exit cs5535_mfd_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&cs5535_mfd_driver);
|
||||
}
|
||||
|
||||
module_init(cs5535_mfd_init);
|
||||
module_exit(cs5535_mfd_exit);
|
||||
module_pci_driver(cs5535_mfd_driver);
|
||||
|
||||
MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
|
||||
MODULE_DESCRIPTION("MFD driver for CS5535/CS5536 southbridge's ISA PCI device");
|
||||
|
||||
@@ -318,6 +318,135 @@ static bool da9052_reg_volatile(struct device *dev, unsigned int reg)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TBAT look-up table is computed from the R90 reg (8 bit register)
|
||||
* reading as below. The battery temperature is in milliCentigrade
|
||||
* TBAT = (1/(t1+1/298) - 273) * 1000 mC
|
||||
* where t1 = (1/B)* ln(( ADCval * 2.5)/(R25*ITBAT*255))
|
||||
* Default values are R25 = 10e3, B = 3380, ITBAT = 50e-6
|
||||
* Example:
|
||||
* R25=10E3, B=3380, ITBAT=50e-6, ADCVAL=62d calculates
|
||||
* TBAT = 20015 mili degrees Centrigrade
|
||||
*
|
||||
*/
|
||||
static const int32_t tbat_lookup[255] = {
|
||||
183258, 144221, 124334, 111336, 101826, 94397, 88343, 83257,
|
||||
78889, 75071, 71688, 68656, 65914, 63414, 61120, 59001,
|
||||
570366, 55204, 53490, 51881, 50364, 48931, 47574, 46285,
|
||||
45059, 43889, 42772, 41703, 40678, 39694, 38748, 37838,
|
||||
36961, 36115, 35297, 34507, 33743, 33002, 32284, 31588,
|
||||
30911, 30254, 29615, 28994, 28389, 27799, 27225, 26664,
|
||||
26117, 25584, 25062, 24553, 24054, 23567, 23091, 22624,
|
||||
22167, 21719, 21281, 20851, 20429, 20015, 19610, 19211,
|
||||
18820, 18436, 18058, 17688, 17323, 16965, 16612, 16266,
|
||||
15925, 15589, 15259, 14933, 14613, 14298, 13987, 13681,
|
||||
13379, 13082, 12788, 12499, 12214, 11933, 11655, 11382,
|
||||
11112, 10845, 10582, 10322, 10066, 9812, 9562, 9315,
|
||||
9071, 8830, 8591, 8356, 8123, 7893, 7665, 7440,
|
||||
7218, 6998, 6780, 6565, 6352, 6141, 5933, 5726,
|
||||
5522, 5320, 5120, 4922, 4726, 4532, 4340, 4149,
|
||||
3961, 3774, 3589, 3406, 3225, 3045, 2867, 2690,
|
||||
2516, 2342, 2170, 2000, 1831, 1664, 1498, 1334,
|
||||
1171, 1009, 849, 690, 532, 376, 221, 67,
|
||||
-84, -236, -386, -535, -683, -830, -975, -1119,
|
||||
-1263, -1405, -1546, -1686, -1825, -1964, -2101, -2237,
|
||||
-2372, -2506, -2639, -2771, -2902, -3033, -3162, -3291,
|
||||
-3418, -3545, -3671, -3796, -3920, -4044, -4166, -4288,
|
||||
-4409, -4529, -4649, -4767, -4885, -5002, -5119, -5235,
|
||||
-5349, -5464, -5577, -5690, -5802, -5913, -6024, -6134,
|
||||
-6244, -6352, -6461, -6568, -6675, -6781, -6887, -6992,
|
||||
-7096, -7200, -7303, -7406, -7508, -7609, -7710, -7810,
|
||||
-7910, -8009, -8108, -8206, -8304, -8401, -8497, -8593,
|
||||
-8689, -8784, -8878, -8972, -9066, -9159, -9251, -9343,
|
||||
-9435, -9526, -9617, -9707, -9796, -9886, -9975, -10063,
|
||||
-10151, -10238, -10325, -10412, -10839, -10923, -11007, -11090,
|
||||
-11173, -11256, -11338, -11420, -11501, -11583, -11663, -11744,
|
||||
-11823, -11903, -11982
|
||||
};
|
||||
|
||||
static const u8 chan_mux[DA9052_ADC_VBBAT + 1] = {
|
||||
[DA9052_ADC_VDDOUT] = DA9052_ADC_MAN_MUXSEL_VDDOUT,
|
||||
[DA9052_ADC_ICH] = DA9052_ADC_MAN_MUXSEL_ICH,
|
||||
[DA9052_ADC_TBAT] = DA9052_ADC_MAN_MUXSEL_TBAT,
|
||||
[DA9052_ADC_VBAT] = DA9052_ADC_MAN_MUXSEL_VBAT,
|
||||
[DA9052_ADC_IN4] = DA9052_ADC_MAN_MUXSEL_AD4,
|
||||
[DA9052_ADC_IN5] = DA9052_ADC_MAN_MUXSEL_AD5,
|
||||
[DA9052_ADC_IN6] = DA9052_ADC_MAN_MUXSEL_AD6,
|
||||
[DA9052_ADC_VBBAT] = DA9052_ADC_MAN_MUXSEL_VBBAT
|
||||
};
|
||||
|
||||
int da9052_adc_manual_read(struct da9052 *da9052, unsigned char channel)
|
||||
{
|
||||
int ret;
|
||||
unsigned short calc_data;
|
||||
unsigned short data;
|
||||
unsigned char mux_sel;
|
||||
|
||||
if (channel > DA9052_ADC_VBBAT)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&da9052->auxadc_lock);
|
||||
|
||||
/* Channel gets activated on enabling the Conversion bit */
|
||||
mux_sel = chan_mux[channel] | DA9052_ADC_MAN_MAN_CONV;
|
||||
|
||||
ret = da9052_reg_write(da9052, DA9052_ADC_MAN_REG, mux_sel);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
/* Wait for an interrupt */
|
||||
if (!wait_for_completion_timeout(&da9052->done,
|
||||
msecs_to_jiffies(500))) {
|
||||
dev_err(da9052->dev,
|
||||
"timeout waiting for ADC conversion interrupt\n");
|
||||
ret = -ETIMEDOUT;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = da9052_reg_read(da9052, DA9052_ADC_RES_H_REG);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
calc_data = (unsigned short)ret;
|
||||
data = calc_data << 2;
|
||||
|
||||
ret = da9052_reg_read(da9052, DA9052_ADC_RES_L_REG);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
calc_data = (unsigned short)(ret & DA9052_ADC_RES_LSB);
|
||||
data |= calc_data;
|
||||
|
||||
ret = data;
|
||||
|
||||
err:
|
||||
mutex_unlock(&da9052->auxadc_lock);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(da9052_adc_manual_read);
|
||||
|
||||
static irqreturn_t da9052_auxadc_irq(int irq, void *irq_data)
|
||||
{
|
||||
struct da9052 *da9052 = irq_data;
|
||||
|
||||
complete(&da9052->done);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
int da9052_adc_read_temp(struct da9052 *da9052)
|
||||
{
|
||||
int tbat;
|
||||
|
||||
tbat = da9052_reg_read(da9052, DA9052_TBAT_RES_REG);
|
||||
if (tbat <= 0)
|
||||
return tbat;
|
||||
|
||||
/* ARRAY_SIZE check is not needed since TBAT is a 8-bit register */
|
||||
return tbat_lookup[tbat - 1];
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(da9052_adc_read_temp);
|
||||
|
||||
static struct resource da9052_rtc_resource = {
|
||||
.name = "ALM",
|
||||
.start = DA9052_IRQ_ALARM,
|
||||
@@ -646,6 +775,9 @@ int __devinit da9052_device_init(struct da9052 *da9052, u8 chip_id)
|
||||
struct irq_desc *desc;
|
||||
int ret;
|
||||
|
||||
mutex_init(&da9052->auxadc_lock);
|
||||
init_completion(&da9052->done);
|
||||
|
||||
if (pdata && pdata->init != NULL)
|
||||
pdata->init(da9052);
|
||||
|
||||
@@ -665,6 +797,12 @@ int __devinit da9052_device_init(struct da9052 *da9052, u8 chip_id)
|
||||
|
||||
da9052->irq_base = regmap_irq_chip_get_base(da9052->irq_data);
|
||||
|
||||
ret = request_threaded_irq(DA9052_IRQ_ADC_EOM, NULL, da9052_auxadc_irq,
|
||||
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
|
||||
"adc irq", da9052);
|
||||
if (ret != 0)
|
||||
dev_err(da9052->dev, "DA9052 ADC IRQ failed ret=%d\n", ret);
|
||||
|
||||
ret = mfd_add_devices(da9052->dev, -1, da9052_subdev_info,
|
||||
ARRAY_SIZE(da9052_subdev_info), NULL, 0);
|
||||
if (ret)
|
||||
@@ -673,6 +811,7 @@ int __devinit da9052_device_init(struct da9052 *da9052, u8 chip_id)
|
||||
return 0;
|
||||
|
||||
err:
|
||||
free_irq(DA9052_IRQ_ADC_EOM, da9052);
|
||||
mfd_remove_devices(da9052->dev);
|
||||
regmap_err:
|
||||
return ret;
|
||||
@@ -680,6 +819,7 @@ regmap_err:
|
||||
|
||||
void da9052_device_exit(struct da9052 *da9052)
|
||||
{
|
||||
free_irq(DA9052_IRQ_ADC_EOM, da9052);
|
||||
regmap_del_irq_chip(da9052->chip_irq, da9052->irq_data);
|
||||
mfd_remove_devices(da9052->dev);
|
||||
}
|
||||
|
||||
+83
-59
@@ -22,6 +22,11 @@
|
||||
#include <linux/mfd/da9052/da9052.h>
|
||||
#include <linux/mfd/da9052/reg.h>
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#endif
|
||||
|
||||
static int da9052_i2c_enable_multiwrite(struct da9052 *da9052)
|
||||
{
|
||||
int reg_val, ret;
|
||||
@@ -41,65 +46,6 @@ static int da9052_i2c_enable_multiwrite(struct da9052 *da9052)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devinit da9052_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct da9052 *da9052;
|
||||
int ret;
|
||||
|
||||
da9052 = kzalloc(sizeof(struct da9052), GFP_KERNEL);
|
||||
if (!da9052)
|
||||
return -ENOMEM;
|
||||
|
||||
if (!i2c_check_functionality(client->adapter,
|
||||
I2C_FUNC_SMBUS_BYTE_DATA)) {
|
||||
dev_info(&client->dev, "Error in %s:i2c_check_functionality\n",
|
||||
__func__);
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
}
|
||||
|
||||
da9052->dev = &client->dev;
|
||||
da9052->chip_irq = client->irq;
|
||||
|
||||
i2c_set_clientdata(client, da9052);
|
||||
|
||||
da9052->regmap = regmap_init_i2c(client, &da9052_regmap_config);
|
||||
if (IS_ERR(da9052->regmap)) {
|
||||
ret = PTR_ERR(da9052->regmap);
|
||||
dev_err(&client->dev, "Failed to allocate register map: %d\n",
|
||||
ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = da9052_i2c_enable_multiwrite(da9052);
|
||||
if (ret < 0)
|
||||
goto err_regmap;
|
||||
|
||||
ret = da9052_device_init(da9052, id->driver_data);
|
||||
if (ret != 0)
|
||||
goto err_regmap;
|
||||
|
||||
return 0;
|
||||
|
||||
err_regmap:
|
||||
regmap_exit(da9052->regmap);
|
||||
err:
|
||||
kfree(da9052);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __devexit da9052_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
struct da9052 *da9052 = i2c_get_clientdata(client);
|
||||
|
||||
da9052_device_exit(da9052);
|
||||
regmap_exit(da9052->regmap);
|
||||
kfree(da9052);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct i2c_device_id da9052_i2c_id[] = {
|
||||
{"da9052", DA9052},
|
||||
{"da9053-aa", DA9053_AA},
|
||||
@@ -108,6 +54,81 @@ static struct i2c_device_id da9052_i2c_id[] = {
|
||||
{}
|
||||
};
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static const struct of_device_id dialog_dt_ids[] = {
|
||||
{ .compatible = "dlg,da9052", .data = &da9052_i2c_id[0] },
|
||||
{ .compatible = "dlg,da9053-aa", .data = &da9052_i2c_id[1] },
|
||||
{ .compatible = "dlg,da9053-ab", .data = &da9052_i2c_id[2] },
|
||||
{ .compatible = "dlg,da9053-bb", .data = &da9052_i2c_id[3] },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
#endif
|
||||
|
||||
static int __devinit da9052_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct da9052 *da9052;
|
||||
int ret;
|
||||
|
||||
da9052 = devm_kzalloc(&client->dev, sizeof(struct da9052), GFP_KERNEL);
|
||||
if (!da9052)
|
||||
return -ENOMEM;
|
||||
|
||||
if (!i2c_check_functionality(client->adapter,
|
||||
I2C_FUNC_SMBUS_BYTE_DATA)) {
|
||||
dev_info(&client->dev, "Error in %s:i2c_check_functionality\n",
|
||||
__func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
da9052->dev = &client->dev;
|
||||
da9052->chip_irq = client->irq;
|
||||
|
||||
i2c_set_clientdata(client, da9052);
|
||||
|
||||
da9052->regmap = devm_regmap_init_i2c(client, &da9052_regmap_config);
|
||||
if (IS_ERR(da9052->regmap)) {
|
||||
ret = PTR_ERR(da9052->regmap);
|
||||
dev_err(&client->dev, "Failed to allocate register map: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = da9052_i2c_enable_multiwrite(da9052);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
if (!id) {
|
||||
struct device_node *np = client->dev.of_node;
|
||||
const struct of_device_id *deviceid;
|
||||
|
||||
deviceid = of_match_node(dialog_dt_ids, np);
|
||||
id = (const struct i2c_device_id *)deviceid->data;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!id) {
|
||||
ret = -ENODEV;
|
||||
dev_err(&client->dev, "id is null.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = da9052_device_init(da9052, id->driver_data);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devexit da9052_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
struct da9052 *da9052 = i2c_get_clientdata(client);
|
||||
|
||||
da9052_device_exit(da9052);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct i2c_driver da9052_i2c_driver = {
|
||||
.probe = da9052_i2c_probe,
|
||||
.remove = __devexit_p(da9052_i2c_remove),
|
||||
@@ -115,6 +136,9 @@ static struct i2c_driver da9052_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "da9052",
|
||||
.owner = THIS_MODULE,
|
||||
#ifdef CONFIG_OF
|
||||
.of_match_table = dialog_dt_ids,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -25,8 +25,9 @@ static int __devinit da9052_spi_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret;
|
||||
const struct spi_device_id *id = spi_get_device_id(spi);
|
||||
struct da9052 *da9052 = kzalloc(sizeof(struct da9052), GFP_KERNEL);
|
||||
struct da9052 *da9052;
|
||||
|
||||
da9052 = devm_kzalloc(&spi->dev, sizeof(struct da9052), GFP_KERNEL);
|
||||
if (!da9052)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -42,25 +43,19 @@ static int __devinit da9052_spi_probe(struct spi_device *spi)
|
||||
da9052_regmap_config.read_flag_mask = 1;
|
||||
da9052_regmap_config.write_flag_mask = 0;
|
||||
|
||||
da9052->regmap = regmap_init_spi(spi, &da9052_regmap_config);
|
||||
da9052->regmap = devm_regmap_init_spi(spi, &da9052_regmap_config);
|
||||
if (IS_ERR(da9052->regmap)) {
|
||||
ret = PTR_ERR(da9052->regmap);
|
||||
dev_err(&spi->dev, "Failed to allocate register map: %d\n",
|
||||
ret);
|
||||
goto err;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = da9052_device_init(da9052, id->driver_data);
|
||||
if (ret != 0)
|
||||
goto err_regmap;
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
|
||||
err_regmap:
|
||||
regmap_exit(da9052->regmap);
|
||||
err:
|
||||
kfree(da9052);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __devexit da9052_spi_remove(struct spi_device *spi)
|
||||
@@ -68,9 +63,6 @@ static int __devexit da9052_spi_remove(struct spi_device *spi)
|
||||
struct da9052 *da9052 = dev_get_drvdata(&spi->dev);
|
||||
|
||||
da9052_device_exit(da9052);
|
||||
regmap_exit(da9052->regmap);
|
||||
kfree(da9052);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -88,7 +80,6 @@ static struct spi_driver da9052_spi_driver = {
|
||||
.id_table = da9052_spi_id,
|
||||
.driver = {
|
||||
.name = "da9052",
|
||||
.bus = &spi_bus_type,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
+23
-12
@@ -2720,6 +2720,7 @@ static struct regulator_consumer_supply db8500_vape_consumers[] = {
|
||||
REGULATOR_SUPPLY("v-i2c", "nmk-i2c.1"),
|
||||
REGULATOR_SUPPLY("v-i2c", "nmk-i2c.2"),
|
||||
REGULATOR_SUPPLY("v-i2c", "nmk-i2c.3"),
|
||||
REGULATOR_SUPPLY("v-i2c", "nmk-i2c.4"),
|
||||
/* "v-mmc" changed to "vcore" in the mainline kernel */
|
||||
REGULATOR_SUPPLY("vcore", "sdi0"),
|
||||
REGULATOR_SUPPLY("vcore", "sdi1"),
|
||||
@@ -2958,9 +2959,10 @@ static struct mfd_cell db8500_prcmu_devs[] = {
|
||||
* prcmu_fw_init - arch init call for the Linux PRCMU fw init logic
|
||||
*
|
||||
*/
|
||||
static int __init db8500_prcmu_probe(struct platform_device *pdev)
|
||||
static int __devinit db8500_prcmu_probe(struct platform_device *pdev)
|
||||
{
|
||||
int err = 0;
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
int irq = 0, err = 0;
|
||||
|
||||
if (ux500_is_svp())
|
||||
return -ENODEV;
|
||||
@@ -2970,8 +2972,14 @@ static int __init db8500_prcmu_probe(struct platform_device *pdev)
|
||||
/* Clean up the mailbox interrupts after pre-kernel code. */
|
||||
writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR);
|
||||
|
||||
err = request_threaded_irq(IRQ_DB8500_PRCMU1, prcmu_irq_handler,
|
||||
prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL);
|
||||
if (np)
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
|
||||
if (!np || irq <= 0)
|
||||
irq = IRQ_DB8500_PRCMU1;
|
||||
|
||||
err = request_threaded_irq(irq, prcmu_irq_handler,
|
||||
prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL);
|
||||
if (err < 0) {
|
||||
pr_err("prcmu: Failed to allocate IRQ_DB8500_PRCMU1.\n");
|
||||
err = -EBUSY;
|
||||
@@ -2981,14 +2989,16 @@ static int __init db8500_prcmu_probe(struct platform_device *pdev)
|
||||
if (cpu_is_u8500v20_or_later())
|
||||
prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET);
|
||||
|
||||
err = mfd_add_devices(&pdev->dev, 0, db8500_prcmu_devs,
|
||||
ARRAY_SIZE(db8500_prcmu_devs), NULL,
|
||||
0);
|
||||
if (!np) {
|
||||
err = mfd_add_devices(&pdev->dev, 0, db8500_prcmu_devs,
|
||||
ARRAY_SIZE(db8500_prcmu_devs), NULL, 0);
|
||||
if (err) {
|
||||
pr_err("prcmu: Failed to add subdevices\n");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
if (err)
|
||||
pr_err("prcmu: Failed to add subdevices\n");
|
||||
else
|
||||
pr_info("DB8500 PRCMU initialized\n");
|
||||
pr_info("DB8500 PRCMU initialized\n");
|
||||
|
||||
no_irq_return:
|
||||
return err;
|
||||
@@ -2999,11 +3009,12 @@ static struct platform_driver db8500_prcmu_driver = {
|
||||
.name = "db8500-prcmu",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = db8500_prcmu_probe,
|
||||
};
|
||||
|
||||
static int __init db8500_prcmu_init(void)
|
||||
{
|
||||
return platform_driver_probe(&db8500_prcmu_driver, db8500_prcmu_probe);
|
||||
return platform_driver_register(&db8500_prcmu_driver);
|
||||
}
|
||||
|
||||
arch_initcall(db8500_prcmu_init);
|
||||
|
||||
@@ -406,7 +406,7 @@ static int __devinit intel_msic_probe(struct platform_device *pdev)
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
msic = kzalloc(sizeof(*msic), GFP_KERNEL);
|
||||
msic = devm_kzalloc(&pdev->dev, sizeof(*msic), GFP_KERNEL);
|
||||
if (!msic)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -421,21 +421,13 @@ static int __devinit intel_msic_probe(struct platform_device *pdev)
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "failed to get SRAM iomem resource\n");
|
||||
ret = -ENODEV;
|
||||
goto fail_free_msic;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
res = request_mem_region(res->start, resource_size(res), pdev->name);
|
||||
if (!res) {
|
||||
ret = -EBUSY;
|
||||
goto fail_free_msic;
|
||||
}
|
||||
|
||||
msic->irq_base = ioremap_nocache(res->start, resource_size(res));
|
||||
msic->irq_base = devm_request_and_ioremap(&pdev->dev, res);
|
||||
if (!msic->irq_base) {
|
||||
dev_err(&pdev->dev, "failed to map SRAM memory\n");
|
||||
ret = -ENOMEM;
|
||||
goto fail_release_region;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, msic);
|
||||
@@ -443,7 +435,7 @@ static int __devinit intel_msic_probe(struct platform_device *pdev)
|
||||
ret = intel_msic_init_devices(msic);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "failed to initialize MSIC devices\n");
|
||||
goto fail_unmap_mem;
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev_info(&pdev->dev, "Intel MSIC version %c%d (vendor %#x)\n",
|
||||
@@ -451,27 +443,14 @@ static int __devinit intel_msic_probe(struct platform_device *pdev)
|
||||
msic->vendor);
|
||||
|
||||
return 0;
|
||||
|
||||
fail_unmap_mem:
|
||||
iounmap(msic->irq_base);
|
||||
fail_release_region:
|
||||
release_mem_region(res->start, resource_size(res));
|
||||
fail_free_msic:
|
||||
kfree(msic);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __devexit intel_msic_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct intel_msic *msic = platform_get_drvdata(pdev);
|
||||
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
|
||||
intel_msic_remove_devices(msic);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
iounmap(msic->irq_base);
|
||||
release_mem_region(res->start, resource_size(res));
|
||||
kfree(msic);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -283,23 +283,8 @@ static struct pci_driver cmodio_pci_driver = {
|
||||
.remove = __devexit_p(cmodio_pci_remove),
|
||||
};
|
||||
|
||||
/*
|
||||
* Module Init / Exit
|
||||
*/
|
||||
|
||||
static int __init cmodio_init(void)
|
||||
{
|
||||
return pci_register_driver(&cmodio_pci_driver);
|
||||
}
|
||||
|
||||
static void __exit cmodio_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&cmodio_pci_driver);
|
||||
}
|
||||
module_pci_driver(cmodio_pci_driver);
|
||||
|
||||
MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>");
|
||||
MODULE_DESCRIPTION("Janz CMOD-IO PCI MODULbus Carrier Board Driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
module_init(cmodio_init);
|
||||
module_exit(cmodio_exit);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* lm3533-ctrlbank.c -- LM3533 Generic Control Bank interface
|
||||
*
|
||||
* Copyright (C) 2011-2012 Texas Instruments
|
||||
*
|
||||
* Author: Johan Hovold <jhovold@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <linux/mfd/lm3533.h>
|
||||
|
||||
|
||||
#define LM3533_MAX_CURRENT_MIN 5000
|
||||
#define LM3533_MAX_CURRENT_MAX 29800
|
||||
#define LM3533_MAX_CURRENT_STEP 800
|
||||
|
||||
#define LM3533_BRIGHTNESS_MAX 255
|
||||
#define LM3533_PWM_MAX 0x3f
|
||||
|
||||
#define LM3533_REG_PWM_BASE 0x14
|
||||
#define LM3533_REG_MAX_CURRENT_BASE 0x1f
|
||||
#define LM3533_REG_CTRLBANK_ENABLE 0x27
|
||||
#define LM3533_REG_BRIGHTNESS_BASE 0x40
|
||||
|
||||
|
||||
static inline u8 lm3533_ctrlbank_get_reg(struct lm3533_ctrlbank *cb, u8 base)
|
||||
{
|
||||
return base + cb->id;
|
||||
}
|
||||
|
||||
int lm3533_ctrlbank_enable(struct lm3533_ctrlbank *cb)
|
||||
{
|
||||
u8 mask;
|
||||
int ret;
|
||||
|
||||
dev_dbg(cb->dev, "%s - %d\n", __func__, cb->id);
|
||||
|
||||
mask = 1 << cb->id;
|
||||
ret = lm3533_update(cb->lm3533, LM3533_REG_CTRLBANK_ENABLE,
|
||||
mask, mask);
|
||||
if (ret)
|
||||
dev_err(cb->dev, "failed to enable ctrlbank %d\n", cb->id);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(lm3533_ctrlbank_enable);
|
||||
|
||||
int lm3533_ctrlbank_disable(struct lm3533_ctrlbank *cb)
|
||||
{
|
||||
u8 mask;
|
||||
int ret;
|
||||
|
||||
dev_dbg(cb->dev, "%s - %d\n", __func__, cb->id);
|
||||
|
||||
mask = 1 << cb->id;
|
||||
ret = lm3533_update(cb->lm3533, LM3533_REG_CTRLBANK_ENABLE, 0, mask);
|
||||
if (ret)
|
||||
dev_err(cb->dev, "failed to disable ctrlbank %d\n", cb->id);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(lm3533_ctrlbank_disable);
|
||||
|
||||
/*
|
||||
* Full-scale current.
|
||||
*
|
||||
* imax 5000 - 29800 uA (800 uA step)
|
||||
*/
|
||||
int lm3533_ctrlbank_set_max_current(struct lm3533_ctrlbank *cb, u16 imax)
|
||||
{
|
||||
u8 reg;
|
||||
u8 val;
|
||||
int ret;
|
||||
|
||||
if (imax < LM3533_MAX_CURRENT_MIN || imax > LM3533_MAX_CURRENT_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
val = (imax - LM3533_MAX_CURRENT_MIN) / LM3533_MAX_CURRENT_STEP;
|
||||
|
||||
reg = lm3533_ctrlbank_get_reg(cb, LM3533_REG_MAX_CURRENT_BASE);
|
||||
ret = lm3533_write(cb->lm3533, reg, val);
|
||||
if (ret)
|
||||
dev_err(cb->dev, "failed to set max current\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(lm3533_ctrlbank_set_max_current);
|
||||
|
||||
#define lm3533_ctrlbank_set(_name, _NAME) \
|
||||
int lm3533_ctrlbank_set_##_name(struct lm3533_ctrlbank *cb, u8 val) \
|
||||
{ \
|
||||
u8 reg; \
|
||||
int ret; \
|
||||
\
|
||||
if (val > LM3533_##_NAME##_MAX) \
|
||||
return -EINVAL; \
|
||||
\
|
||||
reg = lm3533_ctrlbank_get_reg(cb, LM3533_REG_##_NAME##_BASE); \
|
||||
ret = lm3533_write(cb->lm3533, reg, val); \
|
||||
if (ret) \
|
||||
dev_err(cb->dev, "failed to set " #_name "\n"); \
|
||||
\
|
||||
return ret; \
|
||||
} \
|
||||
EXPORT_SYMBOL_GPL(lm3533_ctrlbank_set_##_name);
|
||||
|
||||
#define lm3533_ctrlbank_get(_name, _NAME) \
|
||||
int lm3533_ctrlbank_get_##_name(struct lm3533_ctrlbank *cb, u8 *val) \
|
||||
{ \
|
||||
u8 reg; \
|
||||
int ret; \
|
||||
\
|
||||
reg = lm3533_ctrlbank_get_reg(cb, LM3533_REG_##_NAME##_BASE); \
|
||||
ret = lm3533_read(cb->lm3533, reg, val); \
|
||||
if (ret) \
|
||||
dev_err(cb->dev, "failed to get " #_name "\n"); \
|
||||
\
|
||||
return ret; \
|
||||
} \
|
||||
EXPORT_SYMBOL_GPL(lm3533_ctrlbank_get_##_name);
|
||||
|
||||
lm3533_ctrlbank_set(brightness, BRIGHTNESS);
|
||||
lm3533_ctrlbank_get(brightness, BRIGHTNESS);
|
||||
|
||||
/*
|
||||
* PWM-input control mask:
|
||||
*
|
||||
* bit 5 - PWM-input enabled in Zone 4
|
||||
* bit 4 - PWM-input enabled in Zone 3
|
||||
* bit 3 - PWM-input enabled in Zone 2
|
||||
* bit 2 - PWM-input enabled in Zone 1
|
||||
* bit 1 - PWM-input enabled in Zone 0
|
||||
* bit 0 - PWM-input enabled
|
||||
*/
|
||||
lm3533_ctrlbank_set(pwm, PWM);
|
||||
lm3533_ctrlbank_get(pwm, PWM);
|
||||
|
||||
|
||||
MODULE_AUTHOR("Johan Hovold <jhovold@gmail.com>");
|
||||
MODULE_DESCRIPTION("LM3533 Control Bank interface");
|
||||
MODULE_LICENSE("GPL");
|
||||
File diff suppressed because it is too large
Load Diff
+11
-15
@@ -36,6 +36,7 @@
|
||||
|
||||
#define GPIOBASE 0x44
|
||||
#define GPIO_IO_SIZE 64
|
||||
#define GPIO_IO_SIZE_CENTERTON 128
|
||||
|
||||
#define WDTBASE 0x84
|
||||
#define WDT_IO_SIZE 64
|
||||
@@ -68,7 +69,7 @@ static struct resource wdt_sch_resource = {
|
||||
|
||||
static struct mfd_cell tunnelcreek_cells[] = {
|
||||
{
|
||||
.name = "tunnelcreek_wdt",
|
||||
.name = "ie6xx_wdt",
|
||||
.num_resources = 1,
|
||||
.resources = &wdt_sch_resource,
|
||||
},
|
||||
@@ -77,6 +78,7 @@ static struct mfd_cell tunnelcreek_cells[] = {
|
||||
static DEFINE_PCI_DEVICE_TABLE(lpc_sch_ids) = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SCH_LPC) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ITC_LPC) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CENTERTON_ILB) },
|
||||
{ 0, }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, lpc_sch_ids);
|
||||
@@ -115,7 +117,11 @@ static int __devinit lpc_sch_probe(struct pci_dev *dev,
|
||||
}
|
||||
|
||||
gpio_sch_resource.start = base_addr;
|
||||
gpio_sch_resource.end = base_addr + GPIO_IO_SIZE - 1;
|
||||
|
||||
if (id->device == PCI_DEVICE_ID_INTEL_CENTERTON_ILB)
|
||||
gpio_sch_resource.end = base_addr + GPIO_IO_SIZE_CENTERTON - 1;
|
||||
else
|
||||
gpio_sch_resource.end = base_addr + GPIO_IO_SIZE - 1;
|
||||
|
||||
for (i=0; i < ARRAY_SIZE(lpc_sch_cells); i++)
|
||||
lpc_sch_cells[i].id = id->device;
|
||||
@@ -125,7 +131,8 @@ static int __devinit lpc_sch_probe(struct pci_dev *dev,
|
||||
if (ret)
|
||||
goto out_dev;
|
||||
|
||||
if (id->device == PCI_DEVICE_ID_INTEL_ITC_LPC) {
|
||||
if (id->device == PCI_DEVICE_ID_INTEL_ITC_LPC
|
||||
|| id->device == PCI_DEVICE_ID_INTEL_CENTERTON_ILB) {
|
||||
pci_read_config_dword(dev, WDTBASE, &base_addr_cfg);
|
||||
if (!(base_addr_cfg & (1 << 31))) {
|
||||
dev_err(&dev->dev, "Decode of the WDT I/O range disabled\n");
|
||||
@@ -167,18 +174,7 @@ static struct pci_driver lpc_sch_driver = {
|
||||
.remove = __devexit_p(lpc_sch_remove),
|
||||
};
|
||||
|
||||
static int __init lpc_sch_init(void)
|
||||
{
|
||||
return pci_register_driver(&lpc_sch_driver);
|
||||
}
|
||||
|
||||
static void __exit lpc_sch_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&lpc_sch_driver);
|
||||
}
|
||||
|
||||
module_init(lpc_sch_init);
|
||||
module_exit(lpc_sch_exit);
|
||||
module_pci_driver(lpc_sch_driver);
|
||||
|
||||
MODULE_AUTHOR("Denis Turischev <denis@compulab.co.il>");
|
||||
MODULE_DESCRIPTION("LPC interface for Intel Poulsbo SCH");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user