linux/include/linux/mfd/twl6040.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * MFD driver for twl6040
 *
 * Authors:     Jorge Eduardo Candelaria <[email protected]>
 *              Misael Lopez Cruz <[email protected]>
 *
 * Copyright:   (C) 2011 Texas Instruments, Inc.
 */

#ifndef __TWL6040_CODEC_H__
#define __TWL6040_CODEC_H__

#include <linux/interrupt.h>
#include <linux/mfd/core.h>
#include <linux/regulator/consumer.h>
#include <linux/clk.h>

#define TWL6040_REG_ASICID
#define TWL6040_REG_ASICREV
#define TWL6040_REG_INTID
#define TWL6040_REG_INTMR
#define TWL6040_REG_NCPCTL
#define TWL6040_REG_LDOCTL
#define TWL6040_REG_HPPLLCTL
#define TWL6040_REG_LPPLLCTL
#define TWL6040_REG_LPPLLDIV
#define TWL6040_REG_AMICBCTL
#define TWL6040_REG_DMICBCTL
#define TWL6040_REG_MICLCTL
#define TWL6040_REG_MICRCTL
#define TWL6040_REG_MICGAIN
#define TWL6040_REG_LINEGAIN
#define TWL6040_REG_HSLCTL
#define TWL6040_REG_HSRCTL
#define TWL6040_REG_HSGAIN
#define TWL6040_REG_EARCTL
#define TWL6040_REG_HFLCTL
#define TWL6040_REG_HFLGAIN
#define TWL6040_REG_HFRCTL
#define TWL6040_REG_HFRGAIN
#define TWL6040_REG_VIBCTLL
#define TWL6040_REG_VIBDATL
#define TWL6040_REG_VIBCTLR
#define TWL6040_REG_VIBDATR
#define TWL6040_REG_HKCTL1
#define TWL6040_REG_HKCTL2
#define TWL6040_REG_GPOCTL
#define TWL6040_REG_ALB
#define TWL6040_REG_DLB
#define TWL6040_REG_TRIM1
#define TWL6040_REG_TRIM2
#define TWL6040_REG_TRIM3
#define TWL6040_REG_HSOTRIM
#define TWL6040_REG_HFOTRIM
#define TWL6040_REG_ACCCTL
#define TWL6040_REG_STATUS

/* INTID (0x03) fields */

#define TWL6040_THINT
#define TWL6040_PLUGINT
#define TWL6040_UNPLUGINT
#define TWL6040_HOOKINT
#define TWL6040_HFINT
#define TWL6040_VIBINT
#define TWL6040_READYINT

/* INTMR (0x04) fields */

#define TWL6040_THMSK
#define TWL6040_PLUGMSK
#define TWL6040_HOOKMSK
#define TWL6040_HFMSK
#define TWL6040_VIBMSK
#define TWL6040_READYMSK
#define TWL6040_ALLINT_MSK

/* NCPCTL (0x05) fields */

#define TWL6040_NCPENA
#define TWL6040_NCPOPEN

/* LDOCTL (0x06) fields */

#define TWL6040_LSLDOENA
#define TWL6040_HSLDOENA
#define TWL6040_REFENA
#define TWL6040_OSCENA

/* HPPLLCTL (0x07) fields */

#define TWL6040_HPLLENA
#define TWL6040_HPLLRST
#define TWL6040_HPLLBP
#define TWL6040_HPLLSQRENA
#define TWL6040_MCLK_12000KHZ
#define TWL6040_MCLK_19200KHZ
#define TWL6040_MCLK_26000KHZ
#define TWL6040_MCLK_38400KHZ
#define TWL6040_MCLK_MSK

/* LPPLLCTL (0x08) fields */

#define TWL6040_LPLLENA
#define TWL6040_LPLLRST
#define TWL6040_LPLLSEL
#define TWL6040_LPLLFIN
#define TWL6040_HPLLSEL

/* HSLCTL/R (0x10/0x11) fields */

#define TWL6040_HSDACENA
#define TWL6040_HSDACMODE
#define TWL6040_HSDRVENA
#define TWL6040_HSDRVMODE

/* HFLCTL/R (0x14/0x16) fields */

#define TWL6040_HFDACENA
#define TWL6040_HFPGAENA
#define TWL6040_HFDRVENA
#define TWL6040_HFSWENA

/* VIBCTLL/R (0x18/0x1A) fields */

#define TWL6040_VIBENA
#define TWL6040_VIBSEL
#define TWL6040_VIBCTRL
#define TWL6040_VIBCTRL_P
#define TWL6040_VIBCTRL_N

/* VIBDATL/R (0x19/0x1B) fields */

#define TWL6040_VIBDAT_MAX

/* GPOCTL (0x1E) fields */

#define TWL6040_GPO1
#define TWL6040_GPO2
#define TWL6040_GPO3

/* ACCCTL (0x2D) fields */

#define TWL6040_I2CSEL
#define TWL6040_RESETSPLIT
#define TWL6040_INTCLRMODE
#define TWL6040_I2CMODE(x)

/* STATUS (0x2E) fields */

#define TWL6040_PLUGCOMP
#define TWL6040_VIBLOCDET
#define TWL6040_VIBROCDET
#define TWL6040_TSHUTDET

#define TWL6040_CELLS

#define TWL6040_REV_ES1_0
#define TWL6040_REV_ES1_1
#define TWL6040_REV_ES1_3
#define TWL6041_REV_ES2_0

#define TWL6040_IRQ_TH
#define TWL6040_IRQ_PLUG
#define TWL6040_IRQ_HOOK
#define TWL6040_IRQ_HF
#define TWL6040_IRQ_VIB
#define TWL6040_IRQ_READY

/* PLL selection */
#define TWL6040_SYSCLK_SEL_LPPLL
#define TWL6040_SYSCLK_SEL_HPPLL

#define TWL6040_GPO_MAX

struct gpio_desc;
struct regmap;
struct regmap_irq_chips_data;

struct twl6040 {};

int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg);
int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg,
		      u8 val);
int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg,
		     u8 mask);
int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg,
		       u8 mask);
int twl6040_power(struct twl6040 *twl6040, int on);
int twl6040_set_pll(struct twl6040 *twl6040, int pll_id,
		    unsigned int freq_in, unsigned int freq_out);
int twl6040_get_pll(struct twl6040 *twl6040);
unsigned int twl6040_get_sysclk(struct twl6040 *twl6040);

/* Get the combined status of the vibra control register */
int twl6040_get_vibralr_status(struct twl6040 *twl6040);

static inline int twl6040_get_revid(struct twl6040 *twl6040)
{}


#endif  /* End of __TWL6040_CODEC_H__ */