Skip to content

Commit 592b15b

Browse files
committed
Merge branch 'next' into for-linus
Prepare input updates for 4.21 merge window.
2 parents 7db54c8 + 1e3c336 commit 592b15b

File tree

19 files changed

+346
-141
lines changed

19 files changed

+346
-141
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
};

Documentation/devicetree/bindings/serio/olpc,ap-sp.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ Required properties:
44
- compatible : "olpc,ap-sp"
55
- reg : base address and length of SoC's WTM registers
66
- interrupts : SP-AP interrupt
7+
- clocks : phandle + clock-specifier for the clock that drives the WTM
8+
- clock-names: should be "sp"
79

810
Example:
911
ap-sp@d4290000 {
1012
compatible = "olpc,ap-sp";
1113
reg = <0xd4290000 0x1000>;
1214
interrupts = <40>;
15+
clocks = <&soc_clocks MMP2_CLK_SP>;
16+
clock-names = "sp";
1317
}

drivers/clk/mmp/clk-of-mmp2.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#define APMU_DISP1 0x110
5454
#define APMU_CCIC0 0x50
5555
#define APMU_CCIC1 0xf4
56+
#define APMU_SP 0x68
5657
#define MPMU_UART_PLL 0x14
5758

5859
struct mmp2_clk_unit {
@@ -209,6 +210,8 @@ static struct mmp_clk_mix_config ccic1_mix_config = {
209210
.reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32),
210211
};
211212

213+
static DEFINE_SPINLOCK(sp_lock);
214+
212215
static struct mmp_param_mux_clk apmu_mux_clks[] = {
213216
{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},
214217
{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},
@@ -239,6 +242,7 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = {
239242
{MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock},
240243
{MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock},
241244
{MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock},
245+
{MMP2_CLK_SP, "sp_clk", NULL, CLK_SET_RATE_PARENT, APMU_SP, 0x1b, 0x1b, 0x0, 0, &sp_lock},
242246
};
243247

244248
static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit)

drivers/input/keyboard/nomadik-ske-keypad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int __init ske_keypad_chip_init(struct ske_keypad *keypad)
100100
while ((readl(keypad->reg_base + SKE_RIS) != 0x00000000) && timeout--)
101101
cpu_relax();
102102

103-
if (!timeout)
103+
if (timeout == -1)
104104
return -EINVAL;
105105

106106
/*

drivers/input/misc/drv2667.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ static int drv2667_set_waveform_freq(struct drv2667_data *haptics)
177177
error = regmap_write(haptics->regmap, DRV2667_PAGE, read_buf);
178178
if (error) {
179179
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+
}
183183
}
184184

185185
return error;

drivers/input/misc/rotary_encoder.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ static int rotary_encoder_probe(struct platform_device *pdev)
240240

241241
encoder->gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN);
242242
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;
245247
}
246248
if (encoder->gpios->ndescs < 2) {
247249
dev_err(dev, "not enough gpios found\n");

drivers/input/serio/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ config SERIO_APBPS2
254254

255255
config SERIO_OLPC_APSP
256256
tristate "OLPC AP-SP input support"
257-
depends on OLPC || COMPILE_TEST
258257
help
259258
Say Y here if you want support for the keyboard and touchpad included
260259
in the OLPC XO-1.75 and XO-4 laptops.

drivers/input/serio/olpc_apsp.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/of.h>
2424
#include <linux/slab.h>
2525
#include <linux/delay.h>
26+
#include <linux/clk.h>
2627

2728
/*
2829
* The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
@@ -74,6 +75,7 @@ struct olpc_apsp {
7475
struct serio *kbio;
7576
struct serio *padio;
7677
void __iomem *base;
78+
struct clk *clk;
7779
int open_count;
7880
int irq;
7981
};
@@ -145,8 +147,21 @@ static int olpc_apsp_open(struct serio *port)
145147
{
146148
struct olpc_apsp *priv = port->port_data;
147149
unsigned int tmp;
150+
unsigned long l;
151+
int error;
148152

149153
if (priv->open_count++ == 0) {
154+
error = clk_prepare_enable(priv->clk);
155+
if (error)
156+
return error;
157+
158+
l = readl(priv->base + COMMAND_FIFO_STATUS);
159+
if (!(l & CMD_STS_MASK)) {
160+
dev_err(priv->dev, "SP cannot accept commands.\n");
161+
clk_disable_unprepare(priv->clk);
162+
return -EIO;
163+
}
164+
150165
/* Enable interrupt 0 by clearing its bit */
151166
tmp = readl(priv->base + PJ_INTERRUPT_MASK);
152167
writel(tmp & ~INT_0, priv->base + PJ_INTERRUPT_MASK);
@@ -164,6 +179,8 @@ static void olpc_apsp_close(struct serio *port)
164179
/* Disable interrupt 0 */
165180
tmp = readl(priv->base + PJ_INTERRUPT_MASK);
166181
writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK);
182+
183+
clk_disable_unprepare(priv->clk);
167184
}
168185
}
169186

@@ -172,15 +189,12 @@ static int olpc_apsp_probe(struct platform_device *pdev)
172189
struct serio *kb_serio, *pad_serio;
173190
struct olpc_apsp *priv;
174191
struct resource *res;
175-
struct device_node *np;
176-
unsigned long l;
177192
int error;
178193

179194
priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL);
180195
if (!priv)
181196
return -ENOMEM;
182197

183-
np = pdev->dev.of_node;
184198
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
185199
priv->base = devm_ioremap_resource(&pdev->dev, res);
186200
if (IS_ERR(priv->base)) {
@@ -192,11 +206,9 @@ static int olpc_apsp_probe(struct platform_device *pdev)
192206
if (priv->irq < 0)
193207
return priv->irq;
194208

195-
l = readl(priv->base + COMMAND_FIFO_STATUS);
196-
if (!(l & CMD_STS_MASK)) {
197-
dev_err(&pdev->dev, "SP cannot accept commands.\n");
198-
return -EIO;
199-
}
209+
priv->clk = devm_clk_get(&pdev->dev, "sp");
210+
if (IS_ERR(priv->clk))
211+
return PTR_ERR(priv->clk);
200212

201213
/* KEYBOARD */
202214
kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);

drivers/input/touchscreen/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,18 @@ config TOUCHSCREEN_EDT_FT5X06
683683
To compile this driver as a module, choose M here: the
684684
module will be called edt-ft5x06.
685685

686+
config TOUCHSCREEN_RASPBERRYPI_FW
687+
tristate "Raspberry Pi's firmware base touch screen support"
688+
depends on RASPBERRYPI_FIRMWARE || COMPILE_TEST
689+
help
690+
Say Y here if you have the official Raspberry Pi 7 inch screen on
691+
your system.
692+
693+
If unsure, say N.
694+
695+
To compile this driver as a module, choose M here: the
696+
module will be called raspberrypi-ts.
697+
686698
config TOUCHSCREEN_MIGOR
687699
tristate "Renesas MIGO-R touchscreen"
688700
depends on (SH_MIGOR || COMPILE_TEST) && I2C

drivers/input/touchscreen/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,4 @@ obj-$(CONFIG_TOUCHSCREEN_ZET6223) += zet6223.o
108108
obj-$(CONFIG_TOUCHSCREEN_ZFORCE) += zforce_ts.o
109109
obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50) += colibri-vf50-ts.o
110110
obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o
111+
obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_FW) += raspberrypi-ts.o

drivers/input/touchscreen/ad7879.c

Lines changed: 34 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@
2929
#include <linux/property.h>
3030
#include <linux/regmap.h>
3131
#include <linux/slab.h>
32-
#include <linux/gpio.h>
32+
#include <linux/gpio/driver.h>
3333

3434
#include <linux/input/touchscreen.h>
35-
#include <linux/platform_data/ad7879.h>
3635
#include <linux/module.h>
3736
#include "ad7879.h"
3837

@@ -290,7 +289,7 @@ static int ad7879_open(struct input_dev *input)
290289
return 0;
291290
}
292291

293-
static void ad7879_close(struct input_dev* input)
292+
static void ad7879_close(struct input_dev *input)
294293
{
295294
struct ad7879 *ts = input_get_drvdata(input);
296295

@@ -452,47 +451,36 @@ static void ad7879_gpio_set_value(struct gpio_chip *chip,
452451
mutex_unlock(&ts->mutex);
453452
}
454453

455-
static int ad7879_gpio_add(struct ad7879 *ts,
456-
const struct ad7879_platform_data *pdata)
454+
static int ad7879_gpio_add(struct ad7879 *ts)
457455
{
458-
bool gpio_export;
459-
int gpio_base;
460456
int ret = 0;
461457

462-
if (pdata) {
463-
gpio_export = pdata->gpio_export;
464-
gpio_base = pdata->gpio_base;
465-
} else {
466-
gpio_export = device_property_read_bool(ts->dev,
467-
"gpio-controller");
468-
gpio_base = -1;
469-
}
470-
471458
mutex_init(&ts->mutex);
472459

473-
if (gpio_export) {
474-
ts->gc.direction_input = ad7879_gpio_direction_input;
475-
ts->gc.direction_output = ad7879_gpio_direction_output;
476-
ts->gc.get = ad7879_gpio_get_value;
477-
ts->gc.set = ad7879_gpio_set_value;
478-
ts->gc.can_sleep = 1;
479-
ts->gc.base = gpio_base;
480-
ts->gc.ngpio = 1;
481-
ts->gc.label = "AD7879-GPIO";
482-
ts->gc.owner = THIS_MODULE;
483-
ts->gc.parent = ts->dev;
484-
485-
ret = devm_gpiochip_add_data(ts->dev, &ts->gc, ts);
486-
if (ret)
487-
dev_err(ts->dev, "failed to register gpio %d\n",
488-
ts->gc.base);
489-
}
460+
/* Do not create a chip unless flagged for it */
461+
if (!device_property_read_bool(ts->dev, "gpio-controller"))
462+
return 0;
463+
464+
ts->gc.direction_input = ad7879_gpio_direction_input;
465+
ts->gc.direction_output = ad7879_gpio_direction_output;
466+
ts->gc.get = ad7879_gpio_get_value;
467+
ts->gc.set = ad7879_gpio_set_value;
468+
ts->gc.can_sleep = 1;
469+
ts->gc.base = -1;
470+
ts->gc.ngpio = 1;
471+
ts->gc.label = "AD7879-GPIO";
472+
ts->gc.owner = THIS_MODULE;
473+
ts->gc.parent = ts->dev;
474+
475+
ret = devm_gpiochip_add_data(ts->dev, &ts->gc, ts);
476+
if (ret)
477+
dev_err(ts->dev, "failed to register gpio %d\n",
478+
ts->gc.base);
490479

491480
return ret;
492481
}
493482
#else
494-
static int ad7879_gpio_add(struct ad7879 *ts,
495-
const struct ad7879_platform_data *pdata)
483+
static int ad7879_gpio_add(struct ad7879 *ts)
496484
{
497485
return 0;
498486
}
@@ -527,7 +515,6 @@ static int ad7879_parse_dt(struct device *dev, struct ad7879 *ts)
527515
int ad7879_probe(struct device *dev, struct regmap *regmap,
528516
int irq, u16 bustype, u8 devid)
529517
{
530-
struct ad7879_platform_data *pdata = dev_get_platdata(dev);
531518
struct ad7879 *ts;
532519
struct input_dev *input_dev;
533520
int err;
@@ -542,22 +529,9 @@ int ad7879_probe(struct device *dev, struct regmap *regmap,
542529
if (!ts)
543530
return -ENOMEM;
544531

545-
if (pdata) {
546-
/* Platform data use swapped axis (backward compatibility) */
547-
ts->swap_xy = !pdata->swap_xy;
548-
549-
ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
550-
551-
ts->first_conversion_delay = pdata->first_conversion_delay;
552-
ts->acquisition_time = pdata->acquisition_time;
553-
ts->averaging = pdata->averaging;
554-
ts->pen_down_acc_interval = pdata->pen_down_acc_interval;
555-
ts->median = pdata->median;
556-
} else {
557-
err = ad7879_parse_dt(dev, ts);
558-
if (err)
559-
return err;
560-
}
532+
err = ad7879_parse_dt(dev, ts);
533+
if (err)
534+
return err;
561535

562536
input_dev = devm_input_allocate_device(dev);
563537
if (!input_dev) {
@@ -585,28 +559,13 @@ int ad7879_probe(struct device *dev, struct regmap *regmap,
585559

586560
input_set_capability(input_dev, EV_KEY, BTN_TOUCH);
587561

588-
if (pdata) {
589-
input_set_abs_params(input_dev, ABS_X,
590-
pdata->x_min ? : 0,
591-
pdata->x_max ? : MAX_12BIT,
592-
0, 0);
593-
input_set_abs_params(input_dev, ABS_Y,
594-
pdata->y_min ? : 0,
595-
pdata->y_max ? : MAX_12BIT,
596-
0, 0);
597-
input_set_abs_params(input_dev, ABS_PRESSURE,
598-
pdata->pressure_min,
599-
pdata->pressure_max ? : ~0,
600-
0, 0);
601-
} else {
602-
input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0);
603-
input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0);
604-
input_set_capability(input_dev, EV_ABS, ABS_PRESSURE);
605-
touchscreen_parse_properties(input_dev, false, NULL);
606-
if (!input_abs_get_max(input_dev, ABS_PRESSURE)) {
607-
dev_err(dev, "Touchscreen pressure is not specified\n");
608-
return -EINVAL;
609-
}
562+
input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0);
563+
input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0);
564+
input_set_capability(input_dev, EV_ABS, ABS_PRESSURE);
565+
touchscreen_parse_properties(input_dev, false, NULL);
566+
if (!input_abs_get_max(input_dev, ABS_PRESSURE)) {
567+
dev_err(dev, "Touchscreen pressure is not specified\n");
568+
return -EINVAL;
610569
}
611570

612571
err = ad7879_write(ts, AD7879_REG_CTRL2, AD7879_RESET);
@@ -655,7 +614,7 @@ int ad7879_probe(struct device *dev, struct regmap *regmap,
655614
if (err)
656615
return err;
657616

658-
err = ad7879_gpio_add(ts, pdata);
617+
err = ad7879_gpio_add(ts);
659618
if (err)
660619
return err;
661620

drivers/input/touchscreen/atmel_mxt_ts.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,10 +1585,10 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *fw)
15851585
/* T7 config may have changed */
15861586
mxt_init_t7_power_cfg(data);
15871587

1588-
release_raw:
1589-
kfree(cfg.raw);
15901588
release_mem:
15911589
kfree(cfg.mem);
1590+
release_raw:
1591+
kfree(cfg.raw);
15921592
return ret;
15931593
}
15941594

0 commit comments

Comments
 (0)