Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: cyttsp - use devm_regulator_bulk_get_enable()

The driver does not try to power down the rails at system suspend or
when touchscreen is not in use, but rather enables regulators at probe
time. Power savings are achieved by requesting the controller to enter
low power mode.

Switch to devm_regulator_bulk_get_enable() instead of separately
requesting regulators, enabling them, and installing a custom
devm-action to disable them on unbind/remove, which simplifies the
code.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/ZrAgj9rG6oVqfdoK@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+8 -31
+8 -30
drivers/input/touchscreen/cyttsp_core.c
··· 614 614 return 0; 615 615 } 616 616 617 - static void cyttsp_disable_regulators(void *_ts) 618 - { 619 - struct cyttsp *ts = _ts; 620 - 621 - regulator_bulk_disable(ARRAY_SIZE(ts->regulators), 622 - ts->regulators); 623 - } 624 - 625 617 struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops, 626 618 struct device *dev, int irq, size_t xfer_buf_size) 627 619 { 620 + /* 621 + * VCPIN is the analog voltage supply 622 + * VDD is the digital voltage supply 623 + */ 624 + static const char * const supplies[] = { "vcpin", "vdd" }; 628 625 struct cyttsp *ts; 629 626 struct input_dev *input_dev; 630 627 int error; ··· 639 642 ts->bus_ops = bus_ops; 640 643 ts->irq = irq; 641 644 642 - /* 643 - * VCPIN is the analog voltage supply 644 - * VDD is the digital voltage supply 645 - */ 646 - ts->regulators[0].supply = "vcpin"; 647 - ts->regulators[1].supply = "vdd"; 648 - error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->regulators), 649 - ts->regulators); 645 + error = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(supplies), 646 + supplies); 650 647 if (error) { 651 - dev_err(dev, "Failed to get regulators: %d\n", error); 652 - return ERR_PTR(error); 653 - } 654 - 655 - error = regulator_bulk_enable(ARRAY_SIZE(ts->regulators), 656 - ts->regulators); 657 - if (error) { 658 - dev_err(dev, "Cannot enable regulators: %d\n", error); 659 - return ERR_PTR(error); 660 - } 661 - 662 - error = devm_add_action_or_reset(dev, cyttsp_disable_regulators, ts); 663 - if (error) { 664 - dev_err(dev, "failed to install chip disable handler\n"); 648 + dev_err(dev, "Failed to enable regulators: %d\n", error); 665 649 return ERR_PTR(error); 666 650 } 667 651
-1
drivers/input/touchscreen/cyttsp_core.h
··· 122 122 enum cyttsp_state state; 123 123 bool suspended; 124 124 125 - struct regulator_bulk_data regulators[2]; 126 125 struct gpio_desc *reset_gpio; 127 126 bool use_hndshk; 128 127 u8 act_dist;