Lines Matching defs:ddata
47 static int bh1780_write(struct bh1780_data *ddata, u8 reg, u8 val, char *msg)
49 int ret = i2c_smbus_write_byte_data(ddata->client, reg, val);
51 dev_err(&ddata->client->dev,
57 static int bh1780_read(struct bh1780_data *ddata, u8 reg, char *msg)
59 int ret = i2c_smbus_read_byte_data(ddata->client, reg);
61 dev_err(&ddata->client->dev,
71 struct bh1780_data *ddata = platform_get_drvdata(pdev);
74 lsb = bh1780_read(ddata, BH1780_REG_DLOW, "DLOW");
78 msb = bh1780_read(ddata, BH1780_REG_DHIGH, "DHIGH");
90 struct bh1780_data *ddata = platform_get_drvdata(pdev);
93 state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL");
105 struct bh1780_data *ddata = platform_get_drvdata(pdev);
116 mutex_lock(&ddata->lock);
118 error = bh1780_write(ddata, BH1780_REG_CONTROL, val, "CONTROL");
120 mutex_unlock(&ddata->lock);
125 ddata->power_state = val;
126 mutex_unlock(&ddata->lock);
150 struct bh1780_data *ddata = NULL;
158 ddata = kzalloc(sizeof(struct bh1780_data), GFP_KERNEL);
159 if (ddata == NULL) {
164 ddata->client = client;
165 i2c_set_clientdata(client, ddata);
167 ret = bh1780_read(ddata, BH1780_REG_PARTID, "PART ID");
174 mutex_init(&ddata->lock);
183 kfree(ddata);
189 struct bh1780_data *ddata;
191 ddata = i2c_get_clientdata(client);
193 kfree(ddata);
201 struct bh1780_data *ddata;
204 ddata = i2c_get_clientdata(client);
205 state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL");
209 ddata->power_state = state & BH1780_POWMASK;
211 ret = bh1780_write(ddata, BH1780_REG_CONTROL, BH1780_POFF,
222 struct bh1780_data *ddata;
225 ddata = i2c_get_clientdata(client);
226 state = ddata->power_state;
228 ret = bh1780_write(ddata, BH1780_REG_CONTROL, state,