mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
/*
|
|
|
|
* Base driver for Marvell 88PM805
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Marvell International Ltd.
|
|
|
|
* Haojian Zhuang <haojian.zhuang@marvell.com>
|
|
|
|
* Joseph(Yossi) Hanin <yhanin@marvell.com>
|
|
|
|
* Qiao Zhou <zhouqiao@marvell.com>
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General
|
|
|
|
* Public License. See the file "COPYING" in the main directory of this
|
|
|
|
* archive for more details.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/mfd/core.h>
|
|
|
|
#include <linux/mfd/88pm80x.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
|
|
|
|
static const struct i2c_device_id pm80x_id_table[] = {
|
2013-06-14 07:21:51 +02:00
|
|
|
{"88PM805", 0},
|
2012-07-09 15:11:46 +02:00
|
|
|
{} /* NULL terminated */
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(i2c, pm80x_id_table);
|
|
|
|
|
|
|
|
/* Interrupt Number in 88PM805 */
|
|
|
|
enum {
|
|
|
|
PM805_IRQ_LDO_OFF, /*0 */
|
|
|
|
PM805_IRQ_SRC_DPLL_LOCK, /*1 */
|
|
|
|
PM805_IRQ_CLIP_FAULT,
|
|
|
|
PM805_IRQ_MIC_CONFLICT,
|
|
|
|
PM805_IRQ_HP2_SHRT,
|
|
|
|
PM805_IRQ_HP1_SHRT, /*5 */
|
|
|
|
PM805_IRQ_FINE_PLL_FAULT,
|
|
|
|
PM805_IRQ_RAW_PLL_FAULT,
|
|
|
|
PM805_IRQ_VOLP_BTN_DET,
|
|
|
|
PM805_IRQ_VOLM_BTN_DET,
|
|
|
|
PM805_IRQ_SHRT_BTN_DET, /*10 */
|
|
|
|
PM805_IRQ_MIC_DET, /*11 */
|
|
|
|
|
|
|
|
PM805_MAX_IRQ,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource codec_resources[] = {
|
|
|
|
{
|
|
|
|
/* Headset microphone insertion or removal */
|
|
|
|
.name = "micin",
|
|
|
|
.start = PM805_IRQ_MIC_DET,
|
|
|
|
.end = PM805_IRQ_MIC_DET,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
/* Audio short HP1 */
|
|
|
|
.name = "audio-short1",
|
|
|
|
.start = PM805_IRQ_HP1_SHRT,
|
|
|
|
.end = PM805_IRQ_HP1_SHRT,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
/* Audio short HP2 */
|
|
|
|
.name = "audio-short2",
|
|
|
|
.start = PM805_IRQ_HP2_SHRT,
|
|
|
|
.end = PM805_IRQ_HP2_SHRT,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2013-11-18 14:32:59 +01:00
|
|
|
static const struct mfd_cell codec_devs[] = {
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
{
|
|
|
|
.name = "88pm80x-codec",
|
|
|
|
.num_resources = ARRAY_SIZE(codec_resources),
|
|
|
|
.resources = &codec_resources[0],
|
|
|
|
.id = -1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regmap_irq pm805_irqs[] = {
|
|
|
|
/* INT0 */
|
|
|
|
[PM805_IRQ_LDO_OFF] = {
|
|
|
|
.mask = PM805_INT1_HP1_SHRT,
|
|
|
|
},
|
|
|
|
[PM805_IRQ_SRC_DPLL_LOCK] = {
|
|
|
|
.mask = PM805_INT1_HP2_SHRT,
|
|
|
|
},
|
|
|
|
[PM805_IRQ_CLIP_FAULT] = {
|
|
|
|
.mask = PM805_INT1_MIC_CONFLICT,
|
|
|
|
},
|
|
|
|
[PM805_IRQ_MIC_CONFLICT] = {
|
|
|
|
.mask = PM805_INT1_CLIP_FAULT,
|
|
|
|
},
|
|
|
|
[PM805_IRQ_HP2_SHRT] = {
|
|
|
|
.mask = PM805_INT1_LDO_OFF,
|
|
|
|
},
|
|
|
|
[PM805_IRQ_HP1_SHRT] = {
|
|
|
|
.mask = PM805_INT1_SRC_DPLL_LOCK,
|
|
|
|
},
|
|
|
|
/* INT1 */
|
|
|
|
[PM805_IRQ_FINE_PLL_FAULT] = {
|
|
|
|
.reg_offset = 1,
|
|
|
|
.mask = PM805_INT2_MIC_DET,
|
|
|
|
},
|
|
|
|
[PM805_IRQ_RAW_PLL_FAULT] = {
|
|
|
|
.reg_offset = 1,
|
|
|
|
.mask = PM805_INT2_SHRT_BTN_DET,
|
|
|
|
},
|
|
|
|
[PM805_IRQ_VOLP_BTN_DET] = {
|
|
|
|
.reg_offset = 1,
|
|
|
|
.mask = PM805_INT2_VOLM_BTN_DET,
|
|
|
|
},
|
|
|
|
[PM805_IRQ_VOLM_BTN_DET] = {
|
|
|
|
.reg_offset = 1,
|
|
|
|
.mask = PM805_INT2_VOLP_BTN_DET,
|
|
|
|
},
|
|
|
|
[PM805_IRQ_SHRT_BTN_DET] = {
|
|
|
|
.reg_offset = 1,
|
|
|
|
.mask = PM805_INT2_RAW_PLL_FAULT,
|
|
|
|
},
|
|
|
|
[PM805_IRQ_MIC_DET] = {
|
|
|
|
.reg_offset = 1,
|
|
|
|
.mask = PM805_INT2_FINE_PLL_FAULT,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2012-11-19 19:23:04 +01:00
|
|
|
static int device_irq_init_805(struct pm80x_chip *chip)
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
{
|
|
|
|
struct regmap *map = chip->regmap;
|
2013-06-14 07:21:48 +02:00
|
|
|
unsigned long flags = IRQF_ONESHOT;
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
int data, mask, ret = -EINVAL;
|
|
|
|
|
|
|
|
if (!map || !chip->irq) {
|
|
|
|
dev_err(chip->dev, "incorrect parameters\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* irq_mode defines the way of clearing interrupt. it's read-clear by
|
|
|
|
* default.
|
|
|
|
*/
|
|
|
|
mask =
|
|
|
|
PM805_STATUS0_INT_CLEAR | PM805_STATUS0_INV_INT |
|
|
|
|
PM800_STATUS0_INT_MASK;
|
|
|
|
|
|
|
|
data = PM805_STATUS0_INT_CLEAR;
|
|
|
|
ret = regmap_update_bits(map, PM805_INT_STATUS0, mask, data);
|
|
|
|
/*
|
|
|
|
* PM805_INT_STATUS is under 32K clock domain, so need to
|
|
|
|
* add proper delay before the next I2C register access.
|
|
|
|
*/
|
2014-05-08 13:06:19 +02:00
|
|
|
usleep_range(1000, 3000);
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
ret =
|
|
|
|
regmap_add_irq_chip(chip->regmap, chip->irq, flags, -1,
|
|
|
|
chip->regmap_irq_chip, &chip->irq_data);
|
|
|
|
|
|
|
|
out:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void device_irq_exit_805(struct pm80x_chip *chip)
|
|
|
|
{
|
|
|
|
regmap_del_irq_chip(chip->irq, chip->irq_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct regmap_irq_chip pm805_irq_chip = {
|
|
|
|
.name = "88pm805",
|
|
|
|
.irqs = pm805_irqs,
|
|
|
|
.num_irqs = ARRAY_SIZE(pm805_irqs),
|
|
|
|
|
|
|
|
.num_regs = 2,
|
|
|
|
.status_base = PM805_INT_STATUS1,
|
|
|
|
.mask_base = PM805_INT_MASK1,
|
|
|
|
.ack_base = PM805_INT_STATUS1,
|
|
|
|
};
|
|
|
|
|
2012-11-19 19:23:04 +01:00
|
|
|
static int device_805_init(struct pm80x_chip *chip)
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
struct regmap *map = chip->regmap;
|
|
|
|
|
|
|
|
if (!map) {
|
|
|
|
dev_err(chip->dev, "regmap is invalid\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
chip->regmap_irq_chip = &pm805_irq_chip;
|
|
|
|
|
|
|
|
ret = device_irq_init_805(chip);
|
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(chip->dev, "Failed to init pm805 irq!\n");
|
|
|
|
goto out_irq_init;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = mfd_add_devices(chip->dev, 0, &codec_devs[0],
|
2012-09-11 09:16:36 +02:00
|
|
|
ARRAY_SIZE(codec_devs), &codec_resources[0], 0,
|
|
|
|
NULL);
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(chip->dev, "Failed to add codec subdev\n");
|
|
|
|
goto out_codec;
|
|
|
|
} else
|
|
|
|
dev_info(chip->dev, "[%s]:Added mfd codec_devs\n", __func__);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
out_codec:
|
|
|
|
device_irq_exit_805(chip);
|
|
|
|
out_irq_init:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-11-19 19:23:04 +01:00
|
|
|
static int pm805_probe(struct i2c_client *client,
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
const struct i2c_device_id *id)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
struct pm80x_chip *chip;
|
2013-07-30 10:10:05 +02:00
|
|
|
struct pm80x_platform_data *pdata = dev_get_platdata(&client->dev);
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
|
2013-06-14 07:21:51 +02:00
|
|
|
ret = pm80x_init(client);
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
if (ret) {
|
|
|
|
dev_err(&client->dev, "pm805_init fail!\n");
|
|
|
|
goto out_init;
|
|
|
|
}
|
|
|
|
|
|
|
|
chip = i2c_get_clientdata(client);
|
|
|
|
|
|
|
|
ret = device_805_init(chip);
|
|
|
|
if (ret) {
|
2013-06-14 07:21:51 +02:00
|
|
|
dev_err(chip->dev, "Failed to initialize 88pm805 devices\n");
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
goto err_805_init;
|
|
|
|
}
|
|
|
|
|
2013-08-19 03:27:55 +02:00
|
|
|
if (pdata && pdata->plat_config)
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
pdata->plat_config(chip, pdata);
|
|
|
|
|
|
|
|
err_805_init:
|
2013-01-22 03:43:45 +01:00
|
|
|
pm80x_deinit();
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
out_init:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-11-19 19:26:01 +01:00
|
|
|
static int pm805_remove(struct i2c_client *client)
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
{
|
|
|
|
struct pm80x_chip *chip = i2c_get_clientdata(client);
|
|
|
|
|
|
|
|
mfd_remove_devices(chip->dev);
|
|
|
|
device_irq_exit_805(chip);
|
|
|
|
|
2013-01-22 03:43:45 +01:00
|
|
|
pm80x_deinit();
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct i2c_driver pm805_driver = {
|
|
|
|
.driver = {
|
2013-06-14 07:21:46 +02:00
|
|
|
.name = "88PM805",
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
.pm = &pm80x_pm_ops,
|
|
|
|
},
|
|
|
|
.probe = pm805_probe,
|
2012-11-19 19:20:24 +01:00
|
|
|
.remove = pm805_remove,
|
mfd: Support 88pm80x in 80x driver
88PM800 and 88PM805 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according
to requirement.
88pm80x.c provides common i2c driver handling for both 800 and
805, such as i2c_driver init, regmap init, read/write api etc.
88pm800.c handles specifically for 800, such as chip init, irq
init/handle, mfd device register, including rtc, onkey, regulator(
to be add later) etc. besides that, 800 has three i2c device, one
regular i2c client, two other i2c dummy for gpadc and power purpose.
88pm805.c handles specifically for 805, such as chip init, irq
init/handle, mfd device register, including codec, headset/mic detect
etc.
the i2c operation of both 800 and 805 are via regmap, and 88pm80x-i2c
exported a group of r/w bulk r/w and bits set API for facility.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 08:37:32 +02:00
|
|
|
.id_table = pm80x_id_table,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init pm805_i2c_init(void)
|
|
|
|
{
|
|
|
|
return i2c_add_driver(&pm805_driver);
|
|
|
|
}
|
|
|
|
subsys_initcall(pm805_i2c_init);
|
|
|
|
|
|
|
|
static void __exit pm805_i2c_exit(void)
|
|
|
|
{
|
|
|
|
i2c_del_driver(&pm805_driver);
|
|
|
|
}
|
|
|
|
module_exit(pm805_i2c_exit);
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("PMIC Driver for Marvell 88PM805");
|
|
|
|
MODULE_AUTHOR("Qiao Zhou <zhouqiao@marvell.com>");
|
|
|
|
MODULE_LICENSE("GPL");
|