mirror of
https://github.com/AetherDroid/android_kernel_samsung_on5xelte.git
synced 2025-10-29 23:28:52 +01:00
Fixed MTP to work with TWRP
This commit is contained in:
commit
f6dfaef42e
50820 changed files with 20846062 additions and 0 deletions
145
include/linux/mfd/wm8994/core.h
Normal file
145
include/linux/mfd/wm8994/core.h
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* 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__
|
||||
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include <linux/mfd/wm8994/pdata.h>
|
||||
|
||||
enum wm8994_type {
|
||||
WM8994 = 0,
|
||||
WM8958 = 1,
|
||||
WM1811 = 2,
|
||||
};
|
||||
|
||||
struct regulator_dev;
|
||||
struct regulator_bulk_data;
|
||||
struct irq_domain;
|
||||
|
||||
#define WM8994_NUM_GPIO_REGS 11
|
||||
#define WM8994_NUM_LDO_REGS 2
|
||||
#define WM8994_NUM_IRQ_REGS 2
|
||||
|
||||
#define WM8994_IRQ_TEMP_SHUT 0
|
||||
#define WM8994_IRQ_MIC1_DET 1
|
||||
#define WM8994_IRQ_MIC1_SHRT 2
|
||||
#define WM8994_IRQ_MIC2_DET 3
|
||||
#define WM8994_IRQ_MIC2_SHRT 4
|
||||
#define WM8994_IRQ_FLL1_LOCK 5
|
||||
#define WM8994_IRQ_FLL2_LOCK 6
|
||||
#define WM8994_IRQ_SRC1_LOCK 7
|
||||
#define WM8994_IRQ_SRC2_LOCK 8
|
||||
#define WM8994_IRQ_AIF1DRC1_SIG_DET 9
|
||||
#define WM8994_IRQ_AIF1DRC2_SIG_DET 10
|
||||
#define WM8994_IRQ_AIF2DRC_SIG_DET 11
|
||||
#define WM8994_IRQ_FIFOS_ERR 12
|
||||
#define WM8994_IRQ_WSEQ_DONE 13
|
||||
#define WM8994_IRQ_DCS_DONE 14
|
||||
#define WM8994_IRQ_TEMP_WARN 15
|
||||
|
||||
/* GPIOs in the chip are numbered from 1-11 */
|
||||
#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN)
|
||||
|
||||
struct wm8994 {
|
||||
struct wm8994_pdata pdata;
|
||||
|
||||
enum wm8994_type type;
|
||||
int revision;
|
||||
int cust_id;
|
||||
|
||||
struct device *dev;
|
||||
struct regmap *regmap;
|
||||
|
||||
bool ldo_ena_always_driven;
|
||||
|
||||
int gpio_base;
|
||||
int irq_base;
|
||||
|
||||
int irq;
|
||||
struct regmap_irq_chip_data *irq_data;
|
||||
struct irq_domain *edge_irq;
|
||||
|
||||
/* Used over suspend/resume */
|
||||
bool suspended;
|
||||
|
||||
struct regulator_dev *dbvdd;
|
||||
int num_supplies;
|
||||
struct regulator_bulk_data *supplies;
|
||||
};
|
||||
|
||||
/* Device I/O API */
|
||||
|
||||
static inline int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg)
|
||||
{
|
||||
unsigned int val;
|
||||
int ret;
|
||||
|
||||
ret = regmap_read(wm8994->regmap, reg, &val);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
else
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
|
||||
unsigned short val)
|
||||
{
|
||||
return regmap_write(wm8994->regmap, reg, val);
|
||||
}
|
||||
|
||||
static inline int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
|
||||
int count, u16 *buf)
|
||||
{
|
||||
return regmap_bulk_read(wm8994->regmap, reg, buf, count);
|
||||
}
|
||||
|
||||
static inline int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
|
||||
int count, const u16 *buf)
|
||||
{
|
||||
return regmap_raw_write(wm8994->regmap, reg, buf, count * sizeof(u16));
|
||||
}
|
||||
|
||||
static inline int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
|
||||
unsigned short mask, unsigned short val)
|
||||
{
|
||||
return regmap_update_bits(wm8994->regmap, reg, mask, val);
|
||||
}
|
||||
|
||||
/* Helper to save on boilerplate */
|
||||
static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
|
||||
irq_handler_t handler, const char *name,
|
||||
void *data)
|
||||
{
|
||||
if (!wm8994->irq_data)
|
||||
return -EINVAL;
|
||||
return request_threaded_irq(regmap_irq_get_virq(wm8994->irq_data, irq),
|
||||
NULL, handler, IRQF_TRIGGER_RISING, name,
|
||||
data);
|
||||
}
|
||||
static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data)
|
||||
{
|
||||
if (!wm8994->irq_data)
|
||||
return;
|
||||
free_irq(regmap_irq_get_virq(wm8994->irq_data, irq), data);
|
||||
}
|
||||
|
||||
int wm8994_irq_init(struct wm8994 *wm8994);
|
||||
void wm8994_irq_exit(struct wm8994 *wm8994);
|
||||
|
||||
#endif
|
||||
76
include/linux/mfd/wm8994/gpio.h
Normal file
76
include/linux/mfd/wm8994/gpio.h
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* 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_GP_FN_THW 19
|
||||
#define WM8994_GP_FN_DCS_DONE 20
|
||||
#define WM8994_GP_FN_FLL1_OUT 21
|
||||
#define WM8994_GP_FN_FLL2_OUT 22
|
||||
|
||||
#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
|
||||
238
include/linux/mfd/wm8994/pdata.h
Normal file
238
include/linux/mfd/wm8994/pdata.h
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
/*
|
||||
* 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
|
||||
#define WM8994_NUM_AIF 3
|
||||
|
||||
struct wm8994_ldo_pdata {
|
||||
/** GPIOs to enable regulator, 0 or less if not available */
|
||||
int enable;
|
||||
|
||||
const struct regulator_init_data *init_data;
|
||||
};
|
||||
|
||||
#define WM8994_CONFIGURE_GPIO 0x10000
|
||||
|
||||
#define WM8994_DRC_REGS 5
|
||||
#define WM8994_EQ_REGS 20
|
||||
#define WM8958_MBC_CUTOFF_REGS 20
|
||||
#define WM8958_MBC_COEFF_REGS 48
|
||||
#define WM8958_MBC_COMBINED_REGS 56
|
||||
#define WM8958_VSS_HPF_REGS 2
|
||||
#define WM8958_VSS_REGS 148
|
||||
#define WM8958_ENH_EQ_REGS 32
|
||||
|
||||
/**
|
||||
* 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];
|
||||
};
|
||||
|
||||
/**
|
||||
* Multiband compressor configurations are specified with a label and
|
||||
* two sets of values to write. Configurations are expected to be
|
||||
* generated using the multiband compressor configuration panel in
|
||||
* WISCE - see http://www.wolfsonmicro.com/wisce/
|
||||
*/
|
||||
struct wm8958_mbc_cfg {
|
||||
const char *name;
|
||||
u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS];
|
||||
u16 coeff_regs[WM8958_MBC_COEFF_REGS];
|
||||
|
||||
/* Coefficient layout when using MBC+VSS firmware */
|
||||
u16 combined_regs[WM8958_MBC_COMBINED_REGS];
|
||||
};
|
||||
|
||||
/**
|
||||
* VSS HPF configurations are specified with a label and two values to
|
||||
* write. Configurations are expected to be generated using the
|
||||
* multiband compressor configuration panel in WISCE - see
|
||||
* http://www.wolfsonmicro.com/wisce/
|
||||
*/
|
||||
struct wm8958_vss_hpf_cfg {
|
||||
const char *name;
|
||||
u16 regs[WM8958_VSS_HPF_REGS];
|
||||
};
|
||||
|
||||
/**
|
||||
* VSS configurations are specified with a label and array of values
|
||||
* to write. Configurations are expected to be generated using the
|
||||
* multiband compressor configuration panel in WISCE - see
|
||||
* http://www.wolfsonmicro.com/wisce/
|
||||
*/
|
||||
struct wm8958_vss_cfg {
|
||||
const char *name;
|
||||
u16 regs[WM8958_VSS_REGS];
|
||||
};
|
||||
|
||||
/**
|
||||
* Enhanced EQ configurations are specified with a label and array of
|
||||
* values to write. Configurations are expected to be generated using
|
||||
* the multiband compressor configuration panel in WISCE - see
|
||||
* http://www.wolfsonmicro.com/wisce/
|
||||
*/
|
||||
struct wm8958_enh_eq_cfg {
|
||||
const char *name;
|
||||
u16 regs[WM8958_ENH_EQ_REGS];
|
||||
};
|
||||
|
||||
/**
|
||||
* Microphone detection rates, used to tune response rates and power
|
||||
* consumption for WM8958/WM1811 microphone detection.
|
||||
*
|
||||
* @sysclk: System clock rate to use this configuration for.
|
||||
* @idle: True if this configuration should use when no accessory is detected,
|
||||
* false otherwise.
|
||||
* @start: Value for MICD_BIAS_START_TIME register field (not shifted).
|
||||
* @rate: Value for MICD_RATE register field (not shifted).
|
||||
*/
|
||||
struct wm8958_micd_rate {
|
||||
int sysclk;
|
||||
bool idle;
|
||||
int start;
|
||||
int rate;
|
||||
};
|
||||
|
||||
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 irq_base; /** Base IRQ number for WM8994, required for IRQs */
|
||||
unsigned long irq_flags; /** user irq flags */
|
||||
|
||||
int num_drc_cfgs;
|
||||
struct wm8994_drc_cfg *drc_cfgs;
|
||||
|
||||
int num_retune_mobile_cfgs;
|
||||
struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;
|
||||
|
||||
int num_mbc_cfgs;
|
||||
struct wm8958_mbc_cfg *mbc_cfgs;
|
||||
|
||||
int num_vss_cfgs;
|
||||
struct wm8958_vss_cfg *vss_cfgs;
|
||||
|
||||
int num_vss_hpf_cfgs;
|
||||
struct wm8958_vss_hpf_cfg *vss_hpf_cfgs;
|
||||
|
||||
int num_enh_eq_cfgs;
|
||||
struct wm8958_enh_eq_cfg *enh_eq_cfgs;
|
||||
|
||||
int num_micd_rates;
|
||||
struct wm8958_micd_rate *micd_rates;
|
||||
|
||||
/* Power up delays to add after microphone bias power up (ms) */
|
||||
int micb1_delay;
|
||||
int micb2_delay;
|
||||
|
||||
/* 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;
|
||||
|
||||
/* Delay between detecting a jack and starting microphone
|
||||
* detect (specified in ms)
|
||||
*/
|
||||
int micdet_delay;
|
||||
|
||||
/* Delay between microphone detect completing and reporting on
|
||||
* insert (specified in ms)
|
||||
*/
|
||||
int mic_id_delay;
|
||||
|
||||
/* IRQ for microphone detection if brought out directly as a
|
||||
* signal.
|
||||
*/
|
||||
int micdet_irq;
|
||||
|
||||
/* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
|
||||
unsigned int micbias1_lvl:1;
|
||||
unsigned int micbias2_lvl:1;
|
||||
|
||||
/* WM8994 jack detect threashold levels, see datasheet for values */
|
||||
unsigned int jd_scthr:2;
|
||||
unsigned int jd_thr:2;
|
||||
|
||||
/* Configure WM1811 jack detection for use with external capacitor */
|
||||
unsigned int jd_ext_cap:1;
|
||||
|
||||
/* WM8958 microphone bias configuration */
|
||||
int micbias[2];
|
||||
|
||||
/* WM8958 microphone detection ranges */
|
||||
u16 micd_lvl_sel;
|
||||
|
||||
/* Disable the internal pull downs on the LDOs if they are
|
||||
* always driven (eg, connected to an always on supply or
|
||||
* GPIO that always drives an output. If they float power
|
||||
* consumption will rise.
|
||||
*/
|
||||
bool ldo_ena_always_driven;
|
||||
|
||||
/*
|
||||
* SPKMODE must be pulled internally by the device on this
|
||||
* system.
|
||||
*/
|
||||
bool spkmode_pu;
|
||||
|
||||
/**
|
||||
* Maximum number of channels clocks will be generated for,
|
||||
* useful for systems where and I2S bus with multiple data
|
||||
* lines is mastered.
|
||||
*/
|
||||
int max_channels_clocked[WM8994_NUM_AIF];
|
||||
|
||||
/**
|
||||
* GPIO for the IRQ pin if host only supports edge triggering
|
||||
*/
|
||||
int irq_gpio;
|
||||
};
|
||||
|
||||
#endif
|
||||
4822
include/linux/mfd/wm8994/registers.h
Normal file
4822
include/linux/mfd/wm8994/registers.h
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue