static int cs8427_i2c_read(struct cs8427 *chip,
				unsigned short reg,
				int bytes, void *dest)
{
	u32 err = 0, ret = 0;
	struct cs8427_platform_data *pdata = chip->client->dev.platform_data;
	/*
	 * enable the 100KHz level shifter to communicate
	 * with CS8427 chip
	 */
	if (pdata->enable) {
		err = pdata->enable(1, pdata->ls_gpio);
		if (err < 0) {
			dev_err(&chip->client->dev,
				"failed to enable the level shifter\n");
			return err;
		}
	}
	ret = cs8427_i2c_read_device(chip, reg,
					bytes, dest);

	/*
	 * Disable the 100KHz level shifter to communicate
	 * with CS8427 chip
	 */
	if (pdata->enable) {
		err = pdata->enable(0, pdata->ls_gpio);
		if (err < 0) {
			dev_err(&chip->client->dev,
				"failed to disable the level shifter\n");
			return err;
		}
	}
	return ret;
}
Ejemplo n.º 2
0
static int cs8427_i2c_read(struct cs8427 *chip,
				unsigned short reg,
				int bytes, void *dest)
{
	return cs8427_i2c_read_device(chip, reg,
					bytes, dest);
}