diff options
Diffstat (limited to 'drivers/staging/cg2900/mfd/cg2900_audio.c')
-rw-r--r-- | drivers/staging/cg2900/mfd/cg2900_audio.c | 76 |
1 files changed, 49 insertions, 27 deletions
diff --git a/drivers/staging/cg2900/mfd/cg2900_audio.c b/drivers/staging/cg2900/mfd/cg2900_audio.c index 2f00d79ed1e..267e4bd8a02 100644 --- a/drivers/staging/cg2900/mfd/cg2900_audio.c +++ b/drivers/staging/cg2900/mfd/cg2900_audio.c @@ -3,6 +3,7 @@ * Authors: * Par-Gunnar Hjalmdahl (par-gunnar.p.hjalmdahl@stericsson.com) for ST-Ericsson. * Kjell Andersson (kjell.k.andersson@stericsson.com) for ST-Ericsson. + * Hemant Gupta (hemant.gupta@stericsson.com) for ST-Ericsson. * License terms: GNU General Public License (GPL), version 2 * * Linux Bluetooth Audio Driver for ST-Ericsson CG2900 controller. @@ -50,8 +51,11 @@ /* Used to select proper API, ignoring subrevisions etc */ enum chip_revision { - CHIP_REV_PG1, - CHIP_REV_PG2 + CG2900_CHIP_REV_PG1, + CG2900_CHIP_REV_PG2, + CG2905_CHIP_REV_PG1_1, + CG2910_CHIP_REV_PG1, + CG2910_CHIP_REV_PG2 }; /** @@ -130,7 +134,7 @@ struct endpoint_config_node { * @false otherwise. * @endpoints: List containing the endpoint configurations. * @stream_ids: Bitmask for in-use stream ids (only used with - * PG2 chip API). + * CG2900 PG2 onwards chip API). */ struct audio_info { struct list_head list; @@ -880,7 +884,7 @@ static int send_vs_delete_stream(struct audio_user *audio_user, struct audio_cb_info *cb_info = cg2900_get_usr(pf_data); /* Now delete the stream - format command... */ - if (info->revision == CHIP_REV_PG1) { + if (info->revision == CG2900_CHIP_REV_PG1) { struct bt_vs_reset_session_cfg_cmd *cmd; dev_dbg(BT_DEV, "BT: HCI_VS_Reset_Session_Configuration\n"); @@ -933,12 +937,13 @@ static int send_vs_delete_stream(struct audio_user *audio_user, } /* wait for response */ - if (info->revision == CHIP_REV_PG1) { + if (info->revision == CG2900_CHIP_REV_PG1) { err = receive_bt_cmd_complete(audio_user, opcode, NULL, 0); } else { u8 vs_err; - /* All commands in PG2 API returns one byte extra status */ + /* All commands on CG2900 PG2 onwards + * API returns one byte extra status */ err = receive_bt_cmd_complete(audio_user, opcode, &vs_err, sizeof(vs_err)); @@ -1250,7 +1255,8 @@ static int send_vs_stream_ctrl(struct audio_user *user, u8 stream, u8 command) goto finished; } - /* All commands in PG2 API returns one byte with extra status */ + /* All commands on CG2900 PG2 onwards + * API returns one byte extra status */ err = receive_bt_cmd_complete(user, CG2900_MC_VS_STREAM_CONTROL, &vs_err, sizeof(vs_err)); @@ -1338,7 +1344,8 @@ static int send_vs_create_stream(struct audio_user *user, u8 inport, goto finished_release_id; } - /* All commands in PG2 API returns one byte with extra status */ + /* All commands on CG2900 PG2 onwards + * API returns one byte extra status */ err = receive_bt_cmd_complete(user, CG2900_MC_VS_CREATE_STREAM, &vs_err, sizeof(vs_err)); @@ -1423,7 +1430,8 @@ static int send_vs_port_cfg(struct audio_user *user, u8 port, goto finished; } - /* All commands in PG2 API returns one byte with extra status */ + /* All commands on CG2900 PG2 onwards + * API returns one byte extra status */ err = receive_bt_cmd_complete(user, CG2900_MC_VS_PORT_CONFIG, &vs_err, sizeof(vs_err)); if (err) @@ -1516,8 +1524,8 @@ static int set_dai_config_pg1(struct audio_user *audio_user, i2s_pcm = &config->conf.i2s_pcm; /* - * PG1 chips don't support I2S over the PCM/I2S bus, - * and PG2 chips don't use this command + * CG2900 PG1 chips don't support I2S over the PCM/I2S bus, + * and CG2900 PG2 onwards chips don't use this command */ if (i2s_pcm->protocol != PORT_PROTOCOL_PCM) { dev_err(BT_DEV, @@ -1583,13 +1591,15 @@ finished_unlock_mutex: } /** - * set_dai_config_pg2() - Internal implementation of @cg2900_audio_set_dai_config for PG2 hardware. + * set_dai_config_pg2() - Internal implementation of + * cg2900_audio_set_dai_config for CG2900 PG2 onwards hardware. * @audio_user: Pointer to audio user struct. * @config: Pointer to the configuration to set. * - * Sets the Digital Audio Interface (DAI) configuration for PG2 - * hardware. This is an internal function and basic - * argument-verification should have been done by the caller. + * Sets the Digital Audio Interface (DAI) configuration for + * CG2900 PG2 onwards hardware. This is an internal function + * and basic argument-verification should have been + * done by the caller. * * Returns: * 0 if there is no error. @@ -1831,7 +1841,7 @@ static int conn_start_i2s_to_fm_rx(struct audio_user *audio_user, goto finished_unlock_mutex; /* Set up the stream */ - if (info->revision == CHIP_REV_PG1) { + if (info->revision == CG2900_CHIP_REV_PG1) { struct i2s_fm_stream_config_priv stream_priv; /* Now send HCI_VS_Set_Session_Configuration command */ @@ -1868,7 +1878,7 @@ static int conn_start_i2s_to_fm_rx(struct audio_user *audio_user, dev_dbg(FM_DEV, "stream_handle set to %d\n", *stream_handle); /* Now start the stream */ - if (info->revision == CHIP_REV_PG1) + if (info->revision == CG2900_CHIP_REV_PG1) err = send_vs_session_ctrl(audio_user, *stream_handle, CG2900_BT_SESSION_START); else @@ -1964,7 +1974,7 @@ static int conn_start_i2s_to_fm_tx(struct audio_user *audio_user, goto finished_unlock_mutex; /* Set up the stream */ - if (info->revision == CHIP_REV_PG1) { + if (info->revision == CG2900_CHIP_REV_PG1) { struct i2s_fm_stream_config_priv stream_priv; /* Now send HCI_VS_Set_Session_Configuration command */ @@ -2001,7 +2011,7 @@ static int conn_start_i2s_to_fm_tx(struct audio_user *audio_user, dev_dbg(FM_DEV, "stream_handle set to %d\n", *stream_handle); /* Now start the stream */ - if (info->revision == CHIP_REV_PG1) + if (info->revision == CG2900_CHIP_REV_PG1) err = send_vs_session_ctrl(audio_user, *stream_handle, CG2900_BT_SESSION_START); else @@ -2112,7 +2122,7 @@ static int conn_start_pcm_to_sco(struct audio_user *audio_user, mutex_lock(&info->bt_mutex); /* Set up the stream */ - if (info->revision == CHIP_REV_PG1) { + if (info->revision == CG2900_CHIP_REV_PG1) { err = send_vs_session_config(audio_user, config_pcm_sco_stream, &bt_config->sco); } else { @@ -2143,7 +2153,7 @@ static int conn_start_pcm_to_sco(struct audio_user *audio_user, dev_dbg(BT_DEV, "stream_handle set to %d\n", *stream_handle); /* Now start the stream */ - if (info->revision == CHIP_REV_PG1) + if (info->revision == CG2900_CHIP_REV_PG1) err = send_vs_session_ctrl(audio_user, *stream_handle, CG2900_BT_SESSION_START); else @@ -2193,7 +2203,7 @@ static int conn_stop_stream(struct audio_user *audio_user, mutex_lock(&info->bt_mutex); /* Now stop the stream */ - if (info->revision == CHIP_REV_PG1) + if (info->revision == CG2900_CHIP_REV_PG1) err = send_vs_session_ctrl(audio_user, stream_handle, CG2900_BT_SESSION_STOP); else @@ -2357,11 +2367,23 @@ int cg2900_audio_open(unsigned int *session, struct device *parent) switch (rev_data.revision) { case CG2900_PG1_REV: case CG2900_PG1_SPECIAL_REV: - info->revision = CHIP_REV_PG1; + info->revision = CG2900_CHIP_REV_PG1; break; case CG2900_PG2_REV: - info->revision = CHIP_REV_PG2; + info->revision = CG2900_CHIP_REV_PG2; + break; + + case CG2905_PG1_1_REV: + info->revision = CG2905_CHIP_REV_PG1_1; + break; + + case CG2910_PG1_REV: + info->revision = CG2910_CHIP_REV_PG1; + break; + + case CG2910_PG2_REV: + info->revision = CG2910_CHIP_REV_PG2; break; default: @@ -2501,10 +2523,10 @@ int cg2900_audio_set_dai_config(unsigned int session, return -EIO; } - /* Different commands are used for PG1 and PG2 */ - if (info->revision == CHIP_REV_PG1) + /* Different command is used for CG2900 PG1 */ + if (info->revision == CG2900_CHIP_REV_PG1) err = set_dai_config_pg1(audio_user, config); - else if (info->revision == CHIP_REV_PG2) + else err = set_dai_config_pg2(audio_user, config); return err; |