Lines Matching refs:sunrise

53 	struct sunrise_dev *sunrise = i2c_get_clientdata(client);  in sunrise_regmap_read()  local
71 sunrise->ignore_nak ? I2C_M_IGNORE_NAK : 0, in sunrise_regmap_read()
90 struct sunrise_dev *sunrise = i2c_get_clientdata(client); in sunrise_regmap_write() local
103 sunrise->ignore_nak ? I2C_M_IGNORE_NAK : 0, in sunrise_regmap_write()
118 static int sunrise_read_byte(struct sunrise_dev *sunrise, u8 reg) in sunrise_read_byte() argument
120 const struct i2c_client *client = sunrise->client; in sunrise_read_byte()
126 ret = regmap_read(sunrise->regmap, reg, &val); in sunrise_read_byte()
136 static int sunrise_read_word(struct sunrise_dev *sunrise, u8 reg, u16 *val) in sunrise_read_word() argument
138 const struct i2c_client *client = sunrise->client; in sunrise_read_word()
144 ret = regmap_bulk_read(sunrise->regmap, reg, &be_val, sizeof(be_val)); in sunrise_read_word()
156 static int sunrise_write_byte(struct sunrise_dev *sunrise, u8 reg, u8 val) in sunrise_write_byte() argument
158 const struct i2c_client *client = sunrise->client; in sunrise_write_byte()
163 ret = regmap_write(sunrise->regmap, reg, val); in sunrise_write_byte()
171 static int sunrise_write_word(struct sunrise_dev *sunrise, u8 reg, u16 data) in sunrise_write_word() argument
173 const struct i2c_client *client = sunrise->client; in sunrise_write_word()
179 ret = regmap_bulk_write(sunrise->regmap, reg, &be_data, sizeof(be_data)); in sunrise_write_word()
211 static int sunrise_calibrate(struct sunrise_dev *sunrise, in sunrise_calibrate() argument
218 ret = sunrise_write_byte(sunrise, SUNRISE_CALIBRATION_STATUS_REG, 0x00); in sunrise_calibrate()
223 ret = sunrise_write_word(sunrise, SUNRISE_CALIBRATION_COMMAND_REG, data->cmd); in sunrise_calibrate()
227 dev_dbg(&sunrise->client->dev, "%s in progress\n", data->name); in sunrise_calibrate()
235 sunrise, SUNRISE_CALIBRATION_STATUS_REG); in sunrise_calibrate()
243 struct sunrise_dev *sunrise = iio_priv(iiodev); in sunrise_cal_factory_write() local
254 mutex_lock(&sunrise->lock); in sunrise_cal_factory_write()
255 ret = sunrise_calibrate(sunrise, &calib_data[SUNRISE_CALIBRATION_FACTORY]); in sunrise_cal_factory_write()
256 mutex_unlock(&sunrise->lock); in sunrise_cal_factory_write()
268 struct sunrise_dev *sunrise = iio_priv(iiodev); in sunrise_cal_background_write() local
279 mutex_lock(&sunrise->lock); in sunrise_cal_background_write()
280 ret = sunrise_calibrate(sunrise, &calib_data[SUNRISE_CALIBRATION_BACKGROUND]); in sunrise_cal_background_write()
281 mutex_unlock(&sunrise->lock); in sunrise_cal_background_write()
325 struct sunrise_dev *sunrise = iio_priv(iiodev); in sunrise_error_status_read() local
332 mutex_lock(&sunrise->lock); in sunrise_error_status_read()
333 ret = sunrise_read_word(sunrise, SUNRISE_ERROR_STATUS_REG, &value); in sunrise_error_status_read()
335 mutex_unlock(&sunrise->lock); in sunrise_error_status_read()
346 mutex_unlock(&sunrise->lock); in sunrise_error_status_read()
399 struct sunrise_dev *sunrise = iio_priv(iio_dev); in sunrise_read_raw() local
407 mutex_lock(&sunrise->lock); in sunrise_read_raw()
408 ret = sunrise_read_word(sunrise, SUNRISE_CO2_FILTERED_COMP_REG, in sunrise_read_raw()
410 mutex_unlock(&sunrise->lock); in sunrise_read_raw()
419 mutex_lock(&sunrise->lock); in sunrise_read_raw()
420 ret = sunrise_read_word(sunrise, SUNRISE_CHIP_TEMPERATURE_REG, in sunrise_read_raw()
422 mutex_unlock(&sunrise->lock); in sunrise_read_raw()
476 struct sunrise_dev *sunrise; in sunrise_probe() local
486 iio_dev = devm_iio_device_alloc(&client->dev, sizeof(*sunrise)); in sunrise_probe()
490 sunrise = iio_priv(iio_dev); in sunrise_probe()
491 sunrise->client = client; in sunrise_probe()
492 mutex_init(&sunrise->lock); in sunrise_probe()
494 i2c_set_clientdata(client, sunrise); in sunrise_probe()
496 sunrise->regmap = devm_regmap_init(&client->dev, &sunrise_regmap_bus, in sunrise_probe()
498 if (IS_ERR(sunrise->regmap)) { in sunrise_probe()
500 return PTR_ERR(sunrise->regmap); in sunrise_probe()
509 sunrise->ignore_nak = true; in sunrise_probe()