@@ -731,6 +731,47 @@ static const struct of_device_id sn65dsi83_match_table[] = {
};
MODULE_DEVICE_TABLE(of, sn65dsi83_match_table);
+static ssize_t pattern_generator_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t len)
+{
+ struct sn65dsi83 *ctx = dev_get_drvdata(dev);
+ bool arg;
+ int ret;
+
+ ret = kstrtobool(buf, &arg);
+ if (ret < 0)
+ return ret;
+
+ ret = regmap_write(ctx->regmap, REG_VID_CHA_TEST_PATTERN, arg ? 0x10 : 0x00);
+ if (ret < 0)
+ return ret;
+
+ return len;
+}
+
+static ssize_t pattern_generator_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct sn65dsi83 *ctx = dev_get_drvdata(dev);
+ int ret, test_pattern;
+
+ ret = regmap_read(ctx->regmap, REG_VID_CHA_TEST_PATTERN, &test_pattern);
+ if (ret < 0)
+ return ret;
+
+ return sprintf(buf, "%d\n", !!test_pattern);
+}
+
+static DEVICE_ATTR_RW(pattern_generator);
+
+static struct attribute *sn65dsi83_attrs[] = {
+ &dev_attr_pattern_generator.attr,
+ NULL,
+};
+
+ATTRIBUTE_GROUPS(sn65dsi83);
+
static struct i2c_driver sn65dsi83_driver = {
.probe = sn65dsi83_probe,
.remove = sn65dsi83_remove,
@@ -738,6 +779,7 @@ static struct i2c_driver sn65dsi83_driver = {
.driver = {
.name = "sn65dsi83",
.of_match_table = sn65dsi83_match_table,
+ .dev_groups = sn65dsi83_groups,
},
};
module_i2c_driver(sn65dsi83_driver);