diff options
author | Tom Rini <trini@konsulko.com> | 2018-12-14 14:18:47 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-12-14 14:18:47 -0500 |
commit | 8fc26fce41592175ae004514e431e68a9dd60671 (patch) | |
tree | 9d4f5d9b057a749742e9dcead3cfa41c4ddae5ea /drivers/sound/maxim_codec.h | |
parent | d117d8f19b0625f88309e47a8a32c2faa384dddc (diff) | |
parent | f987177db9c988142032ed8142a093cce2378a90 (diff) |
Merge tag 'dm-pull-14dec18' of git://git.denx.de/u-boot-dm
Complete conversion of sound to driver model
Diffstat (limited to 'drivers/sound/maxim_codec.h')
-rw-r--r-- | drivers/sound/maxim_codec.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/drivers/sound/maxim_codec.h b/drivers/sound/maxim_codec.h new file mode 100644 index 0000000000..a3128e0bb7 --- /dev/null +++ b/drivers/sound/maxim_codec.h @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * maxim_codec.h -- MAXIM codec common interface file + * + * Copyright (C) 2013 Samsung Electronics + * D Krishna Mohan <krishna.md@samsung.com> + */ + +#ifndef __MAXIM_COMMON_H__ +#define __MAXIM_COMMON_H__ + +enum maxim_codec_type { + MAX98095, + MAX98090, +}; + +struct maxim_priv { + enum maxim_codec_type devtype; + unsigned int sysclk; + unsigned int rate; + unsigned int fmt; + struct udevice *dev; +}; + +#define MAXIM_AUDIO_I2C_BUS 7 +#define MAXIM_AUDIO_I2C_REG_98095 0x22 + +#define MAXIM_AUDIO_I2C_REG MAXIM_AUDIO_I2C_REG_98095 + +/* + * Writes value to a device register through i2c + * + * @param priv Private data for driver + * @param reg reg number to be write + * @param data data to be writen to the above registor + * + * @return int value 1 for change, 0 for no change or negative error code. + */ +int maxim_i2c_write(struct maxim_priv *priv, unsigned int reg, + unsigned char data); + +/* + * Read a value from a device register through i2c + * + * @param priv Private data for driver + * @param reg reg number to be read + * @param data address of read data to be stored + * + * @return int value 0 for success, -1 in case of error. + */ +unsigned int maxim_i2c_read(struct maxim_priv *priv, unsigned int reg, + unsigned char *data); + +/* + * update device register bits through i2c + * + * @param priv Private data for driver + * @param reg codec register + * @param mask register mask + * @param value new value + * + * @return int value 0 for success, non-zero error code. + */ +int maxim_bic_or(struct maxim_priv *priv, unsigned int reg, unsigned char mask, + unsigned char value); + +#endif /* __MAXIM_COMMON_H__ */ |