X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Fi2s.h;h=7760aab7c46500209ba889d0810767525ff97687;hb=24b77393a5fcc3e1f51b4e3a1080c0efb60b52eb;hp=75ae75cf2358084d17ac1232e48055c696716005;hpb=511ed5fdd3892c6e4a42b14c7d80db15eee7fc4f;p=oweals%2Fu-boot.git diff --git a/include/i2s.h b/include/i2s.h index 75ae75cf23..7760aab7c4 100644 --- a/include/i2s.h +++ b/include/i2s.h @@ -1,24 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2012 Samsung Electronics * R. Chandrasekar - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA */ #ifndef __I2S_H__ @@ -93,35 +76,51 @@ struct i2s_reg { }; /* This structure stores the i2s related information */ -struct i2stx_info { +struct i2s_uc_priv { unsigned int rfs; /* LR clock frame size */ - unsigned int bfs; /* Bit slock frame size */ + unsigned int bfs; /* Bit clock frame size */ unsigned int audio_pll_clk; /* Audio pll frequency in Hz */ unsigned int samplingrate; /* sampling rate */ unsigned int bitspersample; /* bits per sample */ unsigned int channels; /* audio channels */ unsigned int base_address; /* I2S Register Base */ + unsigned int id; /* I2S controller id */ }; -/* - * Sends the given data through i2s tx - * - * @param pi2s_tx pointer of i2s transmitter parameter structure. - * @param data address of the data buffer - * @param data_size array size of the int buffer (total size / size of int) +/* Operations for i2s devices */ +struct i2s_ops { + /** + * tx_data() - Transmit audio data + * + * @dev: I2C device + * @data: Data buffer to play + * @data_size: Size of data buffer in bytes + * @return 0 if OK, -ve on error + */ + int (*tx_data)(struct udevice *dev, void *data, uint data_size); +}; + +#define i2s_get_ops(dev) ((struct i2s_ops *)(dev)->driver->ops) + +/** + * i2s_tx_data() - Transmit audio data * - * @return int value 0 for success, -1 in case of error + * @dev: I2C device + * @data: Data buffer to play + * @data_size: Size of data buffer in bytes + * @return 0 if OK, -ve on error */ -int i2s_transfer_tx_data(struct i2stx_info *pi2s_tx, unsigned *data, - unsigned long data_size); +int i2s_tx_data(struct udevice *dev, void *data, uint data_size); /* - * Initialise i2s transmiter + * Sends the given data through i2s tx * * @param pi2s_tx pointer of i2s transmitter parameter structure. - * + * @param data address of the data buffer + * @param data_size size of the data (in bytes) * @return int value 0 for success, -1 in case of error */ -int i2s_tx_init(struct i2stx_info *pi2s_tx); +int i2s_transfer_tx_data(struct i2s_uc_priv *pi2s_tx, void *data, + uint data_size); #endif /* __I2S_H__ */