/*----------------------------------------------------------------------------- Sends a command to the part and returns the reply bytes -----------------------------------------------------------------------------*/ static int si47xx_command(u8 cmd_size, u8 *cmd, u8 reply_size, u8 *reply) { int ret = 0; ret = i2c_master_send((struct i2c_client *)(Si47xx_dev->client), cmd, cmd_size); if (ret < 0) { dev_err(Si47xx_dev->dev, "%s si47xx_command failed %d\n", __func__, ret); return ret; } si47xx_waitForCTS(); if (reply_size) { ret = i2c_master_recv((struct i2c_client *)(Si47xx_dev->client), reply, reply_size); if (ret < 0) dev_err(Si47xx_dev->dev, "%s si47xx_command failed %d\n", __func__, ret); return ret; } return ret; }
//----------------------------------------------------------------------------- // Sends a command to the part and returns the reply bytes //----------------------------------------------------------------------------- static void si47XX_Command(u8 cmd_size, u8 *cmd, u8 reply_size, u8 *reply) { // It is always a good idea to check for cts prior to sending a command to // the part. si47xx_waitForCTS(); // Write the command to the part si47xx_lowWrite(cmd_size, cmd); // Wait for CTS after sending the command si47xx_waitForCTS(); // If the calling function would like to have results then read them. if(reply_size) { si47xx_lowRead(reply_size, reply); } }