@@ -134,6 +134,38 @@ static SENSOR_DEVICE_ATTR_2(avs1_enabled, 0644,
isl68137_avs_enable_show, isl68137_avs_enable_store,
0, 1);
+static ssize_t isl68137_word_show(struct device *dev,
+ struct device_attribute *devattr, char *buf)
+{
+ struct i2c_client *client = kobj_to_i2c_client(&dev->kobj);
+ struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr);
+ int val = pmbus_read_word_data(client, attr->index, attr->nr);
+ return snprintf(buf, PAGE_SIZE, "%d\n", val);
+}
+
+static ssize_t isl68137_word_store(struct device *dev,
+ struct device_attribute *devattr,
+ const char *buf, size_t count)
+{
+ struct i2c_client *client = kobj_to_i2c_client(&dev->kobj);
+ struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr);
+ char *end;
+ int rc;
+ long new = simple_strtol(buf, &end, 0);
+ if (end == buf || new > INT_MAX || new < INT_MIN)
+ return -EINVAL;
+
+ rc = pmbus_write_word_data(client, attr->index, attr->nr, new);
+ return rc < 0 ? rc : count;
+}
+
+static SENSOR_DEVICE_ATTR_2(vout0_max, 0644,
+ isl68137_word_show, isl68137_word_store,
+ PMBUS_VOUT_MAX, 0);
+static SENSOR_DEVICE_ATTR_2(vout1_max, 0644,
+ isl68137_word_show, isl68137_word_store,
+ PMBUS_VOUT_MAX, 1);
+
static int isl68137_remove(struct i2c_client *client);
static int isl68137_probe(struct i2c_client *client,
@@ -153,6 +185,14 @@ static int isl68137_probe(struct i2c_client *client,
&sensor_dev_attr_avs1_enabled.dev_attr);
if (rc)
goto out_fail;
+ rc = device_create_file(&client->dev,
+ &sensor_dev_attr_vout0_max.dev_attr);
+ if (rc)
+ goto out_fail;
+ rc = device_create_file(&client->dev,
+ &sensor_dev_attr_vout1_max.dev_attr);
+ if (rc)
+ goto out_fail;
return rc;
@@ -163,6 +203,10 @@ static int isl68137_probe(struct i2c_client *client,
static int isl68137_remove(struct i2c_client *client)
{
+ device_remove_file(&client->dev,
+ &sensor_dev_attr_vout1_max.dev_attr);
+ device_remove_file(&client->dev,
+ &sensor_dev_attr_vout0_max.dev_attr);
device_remove_file(&client->dev,
&sensor_dev_attr_avs1_enabled.dev_attr);
device_remove_file(&client->dev,