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

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input updates from Dmitry Torokhov:
"A tiny pull request this merge window unfortunately, should get more
material in for the next release:

- new driver for Raspberry Pi's touchscreen (firmware interface)

- miscellaneous input driver fixes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: elan_i2c - add ACPI ID for touchpad in ASUS Aspire F5-573G
Input: atmel_mxt_ts - don't try to free unallocated kernel memory
Input: drv2667 - fix indentation issues
Input: touchscreen - fix coding style issue
Input: add official Raspberry Pi's touchscreen driver
Input: nomadik-ske-keypad - fix a loop timeout test
Input: rotary-encoder - don't log EPROBE_DEFER to kernel log
Input: olpc_apsp - remove set but not used variable 'np'
Input: olpc_apsp - enable the SP clock
Input: olpc_apsp - check FIFO status on open(), not probe()
Input: olpc_apsp - drop CONFIG_OLPC dependency
clk: mmp2: add SP clock
dt-bindings: marvell,mmp2: Add clock id for the SP clock
Input: ad7879 - drop platform data support

+346 -140
+26
Documentation/devicetree/bindings/input/touchscreen/raspberrypi,firmware-ts.txt
··· 1 + Raspberry Pi firmware based 7" touchscreen 2 + ===================================== 3 + 4 + Required properties: 5 + - compatible: "raspberrypi,firmware-ts" 6 + 7 + Optional properties: 8 + - firmware: Reference to RPi's firmware device node 9 + - touchscreen-size-x: See touchscreen.txt 10 + - touchscreen-size-y: See touchscreen.txt 11 + - touchscreen-inverted-x: See touchscreen.txt 12 + - touchscreen-inverted-y: See touchscreen.txt 13 + - touchscreen-swapped-x-y: See touchscreen.txt 14 + 15 + Example: 16 + 17 + firmware: firmware-rpi { 18 + compatible = "raspberrypi,bcm2835-firmware"; 19 + mboxes = <&mailbox>; 20 + 21 + ts: touchscreen { 22 + compatible = "raspberrypi,firmware-ts"; 23 + touchscreen-size-x = <800>; 24 + touchscreen-size-y = <480>; 25 + }; 26 + };
+4
Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
··· 4 4 - compatible : "olpc,ap-sp" 5 5 - reg : base address and length of SoC's WTM registers 6 6 - interrupts : SP-AP interrupt 7 + - clocks : phandle + clock-specifier for the clock that drives the WTM 8 + - clock-names: should be "sp" 7 9 8 10 Example: 9 11 ap-sp@d4290000 { 10 12 compatible = "olpc,ap-sp"; 11 13 reg = <0xd4290000 0x1000>; 12 14 interrupts = <40>; 15 + clocks = <&soc_clocks MMP2_CLK_SP>; 16 + clock-names = "sp"; 13 17 }
+4
drivers/clk/mmp/clk-of-mmp2.c
··· 53 53 #define APMU_DISP1 0x110 54 54 #define APMU_CCIC0 0x50 55 55 #define APMU_CCIC1 0xf4 56 + #define APMU_SP 0x68 56 57 #define MPMU_UART_PLL 0x14 57 58 58 59 struct mmp2_clk_unit { ··· 210 209 .reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32), 211 210 }; 212 211 212 + static DEFINE_SPINLOCK(sp_lock); 213 + 213 214 static struct mmp_param_mux_clk apmu_mux_clks[] = { 214 215 {MMP2_CLK_DISP0_MUX, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 2, 0, &disp0_lock}, 215 216 {MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock}, ··· 242 239 {MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock}, 243 240 {MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock}, 244 241 {MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock}, 242 + {MMP2_CLK_SP, "sp_clk", NULL, CLK_SET_RATE_PARENT, APMU_SP, 0x1b, 0x1b, 0x0, 0, &sp_lock}, 245 243 }; 246 244 247 245 static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit)
+1 -1
drivers/input/keyboard/nomadik-ske-keypad.c
··· 100 100 while ((readl(keypad->reg_base + SKE_RIS) != 0x00000000) && timeout--) 101 101 cpu_relax(); 102 102 103 - if (!timeout) 103 + if (timeout == -1) 104 104 return -EINVAL; 105 105 106 106 /*
+3 -3
drivers/input/misc/drv2667.c
··· 177 177 error = regmap_write(haptics->regmap, DRV2667_PAGE, read_buf); 178 178 if (error) { 179 179 dev_err(&haptics->client->dev, 180 - "Failed to set the page: %d\n", error); 181 - return -EIO; 182 - } 180 + "Failed to set the page: %d\n", error); 181 + return -EIO; 182 + } 183 183 } 184 184 185 185 return error;
+4 -2
drivers/input/misc/rotary_encoder.c
··· 240 240 241 241 encoder->gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN); 242 242 if (IS_ERR(encoder->gpios)) { 243 - dev_err(dev, "unable to get gpios\n"); 244 - return PTR_ERR(encoder->gpios); 243 + err = PTR_ERR(encoder->gpios); 244 + if (err != -EPROBE_DEFER) 245 + dev_err(dev, "unable to get gpios: %d\n", err); 246 + return err; 245 247 } 246 248 if (encoder->gpios->ndescs < 2) { 247 249 dev_err(dev, "not enough gpios found\n");
+1
drivers/input/mouse/elan_i2c_core.c
··· 1336 1336 static const struct acpi_device_id elan_acpi_id[] = { 1337 1337 { "ELAN0000", 0 }, 1338 1338 { "ELAN0100", 0 }, 1339 + { "ELAN0501", 0 }, 1339 1340 { "ELAN0600", 0 }, 1340 1341 { "ELAN0602", 0 }, 1341 1342 { "ELAN0605", 0 },
-1
drivers/input/serio/Kconfig
··· 254 254 255 255 config SERIO_OLPC_APSP 256 256 tristate "OLPC AP-SP input support" 257 - depends on OLPC || COMPILE_TEST 258 257 help 259 258 Say Y here if you want support for the keyboard and touchpad included 260 259 in the OLPC XO-1.75 and XO-4 laptops.
+20 -8
drivers/input/serio/olpc_apsp.c
··· 23 23 #include <linux/of.h> 24 24 #include <linux/slab.h> 25 25 #include <linux/delay.h> 26 + #include <linux/clk.h> 26 27 27 28 /* 28 29 * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller. ··· 75 74 struct serio *kbio; 76 75 struct serio *padio; 77 76 void __iomem *base; 77 + struct clk *clk; 78 78 int open_count; 79 79 int irq; 80 80 }; ··· 147 145 { 148 146 struct olpc_apsp *priv = port->port_data; 149 147 unsigned int tmp; 148 + unsigned long l; 149 + int error; 150 150 151 151 if (priv->open_count++ == 0) { 152 + error = clk_prepare_enable(priv->clk); 153 + if (error) 154 + return error; 155 + 156 + l = readl(priv->base + COMMAND_FIFO_STATUS); 157 + if (!(l & CMD_STS_MASK)) { 158 + dev_err(priv->dev, "SP cannot accept commands.\n"); 159 + clk_disable_unprepare(priv->clk); 160 + return -EIO; 161 + } 162 + 152 163 /* Enable interrupt 0 by clearing its bit */ 153 164 tmp = readl(priv->base + PJ_INTERRUPT_MASK); 154 165 writel(tmp & ~INT_0, priv->base + PJ_INTERRUPT_MASK); ··· 179 164 /* Disable interrupt 0 */ 180 165 tmp = readl(priv->base + PJ_INTERRUPT_MASK); 181 166 writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK); 167 + 168 + clk_disable_unprepare(priv->clk); 182 169 } 183 170 } 184 171 ··· 189 172 struct serio *kb_serio, *pad_serio; 190 173 struct olpc_apsp *priv; 191 174 struct resource *res; 192 - struct device_node *np; 193 - unsigned long l; 194 175 int error; 195 176 196 177 priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL); 197 178 if (!priv) 198 179 return -ENOMEM; 199 180 200 - np = pdev->dev.of_node; 201 181 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 202 182 priv->base = devm_ioremap_resource(&pdev->dev, res); 203 183 if (IS_ERR(priv->base)) { ··· 206 192 if (priv->irq < 0) 207 193 return priv->irq; 208 194 209 - l = readl(priv->base + COMMAND_FIFO_STATUS); 210 - if (!(l & CMD_STS_MASK)) { 211 - dev_err(&pdev->dev, "SP cannot accept commands.\n"); 212 - return -EIO; 213 - } 195 + priv->clk = devm_clk_get(&pdev->dev, "sp"); 196 + if (IS_ERR(priv->clk)) 197 + return PTR_ERR(priv->clk); 214 198 215 199 /* KEYBOARD */ 216 200 kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
+12
drivers/input/touchscreen/Kconfig
··· 696 696 To compile this driver as a module, choose M here: the 697 697 module will be called edt-ft5x06. 698 698 699 + config TOUCHSCREEN_RASPBERRYPI_FW 700 + tristate "Raspberry Pi's firmware base touch screen support" 701 + depends on RASPBERRYPI_FIRMWARE || COMPILE_TEST 702 + help 703 + Say Y here if you have the official Raspberry Pi 7 inch screen on 704 + your system. 705 + 706 + If unsure, say N. 707 + 708 + To compile this driver as a module, choose M here: the 709 + module will be called raspberrypi-ts. 710 + 699 711 config TOUCHSCREEN_MIGOR 700 712 tristate "Renesas MIGO-R touchscreen" 701 713 depends on (SH_MIGOR || COMPILE_TEST) && I2C
+1
drivers/input/touchscreen/Makefile
··· 109 109 obj-$(CONFIG_TOUCHSCREEN_ZFORCE) += zforce_ts.o 110 110 obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50) += colibri-vf50-ts.o 111 111 obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o 112 + obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_FW) += raspberrypi-ts.o
+33 -74
drivers/input/touchscreen/ad7879.c
··· 29 29 #include <linux/property.h> 30 30 #include <linux/regmap.h> 31 31 #include <linux/slab.h> 32 - #include <linux/gpio.h> 32 + #include <linux/gpio/driver.h> 33 33 34 34 #include <linux/input/touchscreen.h> 35 - #include <linux/platform_data/ad7879.h> 36 35 #include <linux/module.h> 37 36 #include "ad7879.h" 38 37 ··· 289 290 return 0; 290 291 } 291 292 292 - static void ad7879_close(struct input_dev* input) 293 + static void ad7879_close(struct input_dev *input) 293 294 { 294 295 struct ad7879 *ts = input_get_drvdata(input); 295 296 ··· 451 452 mutex_unlock(&ts->mutex); 452 453 } 453 454 454 - static int ad7879_gpio_add(struct ad7879 *ts, 455 - const struct ad7879_platform_data *pdata) 455 + static int ad7879_gpio_add(struct ad7879 *ts) 456 456 { 457 - bool gpio_export; 458 - int gpio_base; 459 457 int ret = 0; 460 - 461 - if (pdata) { 462 - gpio_export = pdata->gpio_export; 463 - gpio_base = pdata->gpio_base; 464 - } else { 465 - gpio_export = device_property_read_bool(ts->dev, 466 - "gpio-controller"); 467 - gpio_base = -1; 468 - } 469 458 470 459 mutex_init(&ts->mutex); 471 460 472 - if (gpio_export) { 473 - ts->gc.direction_input = ad7879_gpio_direction_input; 474 - ts->gc.direction_output = ad7879_gpio_direction_output; 475 - ts->gc.get = ad7879_gpio_get_value; 476 - ts->gc.set = ad7879_gpio_set_value; 477 - ts->gc.can_sleep = 1; 478 - ts->gc.base = gpio_base; 479 - ts->gc.ngpio = 1; 480 - ts->gc.label = "AD7879-GPIO"; 481 - ts->gc.owner = THIS_MODULE; 482 - ts->gc.parent = ts->dev; 461 + /* Do not create a chip unless flagged for it */ 462 + if (!device_property_read_bool(ts->dev, "gpio-controller")) 463 + return 0; 483 464 484 - ret = devm_gpiochip_add_data(ts->dev, &ts->gc, ts); 485 - if (ret) 486 - dev_err(ts->dev, "failed to register gpio %d\n", 487 - ts->gc.base); 488 - } 465 + ts->gc.direction_input = ad7879_gpio_direction_input; 466 + ts->gc.direction_output = ad7879_gpio_direction_output; 467 + ts->gc.get = ad7879_gpio_get_value; 468 + ts->gc.set = ad7879_gpio_set_value; 469 + ts->gc.can_sleep = 1; 470 + ts->gc.base = -1; 471 + ts->gc.ngpio = 1; 472 + ts->gc.label = "AD7879-GPIO"; 473 + ts->gc.owner = THIS_MODULE; 474 + ts->gc.parent = ts->dev; 475 + 476 + ret = devm_gpiochip_add_data(ts->dev, &ts->gc, ts); 477 + if (ret) 478 + dev_err(ts->dev, "failed to register gpio %d\n", 479 + ts->gc.base); 489 480 490 481 return ret; 491 482 } 492 483 #else 493 - static int ad7879_gpio_add(struct ad7879 *ts, 494 - const struct ad7879_platform_data *pdata) 484 + static int ad7879_gpio_add(struct ad7879 *ts) 495 485 { 496 486 return 0; 497 487 } ··· 515 527 int ad7879_probe(struct device *dev, struct regmap *regmap, 516 528 int irq, u16 bustype, u8 devid) 517 529 { 518 - struct ad7879_platform_data *pdata = dev_get_platdata(dev); 519 530 struct ad7879 *ts; 520 531 struct input_dev *input_dev; 521 532 int err; ··· 529 542 if (!ts) 530 543 return -ENOMEM; 531 544 532 - if (pdata) { 533 - /* Platform data use swapped axis (backward compatibility) */ 534 - ts->swap_xy = !pdata->swap_xy; 535 - 536 - ts->x_plate_ohms = pdata->x_plate_ohms ? : 400; 537 - 538 - ts->first_conversion_delay = pdata->first_conversion_delay; 539 - ts->acquisition_time = pdata->acquisition_time; 540 - ts->averaging = pdata->averaging; 541 - ts->pen_down_acc_interval = pdata->pen_down_acc_interval; 542 - ts->median = pdata->median; 543 - } else { 544 - err = ad7879_parse_dt(dev, ts); 545 - if (err) 546 - return err; 547 - } 545 + err = ad7879_parse_dt(dev, ts); 546 + if (err) 547 + return err; 548 548 549 549 input_dev = devm_input_allocate_device(dev); 550 550 if (!input_dev) { ··· 559 585 560 586 input_set_capability(input_dev, EV_KEY, BTN_TOUCH); 561 587 562 - if (pdata) { 563 - input_set_abs_params(input_dev, ABS_X, 564 - pdata->x_min ? : 0, 565 - pdata->x_max ? : MAX_12BIT, 566 - 0, 0); 567 - input_set_abs_params(input_dev, ABS_Y, 568 - pdata->y_min ? : 0, 569 - pdata->y_max ? : MAX_12BIT, 570 - 0, 0); 571 - input_set_abs_params(input_dev, ABS_PRESSURE, 572 - pdata->pressure_min, 573 - pdata->pressure_max ? : ~0, 574 - 0, 0); 575 - } else { 576 - input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0); 577 - input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0); 578 - input_set_capability(input_dev, EV_ABS, ABS_PRESSURE); 579 - touchscreen_parse_properties(input_dev, false, NULL); 580 - if (!input_abs_get_max(input_dev, ABS_PRESSURE)) { 581 - dev_err(dev, "Touchscreen pressure is not specified\n"); 582 - return -EINVAL; 583 - } 588 + input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0); 589 + input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0); 590 + input_set_capability(input_dev, EV_ABS, ABS_PRESSURE); 591 + touchscreen_parse_properties(input_dev, false, NULL); 592 + if (!input_abs_get_max(input_dev, ABS_PRESSURE)) { 593 + dev_err(dev, "Touchscreen pressure is not specified\n"); 594 + return -EINVAL; 584 595 } 585 596 586 597 err = ad7879_write(ts, AD7879_REG_CTRL2, AD7879_RESET); ··· 614 655 if (err) 615 656 return err; 616 657 617 - err = ad7879_gpio_add(ts, pdata); 658 + err = ad7879_gpio_add(ts); 618 659 if (err) 619 660 return err; 620 661
+2 -2
drivers/input/touchscreen/atmel_mxt_ts.c
··· 1585 1585 /* T7 config may have changed */ 1586 1586 mxt_init_t7_power_cfg(data); 1587 1587 1588 - release_raw: 1589 - kfree(cfg.raw); 1590 1588 release_mem: 1591 1589 kfree(cfg.mem); 1590 + release_raw: 1591 + kfree(cfg.raw); 1592 1592 return ret; 1593 1593 } 1594 1594
+1 -1
drivers/input/touchscreen/ektf2127.c
··· 51 51 struct touchscreen_properties prop; 52 52 }; 53 53 54 - static void ektf2127_parse_coordinates(const u8* buf, unsigned int touch_count, 54 + static void ektf2127_parse_coordinates(const u8 *buf, unsigned int touch_count, 55 55 struct input_mt_pos *touches) 56 56 { 57 57 int index = 0;
+2 -2
drivers/input/touchscreen/gunze.c
··· 53 53 char phys[32]; 54 54 }; 55 55 56 - static void gunze_process_packet(struct gunze* gunze) 56 + static void gunze_process_packet(struct gunze *gunze) 57 57 { 58 58 struct input_dev *dev = gunze->dev; 59 59 ··· 72 72 static irqreturn_t gunze_interrupt(struct serio *serio, 73 73 unsigned char data, unsigned int flags) 74 74 { 75 - struct gunze* gunze = serio_get_drvdata(serio); 75 + struct gunze *gunze = serio_get_drvdata(serio); 76 76 77 77 if (data == '\r') { 78 78 gunze_process_packet(gunze);
+2 -2
drivers/input/touchscreen/inexio.c
··· 79 79 static irqreturn_t inexio_interrupt(struct serio *serio, 80 80 unsigned char data, unsigned int flags) 81 81 { 82 - struct inexio* pinexio = serio_get_drvdata(serio); 82 + struct inexio *pinexio = serio_get_drvdata(serio); 83 83 84 84 pinexio->data[pinexio->idx] = data; 85 85 ··· 97 97 98 98 static void inexio_disconnect(struct serio *serio) 99 99 { 100 - struct inexio* pinexio = serio_get_drvdata(serio); 100 + struct inexio *pinexio = serio_get_drvdata(serio); 101 101 102 102 input_get_device(pinexio->dev); 103 103 input_unregister_device(pinexio->dev);
+2 -2
drivers/input/touchscreen/mtouch.c
··· 90 90 static irqreturn_t mtouch_interrupt(struct serio *serio, 91 91 unsigned char data, unsigned int flags) 92 92 { 93 - struct mtouch* mtouch = serio_get_drvdata(serio); 93 + struct mtouch *mtouch = serio_get_drvdata(serio); 94 94 95 95 mtouch->data[mtouch->idx] = data; 96 96 ··· 110 110 111 111 static void mtouch_disconnect(struct serio *serio) 112 112 { 113 - struct mtouch* mtouch = serio_get_drvdata(serio); 113 + struct mtouch *mtouch = serio_get_drvdata(serio); 114 114 115 115 input_get_device(mtouch->dev); 116 116 input_unregister_device(mtouch->dev);
+227
drivers/input/touchscreen/raspberrypi-ts.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Raspberry Pi firmware based touchscreen driver 4 + * 5 + * Copyright (C) 2015, 2017 Raspberry Pi 6 + * Copyright (C) 2018 Nicolas Saenz Julienne <nsaenzjulienne@suse.de> 7 + */ 8 + 9 + #include <linux/io.h> 10 + #include <linux/of.h> 11 + #include <linux/slab.h> 12 + #include <linux/device.h> 13 + #include <linux/module.h> 14 + #include <linux/bitops.h> 15 + #include <linux/dma-mapping.h> 16 + #include <linux/platform_device.h> 17 + #include <linux/input.h> 18 + #include <linux/input/mt.h> 19 + #include <linux/input-polldev.h> 20 + #include <linux/input/touchscreen.h> 21 + #include <soc/bcm2835/raspberrypi-firmware.h> 22 + 23 + #define RPI_TS_DEFAULT_WIDTH 800 24 + #define RPI_TS_DEFAULT_HEIGHT 480 25 + 26 + #define RPI_TS_MAX_SUPPORTED_POINTS 10 27 + 28 + #define RPI_TS_FTS_TOUCH_DOWN 0 29 + #define RPI_TS_FTS_TOUCH_CONTACT 2 30 + 31 + #define RPI_TS_POLL_INTERVAL 17 /* 60fps */ 32 + 33 + #define RPI_TS_NPOINTS_REG_INVALIDATE 99 34 + 35 + struct rpi_ts { 36 + struct platform_device *pdev; 37 + struct input_polled_dev *poll_dev; 38 + struct touchscreen_properties prop; 39 + 40 + void __iomem *fw_regs_va; 41 + dma_addr_t fw_regs_phys; 42 + 43 + int known_ids; 44 + }; 45 + 46 + struct rpi_ts_regs { 47 + u8 device_mode; 48 + u8 gesture_id; 49 + u8 num_points; 50 + struct rpi_ts_touch { 51 + u8 xh; 52 + u8 xl; 53 + u8 yh; 54 + u8 yl; 55 + u8 pressure; /* Not supported */ 56 + u8 area; /* Not supported */ 57 + } point[RPI_TS_MAX_SUPPORTED_POINTS]; 58 + }; 59 + 60 + static void rpi_ts_poll(struct input_polled_dev *dev) 61 + { 62 + struct input_dev *input = dev->input; 63 + struct rpi_ts *ts = dev->private; 64 + struct rpi_ts_regs regs; 65 + int modified_ids = 0; 66 + long released_ids; 67 + int event_type; 68 + int touchid; 69 + int x, y; 70 + int i; 71 + 72 + memcpy_fromio(&regs, ts->fw_regs_va, sizeof(regs)); 73 + /* 74 + * We poll the memory based register copy of the touchscreen chip using 75 + * the number of points register to know whether the copy has been 76 + * updated (we write 99 to the memory copy, the GPU will write between 77 + * 0 - 10 points) 78 + */ 79 + iowrite8(RPI_TS_NPOINTS_REG_INVALIDATE, 80 + ts->fw_regs_va + offsetof(struct rpi_ts_regs, num_points)); 81 + 82 + if (regs.num_points == RPI_TS_NPOINTS_REG_INVALIDATE || 83 + (regs.num_points == 0 && ts->known_ids == 0)) 84 + return; 85 + 86 + for (i = 0; i < regs.num_points; i++) { 87 + x = (((int)regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; 88 + y = (((int)regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; 89 + touchid = (regs.point[i].yh >> 4) & 0xf; 90 + event_type = (regs.point[i].xh >> 6) & 0x03; 91 + 92 + modified_ids |= BIT(touchid); 93 + 94 + if (event_type == RPI_TS_FTS_TOUCH_DOWN || 95 + event_type == RPI_TS_FTS_TOUCH_CONTACT) { 96 + input_mt_slot(input, touchid); 97 + input_mt_report_slot_state(input, MT_TOOL_FINGER, 1); 98 + touchscreen_report_pos(input, &ts->prop, x, y, true); 99 + } 100 + } 101 + 102 + released_ids = ts->known_ids & ~modified_ids; 103 + for_each_set_bit(i, &released_ids, RPI_TS_MAX_SUPPORTED_POINTS) { 104 + input_mt_slot(input, i); 105 + input_mt_report_slot_state(input, MT_TOOL_FINGER, 0); 106 + modified_ids &= ~(BIT(i)); 107 + } 108 + ts->known_ids = modified_ids; 109 + 110 + input_mt_sync_frame(input); 111 + input_sync(input); 112 + } 113 + 114 + static void rpi_ts_dma_cleanup(void *data) 115 + { 116 + struct rpi_ts *ts = data; 117 + struct device *dev = &ts->pdev->dev; 118 + 119 + dma_free_coherent(dev, PAGE_SIZE, ts->fw_regs_va, ts->fw_regs_phys); 120 + } 121 + 122 + static int rpi_ts_probe(struct platform_device *pdev) 123 + { 124 + struct device *dev = &pdev->dev; 125 + struct device_node *np = dev->of_node; 126 + struct input_polled_dev *poll_dev; 127 + struct device_node *fw_node; 128 + struct rpi_firmware *fw; 129 + struct input_dev *input; 130 + struct rpi_ts *ts; 131 + u32 touchbuf; 132 + int error; 133 + 134 + fw_node = of_get_parent(np); 135 + if (!fw_node) { 136 + dev_err(dev, "Missing firmware node\n"); 137 + return -ENOENT; 138 + } 139 + 140 + fw = rpi_firmware_get(fw_node); 141 + of_node_put(fw_node); 142 + if (!fw) 143 + return -EPROBE_DEFER; 144 + 145 + ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); 146 + if (!ts) 147 + return -ENOMEM; 148 + ts->pdev = pdev; 149 + 150 + ts->fw_regs_va = dma_zalloc_coherent(dev, PAGE_SIZE, &ts->fw_regs_phys, 151 + GFP_KERNEL); 152 + if (!ts->fw_regs_va) { 153 + dev_err(dev, "failed to dma_alloc_coherent\n"); 154 + return -ENOMEM; 155 + } 156 + 157 + error = devm_add_action_or_reset(dev, rpi_ts_dma_cleanup, ts); 158 + if (error) { 159 + dev_err(dev, "failed to devm_add_action_or_reset, %d\n", error); 160 + return error; 161 + } 162 + 163 + 164 + touchbuf = (u32)ts->fw_regs_phys; 165 + error = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF, 166 + &touchbuf, sizeof(touchbuf)); 167 + 168 + if (error || touchbuf != 0) { 169 + dev_warn(dev, "Failed to set touchbuf, %d\n", error); 170 + return error; 171 + } 172 + 173 + poll_dev = devm_input_allocate_polled_device(dev); 174 + if (!poll_dev) { 175 + dev_err(dev, "Failed to allocate input device\n"); 176 + return -ENOMEM; 177 + } 178 + ts->poll_dev = poll_dev; 179 + input = poll_dev->input; 180 + 181 + input->name = "raspberrypi-ts"; 182 + input->id.bustype = BUS_HOST; 183 + poll_dev->poll_interval = RPI_TS_POLL_INTERVAL; 184 + poll_dev->poll = rpi_ts_poll; 185 + poll_dev->private = ts; 186 + 187 + input_set_abs_params(input, ABS_MT_POSITION_X, 0, 188 + RPI_TS_DEFAULT_WIDTH, 0, 0); 189 + input_set_abs_params(input, ABS_MT_POSITION_Y, 0, 190 + RPI_TS_DEFAULT_HEIGHT, 0, 0); 191 + touchscreen_parse_properties(input, true, &ts->prop); 192 + 193 + error = input_mt_init_slots(input, RPI_TS_MAX_SUPPORTED_POINTS, 194 + INPUT_MT_DIRECT); 195 + if (error) { 196 + dev_err(dev, "could not init mt slots, %d\n", error); 197 + return error; 198 + } 199 + 200 + error = input_register_polled_device(poll_dev); 201 + if (error) { 202 + dev_err(dev, "could not register input device, %d\n", error); 203 + return error; 204 + } 205 + 206 + return 0; 207 + } 208 + 209 + static const struct of_device_id rpi_ts_match[] = { 210 + { .compatible = "raspberrypi,firmware-ts", }, 211 + {}, 212 + }; 213 + MODULE_DEVICE_TABLE(of, rpi_ts_match); 214 + 215 + static struct platform_driver rpi_ts_driver = { 216 + .driver = { 217 + .name = "raspberrypi-ts", 218 + .of_match_table = rpi_ts_match, 219 + }, 220 + .probe = rpi_ts_probe, 221 + }; 222 + module_platform_driver(rpi_ts_driver); 223 + 224 + MODULE_AUTHOR("Gordon Hollingworth"); 225 + MODULE_AUTHOR("Nicolas Saenz Julienne <nsaenzjulienne@suse.de>"); 226 + MODULE_DESCRIPTION("Raspberry Pi firmware based touchscreen driver"); 227 + MODULE_LICENSE("GPL v2");
+1
include/dt-bindings/clock/marvell,mmp2.h
··· 71 71 #define MMP2_CLK_CCIC1_MIX 117 72 72 #define MMP2_CLK_CCIC1_PHY 118 73 73 #define MMP2_CLK_CCIC1_SPHY 119 74 + #define MMP2_CLK_SP 120 74 75 75 76 #define MMP2_NR_CLKS 200 76 77 #endif
-42
include/linux/platform_data/ad7879.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* linux/platform_data/ad7879.h */ 3 - 4 - /* Touchscreen characteristics vary between boards and models. The 5 - * platform_data for the device's "struct device" holds this information. 6 - * 7 - * It's OK if the min/max values are zero. 8 - */ 9 - struct ad7879_platform_data { 10 - u16 model; /* 7879 */ 11 - u16 x_plate_ohms; 12 - u16 x_min, x_max; 13 - u16 y_min, y_max; 14 - u16 pressure_min, pressure_max; 15 - 16 - bool swap_xy; /* swap x and y axes */ 17 - 18 - /* [0..255] 0=OFF Starts at 1=550us and goes 19 - * all the way to 9.440ms in steps of 35us. 20 - */ 21 - u8 pen_down_acc_interval; 22 - /* [0..15] Starts at 0=128us and goes all the 23 - * way to 4.096ms in steps of 128us. 24 - */ 25 - u8 first_conversion_delay; 26 - /* [0..3] 0 = 2us, 1 = 4us, 2 = 8us, 3 = 16us */ 27 - u8 acquisition_time; 28 - /* [0..3] Average X middle samples 0 = 2, 1 = 4, 2 = 8, 3 = 16 */ 29 - u8 averaging; 30 - /* [0..3] Perform X measurements 0 = OFF, 31 - * 1 = 4, 2 = 8, 3 = 16 (median > averaging) 32 - */ 33 - u8 median; 34 - /* 1 = AUX/VBAT/GPIO export GPIO to gpiolib 35 - * requires CONFIG_GPIOLIB 36 - */ 37 - bool gpio_export; 38 - /* identifies the first GPIO number handled by this chip; 39 - * or, if negative, requests dynamic ID allocation. 40 - */ 41 - s32 gpio_base; 42 - };