// SPDX-License-Identifier: GPL-2.0-or-later /* * Board info for Lenovo X86 tablets which ship with Android as the factory image * and which have broken DSDT tables. The factory kernels shipped on these * devices typically have a bunch of things hardcoded, rather than specified * in their DSDT. * * Copyright (C) 2021-2023 Hans de Goede <hdegoede@redhat.com>
*/
/* * Various Lenovo models use a TI LP8557 LED backlight controller with its PWM * input connected to a PWM output coming from the LCD panel's controller. * The Android kernels have a hack in the i915 driver to write a non-standard * panel specific DSI register to set the duty-cycle of the LCD's PWM output. * * To avoid having to have a similar hack in the mainline kernel program the * LP8557 to directly set the level and use the lp855x_bl driver for control. * * The LP8557 can either be configured to multiply its PWM input and * the I2C register set level (requiring both to be at 100% for 100% output); * or to only take the I2C register set level into account. * * Multiplying the 2 levels is useful because this will turn off the backlight * when the panel goes off and turns off its PWM output. * * But on some models the panel's PWM output defaults to a duty-cycle of * much less then 100%, severely limiting max brightness. In this case * the LP8557 should be configured to only take the I2C register into * account and the i915 driver must turn off the panel and the backlight * separately using e.g. VBT MIPI sequences to turn off the backlight.
*/ staticstruct lp855x_platform_data lenovo_lp8557_pwm_and_reg_pdata = {
.device_control = 0x86,
.initial_brightness = 128,
};
/* * The HiDeep IST940E touchscreen comes up in I2C-HID mode. The native protocol * reports ABS_MT_PRESSURE and ABS_MT_TOUCH_MAJOR which are not reported in HID * mode, so using native mode is preferred. * It could alternatively be used in HID mode by changing the properties to: * PROPERTY_ENTRY_U32("hid-descr-addr", 0x0020), * PROPERTY_ENTRY_U32("post-reset-deassert-delay-ms", 120), * and changing board_info.type to "hid-over-i2c".
*/ staticconststruct property_entry lenovo_yb1_x90_hideep_ts_props[] = {
PROPERTY_ENTRY_U32("touchscreen-size-x", 1200),
PROPERTY_ENTRY_U32("touchscreen-size-y", 1920),
PROPERTY_ENTRY_U32("touchscreen-max-pressure", 16384),
PROPERTY_ENTRY_BOOL("hideep,force-native-protocol"),
{ }
};
/* * DSDT says UART path is "\\_SB.PCIO.URT1" with a letter 'O' instead of * the number '0' add the link manually.
*/ staticconststruct x86_serdev_info lenovo_yb1_x90_serdevs[] __initconst = {
{
.ctrl.acpi.hid = "8086228A",
.ctrl.acpi.uid = "1",
.ctrl_devname = "serial0",
.serdev_hid = "BCM2E1A",
},
};
/* * The Lenovo Yoga Tablet 2 830 and 1050 (8" vs 10") versions use the same * mainboard, but the 830 uses a portrait LCD panel with a landscape touchscreen, * requiring the touchscreen driver to adjust the touch-coords to match the LCD. * And requiring the accelerometer to have a mount-matrix set to correct for * the 90° rotation of the LCD vs the frame.
*/ staticconstchar * const lenovo_yoga_tab2_830_lms303d_mount_matrix[] = { "0", "1", "0", "-1", "0", "0", "0", "0", "1"
};
staticint __init lenovo_yoga_tab2_830_1050_init_touchscreen(void)
{ struct gpio_desc *gpiod; int ret;
/* Use PMIC GPIO 10 bootstrap pin to differentiate 830 vs 1050 */
ret = x86_android_tablet_get_gpiod("gpio_crystalcove", 10, "yoga_bootstrap", false, GPIOD_ASIS, &gpiod); if (ret) return ret;
/* SUS (INT33FC:02) pin 6 needs to be configured as pmu_clk for the audio codec */ staticconststruct pinctrl_map lenovo_yoga_tab2_830_1050_codec_pinctrl_map =
PIN_MAP_MUX_GROUP(LENOVO_YOGA_TAB2_830_1050_CODEC_NAME, "codec_32khz_clk", "INT33FC:02", "pmu_clk2_grp", "pmu_clk");
/* * These tablet's DSDT does not set acpi_gbl_reduced_hardware, so acpi_power_off() * gets used as pm_power_off handler. This causes "poweroff" on these tablets * to hang hard. Requiring pressing the power button for 30 seconds *twice* * followed by a normal 3 second press to recover. Avoid this by doing an EFI * poweroff instead.
*/ staticint lenovo_yoga_tab2_830_1050_power_off(struct sys_off_data *data)
{
efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
return NOTIFY_DONE;
}
staticint __init lenovo_yoga_tab2_830_1050_init(struct device *dev)
{ int ret;
ret = lenovo_yoga_tab2_830_1050_init_touchscreen(); if (ret) return ret;
ret = lenovo_yoga_tab2_830_1050_init_codec(); if (ret) return ret;
/* SYS_OFF_PRIO_FIRMWARE + 1 so that it runs before acpi_power_off() */
lenovo_yoga_tab2_830_1050_sys_off_handler =
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_FIRMWARE + 1,
lenovo_yoga_tab2_830_1050_power_off, NULL); if (IS_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler)) return PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
if (lenovo_yoga_tab2_830_1050_codec_pinctrl) {
pinctrl_put(lenovo_yoga_tab2_830_1050_codec_pinctrl);
pinctrl_unregister_mappings(&lenovo_yoga_tab2_830_1050_codec_pinctrl_map);
}
}
/* * Lenovo Yoga Tablet 2 Pro 1380F/L * * The Lenovo Yoga Tablet 2 Pro 1380F/L mostly has the same design as the 830F/L * and the 1050F/L so this re-uses some of the handling for that from above.
*/ staticconstchar * const lc824206xa_chg_det_psy[] = { "lc824206xa-charger-detect" };
staticconststruct platform_device_info lenovo_yoga_tab2_1380_pdevs[] __initconst = {
{ /* For the Tablet 2 Pro 1380's custom fast charging driver */
.name = "lenovo-yoga-tab2-pro-1380-fastcharger",
.id = PLATFORM_DEVID_NONE,
},
};
staticconstchar * const lenovo_yoga_tab2_1380_modules[] __initconst = { "bq24190_charger", /* For the Vbus regulator for lc824206xa */
NULL
};
staticint __init lenovo_yoga_tab2_1380_init(struct device *dev)
{ int ret;
/* To verify that the DMI matching works vs the 830 / 1050 models */
pr_info("detected Lenovo Yoga Tablet 2 Pro 1380F/L\n");
ret = lenovo_yoga_tab2_830_1050_init_codec(); if (ret) return ret;
/* SYS_OFF_PRIO_FIRMWARE + 1 so that it runs before acpi_power_off() */
lenovo_yoga_tab2_830_1050_sys_off_handler =
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_FIRMWARE + 1,
lenovo_yoga_tab2_830_1050_power_off, NULL); if (IS_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler)) return PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
/* * The AOSP 3.5 mm Headset: Accessory Specification gives the following values: * Function A Play/Pause: 0 ohm * Function D Voice assistant: 135 ohm * Function B Volume Up 240 ohm * Function C Volume Down 470 ohm * Minimum Mic DC resistance 1000 ohm * Minimum Ear speaker impedance 16 ohm * Note the first max value below must be less then the min. speaker impedance, * to allow CTIA/OMTP detection to work. The other max values are the closest * value from extcon-arizona.c:arizona_micd_levels halfway 2 button resistances.
*/ staticconststruct arizona_micd_range arizona_micd_aosp_ranges[] = {
{ .max = 11, .key = KEY_PLAYPAUSE },
{ .max = 186, .key = KEY_VOICECOMMAND },
{ .max = 348, .key = KEY_VOLUMEUP },
{ .max = 752, .key = KEY_VOLUMEDOWN },
};
staticint __init lenovo_yt3_init(struct device *dev)
{ int ret;
/* * The "bq25892_0" charger IC has its /CE (Charge-Enable) and OTG pins * connected to GPIOs, rather then having them hardwired to the correct * values as is normally done. * * The bq25890_charger driver controls these through I2C, but this only * works if not overridden by the pins. Set these pins here: * 1. Set /CE to 1 to allow charging. * 2. Set OTG to 0 disable V5 boost output since the 5V boost output of * the main "bq25892_1" charger is used when necessary.
*/
/* /CE pin */
ret = x86_android_tablet_get_gpiod("INT33FF:02", 22, "bq25892_0_ce", true, GPIOD_OUT_HIGH, NULL); if (ret < 0) return ret;
/* OTG pin */
ret = x86_android_tablet_get_gpiod("INT33FF:03", 19, "bq25892_0_otg", false, GPIOD_OUT_LOW, NULL); if (ret < 0) return ret;
/* Enable the regulators used by the touchscreen */
intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0x9b, 0x02, 0xff);
intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0xa0, 0x02, 0xff);
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.