Lines Matching refs:bh1780
43 static int bh1780_write(struct bh1780_data *bh1780, u8 reg, u8 val)
45 int ret = i2c_smbus_write_byte_data(bh1780->client,
49 dev_err(&bh1780->client->dev,
56 static int bh1780_read(struct bh1780_data *bh1780, u8 reg)
58 int ret = i2c_smbus_read_byte_data(bh1780->client,
61 dev_err(&bh1780->client->dev,
68 static int bh1780_read_word(struct bh1780_data *bh1780, u8 reg)
70 int ret = i2c_smbus_read_word_data(bh1780->client,
73 dev_err(&bh1780->client->dev,
84 struct bh1780_data *bh1780 = iio_priv(indio_dev);
88 return bh1780_write(bh1780, (u8)reg, (u8)writeval);
90 ret = bh1780_read(bh1780, (u8)reg);
103 struct bh1780_data *bh1780 = iio_priv(indio_dev);
110 pm_runtime_get_sync(&bh1780->client->dev);
111 value = bh1780_read_word(bh1780, BH1780_REG_DLOW);
114 pm_runtime_mark_last_busy(&bh1780->client->dev);
115 pm_runtime_put_autosuspend(&bh1780->client->dev);
147 struct bh1780_data *bh1780;
154 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*bh1780));
158 bh1780 = iio_priv(indio_dev);
159 bh1780->client = client;
163 ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_PON);
171 ret = bh1780_read(bh1780, BH1780_REG_PARTID);
188 indio_dev->name = "bh1780";
207 struct bh1780_data *bh1780 = iio_priv(indio_dev);
214 ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_POFF);
224 struct bh1780_data *bh1780 = iio_priv(indio_dev);
227 ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_POFF);
240 struct bh1780_data *bh1780 = iio_priv(indio_dev);
243 ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_PON);
259 { "bh1780", 0 },
276 .name = "bh1780",