Commit 9e501086 authored by Mark Brown's avatar Mark Brown Committed by Samuel Ortiz

mfd: Add initial WM8994 support

The WM8994 is a highly integrated ultra low power audio hub CODEC.
Since it includes on-board regulators and GPIOs it is represented
as a multi-function device, though the overwhelming majority of
the functionality is provided by the ASoC CODEC driver.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 1c4d3b70
......@@ -295,6 +295,18 @@ config MFD_WM8350_I2C
I2C as the control interface. Additional options must be
selected to enable support for the functionality of the chip.
config MFD_WM8994
tristate "Support Wolfson Microelectronics WM8994"
select MFD_CORE
depends on I2C
help
The WM8994 is a highly integrated hi-fi CODEC designed for
smartphone applicatiosn. As well as audio functionality it
has on board GPIO and regulator functionality which is
supported via the relevant subsystems. This driver provides
core support for the WM8994, in order to use the actual
functionaltiy of the device other drivers must be enabled.
config MFD_PCF50633
tristate "Support for NXP PCF50633"
depends on I2C
......
......@@ -25,6 +25,7 @@ wm8350-objs := wm8350-core.o wm8350-regmap.o wm8350-gpio.o
wm8350-objs += wm8350-irq.o
obj-$(CONFIG_MFD_WM8350) += wm8350.o
obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o
obj-$(CONFIG_MFD_WM8994) += wm8994-core.o
obj-$(CONFIG_TPS65010) += tps65010.o
obj-$(CONFIG_MENELAUS) += menelaus.o
......
This diff is collapsed.
/*
* include/linux/mfd/wm8994/core.h -- Core interface for WM8994
*
* Copyright 2009 Wolfson Microelectronics PLC.
*
* Author: Mark Brown <broonie@opensource.wolfsonmicro.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.
*
*/
#ifndef __MFD_WM8994_CORE_H__
#define __MFD_WM8994_CORE_H__
struct regulator_dev;
struct regulator_bulk_data;
#define WM8994_NUM_GPIO_REGS 11
#define WM8994_NUM_LDO_REGS 2
struct wm8994 {
struct mutex io_lock;
struct device *dev;
int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
int bytes, void *dest);
int (*write_dev)(struct wm8994 *wm8994, unsigned short reg,
int bytes, void *src);
void *control_data;
int gpio_base;
/* Used over suspend/resume */
u16 ldo_regs[WM8994_NUM_LDO_REGS];
u16 gpio_regs[WM8994_NUM_GPIO_REGS];
struct regulator_dev *dbvdd;
struct regulator_bulk_data *supplies;
};
/* Device I/O API */
int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg);
int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
unsigned short val);
int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
unsigned short mask, unsigned short val);
int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
int count, u16 *buf);
#endif
/*
* include/linux/mfd/wm8994/gpio.h - GPIO configuration for WM8994
*
* Copyright 2009 Wolfson Microelectronics PLC.
*
* Author: Mark Brown <broonie@opensource.wolfsonmicro.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.
*
*/
#ifndef __MFD_WM8994_GPIO_H__
#define __MFD_WM8994_GPIO_H__
#define WM8994_GPIO_MAX 11
#define WM8994_GP_FN_PIN_SPECIFIC 0
#define WM8994_GP_FN_GPIO 1
#define WM8994_GP_FN_SDOUT 2
#define WM8994_GP_FN_IRQ 3
#define WM8994_GP_FN_TEMPERATURE 4
#define WM8994_GP_FN_MICBIAS1_DET 5
#define WM8994_GP_FN_MICBIAS1_SHORT 6
#define WM8994_GP_FN_MICBIAS2_DET 7
#define WM8994_GP_FN_MICBIAS2_SHORT 8
#define WM8994_GP_FN_FLL1_LOCK 9
#define WM8994_GP_FN_FLL2_LOCK 10
#define WM8994_GP_FN_SRC1_LOCK 11
#define WM8994_GP_FN_SRC2_LOCK 12
#define WM8994_GP_FN_DRC1_ACT 13
#define WM8994_GP_FN_DRC2_ACT 14
#define WM8994_GP_FN_DRC3_ACT 15
#define WM8994_GP_FN_WSEQ_STATUS 16
#define WM8994_GP_FN_FIFO_ERROR 17
#define WM8994_GP_FN_OPCLK 18
#define WM8994_GPN_DIR 0x8000 /* GPN_DIR */
#define WM8994_GPN_DIR_MASK 0x8000 /* GPN_DIR */
#define WM8994_GPN_DIR_SHIFT 15 /* GPN_DIR */
#define WM8994_GPN_DIR_WIDTH 1 /* GPN_DIR */
#define WM8994_GPN_PU 0x4000 /* GPN_PU */
#define WM8994_GPN_PU_MASK 0x4000 /* GPN_PU */
#define WM8994_GPN_PU_SHIFT 14 /* GPN_PU */
#define WM8994_GPN_PU_WIDTH 1 /* GPN_PU */
#define WM8994_GPN_PD 0x2000 /* GPN_PD */
#define WM8994_GPN_PD_MASK 0x2000 /* GPN_PD */
#define WM8994_GPN_PD_SHIFT 13 /* GPN_PD */
#define WM8994_GPN_PD_WIDTH 1 /* GPN_PD */
#define WM8994_GPN_POL 0x0400 /* GPN_POL */
#define WM8994_GPN_POL_MASK 0x0400 /* GPN_POL */
#define WM8994_GPN_POL_SHIFT 10 /* GPN_POL */
#define WM8994_GPN_POL_WIDTH 1 /* GPN_POL */
#define WM8994_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */
#define WM8994_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
#define WM8994_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
#define WM8994_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
#define WM8994_GPN_DB 0x0100 /* GPN_DB */
#define WM8994_GPN_DB_MASK 0x0100 /* GPN_DB */
#define WM8994_GPN_DB_SHIFT 8 /* GPN_DB */
#define WM8994_GPN_DB_WIDTH 1 /* GPN_DB */
#define WM8994_GPN_LVL 0x0040 /* GPN_LVL */
#define WM8994_GPN_LVL_MASK 0x0040 /* GPN_LVL */
#define WM8994_GPN_LVL_SHIFT 6 /* GPN_LVL */
#define WM8994_GPN_LVL_WIDTH 1 /* GPN_LVL */
#define WM8994_GPN_FN_MASK 0x001F /* GPN_FN - [4:0] */
#define WM8994_GPN_FN_SHIFT 0 /* GPN_FN - [4:0] */
#define WM8994_GPN_FN_WIDTH 5 /* GPN_FN - [4:0] */
#endif
/*
* include/linux/mfd/wm8994/pdata.h -- Platform data for WM8994
*
* Copyright 2009 Wolfson Microelectronics PLC.
*
* Author: Mark Brown <broonie@opensource.wolfsonmicro.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.
*
*/
#ifndef __MFD_WM8994_PDATA_H__
#define __MFD_WM8994_PDATA_H__
#define WM8994_NUM_LDO 2
#define WM8994_NUM_GPIO 11
struct wm8994_ldo_pdata {
/** GPIOs to enable regulator, 0 or less if not available */
int enable;
const char *supply;
struct regulator_init_data *init_data;
};
#define WM8994_CONFIGURE_GPIO 0x8000
#define WM8994_DRC_REGS 5
#define WM8994_EQ_REGS 19
/**
* DRC configurations are specified with a label and a set of register
* values to write (the enable bits will be ignored). At runtime an
* enumerated control will be presented for each DRC block allowing
* the user to choose the configration to use.
*
* Configurations may be generated by hand or by using the DRC control
* panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/
* for details.
*/
struct wm8994_drc_cfg {
const char *name;
u16 regs[WM8994_DRC_REGS];
};
/**
* ReTune Mobile configurations are specified with a label, sample
* rate and set of values to write (the enable bits will be ignored).
*
* Configurations are expected to be generated using the ReTune Mobile
* control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
*/
struct wm8994_retune_mobile_cfg {
const char *name;
unsigned int rate;
u16 regs[WM8994_EQ_REGS];
};
struct wm8994_pdata {
int gpio_base;
/**
* Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO
* can be used for all zero values.
*/
int gpio_defaults[WM8994_NUM_GPIO];
struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
int num_drc_cfgs;
struct wm8994_drc_cfg *drc_cfgs;
int num_retune_mobile_cfgs;
struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;
/* LINEOUT can be differential or single ended */
unsigned int lineout1_diff:1;
unsigned int lineout2_diff:1;
/* Common mode feedback */
unsigned int lineout1fb:1;
unsigned int lineout2fb:1;
/* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
unsigned int micbias1_lvl:1;
unsigned int micbias2_lvl:1;
/* Jack detect threashold levels, see datasheet for values */
unsigned int jd_scthr:2;
unsigned int jd_thr:2;
};
#endif
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