Lines Matching refs:ddata
49 static int bh1780_write(struct bh1780_data *ddata, u8 reg, u8 val, char *msg) in bh1780_write() argument
51 int ret = i2c_smbus_write_byte_data(ddata->client, reg, val); in bh1780_write()
53 dev_err(&ddata->client->dev, in bh1780_write()
59 static int bh1780_read(struct bh1780_data *ddata, u8 reg, char *msg) in bh1780_read() argument
61 int ret = i2c_smbus_read_byte_data(ddata->client, reg); in bh1780_read()
63 dev_err(&ddata->client->dev, in bh1780_read()
73 struct bh1780_data *ddata = platform_get_drvdata(pdev); in bh1780_show_lux() local
76 lsb = bh1780_read(ddata, BH1780_REG_DLOW, "DLOW"); in bh1780_show_lux()
80 msb = bh1780_read(ddata, BH1780_REG_DHIGH, "DHIGH"); in bh1780_show_lux()
92 struct bh1780_data *ddata = platform_get_drvdata(pdev); in bh1780_show_power_state() local
95 state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL"); in bh1780_show_power_state()
107 struct bh1780_data *ddata = platform_get_drvdata(pdev); in bh1780_store_power_state() local
118 mutex_lock(&ddata->lock); in bh1780_store_power_state()
120 error = bh1780_write(ddata, BH1780_REG_CONTROL, val, "CONTROL"); in bh1780_store_power_state()
122 mutex_unlock(&ddata->lock); in bh1780_store_power_state()
127 ddata->power_state = val; in bh1780_store_power_state()
128 mutex_unlock(&ddata->lock); in bh1780_store_power_state()
152 struct bh1780_data *ddata; in bh1780_probe() local
158 ddata = devm_kzalloc(&client->dev, sizeof(struct bh1780_data), in bh1780_probe()
160 if (ddata == NULL) in bh1780_probe()
163 ddata->client = client; in bh1780_probe()
164 i2c_set_clientdata(client, ddata); in bh1780_probe()
166 ret = bh1780_read(ddata, BH1780_REG_PARTID, "PART ID"); in bh1780_probe()
173 mutex_init(&ddata->lock); in bh1780_probe()
188 struct bh1780_data *ddata; in bh1780_suspend() local
192 ddata = i2c_get_clientdata(client); in bh1780_suspend()
193 state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL"); in bh1780_suspend()
197 ddata->power_state = state & BH1780_POWMASK; in bh1780_suspend()
199 ret = bh1780_write(ddata, BH1780_REG_CONTROL, BH1780_POFF, in bh1780_suspend()
210 struct bh1780_data *ddata; in bh1780_resume() local
214 ddata = i2c_get_clientdata(client); in bh1780_resume()
215 state = ddata->power_state; in bh1780_resume()
216 ret = bh1780_write(ddata, BH1780_REG_CONTROL, state, in bh1780_resume()