/* Brightness scale on the Parade chip */ #define PS8622_MAX_BRIGHTNESS 0xff
/* Timings taken from the version 1.7 datasheet for the PS8622/PS8625 */ #define PS8622_POWER_RISE_T1_MIN_US 10 #define PS8622_POWER_RISE_T1_MAX_US 10000 #define PS8622_RST_HIGH_T2_MIN_US 3000 #define PS8622_RST_HIGH_T2_MAX_US 30000 #define PS8622_PWMO_END_T12_MS 200 #define PS8622_POWER_FALL_T16_MAX_US 10000 #define PS8622_POWER_OFF_T17_MS 500
#if ((PS8622_RST_HIGH_T2_MIN_US + PS8622_POWER_RISE_T1_MAX_US) > \
(PS8622_RST_HIGH_T2_MAX_US + PS8622_POWER_RISE_T1_MIN_US)) #error"T2.min + T1.max must be less than T2.max + T1.min" #endif
/* [7:6] Right-bar GPIO output strength is 8mA */
err = ps8622_set(cl, 0x04, 0x15, 0x40); if (err) goto error;
/* EQ Training State Machine Setting, RCO calibration start */
err = ps8622_set(cl, 0x04, 0x54, 0x10); if (err) goto error;
/* Logic, needs more than 10 I2C command */ /* [4:0] MAX_LANE_COUNT set to max supported lanes */
err = ps8622_set(cl, 0x01, 0x02, 0x80 | ps8622->max_lane_count); if (err) goto error;
/* [4:0] LANE_COUNT_SET set to chosen lane count */
err = ps8622_set(cl, 0x01, 0x21, 0x80 | ps8622->lane_count); if (err) goto error;
err = ps8622_set(cl, 0x00, 0x52, 0x20); if (err) goto error;
if (ps8622->v12) {
ret = regulator_enable(ps8622->v12); if (ret)
DRM_ERROR("fails to enable ps8622->v12");
}
gpiod_set_value(ps8622->gpio_slp, 1);
/* * T1 is the range of time that it takes for the power to rise after we * enable the lcd/ps8622 fet. T2 is the range of time in which the * data sheet specifies we should deassert the reset pin. * * If it takes T1.max for the power to rise, we need to wait atleast * T2.min before deasserting the reset pin. If it takes T1.min for the * power to rise, we need to wait at most T2.max before deasserting the * reset pin.
*/
usleep_range(PS8622_RST_HIGH_T2_MIN_US + PS8622_POWER_RISE_T1_MAX_US,
PS8622_RST_HIGH_T2_MAX_US + PS8622_POWER_RISE_T1_MIN_US);
gpiod_set_value(ps8622->gpio_rst, 1);
/* wait 20ms after RST high */
usleep_range(20000, 30000);
ret = ps8622_send_config(ps8622); if (ret) {
DRM_ERROR("Failed to send config to bridge (%d)\n", ret); return;
}
ps8622->enabled = true;
}
staticvoid ps8622_disable(struct drm_bridge *bridge)
{ /* Delay after panel is disabled */
msleep(PS8622_PWMO_END_T12_MS);
}
/* * This doesn't matter if the regulators are turned off, but something * else might keep them on. In that case, we want to assert the slp gpio * to lower power.
*/
gpiod_set_value(ps8622->gpio_slp, 0);
if (ps8622->v12)
regulator_disable(ps8622->v12);
/* * Sleep for at least the amount of time that it takes the power rail to * fall to prevent asserting the rst gpio from doing anything.
*/
usleep_range(PS8622_POWER_FALL_T16_MAX_US,
2 * PS8622_POWER_FALL_T16_MAX_US);
gpiod_set_value(ps8622->gpio_rst, 0);
ps8622->v12 = devm_regulator_get(dev, "vdd12"); if (IS_ERR(ps8622->v12)) {
dev_info(dev, "no 1.2v regulator found for PS8622\n");
ps8622->v12 = NULL;
}
ps8622->gpio_slp = devm_gpiod_get(dev, "sleep", GPIOD_OUT_HIGH); if (IS_ERR(ps8622->gpio_slp)) {
ret = PTR_ERR(ps8622->gpio_slp);
dev_err(dev, "cannot get gpio_slp %d\n", ret); return ret;
}
/* * Assert the reset pin high to avoid the bridge being * initialized prematurely
*/
ps8622->gpio_rst = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(ps8622->gpio_rst)) {
ret = PTR_ERR(ps8622->gpio_rst);
dev_err(dev, "cannot get gpio_rst %d\n", ret); return ret;
}
ps8622->max_lane_count = id->driver_data;
if (of_property_read_u32(dev->of_node, "lane-count",
&ps8622->lane_count)) {
ps8622->lane_count = ps8622->max_lane_count;
} elseif (ps8622->lane_count > ps8622->max_lane_count) {
dev_info(dev, "lane-count property is too high," "using max_lane_count\n");
ps8622->lane_count = ps8622->max_lane_count;
}
if (!of_property_read_bool(dev->of_node, "use-external-pwm")) {
ps8622->bl = backlight_device_register("ps8622-backlight",
dev, ps8622, &ps8622_backlight_ops,
NULL); if (IS_ERR(ps8622->bl)) {
DRM_ERROR("failed to register backlight\n");
ret = PTR_ERR(ps8622->bl);
ps8622->bl = NULL; return ret;
}
ps8622->bl->props.max_brightness = PS8622_MAX_BRIGHTNESS;
ps8622->bl->props.brightness = PS8622_MAX_BRIGHTNESS;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.