Commit 12e7b0a6 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'mfd-for-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "New Drivers:
   - Freescale Touch Screen ADC
   - X-Powers AXP PMIC with RSB
   - TI TPS65086 Power Management IC (PMIC)

  New Device Support:
   - Supply device PCI IDs for Intel Broxton

  Fix-ups:
   - Move to clkdev_create() API; intel_quark_i2c_gpio
   - Complete re-write of TI's TPS65912 Power Management IC (PMIC)
   - Remove unnecessary function argument; axp20x
   - Separate out bus related code; axp20x
   - Coding Style changes; axp20x
   - Allow more drivers to be compiled as modules
   - Work around false positive 'used uninitialised' warning; db8500-prcmu

  Bug Fixes:
   - Remove do_div(); fsl-imx25-gcq
   - Fix driver init when built-in; tps65010
   - Fix clock-unregister leak; intel-lpss"

* tag 'mfd-for-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (53 commits)
  mfd: intel-lpss: Pass I2C configuration via properties on BXT
  mfd: imx6sx: Add PCIe register definitions for iomuxc gpr
  mfd: ipaq-micro: Use __maybe_unused to hide pm functions
  mfd: max77686: Add max77802 to I2C device ID table
  mfd: max77686: Export OF module alias information
  mfd: max77686: Allow driver to be built as a module
  mfd: stmpe: Add the proper PWM resources
  mfd: tps65090: Set regmap config reg counts properly
  mfd: syscon: Return ENOTSUPP instead of ENOSYS when disabled
  mfd: as3711: Set regmap config reg counts properly
  mfd: rc5t583: Set regmap config reg counts properly
  gpio: tps65086: Add GPO driver for the TPS65086 PMIC
  mfd: mt6397: Add platform device ID table
  mfd: da9063: Fix missing volatile registers in the core regmap_range volatile lists
  mfd: mt6397: Add MT6323 support to MT6397 driver
  mfd: mt6397: Add support for different Slave types
  mfd: mt6397: int_con and int_status may vary in location
  dt-bindings: mfd: Add bindings for the MediaTek MT6323 PMIC
  mfd: da9062: Fix missing volatile registers in the core regmap_range volatile lists
  mfd: Add documentation for ACT8945A DT bindings
  ...
parents 021f163d 0343b2f4
Freescale i.MX25 ADC GCQ device
This is a generic conversion queue device that can convert any of the
analog inputs using the ADC unit of the i.MX25.
Required properties:
- compatible: Should be "fsl,imx25-gcq".
- reg: Should be the register range of the module.
- interrupts: Should be the interrupt number of the module.
Typically this is <1>.
- interrupt-parent: phandle to the tsadc module of the i.MX25.
- #address-cells: Should be <1> (setting for the subnodes)
- #size-cells: Should be <0> (setting for the subnodes)
Optional properties:
- vref-ext-supply: The regulator supplying the ADC reference voltage.
Required when at least one subnode uses the this reference.
- vref-xp-supply: The regulator supplying the ADC reference voltage on pin XP.
Required when at least one subnode uses this reference.
- vref-yp-supply: The regulator supplying the ADC reference voltage on pin YP.
Required when at least one subnode uses this reference.
Sub-nodes:
Optionally you can define subnodes which define the reference voltage
for the analog inputs.
Required properties for subnodes:
- reg: Should be the number of the analog input.
0: xp
1: yp
2: xn
3: yn
4: wiper
5: inaux0
6: inaux1
7: inaux2
Optional properties for subnodes:
- fsl,adc-refp: specifies the positive reference input as defined in
<dt-bindings/iio/adc/fsl-imx25-gcq.h>
- fsl,adc-refn: specifies the negative reference input as defined in
<dt-bindings/iio/adc/fsl-imx25-gcq.h>
Example:
adc: adc@50030800 {
compatible = "fsl,imx25-gcq";
reg = <0x50030800 0x60>;
interrupt-parent = <&tscadc>;
interrupts = <1>;
#address-cells = <1>;
#size-cells = <0>;
inaux@5 {
reg = <5>;
fsl,adc-refp = <MX25_ADC_REFP_INT>;
fsl,adc-refn = <MX25_ADC_REFN_NGND>;
};
};
Freescale mx25 TS conversion queue module
mx25 touchscreen conversion queue module which controls the ADC unit of the
mx25 for attached touchscreens.
Required properties:
- compatible: Should be "fsl,imx25-tcq".
- reg: Memory range of the device.
- interrupts: Should be the interrupt number associated with this module within
the tscadc unit (<0>).
- interrupt-parent: Should be a phandle to the tscadc unit.
- fsl,wires: Should be '<4>' or '<5>'
Optional properties:
- fsl,pen-debounce-ns: Pen debounce time in nanoseconds.
- fsl,pen-threshold: Pen-down threshold for the touchscreen. This is a value
between 1 and 4096. It is the ratio between the internal reference voltage
and the measured voltage after the plate was precharged. Resistence between
plates and therefore the voltage decreases with pressure so that a smaller
value is equivalent to a higher pressure.
- fsl,settling-time-ns: Settling time in nanoseconds. The settling time is before
the actual touch detection to wait for an even charge distribution in the
plate.
This device includes two conversion queues which can be added as subnodes.
The first queue is for the touchscreen, the second for general purpose ADC.
Example:
tsc: tcq@50030400 {
compatible = "fsl,imx25-tcq";
reg = <0x50030400 0x60>;
interrupt-parent = <&tscadc>;
interrupts = <0>;
fsl,wires = <4>;
};
Device-Tree bindings for Active-semi ACT8945A MFD driver
Required properties:
- compatible: "active-semi,act8945a".
- reg: the I2C slave address for the ACT8945A chip
The chip exposes two subdevices:
- a regulators: see ../regulator/act8945a-regulator.txt
- a charger: see ../power/act8945a-charger.txt
Example:
pmic@5b {
compatible = "active-semi,act8945a";
reg = <0x5b>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_charger_chglev>;
active-semi,chglev-gpio = <&pioA 12 GPIO_ACTIVE_HIGH>;
active-semi,input-voltage-threshold-microvolt = <6600>;
active-semi,precondition-timeout = <40>;
active-semi,total-timeout = <3>;
active-semi,vsel-high;
regulators {
vdd_1v35_reg: REG_DCDC1 {
regulator-name = "VDD_1V35";
regulator-min-microvolt = <1350000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
};
vdd_1v2_reg: REG_DCDC2 {
regulator-name = "VDD_1V2";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1300000>;
regulator-always-on;
};
vdd_3v3_reg: REG_DCDC3 {
regulator-name = "VDD_3V3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
vdd_fuse_reg: REG_LDO1 {
regulator-name = "VDD_FUSE";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
regulator-always-on;
};
vdd_3v3_lp_reg: REG_LDO2 {
regulator-name = "VDD_3V3_LP";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
vdd_led_reg: REG_LDO3 {
regulator-name = "VDD_LED";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
vdd_sdhc_1v8_reg: REG_LDO4 {
regulator-name = "VDD_SDHC_1V8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
};
};
...@@ -5,11 +5,12 @@ axp152 (X-Powers) ...@@ -5,11 +5,12 @@ axp152 (X-Powers)
axp202 (X-Powers) axp202 (X-Powers)
axp209 (X-Powers) axp209 (X-Powers)
axp221 (X-Powers) axp221 (X-Powers)
axp223 (X-Powers)
Required properties: Required properties:
- compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209", - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
"x-powers,axp221" "x-powers,axp221", "x-powers,axp223"
- reg: The I2C slave address for the AXP chip - reg: The I2C slave address or RSB hardware address for the AXP chip
- interrupt-parent: The parent interrupt controller - interrupt-parent: The parent interrupt controller
- interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
- interrupt-controller: The PMIC has its own internal IRQs - interrupt-controller: The PMIC has its own internal IRQs
...@@ -51,7 +52,7 @@ LDO3 : LDO : ldo3in-supply ...@@ -51,7 +52,7 @@ LDO3 : LDO : ldo3in-supply
LDO4 : LDO : ldo24in-supply : shared supply LDO4 : LDO : ldo24in-supply : shared supply
LDO5 : LDO : ldo5in-supply LDO5 : LDO : ldo5in-supply
AXP221 regulators, type, and corresponding input supply names: AXP221/AXP223 regulators, type, and corresponding input supply names:
Regulator Type Supply Name Notes Regulator Type Supply Name Notes
--------- ---- ----------- ----- --------- ---- ----------- -----
......
Freescale MX25 ADC/TSC MultiFunction Device (MFD)
This device combines two general purpose conversion queues one used for general
ADC and the other used for touchscreens.
Required properties:
- compatible: Should be "fsl,imx25-tsadc".
- reg: Start address and size of the memory area of
the device
- interrupts: Interrupt for this device
(See: ../interrupt-controller/interrupts.txt)
- clocks: An 'ipg' clock (See: ../clock/clock-bindings.txt)
- interrupt-controller: This device is an interrupt controller. It
controls the interrupts of both
conversion queues.
- #interrupt-cells: Should be '<1>'.
- #address-cells: Should be '<1>'.
- #size-cells: Should be '<1>'.
This device includes two conversion queues which can be added as subnodes.
The first queue is for the touchscreen, the second for general purpose ADC.
Example:
tscadc: tscadc@50030000 {
compatible = "fsl,imx25-tsadc";
reg = <0x50030000 0xc>;
interrupts = <46>;
clocks = <&clks 119>;
clock-names = "ipg";
interrupt-controller;
#interrupt-cells = <1>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
tsc: tcq@50030400 {
compatible = "fsl,imx25-tcq";
reg = <0x50030400 0x60>;
...
};
adc: gcq@50030800 {
compatible = "fsl,imx25-gcq";
reg = <0x50030800 0x60>;
...
};
};
MediaTek MT6397 Multifunction Device Driver MediaTek MT6397/MT6323 Multifunction Device Driver
MT6397 is a multifunction device with the following sub modules: MT6397/MT6323 is a multifunction device with the following sub modules:
- Regulator - Regulator
- RTC - RTC
- Audio codec - Audio codec
...@@ -8,14 +8,14 @@ MT6397 is a multifunction device with the following sub modules: ...@@ -8,14 +8,14 @@ MT6397 is a multifunction device with the following sub modules:
- Clock - Clock
It is interfaced to host controller using SPI interface by a proprietary hardware It is interfaced to host controller using SPI interface by a proprietary hardware
called PMIC wrapper or pwrap. MT6397 MFD is a child device of pwrap. called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap.
See the following for pwarp node definitions: See the following for pwarp node definitions:
Documentation/devicetree/bindings/soc/pwrap.txt Documentation/devicetree/bindings/soc/pwrap.txt
This document describes the binding for MFD device and its sub module. This document describes the binding for MFD device and its sub module.
Required properties: Required properties:
compatible: "mediatek,mt6397" compatible: "mediatek,mt6397" or "mediatek,mt6323"
Optional subnodes: Optional subnodes:
...@@ -26,6 +26,8 @@ Optional subnodes: ...@@ -26,6 +26,8 @@ Optional subnodes:
Required properties: Required properties:
- compatible: "mediatek,mt6397-regulator" - compatible: "mediatek,mt6397-regulator"
see Documentation/devicetree/bindings/regulator/mt6397-regulator.txt see Documentation/devicetree/bindings/regulator/mt6397-regulator.txt
- compatible: "mediatek,mt6323-regulator"
see Documentation/devicetree/bindings/regulator/mt6323-regulator.txt
- codec - codec
Required properties: Required properties:
- compatible: "mediatek,mt6397-codec" - compatible: "mediatek,mt6397-codec"
......
* TPS65086 Power Management Integrated Circuit (PMIC) bindings
Required properties:
- compatible : Should be "ti,tps65086".
- reg : I2C slave address.
- interrupt-parent : Phandle to the parent interrupt controller.
- interrupts : The interrupt line the device is connected to.
- interrupt-controller : Marks the device node as an interrupt controller.
- #interrupt-cells : The number of cells to describe an IRQ, should be 2.
The first cell is the IRQ number.
The second cell is the flags, encoded as trigger
masks from ../interrupt-controller/interrupts.txt.
- gpio-controller : Marks the device node as a GPIO Controller.
- #gpio-cells : Should be two. The first cell is the pin number and
the second cell is used to specify flags.
See ../gpio/gpio.txt for more information.
- regulators: : List of child nodes that specify the regulator
initialization data. Child nodes must be named
after their hardware counterparts: buck[1-6],
ldoa[1-3], swa1, swb[1-2], and vtt. Each child
node is defined using the standard binding for
regulators and the optional regulator properties
defined below.
Optional regulator properties:
- ti,regulator-step-size-25mv : This is applicable for buck[1,2,6], set this
if the regulator is factory set with a 25mv
step voltage mapping.
- ti,regulator-decay : This is applicable for buck[1-6], set this if
the output needs to decay, default is for
the output to slew down.
Example:
pmic: tps65086@5e {
compatible = "ti,tps65086";
reg = <0x5e>;
interrupt-parent = <&gpio1>;
interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
interrupt-controller;
#interrupt-cells = <2>;
gpio-controller;
#gpio-cells = <2>;
regulators {
buck1 {
regulator-name = "vcc1";
regulator-min-microvolt = <1600000>;
regulator-max-microvolt = <1600000>;
regulator-boot-on;
ti,regulator-decay;
ti,regulator-step-size-25mv;
};
};
};
...@@ -898,6 +898,12 @@ config GPIO_TIMBERDALE ...@@ -898,6 +898,12 @@ config GPIO_TIMBERDALE
---help--- ---help---
Add support for the GPIO IP in the timberdale FPGA. Add support for the GPIO IP in the timberdale FPGA.
config GPIO_TPS65086
tristate "TI TPS65086 GPO"
depends on MFD_TPS65086
help
This driver supports the GPO on TI TPS65086x PMICs.
config GPIO_TPS65218 config GPIO_TPS65218
tristate "TPS65218 GPIO" tristate "TPS65218 GPIO"
depends on MFD_TPS65218 depends on MFD_TPS65218
......
...@@ -99,6 +99,7 @@ obj-$(CONFIG_ARCH_TEGRA) += gpio-tegra.o ...@@ -99,6 +99,7 @@ obj-$(CONFIG_ARCH_TEGRA) += gpio-tegra.o
obj-$(CONFIG_GPIO_TIMBERDALE) += gpio-timberdale.o obj-$(CONFIG_GPIO_TIMBERDALE) += gpio-timberdale.o
obj-$(CONFIG_GPIO_PALMAS) += gpio-palmas.o obj-$(CONFIG_GPIO_PALMAS) += gpio-palmas.o
obj-$(CONFIG_GPIO_TPIC2810) += gpio-tpic2810.o obj-$(CONFIG_GPIO_TPIC2810) += gpio-tpic2810.o
obj-$(CONFIG_GPIO_TPS65086) += gpio-tps65086.o
obj-$(CONFIG_GPIO_TPS65218) += gpio-tps65218.o obj-$(CONFIG_GPIO_TPS65218) += gpio-tps65218.o
obj-$(CONFIG_GPIO_TPS6586X) += gpio-tps6586x.o obj-$(CONFIG_GPIO_TPS6586X) += gpio-tps6586x.o
obj-$(CONFIG_GPIO_TPS65910) += gpio-tps65910.o obj-$(CONFIG_GPIO_TPS65910) += gpio-tps65910.o
......
/*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
* Andrew F. Davis <afd@ti.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.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether expressed or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License version 2 for more details.
*
* Based on the TPS65912 driver
*/
#include <linux/gpio.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/mfd/tps65086.h>
struct tps65086_gpio {
struct gpio_chip chip;
struct tps65086 *tps;
};
static int tps65086_gpio_get_direction(struct gpio_chip *chip,
unsigned offset)
{
/* This device is output only */
return 0;
}
static int tps65086_gpio_direction_input(struct gpio_chip *chip,
unsigned offset)
{
/* This device is output only */
return -EINVAL;
}
static int tps65086_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
struct tps65086_gpio *gpio = gpiochip_get_data(chip);
/* Set the initial value */
regmap_update_bits(gpio->tps->regmap, TPS65086_GPOCTRL,
BIT(4 + offset), value ? BIT(4 + offset) : 0);
return 0;
}
static int tps65086_gpio_get(struct gpio_chip *chip, unsigned offset)
{
struct tps65086_gpio *gpio = gpiochip_get_data(chip);
int ret, val;
ret = regmap_read(gpio->tps->regmap, TPS65086_GPOCTRL, &val);
if (ret < 0)
return ret;
return val & BIT(4 + offset);
}
static void tps65086_gpio_set(struct gpio_chip *chip, unsigned offset,
int value)
{
struct tps65086_gpio *gpio = gpiochip_get_data(chip);
regmap_update_bits(gpio->tps->regmap, TPS65086_GPOCTRL,
BIT(4 + offset), value ? BIT(4 + offset) : 0);
}
static struct gpio_chip template_chip = {
.label = "tps65086-gpio",
.owner = THIS_MODULE,
.get_direction = tps65086_gpio_get_direction,
.direction_input = tps65086_gpio_direction_input,
.direction_output = tps65086_gpio_direction_output,
.get = tps65086_gpio_get,
.set = tps65086_gpio_set,
.base = -1,
.ngpio = 4,
.can_sleep = true,
};
static int tps65086_gpio_probe(struct platform_device *pdev)
{
struct tps65086_gpio *gpio;
int ret;
gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
if (!gpio)
return -ENOMEM;
platform_set_drvdata(pdev, gpio);
gpio->tps = dev_get_drvdata(pdev->dev.parent);
gpio->chip = template_chip;
gpio->chip.parent = gpio->tps->dev;
ret = gpiochip_add_data(&gpio->chip, gpio);
if (ret < 0) {
dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
return ret;
}
return 0;
}
static int tps65086_gpio_remove(struct platform_device *pdev)
{
struct tps65086_gpio *gpio = platform_get_drvdata(pdev);
gpiochip_remove(&gpio->chip);
return 0;
}
static const struct platform_device_id tps65086_gpio_id_table[] = {
{ "tps65086-gpio", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, tps65086_gpio_id_table);
static struct platform_driver tps65086_gpio_driver = {
.driver = {
.name = "tps65086-gpio",
},
.probe = tps65086_gpio_probe,
.remove = tps65086_gpio_remove,
.id_table = tps65086_gpio_id_table,
};
module_platform_driver(tps65086_gpio_driver);
MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
MODULE_DESCRIPTION("TPS65086 GPIO driver");
MODULE_LICENSE("GPL v2");
...@@ -194,6 +194,13 @@ config EXYNOS_ADC ...@@ -194,6 +194,13 @@ config EXYNOS_ADC
To compile this driver as a module, choose M here: the module will be To compile this driver as a module, choose M here: the module will be
called exynos_adc. called exynos_adc.
config FSL_MX25_ADC
tristate "Freescale MX25 ADC driver"
depends on MFD_MX25_TSADC
help
Generic Conversion Queue driver used for general purpose ADC in the
MX25. This driver supports single measurements using the MX25 ADC.
config HI8435 config HI8435
tristate "Holt Integrated Circuits HI-8435 threshold detector" tristate "Holt Integrated Circuits HI-8435 threshold detector"
select IIO_TRIGGERED_EVENT select IIO_TRIGGERED_EVENT
......
...@@ -20,6 +20,7 @@ obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o ...@@ -20,6 +20,7 @@ obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o
obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o
obj-$(CONFIG_DA9150_GPADC) += da9150-gpadc.o obj-$(CONFIG_DA9150_GPADC) += da9150-gpadc.o
obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o
obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o
obj-$(CONFIG_HI8435) += hi8435.o obj-$(CONFIG_HI8435) += hi8435.o
obj-$(CONFIG_IMX7D_ADC) += imx7d_adc.o obj-$(CONFIG_IMX7D_ADC) += imx7d_adc.o
obj-$(CONFIG_INA2XX_ADC) += ina2xx-adc.o obj-$(CONFIG_INA2XX_ADC) += ina2xx-adc.o
......
This diff is collapsed.
...@@ -833,6 +833,15 @@ config TOUCHSCREEN_USB_COMPOSITE ...@@ -833,6 +833,15 @@ config TOUCHSCREEN_USB_COMPOSITE
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called usbtouchscreen. module will be called usbtouchscreen.
config TOUCHSCREEN_MX25
tristate "Freescale i.MX25 touchscreen input driver"
depends on MFD_MX25_TSADC
help
Enable support for touchscreen connected to your i.MX25.
To compile this driver as a module, choose M here: the
module will be called fsl-imx25-tcq.
config TOUCHSCREEN_MC13783 config TOUCHSCREEN_MC13783
tristate "Freescale MC13783 touchscreen input driver" tristate "Freescale MC13783 touchscreen input driver"
depends on MFD_MC13XXX depends on MFD_MC13XXX
......
...@@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o ...@@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o
obj-$(CONFIG_TOUCHSCREEN_IPROC) += bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_IPROC) += bcm_iproc_tsc.o
obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o
obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o
obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o
obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o
obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o
obj-$(CONFIG_TOUCHSCREEN_MELFAS_MIP4) += melfas_mip4.o obj-$(CONFIG_TOUCHSCREEN_MELFAS_MIP4) += melfas_mip4.o
......
This diff is collapsed.
...@@ -18,6 +18,17 @@ config MFD_CS5535 ...@@ -18,6 +18,17 @@ config MFD_CS5535
This is the core driver for CS5535/CS5536 MFD functions. This is This is the core driver for CS5535/CS5536 MFD functions. This is
necessary for using the board's GPIO and MFGPT functionality. necessary for using the board's GPIO and MFGPT functionality.
config MFD_ACT8945A
tristate "Active-semi ACT8945A"
select MFD_CORE
select REGMAP_I2C
depends on I2C && OF
help
Support for the ACT8945A PMIC from Active-semi. This device
features three step-down DC/DC converters and four low-dropout
linear regulators, along with a complete ActivePath battery
charger.
config MFD_AS3711 config MFD_AS3711
bool "AMS AS3711" bool "AMS AS3711"
select MFD_CORE select MFD_CORE
...@@ -91,14 +102,29 @@ config MFD_BCM590XX ...@@ -91,14 +102,29 @@ config MFD_BCM590XX
Support for the BCM590xx PMUs from Broadcom Support for the BCM590xx PMUs from Broadcom
config MFD_AXP20X config MFD_AXP20X
bool "X-Powers AXP20X" tristate
select MFD_CORE select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ select REGMAP_IRQ
depends on I2C=y
config MFD_AXP20X_I2C
tristate "X-Powers AXP series PMICs with I2C"
select MFD_AXP20X
select REGMAP_I2C
depends on I2C
help
If you say Y here you get support for the X-Powers AXP series power
management ICs (PMICs) controlled with I2C.
This driver include only the core APIs. You have to select individual
components like regulators or the PEK (Power Enable Key) under the
corresponding menus.
config MFD_AXP20X_RSB
tristate "X-Powers AXP series PMICs with RSB"
select MFD_AXP20X
depends on SUNXI_RSB
help help
If you say Y here you get support for the X-Powers AXP202, AXP209 and If you say Y here you get support for the X-Powers AXP series power
AXP288 power management IC (PMIC). management ICs (PMICs) controlled with RSB.
This driver include only the core APIs. You have to select individual This driver include only the core APIs. You have to select individual
components like regulators or the PEK (Power Enable Key) under the components like regulators or the PEK (Power Enable Key) under the
corresponding menus. corresponding menus.
...@@ -203,7 +229,7 @@ config MFD_DA9062 ...@@ -203,7 +229,7 @@ config MFD_DA9062
select MFD_CORE select MFD_CORE
select REGMAP_I2C select REGMAP_I2C
select REGMAP_IRQ select REGMAP_IRQ
depends on I2C=y depends on I2C
help help
Say yes here for support for the Dialog Semiconductor DA9062 PMIC. Say yes here for support for the Dialog Semiconductor DA9062 PMIC.
This includes the I2C driver and core APIs. This includes the I2C driver and core APIs.
...@@ -215,7 +241,7 @@ config MFD_DA9063 ...@@ -215,7 +241,7 @@ config MFD_DA9063
select MFD_CORE select MFD_CORE
select REGMAP_I2C select REGMAP_I2C
select REGMAP_IRQ select REGMAP_IRQ
depends on I2C=y depends on I2C
help help
Say yes here for support for the Dialog Semiconductor DA9063 PMIC. Say yes here for support for the Dialog Semiconductor DA9063 PMIC.
This includes the I2C driver and core APIs. This includes the I2C driver and core APIs.
...@@ -224,7 +250,7 @@ config MFD_DA9063 ...@@ -224,7 +250,7 @@ config MFD_DA9063
config MFD_DA9150 config MFD_DA9150
tristate "Dialog Semiconductor DA9150 Charger Fuel-Gauge chip" tristate "Dialog Semiconductor DA9150 Charger Fuel-Gauge chip"
depends on I2C=y depends on I2C
select MFD_CORE select MFD_CORE
select REGMAP_I2C select REGMAP_I2C
select REGMAP_IRQ select REGMAP_IRQ
...@@ -271,6 +297,15 @@ config MFD_MC13XXX_I2C ...@@ -271,6 +297,15 @@ config MFD_MC13XXX_I2C
help help
Select this if your MC13xxx is connected via an I2C bus. Select this if your MC13xxx is connected via an I2C bus.
config MFD_MX25_TSADC
tristate "Freescale i.MX25 integrated Touchscreen and ADC unit"
select REGMAP_MMIO
depends on (SOC_IMX25 && OF) || COMPILE_TEST
help
Enable support for the integrated Touchscreen and ADC unit of the
i.MX25 processors. They consist of a conversion queue for general
purpose ADC and a queue for Touchscreens.
config MFD_HI6421_PMIC config MFD_HI6421_PMIC
tristate "HiSilicon Hi6421 PMU/Codec IC" tristate "HiSilicon Hi6421 PMU/Codec IC"
depends on OF depends on OF
...@@ -445,7 +480,7 @@ config MFD_KEMPLD ...@@ -445,7 +480,7 @@ config MFD_KEMPLD
config MFD_88PM800 config MFD_88PM800
tristate "Marvell 88PM800" tristate "Marvell 88PM800"
depends on I2C=y depends on I2C
select REGMAP_I2C select REGMAP_I2C
select REGMAP_IRQ select REGMAP_IRQ
select MFD_CORE select MFD_CORE
...@@ -457,7 +492,7 @@ config MFD_88PM800 ...@@ -457,7 +492,7 @@ config MFD_88PM800
config MFD_88PM805 config MFD_88PM805
tristate "Marvell 88PM805" tristate "Marvell 88PM805"
depends on I2C=y depends on I2C
select REGMAP_I2C select REGMAP_I2C
select REGMAP_IRQ select REGMAP_IRQ
select MFD_CORE select MFD_CORE
...@@ -493,8 +528,8 @@ config MFD_MAX14577 ...@@ -493,8 +528,8 @@ config MFD_MAX14577
of the device. of the device.
config MFD_MAX77686 config MFD_MAX77686
bool "Maxim Semiconductor MAX77686/802 PMIC Support" tristate "Maxim Semiconductor MAX77686/802 PMIC Support"
depends on I2C=y depends on I2C
depends on OF depends on OF
select MFD_CORE select MFD_CORE
select REGMAP_I2C select REGMAP_I2C
...@@ -538,7 +573,7 @@ config MFD_MAX77843 ...@@ -538,7 +573,7 @@ config MFD_MAX77843
config MFD_MAX8907 config MFD_MAX8907
tristate "Maxim Semiconductor MAX8907 PMIC Support" tristate "Maxim Semiconductor MAX8907 PMIC Support"
select MFD_CORE select MFD_CORE
depends on I2C=y depends on I2C
select REGMAP_I2C select REGMAP_I2C
select REGMAP_IRQ select REGMAP_IRQ
help help
...@@ -743,7 +778,7 @@ config MFD_RTSX_PCI ...@@ -743,7 +778,7 @@ config MFD_RTSX_PCI
config MFD_RT5033 config MFD_RT5033
tristate "Richtek RT5033 Power Management IC" tristate "Richtek RT5033 Power Management IC"
depends on I2C=y depends on I2C
select MFD_CORE select MFD_CORE
select REGMAP_I2C select REGMAP_I2C
select REGMAP_IRQ select REGMAP_IRQ
...@@ -1106,6 +1141,19 @@ config TPS6507X ...@@ -1106,6 +1141,19 @@ config TPS6507X
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called tps6507x. will be called tps6507x.
config MFD_TPS65086
tristate "TI TPS65086 Power Management Integrated Chips (PMICs)"
select REGMAP
select REGMAP_IRQ
select REGMAP_I2C
depends on I2C
help
If you say yes here you get support for the TPS65086 series of
Power Management chips.
This driver provides common support for accessing the device,
additional drivers must be enabled in order to use the
functionality of the device.
config TPS65911_COMPARATOR config TPS65911_COMPARATOR
tristate tristate
...@@ -1370,7 +1418,6 @@ config MFD_ARIZONA ...@@ -1370,7 +1418,6 @@ config MFD_ARIZONA
config MFD_ARIZONA_I2C config MFD_ARIZONA_I2C
tristate "Cirrus Logic/Wolfson Microelectronics Arizona platform with I2C" tristate "Cirrus Logic/Wolfson Microelectronics Arizona platform with I2C"
select MFD_ARIZONA select MFD_ARIZONA
select MFD_CORE
select REGMAP_I2C select REGMAP_I2C
depends on I2C depends on I2C
help help
...@@ -1380,12 +1427,11 @@ config MFD_ARIZONA_I2C ...@@ -1380,12 +1427,11 @@ config MFD_ARIZONA_I2C
config MFD_ARIZONA_SPI config MFD_ARIZONA_SPI
tristate "Cirrus Logic/Wolfson Microelectronics Arizona platform with SPI" tristate "Cirrus Logic/Wolfson Microelectronics Arizona platform with SPI"
select MFD_ARIZONA select MFD_ARIZONA
select MFD_CORE
select REGMAP_SPI select REGMAP_SPI
depends on SPI_MASTER depends on SPI_MASTER
help help
Support for the Cirrus Logic/Wolfson Microelectronics Arizona platform Support for the Cirrus Logic/Wolfson Microelectronics Arizona platform
audio SoC core functionality controlled via I2C. audio SoC core functionality controlled via SPI.
config MFD_CS47L24 config MFD_CS47L24
bool "Cirrus Logic CS47L24 and WM1831" bool "Cirrus Logic CS47L24 and WM1831"
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o
obj-$(CONFIG_MFD_88PM800) += 88pm800.o 88pm80x.o obj-$(CONFIG_MFD_88PM800) += 88pm800.o 88pm80x.o
obj-$(CONFIG_MFD_88PM805) += 88pm805.o 88pm80x.o obj-$(CONFIG_MFD_88PM805) += 88pm805.o 88pm80x.o
obj-$(CONFIG_MFD_ACT8945A) += act8945a.o
obj-$(CONFIG_MFD_SM501) += sm501.o obj-$(CONFIG_MFD_SM501) += sm501.o
obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o
...@@ -70,6 +71,7 @@ obj-$(CONFIG_MFD_WM8994) += wm8994.o ...@@ -70,6 +71,7 @@ obj-$(CONFIG_MFD_WM8994) += wm8994.o
obj-$(CONFIG_TPS6105X) += tps6105x.o obj-$(CONFIG_TPS6105X) += tps6105x.o
obj-$(CONFIG_TPS65010) += tps65010.o obj-$(CONFIG_TPS65010) += tps65010.o
obj-$(CONFIG_TPS6507X) += tps6507x.o obj-$(CONFIG_TPS6507X) += tps6507x.o
obj-$(CONFIG_MFD_TPS65086) += tps65086.o
obj-$(CONFIG_MFD_TPS65217) += tps65217.o obj-$(CONFIG_MFD_TPS65217) += tps65217.o
obj-$(CONFIG_MFD_TPS65218) += tps65218.o obj-$(CONFIG_MFD_TPS65218) += tps65218.o
obj-$(CONFIG_MFD_TPS65910) += tps65910.o obj-$(CONFIG_MFD_TPS65910) += tps65910.o
...@@ -84,6 +86,8 @@ obj-$(CONFIG_TWL4030_POWER) += twl4030-power.o ...@@ -84,6 +86,8 @@ obj-$(CONFIG_TWL4030_POWER) += twl4030-power.o
obj-$(CONFIG_MFD_TWL4030_AUDIO) += twl4030-audio.o obj-$(CONFIG_MFD_TWL4030_AUDIO) += twl4030-audio.o
obj-$(CONFIG_TWL6040_CORE) += twl6040.o obj-$(CONFIG_TWL6040_CORE) += twl6040.o
obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o
obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o
obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o
obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o
...@@ -110,6 +114,8 @@ obj-$(CONFIG_PMIC_DA9052) += da9052-core.o ...@@ -110,6 +114,8 @@ obj-$(CONFIG_PMIC_DA9052) += da9052-core.o
obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o
obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
obj-$(CONFIG_MFD_AXP20X) += axp20x.o obj-$(CONFIG_MFD_AXP20X) += axp20x.o
obj-$(CONFIG_MFD_AXP20X_I2C) += axp20x-i2c.o
obj-$(CONFIG_MFD_AXP20X_RSB) += axp20x-rsb.o
obj-$(CONFIG_MFD_LP3943) += lp3943.o obj-$(CONFIG_MFD_LP3943) += lp3943.o
obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o
......
/*
* MFD driver for Active-semi ACT8945a PMIC
*
* Copyright (C) 2015 Atmel Corporation.
*
* Author: Wenyou Yang <wenyou.yang@atmel.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/i2c.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/regmap.h>
static const struct mfd_cell act8945a_devs[] = {
{
.name = "act8945a-regulator",
},
{
.name = "act8945a-charger",
},
};
static const struct regmap_config act8945a_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
};
static int act8945a_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
int ret;
struct regmap *regmap;
regmap = devm_regmap_init_i2c(i2c, &act8945a_regmap_config);
if (IS_ERR(regmap)) {
ret = PTR_ERR(regmap);
dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
return ret;
}
i2c_set_clientdata(i2c, regmap);
ret = mfd_add_devices(&i2c->dev, PLATFORM_DEVID_NONE, act8945a_devs,
ARRAY_SIZE(act8945a_devs), NULL, 0, NULL);
if (ret) {
dev_err(&i2c->dev, "Failed to add sub devices\n");
return ret;
}
return 0;
}
static int act8945a_i2c_remove(struct i2c_client *i2c)
{
mfd_remove_devices(&i2c->dev);
return 0;
}
static const struct i2c_device_id act8945a_i2c_id[] = {
{ "act8945a", 0 },
{}
};
MODULE_DEVICE_TABLE(i2c, act8945a_i2c_id);
static const struct of_device_id act8945a_of_match[] = {
{ .compatible = "active-semi,act8945a", },
{},
};
MODULE_DEVICE_TABLE(of, act8945a_of_match);
static struct i2c_driver act8945a_i2c_driver = {
.driver = {
.name = "act8945a",
.of_match_table = of_match_ptr(act8945a_of_match),
},
.probe = act8945a_i2c_probe,
.remove = act8945a_i2c_remove,
.id_table = act8945a_i2c_id,
};
static int __init act8945a_i2c_init(void)
{
return i2c_add_driver(&act8945a_i2c_driver);
}
subsys_initcall(act8945a_i2c_init);
static void __exit act8945a_i2c_exit(void)
{
i2c_del_driver(&act8945a_i2c_driver);
}
module_exit(act8945a_i2c_exit);
MODULE_DESCRIPTION("ACT8945A PMIC multi-function driver");
MODULE_AUTHOR("Wenyou Yang <wenyou.yang@atmel.com>");
MODULE_LICENSE("GPL");
...@@ -108,8 +108,8 @@ static const struct regmap_config as3711_regmap_config = { ...@@ -108,8 +108,8 @@ static const struct regmap_config as3711_regmap_config = {
.volatile_reg = as3711_volatile_reg, .volatile_reg = as3711_volatile_reg,
.readable_reg = as3711_readable_reg, .readable_reg = as3711_readable_reg,
.precious_reg = as3711_precious_reg, .precious_reg = as3711_precious_reg,
.max_register = AS3711_MAX_REGS, .max_register = AS3711_MAX_REG,
.num_reg_defaults_raw = AS3711_MAX_REGS, .num_reg_defaults_raw = AS3711_NUM_REGS,
.cache_type = REGCACHE_RBTREE, .cache_type = REGCACHE_RBTREE,
}; };
......
/*
* I2C driver for the X-Powers' Power Management ICs
*
* AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
* converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
* as well as configurable GPIOs.
*
* This driver supports the I2C variants.
*
* Copyright (C) 2014 Carlo Caione
*
* Author: Carlo Caione <carlo@caione.org>
*
* 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/acpi.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/mfd/axp20x.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/slab.h>
static int axp20x_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct axp20x_dev *axp20x;
int ret;
axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
if (!axp20x)
return -ENOMEM;
axp20x->dev = &i2c->dev;
axp20x->irq = i2c->irq;
dev_set_drvdata(axp20x->dev, axp20x);
ret = axp20x_match_device(axp20x);
if (ret)
return ret;
axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg);
if (IS_ERR(axp20x->regmap)) {
ret = PTR_ERR(axp20x->regmap);
dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
return ret;
}
return axp20x_device_probe(axp20x);
}
static int axp20x_i2c_remove(struct i2c_client *i2c)
{
struct axp20x_dev *axp20x = i2c_get_clientdata(i2c);
return axp20x_device_remove(axp20x);
}
static const struct of_device_id axp20x_i2c_of_match[] = {
{ .compatible = "x-powers,axp152", .data = (void *)AXP152_ID },
{ .compatible = "x-powers,axp202", .data = (void *)AXP202_ID },
{ .compatible = "x-powers,axp209", .data = (void *)AXP209_ID },
{ .compatible = "x-powers,axp221", .data = (void *)AXP221_ID },
{ },
};
MODULE_DEVICE_TABLE(of, axp20x_i2c_of_match);
/*
* This is useless for OF-enabled devices, but it is needed by I2C subsystem
*/
static const struct i2c_device_id axp20x_i2c_id[] = {
{ },
};
MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id);
static const struct acpi_device_id axp20x_i2c_acpi_match[] = {
{
.id = "INT33F4",
.driver_data = AXP288_ID,
},
{ },
};
MODULE_DEVICE_TABLE(acpi, axp20x_i2c_acpi_match);
static struct i2c_driver axp20x_i2c_driver = {
.driver = {
.name = "axp20x-i2c",
.of_match_table = of_match_ptr(axp20x_i2c_of_match),
.acpi_match_table = ACPI_PTR(axp20x_i2c_acpi_match),
},
.probe = axp20x_i2c_probe,
.remove = axp20x_i2c_remove,
.id_table = axp20x_i2c_id,
};
module_i2c_driver(axp20x_i2c_driver);
MODULE_DESCRIPTION("PMIC MFD I2C driver for AXP20X");
MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
MODULE_LICENSE("GPL");
/*
* RSB driver for the X-Powers' Power Management ICs
*
* AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
* converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
* as well as configurable GPIOs.
*
* This driver supports the RSB variants.
*
* Copyright (C) 2015 Chen-Yu Tsai
*
* Author: Chen-Yu Tsai <wens@csie.org>
*
* 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/acpi.h>
#include <linux/err.h>
#include <linux/mfd/axp20x.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/sunxi-rsb.h>
static int axp20x_rsb_probe(struct sunxi_rsb_device *rdev)
{
struct axp20x_dev *axp20x;
int ret;
axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL);
if (!axp20x)
return -ENOMEM;
axp20x->dev = &rdev->dev;
axp20x->irq = rdev->irq;
dev_set_drvdata(&rdev->dev, axp20x);
ret = axp20x_match_device(axp20x);
if (ret)
return ret;
axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev, axp20x->regmap_cfg);
if (IS_ERR(axp20x->regmap)) {
ret = PTR_ERR(axp20x->regmap);
dev_err(&rdev->dev, "regmap init failed: %d\n", ret);
return ret;
}
return axp20x_device_probe(axp20x);
}
static int axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
{
struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
return axp20x_device_remove(axp20x);
}
static const struct of_device_id axp20x_rsb_of_match[] = {
{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
{ },
};
MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match);
static struct sunxi_rsb_driver axp20x_rsb_driver = {
.driver = {
.name = "axp20x-rsb",
.of_match_table = of_match_ptr(axp20x_rsb_of_match),
},
.probe = axp20x_rsb_probe,
.remove = axp20x_rsb_remove,
};
module_sunxi_rsb_driver(axp20x_rsb_driver);
MODULE_DESCRIPTION("PMIC MFD sunXi RSB driver for AXP20X");
MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>");
MODULE_LICENSE("GPL v2");
/* /*
* axp20x.c - MFD core driver for the X-Powers' Power Management ICs * MFD core driver for the X-Powers' Power Management ICs
* *
* AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
* converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
* as well as configurable GPIOs. * as well as configurable GPIOs.
* *
* This file contains the interface independent core functions.
*
* Copyright (C) 2014 Carlo Caione
*
* Author: Carlo Caione <carlo@caione.org> * Author: Carlo Caione <carlo@caione.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -13,18 +17,15 @@ ...@@ -13,18 +17,15 @@
*/ */
#include <linux/err.h> #include <linux/err.h>
#include <linux/i2c.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/mfd/axp20x.h> #include <linux/mfd/axp20x.h>
#include <linux/mfd/core.h> #include <linux/mfd/core.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_irq.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#define AXP20X_OFF 0x80 #define AXP20X_OFF 0x80
...@@ -34,6 +35,7 @@ static const char * const axp20x_model_names[] = { ...@@ -34,6 +35,7 @@ static const char * const axp20x_model_names[] = {
"AXP202", "AXP202",
"AXP209", "AXP209",
"AXP221", "AXP221",
"AXP223",
"AXP288", "AXP288",
}; };
...@@ -376,32 +378,6 @@ static const struct regmap_irq axp288_regmap_irqs[] = { ...@@ -376,32 +378,6 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG, 5, 1), INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG, 5, 1),
}; };
static const struct of_device_id axp20x_of_match[] = {
{ .compatible = "x-powers,axp152", .data = (void *) AXP152_ID },
{ .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
{ .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
{ .compatible = "x-powers,axp221", .data = (void *) AXP221_ID },
{ },
};
MODULE_DEVICE_TABLE(of, axp20x_of_match);
/*
* This is useless for OF-enabled devices, but it is needed by I2C subsystem
*/
static const struct i2c_device_id axp20x_i2c_id[] = {
{ },
};
MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id);
static const struct acpi_device_id axp20x_acpi_match[] = {
{
.id = "INT33F4",
.driver_data = AXP288_ID,
},
{ },
};
MODULE_DEVICE_TABLE(acpi, axp20x_acpi_match);
static const struct regmap_irq_chip axp152_regmap_irq_chip = { static const struct regmap_irq_chip axp152_regmap_irq_chip = {
.name = "axp152_irq_chip", .name = "axp152_irq_chip",
.status_base = AXP152_IRQ1_STATE, .status_base = AXP152_IRQ1_STATE,
...@@ -606,25 +582,26 @@ static void axp20x_power_off(void) ...@@ -606,25 +582,26 @@ static void axp20x_power_off(void)
AXP20X_OFF); AXP20X_OFF);
} }
static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev) int axp20x_match_device(struct axp20x_dev *axp20x)
{ {
struct device *dev = axp20x->dev;
const struct acpi_device_id *acpi_id; const struct acpi_device_id *acpi_id;
const struct of_device_id *of_id; const struct of_device_id *of_id;
if (dev->of_node) { if (dev->of_node) {
of_id = of_match_device(axp20x_of_match, dev); of_id = of_match_device(dev->driver->of_match_table, dev);
if (!of_id) { if (!of_id) {
dev_err(dev, "Unable to match OF ID\n"); dev_err(dev, "Unable to match OF ID\n");
return -ENODEV; return -ENODEV;
} }
axp20x->variant = (long) of_id->data; axp20x->variant = (long)of_id->data;
} else { } else {
acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev); acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!acpi_id || !acpi_id->driver_data) { if (!acpi_id || !acpi_id->driver_data) {
dev_err(dev, "Unable to match ACPI ID and data\n"); dev_err(dev, "Unable to match ACPI ID and data\n");
return -ENODEV; return -ENODEV;
} }
axp20x->variant = (long) acpi_id->driver_data; axp20x->variant = (long)acpi_id->driver_data;
} }
switch (axp20x->variant) { switch (axp20x->variant) {
...@@ -642,6 +619,7 @@ static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev) ...@@ -642,6 +619,7 @@ static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip; axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
break; break;
case AXP221_ID: case AXP221_ID:
case AXP223_ID:
axp20x->nr_cells = ARRAY_SIZE(axp22x_cells); axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
axp20x->cells = axp22x_cells; axp20x->cells = axp22x_cells;
axp20x->regmap_cfg = &axp22x_regmap_config; axp20x->regmap_cfg = &axp22x_regmap_config;
...@@ -658,51 +636,31 @@ static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev) ...@@ -658,51 +636,31 @@ static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
return -EINVAL; return -EINVAL;
} }
dev_info(dev, "AXP20x variant %s found\n", dev_info(dev, "AXP20x variant %s found\n",
axp20x_model_names[axp20x->variant]); axp20x_model_names[axp20x->variant]);
return 0; return 0;
} }
EXPORT_SYMBOL(axp20x_match_device);
static int axp20x_i2c_probe(struct i2c_client *i2c, int axp20x_device_probe(struct axp20x_dev *axp20x)
const struct i2c_device_id *id)
{ {
struct axp20x_dev *axp20x;
int ret; int ret;
axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL); ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq,
if (!axp20x)
return -ENOMEM;
ret = axp20x_match_device(axp20x, &i2c->dev);
if (ret)
return ret;
axp20x->i2c_client = i2c;
axp20x->dev = &i2c->dev;
dev_set_drvdata(axp20x->dev, axp20x);
axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg);
if (IS_ERR(axp20x->regmap)) {
ret = PTR_ERR(axp20x->regmap);
dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
return ret;
}
ret = regmap_add_irq_chip(axp20x->regmap, i2c->irq,
IRQF_ONESHOT | IRQF_SHARED, -1, IRQF_ONESHOT | IRQF_SHARED, -1,
axp20x->regmap_irq_chip, axp20x->regmap_irq_chip,
&axp20x->regmap_irqc); &axp20x->regmap_irqc);
if (ret) { if (ret) {
dev_err(&i2c->dev, "failed to add irq chip: %d\n", ret); dev_err(axp20x->dev, "failed to add irq chip: %d\n", ret);
return ret; return ret;
} }
ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells, ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells,
axp20x->nr_cells, NULL, 0, NULL); axp20x->nr_cells, NULL, 0, NULL);
if (ret) { if (ret) {
dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret); dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret);
regmap_del_irq_chip(i2c->irq, axp20x->regmap_irqc); regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
return ret; return ret;
} }
...@@ -711,38 +669,25 @@ static int axp20x_i2c_probe(struct i2c_client *i2c, ...@@ -711,38 +669,25 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
pm_power_off = axp20x_power_off; pm_power_off = axp20x_power_off;
} }
dev_info(&i2c->dev, "AXP20X driver loaded\n"); dev_info(axp20x->dev, "AXP20X driver loaded\n");
return 0; return 0;
} }
EXPORT_SYMBOL(axp20x_device_probe);
static int axp20x_i2c_remove(struct i2c_client *i2c) int axp20x_device_remove(struct axp20x_dev *axp20x)
{ {
struct axp20x_dev *axp20x = i2c_get_clientdata(i2c);
if (axp20x == axp20x_pm_power_off) { if (axp20x == axp20x_pm_power_off) {
axp20x_pm_power_off = NULL; axp20x_pm_power_off = NULL;
pm_power_off = NULL; pm_power_off = NULL;
} }
mfd_remove_devices(axp20x->dev); mfd_remove_devices(axp20x->dev);
regmap_del_irq_chip(axp20x->i2c_client->irq, axp20x->regmap_irqc); regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
return 0; return 0;
} }
EXPORT_SYMBOL(axp20x_device_remove);
static struct i2c_driver axp20x_i2c_driver = {
.driver = {
.name = "axp20x",
.of_match_table = of_match_ptr(axp20x_of_match),
.acpi_match_table = ACPI_PTR(axp20x_acpi_match),
},
.probe = axp20x_i2c_probe,
.remove = axp20x_i2c_remove,
.id_table = axp20x_i2c_id,
};
module_i2c_driver(axp20x_i2c_driver);
MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X"); MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
MODULE_AUTHOR("Carlo Caione <carlo@caione.org>"); MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
......
...@@ -227,8 +227,6 @@ static const struct reg_default cs47l24_reg_default[] = { ...@@ -227,8 +227,6 @@ static const struct reg_default cs47l24_reg_default[] = {
{ 0x00000174, 0x007D }, /* R372 - FLL1 Control 4 */ { 0x00000174, 0x007D }, /* R372 - FLL1 Control 4 */
{ 0x00000175, 0x0006 }, /* R373 - FLL1 Control 5 */ { 0x00000175, 0x0006 }, /* R373 - FLL1 Control 5 */
{ 0x00000176, 0x0000 }, /* R374 - FLL1 Control 6 */ { 0x00000176, 0x0000 }, /* R374 - FLL1 Control 6 */
{ 0x00000177, 0x0281 }, /* R375 - FLL1 Loop Filter Test 1 */
{ 0x00000178, 0x0000 }, /* R376 - FLL1 NCO Test 0 */
{ 0x00000179, 0x0000 }, /* R376 - FLL1 Control 7 */ { 0x00000179, 0x0000 }, /* R376 - FLL1 Control 7 */
{ 0x00000181, 0x0000 }, /* R385 - FLL1 Synchroniser 1 */ { 0x00000181, 0x0000 }, /* R385 - FLL1 Synchroniser 1 */
{ 0x00000182, 0x0000 }, /* R386 - FLL1 Synchroniser 2 */ { 0x00000182, 0x0000 }, /* R386 - FLL1 Synchroniser 2 */
...@@ -245,8 +243,6 @@ static const struct reg_default cs47l24_reg_default[] = { ...@@ -245,8 +243,6 @@ static const struct reg_default cs47l24_reg_default[] = {
{ 0x00000194, 0x007D }, /* R404 - FLL2 Control 4 */ { 0x00000194, 0x007D }, /* R404 - FLL2 Control 4 */
{ 0x00000195, 0x000C }, /* R405 - FLL2 Control 5 */ { 0x00000195, 0x000C }, /* R405 - FLL2 Control 5 */
{ 0x00000196, 0x0000 }, /* R406 - FLL2 Control 6 */ { 0x00000196, 0x0000 }, /* R406 - FLL2 Control 6 */
{ 0x00000197, 0x0000 }, /* R407 - FLL2 Loop Filter Test 1 */
{ 0x00000198, 0x0000 }, /* R408 - FLL2 NCO Test 0 */
{ 0x00000199, 0x0000 }, /* R408 - FLL2 Control 7 */ { 0x00000199, 0x0000 }, /* R408 - FLL2 Control 7 */
{ 0x000001A1, 0x0000 }, /* R417 - FLL2 Synchroniser 1 */ { 0x000001A1, 0x0000 }, /* R417 - FLL2 Synchroniser 1 */
{ 0x000001A2, 0x0000 }, /* R418 - FLL2 Synchroniser 2 */ { 0x000001A2, 0x0000 }, /* R418 - FLL2 Synchroniser 2 */
...@@ -678,7 +674,7 @@ static const struct reg_default cs47l24_reg_default[] = { ...@@ -678,7 +674,7 @@ static const struct reg_default cs47l24_reg_default[] = {
{ 0x00000C0F, 0x0400 }, /* R3087 - IRQ CTRL 1 */ { 0x00000C0F, 0x0400 }, /* R3087 - IRQ CTRL 1 */
{ 0x00000C10, 0x1000 }, /* R3088 - GPIO Debounce Config */ { 0x00000C10, 0x1000 }, /* R3088 - GPIO Debounce Config */
{ 0x00000C20, 0x0002 }, /* R3104 - Misc Pad Ctrl 1 */ { 0x00000C20, 0x0002 }, /* R3104 - Misc Pad Ctrl 1 */
{ 0x00000C21, 0x8001 }, /* R3105 - Misc Pad Ctrl 2 */ { 0x00000C21, 0x0000 }, /* R3105 - Misc Pad Ctrl 2 */
{ 0x00000C22, 0x0000 }, /* R3106 - Misc Pad Ctrl 3 */ { 0x00000C22, 0x0000 }, /* R3106 - Misc Pad Ctrl 3 */
{ 0x00000C23, 0x0000 }, /* R3107 - Misc Pad Ctrl 4 */ { 0x00000C23, 0x0000 }, /* R3107 - Misc Pad Ctrl 4 */
{ 0x00000C24, 0x0000 }, /* R3108 - Misc Pad Ctrl 5 */ { 0x00000C24, 0x0000 }, /* R3108 - Misc Pad Ctrl 5 */
...@@ -858,8 +854,6 @@ static bool cs47l24_readable_register(struct device *dev, unsigned int reg) ...@@ -858,8 +854,6 @@ static bool cs47l24_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_FLL1_CONTROL_5: case ARIZONA_FLL1_CONTROL_5:
case ARIZONA_FLL1_CONTROL_6: case ARIZONA_FLL1_CONTROL_6:
case ARIZONA_FLL1_CONTROL_7: case ARIZONA_FLL1_CONTROL_7:
case ARIZONA_FLL1_LOOP_FILTER_TEST_1:
case ARIZONA_FLL1_NCO_TEST_0:
case ARIZONA_FLL1_SYNCHRONISER_1: case ARIZONA_FLL1_SYNCHRONISER_1:
case ARIZONA_FLL1_SYNCHRONISER_2: case ARIZONA_FLL1_SYNCHRONISER_2:
case ARIZONA_FLL1_SYNCHRONISER_3: case ARIZONA_FLL1_SYNCHRONISER_3:
...@@ -876,8 +870,6 @@ static bool cs47l24_readable_register(struct device *dev, unsigned int reg) ...@@ -876,8 +870,6 @@ static bool cs47l24_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_FLL2_CONTROL_5: case ARIZONA_FLL2_CONTROL_5:
case ARIZONA_FLL2_CONTROL_6: case ARIZONA_FLL2_CONTROL_6:
case ARIZONA_FLL2_CONTROL_7: case ARIZONA_FLL2_CONTROL_7:
case ARIZONA_FLL2_LOOP_FILTER_TEST_1:
case ARIZONA_FLL2_NCO_TEST_0:
case ARIZONA_FLL2_SYNCHRONISER_1: case ARIZONA_FLL2_SYNCHRONISER_1:
case ARIZONA_FLL2_SYNCHRONISER_2: case ARIZONA_FLL2_SYNCHRONISER_2:
case ARIZONA_FLL2_SYNCHRONISER_3: case ARIZONA_FLL2_SYNCHRONISER_3:
......
...@@ -388,11 +388,32 @@ static const struct regmap_range da9062_aa_volatile_ranges[] = { ...@@ -388,11 +388,32 @@ static const struct regmap_range da9062_aa_volatile_ranges[] = {
.range_min = DA9062AA_STATUS_D, .range_min = DA9062AA_STATUS_D,
.range_max = DA9062AA_EVENT_C, .range_max = DA9062AA_EVENT_C,
}, { }, {
.range_min = DA9062AA_CONTROL_F, .range_min = DA9062AA_CONTROL_A,
.range_max = DA9062AA_CONTROL_B,
}, {
.range_min = DA9062AA_CONTROL_E,
.range_max = DA9062AA_CONTROL_F, .range_max = DA9062AA_CONTROL_F,
}, {
.range_min = DA9062AA_BUCK2_CONT,
.range_max = DA9062AA_BUCK4_CONT,
}, {
.range_min = DA9062AA_BUCK3_CONT,
.range_max = DA9062AA_BUCK3_CONT,
}, {
.range_min = DA9062AA_LDO1_CONT,
.range_max = DA9062AA_LDO4_CONT,
}, {
.range_min = DA9062AA_DVC_1,
.range_max = DA9062AA_DVC_1,
}, { }, {
.range_min = DA9062AA_COUNT_S, .range_min = DA9062AA_COUNT_S,
.range_max = DA9062AA_SECOND_D, .range_max = DA9062AA_SECOND_D,
}, {
.range_min = DA9062AA_SEQ,
.range_max = DA9062AA_SEQ,
}, {
.range_min = DA9062AA_EN_32K,
.range_max = DA9062AA_EN_32K,
}, },
}; };
......
...@@ -74,17 +74,29 @@ static const struct regmap_range da9063_ad_writeable_ranges[] = { ...@@ -74,17 +74,29 @@ static const struct regmap_range da9063_ad_writeable_ranges[] = {
static const struct regmap_range da9063_ad_volatile_ranges[] = { static const struct regmap_range da9063_ad_volatile_ranges[] = {
{ {
.range_min = DA9063_REG_STATUS_A, .range_min = DA9063_REG_PAGE_CON,
.range_max = DA9063_REG_EVENT_D, .range_max = DA9063_REG_EVENT_D,
}, { }, {
.range_min = DA9063_REG_CONTROL_F, .range_min = DA9063_REG_CONTROL_A,
.range_max = DA9063_REG_CONTROL_B,
}, {
.range_min = DA9063_REG_CONTROL_E,
.range_max = DA9063_REG_CONTROL_F, .range_max = DA9063_REG_CONTROL_F,
}, { }, {
.range_min = DA9063_REG_ADC_MAN, .range_min = DA9063_REG_BCORE2_CONT,
.range_max = DA9063_REG_LDO11_CONT,
}, {
.range_min = DA9063_REG_DVC_1,
.range_max = DA9063_REG_ADC_MAN, .range_max = DA9063_REG_ADC_MAN,
}, { }, {
.range_min = DA9063_REG_ADC_RES_L, .range_min = DA9063_REG_ADC_RES_L,
.range_max = DA9063_AD_REG_SECOND_D, .range_max = DA9063_AD_REG_SECOND_D,
}, {
.range_min = DA9063_REG_SEQ,
.range_max = DA9063_REG_SEQ,
}, {
.range_min = DA9063_REG_EN_32K,
.range_max = DA9063_REG_EN_32K,
}, { }, {
.range_min = DA9063_AD_REG_MON_REG_5, .range_min = DA9063_AD_REG_MON_REG_5,
.range_max = DA9063_AD_REG_MON_REG_6, .range_max = DA9063_AD_REG_MON_REG_6,
...@@ -152,17 +164,29 @@ static const struct regmap_range da9063_bb_writeable_ranges[] = { ...@@ -152,17 +164,29 @@ static const struct regmap_range da9063_bb_writeable_ranges[] = {
static const struct regmap_range da9063_bb_volatile_ranges[] = { static const struct regmap_range da9063_bb_volatile_ranges[] = {
{ {
.range_min = DA9063_REG_STATUS_A, .range_min = DA9063_REG_PAGE_CON,
.range_max = DA9063_REG_EVENT_D, .range_max = DA9063_REG_EVENT_D,
}, { }, {
.range_min = DA9063_REG_CONTROL_F, .range_min = DA9063_REG_CONTROL_A,
.range_max = DA9063_REG_CONTROL_B,
}, {
.range_min = DA9063_REG_CONTROL_E,
.range_max = DA9063_REG_CONTROL_F, .range_max = DA9063_REG_CONTROL_F,
}, { }, {
.range_min = DA9063_REG_ADC_MAN, .range_min = DA9063_REG_BCORE2_CONT,
.range_max = DA9063_REG_LDO11_CONT,
}, {
.range_min = DA9063_REG_DVC_1,
.range_max = DA9063_REG_ADC_MAN, .range_max = DA9063_REG_ADC_MAN,
}, { }, {
.range_min = DA9063_REG_ADC_RES_L, .range_min = DA9063_REG_ADC_RES_L,
.range_max = DA9063_BB_REG_SECOND_D, .range_max = DA9063_BB_REG_SECOND_D,
}, {
.range_min = DA9063_REG_SEQ,
.range_max = DA9063_REG_SEQ,
}, {
.range_min = DA9063_REG_EN_32K,
.range_max = DA9063_REG_EN_32K,
}, { }, {
.range_min = DA9063_BB_REG_MON_REG_5, .range_min = DA9063_BB_REG_MON_REG_5,
.range_max = DA9063_BB_REG_MON_REG_6, .range_max = DA9063_BB_REG_MON_REG_6,
......
...@@ -739,20 +739,17 @@ int prcmu_config_clkout(u8 clkout, u8 source, u8 div) ...@@ -739,20 +739,17 @@ int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
if (!div && !requests[clkout]) if (!div && !requests[clkout])
return -EINVAL; return -EINVAL;
switch (clkout) { if (clkout == 0) {
case 0:
div_mask = PRCM_CLKOCR_CLKODIV0_MASK; div_mask = PRCM_CLKOCR_CLKODIV0_MASK;
mask = (PRCM_CLKOCR_CLKODIV0_MASK | PRCM_CLKOCR_CLKOSEL0_MASK); mask = (PRCM_CLKOCR_CLKODIV0_MASK | PRCM_CLKOCR_CLKOSEL0_MASK);
bits = ((source << PRCM_CLKOCR_CLKOSEL0_SHIFT) | bits = ((source << PRCM_CLKOCR_CLKOSEL0_SHIFT) |
(div << PRCM_CLKOCR_CLKODIV0_SHIFT)); (div << PRCM_CLKOCR_CLKODIV0_SHIFT));
break; } else {
case 1:
div_mask = PRCM_CLKOCR_CLKODIV1_MASK; div_mask = PRCM_CLKOCR_CLKODIV1_MASK;
mask = (PRCM_CLKOCR_CLKODIV1_MASK | PRCM_CLKOCR_CLKOSEL1_MASK | mask = (PRCM_CLKOCR_CLKODIV1_MASK | PRCM_CLKOCR_CLKOSEL1_MASK |
PRCM_CLKOCR_CLK1TYPE); PRCM_CLKOCR_CLK1TYPE);
bits = ((source << PRCM_CLKOCR_CLKOSEL1_SHIFT) | bits = ((source << PRCM_CLKOCR_CLKOSEL1_SHIFT) |
(div << PRCM_CLKOCR_CLKODIV1_SHIFT)); (div << PRCM_CLKOCR_CLKODIV1_SHIFT));
break;
} }
bits &= mask; bits &= mask;
......
/*
* Copyright (C) 2014-2015 Pengutronix, Markus Pargmann <mpa@pengutronix.de>
*
* 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/clk.h>
#include <linux/interrupt.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/irqdesc.h>
#include <linux/irqdomain.h>
#include <linux/irq.h>
#include <linux/mfd/imx25-tsadc.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
static struct regmap_config mx25_tsadc_regmap_config = {
.fast_io = true,
.max_register = 8,
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
};
static void mx25_tsadc_irq_handler(struct irq_desc *desc)
{
struct mx25_tsadc *tsadc = irq_desc_get_handler_data(desc);
struct irq_chip *chip = irq_desc_get_chip(desc);
u32 status;
chained_irq_enter(chip, desc);
regmap_read(tsadc->regs, MX25_TSC_TGSR, &status);
if (status & MX25_TGSR_GCQ_INT)
generic_handle_irq(irq_find_mapping(tsadc->domain, 1));
if (status & MX25_TGSR_TCQ_INT)
generic_handle_irq(irq_find_mapping(tsadc->domain, 0));
chained_irq_exit(chip, desc);
}
static int mx25_tsadc_domain_map(struct irq_domain *d, unsigned int irq,
irq_hw_number_t hwirq)
{
struct mx25_tsadc *tsadc = d->host_data;
irq_set_chip_data(irq, tsadc);
irq_set_chip_and_handler(irq, &dummy_irq_chip,
handle_level_irq);
irq_modify_status(irq, IRQ_NOREQUEST, IRQ_NOPROBE);
return 0;
}
static struct irq_domain_ops mx25_tsadc_domain_ops = {
.map = mx25_tsadc_domain_map,
.xlate = irq_domain_xlate_onecell,
};
static int mx25_tsadc_setup_irq(struct platform_device *pdev,
struct mx25_tsadc *tsadc)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
int irq;
irq = platform_get_irq(pdev, 0);
if (irq <= 0) {
dev_err(dev, "Failed to get irq\n");
return irq;
}
tsadc->domain = irq_domain_add_simple(np, 2, 0, &mx25_tsadc_domain_ops,
tsadc);
if (!tsadc->domain) {
dev_err(dev, "Failed to add irq domain\n");
return -ENOMEM;
}
irq_set_chained_handler(irq, mx25_tsadc_irq_handler);
irq_set_handler_data(irq, tsadc);
return 0;
}
static void mx25_tsadc_setup_clk(struct platform_device *pdev,
struct mx25_tsadc *tsadc)
{
unsigned clk_div;
/*
* According to the datasheet the ADC clock should never
* exceed 1,75 MHz. Base clock is the IPG and the ADC unit uses
* a funny clock divider. To keep the ADC conversion time constant
* adapt the ADC internal clock divider to the IPG clock rate.
*/
dev_dbg(&pdev->dev, "Found master clock at %lu Hz\n",
clk_get_rate(tsadc->clk));
clk_div = DIV_ROUND_UP(clk_get_rate(tsadc->clk), 1750000);
dev_dbg(&pdev->dev, "Setting up ADC clock divider to %u\n", clk_div);
/* adc clock = IPG clock / (2 * div + 2) */
clk_div -= 2;
clk_div /= 2;
/*
* the ADC clock divider changes its behaviour when values below 4
* are used: it is fixed to "/ 10" in this case
*/
clk_div = max_t(unsigned, 4, clk_div);
dev_dbg(&pdev->dev, "Resulting ADC conversion clock at %lu Hz\n",
clk_get_rate(tsadc->clk) / (2 * clk_div + 2));
regmap_update_bits(tsadc->regs, MX25_TSC_TGCR,
MX25_TGCR_ADCCLKCFG(0x1f),
MX25_TGCR_ADCCLKCFG(clk_div));
}
static int mx25_tsadc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct mx25_tsadc *tsadc;
struct resource *res;
int ret;
void __iomem *iomem;
tsadc = devm_kzalloc(dev, sizeof(*tsadc), GFP_KERNEL);
if (!tsadc)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
iomem = devm_ioremap_resource(dev, res);
if (IS_ERR(iomem))
return PTR_ERR(iomem);
tsadc->regs = devm_regmap_init_mmio(dev, iomem,
&mx25_tsadc_regmap_config);
if (IS_ERR(tsadc->regs)) {
dev_err(dev, "Failed to initialize regmap\n");
return PTR_ERR(tsadc->regs);
}
tsadc->clk = devm_clk_get(dev, "ipg");
if (IS_ERR(tsadc->clk)) {
dev_err(dev, "Failed to get ipg clock\n");
return PTR_ERR(tsadc->clk);
}
/* setup clock according to the datasheet */
mx25_tsadc_setup_clk(pdev, tsadc);
/* Enable clock and reset the component */
regmap_update_bits(tsadc->regs, MX25_TSC_TGCR, MX25_TGCR_CLK_EN,
MX25_TGCR_CLK_EN);
regmap_update_bits(tsadc->regs, MX25_TSC_TGCR, MX25_TGCR_TSC_RST,
MX25_TGCR_TSC_RST);
/* Setup powersaving mode, but enable internal reference voltage */
regmap_update_bits(tsadc->regs, MX25_TSC_TGCR, MX25_TGCR_POWERMODE_MASK,
MX25_TGCR_POWERMODE_SAVE);
regmap_update_bits(tsadc->regs, MX25_TSC_TGCR, MX25_TGCR_INTREFEN,
MX25_TGCR_INTREFEN);
ret = mx25_tsadc_setup_irq(pdev, tsadc);
if (ret)
return ret;
platform_set_drvdata(pdev, tsadc);
of_platform_populate(np, NULL, NULL, dev);
return 0;
}
static const struct of_device_id mx25_tsadc_ids[] = {
{ .compatible = "fsl,imx25-tsadc" },
{ /* Sentinel */ }
};
static struct platform_driver mx25_tsadc_driver = {
.driver = {
.name = "mx25-tsadc",
.of_match_table = of_match_ptr(mx25_tsadc_ids),
},
.probe = mx25_tsadc_probe,
};
module_platform_driver(mx25_tsadc_driver);
MODULE_DESCRIPTION("MFD for ADC/TSC for Freescale mx25");
MODULE_AUTHOR("Markus Pargmann <mpa@pengutronix.de>");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:mx25-tsadc");
...@@ -44,8 +44,20 @@ static const struct intel_lpss_platform_info bxt_info = { ...@@ -44,8 +44,20 @@ static const struct intel_lpss_platform_info bxt_info = {
.clk_rate = 100000000, .clk_rate = 100000000,
}; };
static struct property_entry bxt_i2c_properties[] = {
PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 42),
PROPERTY_ENTRY_U32("i2c-sda-falling-time-ns", 171),
PROPERTY_ENTRY_U32("i2c-scl-falling-time-ns", 208),
{ },
};
static struct property_set bxt_i2c_pset = {
.properties = bxt_i2c_properties,
};
static const struct intel_lpss_platform_info bxt_i2c_info = { static const struct intel_lpss_platform_info bxt_i2c_info = {
.clk_rate = 133000000, .clk_rate = 133000000,
.pset = &bxt_i2c_pset,
}; };
static const struct acpi_device_id intel_lpss_acpi_ids[] = { static const struct acpi_device_id intel_lpss_acpi_ids[] = {
......
...@@ -107,12 +107,24 @@ static const struct intel_lpss_platform_info bxt_uart_info = { ...@@ -107,12 +107,24 @@ static const struct intel_lpss_platform_info bxt_uart_info = {
.pset = &uart_pset, .pset = &uart_pset,
}; };
static struct property_entry bxt_i2c_properties[] = {
PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 42),
PROPERTY_ENTRY_U32("i2c-sda-falling-time-ns", 171),
PROPERTY_ENTRY_U32("i2c-scl-falling-time-ns", 208),
{ },
};
static struct property_set bxt_i2c_pset = {
.properties = bxt_i2c_properties,
};
static const struct intel_lpss_platform_info bxt_i2c_info = { static const struct intel_lpss_platform_info bxt_i2c_info = {
.clk_rate = 133000000, .clk_rate = 133000000,
.pset = &bxt_i2c_pset,
}; };
static const struct pci_device_id intel_lpss_pci_ids[] = { static const struct pci_device_id intel_lpss_pci_ids[] = {
/* BXT */ /* BXT A-Step */
{ PCI_VDEVICE(INTEL, 0x0aac), (kernel_ulong_t)&bxt_i2c_info }, { PCI_VDEVICE(INTEL, 0x0aac), (kernel_ulong_t)&bxt_i2c_info },
{ PCI_VDEVICE(INTEL, 0x0aae), (kernel_ulong_t)&bxt_i2c_info }, { PCI_VDEVICE(INTEL, 0x0aae), (kernel_ulong_t)&bxt_i2c_info },
{ PCI_VDEVICE(INTEL, 0x0ab0), (kernel_ulong_t)&bxt_i2c_info }, { PCI_VDEVICE(INTEL, 0x0ab0), (kernel_ulong_t)&bxt_i2c_info },
...@@ -128,6 +140,23 @@ static const struct pci_device_id intel_lpss_pci_ids[] = { ...@@ -128,6 +140,23 @@ static const struct pci_device_id intel_lpss_pci_ids[] = {
{ PCI_VDEVICE(INTEL, 0x0ac4), (kernel_ulong_t)&bxt_info }, { PCI_VDEVICE(INTEL, 0x0ac4), (kernel_ulong_t)&bxt_info },
{ PCI_VDEVICE(INTEL, 0x0ac6), (kernel_ulong_t)&bxt_info }, { PCI_VDEVICE(INTEL, 0x0ac6), (kernel_ulong_t)&bxt_info },
{ PCI_VDEVICE(INTEL, 0x0aee), (kernel_ulong_t)&bxt_uart_info }, { PCI_VDEVICE(INTEL, 0x0aee), (kernel_ulong_t)&bxt_uart_info },
/* BXT B-Step */
{ PCI_VDEVICE(INTEL, 0x1aac), (kernel_ulong_t)&bxt_i2c_info },
{ PCI_VDEVICE(INTEL, 0x1aae), (kernel_ulong_t)&bxt_i2c_info },
{ PCI_VDEVICE(INTEL, 0x1ab0), (kernel_ulong_t)&bxt_i2c_info },
{ PCI_VDEVICE(INTEL, 0x1ab2), (kernel_ulong_t)&bxt_i2c_info },
{ PCI_VDEVICE(INTEL, 0x1ab4), (kernel_ulong_t)&bxt_i2c_info },
{ PCI_VDEVICE(INTEL, 0x1ab6), (kernel_ulong_t)&bxt_i2c_info },
{ PCI_VDEVICE(INTEL, 0x1ab8), (kernel_ulong_t)&bxt_i2c_info },
{ PCI_VDEVICE(INTEL, 0x1aba), (kernel_ulong_t)&bxt_i2c_info },
{ PCI_VDEVICE(INTEL, 0x1abc), (kernel_ulong_t)&bxt_uart_info },
{ PCI_VDEVICE(INTEL, 0x1abe), (kernel_ulong_t)&bxt_uart_info },
{ PCI_VDEVICE(INTEL, 0x1ac0), (kernel_ulong_t)&bxt_uart_info },
{ PCI_VDEVICE(INTEL, 0x1ac2), (kernel_ulong_t)&bxt_info },
{ PCI_VDEVICE(INTEL, 0x1ac4), (kernel_ulong_t)&bxt_info },
{ PCI_VDEVICE(INTEL, 0x1ac6), (kernel_ulong_t)&bxt_info },
{ PCI_VDEVICE(INTEL, 0x1aee), (kernel_ulong_t)&bxt_uart_info },
/* APL */ /* APL */
{ PCI_VDEVICE(INTEL, 0x5aac), (kernel_ulong_t)&bxt_i2c_info }, { PCI_VDEVICE(INTEL, 0x5aac), (kernel_ulong_t)&bxt_i2c_info },
{ PCI_VDEVICE(INTEL, 0x5aae), (kernel_ulong_t)&bxt_i2c_info }, { PCI_VDEVICE(INTEL, 0x5aae), (kernel_ulong_t)&bxt_i2c_info },
......
...@@ -453,6 +453,7 @@ int intel_lpss_probe(struct device *dev, ...@@ -453,6 +453,7 @@ int intel_lpss_probe(struct device *dev,
err_remove_ltr: err_remove_ltr:
intel_lpss_debugfs_remove(lpss); intel_lpss_debugfs_remove(lpss);
intel_lpss_ltr_hide(lpss); intel_lpss_ltr_hide(lpss);
intel_lpss_unregister_clock(lpss);
err_clk_register: err_clk_register:
ida_simple_remove(&intel_lpss_devid_ida, lpss->devid); ida_simple_remove(&intel_lpss_devid_ida, lpss->devid);
......
...@@ -52,8 +52,6 @@ ...@@ -52,8 +52,6 @@
/* The Quark I2C controller source clock */ /* The Quark I2C controller source clock */
#define INTEL_QUARK_I2C_CLK_HZ 33000000 #define INTEL_QUARK_I2C_CLK_HZ 33000000
#define INTEL_QUARK_I2C_NCLK 1
struct intel_quark_mfd { struct intel_quark_mfd {
struct pci_dev *pdev; struct pci_dev *pdev;
struct clk *i2c_clk; struct clk *i2c_clk;
...@@ -128,30 +126,24 @@ MODULE_DEVICE_TABLE(pci, intel_quark_mfd_ids); ...@@ -128,30 +126,24 @@ MODULE_DEVICE_TABLE(pci, intel_quark_mfd_ids);
static int intel_quark_register_i2c_clk(struct intel_quark_mfd *quark_mfd) static int intel_quark_register_i2c_clk(struct intel_quark_mfd *quark_mfd)
{ {
struct pci_dev *pdev = quark_mfd->pdev; struct pci_dev *pdev = quark_mfd->pdev;
struct clk_lookup *i2c_clk_lookup;
struct clk *i2c_clk; struct clk *i2c_clk;
int ret;
i2c_clk_lookup = devm_kcalloc(&pdev->dev, INTEL_QUARK_I2C_NCLK,
sizeof(*i2c_clk_lookup), GFP_KERNEL);
if (!i2c_clk_lookup)
return -ENOMEM;
i2c_clk_lookup[0].dev_id = INTEL_QUARK_I2C_CONTROLLER_CLK;
i2c_clk = clk_register_fixed_rate(&pdev->dev, i2c_clk = clk_register_fixed_rate(&pdev->dev,
INTEL_QUARK_I2C_CONTROLLER_CLK, NULL, INTEL_QUARK_I2C_CONTROLLER_CLK, NULL,
CLK_IS_ROOT, INTEL_QUARK_I2C_CLK_HZ); CLK_IS_ROOT, INTEL_QUARK_I2C_CLK_HZ);
if (IS_ERR(i2c_clk))
return PTR_ERR(i2c_clk);
quark_mfd->i2c_clk_lookup = i2c_clk_lookup;
quark_mfd->i2c_clk = i2c_clk; quark_mfd->i2c_clk = i2c_clk;
quark_mfd->i2c_clk_lookup = clkdev_create(i2c_clk, NULL,
INTEL_QUARK_I2C_CONTROLLER_CLK);
ret = clk_register_clkdevs(i2c_clk, i2c_clk_lookup, if (!quark_mfd->i2c_clk_lookup) {
INTEL_QUARK_I2C_NCLK); dev_err(&pdev->dev, "Fixed clk register failed\n");
if (ret) return -ENOMEM;
dev_err(&pdev->dev, "Fixed clk register failed: %d\n", ret); }
return ret; return 0;
} }
static void intel_quark_unregister_i2c_clk(struct pci_dev *pdev) static void intel_quark_unregister_i2c_clk(struct pci_dev *pdev)
......
...@@ -376,7 +376,7 @@ static const struct mfd_cell micro_cells[] = { ...@@ -376,7 +376,7 @@ static const struct mfd_cell micro_cells[] = {
{ .name = "ipaq-micro-leds", }, { .name = "ipaq-micro-leds", },
}; };
static int micro_resume(struct device *dev) static int __maybe_unused micro_resume(struct device *dev)
{ {
struct ipaq_micro *micro = dev_get_drvdata(dev); struct ipaq_micro *micro = dev_get_drvdata(dev);
......
...@@ -169,6 +169,7 @@ static const struct of_device_id max77686_pmic_dt_match[] = { ...@@ -169,6 +169,7 @@ static const struct of_device_id max77686_pmic_dt_match[] = {
}, },
{ }, { },
}; };
MODULE_DEVICE_TABLE(of, max77686_pmic_dt_match);
static int max77686_i2c_probe(struct i2c_client *i2c, static int max77686_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
...@@ -265,6 +266,7 @@ static int max77686_i2c_remove(struct i2c_client *i2c) ...@@ -265,6 +266,7 @@ static int max77686_i2c_remove(struct i2c_client *i2c)
static const struct i2c_device_id max77686_i2c_id[] = { static const struct i2c_device_id max77686_i2c_id[] = {
{ "max77686", TYPE_MAX77686 }, { "max77686", TYPE_MAX77686 },
{ "max77802", TYPE_MAX77802 },
{ } { }
}; };
MODULE_DEVICE_TABLE(i2c, max77686_i2c_id); MODULE_DEVICE_TABLE(i2c, max77686_i2c_id);
......
...@@ -19,11 +19,17 @@ ...@@ -19,11 +19,17 @@
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/mfd/core.h> #include <linux/mfd/core.h>
#include <linux/mfd/mt6397/core.h> #include <linux/mfd/mt6397/core.h>
#include <linux/mfd/mt6323/core.h>
#include <linux/mfd/mt6397/registers.h> #include <linux/mfd/mt6397/registers.h>
#include <linux/mfd/mt6323/registers.h>
#define MT6397_RTC_BASE 0xe000 #define MT6397_RTC_BASE 0xe000
#define MT6397_RTC_SIZE 0x3e #define MT6397_RTC_SIZE 0x3e
#define MT6323_CID_CODE 0x23
#define MT6391_CID_CODE 0x91
#define MT6397_CID_CODE 0x97
static const struct resource mt6397_rtc_resources[] = { static const struct resource mt6397_rtc_resources[] = {
{ {
.start = MT6397_RTC_BASE, .start = MT6397_RTC_BASE,
...@@ -37,6 +43,13 @@ static const struct resource mt6397_rtc_resources[] = { ...@@ -37,6 +43,13 @@ static const struct resource mt6397_rtc_resources[] = {
}, },
}; };
static const struct mfd_cell mt6323_devs[] = {
{
.name = "mt6323-regulator",
.of_compatible = "mediatek,mt6323-regulator"
},
};
static const struct mfd_cell mt6397_devs[] = { static const struct mfd_cell mt6397_devs[] = {
{ {
.name = "mt6397-rtc", .name = "mt6397-rtc",
...@@ -69,8 +82,10 @@ static void mt6397_irq_sync_unlock(struct irq_data *data) ...@@ -69,8 +82,10 @@ static void mt6397_irq_sync_unlock(struct irq_data *data)
{ {
struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(data); struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(data);
regmap_write(mt6397->regmap, MT6397_INT_CON0, mt6397->irq_masks_cur[0]); regmap_write(mt6397->regmap, mt6397->int_con[0],
regmap_write(mt6397->regmap, MT6397_INT_CON1, mt6397->irq_masks_cur[1]); mt6397->irq_masks_cur[0]);
regmap_write(mt6397->regmap, mt6397->int_con[1],
mt6397->irq_masks_cur[1]);
mutex_unlock(&mt6397->irqlock); mutex_unlock(&mt6397->irqlock);
} }
...@@ -147,8 +162,8 @@ static irqreturn_t mt6397_irq_thread(int irq, void *data) ...@@ -147,8 +162,8 @@ static irqreturn_t mt6397_irq_thread(int irq, void *data)
{ {
struct mt6397_chip *mt6397 = data; struct mt6397_chip *mt6397 = data;
mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS0, 0); mt6397_irq_handle_reg(mt6397, mt6397->int_status[0], 0);
mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS1, 16); mt6397_irq_handle_reg(mt6397, mt6397->int_status[1], 16);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -177,8 +192,8 @@ static int mt6397_irq_init(struct mt6397_chip *mt6397) ...@@ -177,8 +192,8 @@ static int mt6397_irq_init(struct mt6397_chip *mt6397)
mutex_init(&mt6397->irqlock); mutex_init(&mt6397->irqlock);
/* Mask all interrupt sources */ /* Mask all interrupt sources */
regmap_write(mt6397->regmap, MT6397_INT_CON0, 0x0); regmap_write(mt6397->regmap, mt6397->int_con[0], 0x0);
regmap_write(mt6397->regmap, MT6397_INT_CON1, 0x0); regmap_write(mt6397->regmap, mt6397->int_con[1], 0x0);
mt6397->irq_domain = irq_domain_add_linear(mt6397->dev->of_node, mt6397->irq_domain = irq_domain_add_linear(mt6397->dev->of_node,
MT6397_IRQ_NR, &mt6397_irq_domain_ops, mt6397); MT6397_IRQ_NR, &mt6397_irq_domain_ops, mt6397);
...@@ -203,8 +218,8 @@ static int mt6397_irq_suspend(struct device *dev) ...@@ -203,8 +218,8 @@ static int mt6397_irq_suspend(struct device *dev)
{ {
struct mt6397_chip *chip = dev_get_drvdata(dev); struct mt6397_chip *chip = dev_get_drvdata(dev);
regmap_write(chip->regmap, MT6397_INT_CON0, chip->wake_mask[0]); regmap_write(chip->regmap, chip->int_con[0], chip->wake_mask[0]);
regmap_write(chip->regmap, MT6397_INT_CON1, chip->wake_mask[1]); regmap_write(chip->regmap, chip->int_con[1], chip->wake_mask[1]);
enable_irq_wake(chip->irq); enable_irq_wake(chip->irq);
...@@ -215,8 +230,8 @@ static int mt6397_irq_resume(struct device *dev) ...@@ -215,8 +230,8 @@ static int mt6397_irq_resume(struct device *dev)
{ {
struct mt6397_chip *chip = dev_get_drvdata(dev); struct mt6397_chip *chip = dev_get_drvdata(dev);
regmap_write(chip->regmap, MT6397_INT_CON0, chip->irq_masks_cur[0]); regmap_write(chip->regmap, chip->int_con[0], chip->irq_masks_cur[0]);
regmap_write(chip->regmap, MT6397_INT_CON1, chip->irq_masks_cur[1]); regmap_write(chip->regmap, chip->int_con[1], chip->irq_masks_cur[1]);
disable_irq_wake(chip->irq); disable_irq_wake(chip->irq);
...@@ -230,34 +245,69 @@ static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_irq_suspend, ...@@ -230,34 +245,69 @@ static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_irq_suspend,
static int mt6397_probe(struct platform_device *pdev) static int mt6397_probe(struct platform_device *pdev)
{ {
int ret; int ret;
struct mt6397_chip *mt6397; unsigned int id;
struct mt6397_chip *pmic;
mt6397 = devm_kzalloc(&pdev->dev, sizeof(*mt6397), GFP_KERNEL); pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL);
if (!mt6397) if (!pmic)
return -ENOMEM; return -ENOMEM;
mt6397->dev = &pdev->dev; pmic->dev = &pdev->dev;
/* /*
* mt6397 MFD is child device of soc pmic wrapper. * mt6397 MFD is child device of soc pmic wrapper.
* Regmap is set from its parent. * Regmap is set from its parent.
*/ */
mt6397->regmap = dev_get_regmap(pdev->dev.parent, NULL); pmic->regmap = dev_get_regmap(pdev->dev.parent, NULL);
if (!mt6397->regmap) if (!pmic->regmap)
return -ENODEV; return -ENODEV;
platform_set_drvdata(pdev, mt6397); platform_set_drvdata(pdev, pmic);
mt6397->irq = platform_get_irq(pdev, 0); ret = regmap_read(pmic->regmap, MT6397_CID, &id);
if (mt6397->irq > 0) { if (ret) {
ret = mt6397_irq_init(mt6397); dev_err(pmic->dev, "Failed to read chip id: %d\n", ret);
goto fail_irq;
}
switch (id & 0xff) {
case MT6323_CID_CODE:
pmic->int_con[0] = MT6323_INT_CON0;
pmic->int_con[1] = MT6323_INT_CON1;
pmic->int_status[0] = MT6323_INT_STATUS0;
pmic->int_status[1] = MT6323_INT_STATUS1;
ret = mfd_add_devices(&pdev->dev, -1, mt6323_devs,
ARRAY_SIZE(mt6323_devs), NULL, 0, NULL);
break;
case MT6397_CID_CODE:
case MT6391_CID_CODE:
pmic->int_con[0] = MT6397_INT_CON0;
pmic->int_con[1] = MT6397_INT_CON1;
pmic->int_status[0] = MT6397_INT_STATUS0;
pmic->int_status[1] = MT6397_INT_STATUS1;
ret = mfd_add_devices(&pdev->dev, -1, mt6397_devs,
ARRAY_SIZE(mt6397_devs), NULL, 0, NULL);
break;
default:
dev_err(&pdev->dev, "unsupported chip: %d\n", id);
ret = -ENODEV;
break;
}
pmic->irq = platform_get_irq(pdev, 0);
if (pmic->irq > 0) {
ret = mt6397_irq_init(pmic);
if (ret) if (ret)
return ret; return ret;
} }
ret = mfd_add_devices(&pdev->dev, -1, mt6397_devs, fail_irq:
ARRAY_SIZE(mt6397_devs), NULL, 0, NULL); if (ret) {
if (ret) irq_domain_remove(pmic->irq_domain);
dev_err(&pdev->dev, "failed to add child devices: %d\n", ret); dev_err(&pdev->dev, "failed to add child devices: %d\n", ret);
}
return ret; return ret;
} }
...@@ -271,10 +321,17 @@ static int mt6397_remove(struct platform_device *pdev) ...@@ -271,10 +321,17 @@ static int mt6397_remove(struct platform_device *pdev)
static const struct of_device_id mt6397_of_match[] = { static const struct of_device_id mt6397_of_match[] = {
{ .compatible = "mediatek,mt6397" }, { .compatible = "mediatek,mt6397" },
{ .compatible = "mediatek,mt6323" },
{ } { }
}; };
MODULE_DEVICE_TABLE(of, mt6397_of_match); MODULE_DEVICE_TABLE(of, mt6397_of_match);
static const struct platform_device_id mt6397_id[] = {
{ "mt6397", 0 },
{ },
};
MODULE_DEVICE_TABLE(platform, mt6397_id);
static struct platform_driver mt6397_driver = { static struct platform_driver mt6397_driver = {
.probe = mt6397_probe, .probe = mt6397_probe,
.remove = mt6397_remove, .remove = mt6397_remove,
...@@ -283,6 +340,7 @@ static struct platform_driver mt6397_driver = { ...@@ -283,6 +340,7 @@ static struct platform_driver mt6397_driver = {
.of_match_table = of_match_ptr(mt6397_of_match), .of_match_table = of_match_ptr(mt6397_of_match),
.pm = &mt6397_pm_ops, .pm = &mt6397_pm_ops,
}, },
.id_table = mt6397_id,
}; };
module_platform_driver(mt6397_driver); module_platform_driver(mt6397_driver);
...@@ -290,4 +348,3 @@ module_platform_driver(mt6397_driver); ...@@ -290,4 +348,3 @@ module_platform_driver(mt6397_driver);
MODULE_AUTHOR("Flora Fu, MediaTek"); MODULE_AUTHOR("Flora Fu, MediaTek");
MODULE_DESCRIPTION("Driver for MediaTek MT6397 PMIC"); MODULE_DESCRIPTION("Driver for MediaTek MT6397 PMIC");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:mt6397");
...@@ -241,8 +241,8 @@ static const struct regmap_config rc5t583_regmap_config = { ...@@ -241,8 +241,8 @@ static const struct regmap_config rc5t583_regmap_config = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 8, .val_bits = 8,
.volatile_reg = volatile_reg, .volatile_reg = volatile_reg,
.max_register = RC5T583_MAX_REGS, .max_register = RC5T583_MAX_REG,
.num_reg_defaults_raw = RC5T583_MAX_REGS, .num_reg_defaults_raw = RC5T583_NUM_REGS,
.cache_type = REGCACHE_RBTREE, .cache_type = REGCACHE_RBTREE,
}; };
......
...@@ -333,6 +333,31 @@ static const struct mfd_cell stmpe_keypad_cell = { ...@@ -333,6 +333,31 @@ static const struct mfd_cell stmpe_keypad_cell = {
.num_resources = ARRAY_SIZE(stmpe_keypad_resources), .num_resources = ARRAY_SIZE(stmpe_keypad_resources),
}; };
/*
* PWM (1601, 2401, 2403)
*/
static struct resource stmpe_pwm_resources[] = {
{
.name = "PWM0",
.flags = IORESOURCE_IRQ,
},
{
.name = "PWM1",
.flags = IORESOURCE_IRQ,
},
{
.name = "PWM2",
.flags = IORESOURCE_IRQ,
},
};
static const struct mfd_cell stmpe_pwm_cell = {
.name = "stmpe-pwm",
.of_compatible = "st,stmpe-pwm",
.resources = stmpe_pwm_resources,
.num_resources = ARRAY_SIZE(stmpe_pwm_resources),
};
/* /*
* STMPE801 * STMPE801
*/ */
...@@ -537,6 +562,11 @@ static struct stmpe_variant_block stmpe1601_blocks[] = { ...@@ -537,6 +562,11 @@ static struct stmpe_variant_block stmpe1601_blocks[] = {
.irq = STMPE1601_IRQ_KEYPAD, .irq = STMPE1601_IRQ_KEYPAD,
.block = STMPE_BLOCK_KEYPAD, .block = STMPE_BLOCK_KEYPAD,
}, },
{
.cell = &stmpe_pwm_cell,
.irq = STMPE1601_IRQ_PWM0,
.block = STMPE_BLOCK_PWM,
},
}; };
/* supported autosleep timeout delay (in msecs) */ /* supported autosleep timeout delay (in msecs) */
...@@ -771,6 +801,11 @@ static struct stmpe_variant_block stmpe24xx_blocks[] = { ...@@ -771,6 +801,11 @@ static struct stmpe_variant_block stmpe24xx_blocks[] = {
.irq = STMPE24XX_IRQ_KEYPAD, .irq = STMPE24XX_IRQ_KEYPAD,
.block = STMPE_BLOCK_KEYPAD, .block = STMPE_BLOCK_KEYPAD,
}, },
{
.cell = &stmpe_pwm_cell,
.irq = STMPE24XX_IRQ_PWM0,
.block = STMPE_BLOCK_PWM,
},
}; };
static int stmpe24xx_enable(struct stmpe *stmpe, unsigned int blocks, static int stmpe24xx_enable(struct stmpe *stmpe, unsigned int blocks,
......
...@@ -36,7 +36,7 @@ struct syscon { ...@@ -36,7 +36,7 @@ struct syscon {
struct list_head list; struct list_head list;
}; };
static struct regmap_config syscon_regmap_config = { static const struct regmap_config syscon_regmap_config = {
.reg_bits = 32, .reg_bits = 32,
.val_bits = 32, .val_bits = 32,
.reg_stride = 4, .reg_stride = 4,
...@@ -50,6 +50,7 @@ static struct syscon *of_syscon_register(struct device_node *np) ...@@ -50,6 +50,7 @@ static struct syscon *of_syscon_register(struct device_node *np)
u32 reg_io_width; u32 reg_io_width;
int ret; int ret;
struct regmap_config syscon_config = syscon_regmap_config; struct regmap_config syscon_config = syscon_regmap_config;
struct resource res;
if (!of_device_is_compatible(np, "syscon")) if (!of_device_is_compatible(np, "syscon"))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
...@@ -58,7 +59,12 @@ static struct syscon *of_syscon_register(struct device_node *np) ...@@ -58,7 +59,12 @@ static struct syscon *of_syscon_register(struct device_node *np)
if (!syscon) if (!syscon)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
base = of_iomap(np, 0); if (of_address_to_resource(np, 0, &res)) {
ret = -ENOMEM;
goto err_map;
}
base = ioremap(res.start, resource_size(&res));
if (!base) { if (!base) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_map; goto err_map;
...@@ -81,6 +87,7 @@ static struct syscon *of_syscon_register(struct device_node *np) ...@@ -81,6 +87,7 @@ static struct syscon *of_syscon_register(struct device_node *np)
syscon_config.reg_stride = reg_io_width; syscon_config.reg_stride = reg_io_width;
syscon_config.val_bits = reg_io_width * 8; syscon_config.val_bits = reg_io_width * 8;
syscon_config.max_register = resource_size(&res) - reg_io_width;
regmap = regmap_init_mmio(NULL, base, &syscon_config); regmap = regmap_init_mmio(NULL, base, &syscon_config);
if (IS_ERR(regmap)) { if (IS_ERR(regmap)) {
...@@ -192,6 +199,7 @@ static int syscon_probe(struct platform_device *pdev) ...@@ -192,6 +199,7 @@ static int syscon_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct syscon_platform_data *pdata = dev_get_platdata(dev); struct syscon_platform_data *pdata = dev_get_platdata(dev);
struct syscon *syscon; struct syscon *syscon;
struct regmap_config syscon_config = syscon_regmap_config;
struct resource *res; struct resource *res;
void __iomem *base; void __iomem *base;
...@@ -207,11 +215,10 @@ static int syscon_probe(struct platform_device *pdev) ...@@ -207,11 +215,10 @@ static int syscon_probe(struct platform_device *pdev)
if (!base) if (!base)
return -ENOMEM; return -ENOMEM;
syscon_regmap_config.max_register = res->end - res->start - 3; syscon_config.max_register = res->end - res->start - 3;
if (pdata) if (pdata)
syscon_regmap_config.name = pdata->label; syscon_config.name = pdata->label;
syscon->regmap = devm_regmap_init_mmio(dev, base, syscon->regmap = devm_regmap_init_mmio(dev, base, &syscon_config);
&syscon_regmap_config);
if (IS_ERR(syscon->regmap)) { if (IS_ERR(syscon->regmap)) {
dev_err(dev, "regmap init failed\n"); dev_err(dev, "regmap init failed\n");
return PTR_ERR(syscon->regmap); return PTR_ERR(syscon->regmap);
......
...@@ -1059,26 +1059,7 @@ EXPORT_SYMBOL(tps65013_set_low_pwr); ...@@ -1059,26 +1059,7 @@ EXPORT_SYMBOL(tps65013_set_low_pwr);
static int __init tps_init(void) static int __init tps_init(void)
{ {
u32 tries = 3; return i2c_add_driver(&tps65010_driver);
int status = -ENODEV;
printk(KERN_INFO "%s: version %s\n", DRIVER_NAME, DRIVER_VERSION);
/* some boards have startup glitches */
while (tries--) {
status = i2c_add_driver(&tps65010_driver);
if (the_tps)
break;
i2c_del_driver(&tps65010_driver);
if (!tries) {
printk(KERN_ERR "%s: no chip?\n", DRIVER_NAME);
return -ENODEV;
}
pr_debug("%s: re-probe ...\n", DRIVER_NAME);
msleep(10);
}
return status;
} }
/* NOTE: this MUST be initialized before the other parts of the system /* NOTE: this MUST be initialized before the other parts of the system
* that rely on it ... but after the i2c bus on which this relies. * that rely on it ... but after the i2c bus on which this relies.
......
/*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
* Andrew F. Davis <afd@ti.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.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether expressed or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License version 2 for more details.
*
* Based on the TPS65912 driver
*/
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/mfd/tps65086.h>
static const struct mfd_cell tps65086_cells[] = {
{ .name = "tps65086-regulator", },
{ .name = "tps65086-gpio", },
};
static const struct regmap_range tps65086_yes_ranges[] = {
regmap_reg_range(TPS65086_IRQ, TPS65086_IRQ),
regmap_reg_range(TPS65086_PMICSTAT, TPS65086_SHUTDNSRC),
regmap_reg_range(TPS65086_GPOCTRL, TPS65086_GPOCTRL),
regmap_reg_range(TPS65086_PG_STATUS1, TPS65086_OC_STATUS),
};
static const struct regmap_access_table tps65086_volatile_table = {
.yes_ranges = tps65086_yes_ranges,
.n_yes_ranges = ARRAY_SIZE(tps65086_yes_ranges),
};
static const struct regmap_config tps65086_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.cache_type = REGCACHE_RBTREE,
.volatile_table = &tps65086_volatile_table,
};
static const struct regmap_irq tps65086_irqs[] = {
REGMAP_IRQ_REG(TPS65086_IRQ_DIETEMP, 0, TPS65086_IRQ_DIETEMP_MASK),
REGMAP_IRQ_REG(TPS65086_IRQ_SHUTDN, 0, TPS65086_IRQ_SHUTDN_MASK),
REGMAP_IRQ_REG(TPS65086_IRQ_FAULT, 0, TPS65086_IRQ_FAULT_MASK),
};
static struct regmap_irq_chip tps65086_irq_chip = {
.name = "tps65086",
.status_base = TPS65086_IRQ,
.mask_base = TPS65086_IRQ_MASK,
.ack_base = TPS65086_IRQ,
.init_ack_masked = true,
.num_regs = 1,
.irqs = tps65086_irqs,
.num_irqs = ARRAY_SIZE(tps65086_irqs),
};
static const struct of_device_id tps65086_of_match_table[] = {
{ .compatible = "ti,tps65086", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, tps65086_of_match_table);
static int tps65086_probe(struct i2c_client *client,
const struct i2c_device_id *ids)
{
struct tps65086 *tps;
unsigned int version;
int ret;
tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
if (!tps)
return -ENOMEM;
i2c_set_clientdata(client, tps);
tps->dev = &client->dev;
tps->irq = client->irq;
tps->regmap = devm_regmap_init_i2c(client, &tps65086_regmap_config);
if (IS_ERR(tps->regmap)) {
dev_err(tps->dev, "Failed to initialize register map\n");
return PTR_ERR(tps->regmap);
}
ret = regmap_read(tps->regmap, TPS65086_DEVICEID, &version);
if (ret) {
dev_err(tps->dev, "Failed to read revision register\n");
return ret;
}
dev_info(tps->dev, "Device: TPS65086%01lX, OTP: %c, Rev: %ld\n",
(version & TPS65086_DEVICEID_PART_MASK),
(char)((version & TPS65086_DEVICEID_OTP_MASK) >> 4) + 'A',
(version & TPS65086_DEVICEID_REV_MASK) >> 6);
ret = regmap_add_irq_chip(tps->regmap, tps->irq, IRQF_ONESHOT, 0,
&tps65086_irq_chip, &tps->irq_data);
if (ret) {
dev_err(tps->dev, "Failed to register IRQ chip\n");
return ret;
}
ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65086_cells,
ARRAY_SIZE(tps65086_cells), NULL, 0,
regmap_irq_get_domain(tps->irq_data));
if (ret) {
regmap_del_irq_chip(tps->irq, tps->irq_data);
return ret;
}
return 0;
}
static int tps65086_remove(struct i2c_client *client)
{
struct tps65086 *tps = i2c_get_clientdata(client);
regmap_del_irq_chip(tps->irq, tps->irq_data);
return 0;
}
static const struct i2c_device_id tps65086_id_table[] = {
{ "tps65086", 0 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(i2c, tps65086_id_table);
static struct i2c_driver tps65086_driver = {
.driver = {
.name = "tps65086",
.of_match_table = tps65086_of_match_table,
},
.probe = tps65086_probe,
.remove = tps65086_remove,
.id_table = tps65086_id_table,
};
module_i2c_driver(tps65086_driver);
MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
MODULE_DESCRIPTION("TPS65086 PMIC Driver");
MODULE_LICENSE("GPL v2");
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/err.h> #include <linux/err.h>
#define NUM_INT_REG 2 #define NUM_INT_REG 2
#define TOTAL_NUM_REG 0x18
#define TPS65090_INT1_MASK_VAC_STATUS_CHANGE 1 #define TPS65090_INT1_MASK_VAC_STATUS_CHANGE 1
#define TPS65090_INT1_MASK_VSYS_STATUS_CHANGE 2 #define TPS65090_INT1_MASK_VSYS_STATUS_CHANGE 2
...@@ -161,8 +160,8 @@ static bool is_volatile_reg(struct device *dev, unsigned int reg) ...@@ -161,8 +160,8 @@ static bool is_volatile_reg(struct device *dev, unsigned int reg)
static const struct regmap_config tps65090_regmap_config = { static const struct regmap_config tps65090_regmap_config = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 8, .val_bits = 8,
.max_register = TOTAL_NUM_REG, .max_register = TPS65090_MAX_REG,
.num_reg_defaults_raw = TOTAL_NUM_REG, .num_reg_defaults_raw = TPS65090_NUM_REGS,
.cache_type = REGCACHE_RBTREE, .cache_type = REGCACHE_RBTREE,
.volatile_reg = is_volatile_reg, .volatile_reg = is_volatile_reg,
}; };
......
...@@ -297,7 +297,6 @@ static const struct reg_default wm5102_reg_default[] = { ...@@ -297,7 +297,6 @@ static const struct reg_default wm5102_reg_default[] = {
{ 0x00000174, 0x007D }, /* R372 - FLL1 Control 4 */ { 0x00000174, 0x007D }, /* R372 - FLL1 Control 4 */
{ 0x00000175, 0x0004 }, /* R373 - FLL1 Control 5 */ { 0x00000175, 0x0004 }, /* R373 - FLL1 Control 5 */
{ 0x00000176, 0x0000 }, /* R374 - FLL1 Control 6 */ { 0x00000176, 0x0000 }, /* R374 - FLL1 Control 6 */
{ 0x00000177, 0x0181 }, /* R375 - FLL1 Loop Filter Test 1 */
{ 0x00000179, 0x0000 }, /* R377 - FLL1 Control 7 */ { 0x00000179, 0x0000 }, /* R377 - FLL1 Control 7 */
{ 0x00000181, 0x0000 }, /* R385 - FLL1 Synchroniser 1 */ { 0x00000181, 0x0000 }, /* R385 - FLL1 Synchroniser 1 */
{ 0x00000182, 0x0000 }, /* R386 - FLL1 Synchroniser 2 */ { 0x00000182, 0x0000 }, /* R386 - FLL1 Synchroniser 2 */
...@@ -314,7 +313,6 @@ static const struct reg_default wm5102_reg_default[] = { ...@@ -314,7 +313,6 @@ static const struct reg_default wm5102_reg_default[] = {
{ 0x00000194, 0x007D }, /* R404 - FLL2 Control 4 */ { 0x00000194, 0x007D }, /* R404 - FLL2 Control 4 */
{ 0x00000195, 0x0004 }, /* R405 - FLL2 Control 5 */ { 0x00000195, 0x0004 }, /* R405 - FLL2 Control 5 */
{ 0x00000196, 0x0000 }, /* R406 - FLL2 Control 6 */ { 0x00000196, 0x0000 }, /* R406 - FLL2 Control 6 */
{ 0x00000197, 0x0000 }, /* R407 - FLL2 Loop Filter Test 1 */
{ 0x00000199, 0x0000 }, /* R409 - FLL2 Control 7 */ { 0x00000199, 0x0000 }, /* R409 - FLL2 Control 7 */
{ 0x000001A1, 0x0000 }, /* R417 - FLL2 Synchroniser 1 */ { 0x000001A1, 0x0000 }, /* R417 - FLL2 Synchroniser 1 */
{ 0x000001A2, 0x0000 }, /* R418 - FLL2 Synchroniser 2 */ { 0x000001A2, 0x0000 }, /* R418 - FLL2 Synchroniser 2 */
...@@ -338,7 +336,7 @@ static const struct reg_default wm5102_reg_default[] = { ...@@ -338,7 +336,7 @@ static const struct reg_default wm5102_reg_default[] = {
{ 0x000002A3, 0x1102 }, /* R675 - Mic Detect 1 */ { 0x000002A3, 0x1102 }, /* R675 - Mic Detect 1 */
{ 0x000002A4, 0x009F }, /* R676 - Mic Detect 2 */ { 0x000002A4, 0x009F }, /* R676 - Mic Detect 2 */
{ 0x000002A6, 0x3737 }, /* R678 - Mic Detect Level 1 */ { 0x000002A6, 0x3737 }, /* R678 - Mic Detect Level 1 */
{ 0x000002A7, 0x372C }, /* R679 - Mic Detect Level 2 */ { 0x000002A7, 0x2C37 }, /* R679 - Mic Detect Level 2 */
{ 0x000002A8, 0x1422 }, /* R680 - Mic Detect Level 3 */ { 0x000002A8, 0x1422 }, /* R680 - Mic Detect Level 3 */
{ 0x000002A9, 0x030A }, /* R681 - Mic Detect Level 4 */ { 0x000002A9, 0x030A }, /* R681 - Mic Detect Level 4 */
{ 0x000002C3, 0x0000 }, /* R707 - Mic noise mix control 1 */ { 0x000002C3, 0x0000 }, /* R707 - Mic noise mix control 1 */
...@@ -402,7 +400,7 @@ static const struct reg_default wm5102_reg_default[] = { ...@@ -402,7 +400,7 @@ static const struct reg_default wm5102_reg_default[] = {
{ 0x00000435, 0x0180 }, /* R1077 - DAC Digital Volume 5R */ { 0x00000435, 0x0180 }, /* R1077 - DAC Digital Volume 5R */
{ 0x00000436, 0x0081 }, /* R1078 - DAC Volume Limit 5R */ { 0x00000436, 0x0081 }, /* R1078 - DAC Volume Limit 5R */
{ 0x00000437, 0x0200 }, /* R1079 - Noise Gate Select 5R */ { 0x00000437, 0x0200 }, /* R1079 - Noise Gate Select 5R */
{ 0x00000440, 0x8FFF }, /* R1088 - DRE Enable */ { 0x00000440, 0x0FFF }, /* R1088 - DRE Enable */
{ 0x00000442, 0x3F0A }, /* R1090 - DRE Control 2 */ { 0x00000442, 0x3F0A }, /* R1090 - DRE Control 2 */
{ 0x00000443, 0xDC1F }, /* R1090 - DRE Control 3 */ { 0x00000443, 0xDC1F }, /* R1090 - DRE Control 3 */
{ 0x00000450, 0x0000 }, /* R1104 - DAC AEC Control 1 */ { 0x00000450, 0x0000 }, /* R1104 - DAC AEC Control 1 */
...@@ -863,7 +861,7 @@ static const struct reg_default wm5102_reg_default[] = { ...@@ -863,7 +861,7 @@ static const struct reg_default wm5102_reg_default[] = {
{ 0x00000C0F, 0x0400 }, /* R3087 - IRQ CTRL 1 */ { 0x00000C0F, 0x0400 }, /* R3087 - IRQ CTRL 1 */
{ 0x00000C10, 0x1000 }, /* R3088 - GPIO Debounce Config */ { 0x00000C10, 0x1000 }, /* R3088 - GPIO Debounce Config */
{ 0x00000C20, 0x8002 }, /* R3104 - Misc Pad Ctrl 1 */ { 0x00000C20, 0x8002 }, /* R3104 - Misc Pad Ctrl 1 */
{ 0x00000C21, 0x8001 }, /* R3105 - Misc Pad Ctrl 2 */ { 0x00000C21, 0x0001 }, /* R3105 - Misc Pad Ctrl 2 */
{ 0x00000C22, 0x0000 }, /* R3106 - Misc Pad Ctrl 3 */ { 0x00000C22, 0x0000 }, /* R3106 - Misc Pad Ctrl 3 */
{ 0x00000C23, 0x0000 }, /* R3107 - Misc Pad Ctrl 4 */ { 0x00000C23, 0x0000 }, /* R3107 - Misc Pad Ctrl 4 */
{ 0x00000C24, 0x0000 }, /* R3108 - Misc Pad Ctrl 5 */ { 0x00000C24, 0x0000 }, /* R3108 - Misc Pad Ctrl 5 */
...@@ -984,7 +982,7 @@ static const struct reg_default wm5102_reg_default[] = { ...@@ -984,7 +982,7 @@ static const struct reg_default wm5102_reg_default[] = {
{ 0x00000ECD, 0x0000 }, /* R3789 - HPLPF4_2 */ { 0x00000ECD, 0x0000 }, /* R3789 - HPLPF4_2 */
{ 0x00000EE0, 0x0000 }, /* R3808 - ASRC_ENABLE */ { 0x00000EE0, 0x0000 }, /* R3808 - ASRC_ENABLE */
{ 0x00000EE2, 0x0000 }, /* R3810 - ASRC_RATE1 */ { 0x00000EE2, 0x0000 }, /* R3810 - ASRC_RATE1 */
{ 0x00000EE3, 0x0400 }, /* R3811 - ASRC_RATE2 */ { 0x00000EE3, 0x4000 }, /* R3811 - ASRC_RATE2 */
{ 0x00000EF0, 0x0000 }, /* R3824 - ISRC 1 CTRL 1 */ { 0x00000EF0, 0x0000 }, /* R3824 - ISRC 1 CTRL 1 */
{ 0x00000EF1, 0x0000 }, /* R3825 - ISRC 1 CTRL 2 */ { 0x00000EF1, 0x0000 }, /* R3825 - ISRC 1 CTRL 2 */
{ 0x00000EF2, 0x0000 }, /* R3826 - ISRC 1 CTRL 3 */ { 0x00000EF2, 0x0000 }, /* R3826 - ISRC 1 CTRL 3 */
...@@ -1062,8 +1060,6 @@ static bool wm5102_readable_register(struct device *dev, unsigned int reg) ...@@ -1062,8 +1060,6 @@ static bool wm5102_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_FLL1_CONTROL_4: case ARIZONA_FLL1_CONTROL_4:
case ARIZONA_FLL1_CONTROL_5: case ARIZONA_FLL1_CONTROL_5:
case ARIZONA_FLL1_CONTROL_6: case ARIZONA_FLL1_CONTROL_6:
case ARIZONA_FLL1_LOOP_FILTER_TEST_1:
case ARIZONA_FLL1_NCO_TEST_0:
case ARIZONA_FLL1_CONTROL_7: case ARIZONA_FLL1_CONTROL_7:
case ARIZONA_FLL1_SYNCHRONISER_1: case ARIZONA_FLL1_SYNCHRONISER_1:
case ARIZONA_FLL1_SYNCHRONISER_2: case ARIZONA_FLL1_SYNCHRONISER_2:
...@@ -1080,8 +1076,6 @@ static bool wm5102_readable_register(struct device *dev, unsigned int reg) ...@@ -1080,8 +1076,6 @@ static bool wm5102_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_FLL2_CONTROL_4: case ARIZONA_FLL2_CONTROL_4:
case ARIZONA_FLL2_CONTROL_5: case ARIZONA_FLL2_CONTROL_5:
case ARIZONA_FLL2_CONTROL_6: case ARIZONA_FLL2_CONTROL_6:
case ARIZONA_FLL2_LOOP_FILTER_TEST_1:
case ARIZONA_FLL2_NCO_TEST_0:
case ARIZONA_FLL2_CONTROL_7: case ARIZONA_FLL2_CONTROL_7:
case ARIZONA_FLL2_SYNCHRONISER_1: case ARIZONA_FLL2_SYNCHRONISER_1:
case ARIZONA_FLL2_SYNCHRONISER_2: case ARIZONA_FLL2_SYNCHRONISER_2:
...@@ -1849,8 +1843,6 @@ static bool wm5102_volatile_register(struct device *dev, unsigned int reg) ...@@ -1849,8 +1843,6 @@ static bool wm5102_volatile_register(struct device *dev, unsigned int reg)
case ARIZONA_HAPTICS_STATUS: case ARIZONA_HAPTICS_STATUS:
case ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS: case ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS:
case ARIZONA_ASYNC_SAMPLE_RATE_2_STATUS: case ARIZONA_ASYNC_SAMPLE_RATE_2_STATUS:
case ARIZONA_FLL1_NCO_TEST_0:
case ARIZONA_FLL2_NCO_TEST_0:
case ARIZONA_DAC_COMP_1: case ARIZONA_DAC_COMP_1:
case ARIZONA_DAC_COMP_2: case ARIZONA_DAC_COMP_2:
case ARIZONA_DAC_COMP_3: case ARIZONA_DAC_COMP_3:
......
This diff is collapsed.
...@@ -229,8 +229,6 @@ static const struct reg_default wm8998_reg_default[] = { ...@@ -229,8 +229,6 @@ static const struct reg_default wm8998_reg_default[] = {
{ 0x00000174, 0x007D }, /* R372 - FLL1 Control 4 */ { 0x00000174, 0x007D }, /* R372 - FLL1 Control 4 */
{ 0x00000175, 0x0004 }, /* R373 - FLL1 Control 5 */ { 0x00000175, 0x0004 }, /* R373 - FLL1 Control 5 */
{ 0x00000176, 0x0000 }, /* R374 - FLL1 Control 6 */ { 0x00000176, 0x0000 }, /* R374 - FLL1 Control 6 */
{ 0x00000177, 0x0181 }, /* R375 - FLL1 Loop Filter Test 1 */
{ 0x00000178, 0x0000 }, /* R376 - FLL1 NCO Test 0 */
{ 0x00000179, 0x0000 }, /* R377 - FLL1 Control 7 */ { 0x00000179, 0x0000 }, /* R377 - FLL1 Control 7 */
{ 0x00000181, 0x0000 }, /* R385 - FLL1 Synchroniser 1 */ { 0x00000181, 0x0000 }, /* R385 - FLL1 Synchroniser 1 */
{ 0x00000182, 0x0000 }, /* R386 - FLL1 Synchroniser 2 */ { 0x00000182, 0x0000 }, /* R386 - FLL1 Synchroniser 2 */
...@@ -247,8 +245,6 @@ static const struct reg_default wm8998_reg_default[] = { ...@@ -247,8 +245,6 @@ static const struct reg_default wm8998_reg_default[] = {
{ 0x00000194, 0x007D }, /* R404 - FLL2 Control 4 */ { 0x00000194, 0x007D }, /* R404 - FLL2 Control 4 */
{ 0x00000195, 0x0004 }, /* R405 - FLL2 Control 5 */ { 0x00000195, 0x0004 }, /* R405 - FLL2 Control 5 */
{ 0x00000196, 0x0000 }, /* R406 - FLL2 Control 6 */ { 0x00000196, 0x0000 }, /* R406 - FLL2 Control 6 */
{ 0x00000197, 0x0000 }, /* R407 - FLL2 Loop Filter Test 1 */
{ 0x00000198, 0x0000 }, /* R408 - FLL2 NCO Test 0 */
{ 0x00000199, 0x0000 }, /* R409 - FLL2 Control 7 */ { 0x00000199, 0x0000 }, /* R409 - FLL2 Control 7 */
{ 0x000001A1, 0x0000 }, /* R417 - FLL2 Synchroniser 1 */ { 0x000001A1, 0x0000 }, /* R417 - FLL2 Synchroniser 1 */
{ 0x000001A2, 0x0000 }, /* R418 - FLL2 Synchroniser 2 */ { 0x000001A2, 0x0000 }, /* R418 - FLL2 Synchroniser 2 */
...@@ -320,7 +316,7 @@ static const struct reg_default wm8998_reg_default[] = { ...@@ -320,7 +316,7 @@ static const struct reg_default wm8998_reg_default[] = {
{ 0x00000434, 0x0000 }, /* R1076 - Output Path Config 5R */ { 0x00000434, 0x0000 }, /* R1076 - Output Path Config 5R */
{ 0x00000435, 0x0180 }, /* R1077 - DAC Digital Volume 5R */ { 0x00000435, 0x0180 }, /* R1077 - DAC Digital Volume 5R */
{ 0x00000437, 0x0200 }, /* R1079 - Noise Gate Select 5R */ { 0x00000437, 0x0200 }, /* R1079 - Noise Gate Select 5R */
{ 0x00000440, 0x8FFF }, /* R1088 - DRE Enable */ { 0x00000440, 0x002F }, /* R1088 - DRE Enable */
{ 0x00000441, 0xC759 }, /* R1089 - DRE Control 1 */ { 0x00000441, 0xC759 }, /* R1089 - DRE Control 1 */
{ 0x00000442, 0x2A08 }, /* R1089 - DRE Control 2 */ { 0x00000442, 0x2A08 }, /* R1089 - DRE Control 2 */
{ 0x00000443, 0x5CFA }, /* R1089 - DRE Control 3 */ { 0x00000443, 0x5CFA }, /* R1089 - DRE Control 3 */
...@@ -686,7 +682,7 @@ static const struct reg_default wm8998_reg_default[] = { ...@@ -686,7 +682,7 @@ static const struct reg_default wm8998_reg_default[] = {
{ 0x00000C10, 0x1000 }, /* R3088 - GPIO Debounce Config */ { 0x00000C10, 0x1000 }, /* R3088 - GPIO Debounce Config */
{ 0x00000C18, 0x0000 }, /* R3096 - GP Switch 1 */ { 0x00000C18, 0x0000 }, /* R3096 - GP Switch 1 */
{ 0x00000C20, 0x8002 }, /* R3104 - Misc Pad Ctrl 1 */ { 0x00000C20, 0x8002 }, /* R3104 - Misc Pad Ctrl 1 */
{ 0x00000C21, 0x8001 }, /* R3105 - Misc Pad Ctrl 2 */ { 0x00000C21, 0x0001 }, /* R3105 - Misc Pad Ctrl 2 */
{ 0x00000C22, 0x0000 }, /* R3106 - Misc Pad Ctrl 3 */ { 0x00000C22, 0x0000 }, /* R3106 - Misc Pad Ctrl 3 */
{ 0x00000C23, 0x0000 }, /* R3107 - Misc Pad Ctrl 4 */ { 0x00000C23, 0x0000 }, /* R3107 - Misc Pad Ctrl 4 */
{ 0x00000C24, 0x0000 }, /* R3108 - Misc Pad Ctrl 5 */ { 0x00000C24, 0x0000 }, /* R3108 - Misc Pad Ctrl 5 */
...@@ -888,8 +884,6 @@ static bool wm8998_readable_register(struct device *dev, unsigned int reg) ...@@ -888,8 +884,6 @@ static bool wm8998_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_FLL1_CONTROL_5: case ARIZONA_FLL1_CONTROL_5:
case ARIZONA_FLL1_CONTROL_6: case ARIZONA_FLL1_CONTROL_6:
case ARIZONA_FLL1_CONTROL_7: case ARIZONA_FLL1_CONTROL_7:
case ARIZONA_FLL1_LOOP_FILTER_TEST_1:
case ARIZONA_FLL1_NCO_TEST_0:
case ARIZONA_FLL1_SYNCHRONISER_1: case ARIZONA_FLL1_SYNCHRONISER_1:
case ARIZONA_FLL1_SYNCHRONISER_2: case ARIZONA_FLL1_SYNCHRONISER_2:
case ARIZONA_FLL1_SYNCHRONISER_3: case ARIZONA_FLL1_SYNCHRONISER_3:
...@@ -906,8 +900,6 @@ static bool wm8998_readable_register(struct device *dev, unsigned int reg) ...@@ -906,8 +900,6 @@ static bool wm8998_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_FLL2_CONTROL_5: case ARIZONA_FLL2_CONTROL_5:
case ARIZONA_FLL2_CONTROL_6: case ARIZONA_FLL2_CONTROL_6:
case ARIZONA_FLL2_CONTROL_7: case ARIZONA_FLL2_CONTROL_7:
case ARIZONA_FLL2_LOOP_FILTER_TEST_1:
case ARIZONA_FLL2_NCO_TEST_0:
case ARIZONA_FLL2_SYNCHRONISER_1: case ARIZONA_FLL2_SYNCHRONISER_1:
case ARIZONA_FLL2_SYNCHRONISER_2: case ARIZONA_FLL2_SYNCHRONISER_2:
case ARIZONA_FLL2_SYNCHRONISER_3: case ARIZONA_FLL2_SYNCHRONISER_3:
......
...@@ -238,6 +238,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) ...@@ -238,6 +238,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
step = 75; step = 75;
break; break;
case AXP221_ID: case AXP221_ID:
case AXP223_ID:
min = 1800; min = 1800;
max = 4050; max = 4050;
def = 3000; def = 3000;
...@@ -316,6 +317,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work ...@@ -316,6 +317,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
break; break;
case AXP221_ID: case AXP221_ID:
case AXP223_ID:
if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5) if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5)
return -EINVAL; return -EINVAL;
...@@ -354,6 +356,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev) ...@@ -354,6 +356,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
nregulators = AXP20X_REG_ID_MAX; nregulators = AXP20X_REG_ID_MAX;
break; break;
case AXP221_ID: case AXP221_ID:
case AXP223_ID:
regulators = axp22x_regulators; regulators = axp22x_regulators;
nregulators = AXP22X_REG_ID_MAX; nregulators = AXP22X_REG_ID_MAX;
break; break;
......
/*
* This header provides constants for configuring the I.MX25 ADC
*/
#ifndef _DT_BINDINGS_IIO_ADC_FS_IMX25_GCQ_H
#define _DT_BINDINGS_IIO_ADC_FS_IMX25_GCQ_H
#define MX25_ADC_REFP_YP 0 /* YP voltage reference */
#define MX25_ADC_REFP_XP 1 /* XP voltage reference */
#define MX25_ADC_REFP_EXT 2 /* External voltage reference */
#define MX25_ADC_REFP_INT 3 /* Internal voltage reference */
#define MX25_ADC_REFN_XN 0 /* XN ground reference */
#define MX25_ADC_REFN_YN 1 /* YN ground reference */
#define MX25_ADC_REFN_NGND 2 /* Internal ground reference */
#define MX25_ADC_REFN_NGND2 3 /* External ground reference */
#endif
...@@ -51,7 +51,8 @@ ...@@ -51,7 +51,8 @@
#define AS3711_ASIC_ID_1 0x90 #define AS3711_ASIC_ID_1 0x90
#define AS3711_ASIC_ID_2 0x91 #define AS3711_ASIC_ID_2 0x91
#define AS3711_MAX_REGS 0x92 #define AS3711_MAX_REG AS3711_ASIC_ID_2
#define AS3711_NUM_REGS (AS3711_MAX_REG + 1)
/* Regulators */ /* Regulators */
enum { enum {
......
...@@ -18,6 +18,7 @@ enum { ...@@ -18,6 +18,7 @@ enum {
AXP202_ID, AXP202_ID,
AXP209_ID, AXP209_ID,
AXP221_ID, AXP221_ID,
AXP223_ID,
AXP288_ID, AXP288_ID,
NR_AXP20X_VARIANTS, NR_AXP20X_VARIANTS,
}; };
...@@ -396,7 +397,7 @@ enum axp288_irqs { ...@@ -396,7 +397,7 @@ enum axp288_irqs {
struct axp20x_dev { struct axp20x_dev {
struct device *dev; struct device *dev;
struct i2c_client *i2c_client; int irq;
struct regmap *regmap; struct regmap *regmap;
struct regmap_irq_chip_data *regmap_irqc; struct regmap_irq_chip_data *regmap_irqc;
long variant; long variant;
...@@ -462,4 +463,35 @@ static inline int axp20x_read_variable_width(struct regmap *regmap, ...@@ -462,4 +463,35 @@ static inline int axp20x_read_variable_width(struct regmap *regmap,
return result; return result;
} }
/**
* axp20x_match_device(): Setup axp20x variant related fields
*
* @axp20x: axp20x device to setup (.dev field must be set)
* @dev: device associated with this axp20x device
*
* This lets the axp20x core configure the mfd cells and register maps
* for later use.
*/
int axp20x_match_device(struct axp20x_dev *axp20x);
/**
* axp20x_device_probe(): Probe a configured axp20x device
*
* @axp20x: axp20x device to probe (must be configured)
*
* This function lets the axp20x core register the axp20x mfd devices
* and irqchip. The axp20x device passed in must be fully configured
* with axp20x_match_device, its irq set, and regmap created.
*/
int axp20x_device_probe(struct axp20x_dev *axp20x);
/**
* axp20x_device_probe(): Remove a axp20x device
*
* @axp20x: axp20x device to remove
*
* This tells the axp20x core to remove the associated mfd devices
*/
int axp20x_device_remove(struct axp20x_dev *axp20x);
#endif /* __LINUX_MFD_AXP20X_H */ #endif /* __LINUX_MFD_AXP20X_H */
...@@ -245,7 +245,7 @@ int cros_ec_remove(struct cros_ec_device *ec_dev); ...@@ -245,7 +245,7 @@ int cros_ec_remove(struct cros_ec_device *ec_dev);
int cros_ec_register(struct cros_ec_device *ec_dev); int cros_ec_register(struct cros_ec_device *ec_dev);
/** /**
* cros_ec_register - Query the protocol version supported by the ChromeOS EC * cros_ec_query_all - Query the protocol version supported by the ChromeOS EC
* *
* @ec_dev: Device to register * @ec_dev: Device to register
* @return 0 if ok, -ve on error * @return 0 if ok, -ve on error
......
#ifndef _LINUX_INCLUDE_MFD_IMX25_TSADC_H_
#define _LINUX_INCLUDE_MFD_IMX25_TSADC_H_
struct regmap;
struct clk;
struct mx25_tsadc {
struct regmap *regs;
struct irq_domain *domain;
struct clk *clk;
};
#define MX25_TSC_TGCR 0x00
#define MX25_TSC_TGSR 0x04
#define MX25_TSC_TICR 0x08
/* The same register layout for TC and GC queue */
#define MX25_ADCQ_FIFO 0x00
#define MX25_ADCQ_CR 0x04
#define MX25_ADCQ_SR 0x08
#define MX25_ADCQ_MR 0x0c
#define MX25_ADCQ_ITEM_7_0 0x20
#define MX25_ADCQ_ITEM_15_8 0x24
#define MX25_ADCQ_CFG(n) (0x40 + ((n) * 0x4))
#define MX25_ADCQ_MR_MASK 0xffffffff
/* TGCR */
#define MX25_TGCR_PDBTIME(x) ((x) << 25)
#define MX25_TGCR_PDBTIME_MASK GENMASK(31, 25)
#define MX25_TGCR_PDBEN BIT(24)
#define MX25_TGCR_PDEN BIT(23)
#define MX25_TGCR_ADCCLKCFG(x) ((x) << 16)
#define MX25_TGCR_GET_ADCCLK(x) (((x) >> 16) & 0x1f)
#define MX25_TGCR_INTREFEN BIT(10)
#define MX25_TGCR_POWERMODE_MASK GENMASK(9, 8)
#define MX25_TGCR_POWERMODE_SAVE (1 << 8)
#define MX25_TGCR_POWERMODE_ON (2 << 8)
#define MX25_TGCR_STLC BIT(5)
#define MX25_TGCR_SLPC BIT(4)
#define MX25_TGCR_FUNC_RST BIT(2)
#define MX25_TGCR_TSC_RST BIT(1)
#define MX25_TGCR_CLK_EN BIT(0)
/* TGSR */
#define MX25_TGSR_SLP_INT BIT(2)
#define MX25_TGSR_GCQ_INT BIT(1)
#define MX25_TGSR_TCQ_INT BIT(0)
/* ADCQ_ITEM_* */
#define _MX25_ADCQ_ITEM(item, x) ((x) << ((item) * 4))
#define MX25_ADCQ_ITEM(item, x) ((item) >= 8 ? \
_MX25_ADCQ_ITEM((item) - 8, (x)) : _MX25_ADCQ_ITEM((item), (x)))
/* ADCQ_FIFO (TCQFIFO and GCQFIFO) */
#define MX25_ADCQ_FIFO_DATA(x) (((x) >> 4) & 0xfff)
#define MX25_ADCQ_FIFO_ID(x) ((x) & 0xf)
/* ADCQ_CR (TCQR and GCQR) */
#define MX25_ADCQ_CR_PDCFG_LEVEL BIT(19)
#define MX25_ADCQ_CR_PDMSK BIT(18)
#define MX25_ADCQ_CR_FRST BIT(17)
#define MX25_ADCQ_CR_QRST BIT(16)
#define MX25_ADCQ_CR_RWAIT_MASK GENMASK(15, 12)
#define MX25_ADCQ_CR_RWAIT(x) ((x) << 12)
#define MX25_ADCQ_CR_WMRK_MASK GENMASK(11, 8)
#define MX25_ADCQ_CR_WMRK(x) ((x) << 8)
#define MX25_ADCQ_CR_LITEMID_MASK (0xf << 4)
#define MX25_ADCQ_CR_LITEMID(x) ((x) << 4)
#define MX25_ADCQ_CR_RPT BIT(3)
#define MX25_ADCQ_CR_FQS BIT(2)
#define MX25_ADCQ_CR_QSM_MASK GENMASK(1, 0)
#define MX25_ADCQ_CR_QSM_PD 0x1
#define MX25_ADCQ_CR_QSM_FQS 0x2
#define MX25_ADCQ_CR_QSM_FQS_PD 0x3
/* ADCQ_SR (TCQSR and GCQSR) */
#define MX25_ADCQ_SR_FDRY BIT(15)
#define MX25_ADCQ_SR_FULL BIT(14)
#define MX25_ADCQ_SR_EMPT BIT(13)
#define MX25_ADCQ_SR_FDN(x) (((x) >> 8) & 0x1f)
#define MX25_ADCQ_SR_FRR BIT(6)
#define MX25_ADCQ_SR_FUR BIT(5)
#define MX25_ADCQ_SR_FOR BIT(4)
#define MX25_ADCQ_SR_EOQ BIT(1)
#define MX25_ADCQ_SR_PD BIT(0)
/* ADCQ_MR (TCQMR and GCQMR) */
#define MX25_ADCQ_MR_FDRY_DMA BIT(31)
#define MX25_ADCQ_MR_FER_DMA BIT(22)
#define MX25_ADCQ_MR_FUR_DMA BIT(21)
#define MX25_ADCQ_MR_FOR_DMA BIT(20)
#define MX25_ADCQ_MR_EOQ_DMA BIT(17)
#define MX25_ADCQ_MR_PD_DMA BIT(16)
#define MX25_ADCQ_MR_FDRY_IRQ BIT(15)
#define MX25_ADCQ_MR_FER_IRQ BIT(6)
#define MX25_ADCQ_MR_FUR_IRQ BIT(5)
#define MX25_ADCQ_MR_FOR_IRQ BIT(4)
#define MX25_ADCQ_MR_EOQ_IRQ BIT(1)
#define MX25_ADCQ_MR_PD_IRQ BIT(0)
/* ADCQ_CFG (TICR, TCC0-7,GCC0-7) */
#define MX25_ADCQ_CFG_SETTLING_TIME(x) ((x) << 24)
#define MX25_ADCQ_CFG_IGS (1 << 20)
#define MX25_ADCQ_CFG_NOS_MASK GENMASK(19, 16)
#define MX25_ADCQ_CFG_NOS(x) (((x) - 1) << 16)
#define MX25_ADCQ_CFG_WIPER (1 << 15)
#define MX25_ADCQ_CFG_YNLR (1 << 14)
#define MX25_ADCQ_CFG_YPLL_HIGH (0 << 12)
#define MX25_ADCQ_CFG_YPLL_OFF (1 << 12)
#define MX25_ADCQ_CFG_YPLL_LOW (3 << 12)
#define MX25_ADCQ_CFG_XNUR_HIGH (0 << 10)
#define MX25_ADCQ_CFG_XNUR_OFF (1 << 10)
#define MX25_ADCQ_CFG_XNUR_LOW (3 << 10)
#define MX25_ADCQ_CFG_XPUL_HIGH (0 << 9)
#define MX25_ADCQ_CFG_XPUL_OFF (1 << 9)
#define MX25_ADCQ_CFG_REFP(sel) ((sel) << 7)
#define MX25_ADCQ_CFG_REFP_YP MX25_ADCQ_CFG_REFP(0)
#define MX25_ADCQ_CFG_REFP_XP MX25_ADCQ_CFG_REFP(1)
#define MX25_ADCQ_CFG_REFP_EXT MX25_ADCQ_CFG_REFP(2)
#define MX25_ADCQ_CFG_REFP_INT MX25_ADCQ_CFG_REFP(3)
#define MX25_ADCQ_CFG_REFP_MASK GENMASK(8, 7)
#define MX25_ADCQ_CFG_IN(sel) ((sel) << 4)
#define MX25_ADCQ_CFG_IN_XP MX25_ADCQ_CFG_IN(0)
#define MX25_ADCQ_CFG_IN_YP MX25_ADCQ_CFG_IN(1)
#define MX25_ADCQ_CFG_IN_XN MX25_ADCQ_CFG_IN(2)
#define MX25_ADCQ_CFG_IN_YN MX25_ADCQ_CFG_IN(3)
#define MX25_ADCQ_CFG_IN_WIPER MX25_ADCQ_CFG_IN(4)
#define MX25_ADCQ_CFG_IN_AUX0 MX25_ADCQ_CFG_IN(5)
#define MX25_ADCQ_CFG_IN_AUX1 MX25_ADCQ_CFG_IN(6)
#define MX25_ADCQ_CFG_IN_AUX2 MX25_ADCQ_CFG_IN(7)
#define MX25_ADCQ_CFG_REFN(sel) ((sel) << 2)
#define MX25_ADCQ_CFG_REFN_XN MX25_ADCQ_CFG_REFN(0)
#define MX25_ADCQ_CFG_REFN_YN MX25_ADCQ_CFG_REFN(1)
#define MX25_ADCQ_CFG_REFN_NGND MX25_ADCQ_CFG_REFN(2)
#define MX25_ADCQ_CFG_REFN_NGND2 MX25_ADCQ_CFG_REFN(3)
#define MX25_ADCQ_CFG_REFN_MASK GENMASK(3, 2)
#define MX25_ADCQ_CFG_PENIACK (1 << 1)
#endif /* _LINUX_INCLUDE_MFD_IMX25_TSADC_H_ */
/*
* Copyright (c) 2016 Chen Zhong <chen.zhong@mediatek.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.
*/
#ifndef __MFD_MT6323_CORE_H__
#define __MFD_MT6323_CORE_H__
enum MT6323_IRQ_STATUS_numbers {
MT6323_IRQ_STATUS_SPKL_AB = 0,
MT6323_IRQ_STATUS_SPKL,
MT6323_IRQ_STATUS_BAT_L,
MT6323_IRQ_STATUS_BAT_H,
MT6323_IRQ_STATUS_WATCHDOG,
MT6323_IRQ_STATUS_PWRKEY,
MT6323_IRQ_STATUS_THR_L,
MT6323_IRQ_STATUS_THR_H,
MT6323_IRQ_STATUS_VBATON_UNDET,
MT6323_IRQ_STATUS_BVALID_DET,
MT6323_IRQ_STATUS_CHRDET,
MT6323_IRQ_STATUS_OV,
MT6323_IRQ_STATUS_LDO = 16,
MT6323_IRQ_STATUS_FCHRKEY,
MT6323_IRQ_STATUS_ACCDET,
MT6323_IRQ_STATUS_AUDIO,
MT6323_IRQ_STATUS_RTC,
MT6323_IRQ_STATUS_VPROC,
MT6323_IRQ_STATUS_VSYS,
MT6323_IRQ_STATUS_VPA,
MT6323_IRQ_STATUS_NR,
};
#endif /* __MFD_MT6323_CORE_H__ */
This diff is collapsed.
...@@ -60,6 +60,8 @@ struct mt6397_chip { ...@@ -60,6 +60,8 @@ struct mt6397_chip {
u16 wake_mask[2]; u16 wake_mask[2];
u16 irq_masks_cur[2]; u16 irq_masks_cur[2];
u16 irq_masks_cache[2]; u16 irq_masks_cache[2];
u16 int_con[2];
u16 int_status[2];
}; };
#endif /* __MFD_MT6397_CORE_H__ */ #endif /* __MFD_MT6397_CORE_H__ */
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#define RC5T583_MAX_REGS 0xF8
/* Maximum number of main interrupts */ /* Maximum number of main interrupts */
#define MAX_MAIN_INTERRUPT 5 #define MAX_MAIN_INTERRUPT 5
#define RC5T583_MAX_GPEDGE_REG 2 #define RC5T583_MAX_GPEDGE_REG 2
...@@ -169,6 +167,9 @@ ...@@ -169,6 +167,9 @@
#define RC5T583_RTC_AY_MONTH 0xF3 #define RC5T583_RTC_AY_MONTH 0xF3
#define RC5T583_RTC_AY_YEAR 0xF4 #define RC5T583_RTC_AY_YEAR 0xF4
#define RC5T583_MAX_REG 0xF7
#define RC5T583_NUM_REGS (RC5T583_MAX_REG + 1)
/* RICOH_RC5T583 IRQ definitions */ /* RICOH_RC5T583 IRQ definitions */
enum { enum {
RC5T583_IRQ_ONKEY, RC5T583_IRQ_ONKEY,
......
...@@ -29,24 +29,24 @@ extern struct regmap *syscon_regmap_lookup_by_phandle( ...@@ -29,24 +29,24 @@ extern struct regmap *syscon_regmap_lookup_by_phandle(
#else #else
static inline struct regmap *syscon_node_to_regmap(struct device_node *np) static inline struct regmap *syscon_node_to_regmap(struct device_node *np)
{ {
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOTSUPP);
} }
static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s) static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s)
{ {
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOTSUPP);
} }
static inline struct regmap *syscon_regmap_lookup_by_pdevname(const char *s) static inline struct regmap *syscon_regmap_lookup_by_pdevname(const char *s)
{ {
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOTSUPP);
} }
static inline struct regmap *syscon_regmap_lookup_by_phandle( static inline struct regmap *syscon_regmap_lookup_by_phandle(
struct device_node *np, struct device_node *np,
const char *property) const char *property)
{ {
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOTSUPP);
} }
#endif #endif
......
...@@ -422,6 +422,7 @@ ...@@ -422,6 +422,7 @@
#define IMX6SX_GPR5_VADC_TO_CSI_CAPTURE_EN_MASK (0x1 << 26) #define IMX6SX_GPR5_VADC_TO_CSI_CAPTURE_EN_MASK (0x1 << 26)
#define IMX6SX_GPR5_VADC_TO_CSI_CAPTURE_EN_ENABLE (0x1 << 26) #define IMX6SX_GPR5_VADC_TO_CSI_CAPTURE_EN_ENABLE (0x1 << 26)
#define IMX6SX_GPR5_VADC_TO_CSI_CAPTURE_EN_DISABLE (0x0 << 26) #define IMX6SX_GPR5_VADC_TO_CSI_CAPTURE_EN_DISABLE (0x0 << 26)
#define IMX6SX_GPR5_PCIE_BTNRST_RESET BIT(19)
#define IMX6SX_GPR5_CSI1_MUX_CTRL_MASK (0x3 << 4) #define IMX6SX_GPR5_CSI1_MUX_CTRL_MASK (0x3 << 4)
#define IMX6SX_GPR5_CSI1_MUX_CTRL_EXT_PIN (0x0 << 4) #define IMX6SX_GPR5_CSI1_MUX_CTRL_EXT_PIN (0x0 << 4)
#define IMX6SX_GPR5_CSI1_MUX_CTRL_CVD (0x1 << 4) #define IMX6SX_GPR5_CSI1_MUX_CTRL_CVD (0x1 << 4)
...@@ -435,6 +436,10 @@ ...@@ -435,6 +436,10 @@
#define IMX6SX_GPR5_DISP_MUX_DCIC1_LVDS (0x1 << 1) #define IMX6SX_GPR5_DISP_MUX_DCIC1_LVDS (0x1 << 1)
#define IMX6SX_GPR5_DISP_MUX_DCIC1_MASK (0x1 << 1) #define IMX6SX_GPR5_DISP_MUX_DCIC1_MASK (0x1 << 1)
#define IMX6SX_GPR12_PCIE_TEST_POWERDOWN BIT(30)
#define IMX6SX_GPR12_PCIE_RX_EQ_MASK (0x7 << 0)
#define IMX6SX_GPR12_PCIE_RX_EQ_2 (0x2 << 0)
/* For imx6ul iomux gpr register field define */ /* For imx6ul iomux gpr register field define */
#define IMX6UL_GPR1_ENET1_CLK_DIR (0x1 << 17) #define IMX6UL_GPR1_ENET1_CLK_DIR (0x1 << 17)
#define IMX6UL_GPR1_ENET2_CLK_DIR (0x1 << 18) #define IMX6UL_GPR1_ENET2_CLK_DIR (0x1 << 18)
......
/*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
* Andrew F. Davis <afd@ti.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.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether expressed or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License version 2 for more details.
*
* Based on the TPS65912 driver
*/
#ifndef __LINUX_MFD_TPS65086_H
#define __LINUX_MFD_TPS65086_H
#include <linux/device.h>
#include <linux/regmap.h>
/* List of registers for TPS65086 */
#define TPS65086_DEVICEID 0x01
#define TPS65086_IRQ 0x02
#define TPS65086_IRQ_MASK 0x03
#define TPS65086_PMICSTAT 0x04
#define TPS65086_SHUTDNSRC 0x05
#define TPS65086_BUCK1CTRL 0x20
#define TPS65086_BUCK2CTRL 0x21
#define TPS65086_BUCK3DECAY 0x22
#define TPS65086_BUCK3VID 0x23
#define TPS65086_BUCK3SLPCTRL 0x24
#define TPS65086_BUCK4CTRL 0x25
#define TPS65086_BUCK5CTRL 0x26
#define TPS65086_BUCK6CTRL 0x27
#define TPS65086_LDOA2CTRL 0x28
#define TPS65086_LDOA3CTRL 0x29
#define TPS65086_DISCHCTRL1 0x40
#define TPS65086_DISCHCTRL2 0x41
#define TPS65086_DISCHCTRL3 0x42
#define TPS65086_PG_DELAY1 0x43
#define TPS65086_FORCESHUTDN 0x91
#define TPS65086_BUCK1SLPCTRL 0x92
#define TPS65086_BUCK2SLPCTRL 0x93
#define TPS65086_BUCK4VID 0x94
#define TPS65086_BUCK4SLPVID 0x95
#define TPS65086_BUCK5VID 0x96
#define TPS65086_BUCK5SLPVID 0x97
#define TPS65086_BUCK6VID 0x98
#define TPS65086_BUCK6SLPVID 0x99
#define TPS65086_LDOA2VID 0x9A
#define TPS65086_LDOA3VID 0x9B
#define TPS65086_BUCK123CTRL 0x9C
#define TPS65086_PG_DELAY2 0x9D
#define TPS65086_PIN_EN_MASK1 0x9E
#define TPS65086_PIN_EN_MASK2 0x9F
#define TPS65086_SWVTT_EN 0x9F
#define TPS65086_PIN_EN_OVR1 0xA0
#define TPS65086_PIN_EN_OVR2 0xA1
#define TPS65086_GPOCTRL 0xA1
#define TPS65086_PWR_FAULT_MASK1 0xA2
#define TPS65086_PWR_FAULT_MASK2 0xA3
#define TPS65086_GPO1PG_CTRL1 0xA4
#define TPS65086_GPO1PG_CTRL2 0xA5
#define TPS65086_GPO4PG_CTRL1 0xA6
#define TPS65086_GPO4PG_CTRL2 0xA7
#define TPS65086_GPO2PG_CTRL1 0xA8
#define TPS65086_GPO2PG_CTRL2 0xA9
#define TPS65086_GPO3PG_CTRL1 0xAA
#define TPS65086_GPO3PG_CTRL2 0xAB
#define TPS65086_LDOA1CTRL 0xAE
#define TPS65086_PG_STATUS1 0xB0
#define TPS65086_PG_STATUS2 0xB1
#define TPS65086_PWR_FAULT_STATUS1 0xB2
#define TPS65086_PWR_FAULT_STATUS2 0xB3
#define TPS65086_TEMPCRIT 0xB4
#define TPS65086_TEMPHOT 0xB5
#define TPS65086_OC_STATUS 0xB6
/* IRQ Register field definitions */
#define TPS65086_IRQ_DIETEMP_MASK BIT(0)
#define TPS65086_IRQ_SHUTDN_MASK BIT(3)
#define TPS65086_IRQ_FAULT_MASK BIT(7)
/* DEVICEID Register field definitions */
#define TPS65086_DEVICEID_PART_MASK GENMASK(3, 0)
#define TPS65086_DEVICEID_OTP_MASK GENMASK(5, 4)
#define TPS65086_DEVICEID_REV_MASK GENMASK(7, 6)
/* VID Masks */
#define BUCK_VID_MASK GENMASK(7, 1)
#define VDOA1_VID_MASK GENMASK(4, 1)
#define VDOA23_VID_MASK GENMASK(3, 0)
/* Define the TPS65086 IRQ numbers */
enum tps65086_irqs {
TPS65086_IRQ_DIETEMP,
TPS65086_IRQ_SHUTDN,
TPS65086_IRQ_FAULT,
};
/**
* struct tps65086 - state holder for the tps65086 driver
*
* Device data may be used to access the TPS65086 chip
*/
struct tps65086 {
struct device *dev;
struct regmap *regmap;
/* IRQ Data */
int irq;
struct regmap_irq_chip_data *irq_data;
};
#endif /* __LINUX_MFD_TPS65086_H */
...@@ -77,6 +77,11 @@ enum { ...@@ -77,6 +77,11 @@ enum {
#define TPS65090_REG_CG_CTRL5 0x09 #define TPS65090_REG_CG_CTRL5 0x09
#define TPS65090_REG_CG_STATUS1 0x0a #define TPS65090_REG_CG_STATUS1 0x0a
#define TPS65090_REG_CG_STATUS2 0x0b #define TPS65090_REG_CG_STATUS2 0x0b
#define TPS65090_REG_AD_OUT1 0x17
#define TPS65090_REG_AD_OUT2 0x18
#define TPS65090_MAX_REG TPS65090_REG_AD_OUT2
#define TPS65090_NUM_REGS (TPS65090_MAX_REG + 1)
struct tps65090 { struct tps65090 {
struct device *dev; struct device *dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment