Exemplo n.º 1
0
static int marimba_write_u8(struct marimba_tsadc *tsadc, u8 reg, u8 data)
{
	int rc;

	tsadc->marimba->mod_id = MARIMBA_SLAVE_ID_MARIMBA;
	rc = marimba_write(tsadc->marimba, reg, &data, 1);

	if (!rc)
		dev_warn(tsadc->dev, "Error writing marimba reg %X - ret %X\n",
				reg, data);
	return 0;
}
int timpani_reset(void)
{
	struct marimba *marimba = &marimba_modules[MARIMBA_SLAVE_ID_MARIMBA];
	struct marimba_platform_data *pdata = marimba_pdata;
	int rc = 0;
	u8 buf[1];

	buf[0] = 0x10;

	mutex_lock(&marimba->xfer_lock);
		rc = pdata->timpani_reset_config();
	mutex_unlock(&marimba->xfer_lock);
	marimba_write(marimba, MARIMBA_MODE, buf, 1);
	return rc;
}
Exemplo n.º 3
0
void adie_enable(void)
{
	struct i2c_client *client = marimba_client;

	marimba_vreg_enable();

	marimba_write(client, 0xff, 0x08); /* bring up codec */
	marimba_write(client, 0xff, 0x0a); /* GDFS_EN_FEW=1 */
	marimba_write(client, 0xff, 0x0e); /* GDFS_EN_REST=1 */
	marimba_write(client, 0xff, 0x07); /* RESET_N=1 */
	marimba_write(client, 0xff, 0x17); /* clock enable */
	marimba_write(client, 0x03, 0x04); /* enable band gap */
	marimba_write(client, 0x8F, 0x44); /* dither delay select, dmic gain bypass */

	msleep(100);

	adie_load(client, init_rx);
	adie_load(client, init_speaker_48k_256_stereo);
}
static int marimba_debugfs_set(void *data, u64 val)
{
	struct adie_dbg_device *dbgdev = data;
	u8 reg = val;
	int rc;
	struct marimba marimba_id;

	mutex_lock(&dbgdev->dbg_mutex);

	rc = check_addr(dbgdev->addr, __func__);
	if (rc)
		goto done;

	marimba_id.mod_id = dbgdev->mod_id;
	rc = marimba_write(&marimba_id, dbgdev->addr, &reg, 1);
	rc = (rc == 1) ? 0 : rc;

	if (rc)
		pr_err("%s: FAIL marimba_write(0x%03X)=0x%02X: rc=%d\n",
			__func__, dbgdev->addr, reg, rc);
done:
	mutex_unlock(&dbgdev->dbg_mutex);
	return rc;
}
/**
* This function provides interface to change the mode of operation
* from I2S mode  to AUX PCM or vice versa. This function programs the
* wcn2243 registers to TRISTATE or ON mode.
*
* @return  int - negative number on failure.
*
*/
static int switch_pins( int fd, int nPath )
{
    unsigned char value =0;
    unsigned char reg =0;
    int retval = -1;
    unsigned char set = I2C_PIN_CTL; // SET PIN CTL mode
    unsigned char unset = I2C_NORMAL; // UNSET PIN CTL MODE
    if(nPath == MODE_FM ) {
        // as we need to switch path to FM we need to move
        // BT AUX PCM lines to PIN CONTROL mode then move
        // FM to normal mode.
        for( reg = BT_PCM_BCLK_MODE; reg <= BT_PCM_SYNC_MODE; reg++ ) {
#ifdef DEBUG_CHK
            retval = marimba_read(fd, reg,&value, 1);
            ALOGD("value read is:%d\n",value);
#endif
            retval = marimba_write(fd, reg, &set,1);
            if (retval < 0) {
                goto err_all;
            }
        }
        for( reg = FM_I2S_SD_MODE; reg <= FM_I2S_SCK_MODE; reg++ ) {
#ifdef DEBUG_CHK
            retval = marimba_read(fd, reg,&value, 1);
            ALOGD("value read is:%d\n",value);
#endif
            retval = marimba_write(fd, reg, &unset,1);
            if (retval < 0) {
                goto err_all;
            }
        }
    } else {
        // as we need to switch path to AUXPCM we need to move
        // FM I2S lines to PIN CONTROL mode then move
        // BT AUX_PCM to normal mode.
        for( reg = FM_I2S_SD_MODE; reg <= FM_I2S_SCK_MODE; reg++ ) {
#ifdef DEBUG_CHK
            retval = marimba_read(fd, reg,&value, 1);
            ALOGD("value read is:%d\n",value);
#endif
            retval = marimba_write(fd, reg, &set,1);
            if (retval < 0) {
                goto err_all;
            }
        }
        for( reg = BT_PCM_BCLK_MODE; reg <= BT_PCM_SYNC_MODE; reg++ ) {
#ifdef DEBUG_CHK
            retval = marimba_read(fd, reg,&value, 1);
            ALOGD("value read is:%d\n",value);
#endif
            retval = marimba_write(fd, reg, &unset,1);
            if (retval < 0) {
                goto err_all;
            }
        }
    }
    ALOGD("switch pin called with : %d\n",nPath);
    return 0;

err_all:
    return retval;
}