Lines Matching refs:ddata
48 static int bh1780_write(struct bh1780_data *ddata, u8 reg, u8 val, char *msg) in bh1780_write() argument
50 int ret = i2c_smbus_write_byte_data(ddata->client, reg, val); in bh1780_write()
52 dev_err(&ddata->client->dev, in bh1780_write()
58 static int bh1780_read(struct bh1780_data *ddata, u8 reg, char *msg) in bh1780_read() argument
60 int ret = i2c_smbus_read_byte_data(ddata->client, reg); in bh1780_read()
62 dev_err(&ddata->client->dev, in bh1780_read()
72 struct bh1780_data *ddata = platform_get_drvdata(pdev); in bh1780_show_lux() local
75 lsb = bh1780_read(ddata, BH1780_REG_DLOW, "DLOW"); in bh1780_show_lux()
79 msb = bh1780_read(ddata, BH1780_REG_DHIGH, "DHIGH"); in bh1780_show_lux()
91 struct bh1780_data *ddata = platform_get_drvdata(pdev); in bh1780_show_power_state() local
94 state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL"); in bh1780_show_power_state()
106 struct bh1780_data *ddata = platform_get_drvdata(pdev); in bh1780_store_power_state() local
117 mutex_lock(&ddata->lock); in bh1780_store_power_state()
119 error = bh1780_write(ddata, BH1780_REG_CONTROL, val, "CONTROL"); in bh1780_store_power_state()
121 mutex_unlock(&ddata->lock); in bh1780_store_power_state()
126 ddata->power_state = val; in bh1780_store_power_state()
127 mutex_unlock(&ddata->lock); in bh1780_store_power_state()
151 struct bh1780_data *ddata = NULL; in bh1780_probe() local
159 ddata = kzalloc(sizeof(struct bh1780_data), GFP_KERNEL); in bh1780_probe()
160 if (ddata == NULL) { in bh1780_probe()
165 ddata->client = client; in bh1780_probe()
166 i2c_set_clientdata(client, ddata); in bh1780_probe()
168 ret = bh1780_read(ddata, BH1780_REG_PARTID, "PART ID"); in bh1780_probe()
175 mutex_init(&ddata->lock); in bh1780_probe()
184 kfree(ddata); in bh1780_probe()
190 struct bh1780_data *ddata; in bh1780_remove() local
192 ddata = i2c_get_clientdata(client); in bh1780_remove()
194 kfree(ddata); in bh1780_remove()
202 struct bh1780_data *ddata; in bh1780_suspend() local
206 ddata = i2c_get_clientdata(client); in bh1780_suspend()
207 state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL"); in bh1780_suspend()
211 ddata->power_state = state & BH1780_POWMASK; in bh1780_suspend()
213 ret = bh1780_write(ddata, BH1780_REG_CONTROL, BH1780_POFF, in bh1780_suspend()
224 struct bh1780_data *ddata; in bh1780_resume() local
228 ddata = i2c_get_clientdata(client); in bh1780_resume()
229 state = ddata->power_state; in bh1780_resume()
230 ret = bh1780_write(ddata, BH1780_REG_CONTROL, state, in bh1780_resume()