Lines Matching refs:client
73 static int ads1015_read_adc(struct i2c_client *client, unsigned int channel) in ads1015_read_adc() argument
76 struct ads1015_data *data = i2c_get_clientdata(client); in ads1015_read_adc()
87 res = i2c_smbus_read_word_swapped(client, ADS1015_CONFIG); in ads1015_read_adc()
100 res = i2c_smbus_write_word_swapped(client, ADS1015_CONFIG, config); in ads1015_read_adc()
106 res = i2c_smbus_read_word_swapped(client, ADS1015_CONFIG); in ads1015_read_adc()
116 res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); in ads1015_read_adc()
123 static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel, in ads1015_reg_to_mv() argument
126 struct ads1015_data *data = i2c_get_clientdata(client); in ads1015_reg_to_mv()
139 struct i2c_client *client = to_i2c_client(dev); in show_in() local
143 res = ads1015_read_adc(client, index); in show_in()
147 return sprintf(buf, "%d\n", ads1015_reg_to_mv(client, index, res)); in show_in()
165 static int ads1015_remove(struct i2c_client *client) in ads1015_remove() argument
167 struct ads1015_data *data = i2c_get_clientdata(client); in ads1015_remove()
172 device_remove_file(&client->dev, &ads1015_in[k].dev_attr); in ads1015_remove()
177 static int ads1015_get_channels_config_of(struct i2c_client *client) in ads1015_get_channels_config_of() argument
179 struct ads1015_data *data = i2c_get_clientdata(client); in ads1015_get_channels_config_of()
182 if (!client->dev.of_node in ads1015_get_channels_config_of()
183 || !of_get_next_child(client->dev.of_node, NULL)) in ads1015_get_channels_config_of()
186 for_each_child_of_node(client->dev.of_node, node) { in ads1015_get_channels_config_of()
193 dev_err(&client->dev, "invalid reg on %s\n", in ads1015_get_channels_config_of()
200 dev_err(&client->dev, in ads1015_get_channels_config_of()
209 dev_err(&client->dev, "invalid gain on %s\n", in ads1015_get_channels_config_of()
218 dev_err(&client->dev, in ads1015_get_channels_config_of()
234 static void ads1015_get_channels_config(struct i2c_client *client) in ads1015_get_channels_config() argument
237 struct ads1015_data *data = i2c_get_clientdata(client); in ads1015_get_channels_config()
238 struct ads1015_platform_data *pdata = dev_get_platdata(&client->dev); in ads1015_get_channels_config()
248 if (!ads1015_get_channels_config_of(client)) in ads1015_get_channels_config()
260 static int ads1015_probe(struct i2c_client *client, in ads1015_probe() argument
267 data = devm_kzalloc(&client->dev, sizeof(struct ads1015_data), in ads1015_probe()
272 i2c_set_clientdata(client, data); in ads1015_probe()
276 ads1015_get_channels_config(client); in ads1015_probe()
280 err = device_create_file(&client->dev, &ads1015_in[k].dev_attr); in ads1015_probe()
285 data->hwmon_dev = hwmon_device_register(&client->dev); in ads1015_probe()
295 device_remove_file(&client->dev, &ads1015_in[k].dev_attr); in ads1015_probe()