* [PATCH v4 0/5] bitmap: Introduce alloc/free helpers
From: Andy Shevchenko @ 2018-06-30 20:17 UTC (permalink / raw)
To: Alasdair Kergon, Mike Snitzer, dm-devel, Shaohua Li, linux-raid,
Dmitry Torokhov, linux-input, Andrew Morton, Yury Norov,
linux-kernel, mika.westerberg, Joe Perches
Cc: Andy Shevchenko
A lot of code is using allocation of bitmaps using BITS_PER_LONG() macro and
sizeof(unsigned long) operator. The readability suffers because of this.
The series introduces three helpers, i.e. bitmap_alloc(), bitmap_zalloc() and
bitmap_free(), to make it more cleaner.
Patches 1 and 2 are preparatory to avoid namespace collisions between
bitmap API and DM / MD bitmap. No functional changes intended.
Patch 3 introduces new helpers.
Patches 4 and 5 is just an example how to use new helpers. Locally I have
like dozen of them against different subsystems and drivers.
Taking above into consideration it might make sense to have
an immutable branch for this cycle.
Ideally it would go through Input subsystem, thus, needs an Ack
from MD / DM maintainer(s).
Since v3:
- split DM part and do rename accordingly (Mike)
- explain better in the commit message why we can't make helpers as
inliners (Dmitry, Andrew)
- drop applied orphaned patch
Since v2:
- fix compilation issue in MD bitmap code
- elaborate changes in commit message of patch 5
Since v1:
- added namespace fix patch against MD bitmap API
- moved functions to lib/bitmap.c to avoid circular dependencies
- appended Dmitry's tags
Andy Shevchenko (5):
dm: Avoid namespace collision with bitmap API
md: Avoid namespace collision with bitmap API
bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()
Input: gpio-keys - Switch to bitmap_zalloc()
Input: evdev - Switch to bitmap API
drivers/input/evdev.c | 16 +-
drivers/input/keyboard/gpio_keys.c | 8 +-
drivers/md/dm-raid.c | 6 +-
drivers/md/md-bitmap.c | 305 +++++++++---------
drivers/md/md-bitmap.h | 60 ++--
drivers/md/md-cluster.c | 18 +-
drivers/md/md.c | 44 +--
.../md/persistent-data/dm-space-map-common.c | 20 +-
drivers/md/raid1.c | 35 +-
drivers/md/raid10.c | 52 ++-
drivers/md/raid5-cache.c | 8 +-
drivers/md/raid5.c | 44 +--
include/linux/bitmap.h | 8 +
lib/bitmap.c | 19 ++
14 files changed, 326 insertions(+), 317 deletions(-)
--
2.18.0
^ permalink raw reply
* Re: [PATCH] synaptics: Enable RMI4 for Clevo P870DM laptops
From: Rosen Penev @ 2018-06-30 18:57 UTC (permalink / raw)
To: teika
Cc: linux-input, linux-kernel, benjamin.tissoires, dmitry.torokhov,
jan.steffens, waltercool
In-Reply-To: <20180624.150445.1006140718276550233.teika@gmx.com>
On Sat, Jun 23, 2018 at 11:05 PM Teika Kazura <teika@gmx.com> wrote:
>
> Hi, Rosen. Thank you for your patch. (@Jan Steffens and @Pablo Cholaky: Thanks for your reports.) But I'm afraid some more work is necessary. Let me propose some points.
Too much work for me. I'll just use the kernel pareameter.
>
> I'm not a kernel developer, but have been working on this issue to help them. (See https://www.spinics.net/lists/linux-input/msg55950.html )
>
> 0.
> Could you resend it, cc-ing to the relevant developers. (Use the one of my reply here. You can use <kernel src tree>/scripts/get_maintainer.pl next time.) Otherwise, it is unlikely to be noticed by them.
>
> 1.
> You added your device to forcepad_pnp_ids[], but I guess it should be smbus_pnp_ids[].
>
> When making the patch again, please use the kernel 4.17 or newer, because smbus_pnp_ids was changed recently.
>
> If it works by using smbus_pnp_ids, please test it for a week or so, especially making sure that suspend/resume works without any problem.
>
> 2.
> Though it's my personal impression, the change description looked somewhat personal. At the same time, it's important, guaranteeing the stability of the patch.- I know you originally reported it last August [1]. Furthermore, there have been two other users [2] who reported SMBus worked for the same device, namely SYN1219. (They two are cc-ed to in this reply.)
>
> You can use "$ git format-patch --cover-letter"; it will generate a "cover-letter", the introductory part of the patch, explaining the acceptability of the patch to kernel developers. (For an example, see https://www.spinics.net/lists/linux-input/msg57041.html)
>
> So the full description can be given in the cover letter, and the real patch description can be something like "This enables SMBus for xxx", being almost identical to the email subject.
>
> 3. This is not essential, but the style of the email subject that the device maintainer prefers might be:
> ------------------------------------------------------------------------
> [PATCH v2] Input: synaptics - Enable RMI4 for Clevo P870DM laptops
> ------------------------------------------------------------------------
> after looking at this tree [3]. ("v2" meaning version 2, due to the above change.) You can feed "--subject-prefix='PATCH v2'" to "$ git format-patch".
>
> 4. If you want to give the credit for my reply, you can add
> ------------------------------------------------------------------------
> Suggested-by: Teika Kazura <teika@gmx.com>
> ------------------------------------------------------------------------
> after Signed-off-by. It's completely ok without it. :-)
>
> [1] https://marc.info/?l=linux-input&m=150284057602358&w=2
> [2] https://marc.info/?l=linux-input&m=150049625613055&w=2
> https://marc.info/?l=linux-input&m=150094561111026&w=2
> [3] https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/log/
>
> Best regards,
> Teika (Teika kazura)
>
>
> From: Rosen Penev <rosenp@gmail.com>
> Subject: [PATCH] synaptics: Enable RMI4 for Clevo P870DM laptops
> Date: Sat, 16 Jun 2018 18:42:16 -0700
>
> > I have been testing this for half a year with no issues to report.
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> > drivers/input/mouse/synaptics.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> > index 55d33500d55e..23f5bb2cf9da 100644
> > --- a/drivers/input/mouse/synaptics.c
> > +++ b/drivers/input/mouse/synaptics.c
> > @@ -183,6 +183,7 @@ static const char * const smbus_pnp_ids[] = {
> > };
> >
> > static const char * const forcepad_pnp_ids[] = {
> > + "SYN1219",
> > "SYN300D",
> > "SYN3014",
> > NULL
> > --
> > 2.17.1
> >
^ permalink raw reply
* Re: [PATCH 4/5] iio: adc: ti_am335x_adc: Disable ADC during suspend unconditionally
From: Jonathan Cameron @ 2018-06-30 15:18 UTC (permalink / raw)
To: Vignesh R
Cc: Dmitry Torokhov, Lee Jones, linux-iio, linux-omap, linux-kernel,
linux-input
In-Reply-To: <20180630103318.25355-5-vigneshr@ti.com>
On Sat, 30 Jun 2018 16:03:17 +0530
Vignesh R <vigneshr@ti.com> wrote:
> Parent MFD device takes care of enabling ADC interface whenever
> touchscreen is marked wakeup capable. Therefore, unconditionally disable
> ADC interface during system suspend to save power in case of system with
> just ADC and no TSC.
>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
This sounds like a sensible change to me. Is it applicable without the
rest of the series? If so I'll take it through IIO. If the answer
is that it needs to go with the rest then
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Thanks,
Jonathan
> ---
> drivers/iio/adc/ti_am335x_adc.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index 80df5a377d30..cafb1dcadc48 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -693,16 +693,12 @@ static int __maybe_unused tiadc_suspend(struct device *dev)
> {
> struct iio_dev *indio_dev = dev_get_drvdata(dev);
> struct tiadc_device *adc_dev = iio_priv(indio_dev);
> - struct ti_tscadc_dev *tscadc_dev;
> unsigned int idle;
>
> - tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
> - if (!device_may_wakeup(tscadc_dev->dev)) {
> - idle = tiadc_readl(adc_dev, REG_CTRL);
> - idle &= ~(CNTRLREG_TSCSSENB);
> - tiadc_writel(adc_dev, REG_CTRL, (idle |
> - CNTRLREG_POWERDOWN));
> - }
> + idle = tiadc_readl(adc_dev, REG_CTRL);
> + idle &= ~(CNTRLREG_TSCSSENB);
> + tiadc_writel(adc_dev, REG_CTRL, (idle |
> + CNTRLREG_POWERDOWN));
>
> return 0;
> }
^ permalink raw reply
* [PATCH 5/5] Input: ti_am335x_tsc: Mark IRQ as wakeup capable
From: Vignesh R @ 2018-06-30 10:33 UTC (permalink / raw)
To: Jonathan Cameron, Dmitry Torokhov, Lee Jones
Cc: Vignesh R, linux-iio, linux-omap, linux-kernel, linux-input
In-Reply-To: <20180630103318.25355-1-vigneshr@ti.com>
On AM335x, ti_am335x_tsc can wake up the system from suspend, mark the
IRQ as wakeup capable, so that device irq is not disabled during system
suspend.
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
drivers/input/touchscreen/ti_am335x_tsc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index a4f25a915ffc..9e8684ab48f4 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -27,6 +27,7 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/sort.h>
+#include <linux/pm_wakeirq.h>
#include <linux/mfd/ti_am335x_tscadc.h>
@@ -439,6 +440,9 @@ static int titsc_probe(struct platform_device *pdev)
}
device_init_wakeup(&pdev->dev, true);
+ err = dev_pm_set_wake_irq(&pdev->dev, ts_dev->irq);
+ if (err)
+ dev_err(&pdev->dev, "irq wake enable failed.\n");
titsc_writel(ts_dev, REG_IRQSTATUS, TSC_IRQENB_MASK);
titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES);
@@ -471,6 +475,7 @@ static int titsc_probe(struct platform_device *pdev)
return 0;
err_free_irq:
+ dev_pm_clear_wake_irq(&pdev->dev);
device_init_wakeup(&pdev->dev, false);
free_irq(ts_dev->irq, ts_dev);
err_free_mem:
@@ -484,6 +489,7 @@ static int titsc_remove(struct platform_device *pdev)
struct titsc *ts_dev = platform_get_drvdata(pdev);
u32 steps;
+ dev_pm_clear_wake_irq(&pdev->dev);
device_init_wakeup(&pdev->dev, false);
free_irq(ts_dev->irq, ts_dev);
--
2.18.0
^ permalink raw reply related
* [PATCH 4/5] iio: adc: ti_am335x_adc: Disable ADC during suspend unconditionally
From: Vignesh R @ 2018-06-30 10:33 UTC (permalink / raw)
To: Jonathan Cameron, Dmitry Torokhov, Lee Jones
Cc: Vignesh R, linux-iio, linux-omap, linux-kernel, linux-input
In-Reply-To: <20180630103318.25355-1-vigneshr@ti.com>
Parent MFD device takes care of enabling ADC interface whenever
touchscreen is marked wakeup capable. Therefore, unconditionally disable
ADC interface during system suspend to save power in case of system with
just ADC and no TSC.
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
drivers/iio/adc/ti_am335x_adc.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 80df5a377d30..cafb1dcadc48 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -693,16 +693,12 @@ static int __maybe_unused tiadc_suspend(struct device *dev)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct tiadc_device *adc_dev = iio_priv(indio_dev);
- struct ti_tscadc_dev *tscadc_dev;
unsigned int idle;
- tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
- if (!device_may_wakeup(tscadc_dev->dev)) {
- idle = tiadc_readl(adc_dev, REG_CTRL);
- idle &= ~(CNTRLREG_TSCSSENB);
- tiadc_writel(adc_dev, REG_CTRL, (idle |
- CNTRLREG_POWERDOWN));
- }
+ idle = tiadc_readl(adc_dev, REG_CTRL);
+ idle &= ~(CNTRLREG_TSCSSENB);
+ tiadc_writel(adc_dev, REG_CTRL, (idle |
+ CNTRLREG_POWERDOWN));
return 0;
}
--
2.18.0
^ permalink raw reply related
* [PATCH 3/5] mfd: ti_am335x_tscadc: Keep ADC interface on if child is wakeup capable
From: Vignesh R @ 2018-06-30 10:33 UTC (permalink / raw)
To: Jonathan Cameron, Dmitry Torokhov, Lee Jones
Cc: Vignesh R, linux-iio, linux-omap, linux-kernel, linux-input
In-Reply-To: <20180630103318.25355-1-vigneshr@ti.com>
If a child device like touchscreen is wakeup capable, then keep ADC
interface on, so that a touching resistive screen will generate wakeup
event to the system.
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
drivers/mfd/ti_am335x_tscadc.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 858c1a071a81..c21ed54d1662 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -294,11 +294,24 @@ static int ti_tscadc_remove(struct platform_device *pdev)
return 0;
}
+static int __maybe_unused ti_tscadc_can_wakeup(struct device *dev, void *data)
+{
+ return device_may_wakeup(dev);
+}
+
static int __maybe_unused tscadc_suspend(struct device *dev)
{
struct ti_tscadc_dev *tscadc = dev_get_drvdata(dev);
regmap_write(tscadc->regmap, REG_SE, 0x00);
+ if (device_for_each_child(dev, NULL, ti_tscadc_can_wakeup)) {
+ u32 ctrl;
+
+ regmap_read(tscadc->regmap, REG_CTRL, &ctrl);
+ ctrl &= ~(CNTRLREG_POWERDOWN);
+ ctrl |= CNTRLREG_TSCSSENB;
+ regmap_write(tscadc->regmap, REG_CTRL, ctrl);
+ }
pm_runtime_put_sync(dev);
return 0;
--
2.18.0
^ permalink raw reply related
* [PATCH 2/5] Input: ti_am335x_tsc: Mark TSC device as wakeup source
From: Vignesh R @ 2018-06-30 10:33 UTC (permalink / raw)
To: Jonathan Cameron, Dmitry Torokhov, Lee Jones
Cc: Vignesh R, linux-iio, linux-omap, linux-kernel, linux-input
In-Reply-To: <20180630103318.25355-1-vigneshr@ti.com>
Instead of TSCADC MFD device, mark TSC as wakeup source and change all
wakeup related PM calls to operate on TSC device.
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
drivers/input/touchscreen/ti_am335x_tsc.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index b86c1e5fbc11..a4f25a915ffc 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -46,6 +46,7 @@ static const int config_pins[] = {
struct titsc {
struct input_dev *input;
struct ti_tscadc_dev *mfd_tscadc;
+ struct device *dev;
unsigned int irq;
unsigned int wires;
unsigned int x_plate_resistance;
@@ -276,7 +277,7 @@ static irqreturn_t titsc_irq(int irq, void *dev)
if (status & IRQENB_HW_PEN) {
ts_dev->pen_down = true;
irqclr |= IRQENB_HW_PEN;
- pm_stay_awake(ts_dev->mfd_tscadc->dev);
+ pm_stay_awake(ts_dev->dev);
}
if (status & IRQENB_PENUP) {
@@ -286,7 +287,7 @@ static irqreturn_t titsc_irq(int irq, void *dev)
input_report_key(input_dev, BTN_TOUCH, 0);
input_report_abs(input_dev, ABS_PRESSURE, 0);
input_sync(input_dev);
- pm_relax(ts_dev->mfd_tscadc->dev);
+ pm_relax(ts_dev->dev);
} else {
ts_dev->pen_down = true;
}
@@ -422,6 +423,7 @@ static int titsc_probe(struct platform_device *pdev)
ts_dev->mfd_tscadc = tscadc_dev;
ts_dev->input = input_dev;
ts_dev->irq = tscadc_dev->irq;
+ ts_dev->dev = &pdev->dev;
err = titsc_parse_dt(pdev, ts_dev);
if (err) {
@@ -436,6 +438,8 @@ static int titsc_probe(struct platform_device *pdev)
goto err_free_mem;
}
+ device_init_wakeup(&pdev->dev, true);
+
titsc_writel(ts_dev, REG_IRQSTATUS, TSC_IRQENB_MASK);
titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES);
titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_EOS);
@@ -467,6 +471,7 @@ static int titsc_probe(struct platform_device *pdev)
return 0;
err_free_irq:
+ device_init_wakeup(&pdev->dev, false);
free_irq(ts_dev->irq, ts_dev);
err_free_mem:
input_free_device(input_dev);
@@ -479,6 +484,7 @@ static int titsc_remove(struct platform_device *pdev)
struct titsc *ts_dev = platform_get_drvdata(pdev);
u32 steps;
+ device_init_wakeup(&pdev->dev, false);
free_irq(ts_dev->irq, ts_dev);
/* total steps followed by the enable mask */
@@ -499,7 +505,7 @@ static int __maybe_unused titsc_suspend(struct device *dev)
unsigned int idle;
tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
- if (device_may_wakeup(tscadc_dev->dev)) {
+ if (device_may_wakeup(dev)) {
titsc_writel(ts_dev, REG_IRQSTATUS, TSC_IRQENB_MASK);
idle = titsc_readl(ts_dev, REG_IRQENABLE);
titsc_writel(ts_dev, REG_IRQENABLE,
@@ -515,11 +521,11 @@ static int __maybe_unused titsc_resume(struct device *dev)
struct ti_tscadc_dev *tscadc_dev;
tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
- if (device_may_wakeup(tscadc_dev->dev)) {
+ if (device_may_wakeup(dev)) {
titsc_writel(ts_dev, REG_IRQWAKEUP,
0x00);
titsc_writel(ts_dev, REG_IRQCLR, IRQENB_HW_PEN);
- pm_relax(ts_dev->mfd_tscadc->dev);
+ pm_relax(dev);
}
titsc_step_config(ts_dev);
titsc_writel(ts_dev, REG_FIFO0THR,
--
2.18.0
^ permalink raw reply related
* [PATCH 1/5] mfd: ti_am335x_tscadc: Don't mark TSCADC MFD as wakeup capable
From: Vignesh R @ 2018-06-30 10:33 UTC (permalink / raw)
To: Jonathan Cameron, Dmitry Torokhov, Lee Jones
Cc: Vignesh R, linux-iio, linux-omap, linux-kernel, linux-input
In-Reply-To: <20180630103318.25355-1-vigneshr@ti.com>
Currently tscadc MFD is marked as wakeup capable which incorrect
because, its actually touch event by child TSC device that wakes up the
system. Therefore, remove device_init_wakeup() call that marks TSCADC
device as wakeup capable in favor of moving to mark TSC input device as
wakeup capable later.
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
drivers/mfd/ti_am335x_tscadc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 47012c0899cd..858c1a071a81 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -270,7 +270,6 @@ static int ti_tscadc_probe(struct platform_device *pdev)
if (err < 0)
goto err_disable_clk;
- device_init_wakeup(&pdev->dev, true);
platform_set_drvdata(pdev, tscadc);
return 0;
--
2.18.0
^ permalink raw reply related
* [PATCH 0/5] ti_am335x_tsc: Enable wakeup capability
From: Vignesh R @ 2018-06-30 10:33 UTC (permalink / raw)
To: Jonathan Cameron, Dmitry Torokhov, Lee Jones
Cc: Vignesh R, linux-iio, linux-omap, linux-kernel, linux-input
On AM335x, resistive TSC can wakeup the system from low power state.
Currently, parent MFD device is marked as wakeup source, which is
inaccurate as its the touch event generated by TSC thats the wakeup
source. This series moves all wakeup related calls to operate on TSC
device instead of MFD. It also marks TSC IRQ as wakeup capable, so that
its not disabled during system suspend.
This series is based on Dmitry's comments here:
https://lkml.org/lkml/2018/4/24/65
There are many new patches in this series, hence did not mark this as v4.
Vignesh R (5):
mfd: ti_am335x_tscadc: Don't mark TSCADC MFD as wakeup capable
Input: ti_am335x_tsc: Mark TSC device as wakeup source
mfd: ti_am335x_tscadc: Keep ADC interface on if child is wakeup
capable
iio: adc: ti_am335x_adc: Disable ADC during suspend unconditionally
Input: ti_am335x_tsc: Mark IRQ as wakeup capable
drivers/iio/adc/ti_am335x_adc.c | 12 ++++--------
drivers/input/touchscreen/ti_am335x_tsc.c | 22 +++++++++++++++++-----
drivers/mfd/ti_am335x_tscadc.c | 14 +++++++++++++-
3 files changed, 34 insertions(+), 14 deletions(-)
--
2.18.0
^ permalink raw reply
* [PATCH] HID: hiddev: fix potential Spectre v1
From: Gustavo A. R. Silva @ 2018-06-29 22:08 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires
Cc: linux-usb, linux-input, linux-kernel, Gustavo A. R. Silva
uref->field_index, uref->usage_index, finfo.field_index and
cinfo.index can be indirectly controlled by user-space, hence
leading to a potential exploitation of the Spectre variant 1
vulnerability.
This issue was detected with the help of Smatch:
drivers/hid/usbhid/hiddev.c:473 hiddev_ioctl_usage() warn: potential
spectre issue 'report->field' (local cap)
drivers/hid/usbhid/hiddev.c:477 hiddev_ioctl_usage() warn: potential
spectre issue 'field->usage' (local cap)
drivers/hid/usbhid/hiddev.c:757 hiddev_ioctl() warn: potential spectre
issue 'report->field' (local cap)
drivers/hid/usbhid/hiddev.c:801 hiddev_ioctl() warn: potential spectre
issue 'hid->collection' (local cap)
Fix this by sanitizing such structure fields before using them to index
report->field, field->usage and hid->collection
Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].
[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2
Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/hid/usbhid/hiddev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index e3ce233..23872d0 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -36,6 +36,7 @@
#include <linux/hiddev.h>
#include <linux/compat.h>
#include <linux/vmalloc.h>
+#include <linux/nospec.h>
#include "usbhid.h"
#ifdef CONFIG_USB_DYNAMIC_MINORS
@@ -469,10 +470,14 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
if (uref->field_index >= report->maxfield)
goto inval;
+ uref->field_index = array_index_nospec(uref->field_index,
+ report->maxfield);
field = report->field[uref->field_index];
if (uref->usage_index >= field->maxusage)
goto inval;
+ uref->usage_index = array_index_nospec(uref->usage_index,
+ field->maxusage);
uref->usage_code = field->usage[uref->usage_index].hid;
@@ -499,6 +504,8 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
if (uref->field_index >= report->maxfield)
goto inval;
+ uref->field_index = array_index_nospec(uref->field_index,
+ report->maxfield);
field = report->field[uref->field_index];
@@ -753,6 +760,8 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (finfo.field_index >= report->maxfield)
break;
+ finfo.field_index = array_index_nospec(finfo.field_index,
+ report->maxfield);
field = report->field[finfo.field_index];
memset(&finfo, 0, sizeof(finfo));
@@ -797,6 +806,8 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (cinfo.index >= hid->maxcollection)
break;
+ cinfo.index = array_index_nospec(cinfo.index,
+ hid->maxcollection);
cinfo.type = hid->collection[cinfo.index].type;
cinfo.usage = hid->collection[cinfo.index].usage;
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v8 2/2] mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC
From: Matti Vaittinen @ 2018-06-29 8:26 UTC (permalink / raw)
To: mturquette, robh+dt, mark.rutland, lee.jones, lgirdwood, broonie,
mazziesaccount, arnd, dmitry.torokhov, sre, chenjh,
andrew.smirnov, linus.walleij, kstewart, heiko, gregkh
Cc: sboyd, linux-clk, devicetree, linux-kernel, linux-input,
mikko.mutanen, heikki.haikola
In-Reply-To: <a7904544d51270f4d2230ceb1a336b57a06652c1.1530259815.git.matti.vaittinen@fi.rohmeurope.com>
On Fri, Jun 29, 2018 at 11:23:42AM +0300, Matti Vaittinen wrote:
> Document devicetree bindings for ROHM BD71837 PMIC MFD.
>
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> Reviewed-by: Rob Herring <robh@kernel.org>
I kept the Reviewed-by: tag here as there is no changes from patch v6
which was reviewed by Rob - hopefully this was not a violation of any
sort...
Best Regards
Matti Vaittinen
^ permalink raw reply
* [PATCH v8 2/2] mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC
From: Matti Vaittinen @ 2018-06-29 8:23 UTC (permalink / raw)
To: mturquette, robh+dt, mark.rutland, lee.jones, lgirdwood, broonie,
mazziesaccount, arnd, dmitry.torokhov, sre, chenjh,
andrew.smirnov, linus.walleij, kstewart, heiko, gregkh
Cc: sboyd, linux-clk, devicetree, linux-kernel, linux-input,
mikko.mutanen, heikki.haikola
In-Reply-To: <cover.1530259815.git.matti.vaittinen@fi.rohmeurope.com>
Document devicetree bindings for ROHM BD71837 PMIC MFD.
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
.../devicetree/bindings/mfd/rohm,bd71837-pmic.txt | 67 ++++++++++++++++++++++
1 file changed, 67 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt b/Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
new file mode 100644
index 000000000000..67f2616288d9
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
@@ -0,0 +1,67 @@
+* ROHM BD71837 Power Management Integrated Circuit bindings
+
+BD71837MWV is a programmable Power Management IC for powering single-core,
+dual-core, and quad-core SoC’s such as NXP-i.MX 8M. It is optimized for
+low BOM cost and compact solution footprint. It integrates 8 Buck
+egulators and 7 LDO’s to provide all the power rails required by the SoC and
+the commonly used peripherals.
+
+Datasheet for PMIC is available at:
+https://www.rohm.com/datasheet/BD71837MWV/bd71837mwv-e
+
+Required properties:
+ - compatible : Should be "rohm,bd71837".
+ - reg : I2C slave address.
+ - interrupt-parent : Phandle to the parent interrupt controller.
+ - interrupts : The interrupt line the device is connected to.
+ - clocks : The parent clock connected to PMIC. If this is missng
+ 32768 KHz clock is assumed.
+ - #clock-cells : Should be 0
+ - regulators: : List of child nodes that specify the regulators
+ Please see ../regulator/rohm,bd71837-regulator.txt
+
+Optional properties:
+- clock-output-names : Should contain name for output clock.
+
+Example:
+
+ /* external oscillator node */
+ osc: oscillator {
+ compatible = "fixed-clock";
+ #clock-cells = <1>;
+ clock-frequency = <32768>;
+ clock-output-names = "osc";
+ };
+
+ /* PMIC node */
+
+ pmic: pmic@4b {
+ compatible = "rohm,bd71837";
+ reg = <0x4b>;
+ interrupt-parent = <&gpio1>;
+ interrupts = <29 GPIO_ACTIVE_LOW>;
+ interrupt-names = "irq";
+ #clock-cells = <0>;
+ clocks = <&osc 0>;
+ clock-output-names = "bd71837-32k-out";
+
+ regulators {
+ buck1: BUCK1 {
+ regulator-name = "buck1";
+ regulator-min-microvolt = <700000>;
+ regulator-max-microvolt = <1300000>;
+ regulator-boot-on;
+ regulator-ramp-delay = <1250>;
+ };
+ /* ... */
+ };
+ };
+
+ /* Clock consumer node */
+
+ foo@0 {
+ compatible = "bar,foo";
+ /* ... */
+ clock-names = "my-clock";
+ clocks = <&pmic>;
+ };
--
2.14.3
^ permalink raw reply related
* [PATCH v8 1/2] mfd: bd71837: mfd driver for ROHM BD71837 PMIC
From: Matti Vaittinen @ 2018-06-29 8:21 UTC (permalink / raw)
To: mturquette, robh+dt, mark.rutland, lee.jones, lgirdwood, broonie,
mazziesaccount, arnd, dmitry.torokhov, sre, chenjh,
andrew.smirnov, linus.walleij, kstewart, heiko, gregkh
Cc: sboyd, linux-clk, devicetree, linux-kernel, linux-input,
mikko.mutanen, heikki.haikola
In-Reply-To: <cover.1530259815.git.matti.vaittinen@fi.rohmeurope.com>
ROHM BD71837 PMIC MFD driver providing interrupts and support
for three subsystems:
- clk
- Regulators
- input/power-key
fix too long lines
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
---
drivers/mfd/Kconfig | 13 ++
drivers/mfd/Makefile | 1 +
drivers/mfd/bd71837.c | 220 +++++++++++++++++++++++++
include/linux/mfd/bd71837.h | 391 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 625 insertions(+)
create mode 100644 drivers/mfd/bd71837.c
create mode 100644 include/linux/mfd/bd71837.h
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b860eb5aa194..d01a279f5e4a 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1787,6 +1787,19 @@ config MFD_STW481X
in various ST Microelectronics and ST-Ericsson embedded
Nomadik series.
+config MFD_BD71837
+ tristate "BD71837 Power Management chip"
+ depends on I2C=y
+ depends on OF
+ select REGMAP_I2C
+ select REGMAP_IRQ
+ select MFD_CORE
+ help
+ Select this option to get support for the ROHM BD71837
+ Power Management chips. BD71837 is designed to power processors like
+ NXP i.MX8. It contains 8 BUCK outputs and 7 LDOs, voltage monitoring
+ and emergency shut down as well as 32,768KHz clock output.
+
config MFD_STM32_LPTIMER
tristate "Support for STM32 Low-Power Timer"
depends on (ARCH_STM32 && OF) || COMPILE_TEST
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index e9fd20dba18d..09dc9eb3782c 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -227,4 +227,5 @@ obj-$(CONFIG_MFD_STM32_TIMERS) += stm32-timers.o
obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o
obj-$(CONFIG_MFD_SC27XX_PMIC) += sprd-sc27xx-spi.o
obj-$(CONFIG_RAVE_SP_CORE) += rave-sp.o
+obj-$(CONFIG_MFD_BD71837) += bd71837.o
diff --git a/drivers/mfd/bd71837.c b/drivers/mfd/bd71837.c
new file mode 100644
index 000000000000..25f2de2a5bb8
--- /dev/null
+++ b/drivers/mfd/bd71837.c
@@ -0,0 +1,220 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// Copyright (C) 2018 ROHM Semiconductors
+// bd71837.c -- ROHM BD71837MWV mfd driver
+//
+// Datasheet available from
+// https://www.rohm.com/datasheet/BD71837MWV/bd71837mwv-e
+
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/mfd/bd71837.h>
+#include <linux/mfd/core.h>
+#include <linux/module.h>
+#include <linux/regmap.h>
+#include <linux/gpio_keys.h>
+
+static struct gpio_keys_button btns[] = {
+ {
+ .code = KEY_POWER,
+ .gpio = -1,
+ .type = EV_KEY,
+ }
+};
+
+static struct gpio_keys_platform_data bd718xx_powerkey_data = {
+ .buttons = &btns[0],
+ .nbuttons = ARRAY_SIZE(btns),
+ .name = "bd718xx-pwrkey",
+};
+
+/* bd71837 multi function cells */
+
+static struct mfd_cell bd71837_mfd_cells[] = {
+ {
+ .name = "bd71837-clk",
+ }, {
+ .name = "gpio-keys",
+ .platform_data = &bd718xx_powerkey_data,
+ .pdata_size = sizeof(bd718xx_powerkey_data),
+ }, {
+ .name = "bd71837-pmic",
+ }
+};
+
+static const struct regmap_irq bd71837_irqs[] = {
+ REGMAP_IRQ_REG(BD71837_INT_SWRST, 0, BD71837_INT_SWRST_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_PWRBTN_S, 0, BD71837_INT_PWRBTN_S_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_PWRBTN_L, 0, BD71837_INT_PWRBTN_L_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_PWRBTN, 0, BD71837_INT_PWRBTN_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_WDOG, 0, BD71837_INT_WDOG_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_ON_REQ, 0, BD71837_INT_ON_REQ_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_STBY_REQ, 0, BD71837_INT_STBY_REQ_MASK),
+};
+
+static struct regmap_irq_chip bd71837_irq_chip = {
+ .name = "bd71837-irq",
+ .irqs = bd71837_irqs,
+ .num_irqs = ARRAY_SIZE(bd71837_irqs),
+ .num_regs = 1,
+ .irq_reg_stride = 1,
+ .status_base = BD71837_REG_IRQ,
+ .mask_base = BD71837_REG_MIRQ,
+ .ack_base = BD71837_REG_IRQ,
+ .init_ack_masked = true,
+ .mask_invert = false,
+};
+
+static const struct regmap_range pmic_status_range = {
+ .range_min = BD71837_REG_IRQ,
+ .range_max = BD71837_REG_POW_STATE,
+};
+
+static const struct regmap_access_table volatile_regs = {
+ .yes_ranges = &pmic_status_range,
+ .n_yes_ranges = 1,
+};
+
+static const struct regmap_config bd71837_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .volatile_table = &volatile_regs,
+ .max_register = BD71837_MAX_REGISTER - 1,
+ .cache_type = REGCACHE_RBTREE,
+};
+
+static const struct of_device_id bd71837_of_match[] = {
+ { .compatible = "rohm,bd71837", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, bd71837_of_match);
+
+static int bd71837_i2c_probe(struct i2c_client *i2c,
+ const struct i2c_device_id *id)
+{
+ struct bd71837 *bd71837;
+ struct bd71837_board *board_info;
+ int ret = -EINVAL;
+
+ board_info = dev_get_platdata(&i2c->dev);
+
+ if (!board_info) {
+ board_info = devm_kzalloc(&i2c->dev, sizeof(*board_info),
+ GFP_KERNEL);
+ if (!board_info) {
+ ret = -ENOMEM;
+ goto err_out;
+ } else if (i2c->irq) {
+ board_info->gpio_intr = i2c->irq;
+ } else {
+ ret = -ENOENT;
+ goto err_out;
+ }
+ }
+
+ if (!board_info)
+ goto err_out;
+
+ bd71837 = devm_kzalloc(&i2c->dev, sizeof(struct bd71837), GFP_KERNEL);
+ if (bd71837 == NULL)
+ return -ENOMEM;
+
+ i2c_set_clientdata(i2c, bd71837);
+ bd71837->dev = &i2c->dev;
+ bd71837->i2c_client = i2c;
+ bd71837->chip_irq = board_info->gpio_intr;
+
+ bd71837->regmap = devm_regmap_init_i2c(i2c, &bd71837_regmap_config);
+ if (IS_ERR(bd71837->regmap)) {
+ ret = PTR_ERR(bd71837->regmap);
+ dev_err(&i2c->dev, "regmap initialization failed: %d\n", ret);
+ goto err_out;
+ }
+
+ ret = bd71837_reg_read(bd71837, BD71837_REG_REV);
+ if (ret < 0) {
+ dev_err(bd71837->dev,
+ "%s(): Read BD71837_REG_DEVICE failed!\n", __func__);
+ goto err_out;
+ }
+
+ ret = devm_regmap_add_irq_chip(&i2c->dev, bd71837->regmap,
+ bd71837->chip_irq, IRQF_ONESHOT, 0,
+ &bd71837_irq_chip, &bd71837->irq_data);
+ if (ret < 0) {
+ dev_err(bd71837->dev, "Failed to add irq_chip %d\n", ret);
+ goto err_out;
+ }
+
+ ret = regmap_update_bits(bd71837->regmap,
+ BD71837_REG_PWRONCONFIG0,
+ BD718XX_PWRBTN_PRESS_DURATION_MASK,
+ BD718XX_PWRBTN_SHORT_PRESS_10MS);
+ if (ret < 0) {
+ dev_err(bd71837->dev,
+ "Failed to configure button short press timeout %d\n",
+ ret);
+ goto err_out;
+ }
+ /* According to BD71847 datasheet the HW default for long press
+ * detection is 10ms. So lets change it to 10 sec so we can actually
+ * get the short push and allow gracefull shut down
+ */
+ ret = regmap_update_bits(bd71837->regmap,
+ BD71837_REG_PWRONCONFIG1,
+ BD718XX_PWRBTN_PRESS_DURATION_MASK,
+ BD718XX_PWRBTN_LONG_PRESS_10S);
+ if (ret < 0) {
+ dev_err(bd71837->dev,
+ "Failed to configure button long press timeout %d\n",
+ ret);
+ goto err_out;
+ }
+ btns[0].irq = regmap_irq_get_virq(bd71837->irq_data,
+ BD71837_INT_PWRBTN_S);
+
+ if (btns[0].irq < 0) {
+ ret = btns[0].irq;
+ goto err_out;
+ }
+
+ ret = devm_mfd_add_devices(bd71837->dev, PLATFORM_DEVID_AUTO,
+ bd71837_mfd_cells,
+ ARRAY_SIZE(bd71837_mfd_cells), NULL, 0,
+ regmap_irq_get_domain(bd71837->irq_data));
+err_out:
+
+ return ret;
+}
+
+static const struct i2c_device_id bd71837_i2c_id[] = {
+ { .name = "bd71837", },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, bd71837_i2c_id);
+
+static struct i2c_driver bd71837_i2c_driver = {
+ .driver = {
+ .name = "bd71837-mfd",
+ .of_match_table = bd71837_of_match,
+ },
+ .probe = bd71837_i2c_probe,
+ .id_table = bd71837_i2c_id,
+};
+
+static int __init bd71837_i2c_init(void)
+{
+ return i2c_add_driver(&bd71837_i2c_driver);
+}
+/* init early so consumer devices can complete system boot */
+subsys_initcall(bd71837_i2c_init);
+
+static void __exit bd71837_i2c_exit(void)
+{
+ i2c_del_driver(&bd71837_i2c_driver);
+}
+module_exit(bd71837_i2c_exit);
+
+MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>");
+MODULE_DESCRIPTION("BD71837 chip multi-function driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/mfd/bd71837.h b/include/linux/mfd/bd71837.h
new file mode 100644
index 000000000000..10b0dfe90f27
--- /dev/null
+++ b/include/linux/mfd/bd71837.h
@@ -0,0 +1,391 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* Copyright (C) 2018 ROHM Semiconductors */
+
+/*
+ * ROHM BD71837MWV header file
+ */
+
+#ifndef __LINUX_MFD_BD71837_H__
+#define __LINUX_MFD_BD71837_H__
+
+#include <linux/regmap.h>
+
+enum {
+ BD71837_BUCK1 = 0,
+ BD71837_BUCK2,
+ BD71837_BUCK3,
+ BD71837_BUCK4,
+ BD71837_BUCK5,
+ BD71837_BUCK6,
+ BD71837_BUCK7,
+ BD71837_BUCK8,
+ BD71837_LDO1,
+ BD71837_LDO2,
+ BD71837_LDO3,
+ BD71837_LDO4,
+ BD71837_LDO5,
+ BD71837_LDO6,
+ BD71837_LDO7,
+ BD71837_REGULATOR_CNT,
+};
+
+#define BD71837_BUCK1_VOLTAGE_NUM 0x40
+#define BD71837_BUCK2_VOLTAGE_NUM 0x40
+#define BD71837_BUCK3_VOLTAGE_NUM 0x40
+#define BD71837_BUCK4_VOLTAGE_NUM 0x40
+
+#define BD71837_BUCK5_VOLTAGE_NUM 0x08
+#define BD71837_BUCK6_VOLTAGE_NUM 0x04
+#define BD71837_BUCK7_VOLTAGE_NUM 0x08
+#define BD71837_BUCK8_VOLTAGE_NUM 0x40
+
+#define BD71837_LDO1_VOLTAGE_NUM 0x04
+#define BD71837_LDO2_VOLTAGE_NUM 0x02
+#define BD71837_LDO3_VOLTAGE_NUM 0x10
+#define BD71837_LDO4_VOLTAGE_NUM 0x10
+#define BD71837_LDO5_VOLTAGE_NUM 0x10
+#define BD71837_LDO6_VOLTAGE_NUM 0x10
+#define BD71837_LDO7_VOLTAGE_NUM 0x10
+
+enum {
+ BD71837_REG_REV = 0x00,
+ BD71837_REG_SWRESET = 0x01,
+ BD71837_REG_I2C_DEV = 0x02,
+ BD71837_REG_PWRCTRL0 = 0x03,
+ BD71837_REG_PWRCTRL1 = 0x04,
+ BD71837_REG_BUCK1_CTRL = 0x05,
+ BD71837_REG_BUCK2_CTRL = 0x06,
+ BD71837_REG_BUCK3_CTRL = 0x07,
+ BD71837_REG_BUCK4_CTRL = 0x08,
+ BD71837_REG_BUCK5_CTRL = 0x09,
+ BD71837_REG_BUCK6_CTRL = 0x0A,
+ BD71837_REG_BUCK7_CTRL = 0x0B,
+ BD71837_REG_BUCK8_CTRL = 0x0C,
+ BD71837_REG_BUCK1_VOLT_RUN = 0x0D,
+ BD71837_REG_BUCK1_VOLT_IDLE = 0x0E,
+ BD71837_REG_BUCK1_VOLT_SUSP = 0x0F,
+ BD71837_REG_BUCK2_VOLT_RUN = 0x10,
+ BD71837_REG_BUCK2_VOLT_IDLE = 0x11,
+ BD71837_REG_BUCK3_VOLT_RUN = 0x12,
+ BD71837_REG_BUCK4_VOLT_RUN = 0x13,
+ BD71837_REG_BUCK5_VOLT = 0x14,
+ BD71837_REG_BUCK6_VOLT = 0x15,
+ BD71837_REG_BUCK7_VOLT = 0x16,
+ BD71837_REG_BUCK8_VOLT = 0x17,
+ BD71837_REG_LDO1_VOLT = 0x18,
+ BD71837_REG_LDO2_VOLT = 0x19,
+ BD71837_REG_LDO3_VOLT = 0x1A,
+ BD71837_REG_LDO4_VOLT = 0x1B,
+ BD71837_REG_LDO5_VOLT = 0x1C,
+ BD71837_REG_LDO6_VOLT = 0x1D,
+ BD71837_REG_LDO7_VOLT = 0x1E,
+ BD71837_REG_TRANS_COND0 = 0x1F,
+ BD71837_REG_TRANS_COND1 = 0x20,
+ BD71837_REG_VRFAULTEN = 0x21,
+ BD71837_REG_MVRFLTMASK0 = 0x22,
+ BD71837_REG_MVRFLTMASK1 = 0x23,
+ BD71837_REG_MVRFLTMASK2 = 0x24,
+ BD71837_REG_RCVCFG = 0x25,
+ BD71837_REG_RCVNUM = 0x26,
+ BD71837_REG_PWRONCONFIG0 = 0x27,
+ BD71837_REG_PWRONCONFIG1 = 0x28,
+ BD71837_REG_RESETSRC = 0x29,
+ BD71837_REG_MIRQ = 0x2A,
+ BD71837_REG_IRQ = 0x2B,
+ BD71837_REG_IN_MON = 0x2C,
+ BD71837_REG_POW_STATE = 0x2D,
+ BD71837_REG_OUT32K = 0x2E,
+ BD71837_REG_REGLOCK = 0x2F,
+ BD71837_REG_OTPVER = 0xFF,
+ BD71837_MAX_REGISTER = 0x100,
+};
+
+#define REGLOCK_PWRSEQ 0x1
+#define REGLOCK_VREG 0x10
+
+/* Generic BUCK control masks */
+#define BD71837_BUCK_SEL 0x02
+#define BD71837_BUCK_EN 0x01
+#define BD71837_BUCK_RUN_ON 0x04
+
+/* Generic LDO masks */
+#define BD71837_LDO_SEL 0x80
+#define BD71837_LDO_EN 0x40
+
+/* BD71837 BUCK ramp rate CTRL reg bits */
+#define BUCK_RAMPRATE_MASK 0xC0
+#define BUCK_RAMPRATE_10P00MV 0x0
+#define BUCK_RAMPRATE_5P00MV 0x1
+#define BUCK_RAMPRATE_2P50MV 0x2
+#define BUCK_RAMPRATE_1P25MV 0x3
+
+/* BD71837_REG_BUCK1_VOLT_RUN bits */
+#define BUCK1_RUN_MASK 0x3F
+#define BUCK1_RUN_DEFAULT 0x14
+
+/* BD71837_REG_BUCK1_VOLT_SUSP bits */
+#define BUCK1_SUSP_MASK 0x3F
+#define BUCK1_SUSP_DEFAULT 0x14
+
+/* BD71837_REG_BUCK1_VOLT_IDLE bits */
+#define BUCK1_IDLE_MASK 0x3F
+#define BUCK1_IDLE_DEFAULT 0x14
+
+/* BD71837_REG_BUCK2_VOLT_RUN bits */
+#define BUCK2_RUN_MASK 0x3F
+#define BUCK2_RUN_DEFAULT 0x1E
+
+/* BD71837_REG_BUCK2_VOLT_IDLE bits */
+#define BUCK2_IDLE_MASK 0x3F
+#define BUCK2_IDLE_DEFAULT 0x14
+
+/* BD71837_REG_BUCK3_VOLT_RUN bits */
+#define BUCK3_RUN_MASK 0x3F
+#define BUCK3_RUN_DEFAULT 0x1E
+
+/* BD71837_REG_BUCK4_VOLT_RUN bits */
+#define BUCK4_RUN_MASK 0x3F
+#define BUCK4_RUN_DEFAULT 0x1E
+
+/* BD71837_REG_BUCK5_VOLT bits */
+#define BUCK5_MASK 0x07
+#define BUCK5_DEFAULT 0x02
+
+/* BD71837_REG_BUCK6_VOLT bits */
+#define BUCK6_MASK 0x03
+#define BUCK6_DEFAULT 0x03
+
+/* BD71837_REG_BUCK7_VOLT bits */
+#define BUCK7_MASK 0x07
+#define BUCK7_DEFAULT 0x03
+
+/* BD71837_REG_BUCK8_VOLT bits */
+#define BUCK8_MASK 0x3F
+#define BUCK8_DEFAULT 0x1E
+
+/* BD71837_REG_IRQ bits */
+#define IRQ_SWRST 0x40
+#define IRQ_PWRON_S 0x20
+#define IRQ_PWRON_L 0x10
+#define IRQ_PWRON 0x08
+#define IRQ_WDOG 0x04
+#define IRQ_ON_REQ 0x02
+#define IRQ_STBY_REQ 0x01
+
+/* BD71837_REG_OUT32K bits */
+#define BD71837_OUT32K_EN 0x01
+
+/* BD71837 gated clock rate */
+#define BD71837_CLK_RATE 32768
+
+/* BD71837 irqs */
+enum {
+ BD71837_INT_STBY_REQ,
+ BD71837_INT_ON_REQ,
+ BD71837_INT_WDOG,
+ BD71837_INT_PWRBTN,
+ BD71837_INT_PWRBTN_L,
+ BD71837_INT_PWRBTN_S,
+ BD71837_INT_SWRST
+};
+
+/* BD71837 interrupt masks */
+#define BD71837_INT_SWRST_MASK 0x40
+#define BD71837_INT_PWRBTN_S_MASK 0x20
+#define BD71837_INT_PWRBTN_L_MASK 0x10
+#define BD71837_INT_PWRBTN_MASK 0x8
+#define BD71837_INT_WDOG_MASK 0x4
+#define BD71837_INT_ON_REQ_MASK 0x2
+#define BD71837_INT_STBY_REQ_MASK 0x1
+
+/* BD71837_REG_LDO1_VOLT bits */
+#define LDO1_MASK 0x03
+
+/* BD71837_REG_LDO1_VOLT bits */
+#define LDO2_MASK 0x20
+
+/* BD71837_REG_LDO3_VOLT bits */
+#define LDO3_MASK 0x0F
+
+/* BD71837_REG_LDO4_VOLT bits */
+#define LDO4_MASK 0x0F
+
+/* BD71837_REG_LDO5_VOLT bits */
+#define LDO5_MASK 0x0F
+
+/* BD71837_REG_LDO6_VOLT bits */
+#define LDO6_MASK 0x0F
+
+/* BD71837_REG_LDO7_VOLT bits */
+#define LDO7_MASK 0x0F
+
+/* Register write induced reset settings */
+
+/* Even though the bit zero is not SWRESET type we still want to write zero
+ * to it when changing type. Bit zero is 'SWRESET' trigger bit and if we
+ * write 1 to it we will trigger the action. So always write 0 to it when
+ * changning SWRESET action - no matter what we read from it.
+ */
+#define BD71837_SWRESET_TYPE_MASK 7
+#define BD71837_SWRESET_TYPE_DISABLED 0
+#define BD71837_SWRESET_TYPE_COLD 4
+#define BD71837_SWRESET_TYPE_WARM 6
+
+#define BD71837_SWRESET_RESET_MASK 1
+#define BD71837_SWRESET_RESET 1
+
+/* Poweroff state transition conditions */
+
+#define BD718XX_ON_REQ_POWEROFF_MASK 1
+#define BD718XX_SWRESET_POWEROFF_MASK 2
+#define BD718XX_WDOG_POWEROFF_MASK 4
+#define BD718XX_KEY_L_POWEROFF_MASK 8
+
+#define BD718XX_POWOFF_TO_SNVS 0
+#define BD718XX_POWOFF_TO_RDY 0xF
+
+#define BD718XX_POWOFF_TIME_MASK 0xF0
+enum {
+ BD718XX_POWOFF_TIME_5MS = 0,
+ BD718XX_POWOFF_TIME_10MS,
+ BD718XX_POWOFF_TIME_15MS,
+ BD718XX_POWOFF_TIME_20MS,
+ BD718XX_POWOFF_TIME_25MS,
+ BD718XX_POWOFF_TIME_30MS,
+ BD718XX_POWOFF_TIME_35MS,
+ BD718XX_POWOFF_TIME_40MS,
+ BD718XX_POWOFF_TIME_45MS,
+ BD718XX_POWOFF_TIME_50MS,
+ BD718XX_POWOFF_TIME_75MS,
+ BD718XX_POWOFF_TIME_100MS,
+ BD718XX_POWOFF_TIME_250MS,
+ BD718XX_POWOFF_TIME_500MS,
+ BD718XX_POWOFF_TIME_750MS,
+ BD718XX_POWOFF_TIME_1500MS
+};
+
+/* Poweron sequence state transition conditions */
+
+#define BD718XX_RDY_TO_SNVS_MASK 0xF
+#define BD718XX_SNVS_TO_RUN_MASK 0xF0
+
+#define BD718XX_PWR_TRIG_KEY_L 1
+#define BD718XX_PWR_TRIG_KEY_S 2
+#define BD718XX_PWR_TRIG_PMIC_ON 4
+#define BD718XX_PWR_TRIG_VSYS_UVLO 8
+#define BD718XX_RDY_TO_SNVS_SIFT 0
+#define BD718XX_SNVS_TO_RUN_SIFT 4
+
+
+#define BD718XX_PWRBTN_PRESS_DURATION_MASK 0xF
+
+/* Timeout value for detecting short press */
+
+enum {
+ BD718XX_PWRBTN_SHORT_PRESS_10MS = 0,
+ BD718XX_PWRBTN_SHORT_PRESS_500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_1000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_1500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_2000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_2500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_3000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_3500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_4000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_4500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_5000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_5500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_6000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_6500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_7000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_7500MS
+};
+
+/* Timeout value for detecting LONG press */
+
+enum {
+ BD718XX_PWRBTN_LONG_PRESS_10MS = 0,
+ BD718XX_PWRBTN_LONG_PRESS_1S,
+ BD718XX_PWRBTN_LONG_PRESS_2S,
+ BD718XX_PWRBTN_LONG_PRESS_3S,
+ BD718XX_PWRBTN_LONG_PRESS_4S,
+ BD718XX_PWRBTN_LONG_PRESS_5S,
+ BD718XX_PWRBTN_LONG_PRESS_6S,
+ BD718XX_PWRBTN_LONG_PRESS_7S,
+ BD718XX_PWRBTN_LONG_PRESS_8S,
+ BD718XX_PWRBTN_LONG_PRESS_9S,
+ BD718XX_PWRBTN_LONG_PRESS_10S,
+ BD718XX_PWRBTN_LONG_PRESS_11S,
+ BD718XX_PWRBTN_LONG_PRESS_12S,
+ BD718XX_PWRBTN_LONG_PRESS_13S,
+ BD718XX_PWRBTN_LONG_PRESS_14S,
+ BD718XX_PWRBTN_LONG_PRESS_15S
+};
+
+
+
+struct bd71837;
+struct bd71837_pmic;
+struct bd71837_clk;
+struct bd718xx_pwrkey;
+
+/*
+ * Board platform data may be used to initialize regulators.
+ */
+
+struct bd71837_board {
+ struct regulator_init_data *init_data[BD71837_REGULATOR_CNT];
+ int gpio_intr;
+};
+
+struct bd71837 {
+ struct device *dev;
+ struct i2c_client *i2c_client;
+ struct regmap *regmap;
+ unsigned long int id;
+
+ int chip_irq;
+ struct regmap_irq_chip_data *irq_data;
+
+ struct bd71837_pmic *pmic;
+ struct bd71837_clk *clk;
+ struct bd718xx_pwrkey *pwrkey;
+};
+
+/*
+ * bd71837 sub-driver chip access routines
+ */
+
+static inline int bd71837_reg_read(struct bd71837 *bd71837, u8 reg)
+{
+ int r, val;
+
+ r = regmap_read(bd71837->regmap, reg, &val);
+ if (r < 0)
+ return r;
+ return val;
+}
+
+static inline int bd71837_reg_write(struct bd71837 *bd71837, u8 reg,
+ unsigned int val)
+{
+ return regmap_write(bd71837->regmap, reg, val);
+}
+
+static inline int bd71837_set_bits(struct bd71837 *bd71837, u8 reg, u8 mask)
+{
+ return regmap_update_bits(bd71837->regmap, reg, mask, mask);
+}
+
+static inline int bd71837_clear_bits(struct bd71837 *bd71837, u8 reg,
+ u8 mask)
+{
+ return regmap_update_bits(bd71837->regmap, reg, mask, 0);
+}
+
+static inline int bd71837_update_bits(struct bd71837 *bd71837, u8 reg,
+ u8 mask, u8 val)
+{
+ return regmap_update_bits(bd71837->regmap, reg, mask, val);
+}
+
+#endif /* __LINUX_MFD_BD71837_H__ */
--
2.14.3
^ permalink raw reply related
* [PATCH v8 0/2] mfd/regulator/clk/input: bd71837: ROHM BD71837 PMIC driver
From: Matti Vaittinen @ 2018-06-29 8:20 UTC (permalink / raw)
To: mturquette, robh+dt, mark.rutland, lee.jones, lgirdwood, broonie,
mazziesaccount, arnd, dmitry.torokhov, sre, chenjh,
andrew.smirnov, linus.walleij, kstewart, heiko, gregkh
Cc: sboyd, linux-clk, devicetree, linux-kernel, linux-input,
mikko.mutanen, heikki.haikola
Patch series adding support for ROHM BD71837 PMIC.
BD71837 is a programmable Power Management IC for powering single-core,
dual-core, and quad-core SoC’s such as NXP-i.MX 8M. It is optimized for
low BOM cost and compact solution footprint. It integrates 8 buck
regulators and 7 LDO’s to provide all the power rails required by the
SoC and the commonly used peripherals.
This is reduced set of patches containing only the MFD and devicetree
bindings. Devicetree bindings patch (2) is not changed. The MFD patch
enables alrady applied regulator part and power button support using
gpio-keys. Clock and reset support will be sent as separate set of
patches - possibly only after my vacations. Sorry for longish delay
which will follow.
Changelog v8
- Dropped clk-bd71837 from series (will send later)
- Patch 2 is unchanged.
- Dropped bd718xx-pwrkey driver and used gpio_keys instead.
- Added power-button short/long press duration configuratio to MFD
- Cleaned MFD driver according to comments from Enric Balletbo Serra.
(used devm, removed unnecessary header inclusions, removed redundant
assignment, styling issues, allow building MFD part as module, fixed
license mismatch).
Changelog v7
- patch 1: Cleaned MFD probe since MFD no longer directly reads DT
properties.
- patch 1/4: Moved power-key related definitions from powerkey patch (4)
to MFD patch (1) so that powerkey can be applied independently
- Patch 2 is unchanged.
- patch 3: Added missing allocation check back to clk probe
Changelog v6
- Added power-key input driver
Based on feedback from Rob Herring and Stephen Boyd
- Added link to datasheet
- Removed interrupt-controller from DT and fixed binding document
- clk styling fixes
- remove clkdev usage
- add clk bindings to MFD documentation
- removed clk binding document
Changelog v5
- dropped regulator patches which are already applied to Mark's tree
Based on feedback from Rob Herring and Stephen Boyd
- mfd bindings: explain why this can be interrupt-controller
- mfd bindings: describe interrupts better
- mfd bindings: require one cell interrupt specifier
- mfd bindings: use generic node names in example
- mfd driver: ack masked interrupt once at init
- clk bindings: use generic node names in example
- clk driver: use devm
- clk driver: use of_clk_add_hw_provider
- clk driver: change severity of print and how prints are emitted at
probe error path.
- clk driver: dropped forward declared functions
- clk configs: drop unnecessary dependencies
- clk driver: other styling issues
- mfd/clk DT: drop clk node.
Changelog v4
- remove mutex from regulator state check as core prevents simultaneous
accesses
- allow voltage change for bucks 1 to 4 when regulator is enabled
- fix indentiation problems
- properly correct SPDX comments
Changelog v3
- kill unused variable
- kill unused definitions
- use REGMAP_IRQ_REG
Changelog v2
Based on feedback from Mark Brown
- Squashed code and buildfile changes to same patch
- Fixed some styling issues
- Changed SPDX comments to CPP style
- Error out if voltage is changed when regulator is enabled instead of
Disabling the regulator for duration of change
- Use devm_regulator_register
- Remove compatible usage from regulators - use parent dev for config
- Add a note about using regulator-boot-on for BUCK6 and 7
- fixed warnings from kbuild test robot
patch 1:
MFD driver and definitions bringing interrupt support and
enabling clk, regulator and input subsystems.
patch 2:
MFD driver DT bindings
This patch series is based on for-mfd-next
---
Matti Vaittinen (2):
mfd: bd71837: mfd driver for ROHM BD71837 PMIC
mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC
.../devicetree/bindings/mfd/rohm,bd71837-pmic.txt | 67 ++++
drivers/mfd/Kconfig | 13 +
drivers/mfd/Makefile | 1 +
drivers/mfd/bd71837.c | 220 ++++++++++++
include/linux/mfd/bd71837.h | 391 +++++++++++++++++++++
5 files changed, 692 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
create mode 100644 drivers/mfd/bd71837.c
create mode 100644 include/linux/mfd/bd71837.h
--
2.14.3
^ permalink raw reply
* Re: [PATCH v4 23/26] devicetree: fix a series of wrong file references
From: Bjorn Helgaas @ 2018-06-28 13:53 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Doc Mailing List, Jonathan Corbet, Mauro Carvalho Chehab,
linux-kernel, Dmitry Torokhov, Rob Herring, Mark Rutland,
Lee Jones, Maxime Ripard, Chen-Yu Tsai, Zhou Wang, Bjorn Helgaas,
Xiaowei Song, Binghui Wang, Liam Girdwood, Mark Brown,
Maxime Coquelin, Alexandre Torgue, linux-input, devicetree
In-Reply-To: <266e5f874b36aa83f3327879d85921fab52d5461.1529079120.git.mchehab+samsung@kernel.org>
On Fri, Jun 15, 2018 at 01:30:51PM -0300, Mauro Carvalho Chehab wrote:
> As files got renamed, their references broke.
>
> Manually fix a series of broken refs at the DT bindings.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Thanks for fixing these!
> ---
> .../devicetree/bindings/input/rmi4/rmi_2d_sensor.txt | 2 +-
> Documentation/devicetree/bindings/mfd/sun6i-prcm.txt | 2 +-
> .../devicetree/bindings/pci/hisilicon-pcie.txt | 2 +-
> Documentation/devicetree/bindings/pci/kirin-pcie.txt | 2 +-
> .../devicetree/bindings/pci/pci-keystone.txt | 4 ++--
> .../devicetree/bindings/sound/st,stm32-i2s.txt | 2 +-
> .../devicetree/bindings/sound/st,stm32-sai.txt | 2 +-
> MAINTAINERS | 12 ++++++------
> 8 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txt b/Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txt
> index f2c30c8b725d..9afffbdf6e28 100644
> --- a/Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txt
> +++ b/Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txt
> @@ -12,7 +12,7 @@ Additional documentation for F11 can be found at:
> http://www.synaptics.com/sites/default/files/511-000136-01-Rev-E-RMI4-Interfacing-Guide.pdf
>
> Optional Touch Properties:
> -Description in Documentation/devicetree/bindings/input/touch
> +Description in Documentation/devicetree/bindings/input/touchscreen
> - touchscreen-inverted-x
> - touchscreen-inverted-y
> - touchscreen-swapped-x-y
> diff --git a/Documentation/devicetree/bindings/mfd/sun6i-prcm.txt b/Documentation/devicetree/bindings/mfd/sun6i-prcm.txt
> index 4d21ffdb0fc1..daa091c2e67b 100644
> --- a/Documentation/devicetree/bindings/mfd/sun6i-prcm.txt
> +++ b/Documentation/devicetree/bindings/mfd/sun6i-prcm.txt
> @@ -8,7 +8,7 @@ Required properties:
> - reg: The PRCM registers range
>
> The prcm node may contain several subdevices definitions:
> - - see Documentation/devicetree/clk/sunxi.txt for clock devices
> + - see Documentation/devicetree/bindings/clock/sunxi.txt for clock devices
> - see Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt for reset
> controller devices
>
> diff --git a/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt b/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
> index 7bf9df047a1e..0dcb87d6554f 100644
> --- a/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
> +++ b/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
> @@ -3,7 +3,7 @@ HiSilicon Hip05 and Hip06 PCIe host bridge DT description
> HiSilicon PCIe host controller is based on the Synopsys DesignWare PCI core.
> It shares common functions with the PCIe DesignWare core driver and inherits
> common properties defined in
> -Documentation/devicetree/bindings/pci/designware-pci.txt.
> +Documentation/devicetree/bindings/pci/designware-pcie.txt.
>
> Additional properties are described here:
>
> diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> index 6e217c63123d..6bbe43818ad5 100644
> --- a/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> +++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> @@ -3,7 +3,7 @@ HiSilicon Kirin SoCs PCIe host DT description
> Kirin PCIe host controller is based on the Synopsys DesignWare PCI core.
> It shares common functions with the PCIe DesignWare core driver and
> inherits common properties defined in
> -Documentation/devicetree/bindings/pci/designware-pci.txt.
> +Documentation/devicetree/bindings/pci/designware-pcie.txt.
>
> Additional properties are described here:
>
> diff --git a/Documentation/devicetree/bindings/pci/pci-keystone.txt b/Documentation/devicetree/bindings/pci/pci-keystone.txt
> index 7e05487544ed..3d4a209b0fd0 100644
> --- a/Documentation/devicetree/bindings/pci/pci-keystone.txt
> +++ b/Documentation/devicetree/bindings/pci/pci-keystone.txt
> @@ -3,9 +3,9 @@ TI Keystone PCIe interface
> Keystone PCI host Controller is based on the Synopsys DesignWare PCI
> hardware version 3.65. It shares common functions with the PCIe DesignWare
> core driver and inherits common properties defined in
> -Documentation/devicetree/bindings/pci/designware-pci.txt
> +Documentation/devicetree/bindings/pci/designware-pcie.txt
>
> -Please refer to Documentation/devicetree/bindings/pci/designware-pci.txt
> +Please refer to Documentation/devicetree/bindings/pci/designware-pcie.txt
> for the details of DesignWare DT bindings. Additional properties are
> described here as well as properties that are not applicable.
>
> diff --git a/Documentation/devicetree/bindings/sound/st,stm32-i2s.txt b/Documentation/devicetree/bindings/sound/st,stm32-i2s.txt
> index 4bda52042402..58c341300552 100644
> --- a/Documentation/devicetree/bindings/sound/st,stm32-i2s.txt
> +++ b/Documentation/devicetree/bindings/sound/st,stm32-i2s.txt
> @@ -18,7 +18,7 @@ Required properties:
> See Documentation/devicetree/bindings/dma/stm32-dma.txt.
> - dma-names: Identifier for each DMA request line. Must be "tx" and "rx".
> - pinctrl-names: should contain only value "default"
> - - pinctrl-0: see Documentation/devicetree/bindings/pinctrl/pinctrl-stm32.txt
> + - pinctrl-0: see Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.txt
>
> Optional properties:
> - resets: Reference to a reset controller asserting the reset controller
> diff --git a/Documentation/devicetree/bindings/sound/st,stm32-sai.txt b/Documentation/devicetree/bindings/sound/st,stm32-sai.txt
> index f301cdf0b7e6..3a3fc506e43a 100644
> --- a/Documentation/devicetree/bindings/sound/st,stm32-sai.txt
> +++ b/Documentation/devicetree/bindings/sound/st,stm32-sai.txt
> @@ -37,7 +37,7 @@ SAI subnodes required properties:
> "tx": if sai sub-block is configured as playback DAI
> "rx": if sai sub-block is configured as capture DAI
> - pinctrl-names: should contain only value "default"
> - - pinctrl-0: see Documentation/devicetree/bindings/pinctrl/pinctrl-stm32.txt
> + - pinctrl-0: see Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.txt
>
> SAI subnodes Optional properties:
> - st,sync: specify synchronization mode.
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 783ce44b3e7a..fd3fc63f2759 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -6966,7 +6966,7 @@ IIO MULTIPLEXER
> M: Peter Rosin <peda@axentia.se>
> L: linux-iio@vger.kernel.org
> S: Maintained
> -F: Documentation/devicetree/bindings/iio/multiplexer/iio-mux.txt
> +F: Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt
> F: drivers/iio/multiplexer/iio-mux.c
>
> IIO SUBSYSTEM AND DRIVERS
> @@ -9696,7 +9696,7 @@ MXSFB DRM DRIVER
> M: Marek Vasut <marex@denx.de>
> S: Supported
> F: drivers/gpu/drm/mxsfb/
> -F: Documentation/devicetree/bindings/display/mxsfb-drm.txt
> +F: Documentation/devicetree/bindings/display/mxsfb.txt
>
> MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
> M: Chris Lee <christopher.lee@cspi.com>
> @@ -10885,7 +10885,7 @@ M: Will Deacon <will.deacon@arm.com>
> L: linux-pci@vger.kernel.org
> L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
> S: Maintained
> -F: Documentation/devicetree/bindings/pci/controller-generic-pci.txt
> +F: Documentation/devicetree/bindings/pci/host-generic-pci.txt
> F: drivers/pci/controller/pci-host-common.c
> F: drivers/pci/controller/pci-host-generic.c
>
> @@ -11066,7 +11066,7 @@ M: Xiaowei Song <songxiaowei@hisilicon.com>
> M: Binghui Wang <wangbinghui@hisilicon.com>
> L: linux-pci@vger.kernel.org
> S: Maintained
> -F: Documentation/devicetree/bindings/pci/pcie-kirin.txt
> +F: Documentation/devicetree/bindings/pci/kirin-pcie.txt
> F: drivers/pci/controller/dwc/pcie-kirin.c
>
> PCIE DRIVER FOR HISILICON STB
> @@ -12457,7 +12457,7 @@ L: linux-crypto@vger.kernel.org
> L: linux-samsung-soc@vger.kernel.org
> S: Maintained
> F: drivers/crypto/exynos-rng.c
> -F: Documentation/devicetree/bindings/crypto/samsung,exynos-rng4.txt
> +F: Documentation/devicetree/bindings/rng/samsung,exynos4-rng.txt
>
> SAMSUNG EXYNOS TRUE RANDOM NUMBER GENERATOR (TRNG) DRIVER
> M: Łukasz Stelmach <l.stelmach@samsung.com>
> @@ -13571,7 +13571,7 @@ F: drivers/*/stm32-*timer*
> F: drivers/pwm/pwm-stm32*
> F: include/linux/*/stm32-*tim*
> F: Documentation/ABI/testing/*timer-stm32
> -F: Documentation/devicetree/bindings/*/stm32-*timer
> +F: Documentation/devicetree/bindings/*/stm32-*timer*
> F: Documentation/devicetree/bindings/pwm/pwm-stm32*
>
> STMMAC ETHERNET DRIVER
> --
> 2.17.1
>
^ permalink raw reply
* [PATCH] input: gpio_keys: add missing include to gpio_keys.h
From: Matti Vaittinen @ 2018-06-27 7:34 UTC (permalink / raw)
To: dmitry.torokhov, robh, gregkh, tglx, jeffy.chen, matti.vaittinen
Cc: linux-kernel, linux-input
gpio_keys.h uses 'bool' - type which is defined in linux/types.h.
Include this header.
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
---
include/linux/gpio_keys.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 7160df54a6fe..3f84aeb81e48 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -2,6 +2,8 @@
#ifndef _GPIO_KEYS_H
#define _GPIO_KEYS_H
+#include <linux/types.h>
+
struct device;
/**
--
2.14.3
^ permalink raw reply related
* Re: [PATCH v3 12/12] HID: multitouch: handle palm for touchscreens
From: Peter Hutterer @ 2018-06-27 1:10 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Jiri Kosina, Dmitry Torokhov, Mario.Limonciello, linux-input,
linux-kernel
In-Reply-To: <20180621120908.16706-13-benjamin.tissoires@redhat.com>
On Thu, Jun 21, 2018 at 02:09:08PM +0200, Benjamin Tissoires wrote:
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
> Usually, there is no palm rejection for touchscreens. You don't rest
> your palm on the touchscreen while interacting with it.
> However, some wacom devices do so because you can rest your palm while
> interacting with the stylus.
>
> Unfortunately, the spec for touchscreens[1] is less precise than the one
> for touchpads[2]. This leads to a situation where it's 'legitimate'
> for a touchscreen to provide both tipswitch off and confidence off in the
> same report.
>
> Work around that by keeping the slot active for one frame where we report
> MT_TOOL_PALM, and then synthesizing the release event in a separate frame.
> frame
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> [rebased and new commit message]
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
to the series unless otherwise noted.
Cheers,
Peter
> ---
> changes in v2 (compared to Dmitry's initial submission):
> - extracted from the initial submission in a separate patch
> - rebased on top of my current series
> - add an extra input_mt_sync_frame(input); to release the single touch
> emulation
>
> no changes in v3
> ---
> drivers/hid/hid-multitouch.c | 52 +++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 51 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index 9c708aa261ee..3a1c2d80729b 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -118,6 +118,9 @@ struct mt_application {
> int left_button_state; /* left button state */
> unsigned int mt_flags; /* flags to pass to input-mt */
>
> + unsigned long *pending_palm_slots; /* slots where we reported palm
> + * and need to release */
> +
> __u8 num_received; /* how many contacts we received */
> __u8 num_expected; /* expected last contact index */
> __u8 buttons_count; /* number of physical buttons per touchpad */
> @@ -863,6 +866,28 @@ static int mt_compute_slot(struct mt_device *td, struct mt_application *app,
> return input_mt_get_slot_by_key(input, *slot->contactid);
> }
>
> +static void mt_release_pending_palms(struct mt_device *td,
> + struct mt_application *app,
> + struct input_dev *input)
> +{
> + int slotnum;
> + bool need_sync = false;
> +
> + for_each_set_bit(slotnum, app->pending_palm_slots, td->maxcontacts) {
> + clear_bit(slotnum, app->pending_palm_slots);
> +
> + input_mt_slot(input, slotnum);
> + input_mt_report_slot_state(input, MT_TOOL_PALM, false);
> +
> + need_sync = true;
> + }
> +
> + if (need_sync) {
> + input_mt_sync_frame(input);
> + input_sync(input);
> + }
> +}
> +
> /*
> * this function is called when a whole packet has been received and processed,
> * so that it can decide what to send to the input layer.
> @@ -876,6 +901,9 @@ static void mt_sync_frame(struct mt_device *td, struct mt_application *app,
> input_mt_sync_frame(input);
> input_event(input, EV_MSC, MSC_TIMESTAMP, app->timestamp);
> input_sync(input);
> +
> + mt_release_pending_palms(td, app, input);
> +
> app->num_received = 0;
> app->left_button_state = 0;
>
> @@ -970,8 +998,23 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input,
>
> if (app->application == HID_GD_SYSTEM_MULTIAXIS)
> tool = MT_TOOL_DIAL;
> - else if (unlikely(!confidence_state))
> + else if (unlikely(!confidence_state)) {
> tool = MT_TOOL_PALM;
> + if (!active &&
> + input_mt_is_active(&mt->slots[slotnum])) {
> + /*
> + * The non-confidence was reported for
> + * previously valid contact that is also no
> + * longer valid. We can't simply report
> + * lift-off as userspace will not be aware
> + * of non-confidence, so we need to split
> + * it into 2 events: active MT_TOOL_PALM
> + * and a separate liftoff.
> + */
> + active = true;
> + set_bit(slotnum, app->pending_palm_slots);
> + }
> + }
>
> input_mt_slot(input, slotnum);
> input_mt_report_slot_state(input, tool, active);
> @@ -1206,6 +1249,13 @@ static int mt_touch_input_configured(struct hid_device *hdev,
> if (td->is_buttonpad)
> __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
>
> + app->pending_palm_slots = devm_kcalloc(&hi->input->dev,
> + BITS_TO_LONGS(td->maxcontacts),
> + sizeof(long),
> + GFP_KERNEL);
> + if (!app->pending_palm_slots)
> + return -ENOMEM;
> +
> ret = input_mt_init_slots(input, td->maxcontacts, app->mt_flags);
> if (ret)
> return ret;
> --
> 2.14.3
>
^ permalink raw reply
* Re: [PATCH v3 10/12] HID: multitouch: report MT_TOOL_PALM for non-confident touches
From: Peter Hutterer @ 2018-06-27 1:08 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Jiri Kosina, Dmitry Torokhov, Mario.Limonciello, linux-input,
linux-kernel
In-Reply-To: <20180621120908.16706-11-benjamin.tissoires@redhat.com>
On Thu, Jun 21, 2018 at 02:09:06PM +0200, Benjamin Tissoires wrote:
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
> According to Microsoft specification [1] for Precision Touchpads (and
> Touchscreens) the devices use "confidence" reports to signal accidental
> touches, or contacts that are "too large to be a finger". Instead of
> simply marking contact inactive in this case (which causes issues if
> contact was originally proper and we lost confidence in it later, as
> this results in accidental clicks, drags, etc), let's report such
> contacts as MT_TOOL_PALM and let userspace decide what to do.
> Additionally, let's report contact size for such touches as maximum
> allowed for major/minor, which should help userspace that is not yet
> aware of MT_TOOL_PALM to still perform palm rejection.
tbh. I have a queasy feeling about this last bit. MT_TOOL_PALM has shown to
not be reliable on some devices (X1 Carbon 6th) and we mask it out on those.
Changing the major/minor means it's impossible to rely on the touch size for
palm detection once a device supports MT_TOOL_PALM.
Cheers,
Peter
>
> [1] https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/touchpad-windows-precision-touchpad-collection
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> [splitted and rebased]
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>
> ---
>
> changes in v2:
> - dropped the delayed release in case of palm detection. This is
> a FW bug for PTP devices, and should only happen with touchscreens
> - move input_set_abs_params(hi->input, ABS_MT_TOOL_TYPE,...) into
> its own test so other devices can add MT_QUIRK_CONFIDENCE to their
> quirks.
>
> no changes in v3
> ---
> drivers/hid/hid-multitouch.c | 30 ++++++++++++++++++++++++------
> 1 file changed, 24 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index a4a274ebfbef..36c8b67bb032 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -736,6 +736,13 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
> cls->name == MT_CLS_WIN_8_DUAL) &&
> field->application == HID_DG_TOUCHPAD)
> app->quirks |= MT_QUIRK_CONFIDENCE;
> +
> + if (app->quirks & MT_QUIRK_CONFIDENCE)
> + input_set_abs_params(hi->input,
> + ABS_MT_TOOL_TYPE,
> + MT_TOOL_FINGER,
> + MT_TOOL_PALM, 0, 0);
> +
> MT_STORE_FIELD(confidence_state);
> return 1;
> case HID_DG_TIPSWITCH:
> @@ -958,10 +965,12 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input,
> if (quirks & MT_QUIRK_HOVERING)
> inrange_state = *slot->inrange_state;
>
> - active = (*slot->tip_state || inrange_state) && confidence_state;
> + active = *slot->tip_state || inrange_state;
>
> if (app->application == HID_GD_SYSTEM_MULTIAXIS)
> tool = MT_TOOL_DIAL;
> + else if (unlikely(!confidence_state))
> + tool = MT_TOOL_PALM;
>
> input_mt_slot(input, slotnum);
> input_mt_report_slot_state(input, tool, active);
> @@ -993,11 +1002,20 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input,
> orientation = -azimuth;
> }
>
> - /*
> - * divided by two to match visual scale of touch
> - * for devices with this quirk
> - */
> - if (quirks & MT_QUIRK_TOUCH_SIZE_SCALING) {
> + if (unlikely(!confidence_state)) {
> + /*
> + * When reporting palm, set contact to maximum
> + * size to help userspace that does not
> + * recognize MT_TOOL_PALM to reject contacts
> + * that are too large.
> + */
> + major = input_abs_get_max(input, ABS_MT_TOUCH_MAJOR);
> + minor = input_abs_get_max(input, ABS_MT_TOUCH_MINOR);
> + } else if (quirks & MT_QUIRK_TOUCH_SIZE_SCALING) {
> + /*
> + * divided by two to match visual scale of touch
> + * for devices with this quirk
> + */
> major = major >> 1;
> minor = minor >> 1;
> }
> --
> 2.14.3
>
^ permalink raw reply
* Re: [PATCH v3 01/12] input: add MT_TOOL_DIAL
From: Peter Hutterer @ 2018-06-27 0:54 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Jiri Kosina, Dmitry Torokhov, Mario.Limonciello, linux-input,
linux-kernel
In-Reply-To: <20180621120908.16706-2-benjamin.tissoires@redhat.com>
On Thu, Jun 21, 2018 at 02:08:57PM +0200, Benjamin Tissoires wrote:
> A dial is a tool you place on a multitouch surface which reports its
> orientation or a relative angle of rotation when rotating its knob.
>
> Some examples are the Dell Totem (on the Canvas 27"), the Microsoft Dial,
> or the Griffin Powermate, though the later can't be put on a touch surface.
>
> We give some extra space to account for other types of fingers if we need
> (MT_TOOL_THUMB)
>
> Slightly change the documentation to not make it mandatory to update each
> MT_TOOL we add.
>
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>
> ---
>
> new in v2 (extracted from previous series in its own patch)
>
> changes in v3:
> - re-insert the change in include/uapi/linux/input.h
> ---
> Documentation/input/multi-touch-protocol.rst | 12 ++++++------
> include/uapi/linux/input.h | 3 ++-
> 2 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/input/multi-touch-protocol.rst b/Documentation/input/multi-touch-protocol.rst
> index b51751a0cd5d..6be70342e709 100644
> --- a/Documentation/input/multi-touch-protocol.rst
> +++ b/Documentation/input/multi-touch-protocol.rst
> @@ -310,12 +310,12 @@ ABS_MT_TOOL_Y
> ABS_MT_TOOL_TYPE
> The type of approaching tool. A lot of kernel drivers cannot distinguish
> between different tool types, such as a finger or a pen. In such cases, the
> - event should be omitted. The protocol currently supports MT_TOOL_FINGER,
> - MT_TOOL_PEN, and MT_TOOL_PALM [#f2]_. For type B devices, this event is
> - handled by input core; drivers should instead use
> - input_mt_report_slot_state(). A contact's ABS_MT_TOOL_TYPE may change over
> - time while still touching the device, because the firmware may not be able
> - to determine which tool is being used when it first appears.
> + event should be omitted. The protocol currently mainly supports
> + MT_TOOL_FINGER, MT_TOOL_PEN, and MT_TOOL_PALM [#f2]_.
> + For type B devices, this event is handled by input core; drivers should
> + instead use input_mt_report_slot_state(). A contact's ABS_MT_TOOL_TYPE may
> + change over time while still touching the device, because the firmware may
> + not be able to determine which tool is being used when it first appears.
>
> ABS_MT_BLOB_ID
> The BLOB_ID groups several packets together into one arbitrarily shaped
> diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
> index 7288a7c573cc..e931b0468b6d 100644
> --- a/include/uapi/linux/input.h
> +++ b/include/uapi/linux/input.h
> @@ -273,7 +273,8 @@ struct input_mask {
> #define MT_TOOL_FINGER 0
> #define MT_TOOL_PEN 1
> #define MT_TOOL_PALM 2
> -#define MT_TOOL_MAX 2
> +#define MT_TOOL_DIAL 10
> +#define MT_TOOL_MAX 10
sorry for the late comment here: I'd prefer MAX to be greater than the
actually used highest value. This isn't strictly technically necessary
because tools *should* be able to deal with FOO == MAX but there are some
corner-cases that get more quirky. e.g. converting the string "SW_MAX" to
value is 0xf, but 0xf to name is "SW_PEN_INSERTED". Compare that to
"REL_MAX" -> 0xf -> "REL_MAX".
I know this case needs to be handled etc but not having max as an already
used value papers over some of the quirks needed.
Either way, Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Cheers,
Peter
>
> /*
> * Values describing the status of a force-feedback effect
> --
> 2.14.3
>
^ permalink raw reply
* Re: [PATCH v7 4/4] input/power: Add driver for BD71837/BD71847 PMIC power button
From: Dmitry Torokhov @ 2018-06-27 0:21 UTC (permalink / raw)
To: Matti Vaittinen
Cc: mturquette, sboyd, robh+dt, mark.rutland, lee.jones, lgirdwood,
broonie, mazziesaccount, arnd, sre, chenjh, andrew.smirnov,
linus.walleij, kstewart, heiko, gregkh, linux-clk, devicetree,
linux-kernel, linux-input, mikko.mutanen, heikki.haikola
In-Reply-To: <20180621102547.GA6076@localhost.localdomain>
Hi Matti,
On Thu, Jun 21, 2018 at 01:25:47PM +0300, Matti Vaittinen wrote:
> On Wed, Jun 20, 2018 at 09:43:16AM +0300, Matti Vaittinen wrote:
> > On Tue, Jun 19, 2018 at 10:50:28AM -0700, Dmitry Torokhov wrote:
> > > Hi Matti,
> > >
> > > On Tue, Jun 19, 2018 at 01:57:09PM +0300, Matti Vaittinen wrote:
> > > > ROHM BD71837 PMIC power button driver providing power-key press
> > > > information to user-space.
> > > >
> > > > Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> > > > ---
> > > > drivers/input/misc/Kconfig | 10 +++++
> > > > drivers/input/misc/Makefile | 1 +
> > > > drivers/input/misc/bd718xx-pwrkey.c | 90 +++++++++++++++++++++++++++++++++++++
> > > > 3 files changed, 101 insertions(+)
> > > > create mode 100644 drivers/input/misc/bd718xx-pwrkey.c
> > > >
> > > > + platform_set_drvdata(pdev, pk);
> > > > + err = regmap_update_bits(pk->mfd->regmap,
> > > > + BD71837_REG_PWRONCONFIG0,
> > > > + BD718XX_PWRBTN_SHORT_PRESS_MASK,
> > > > + BD718XX_PWRBTN_SHORT_PRESS_10MS);
> > >
> > > This seems to be the only custom bit of set up in the driver, the rest I
> > > think can easily be handled by gpio-keys.c in interrupt-only mode. Maybe
> > > we could move this into MFD piece and drop this driver?
>
> I did following in MFD driver - is this what you suggested:
> +static struct gpio_keys_button btns[] = {
> + {
> + .code = KEY_POWER,
> + .gpio = -1,
> + .type = EV_KEY,
> + },
> +};
> +
> +static struct gpio_keys_platform_data bd718xx_powerkey_data = {
> + .buttons = &btns[0],
> + .nbuttons = ARRAY_SIZE(btns),
> + .name = "bd718xx-pwrkey",
> +};
> +
> +/* bd71837 multi function cells */
> +
> +static struct mfd_cell bd71837_mfd_cells[] = {
> + {
> + .name = "bd71837-clk",
> + }, {
> + .name = "gpio-keys",
> + .platform_data = &bd718xx_powerkey_data,
> + .pdata_size = sizeof(bd718xx_powerkey_data),
> + }, {
Yes, something like this should work. It will not expose the internal
kernel structure (the fact that we are using gpio-keys dirver) to handle
power button of this PMIC, which Rob would appreciate. And we can change
it later if you want to create a fancier driver.
>
> //snip
>
> +static int bd71837_i2c_probe(struct i2c_client *i2c,
> + const struct i2c_device_id *id)
> +{
>
> // snip
>
> + ret = regmap_add_irq_chip(bd71837->regmap, bd71837->chip_irq,
> + IRQF_ONESHOT, 0,
> + &bd71837_irq_chip, &bd71837->irq_data);
> + if (ret < 0) {
> + dev_err(bd71837->dev, "Failed to add irq_chip %d\n", ret);
> + goto err_out;
> + }
> + /* I think this should be done conditionally and only when pwrkey is used
> + * What would be the correct way to decide if we want to touch rhw button
> + * press detection times?
> + */
> + ret = regmap_update_bits(bd71837->regmap,
> + BD71837_REG_PWRONCONFIG0,
> + BD718XX_PWRBTN_PRESS_DURATION_MASK,
> + BD718XX_PWRBTN_SHORT_PRESS_10MS);
> + if (ret < 0) {
> + dev_err(bd71837->dev, "Failed to configure button short press timeout %d\n", ret);
> + goto err_out;
> + }
> + /* According to BD71847 datasheet the HW default for long press detection
> + * is 10ms. So letch change it to 10 sec so we can actually get the short
> + * push and allow gracefull shut down
> + */
> + ret = regmap_update_bits(bd71837->regmap,
> + BD71837_REG_PWRONCONFIG1,
> + BD718XX_PWRBTN_PRESS_DURATION_MASK,
> + BD718XX_PWRBTN_LONG_PRESS_10S);
> + if (ret < 0) {
> + dev_err(bd71837->dev, "Failed to configure button long press timeout %d\n", ret);
> + goto err_out;
> + }
> + btns[0].irq = regmap_irq_get_virq(bd71837->irq_data,
> + BD71837_INT_PWRBTN_S);
> +
> + if (btns[0].irq < 0) {
> + ret = btns[0].irq;
> + goto err_out;
> + }
> +
> + ret = mfd_add_devices(bd71837->dev, PLATFORM_DEVID_AUTO,
> + bd71837_mfd_cells, ARRAY_SIZE(bd71837_mfd_cells),
> + NULL, 0,
> + regmap_irq_get_domain(bd71837->irq_data));
>
> If looks is Ok I will send new patch with this approach at next week -
> unless I get lost during the traditional midsummer festival here in
> Finland.
>
> > Finally, there may be cases when power button is not attached to PMIC
> > or is needing different configuration for 'short push'. This is why I
> > would prefer having own Kconfig option for this power-key driver. I am
> > not sure if it is easily doable if we use gpio_keys?
>
> What would be the preferred mechanism for skipping the button push duration
> configurations (time it takes for PMIC to detect short or long push)? Or
> setting the durations to values user(s) would prefer? To me this sounds again
> something we could configure from DT. Would adding propereties
> rohm,short-press-ms and rohm,long-press-ms sound reasonable? I will send
> the first version with no option to skip/specify the configuration
> (fixed 10ms for short press, 10 sec for long press) but I would like to add
> support for specifying the duration as next step.
This sounds OK to be but you'd need to get Rob's buy in here. The
properties should probably be in a sub-node of the PMIC device node.
Thanks.
--
Dmitry
^ permalink raw reply
* [git pull] Input updates for v4.18-rc2
From: Dmitry Torokhov @ 2018-06-26 23:32 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-input
Hi Linus,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
to receive updates for the input subsystem:
- the main change is a fix for my brain-dead patch to PS/2 button
reporting for some protocols that made it in 4.17
- there is a new driver for Spreadtum vibrator that I intended to send
during merge window but ended up not sending the 2nd pull request.
Given that this is a brand new driver we should not see regressions
here
- a fixup to Elantech PS/2 driver to avoid decoding errors on Thinkpad
P52
- addition of few more ACPI IDs for Silead and Elan drivers
- RMI4 is switched to using IRQ domain code instead of rolling its own
implementation
Changelog:
---------
??? (1):
Input: elantech - fix V4 report decoding for module with middle key
Aaron Ma (1):
Input: elantech - enable middle button of touchpads on ThinkPad P52
Alexandr Savca (1):
Input: elan_i2c - add ELAN0618 (Lenovo v330 15IKB) ACPI ID
Ben Hutchings (1):
Input: elan_i2c_smbus - fix more potential stack buffer overflows
Dmitry Torokhov (3):
Input: make input_report_slot_state() return boolean
Input: do not assign new tracking ID when changing tool type
Input: psmouse - fix button reporting for basic protocols
Enno Boland (1):
Input: xpad - fix GPD Win 2 controller name
Hans de Goede (1):
Input: silead - add MSSL0002 ACPI HID
Lucas Stach (1):
Input: synaptics-rmi4 - fix axis-swap behavior
Nick Dyer (1):
Input: synaptics-rmi4 - convert irq distribution to irq_domain
Roman Kiryanov (1):
Input: goldfish_events - fix checkpatch warnings
Wei Yongjun (1):
Input: synaptics-rmi4 - fix the error return code in rmi_probe_interrupts()
Xiaotong Lu (1):
Input: add Spreadtrum vibrator driver
Diffstat:
--------
.../bindings/input/sprd,sc27xx-vibra.txt | 23 +++
drivers/input/input-mt.c | 12 +-
drivers/input/joystick/xpad.c | 2 +-
drivers/input/keyboard/goldfish_events.c | 9 +-
drivers/input/misc/Kconfig | 10 ++
drivers/input/misc/Makefile | 1 +
drivers/input/misc/sc27xx-vibra.c | 154 +++++++++++++++++++++
drivers/input/mouse/elan_i2c.h | 2 +
drivers/input/mouse/elan_i2c_core.c | 3 +-
drivers/input/mouse/elan_i2c_smbus.c | 10 +-
drivers/input/mouse/elantech.c | 11 +-
drivers/input/mouse/psmouse-base.c | 12 +-
drivers/input/rmi4/Kconfig | 1 +
drivers/input/rmi4/rmi_2d_sensor.c | 34 +++--
drivers/input/rmi4/rmi_bus.c | 50 ++++++-
drivers/input/rmi4/rmi_bus.h | 10 +-
drivers/input/rmi4/rmi_driver.c | 52 +++----
drivers/input/rmi4/rmi_f01.c | 10 +-
drivers/input/rmi4/rmi_f03.c | 9 +-
drivers/input/rmi4/rmi_f11.c | 42 +++---
drivers/input/rmi4/rmi_f12.c | 8 +-
drivers/input/rmi4/rmi_f30.c | 9 +-
drivers/input/rmi4/rmi_f34.c | 5 +-
drivers/input/rmi4/rmi_f54.c | 6 -
drivers/input/touchscreen/silead.c | 1 +
include/linux/input/mt.h | 2 +-
include/linux/rmi.h | 2 +
27 files changed, 366 insertions(+), 124 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/sprd,sc27xx-vibra.txt
create mode 100644 drivers/input/misc/sc27xx-vibra.c
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH] dt-bindings: Fix unbalanced quotation marks
From: Rob Herring @ 2018-06-26 20:19 UTC (permalink / raw)
To: Jonathan Neuschäfer
Cc: devicetree, Kukjin Kim, Krzysztof Kozlowski, Mark Rutland,
Linus Walleij, Dmitry Torokhov, Thomas Gleixner, Jason Cooper,
Marc Zyngier, Thierry Reding, Jonathan Hunter, Maxime Coquelin,
Alexandre Torgue, Hauke Mehrtens, Rafał Miłecki,
Ralf Baechle, Paul Burton, James Hogan, Madalin Bucur
In-Reply-To: <20180617143127.11421-1-j.neuschaefer@gmx.net>
On Sun, Jun 17, 2018 at 04:31:18PM +0200, Jonathan Neuschäfer wrote:
> Multiple binding documents have various forms of unbalanced quotation
> marks. Fix them.
>
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> ---
>
> Should I split this patch so that different parts can go through different trees?
No, I applied it. Thanks.
> ---
> .../devicetree/bindings/arm/samsung/samsung-boards.txt | 2 +-
> .../devicetree/bindings/gpio/nintendo,hollywood-gpio.txt | 2 +-
> Documentation/devicetree/bindings/input/touchscreen/hideep.txt | 2 +-
> .../bindings/interrupt-controller/nvidia,tegra20-ictlr.txt | 2 +-
> .../devicetree/bindings/interrupt-controller/st,stm32-exti.txt | 2 +-
> Documentation/devicetree/bindings/mips/brcm/soc.txt | 2 +-
> Documentation/devicetree/bindings/net/fsl-fman.txt | 2 +-
> Documentation/devicetree/bindings/power/power_domain.txt | 2 +-
> Documentation/devicetree/bindings/regulator/tps65090.txt | 2 +-
> Documentation/devicetree/bindings/reset/st,sti-softreset.txt | 2 +-
> Documentation/devicetree/bindings/sound/qcom,apq8016-sbc.txt | 2 +-
> Documentation/devicetree/bindings/sound/qcom,apq8096.txt | 2 +-
> 12 files changed, 12 insertions(+), 12 deletions(-)
^ permalink raw reply
* Re: [PATCH v7 1/4] mfd: bd71837: mfd driver for ROHM BD71837 PMIC
From: Enric Balletbo Serra @ 2018-06-26 14:24 UTC (permalink / raw)
To: matti.vaittinen
Cc: Michael Turquette, sboyd, Rob Herring, Mark Rutland, Lee Jones,
Liam Girdwood, Mark Brown, Matti Vaittinen, Arnd Bergmann,
Dmitry Torokhov, Sebastian Reichel, chenjh, Andrey Smirnov,
Linus Walleij, Kate Stewart, Heiko Stübner,
Greg Kroah-Hartman, linux-clk, devicetree@vger.kernel.org,
linux-kernel
In-Reply-To: <20180626120306.GD2118@localhost.localdomain>
Hi Matti,
Missatge de Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> del
dia dt., 26 de juny 2018 a les 14:03:
>
> Hello Again Eric,
>
> On Tue, Jun 26, 2018 at 01:40:40PM +0200, Enric Balletbo Serra wrote:
> > Hi Matti,
> > Missatge de Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> del
> > dia dt., 26 de juny 2018 a les 13:25:
> > > On Tue, Jun 26, 2018 at 11:06:33AM +0200, Enric Balletbo Serra wrote:
> > > > Missatge de Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> del
> > > > dia dt., 19 de juny 2018 a les 12:57:
> > >
> > > > > +static const struct of_device_id bd71837_of_match[] = {
> > > > > + { .compatible = "rohm,bd71837", .data = (void *)0},
> > > > > + { },
> > > >
> > > > nit: { /* sentinel */ }
> > >
> > > I am sorry but I didn't quite get the point here. Could you please
> > > explain what did you expect to be added here?
> > >
> >
> > It's a nit but It is a good practice to specify that the last entry is
> > a sentinel. Just this.
> >
> > +static const struct of_device_id bd71837_of_match[] = {
> > + { .compatible = "rohm,bd71837", .data = (void *)0},
> > + { /* sentinel */ }
> > +};
>
> Oh, I see. Finally something I can disagree =) I quickly opened few
> random drivers which declare match table. None of them practiced this
> good practice. So I guess it is not such a standard after all. And I
> guess the meaning of last entry in match table should be quite obvious.
> Adding the comment /* sentinel */ sounds like stating the obvious at
> best - at worst it gets one just to wonder what the "sentinel" means =)
>
git grep "/\* sentinel \*/"
Anyway, I marked this change as a nit, so you don't need to change. I
just commented because at some point I received a "complain" when I
didn't add it. But this is up to the maintainer and I am not sure if
the "complain" was received in this subsystem :)
Cheers,
Enric
> >
> > And just noticed, is .data = (void *)0 really required?
>
> As static structs should be initialized to zero I'd say it is not
> required. Will remove this. Thanks for pointing this out.
>
> Br,
> Matti Vaittinen
>
^ permalink raw reply
* Re: [PATCH v2 10/10] i2c: remove i2c_lock_adapter and use i2c_lock_bus directly
From: Sekhar Nori @ 2018-06-26 14:09 UTC (permalink / raw)
To: Peter Rosin, linux-kernel
Cc: Crt Mori, Wolfram Sang, linux-iio, Jarkko Sakkinen, linux-i2c,
Peter Meerwald-Stadler, Peter Huewe, Michael Krufky, Lee Jones,
Antti Palosaari, linux-samsung-soc, Florian Fainelli,
Kevin Hilman, Chunyan Zhang, Krzysztof Kozlowski, Jason Gunthorpe,
Kukjin Kim, bcm-kernel-feedback-list, linux-input, Orson Zhai,
Guenter Roeck, Haavard Skinnemoen, Arnd Bergmann, linux-media,
Lars-Peter Clausen, Grego
In-Reply-To: <20180620051803.12206-11-peda@axentia.se>
On Wednesday 20 June 2018 10:48 AM, Peter Rosin wrote:
> The i2c_lock_adapter name is ambiguous since it is unclear if it
> refers to the root adapter or the adapter you name in the argument.
> The natural interpretation is the adapter you name in the argument,
> but there are historical reasons for that not being the case; it
> in fact locks the root adapter. Just remove the function and force
> users to spell out the I2C_LOCK_ROOT_ADAPTER name to indicate what
> is really going on. Also remove i2c_unlock_adapter, of course.
>
> This patch was generated with
>
> git grep -l 'i2c_\(un\)\?lock_adapter' \
> | xargs sed -i 's/i2c_\(un\)\?lock_adapter(\([^)]*\))/'\
> 'i2c_\1lock_bus(\2, I2C_LOCK_ROOT_ADAPTER)/g'
>
> followed by white-space touch-up.
>
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
> drivers/i2c/busses/i2c-brcmstb.c | 8 ++++----
> drivers/i2c/busses/i2c-davinci.c | 4 ++--
On DM644x and DA850 EVMs applying this series does not seem to break I2C
functionality. So:
Tested-by: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
^ permalink raw reply
* Re: [PATCH v2 01/10] tpm/tpm_i2c_infineon: switch to i2c_lock_bus(..., I2C_LOCK_SEGMENT)
From: Jarkko Sakkinen @ 2018-06-26 12:07 UTC (permalink / raw)
To: Alexander Steffen, Peter Rosin
Cc: linux-kernel, Peter Huewe, Jason Gunthorpe, Arnd Bergmann,
Greg Kroah-Hartman, Brian Norris, Gregory Fong, Florian Fainelli,
bcm-kernel-feedback-list, Sekhar Nori, Kevin Hilman,
Haavard Skinnemoen, Kukjin Kim, Krzysztof Kozlowski, Orson Zhai,
Baolin Wang, Chunyan Zhang, Wolfram Sang, Guenter Roeck, Crt Mori,
Jonathan Cameron
In-Reply-To: <6169da633eab7e68d645e6b933b605dcc9ae09f1.camel@linux.intel.com>
On Tue, 2018-06-26 at 15:05 +0300, Jarkko Sakkinen wrote:
> On Tue, 2018-06-26 at 12:07 +0200, Alexander Steffen wrote:
> > On 25.06.2018 12:24, Jarkko Sakkinen wrote:
> > > On Wed, Jun 20, 2018 at 07:17:54AM +0200, Peter Rosin wrote:
> > > > Locking the root adapter for __i2c_transfer will deadlock if the
> > > > device sits behind a mux-locked I2C mux. Switch to the finer-grained
> > > > i2c_lock_bus with the I2C_LOCK_SEGMENT flag. If the device does not
> > > > sit behind a mux-locked mux, the two locking variants are equivalent.
> > > >
> > > > Signed-off-by: Peter Rosin <peda@axentia.se>
> > >
> > > Studied enough so that I can give
> > >
> > > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > >
> > > Do not have hardware to test this, however.
> >
> > I don't have a mux-locked I2C mux either, but at least I can confirm
> > that this change did not break my existing test setup (SLB9635/SLB9645
> > on Raspberry Pi 2B).
> >
> > Tested-by: Alexander Steffen <Alexander.Steffen@infineon.com>
> >
> > Alexander
>
> Given the scope of the change and since analogous change works for
> every other subsystem, this should be enough! Thank you.
It is now applied to my tree (master). I will move it to the
next branch once James has updated security/next-general.
/Jarkko
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox