drivers/platform/x86/x86-android-tablets/lenovo.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/x86-android-tablets/lenovo.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/x86-android-tablets/lenovo.c- Extension
.c- Size
- 33709 bytes
- Lines
- 1080
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/efi.hlinux/gpio/machine.hlinux/gpio/property.hlinux/input-event-codes.hlinux/mfd/arizona/pdata.hlinux/mfd/arizona/registers.hlinux/mfd/intel_soc_pmic.hlinux/pinctrl/consumer.hlinux/pinctrl/machine.hlinux/platform_data/lp855x.hlinux/platform_device.hlinux/power/bq24190_charger.hlinux/reboot.hlinux/rmi.hlinux/spi/spi.hshared-psy-info.hx86-android-tablets.h
Detected Declarations
function lenovo_yb1_x90_initfunction lenovo_yoga_tab2_830_1050_init_touchscreenfunction lenovo_yoga_tab2_830_1050_init_codecfunction lenovo_yoga_tab2_830_1050_power_offfunction lenovo_yoga_tab2_830_1050_initfunction lenovo_yoga_tab2_830_1050_exitfunction lenovo_yoga_tab2_1380_initfunction lenovo_yt3_init
Annotated Snippet
// 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 <hansg@kernel.org>
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/efi.h>
#include <linux/gpio/machine.h>
#include <linux/gpio/property.h>
#include <linux/input-event-codes.h>
#include <linux/mfd/arizona/pdata.h>
#include <linux/mfd/arizona/registers.h>
#include <linux/mfd/intel_soc_pmic.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pinctrl/machine.h>
#include <linux/platform_data/lp855x.h>
#include <linux/platform_device.h>
#include <linux/power/bq24190_charger.h>
#include <linux/reboot.h>
#include <linux/rmi.h>
#include <linux/spi/spi.h>
#include "shared-psy-info.h"
#include "x86-android-tablets.h"
/*
* 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.
*/
static struct lp855x_platform_data lenovo_lp8557_pwm_and_reg_pdata = {
.device_control = 0x86,
.initial_brightness = 128,
};
static struct lp855x_platform_data lenovo_lp8557_reg_only_pdata = {
.device_control = 0x85,
.initial_brightness = 128,
};
static const struct software_node arizona_gpiochip_node = {
.name = "arizona",
};
static const struct software_node crystalcove_gpiochip_node = {
.name = "gpio_crystalcove",
};
/* Lenovo Yoga Book X90F / X90L's Android factory image has everything hardcoded */
static const struct property_entry lenovo_yb1_x90_goodix_props[] = {
PROPERTY_ENTRY_GPIO("reset-gpios", &cherryview_gpiochip_nodes[1], 53, GPIO_ACTIVE_HIGH),
PROPERTY_ENTRY_GPIO("irq-gpios", &cherryview_gpiochip_nodes[1], 56, GPIO_ACTIVE_HIGH),
{ }
};
static const struct software_node lenovo_yb1_x90_goodix_node = {
.properties = lenovo_yb1_x90_goodix_props,
};
static const struct property_entry lenovo_yb1_x90_wacom_props[] = {
PROPERTY_ENTRY_U32("hid-descr-addr", 0x0001),
PROPERTY_ENTRY_U32("post-reset-deassert-delay-ms", 150),
PROPERTY_ENTRY_GPIO("reset-gpios", &cherryview_gpiochip_nodes[0], 82, GPIO_ACTIVE_LOW),
{ }
};
Annotation
- Immediate include surface: `linux/efi.h`, `linux/gpio/machine.h`, `linux/gpio/property.h`, `linux/input-event-codes.h`, `linux/mfd/arizona/pdata.h`, `linux/mfd/arizona/registers.h`, `linux/mfd/intel_soc_pmic.h`, `linux/pinctrl/consumer.h`.
- Detected declarations: `function lenovo_yb1_x90_init`, `function lenovo_yoga_tab2_830_1050_init_touchscreen`, `function lenovo_yoga_tab2_830_1050_init_codec`, `function lenovo_yoga_tab2_830_1050_power_off`, `function lenovo_yoga_tab2_830_1050_init`, `function lenovo_yoga_tab2_830_1050_exit`, `function lenovo_yoga_tab2_1380_init`, `function lenovo_yt3_init`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.