drm/bridge: ti-sn65dsi83: Add a sysfs entry for the pattern generator
Subsystems (3)
PATCH 1/1 drm/bridge: ti-sn65dsi83: Add a sysfs entry for the pattern generator
From: Fabio Estevam <[email protected]>
The sn65dsi83 chip has a test pattern generator capability.
Add a sysfs entry to allow enabling and disabling it in runtime.
This is helpful during the MIPI DSI/LVDS bringup.
To enable the test pattern generator:
echo 1 > /sys/bus/i2c/devices/0-002c/pattern_generator
To disable the test pattern generator:
echo 0 > /sys/bus/i2c/devices/0-002c/pattern_generator
--- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
drivers/gpu/drm/bridge/ti-sn65dsi83.c +42 -0
@@ -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);
Signature · 1 line
2.25.1
Quoted 8 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
The sn65dsi83 chip has a test pattern generator capability.
Add a sysfs entry to allow enabling and disabling it in runtime.
This is helpful during the MIPI DSI/LVDS bringup.
Quoted 7 lines
To enable the test pattern generator:
echo 1 >
/sys/bus/i2c/devices/0-002c/pattern_generatorTo disable the test pattern generator:
echo 0 >
/sys/bus/i2c/devices/0-002c/pattern_generator
I have more of a design question here:
- Shouldn't we implement some sort of standardized helper to set test pattern on various other bridges ? There are other bridges which do support test pattern generation too.
- The API should be able to select different test patterns, since some bridges support more than one.
Thoughts ?