/* Enable the resource. The function returns with error or the content of the register  */
int twl4030_codec_enable_resource(enum twl4030_codec_res id)
/* Enable the resource. The function returns with error or the content of the register  */
int twl4030_codec_enable_resource(enum twl4030_codec_res id)
{
	struct twl4030_codec *codec = platform_get_drvdata(twl4030_codec_dev);
	int val;
	if (id >= TWL4030_CODEC_RES_MAX) {
		dev_err(&twl4030_codec_dev->dev,
				"Invalid resource ID (%u)\n", id);
		return -EINVAL;
	}
	mutex_lock(&codec->mutex);
	if (!codec->resource[id].request_count)
		val = twl4030_codec_set_resource(id, 1);
	else
		val = twl4030_codec_get_resource(id);
	codec->resource[id].request_count++;
	mutex_unlock(&codec->mutex);
	return val;
}