blob: deaefd93eb1bced4993a89ccc920561f27db3047 [file] [log] [blame]
Simon Glass0ab6f0b2018-12-10 10:37:42 -07001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * maxim_codec.h -- MAXIM codec common interface file
4 *
5 * Copyright (C) 2013 Samsung Electronics
6 * D Krishna Mohan <krishna.md@samsung.com>
7 */
8
9#ifndef __MAXIM_COMMON_H__
10#define __MAXIM_COMMON_H__
11
12enum maxim_codec_type {
13 MAX98095,
14 MAX98090,
15};
16
17struct maxim_priv {
18 enum maxim_codec_type devtype;
19 unsigned int sysclk;
20 unsigned int rate;
21 unsigned int fmt;
22 struct udevice *dev;
23};
24
25#define MAXIM_AUDIO_I2C_BUS 7
26#define MAXIM_AUDIO_I2C_REG_98095 0x22
27
28#define MAXIM_AUDIO_I2C_REG MAXIM_AUDIO_I2C_REG_98095
29
30/*
31 * Writes value to a device register through i2c
32 *
33 * @param priv Private data for driver
34 * @param reg reg number to be write
35 * @param data data to be writen to the above registor
36 *
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010037 * Return: int value 1 for change, 0 for no change or negative error code.
Simon Glass0ab6f0b2018-12-10 10:37:42 -070038 */
39int maxim_i2c_write(struct maxim_priv *priv, unsigned int reg,
40 unsigned char data);
41
42/*
43 * Read a value from a device register through i2c
44 *
45 * @param priv Private data for driver
46 * @param reg reg number to be read
47 * @param data address of read data to be stored
48 *
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010049 * Return: int value 0 for success, -1 in case of error.
Simon Glass0ab6f0b2018-12-10 10:37:42 -070050 */
51unsigned int maxim_i2c_read(struct maxim_priv *priv, unsigned int reg,
52 unsigned char *data);
53
54/*
55 * update device register bits through i2c
56 *
57 * @param priv Private data for driver
58 * @param reg codec register
59 * @param mask register mask
60 * @param value new value
61 *
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010062 * Return: int value 0 for success, non-zero error code.
Simon Glass0ab6f0b2018-12-10 10:37:42 -070063 */
64int maxim_bic_or(struct maxim_priv *priv, unsigned int reg, unsigned char mask,
65 unsigned char value);
66
67#endif /* __MAXIM_COMMON_H__ */