Lines Matching +full:- +full:- +full:enable +full:- +full:sparse

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * lenovo-ymc.c - Lenovo Yoga Mode Control driver
13 #include <linux/input/sparse-keymap.h>
15 #include "ideapad-laptop.h"
17 #define LENOVO_YMC_EVENT_GUID "06129D99-6083-4164-81AD-F092F9D773A6"
18 #define LENOVO_YMC_QUERY_GUID "09B0EE6E-C3FD-4243-8DA1-7911FF80BB8C"
25 MODULE_PARM_DESC(ec_trigger, "Enable EC triggering work-around to force emitting tablet mode events…
29 MODULE_PARM_DESC(force, "Force loading on boards without a convertible DMI chassis-type");
72 if (!priv->ec_acpi_dev) in lenovo_ymc_trigger_ec()
75 err = write_ec_cmd(priv->ec_acpi_dev->handle, VPCCMD_W_YMC, 1); in lenovo_ymc_trigger_ec()
77 dev_warn(&wdev->dev, "Could not write YMC: %d\n", err); in lenovo_ymc_trigger_ec()
96 struct lenovo_ymc_private *priv = dev_get_drvdata(&wdev->dev); in lenovo_ymc_notify()
110 dev_warn(&wdev->dev, in lenovo_ymc_notify()
118 if (obj->type != ACPI_TYPE_INTEGER) { in lenovo_ymc_notify()
119 dev_warn(&wdev->dev, in lenovo_ymc_notify()
123 code = obj->integer.value; in lenovo_ymc_notify()
125 if (!sparse_keymap_report_event(priv->input_dev, code, 1, true)) in lenovo_ymc_notify()
126 dev_warn(&wdev->dev, "Unknown key %d pressed\n", code); in lenovo_ymc_notify()
143 dev_info(&wdev->dev, "Force loading Lenovo YMC support\n"); in lenovo_ymc_probe()
145 return -ENODEV; in lenovo_ymc_probe()
150 priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); in lenovo_ymc_probe()
152 return -ENOMEM; in lenovo_ymc_probe()
155 pr_debug("Lenovo YMC enable EC triggering.\n"); in lenovo_ymc_probe()
156 priv->ec_acpi_dev = acpi_dev_get_first_match_dev("VPC2004", NULL, -1); in lenovo_ymc_probe()
158 if (!priv->ec_acpi_dev) { in lenovo_ymc_probe()
159 dev_err(&wdev->dev, "Could not find EC ACPI device.\n"); in lenovo_ymc_probe()
160 return -ENODEV; in lenovo_ymc_probe()
162 err = devm_add_action_or_reset(&wdev->dev, in lenovo_ymc_probe()
163 acpi_dev_put_helper, priv->ec_acpi_dev); in lenovo_ymc_probe()
165 dev_err(&wdev->dev, in lenovo_ymc_probe()
171 input_dev = devm_input_allocate_device(&wdev->dev); in lenovo_ymc_probe()
173 return -ENOMEM; in lenovo_ymc_probe()
175 input_dev->name = "Lenovo Yoga Tablet Mode Control switch"; in lenovo_ymc_probe()
176 input_dev->phys = LENOVO_YMC_EVENT_GUID "/input0"; in lenovo_ymc_probe()
177 input_dev->id.bustype = BUS_HOST; in lenovo_ymc_probe()
178 input_dev->dev.parent = &wdev->dev; in lenovo_ymc_probe()
181 dev_err(&wdev->dev, in lenovo_ymc_probe()
188 dev_err(&wdev->dev, in lenovo_ymc_probe()
193 priv->input_dev = input_dev; in lenovo_ymc_probe()
194 dev_set_drvdata(&wdev->dev, priv); in lenovo_ymc_probe()
210 .name = "lenovo-ymc",