static int rk610_codec_write(struct snd_soc_codec *codec, unsigned int reg, unsigned int value) { struct rk610_codec_priv *rk610_codec = snd_soc_codec_get_drvdata(rk610_codec_codec); u8 data[2]; struct i2c_client *i2c = to_i2c_client(codec->dev); #ifdef CONFIG_MODEM_SOUND if(rk610_codec->call_enable) return 0; #endif if(value == rk610_codec_read_reg_cache(codec,reg)) return 0; DBG("Enter::%s, %d, reg=0x%02X, value=0x%02X\n",__FUNCTION__,__LINE__, reg, value); data[0] = value & 0x00ff; i2c->addr = (i2c->addr & 0x60)|reg; if (codec->hw_write(i2c, data, 1) == 1){ // DBG("================%s %d Run OK================\n",__FUNCTION__,__LINE__); rk610_codec_write_reg_cache (codec, reg, value); return 0; }else{ DBG("================%s %d Run EIO================\n",__FUNCTION__,__LINE__); return -EIO; } }
static int rk610_codec_write_incall(struct snd_soc_codec *codec, unsigned int reg, unsigned int value) { u8 data[2]; struct i2c_client *i2c = to_i2c_client(codec->dev); DBG("Enter::%s, %d, reg=0x%02X, value=0x%02X\n",__FUNCTION__,__LINE__, reg, value); data[0] = value & 0x00ff; rk610_codec_write_reg_cache (codec, reg, value); i2c = (struct i2c_client *)codec->control_data; i2c->addr = (i2c->addr & 0x60)|reg; if (codec->hw_write(i2c, data, 1) == 1) return 0; else return -EIO; }
static int rk610_codec_write(struct snd_soc_codec *codec, unsigned int reg, unsigned int value) { u8 data[2]; struct i2c_client *i2c; DBG("Enter::%s, %d, reg=0x%02X, value=0x%02X\n",__FUNCTION__,__LINE__, reg, value); data[0] = value & 0x00ff; rk610_codec_write_reg_cache (codec, reg, value); i2c = (struct i2c_client *)codec->control_data; i2c->addr = (i2c->addr & 0x60)|reg; if (codec->hw_write(codec->control_data, data, 1) == 1){ // DBG("================%s %d Run OK================\n",__FUNCTION__,__LINE__); return 0; }else{ DBG("================%s %d Run EIO================\n",__FUNCTION__,__LINE__); return -EIO; } }