Re: [PATCH 16/17] auxdisplay: ht16k33: Add support for segment displays

2021-03-29 Thread Robin van der Gracht

On 2021-03-29 09:15, Geert Uytterhoeven wrote:

Hoi Robin,

On Mon, Mar 29, 2021 at 9:09 AM Robin van der Gracht 
 wrote:

On 2021-03-22 15:48, Geert Uytterhoeven wrote:
> The Holtek HT16K33 LED controller is not only used for driving
> dot-matrix displays, but also for driving segment displays.
>
> Add support for 4-digit 7-segment and quad 14-segment alphanumeric
> displays, like the Adafruit 7-segment and 14-segment display backpack
> and FeatherWing expansion boards.  Use the character line display core
> support to display a message, which will be scrolled if it doesn't fit.
>
> Signed-off-by: Geert Uytterhoeven 
> ---
> The 7-segment support is based on schematics, and untested on actual
> hardware.
> ---
>  drivers/auxdisplay/ht16k33.c | 198 +--
>  1 file changed, 191 insertions(+), 7 deletions(-)
>
...
>
> +static int ht16k33_seg_probe(struct i2c_client *client,
> +  struct ht16k33_priv *priv, uint32_t brightness)
> +{
> + struct ht16k33_seg *seg = >seg;
> + struct device *dev = >dev;
> + int err;
> +
> + err = ht16k33_brightness_set(priv, MAX_BRIGHTNESS);
> + if (err)
> + return err;
> +
> + switch (priv->type) {
> + case DISP_MATRIX:
> + /* not handled here */
> + break;

This 'case' shouldn't happen. Having said that, the break here will
still
cause the linedisp_register() function to be called for the 
DISP_MATRIX

type.
If you'd like to handle this case, a return (or setting 'err') should
prevent this.


This function is never called if priv->type == DISP_MATRIX, so this
cannot happen.  However, gcc complains if not all enum values are
handled in a switch() statement, hence the dummy case.


I see. But if it's there it should work right? :P


Is there a better way to handle this?


How about adding the default case:

default:
/* not handled */
err = -EINVAL;

Groetjes/Kind regards,
Robin van der Gracht

--
Protonic Holland
Factorij 36
1689AL Zwaag
+31 (0)229 212928
https://www.protonic.nl


Re: [PATCH 16/17] auxdisplay: ht16k33: Add support for segment displays

2021-03-29 Thread Robin van der Gracht

Hello Geert,

On 2021-03-22 15:48, Geert Uytterhoeven wrote:

The Holtek HT16K33 LED controller is not only used for driving
dot-matrix displays, but also for driving segment displays.

Add support for 4-digit 7-segment and quad 14-segment alphanumeric
displays, like the Adafruit 7-segment and 14-segment display backpack
and FeatherWing expansion boards.  Use the character line display core
support to display a message, which will be scrolled if it doesn't fit.

Signed-off-by: Geert Uytterhoeven 
---
The 7-segment support is based on schematics, and untested on actual
hardware.
---
 drivers/auxdisplay/ht16k33.c | 198 +--
 1 file changed, 191 insertions(+), 7 deletions(-)


...


+static int ht16k33_seg_probe(struct i2c_client *client,
+struct ht16k33_priv *priv, uint32_t brightness)
+{
+   struct ht16k33_seg *seg = >seg;
+   struct device *dev = >dev;
+   int err;
+
+   err = ht16k33_brightness_set(priv, MAX_BRIGHTNESS);
+   if (err)
+   return err;
+
+   switch (priv->type) {
+   case DISP_MATRIX:
+   /* not handled here */
+   break;


This 'case' shouldn't happen. Having said that, the break here will 
still
cause the linedisp_register() function to be called for the DISP_MATRIX 
type.

If you'd like to handle this case, a return (or setting 'err') should
prevent this.


+
+   case DISP_QUAD_7SEG:
+   INIT_DELAYED_WORK(>work, ht16k33_seg7_update);
+   seg->map.seg7 = initial_map_seg7;
+   seg->map_size = sizeof(seg->map.seg7);
+   err = device_create_file(dev, _attr_map_seg7);
+   break;
+
+   case DISP_QUAD_14SEG:
+   INIT_DELAYED_WORK(>work, ht16k33_seg14_update);
+   seg->map.seg14 = initial_map_seg14;
+   seg->map_size = sizeof(seg->map.seg14);
+   err = device_create_file(dev, _attr_map_seg14);
+   break;
+   }
+   if (err)
+   return err;
+
+   err = linedisp_register(>linedisp, dev, 4, seg->curr,
+   ht16k33_linedisp_update);
+   if (err)
+   goto err_remove_map_file;
+
+   return 0;


Groetjes/Kind regards,
Robin van der Gracht


Re: [PATCH 17/17] auxdisplay: ht16k33: Add segment display LED support

2021-03-23 Thread Robin van der Gracht
3_priv *priv, uint32_t brightness)
 {
-   struct ht16k33_seg *seg = >seg;
struct device *dev = >dev;
+   struct device_node *node = dev->of_node;
+   struct ht16k33_seg *seg = >seg;
+   u32 color = COLOR_DEFAULT;
int err;

-   err = ht16k33_brightness_set(priv, MAX_BRIGHTNESS);
+   of_property_read_u32(node, "color", );
+   seg->led.name = devm_kasprintf(dev, GFP_KERNEL,
+   DRIVER_NAME ":%s:" LED_FUNCTION_BACKLIGHT,
+   color < LED_COLOR_ID_MAX ? led_colors[color] : "");
+   seg->led.brightness_set_blocking = ht16k33_brightness_set_blocking;
+   seg->led.blink_set = ht16k33_blink_set;
+   seg->led.flags = LED_CORE_SUSPENDRESUME;
+   seg->led.brightness = brightness;
+   seg->led.max_brightness = MAX_BRIGHTNESS;
+
+   err = devm_led_classdev_register(dev, >led);
+   if (err) {
+   dev_err(dev, "Failed to register LED\n");
+   return err;
+   }
+
+   err = ht16k33_brightness_set(priv, seg->led.brightness);
if (err)
return err;


The LED class can pretty much do what the backlight class can and more.

Maybe we can stop registering a backlight device in the fbdev case and
register a led device for both. This makes the code cleaner and drops
a dependency but will break backwards compatibility.

I'd prefer a single solution that covers both use cases, but I'm not
sure about the 'breaking backwards compatibility' consequence...

Groetjes / Kind regards,
Robin van der Gracht


[PATCH] media: i2c: tvp5150: Fix horizontal crop stop boundry

2019-09-17 Thread Robin van der Gracht
The value for AVID stop is relative to the width of the active video area,
not the maximum register value. Zero means equal and a negative value means
we're cropping on the right side.

Signed-off-by: Robin van der Gracht 
---
 drivers/media/i2c/tvp5150.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index f47cb9a023fb..6bc65ab5e8ab 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -1231,10 +1231,10 @@ __tvp5150_set_selection(struct v4l2_subdev *sd, struct 
v4l2_rect rect)
regmap_write(decoder->regmap, TVP5150_ACT_VD_CROP_ST_LSB,
 rect.left | (1 << TVP5150_CROP_SHIFT));
regmap_write(decoder->regmap, TVP5150_ACT_VD_CROP_STP_MSB,
-(rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
+(rect.left + rect.width - TVP5150_H_MAX) >>
 TVP5150_CROP_SHIFT);
regmap_write(decoder->regmap, TVP5150_ACT_VD_CROP_STP_LSB,
-rect.left + rect.width - TVP5150_MAX_CROP_LEFT);
+rect.left + rect.width - TVP5150_H_MAX);
 }
 
 static int tvp5150_set_selection(struct v4l2_subdev *sd,
-- 
2.20.1



[PATCH v3] input: keyboard: snvs_pwrkey: Send key events for i.MX6 S, DL and Q

2019-09-04 Thread Robin van der Gracht
The first generation i.MX6 processors does not send an interrupt when the
power key is pressed. It sends a power down request interrupt if the key is
released before a hard shutdown (5 second press). This should allow
software to bring down the SoC safely.

For this driver to work as a regular power key with the older SoCs, we need
to send a keypress AND release when we get the power down request irq.

Signed-off-by: Robin van der Gracht 
---

Changes v2 -> v3:
 - Drop alt compatible string for identifying first revision snvs hardware,
   read minor revision from register instead.
 - Drop imx6qdl.dtsi modification and device-tree binding documentation.
 - Add an additional input_sync() to create 2 seperate input reports for press
   and release.

 drivers/input/keyboard/Kconfig   |  2 +-
 drivers/input/keyboard/snvs_pwrkey.c | 28 ++--
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 7c4f19dab34f..937e58da5ce1 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -436,7 +436,7 @@ config KEYBOARD_SNVS_PWRKEY
depends on OF
help
  This is the snvs powerkey driver for the Freescale i.MX application
- processors that are newer than i.MX6 SX.
+ processors.
 
  To compile this driver as a module, choose M here; the
  module will be called snvs_pwrkey.
diff --git a/drivers/input/keyboard/snvs_pwrkey.c 
b/drivers/input/keyboard/snvs_pwrkey.c
index 5342d8d45f81..828580eee0d2 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 
+#define SNVS_HPVIDR1_REG 0xF8
 #define SNVS_LPSR_REG  0x4C/* LP Status Register */
 #define SNVS_LPCR_REG  0x38/* LP Control Register */
 #define SNVS_HPSR_REG  0x14
@@ -37,6 +38,7 @@ struct pwrkey_drv_data {
int wakeup;
struct timer_list check_timer;
struct input_dev *input;
+   u8 minor_rev;
 };
 
 static void imx_imx_snvs_check_for_events(struct timer_list *t)
@@ -45,6 +47,20 @@ static void imx_imx_snvs_check_for_events(struct timer_list 
*t)
struct input_dev *input = pdata->input;
u32 state;
 
+   if (pdata->minor_rev == 0) {
+   /*
+* The first generation i.MX6 SoCs only sends an interrupt on
+* button release. To mimic power-key usage, we'll prepend a
+* press event.
+*/
+   input_report_key(input, pdata->keycode, 1);
+   input_sync(input);
+   input_report_key(input, pdata->keycode, 0);
+   input_sync(input);
+   pm_relax(input->dev.parent);
+   return;
+   }
+
regmap_read(pdata->snvs, SNVS_HPSR_REG, );
state = state & SNVS_HPSR_BTN ? 1 : 0;
 
@@ -67,13 +83,17 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void 
*dev_id)
 {
struct platform_device *pdev = dev_id;
struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+   unsigned long expire = jiffies;
u32 lp_status;
 
pm_wakeup_event(pdata->input->dev.parent, 0);
 
regmap_read(pdata->snvs, SNVS_LPSR_REG, _status);
-   if (lp_status & SNVS_LPSR_SPO)
-   mod_timer(>check_timer, jiffies + 
msecs_to_jiffies(DEBOUNCE_TIME));
+   if (lp_status & SNVS_LPSR_SPO) {
+   if (pdata->minor_rev > 0)
+   expire = jiffies + msecs_to_jiffies(DEBOUNCE_TIME);
+   mod_timer(>check_timer, expire);
+   }
 
/* clear SPO status */
regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
@@ -94,6 +114,7 @@ static int imx_snvs_pwrkey_probe(struct platform_device 
*pdev)
struct input_dev *input = NULL;
struct device_node *np;
int error;
+   u32 vid;
 
/* Get SNVS register Page */
np = pdev->dev.of_node;
@@ -123,6 +144,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device 
*pdev)
return -EINVAL;
}
 
+   regmap_read(pdata->snvs, SNVS_HPVIDR1_REG, );
+   pdata->minor_rev = vid & 0xff;
+
regmap_update_bits(pdata->snvs, SNVS_LPCR_REG, SNVS_LPCR_DEP_EN, 
SNVS_LPCR_DEP_EN);
 
/* clear the unexpected interrupt before driver ready */
-- 
2.20.1



[PATCH v2 1/2] input: keyboard: snvs_pwrkey: Send key events for i.MX6 S, DL and Q

2019-08-27 Thread Robin van der Gracht
The first generation i.MX6 processors does not send an interrupt when the
power key is pressed. It sends a power down request interrupt if the key is
released before a hard shutdown (5 second press). This should allow
software to bring down the SoC safely.

For this driver to work as a regular power key with the older SoCs, we need
to send a keypress AND release when we get the power down request irq.

Signed-off-by: Robin van der Gracht 
---
 .../devicetree/bindings/crypto/fsl-sec4.txt   | 16 --
 drivers/input/keyboard/Kconfig|  2 +-
 drivers/input/keyboard/snvs_pwrkey.c  | 52 ---
 3 files changed, 57 insertions(+), 13 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt 
b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
index 2fe245ca816a..e4fbb9797082 100644
--- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
+++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@ -420,14 +420,22 @@ EXAMPLE
 =
 System ON/OFF key driver
 
-  The snvs-pwrkey is designed to enable POWER key function which controlled
-  by SNVS ONOFF, the driver can report the status of POWER key and wakeup
-  system if pressed after system suspend.
+  The snvs-pwrkey is designed to enable POWER key function which is controlled
+  by SNVS ONOFF. It can wakeup the system if pressed after system suspend.
+
+  There are two generations of SVNS pwrkey hardware. The first generation is
+  included in i.MX6 Solo, DualLite and Quad processors. The second generation
+  is included in i.MX6 SoloX and newer SoCs.
+
+  Second generation SNVS can detect and report the status of POWER key, but the
+  first generation can only detect a key release and so emits an instantaneous
+  press and release event when the key is released.
 
   - compatible:
   Usage: required
   Value type: 
-  Definition: Mush include "fsl,sec-v4.0-pwrkey".
+  Definition: Must include "fsl,sec-v4.0-pwrkey" for i.MX6 SoloX and newer
+  or "fsl,imx6qdl-snvs-pwrkey" for older SoCs.
 
   - interrupts:
   Usage: required
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 7c4f19dab34f..937e58da5ce1 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -436,7 +436,7 @@ config KEYBOARD_SNVS_PWRKEY
depends on OF
help
  This is the snvs powerkey driver for the Freescale i.MX application
- processors that are newer than i.MX6 SX.
+ processors.
 
  To compile this driver as a module, choose M here; the
  module will be called snvs_pwrkey.
diff --git a/drivers/input/keyboard/snvs_pwrkey.c 
b/drivers/input/keyboard/snvs_pwrkey.c
index 5342d8d45f81..d71c44733103 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -29,6 +29,11 @@
 #define DEBOUNCE_TIME 30
 #define REPEAT_INTERVAL 60
 
+enum imx_snvs_hwtype {
+   IMX6SX_SNVS,/* i.MX6 SoloX and newer */
+   IMX6QDL_SNVS,   /* i.MX6 Solo, DualLite and Quad */
+};
+
 struct pwrkey_drv_data {
struct regmap *snvs;
int irq;
@@ -37,14 +42,41 @@ struct pwrkey_drv_data {
int wakeup;
struct timer_list check_timer;
struct input_dev *input;
+   enum imx_snvs_hwtype hwtype;
 };
 
+static const struct of_device_id imx_snvs_pwrkey_ids[] = {
+   {
+   .compatible = "fsl,sec-v4.0-pwrkey",
+   .data = (const void *)IMX6SX_SNVS,
+   },
+   {
+   .compatible = "fsl,imx6qdl-snvs-pwrkey",
+   .data = (const void *)IMX6QDL_SNVS,
+   },
+   { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, imx_snvs_pwrkey_ids);
+
 static void imx_imx_snvs_check_for_events(struct timer_list *t)
 {
struct pwrkey_drv_data *pdata = from_timer(pdata, t, check_timer);
struct input_dev *input = pdata->input;
u32 state;
 
+   if (pdata->hwtype == IMX6QDL_SNVS) {
+   /*
+* The first generation i.MX6 SoCs only sends an interrupt on
+* button release. To mimic power-key usage, we'll prepend a
+* press event.
+*/
+   input_report_key(input, pdata->keycode, 1);
+   input_report_key(input, pdata->keycode, 0);
+   input_sync(input);
+   pm_relax(input->dev.parent);
+   return;
+   }
+
regmap_read(pdata->snvs, SNVS_HPSR_REG, );
state = state & SNVS_HPSR_BTN ? 1 : 0;
 
@@ -67,13 +99,17 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void 
*dev_id)
 {
struct platform_device *pdev = dev_id;
struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+   unsigned long expire = jiffies;
u32 lp_status;
 
pm_wakeup_event(pdata->input

[PATCH v2 2/2] arm: dts: imx6qdl: snvs-pwrkey: Change compatible string

2019-08-27 Thread Robin van der Gracht
The older imx6 SoCs do not send a power key press interrupt, instead it
sends a power down request interrupt when the key is released between
750ms and 5 seconds. The driver uses a different compatible string to ID
the older SoCs.

Signed-off-by: Robin van der Gracht 
---
 arch/arm/boot/dts/imx6qdl.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index b3a77bcf00d5..91b97816881c 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -836,7 +836,7 @@
};
 
snvs_pwrkey: snvs-powerkey {
-   compatible = "fsl,sec-v4.0-pwrkey";
+   compatible = "fsl,imx6qdl-snvs-pwrkey";
regmap = <>;
interrupts = ;
linux,keycode = ;
-- 
2.20.1



[PATCH] input: keyboard: snvs_pwrkey: Send press and release event for i.MX6 S,DL and Q

2019-08-23 Thread Robin van der Gracht
The older generation i.MX6 processors send a powerdown request interrupt if
the powerkey is released before a hard shutdown (5 second press). This should
allow software to bring down the SoC safely.

For this driver to work as a regular powerkey with the older SoCs, we need to
send a keypress AND release when we get the powerdown request interrupt.

Signed-off-by: Robin van der Gracht 
---
 arch/arm/boot/dts/imx6qdl.dtsi   |  2 +-
 arch/arm/boot/dts/imx6sll.dtsi   |  2 +-
 arch/arm/boot/dts/imx6sx.dtsi|  2 +-
 arch/arm/boot/dts/imx6ul.dtsi|  2 +-
 arch/arm/boot/dts/imx7s.dtsi |  2 +-
 drivers/input/keyboard/Kconfig   |  2 +-
 drivers/input/keyboard/snvs_pwrkey.c | 59 +++-
 7 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index b3a77bcf00d51..c10d12658743c 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -836,7 +836,7 @@
};
 
snvs_pwrkey: snvs-powerkey {
-   compatible = "fsl,sec-v4.0-pwrkey";
+   compatible = 
"fsl,imx6qdl-sec-v4.0-pwrkey";
regmap = <>;
interrupts = ;
linux,keycode = ;
diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi
index 1b4899f0fcded..91c7d5bdcc359 100644
--- a/arch/arm/boot/dts/imx6sll.dtsi
+++ b/arch/arm/boot/dts/imx6sll.dtsi
@@ -571,7 +571,7 @@
};
 
snvs_pwrkey: snvs-powerkey {
-   compatible = "fsl,sec-v4.0-pwrkey";
+   compatible = 
"fsl,imx6sx-sec-v4.0-pwrkey";
regmap = <>;
interrupts = ;
linux,keycode = ;
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index b16a123990a26..b6736db65350f 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -733,7 +733,7 @@
};
 
snvs_pwrkey: snvs-powerkey {
-   compatible = "fsl,sec-v4.0-pwrkey";
+   compatible = 
"fsl,imx6sx-sec-v4.0-pwrkey";
regmap = <>;
interrupts = ;
linux,keycode = ;
diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi
index a7f6d1d58e20d..d4678c52b55db 100644
--- a/arch/arm/boot/dts/imx6ul.dtsi
+++ b/arch/arm/boot/dts/imx6ul.dtsi
@@ -644,7 +644,7 @@
};
 
snvs_pwrkey: snvs-powerkey {
-   compatible = "fsl,sec-v4.0-pwrkey";
+   compatible = 
"fsl,imx6sx-sec-v4.0-pwrkey";
regmap = <>;
interrupts = ;
linux,keycode = ;
diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index 106711d2c01b0..bb68c23beb199 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -604,7 +604,7 @@
};
 
snvs_pwrkey: snvs-powerkey {
-   compatible = "fsl,sec-v4.0-pwrkey";
+   compatible = 
"fsl,imx6sx-sec-v4.0-pwrkey";
regmap = <>;
interrupts = ;
linux,keycode = ;
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 7c4f19dab34fd..937e58da5ce17 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -436,7 +436,7 @@ config KEYBOARD_SNVS_PWRKEY
depends on OF
help
  This is the snvs powerkey driver for the Freescale i.MX application
- processors that are newer than i.MX6 SX.
+ processors.
 
  To compile this driver as a module, choose M here; the
  module will be called snvs_pwrkey.
diff --git a/drivers/input/keyboard/snvs_pwrkey.c 
b/drivers/input/keyboard/snvs_pwrkey.c
index 5342d8d45f811..c321e5f2d1087 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -29,6 +29,11 @@
 #define DEBOUNCE_TIME 30
 #define REPEAT_INTERVAL 60
 
+enum imx_snvs_hwtype {
+   IMX6SX_SNVS,/* i.MX6 SoloX an

Re: [PATCH] auxdisplay: ht16k33: Make ht16k33_fb_fix and ht16k33_fb_var constant

2019-08-20 Thread Robin van der Gracht

On 2019-08-19 09:51, Nishka Dasgupta wrote:

The static structures ht16k33_fb_fix and ht16k33_fb_var, of types
fb_fix_screeninfo and fb_var_screeninfo respectively, are not used
except to be copied into other variables. Hence make both of them
constant to prevent unintended modification.
Issue found with
Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/auxdisplay/ht16k33.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c 
b/drivers/auxdisplay/ht16k33.c

index 9c0bb771751d..a2fcde582e2a 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -74,7 +74,7 @@ struct ht16k33_priv {
struct ht16k33_fbdev fbdev;
 };

-static struct fb_fix_screeninfo ht16k33_fb_fix = {
+static const struct fb_fix_screeninfo ht16k33_fb_fix = {
.id = DRIVER_NAME,
.type   = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_MONO10,
@@ -85,7 +85,7 @@ static struct fb_fix_screeninfo ht16k33_fb_fix = {
.accel  = FB_ACCEL_NONE,
 };

-static struct fb_var_screeninfo ht16k33_fb_var = {
+static const struct fb_var_screeninfo ht16k33_fb_var = {
.xres = HT16K33_MATRIX_LED_MAX_ROWS,
.yres = HT16K33_MATRIX_LED_MAX_COLS,
.xres_virtual = HT16K33_MATRIX_LED_MAX_ROWS,


ACK

Robin


Re: [PATCH 2/2] auxdisplay/ht16k33.c: Convert to use vm_map_pages_zero()

2019-05-21 Thread Robin van der Gracht
On Mon, 20 May 2019 21:00:58 +0530
Souptick Joarder  wrote:

> While using mmap, the incorrect value of length and vm_pgoff are
> ignored and this driver go ahead with mapping fbdev.buffer
> to user vma.
> 
> Convert vm_insert_pages() to use vm_map_pages_zero(). We could later
> "fix" these drivers to behave according to the normal vm_pgoff
> offsetting simply by removing the _zero suffix on the function name
> and if that causes regressions, it gives us an easy way to revert.
> 
> Signed-off-by: Souptick Joarder 
> ---
>  drivers/auxdisplay/ht16k33.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index 21393ec..9c0bb77 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -223,9 +223,9 @@ static int ht16k33_bl_check_fb(struct backlight_device 
> *bl, struct fb_info *fi)
>  static int ht16k33_mmap(struct fb_info *info, struct vm_area_struct *vma)
>  {
>   struct ht16k33_priv *priv = info->par;
> + struct page *pages = virt_to_page(priv->fbdev.buffer);
>  
> - return vm_insert_page(vma, vma->vm_start,
> -   virt_to_page(priv->fbdev.buffer));
> +     return vm_map_pages_zero(vma, , 1);
>  }
>  
>  static struct fb_ops ht16k33_fb_ops = {

Acked-by: Robin van der Gracht 


Re: [PATCH] auxdisplay: ht16k33: fix potential user-after-free on module unload

2019-02-10 Thread Robin van der Gracht
On Sat, 9 Feb 2019 01:15:22 +0100
Miguel Ojeda  wrote:

> On module unload/remove, we need to ensure that work does not run
> after we have freed resources. Concretely, cancel_delayed_work()
> may return while the callback function is still running.
> 
> From kernel/workqueue.c:
> 
> The work callback function may still be running on return,
> unless it returns true and the work doesn't re-arm itself.
> Explicitly flush or use cancel_delayed_work_sync() to wait on it.
> 
> Link: 
> https://lore.kernel.org/lkml/20190204220952.30761-1-thesve...@googlemail.com/
> Reported-by: Sven Van Asbroeck 
> Signed-off-by: Miguel Ojeda 
> ---
>  drivers/auxdisplay/ht16k33.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index a43276c76fc6..21393ec3b9a4 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -509,7 +509,7 @@ static int ht16k33_remove(struct i2c_client *client)
>   struct ht16k33_priv *priv = i2c_get_clientdata(client);
>   struct ht16k33_fbdev *fbdev = >fbdev;
>  
> - cancel_delayed_work(>work);
> + cancel_delayed_work_sync(>work);
>   unregister_framebuffer(fbdev->info);
>   framebuffer_release(fbdev->info);
>   free_page((unsigned long) fbdev->buffer);

Looks good

Acked-by: Robin van der Gracht 


Re: [PATCH v4] mmc: mxs-mmc: Introduce regulator support

2019-01-31 Thread Robin van der Gracht
On Thu, 31 Jan 2019 13:17:23 +0100
Ulf Hansson  wrote:

> On Thu, 31 Jan 2019 at 09:20, Robin van der Gracht  wrote:
> >
> > On Mon, 28 Jan 2019 22:15:23 +0100
> > Ulf Hansson  wrote:
> >  
> > > On Mon, 28 Jan 2019 at 15:41, Martin Kepplinger  
> > > wrote:  
> > > >
> > > > From: Martin Kepplinger 
> > > >
> > > > This adds support for explicitly switching the mmc's power on and off
> > > > which is needed for example for WL1837 WL1271 wifi controllers on imx28.
> > > >
> > > > While the wifi's vmmc-supply regulator can be configured in devicetree,
> > > > "ip link set wlan0 down" doesn't turn off the VMMC regulator which leads
> > > > to hangs when loading firmware, for example.
> > > >
> > > > Signed-off-by: Martin Kepplinger 
> > > > ---
> > > >
> > > >
> > > > revision history
> > > > 
> > > > v4: re-added forgotten regulator_enable() during probe
> > > > v3: improve API usage as suggested by Ulf
> > > > v2: tested patch with changes suggested by Robin
> > > > v1: question, why https://patchwork.kernel.org/patch/4365751/ didn't 
> > > > get in
> > > >
> > > >
> > > >  drivers/mmc/host/mxs-mmc.c | 34 +-
> > > >  1 file changed, 25 insertions(+), 9 deletions(-)
> > > >
> > > > diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
> > > > index add1e70195ea..23d275269d61 100644
> > > > --- a/drivers/mmc/host/mxs-mmc.c
> > > > +++ b/drivers/mmc/host/mxs-mmc.c
> > > > @@ -517,6 +517,22 @@ static void mxs_mmc_set_ios(struct mmc_host *mmc, 
> > > > struct mmc_ios *ios)
> > > > else
> > > > host->bus_width = 0;
> > > >
> > > > +   switch (ios->power_mode) {
> > > > +   case MMC_POWER_OFF:
> > > > +   if (!IS_ERR(host->mmc->supply.vmmc))
> > > > +   mmc_regulator_set_ocr(host->mmc,
> > > > + host->mmc->supply.vmmc, 
> > > > 0);
> > > > +   break;
> > > > +   case MMC_POWER_UP:
> > > > +   if (!IS_ERR(host->mmc->supply.vmmc))
> > > > +   mmc_regulator_set_ocr(host->mmc,
> > > > + host->mmc->supply.vmmc,
> > > > + ios->vdd);
> > > > +   break;
> > > > +   default:
> > > > +   break;
> > > > +   }
> > > > +
> > > > if (ios->clock)
> > > > mxs_ssp_set_clk_rate(>ssp, ios->clock);
> > > >  }
> > > > @@ -588,7 +604,6 @@ static int mxs_mmc_probe(struct platform_device 
> > > > *pdev)
> > > > struct mmc_host *mmc;
> > > > struct resource *iores;
> > > > int ret = 0, irq_err;
> > > > -   struct regulator *reg_vmmc;
> > > > struct mxs_ssp *ssp;
> > > >
> > > > irq_err = platform_get_irq(pdev, 0);
> > > > @@ -614,14 +629,15 @@ static int mxs_mmc_probe(struct platform_device 
> > > > *pdev)
> > > > host->mmc = mmc;
> > > > host->sdio_irq_en = 0;
> > > >
> > > > -   reg_vmmc = devm_regulator_get(>dev, "vmmc");
> > > > -   if (!IS_ERR(reg_vmmc)) {
> > > > -   ret = regulator_enable(reg_vmmc);
> > > > -   if (ret) {
> > > > -   dev_err(>dev,
> > > > -   "Failed to enable vmmc regulator: 
> > > > %d\n", ret);
> > > > -   goto out_mmc_free;
> > > > -   }
> > > > +   ret = mmc_regulator_get_supply(mmc);
> > > > +   if (ret == -EPROBE_DEFER)
> > > > +   goto out_mmc_free;
> > > > +
> > > > +   ret = regulator_enable(mmc->supply.vmmc);  
> > >
> > > This is wrong, as it may cause the regulator usage count to become
> > > wrongly balanced.
> > >
> > > Instead, via ->set_ios() when calling mmc_regulator_set_ocr(),

Re: [PATCH v4] mmc: mxs-mmc: Introduce regulator support

2019-01-31 Thread Robin van der Gracht
On Mon, 28 Jan 2019 22:15:23 +0100
Ulf Hansson  wrote:

> On Mon, 28 Jan 2019 at 15:41, Martin Kepplinger  wrote:
> >
> > From: Martin Kepplinger 
> >
> > This adds support for explicitly switching the mmc's power on and off
> > which is needed for example for WL1837 WL1271 wifi controllers on imx28.
> >
> > While the wifi's vmmc-supply regulator can be configured in devicetree,
> > "ip link set wlan0 down" doesn't turn off the VMMC regulator which leads
> > to hangs when loading firmware, for example.
> >
> > Signed-off-by: Martin Kepplinger 
> > ---
> >
> >
> > revision history
> > 
> > v4: re-added forgotten regulator_enable() during probe
> > v3: improve API usage as suggested by Ulf
> > v2: tested patch with changes suggested by Robin
> > v1: question, why https://patchwork.kernel.org/patch/4365751/ didn't get in
> >
> >
> >  drivers/mmc/host/mxs-mmc.c | 34 +-
> >  1 file changed, 25 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
> > index add1e70195ea..23d275269d61 100644
> > --- a/drivers/mmc/host/mxs-mmc.c
> > +++ b/drivers/mmc/host/mxs-mmc.c
> > @@ -517,6 +517,22 @@ static void mxs_mmc_set_ios(struct mmc_host *mmc, 
> > struct mmc_ios *ios)
> > else
> > host->bus_width = 0;
> >
> > +   switch (ios->power_mode) {
> > +   case MMC_POWER_OFF:
> > +   if (!IS_ERR(host->mmc->supply.vmmc))
> > +   mmc_regulator_set_ocr(host->mmc,
> > + host->mmc->supply.vmmc, 0);
> > +   break;
> > +   case MMC_POWER_UP:
> > +   if (!IS_ERR(host->mmc->supply.vmmc))
> > +   mmc_regulator_set_ocr(host->mmc,
> > + host->mmc->supply.vmmc,
> > + ios->vdd);
> > +   break;
> > +   default:
> > +   break;
> > +   }
> > +
> > if (ios->clock)
> > mxs_ssp_set_clk_rate(>ssp, ios->clock);
> >  }
> > @@ -588,7 +604,6 @@ static int mxs_mmc_probe(struct platform_device *pdev)
> > struct mmc_host *mmc;
> > struct resource *iores;
> > int ret = 0, irq_err;
> > -   struct regulator *reg_vmmc;
> > struct mxs_ssp *ssp;
> >
> > irq_err = platform_get_irq(pdev, 0);
> > @@ -614,14 +629,15 @@ static int mxs_mmc_probe(struct platform_device *pdev)
> > host->mmc = mmc;
> > host->sdio_irq_en = 0;
> >
> > -   reg_vmmc = devm_regulator_get(>dev, "vmmc");
> > -   if (!IS_ERR(reg_vmmc)) {
> > -   ret = regulator_enable(reg_vmmc);
> > -   if (ret) {
> > -   dev_err(>dev,
> > -   "Failed to enable vmmc regulator: %d\n", 
> > ret);
> > -   goto out_mmc_free;
> > -   }
> > +   ret = mmc_regulator_get_supply(mmc);
> > +   if (ret == -EPROBE_DEFER)
> > +   goto out_mmc_free;
> > +
> > +   ret = regulator_enable(mmc->supply.vmmc);  
> 
> This is wrong, as it may cause the regulator usage count to become
> wrongly balanced.
> 
> Instead, via ->set_ios() when calling mmc_regulator_set_ocr(), it will
> take care of enabling and disabling the regulator depending of the
> requested vdd voltage level.
> 
> > +   if (ret) {
> > +   dev_err(>dev,
> > +   "Failed to enable vmmc regulator: %d\n", ret);
> > +   goto out_mmc_free;
> > }
> >
> >     ssp->clk = devm_clk_get(>dev, NULL);
> > --
> > 2.20.1
> >  
> 
> BTW, you didn't really answer my earlier question about the TI WiFi
> chip. Doesn't you need a special clock for WiFi chip as well? How do
> you intend to manage that?

I used an external 32K oscillator (SLOW_CLK) for my wl1271. Other
clocks ware generated on the module.

I had to supply a 'vmmc-supply' in your wl1271 devicetree node,
which will be used to power on/off the wlan module. The supply should
be a (delayed) GPIO controlled 'fixed-regulator' attached to the
wlan_en pin on the module.

1: Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt

Kind regards,

-- 
Robin van der Gracht
Protonic Holland
tel.: +31 (0) 229 212928
fax.: +31 (0) 229 210930
Factorij 36 / 1689 AL Zwaag


Re: [PATCH v2] mmc: mxs-mmc: Introduce regulator support

2019-01-28 Thread Robin van der Gracht
Hi Martin,

On Mon, 28 Jan 2019 11:20:22 +0100
Martin Kepplinger  wrote:

> From: Martin Kepplinger 
> 
> This adds support for explicitly switching the mmc's power on and off
> which is needed for example for WL1837 wifi controllers. ip link set wlan0 
> down
> doesn't turn off the VMMC regulator which leads to hangs when loading 
> firmware.
> 
> Tested on i.MX28.
> 
> Signed-off-by: Martin Kepplinger 
> ---
> 
> again, this isn't new. it's (rebased and simplified)
> https://patchwork.kernel.org/patch/4365751/
> 
> Thanks Robin for your input!
> 
> revision history
> 
> v1: was just a question why this hasn't gone in earlier.

Not sure why it never made it. I created it for use with a wl1271 which
wan't properly reset in case of a fault. Also combined with imx28.

Regards,
Robin van der Gracht


Re: [PATCH] mmc: mxs-mmc: Introduce regulator support

2019-01-25 Thread Robin van der Gracht
Hi Martin,

On Fri, 25 Jan 2019 12:34:49 +0100
Martin Kepplinger  wrote:

> From: Martin Kepplinger 
> 
> This adds support for explicitly switching the mmc's power on and off.
> 
> Signed-off-by: Martin Kepplinger 
> ---
> 
> This is not my patch. It's taken from 
> https://patchwork.kernel.org/patch/4365751/
> rebased and minimally changed; but we use this.
> 
> Are there any objections to this?
> 
> Robin, can I still add your Signed-off-by to this? Also, should I set you
> as the author?

It's old, but thanks for keeping me in the loop :)

> 
> thanks,
> 
> martin
> 
>  drivers/mmc/host/mxs-mmc.c | 31 +++
>  1 file changed, 23 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
> index add1e70195ea..e3c19fabb723 100644
> --- a/drivers/mmc/host/mxs-mmc.c
> +++ b/drivers/mmc/host/mxs-mmc.c
> @@ -517,6 +517,26 @@ static void mxs_mmc_set_ios(struct mmc_host *mmc, struct 
> mmc_ios *ios)
>   else
>   host->bus_width = 0;
>  
> + if (ios->power_mode != host->power_mode) {
> + switch (ios->power_mode) {
> + case MMC_POWER_OFF:
> + if ((host->vmmc) && regulator_disable(host->vmmc)) {
> + dev_err(mmc_dev(host->mmc),
> + "Failed to disable vmmc regulator\n");
> + }
> + break;
> + case MMC_POWER_UP:
> + if ((host->vmmc) && regulator_enable(host->vmmc)) {
> + dev_err(mmc_dev(host->mmc),
> + "Failed to enable vmmc regulator\n");
> + }
> + break;
> + default:
> + break;
> + }
> + host->power_mode = ios->power_mode;
> + }
> +

A single check in the root contitional for the availability of vmmc
should suffice, so:

if (host->vmmc && ios->power_mode != host->power_mode) {
...
case MMC_POWER_XX:
if (regulator_xx(host->vmmc))
dev_err;
...


>   if (ios->clock)
>   mxs_ssp_set_clk_rate(>ssp, ios->clock);
>  }
> @@ -613,16 +633,11 @@ static int mxs_mmc_probe(struct platform_device *pdev)
>  
>   host->mmc = mmc;
>   host->sdio_irq_en = 0;
> + host->power_mode = MMC_POWER_OFF;

My patch added 'power_mode' and 'vmmc' to the drivers private struct
(which are missing in this email?)

>  
>   reg_vmmc = devm_regulator_get(>dev, "vmmc");
> - if (!IS_ERR(reg_vmmc)) {
> - ret = regulator_enable(reg_vmmc);
> - if (ret) {
> - dev_err(>dev,
> - "Failed to enable vmmc regulator: %d\n", ret);
> - goto out_mmc_free;
> - }
> - }
> +     if (!IS_ERR(reg_vmmc))
> + host->vmmc = reg_vmmc;

what about mmc_regulator_get_supply(mmc)?

If we use that the vmmc will be made available under mmv->supply->vmmc
if probe was successfull instead of storing it in the drivers private
struct.

>  
>   ssp->clk = devm_clk_get(>dev, NULL);
>   if (IS_ERR(ssp->clk)) {

Robin van der Gracht


Re: [PATCH] auxdisplay: Replace licenses with SPDX identifiers

2018-02-19 Thread Robin van der Gracht
On Mon, 19 Feb 2018 08:44:17 +0100
Robin van der Gracht <ro...@protonic.nl> wrote:

> On Sat, 17 Feb 2018 20:39:55 +0100
> Miguel Ojeda <miguel.ojeda.sando...@gmail.com> wrote:
> 
> > Cc: Willy Tarreau <w...@1wt.eu>
> > Cc: Geert Uytterhoeven <ge...@linux-m68k.org>
> > Cc: Linus Walleij <tr...@df.lth.se>
> > Cc: Robin van der Gracht <ro...@protonic.nl>
> > Cc: Paul Burton <paul.bur...@mips.com>
> > Signed-off-by: Miguel Ojeda <miguel.ojeda.sando...@gmail.com>
> > ---
> > Please let me know if you agree for your files and I will queue it up.
> > Thanks!  
> 
> ...
> 
> >  
> >  #include 
> > diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> > index fbfa5b4cc567..a43276c76fc6 100644
> > --- a/drivers/auxdisplay/ht16k33.c
> > +++ b/drivers/auxdisplay/ht16k33.c
> > @@ -1,18 +1,10 @@
> > +// SPDX-License-Identifier: GPL-2.0
> >  /*
> >   * HT16K33 driver
> >   *
> >   * Author: Robin van der Gracht <ro...@protonic.nl>
> >   *
> >   * Copyright: (C) 2016 Protonic Holland.
> > - *
> > - * This program is free software; you can redistribute it and/or modify
> > - * it under the terms of the GNU General Public License version 2 as
> > - * published by the Free Software Foundation.
> > - *
> > - * This program is distributed in the hope that it will be useful, but
> > - * WITHOUT ANY WARRANTY; without even the implied warranty of
> > - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > - * General Public License for more details.
> >   */
> >
> 
> Signed-off-by: Robin van der Gracht <ro...@protonic.nl>

Change to:

Acked-by: Robin van der Gracht <ro...@protonic.nl>

Best regards, / vriendelijke groet,

-- 
Robin van der Gracht
Protonic Holland
tel.: +31 (0) 229 212928
fax.: +31 (0) 229 210930
Factorij 36 / 1689 AL Zwaag


Re: [PATCH] auxdisplay: Replace licenses with SPDX identifiers

2018-02-19 Thread Robin van der Gracht
On Mon, 19 Feb 2018 08:44:17 +0100
Robin van der Gracht  wrote:

> On Sat, 17 Feb 2018 20:39:55 +0100
> Miguel Ojeda  wrote:
> 
> > Cc: Willy Tarreau 
> > Cc: Geert Uytterhoeven 
> > Cc: Linus Walleij 
> > Cc: Robin van der Gracht 
> > Cc: Paul Burton 
> > Signed-off-by: Miguel Ojeda 
> > ---
> > Please let me know if you agree for your files and I will queue it up.
> > Thanks!  
> 
> ...
> 
> >  
> >  #include 
> > diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> > index fbfa5b4cc567..a43276c76fc6 100644
> > --- a/drivers/auxdisplay/ht16k33.c
> > +++ b/drivers/auxdisplay/ht16k33.c
> > @@ -1,18 +1,10 @@
> > +// SPDX-License-Identifier: GPL-2.0
> >  /*
> >   * HT16K33 driver
> >   *
> >   * Author: Robin van der Gracht 
> >   *
> >   * Copyright: (C) 2016 Protonic Holland.
> > - *
> > - * This program is free software; you can redistribute it and/or modify
> > - * it under the terms of the GNU General Public License version 2 as
> > - * published by the Free Software Foundation.
> > - *
> > - * This program is distributed in the hope that it will be useful, but
> > - * WITHOUT ANY WARRANTY; without even the implied warranty of
> > - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > - * General Public License for more details.
> >   */
> >
> 
> Signed-off-by: Robin van der Gracht 

Change to:

Acked-by: Robin van der Gracht 

Best regards, / vriendelijke groet,

-- 
Robin van der Gracht
Protonic Holland
tel.: +31 (0) 229 212928
fax.: +31 (0) 229 210930
Factorij 36 / 1689 AL Zwaag


Re: [PATCH] auxdisplay: Replace licenses with SPDX identifiers

2018-02-19 Thread Robin van der Gracht
On Sat, 17 Feb 2018 20:39:55 +0100
Miguel Ojeda <miguel.ojeda.sando...@gmail.com> wrote:

> Cc: Willy Tarreau <w...@1wt.eu>
> Cc: Geert Uytterhoeven <ge...@linux-m68k.org>
> Cc: Linus Walleij <tr...@df.lth.se>
> Cc: Robin van der Gracht <ro...@protonic.nl>
> Cc: Paul Burton <paul.bur...@mips.com>
> Signed-off-by: Miguel Ojeda <miguel.ojeda.sando...@gmail.com>
> ---
> Please let me know if you agree for your files and I will queue it up.
> Thanks!

...

>  
>  #include 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index fbfa5b4cc567..a43276c76fc6 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -1,18 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * HT16K33 driver
>   *
>   * Author: Robin van der Gracht <ro...@protonic.nl>
>   *
>   * Copyright: (C) 2016 Protonic Holland.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful, but
> - * WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> - * General Public License for more details.
>   */
>  

Signed-off-by: Robin van der Gracht <ro...@protonic.nl>

Best regards, / vriendelijke groet,

-- 
Robin van der Gracht
Protonic Holland
tel.: +31 (0) 229 212928
fax.: +31 (0) 229 210930
Factorij 36 / 1689 AL Zwaag


Re: [PATCH] auxdisplay: Replace licenses with SPDX identifiers

2018-02-19 Thread Robin van der Gracht
On Sat, 17 Feb 2018 20:39:55 +0100
Miguel Ojeda  wrote:

> Cc: Willy Tarreau 
> Cc: Geert Uytterhoeven 
> Cc: Linus Walleij 
> Cc: Robin van der Gracht 
> Cc: Paul Burton 
> Signed-off-by: Miguel Ojeda 
> ---
> Please let me know if you agree for your files and I will queue it up.
> Thanks!

...

>  
>  #include 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index fbfa5b4cc567..a43276c76fc6 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -1,18 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * HT16K33 driver
>   *
>   * Author: Robin van der Gracht 
>   *
>   * Copyright: (C) 2016 Protonic Holland.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful, but
> - * WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> - * General Public License for more details.
>   */
>  

Signed-off-by: Robin van der Gracht 

Best regards, / vriendelijke groet,

-- 
Robin van der Gracht
Protonic Holland
tel.: +31 (0) 229 212928
fax.: +31 (0) 229 210930
Factorij 36 / 1689 AL Zwaag


[PATCH] auxdisplay: ht16k33: Use generic device properties function

2017-08-16 Thread Robin van der Gracht
matrix_keypad_parse_of_params() was replaced early this year.

Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---

Early this year Dmitry Torokhov introduced a switch to using generic
device properties instead of being OF-specific.

Somehow this driver wasn't included in the update.

For reference: https://patchwork.kernel.org/patch/9527095/

 drivers/auxdisplay/ht16k33.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index fbfa5b4cc567..99ce9731fc9c 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -354,7 +354,7 @@ static int ht16k33_keypad_probe(struct i2c_client *client,
return err;
}
 
-   err = matrix_keypad_parse_of_params(>dev, , );
+   err = matrix_keypad_parse_properties(>dev, , );
if (err)
return err;
if (rows > HT16K33_MATRIX_KEYPAD_MAX_ROWS ||
-- 
2.11.0



[PATCH] auxdisplay: ht16k33: Use generic device properties function

2017-08-16 Thread Robin van der Gracht
matrix_keypad_parse_of_params() was replaced early this year.

Signed-off-by: Robin van der Gracht 
---

Early this year Dmitry Torokhov introduced a switch to using generic
device properties instead of being OF-specific.

Somehow this driver wasn't included in the update.

For reference: https://patchwork.kernel.org/patch/9527095/

 drivers/auxdisplay/ht16k33.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index fbfa5b4cc567..99ce9731fc9c 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -354,7 +354,7 @@ static int ht16k33_keypad_probe(struct i2c_client *client,
return err;
}
 
-   err = matrix_keypad_parse_of_params(>dev, , );
+   err = matrix_keypad_parse_properties(>dev, , );
if (err)
return err;
if (rows > HT16K33_MATRIX_KEYPAD_MAX_ROWS ||
-- 
2.11.0



[PATCH] auxdisplay: ht16k33: Use unique prefixed i2c client device name

2017-08-16 Thread Robin van der Gracht
Static naming causes problems when multiple devices are registered.

Reported-by: Michael Kaplan <m.kap...@evva.com>
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---

Michael Kaplan <m.kap...@evva.com> reported the issue with his multiple
ht16k33 controller setup.

[  472.124385] sysfs: cannot create duplicate filename 
'/class/backlight/ht16k33-bl'

So we've got to get rid of the static device names for backlight and keypad.

I figured incoperating the i2c device name would make it generic enough.

The default device name if on i2c adapter 0 with addres 0x70 is '0-0070' which
might be fine for an input or framebuffer device, but IMO it looks odd for a
backlight device (/sys/class/backlight/0-0070/).

So I choose to prefix the default i2c device name (assigned in i2c-core.c) with
the driver name which will result in 'ht16k33-0-0070'.

 drivers/auxdisplay/ht16k33.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 99ce9731fc9c..674a6c0cec2a 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -339,7 +339,7 @@ static int ht16k33_keypad_probe(struct i2c_client *client,
 
input_set_drvdata(keypad->dev, keypad);
 
-   keypad->dev->name = DRIVER_NAME"-keypad";
+   keypad->dev->name = dev_name(>dev);
keypad->dev->id.bustype = BUS_I2C;
keypad->dev->open = ht16k33_keypad_start;
keypad->dev->close = ht16k33_keypad_stop;
@@ -421,6 +421,7 @@ static int ht16k33_probe(struct i2c_client *client,
 
priv->client = client;
i2c_set_clientdata(client, priv);
+   dev_set_name(>dev, DRIVER_NAME"-%s", dev_name(>dev));
fbdev = >fbdev;
 
err = ht16k33_initialize(priv);
@@ -476,7 +477,8 @@ static int ht16k33_probe(struct i2c_client *client,
bl_props.type = BACKLIGHT_RAW;
bl_props.max_brightness = MAX_BRIGHTNESS;
 
-   bl = devm_backlight_device_register(>dev, DRIVER_NAME"-bl",
+   bl = devm_backlight_device_register(>dev,
+   dev_name(>dev),
>dev, priv,
_bl_ops, _props);
if (IS_ERR(bl)) {
-- 
2.11.0



[PATCH] auxdisplay: ht16k33: Use unique prefixed i2c client device name

2017-08-16 Thread Robin van der Gracht
Static naming causes problems when multiple devices are registered.

Reported-by: Michael Kaplan 
Signed-off-by: Robin van der Gracht 
---

Michael Kaplan  reported the issue with his multiple
ht16k33 controller setup.

[  472.124385] sysfs: cannot create duplicate filename 
'/class/backlight/ht16k33-bl'

So we've got to get rid of the static device names for backlight and keypad.

I figured incoperating the i2c device name would make it generic enough.

The default device name if on i2c adapter 0 with addres 0x70 is '0-0070' which
might be fine for an input or framebuffer device, but IMO it looks odd for a
backlight device (/sys/class/backlight/0-0070/).

So I choose to prefix the default i2c device name (assigned in i2c-core.c) with
the driver name which will result in 'ht16k33-0-0070'.

 drivers/auxdisplay/ht16k33.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 99ce9731fc9c..674a6c0cec2a 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -339,7 +339,7 @@ static int ht16k33_keypad_probe(struct i2c_client *client,
 
input_set_drvdata(keypad->dev, keypad);
 
-   keypad->dev->name = DRIVER_NAME"-keypad";
+   keypad->dev->name = dev_name(>dev);
keypad->dev->id.bustype = BUS_I2C;
keypad->dev->open = ht16k33_keypad_start;
keypad->dev->close = ht16k33_keypad_stop;
@@ -421,6 +421,7 @@ static int ht16k33_probe(struct i2c_client *client,
 
priv->client = client;
i2c_set_clientdata(client, priv);
+   dev_set_name(>dev, DRIVER_NAME"-%s", dev_name(>dev));
fbdev = >fbdev;
 
err = ht16k33_initialize(priv);
@@ -476,7 +477,8 @@ static int ht16k33_probe(struct i2c_client *client,
bl_props.type = BACKLIGHT_RAW;
bl_props.max_brightness = MAX_BRIGHTNESS;
 
-   bl = devm_backlight_device_register(>dev, DRIVER_NAME"-bl",
+   bl = devm_backlight_device_register(>dev,
+   dev_name(>dev),
>dev, priv,
_bl_ops, _props);
if (IS_ERR(bl)) {
-- 
2.11.0



[PATCH] auxdisplay: ht16k33: Keyscan function should be optional

2017-08-16 Thread Robin van der Gracht
keyscan should be optional to support simple LED matrix displays (output only).

Reported-by: Michael Kaplan <m.kap...@evva.com>
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---

 Documentation/devicetree/bindings/display/ht16k33.txt | 15 +--
 drivers/auxdisplay/ht16k33.c  | 14 ++
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
index 8e5b30b87754..e2c9048ed9d4 100644
--- a/Documentation/devicetree/bindings/display/ht16k33.txt
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -4,18 +4,21 @@ Holtek ht16k33 RAM mapping 16*8 LED controller driver with 
keyscan
 Required properties:
 - compatible:  "holtek,ht16k33"
 - reg: I2C slave address of the chip.
-- interrupt-parent:A phandle pointing to the interrupt controller
-   serving the interrupt for this chip.
-- interrupts:  Interrupt specification for the key pressed interrupt.
 - refresh-rate-hz: Display update interval in HZ.
-- debounce-delay-ms:   Debouncing interval time in milliseconds.
-- linux,keymap:The keymap for keys as described in the binding
-   document (devicetree/bindings/input/matrix-keymap.txt).
 
 Optional properties:
 - linux,no-autorepeat: Disable keyrepeat.
 - default-brightness-level: Initial brightness level [0-15] (default: 15).
 
+- Keypad
+ Supply the 'interrupts' property to enable the keyscan feature.
+ - interrupts: Interrupt specification for the key pressed interrupt.
+ - interrupt-parent:   A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+ - debounce-delay-ms:  Debouncing interval time in milliseconds.
+ - linux,keymap:   The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
 Example:
 
  {
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 674a6c0cec2a..14b268388ef9 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -410,11 +410,6 @@ static int ht16k33_probe(struct i2c_client *client,
return -EIO;
}
 
-   if (client->irq <= 0) {
-   dev_err(>dev, "No IRQ specified\n");
-   return -EINVAL;
-   }
-
priv = devm_kzalloc(>dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -468,9 +463,12 @@ static int ht16k33_probe(struct i2c_client *client,
if (err)
goto err_fbdev_info;
 
-   err = ht16k33_keypad_probe(client, >keypad);
-   if (err)
-   goto err_fbdev_unregister;
+   /* Keypad */
+   if (client->irq > 0) {
+   err = ht16k33_keypad_probe(client, >keypad);
+   if (err)
+   goto err_fbdev_unregister;
+   }
 
/* Backlight */
memset(_props, 0, sizeof(struct backlight_properties));
-- 
2.11.0



[PATCH] auxdisplay: ht16k33: Keyscan function should be optional

2017-08-16 Thread Robin van der Gracht
keyscan should be optional to support simple LED matrix displays (output only).

Reported-by: Michael Kaplan 
Signed-off-by: Robin van der Gracht 
---

 Documentation/devicetree/bindings/display/ht16k33.txt | 15 +--
 drivers/auxdisplay/ht16k33.c  | 14 ++
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
index 8e5b30b87754..e2c9048ed9d4 100644
--- a/Documentation/devicetree/bindings/display/ht16k33.txt
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -4,18 +4,21 @@ Holtek ht16k33 RAM mapping 16*8 LED controller driver with 
keyscan
 Required properties:
 - compatible:  "holtek,ht16k33"
 - reg: I2C slave address of the chip.
-- interrupt-parent:A phandle pointing to the interrupt controller
-   serving the interrupt for this chip.
-- interrupts:  Interrupt specification for the key pressed interrupt.
 - refresh-rate-hz: Display update interval in HZ.
-- debounce-delay-ms:   Debouncing interval time in milliseconds.
-- linux,keymap:The keymap for keys as described in the binding
-   document (devicetree/bindings/input/matrix-keymap.txt).
 
 Optional properties:
 - linux,no-autorepeat: Disable keyrepeat.
 - default-brightness-level: Initial brightness level [0-15] (default: 15).
 
+- Keypad
+ Supply the 'interrupts' property to enable the keyscan feature.
+ - interrupts: Interrupt specification for the key pressed interrupt.
+ - interrupt-parent:   A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+ - debounce-delay-ms:  Debouncing interval time in milliseconds.
+ - linux,keymap:   The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
 Example:
 
  {
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 674a6c0cec2a..14b268388ef9 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -410,11 +410,6 @@ static int ht16k33_probe(struct i2c_client *client,
return -EIO;
}
 
-   if (client->irq <= 0) {
-   dev_err(>dev, "No IRQ specified\n");
-   return -EINVAL;
-   }
-
priv = devm_kzalloc(>dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -468,9 +463,12 @@ static int ht16k33_probe(struct i2c_client *client,
if (err)
goto err_fbdev_info;
 
-   err = ht16k33_keypad_probe(client, >keypad);
-   if (err)
-   goto err_fbdev_unregister;
+   /* Keypad */
+   if (client->irq > 0) {
+   err = ht16k33_keypad_probe(client, >keypad);
+   if (err)
+   goto err_fbdev_unregister;
+   }
 
/* Backlight */
memset(_props, 0, sizeof(struct backlight_properties));
-- 
2.11.0



Re: [PATCH] auxdisplay: ht16k33: use le16_to_cpup() to fetch LE16 data

2017-03-29 Thread Robin van der Gracht
On Wed, 29 Mar 2017 00:42:08 -0700
Dmitry Torokhov  wrote:

> The data read from the device is 3 little-endian words, so let's annotate
> them as such and use le16_to_cpu() to convert them to host endianness - it
> might turn out to be a bit more performant, and it expresses the conversion
> more clearly.

Agreed

> 
> Signed-off-by: Dmitry Torokhov 
> ---
>  drivers/auxdisplay/ht16k33.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index f66b45b235b0..61af52a7afd5 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -254,18 +254,19 @@ static bool ht16k33_keypad_scan(struct ht16k33_keypad 
> *keypad)
>  {
>   const unsigned short *keycodes = keypad->dev->keycode;
>   u16 new_state[HT16K33_MATRIX_KEYPAD_MAX_COLS];
> - u8 data[HT16K33_MATRIX_KEYPAD_MAX_COLS * 2];
> + __le16 data[HT16K33_MATRIX_KEYPAD_MAX_COLS];
>   unsigned long bits_changed;
>   int row, col, code;
>   bool pressed = false;
>  
> - if (i2c_smbus_read_i2c_block_data(keypad->client, 0x40, 6, data) != 6) {
> + if (i2c_smbus_read_i2c_block_data(keypad->client, 0x40,
> +   sizeof(data), (u8 *)data) != 6) {

Why use sizeof(data) for length but check against the hardcoded 6?

>   dev_err(>client->dev, "Failed to read key data\n");
>   return false;
>   }
>  
>   for (col = 0; col < keypad->cols; col++) {
> - new_state[col] = (data[col * 2 + 1] << 8) | data[col * 2];
> + new_state[col] = le16_to_cpu(data[col]);

nice!

>   if (new_state[col])
>   pressed = true;
>   bits_changed = keypad->last_key_state[col] ^ new_state[col];

Robin


Re: [PATCH] auxdisplay: ht16k33: use le16_to_cpup() to fetch LE16 data

2017-03-29 Thread Robin van der Gracht
On Wed, 29 Mar 2017 00:42:08 -0700
Dmitry Torokhov  wrote:

> The data read from the device is 3 little-endian words, so let's annotate
> them as such and use le16_to_cpu() to convert them to host endianness - it
> might turn out to be a bit more performant, and it expresses the conversion
> more clearly.

Agreed

> 
> Signed-off-by: Dmitry Torokhov 
> ---
>  drivers/auxdisplay/ht16k33.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index f66b45b235b0..61af52a7afd5 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -254,18 +254,19 @@ static bool ht16k33_keypad_scan(struct ht16k33_keypad 
> *keypad)
>  {
>   const unsigned short *keycodes = keypad->dev->keycode;
>   u16 new_state[HT16K33_MATRIX_KEYPAD_MAX_COLS];
> - u8 data[HT16K33_MATRIX_KEYPAD_MAX_COLS * 2];
> + __le16 data[HT16K33_MATRIX_KEYPAD_MAX_COLS];
>   unsigned long bits_changed;
>   int row, col, code;
>   bool pressed = false;
>  
> - if (i2c_smbus_read_i2c_block_data(keypad->client, 0x40, 6, data) != 6) {
> + if (i2c_smbus_read_i2c_block_data(keypad->client, 0x40,
> +   sizeof(data), (u8 *)data) != 6) {

Why use sizeof(data) for length but check against the hardcoded 6?

>   dev_err(>client->dev, "Failed to read key data\n");
>   return false;
>   }
>  
>   for (col = 0; col < keypad->cols; col++) {
> - new_state[col] = (data[col * 2 + 1] << 8) | data[col * 2];
> + new_state[col] = le16_to_cpu(data[col]);

nice!

>   if (new_state[col])
>   pressed = true;
>   bits_changed = keypad->last_key_state[col] ^ new_state[col];

Robin


Re: [PATCH] auxdisplay: ht16k33: don't access uninitialized data

2017-03-29 Thread Robin van der Gracht
On Tue, 28 Mar 2017 12:11:49 +0200
Arnd Bergmann <a...@arndb.de> wrote:

> gcc-7.0.1 points out that we copy uninitialized data from the stack
> into a per-device structure:
> 
> drivers/auxdisplay/ht16k33.c: In function 'ht16k33_keypad_irq_thread':
> arch/x86/include/asm/string_32.h:78:16: error: 'new_state' may be used 
> uninitialized in this function [-Werror=maybe-uninitialized]
> arch/x86/include/asm/string_32.h:79:22: error: '*((void *)_state+4)' may 
> be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> The access is harmless because we never read the data, but we are better
> off not doing this, so this changes the code to only copy the data
> that was actually initialized. To make sure we don't overflow the
> stack with an incorrect DT, we also need to add a sanity checkin the
> probe function.
> 
> Signed-off-by: Arnd Bergmann <a...@arndb.de>

Reviewed-by: Robin van der Gracht <ro...@protonic.nl>

> ---
>  drivers/auxdisplay/ht16k33.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index f66b45b235b0..ba6370974574 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -278,7 +278,7 @@ static bool ht16k33_keypad_scan(struct ht16k33_keypad 
> *keypad)
>   }
>   }
>   input_sync(keypad->dev);
> - memcpy(keypad->last_key_state, new_state, sizeof(new_state));
> + memcpy(keypad->last_key_state, new_state, sizeof(u16) * keypad->cols);
>  
>   return pressed;
>  }
> @@ -353,6 +353,12 @@ static int ht16k33_keypad_probe(struct i2c_client 
> *client,
>   err = matrix_keypad_parse_of_params(>dev, , );
>   if (err)
>   return err;
> + if (rows > HT16K33_MATRIX_KEYPAD_MAX_ROWS ||
> + cols > HT16K33_MATRIX_KEYPAD_MAX_COLS) {
> + dev_err(>dev, "%u rows or %u cols out of range in DT\n",
> + rows, cols);
> + return -ERANGE;
> + }
>  
>   keypad->rows = rows;
>   keypad->cols = cols;


Re: [PATCH] auxdisplay: ht16k33: don't access uninitialized data

2017-03-29 Thread Robin van der Gracht
On Tue, 28 Mar 2017 12:11:49 +0200
Arnd Bergmann  wrote:

> gcc-7.0.1 points out that we copy uninitialized data from the stack
> into a per-device structure:
> 
> drivers/auxdisplay/ht16k33.c: In function 'ht16k33_keypad_irq_thread':
> arch/x86/include/asm/string_32.h:78:16: error: 'new_state' may be used 
> uninitialized in this function [-Werror=maybe-uninitialized]
> arch/x86/include/asm/string_32.h:79:22: error: '*((void *)_state+4)' may 
> be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> The access is harmless because we never read the data, but we are better
> off not doing this, so this changes the code to only copy the data
> that was actually initialized. To make sure we don't overflow the
> stack with an incorrect DT, we also need to add a sanity checkin the
> probe function.
> 
> Signed-off-by: Arnd Bergmann 

Reviewed-by: Robin van der Gracht 

> ---
>  drivers/auxdisplay/ht16k33.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index f66b45b235b0..ba6370974574 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -278,7 +278,7 @@ static bool ht16k33_keypad_scan(struct ht16k33_keypad 
> *keypad)
>   }
>   }
>   input_sync(keypad->dev);
> - memcpy(keypad->last_key_state, new_state, sizeof(new_state));
> + memcpy(keypad->last_key_state, new_state, sizeof(u16) * keypad->cols);
>  
>   return pressed;
>  }
> @@ -353,6 +353,12 @@ static int ht16k33_keypad_probe(struct i2c_client 
> *client,
>   err = matrix_keypad_parse_of_params(>dev, , );
>   if (err)
>   return err;
> + if (rows > HT16K33_MATRIX_KEYPAD_MAX_ROWS ||
> + cols > HT16K33_MATRIX_KEYPAD_MAX_COLS) {
> + dev_err(>dev, "%u rows or %u cols out of range in DT\n",
> + rows, cols);
> + return -ERANGE;
> + }
>  
>   keypad->rows = rows;
>   keypad->cols = cols;


Re: [PATCH v3] clk: imx: clk-imx6ul: The i.mx6ul has no aips_tz3 clock

2017-03-14 Thread Robin van der Gracht
On Fri,  3 Mar 2017 15:14:05 +0100
Robin van der Gracht <ro...@protonic.nl> wrote:

> The clock was mapped on CG15 (gpio2_clocks) in the CCRG0 register.
> 
> Reviewed-by: Fabio Estevam <fabio.este...@nxp.com>
> Signed-off-by: Robin van der Gracht <ro...@protonic.nl>

Sasha or Shawn would you mind pushing this patch upstream?
I don't have a path.

Best regards,
Robin



Re: [PATCH v3] clk: imx: clk-imx6ul: The i.mx6ul has no aips_tz3 clock

2017-03-14 Thread Robin van der Gracht
On Fri,  3 Mar 2017 15:14:05 +0100
Robin van der Gracht  wrote:

> The clock was mapped on CG15 (gpio2_clocks) in the CCRG0 register.
> 
> Reviewed-by: Fabio Estevam 
> Signed-off-by: Robin van der Gracht 

Sasha or Shawn would you mind pushing this patch upstream?
I don't have a path.

Best regards,
Robin



[PATCH v2] clk: imx: correct uart4_serial clock name in driver for i.MX6UL

2017-03-06 Thread Robin van der Gracht
Reviewed-by: Fabio Estevam <fabio.este...@nxp.com>
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
v2: Rebased on latest mainline

 drivers/clk/imx/clk-imx6ul.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index dbd6e59..b4e0dff 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -358,7 +358,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT1_BUS]   = imx_clk_gate2("gpt1_bus", 
"perclk",   base + 0x6c,20);
clks[IMX6UL_CLK_GPT1_SERIAL]= imx_clk_gate2("gpt1_serial",  
"perclk",   base + 0x6c,22);
clks[IMX6UL_CLK_UART4_IPG]  = imx_clk_gate2("uart4_ipg","ipg",  
base + 0x6c,24);
-   clks[IMX6UL_CLK_UART4_SERIAL]   = imx_clk_gate2("uart4_serail", 
"uart_podf",base + 0x6c,24);
+   clks[IMX6UL_CLK_UART4_SERIAL]   = imx_clk_gate2("uart4_serial", 
"uart_podf",base + 0x6c,24);
 
/* CCGR2 */
if (clk_on_imx6ull()) {
-- 
2.9.3



[PATCH v2] clk: imx: correct uart4_serial clock name in driver for i.MX6UL

2017-03-06 Thread Robin van der Gracht
Reviewed-by: Fabio Estevam 
Signed-off-by: Robin van der Gracht 
---
v2: Rebased on latest mainline

 drivers/clk/imx/clk-imx6ul.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index dbd6e59..b4e0dff 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -358,7 +358,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT1_BUS]   = imx_clk_gate2("gpt1_bus", 
"perclk",   base + 0x6c,20);
clks[IMX6UL_CLK_GPT1_SERIAL]= imx_clk_gate2("gpt1_serial",  
"perclk",   base + 0x6c,22);
clks[IMX6UL_CLK_UART4_IPG]  = imx_clk_gate2("uart4_ipg","ipg",  
base + 0x6c,24);
-   clks[IMX6UL_CLK_UART4_SERIAL]   = imx_clk_gate2("uart4_serail", 
"uart_podf",base + 0x6c,24);
+   clks[IMX6UL_CLK_UART4_SERIAL]   = imx_clk_gate2("uart4_serial", 
"uart_podf",base + 0x6c,24);
 
/* CCGR2 */
if (clk_on_imx6ull()) {
-- 
2.9.3



[PATCH v3] clk: imx: clk-imx6ul: The i.mx6ul has no aips_tz3 clock

2017-03-03 Thread Robin van der Gracht
The clock was mapped on CG15 (gpio2_clocks) in the CCRG0 register.

Reviewed-by: Fabio Estevam <fabio.este...@nxp.com>
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
Fixed another title typo in v3

 drivers/clk/imx/clk-imx6ul.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 75c35fb..dbd6e59 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -73,7 +73,7 @@ static struct clk *clks[IMX6UL_CLK_END];
 static struct clk_onecell_data clk_data;
 
 static int const clks_init_on[] __initconst = {
-   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2, IMX6UL_CLK_AIPSTZ3,
+   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2,
IMX6UL_CLK_AXI, IMX6UL_CLK_ARM, IMX6UL_CLK_ROM,
IMX6UL_CLK_MMDC_P0_FAST, IMX6UL_CLK_MMDC_P0_IPG,
 };
@@ -341,9 +341,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT2_SERIAL]= imx_clk_gate2("gpt2_serial",  
"perclk",   base + 0x68,26);
clks[IMX6UL_CLK_UART2_IPG]  = imx_clk_gate2("uart2_ipg","ipg",  
base + 0x68,28);
clks[IMX6UL_CLK_UART2_SERIAL]   = imx_clk_gate2("uart2_serial", 
"uart_podf",base + 0x68,28);
-   if (clk_on_imx6ul())
-   clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",  base + 0x68,30);
-   else if (clk_on_imx6ull())
+   if (clk_on_imx6ull())
clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",   base + 0x80,   18);
 
/* CCGR1 */
@@ -482,6 +480,9 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
 
+   if (clk_on_imx6ull())
+   clk_prepare_enable(clks[IMX6UL_CLK_AIPSTZ3]);
+
if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY1_GATE]);
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY2_GATE]);
-- 
2.9.3



[PATCH v3] clk: imx: clk-imx6ul: The i.mx6ul has no aips_tz3 clock

2017-03-03 Thread Robin van der Gracht
The clock was mapped on CG15 (gpio2_clocks) in the CCRG0 register.

Reviewed-by: Fabio Estevam 
Signed-off-by: Robin van der Gracht 
---
Fixed another title typo in v3

 drivers/clk/imx/clk-imx6ul.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 75c35fb..dbd6e59 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -73,7 +73,7 @@ static struct clk *clks[IMX6UL_CLK_END];
 static struct clk_onecell_data clk_data;
 
 static int const clks_init_on[] __initconst = {
-   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2, IMX6UL_CLK_AIPSTZ3,
+   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2,
IMX6UL_CLK_AXI, IMX6UL_CLK_ARM, IMX6UL_CLK_ROM,
IMX6UL_CLK_MMDC_P0_FAST, IMX6UL_CLK_MMDC_P0_IPG,
 };
@@ -341,9 +341,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT2_SERIAL]= imx_clk_gate2("gpt2_serial",  
"perclk",   base + 0x68,26);
clks[IMX6UL_CLK_UART2_IPG]  = imx_clk_gate2("uart2_ipg","ipg",  
base + 0x68,28);
clks[IMX6UL_CLK_UART2_SERIAL]   = imx_clk_gate2("uart2_serial", 
"uart_podf",base + 0x68,28);
-   if (clk_on_imx6ul())
-   clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",  base + 0x68,30);
-   else if (clk_on_imx6ull())
+   if (clk_on_imx6ull())
clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",   base + 0x80,   18);
 
/* CCGR1 */
@@ -482,6 +480,9 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
 
+   if (clk_on_imx6ull())
+   clk_prepare_enable(clks[IMX6UL_CLK_AIPSTZ3]);
+
if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY1_GATE]);
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY2_GATE]);
-- 
2.9.3



[PATCH v2] clk: imx: clk-imxul: The i.mx6ul has no aips_tz3 clock

2017-03-03 Thread Robin van der Gracht
The clock was mapped on CG15 (gpio2_clocks) in the CCRG0 register.

Reviewed-by: Fabio Estevam <fabio.este...@nxp.com>
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
 drivers/clk/imx/clk-imx6ul.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 75c35fb..dbd6e59 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -73,7 +73,7 @@ static struct clk *clks[IMX6UL_CLK_END];
 static struct clk_onecell_data clk_data;
 
 static int const clks_init_on[] __initconst = {
-   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2, IMX6UL_CLK_AIPSTZ3,
+   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2,
IMX6UL_CLK_AXI, IMX6UL_CLK_ARM, IMX6UL_CLK_ROM,
IMX6UL_CLK_MMDC_P0_FAST, IMX6UL_CLK_MMDC_P0_IPG,
 };
@@ -341,9 +341,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT2_SERIAL]= imx_clk_gate2("gpt2_serial",  
"perclk",   base + 0x68,26);
clks[IMX6UL_CLK_UART2_IPG]  = imx_clk_gate2("uart2_ipg","ipg",  
base + 0x68,28);
clks[IMX6UL_CLK_UART2_SERIAL]   = imx_clk_gate2("uart2_serial", 
"uart_podf",base + 0x68,28);
-   if (clk_on_imx6ul())
-   clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",  base + 0x68,30);
-   else if (clk_on_imx6ull())
+   if (clk_on_imx6ull())
clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",   base + 0x80,   18);
 
/* CCGR1 */
@@ -482,6 +480,9 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
 
+   if (clk_on_imx6ull())
+   clk_prepare_enable(clks[IMX6UL_CLK_AIPSTZ3]);
+
if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY1_GATE]);
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY2_GATE]);
-- 
2.9.3



[PATCH v2] clk: imx: clk-imxul: The i.mx6ul has no aips_tz3 clock

2017-03-03 Thread Robin van der Gracht
The clock was mapped on CG15 (gpio2_clocks) in the CCRG0 register.

Reviewed-by: Fabio Estevam 
Signed-off-by: Robin van der Gracht 
---
 drivers/clk/imx/clk-imx6ul.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 75c35fb..dbd6e59 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -73,7 +73,7 @@ static struct clk *clks[IMX6UL_CLK_END];
 static struct clk_onecell_data clk_data;
 
 static int const clks_init_on[] __initconst = {
-   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2, IMX6UL_CLK_AIPSTZ3,
+   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2,
IMX6UL_CLK_AXI, IMX6UL_CLK_ARM, IMX6UL_CLK_ROM,
IMX6UL_CLK_MMDC_P0_FAST, IMX6UL_CLK_MMDC_P0_IPG,
 };
@@ -341,9 +341,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT2_SERIAL]= imx_clk_gate2("gpt2_serial",  
"perclk",   base + 0x68,26);
clks[IMX6UL_CLK_UART2_IPG]  = imx_clk_gate2("uart2_ipg","ipg",  
base + 0x68,28);
clks[IMX6UL_CLK_UART2_SERIAL]   = imx_clk_gate2("uart2_serial", 
"uart_podf",base + 0x68,28);
-   if (clk_on_imx6ul())
-   clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",  base + 0x68,30);
-   else if (clk_on_imx6ull())
+   if (clk_on_imx6ull())
clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",   base + 0x80,   18);
 
/* CCGR1 */
@@ -482,6 +480,9 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
 
+   if (clk_on_imx6ull())
+   clk_prepare_enable(clks[IMX6UL_CLK_AIPSTZ3]);
+
if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY1_GATE]);
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY2_GATE]);
-- 
2.9.3



[PATCH] clk: imx: clk-imxul: The i.mx6ul has no aips_tx3 clock

2017-03-03 Thread Robin van der Gracht
The clock was mapped on CG15 (gpio2_clocks) in the CCRG0 register.

Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
 drivers/clk/imx/clk-imx6ul.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 75c35fb..dbd6e59 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -73,7 +73,7 @@ static struct clk *clks[IMX6UL_CLK_END];
 static struct clk_onecell_data clk_data;
 
 static int const clks_init_on[] __initconst = {
-   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2, IMX6UL_CLK_AIPSTZ3,
+   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2,
IMX6UL_CLK_AXI, IMX6UL_CLK_ARM, IMX6UL_CLK_ROM,
IMX6UL_CLK_MMDC_P0_FAST, IMX6UL_CLK_MMDC_P0_IPG,
 };
@@ -341,9 +341,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT2_SERIAL]= imx_clk_gate2("gpt2_serial",  
"perclk",   base + 0x68,26);
clks[IMX6UL_CLK_UART2_IPG]  = imx_clk_gate2("uart2_ipg","ipg",  
base + 0x68,28);
clks[IMX6UL_CLK_UART2_SERIAL]   = imx_clk_gate2("uart2_serial", 
"uart_podf",base + 0x68,28);
-   if (clk_on_imx6ul())
-   clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",  base + 0x68,30);
-   else if (clk_on_imx6ull())
+   if (clk_on_imx6ull())
clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",   base + 0x80,   18);
 
/* CCGR1 */
@@ -482,6 +480,9 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
 
+   if (clk_on_imx6ull())
+   clk_prepare_enable(clks[IMX6UL_CLK_AIPSTZ3]);
+
if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY1_GATE]);
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY2_GATE]);
-- 
2.9.3



[PATCH] clk: imx: clk-imxul: The i.mx6ul has no aips_tx3 clock

2017-03-03 Thread Robin van der Gracht
The clock was mapped on CG15 (gpio2_clocks) in the CCRG0 register.

Signed-off-by: Robin van der Gracht 
---
 drivers/clk/imx/clk-imx6ul.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 75c35fb..dbd6e59 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -73,7 +73,7 @@ static struct clk *clks[IMX6UL_CLK_END];
 static struct clk_onecell_data clk_data;
 
 static int const clks_init_on[] __initconst = {
-   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2, IMX6UL_CLK_AIPSTZ3,
+   IMX6UL_CLK_AIPSTZ1, IMX6UL_CLK_AIPSTZ2,
IMX6UL_CLK_AXI, IMX6UL_CLK_ARM, IMX6UL_CLK_ROM,
IMX6UL_CLK_MMDC_P0_FAST, IMX6UL_CLK_MMDC_P0_IPG,
 };
@@ -341,9 +341,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT2_SERIAL]= imx_clk_gate2("gpt2_serial",  
"perclk",   base + 0x68,26);
clks[IMX6UL_CLK_UART2_IPG]  = imx_clk_gate2("uart2_ipg","ipg",  
base + 0x68,28);
clks[IMX6UL_CLK_UART2_SERIAL]   = imx_clk_gate2("uart2_serial", 
"uart_podf",base + 0x68,28);
-   if (clk_on_imx6ul())
-   clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",  base + 0x68,30);
-   else if (clk_on_imx6ull())
+   if (clk_on_imx6ull())
clks[IMX6UL_CLK_AIPSTZ3]= imx_clk_gate2("aips_tz3", 
"ahb",   base + 0x80,   18);
 
/* CCGR1 */
@@ -482,6 +480,9 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
 
+   if (clk_on_imx6ull())
+   clk_prepare_enable(clks[IMX6UL_CLK_AIPSTZ3]);
+
if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY1_GATE]);
clk_prepare_enable(clks[IMX6UL_CLK_USBPHY2_GATE]);
-- 
2.9.3



[PATCH] clk: imx: correct uart4_serial clock name in driver for i.MX6UL

2017-03-03 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
 drivers/clk/imx/clk-imx6ul.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 0f1f17a..4dcd107 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -325,7 +325,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT1_BUS]   = imx_clk_gate2("gpt1_bus", 
"perclk",   base + 0x6c,20);
clks[IMX6UL_CLK_GPT1_SERIAL]= imx_clk_gate2("gpt1_serial",  
"perclk",   base + 0x6c,22);
clks[IMX6UL_CLK_UART4_IPG]  = imx_clk_gate2("uart4_ipg","ipg",  
base + 0x6c,24);
-   clks[IMX6UL_CLK_UART4_SERIAL]   = imx_clk_gate2("uart4_serail", 
"uart_podf",base + 0x6c,24);
+   clks[IMX6UL_CLK_UART4_SERIAL]   = imx_clk_gate2("uart4_serial", 
"uart_podf",base + 0x6c,24);
 
/* CCGR2 */
clks[IMX6UL_CLK_CSI]= imx_clk_gate2("csi",  
"csi_podf", base + 0x70,2);
-- 
2.9.3



[PATCH] clk: imx: correct uart4_serial clock name in driver for i.MX6UL

2017-03-03 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht 
---
 drivers/clk/imx/clk-imx6ul.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 0f1f17a..4dcd107 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -325,7 +325,7 @@ static void __init imx6ul_clocks_init(struct device_node 
*ccm_node)
clks[IMX6UL_CLK_GPT1_BUS]   = imx_clk_gate2("gpt1_bus", 
"perclk",   base + 0x6c,20);
clks[IMX6UL_CLK_GPT1_SERIAL]= imx_clk_gate2("gpt1_serial",  
"perclk",   base + 0x6c,22);
clks[IMX6UL_CLK_UART4_IPG]  = imx_clk_gate2("uart4_ipg","ipg",  
base + 0x6c,24);
-   clks[IMX6UL_CLK_UART4_SERIAL]   = imx_clk_gate2("uart4_serail", 
"uart_podf",base + 0x6c,24);
+   clks[IMX6UL_CLK_UART4_SERIAL]   = imx_clk_gate2("uart4_serial", 
"uart_podf",base + 0x6c,24);
 
/* CCGR2 */
clks[IMX6UL_CLK_CSI]= imx_clk_gate2("csi",  
"csi_podf", base + 0x70,2);
-- 
2.9.3



Re: [PATCH v2 2/3] auxdisplay: ht16k33: rework input device initialization

2017-02-10 Thread Robin van der Gracht
On Thu,  9 Feb 2017 10:15:52 -0800
Dmitry Torokhov <dmitry.torok...@gmail.com> wrote:

> This patch fixes following issues in input device (keypad) handling:
> 
> - requesting IRQ before allocating and initializing parts of the device
>   that can be referenced from IRQ handler is racy, even if we try to
>   disable interrupt after requesting it. Let's move allocations around
>   so that everything is ready by the time we request IRQ.
> 
> - using threaded interrupt handler to schedule a work item it sub-optimal.
>   Disabling and then re-enabling interrupts in work item and in open/close
>   methods is prone to races and exactly the reason theraded interrupts were
>   introduced. Let's use the infrastructure properly and keep scanning the
>   matrix array in IRQ thread, stopping when there are no keys, or when told
>   to do so.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torok...@gmail.com>
> ---
> 
> v2: addressed Robin's feedback - changed interrupt trigger from
> IRQF_TRIGGER_RISING to IRQF_TRIGGER_HIGH
> 

Works like a charm!

Tested-by: Robin van der Gracht <ro...@protonic.nl>


Re: [PATCH v2 2/3] auxdisplay: ht16k33: rework input device initialization

2017-02-10 Thread Robin van der Gracht
On Thu,  9 Feb 2017 10:15:52 -0800
Dmitry Torokhov  wrote:

> This patch fixes following issues in input device (keypad) handling:
> 
> - requesting IRQ before allocating and initializing parts of the device
>   that can be referenced from IRQ handler is racy, even if we try to
>   disable interrupt after requesting it. Let's move allocations around
>   so that everything is ready by the time we request IRQ.
> 
> - using threaded interrupt handler to schedule a work item it sub-optimal.
>   Disabling and then re-enabling interrupts in work item and in open/close
>   methods is prone to races and exactly the reason theraded interrupts were
>   introduced. Let's use the infrastructure properly and keep scanning the
>   matrix array in IRQ thread, stopping when there are no keys, or when told
>   to do so.
> 
> Signed-off-by: Dmitry Torokhov 
> ---
> 
> v2: addressed Robin's feedback - changed interrupt trigger from
> IRQF_TRIGGER_RISING to IRQF_TRIGGER_HIGH
> 

Works like a charm!

Tested-by: Robin van der Gracht 


Re: [PATCH 3/3] auxdisplay: ht16k33: remove private workqueue

2017-02-08 Thread Robin van der Gracht
On Tue, 31 Jan 2017 12:54:38 -0800
Dmitry Torokhov <dmitry.torok...@gmail.com> wrote:

> There is no need for the driver to user private workqueue, standard system
> workqueue should suffice as they going to use the same worker pool anyway.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torok...@gmail.com>
> ---
>  drivers/auxdisplay/ht16k33.c | 20 +---
>  1 file changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index b2fbe68c7fa9..533886a59cec 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -80,7 +80,6 @@ struct ht16k33_priv {
>   struct i2c_client *client;
>   struct ht16k33_keypad keypad;
>   struct ht16k33_fbdev fbdev;
> - struct workqueue_struct *workqueue;
>  };
>  
>  static struct fb_fix_screeninfo ht16k33_fb_fix = {
> @@ -126,8 +125,8 @@ static void ht16k33_fb_queue(struct ht16k33_priv *priv)
>  {
>   struct ht16k33_fbdev *fbdev = >fbdev;
>  
> - queue_delayed_work(priv->workqueue, >work,
> - msecs_to_jiffies(HZ / fbdev->refresh_rate));
> + schedule_delayed_work(>work,
> +   msecs_to_jiffies(HZ / fbdev->refresh_rate));
>  }
>  
>  /*
> @@ -414,21 +413,15 @@ static int ht16k33_probe(struct i2c_client *client,
>   i2c_set_clientdata(client, priv);
>   fbdev = >fbdev;
>  
> - priv->workqueue = create_singlethread_workqueue(DRIVER_NAME "-wq");
> - if (priv->workqueue == NULL)
> - return -ENOMEM;
> -
>   err = ht16k33_initialize(priv);
>   if (err)
> - goto err_destroy_wq;
> + return err;
>  
>   /* Framebuffer (2 bytes per column) */
>   BUILD_BUG_ON(PAGE_SIZE < HT16K33_FB_SIZE);
>   fbdev->buffer = (unsigned char *) get_zeroed_page(GFP_KERNEL);
> - if (!fbdev->buffer) {
> - err = -ENOMEM;
> - goto err_destroy_wq;
> - }
> + if (!fbdev->buffer)
> + return -ENOMEM;
>  
>   fbdev->cache = devm_kmalloc(>dev, HT16K33_FB_SIZE, GFP_KERNEL);
>   if (!fbdev->cache) {
> @@ -505,8 +498,6 @@ static int ht16k33_probe(struct i2c_client *client,
>   framebuffer_release(fbdev->info);
>  err_fbdev_buffer:
>   free_page((unsigned long) fbdev->buffer);
> -err_destroy_wq:
> - destroy_workqueue(priv->workqueue);
>  
>   return err;
>  }
> @@ -521,7 +512,6 @@ static int ht16k33_remove(struct i2c_client *client)
>   framebuffer_release(fbdev->info);
>   free_page((unsigned long) fbdev->buffer);
>  
> - destroy_workqueue(priv->workqueue);
>   return 0;
>  }
>  

Acked-by: Robin van der Gracht <ro...@protonic.nl>


Re: [PATCH 3/3] auxdisplay: ht16k33: remove private workqueue

2017-02-08 Thread Robin van der Gracht
On Tue, 31 Jan 2017 12:54:38 -0800
Dmitry Torokhov  wrote:

> There is no need for the driver to user private workqueue, standard system
> workqueue should suffice as they going to use the same worker pool anyway.
> 
> Signed-off-by: Dmitry Torokhov 
> ---
>  drivers/auxdisplay/ht16k33.c | 20 +---
>  1 file changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index b2fbe68c7fa9..533886a59cec 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -80,7 +80,6 @@ struct ht16k33_priv {
>   struct i2c_client *client;
>   struct ht16k33_keypad keypad;
>   struct ht16k33_fbdev fbdev;
> - struct workqueue_struct *workqueue;
>  };
>  
>  static struct fb_fix_screeninfo ht16k33_fb_fix = {
> @@ -126,8 +125,8 @@ static void ht16k33_fb_queue(struct ht16k33_priv *priv)
>  {
>   struct ht16k33_fbdev *fbdev = >fbdev;
>  
> - queue_delayed_work(priv->workqueue, >work,
> - msecs_to_jiffies(HZ / fbdev->refresh_rate));
> + schedule_delayed_work(>work,
> +   msecs_to_jiffies(HZ / fbdev->refresh_rate));
>  }
>  
>  /*
> @@ -414,21 +413,15 @@ static int ht16k33_probe(struct i2c_client *client,
>   i2c_set_clientdata(client, priv);
>   fbdev = >fbdev;
>  
> - priv->workqueue = create_singlethread_workqueue(DRIVER_NAME "-wq");
> - if (priv->workqueue == NULL)
> - return -ENOMEM;
> -
>   err = ht16k33_initialize(priv);
>   if (err)
> - goto err_destroy_wq;
> + return err;
>  
>   /* Framebuffer (2 bytes per column) */
>   BUILD_BUG_ON(PAGE_SIZE < HT16K33_FB_SIZE);
>   fbdev->buffer = (unsigned char *) get_zeroed_page(GFP_KERNEL);
> - if (!fbdev->buffer) {
> - err = -ENOMEM;
> - goto err_destroy_wq;
> - }
> + if (!fbdev->buffer)
> + return -ENOMEM;
>  
>   fbdev->cache = devm_kmalloc(>dev, HT16K33_FB_SIZE, GFP_KERNEL);
>   if (!fbdev->cache) {
> @@ -505,8 +498,6 @@ static int ht16k33_probe(struct i2c_client *client,
>   framebuffer_release(fbdev->info);
>  err_fbdev_buffer:
>   free_page((unsigned long) fbdev->buffer);
> -err_destroy_wq:
> - destroy_workqueue(priv->workqueue);
>  
>   return err;
>  }
> @@ -521,7 +512,6 @@ static int ht16k33_remove(struct i2c_client *client)
>   framebuffer_release(fbdev->info);
>   free_page((unsigned long) fbdev->buffer);
>  
> - destroy_workqueue(priv->workqueue);
>   return 0;
>  }
>  

Acked-by: Robin van der Gracht 


Re: [PATCH 2/3] auxdisplay: ht16k33: rework input device initialization

2017-02-08 Thread Robin van der Gracht
On Tue, 31 Jan 2017 12:54:37 -0800
Dmitry Torokhov  wrote:

...

> +
> +static irqreturn_t ht16k33_keypad_irq_thread(int irq, void *dev)
> +{
> + struct ht16k33_keypad *keypad = dev;
> +
> + do {
> + wait_event_timeout(keypad->wait, keypad->stopped,
> + msecs_to_jiffies(keypad->debounce_ms));
> + if (keypad->stopped)
> + break;
> + } while (ht16k33_keypad_scan(keypad));

I like how you worked this one out! Its way cleaner and simpler.

> +
> + return IRQ_HANDLED;
> +}
> +
> +static int ht16k33_keypad_start(struct input_dev *dev)
> +{
> + struct ht16k33_keypad *keypad = input_get_drvdata(dev);
> +
> + keypad->stopped = false;
> + mb();
> + enable_irq(keypad->client->irq);
> +
> + return 0;
> +}
> +
> +static void ht16k33_keypad_stop(struct input_dev *dev)
> +{
> + struct ht16k33_keypad *keypad = input_get_drvdata(dev);
> +
> + keypad->stopped = true;
> + mb();
> + wake_up(>wait);
> + disable_irq(keypad->client->irq);
> +}

Nice!

> +
> +static int ht16k33_keypad_probe(struct i2c_client *client,
> + struct ht16k33_keypad *keypad)
> +{

...

> +
> + err = devm_request_threaded_irq(>dev, client->irq,
> + NULL, ht16k33_keypad_irq_thread,
> + IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> + DRIVER_NAME, keypad);

I believe the interrupt trigger should be switched to IRQF_TRIGGER_HIGH
combined with IRQF_ONESHOT, for this new setup. This is causing a race
condition.

In the previous situation a 'key data' read was triggered by
ht16k33_keypad_start(). This cleared the IRQ and gave a (somewhat racy)
known state. Now, when the IRQ line is HIGH during probe keyscan
wont work. 

Also, when ht16k33_keypad_stop() is run while the irq thread is waiting
for debounce, the scan will be skipped and irq will never be cleared.
This also breaks keyscan.

Regards,
Robin


Re: [PATCH 2/3] auxdisplay: ht16k33: rework input device initialization

2017-02-08 Thread Robin van der Gracht
On Tue, 31 Jan 2017 12:54:37 -0800
Dmitry Torokhov  wrote:

...

> +
> +static irqreturn_t ht16k33_keypad_irq_thread(int irq, void *dev)
> +{
> + struct ht16k33_keypad *keypad = dev;
> +
> + do {
> + wait_event_timeout(keypad->wait, keypad->stopped,
> + msecs_to_jiffies(keypad->debounce_ms));
> + if (keypad->stopped)
> + break;
> + } while (ht16k33_keypad_scan(keypad));

I like how you worked this one out! Its way cleaner and simpler.

> +
> + return IRQ_HANDLED;
> +}
> +
> +static int ht16k33_keypad_start(struct input_dev *dev)
> +{
> + struct ht16k33_keypad *keypad = input_get_drvdata(dev);
> +
> + keypad->stopped = false;
> + mb();
> + enable_irq(keypad->client->irq);
> +
> + return 0;
> +}
> +
> +static void ht16k33_keypad_stop(struct input_dev *dev)
> +{
> + struct ht16k33_keypad *keypad = input_get_drvdata(dev);
> +
> + keypad->stopped = true;
> + mb();
> + wake_up(>wait);
> + disable_irq(keypad->client->irq);
> +}

Nice!

> +
> +static int ht16k33_keypad_probe(struct i2c_client *client,
> + struct ht16k33_keypad *keypad)
> +{

...

> +
> + err = devm_request_threaded_irq(>dev, client->irq,
> + NULL, ht16k33_keypad_irq_thread,
> + IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> + DRIVER_NAME, keypad);

I believe the interrupt trigger should be switched to IRQF_TRIGGER_HIGH
combined with IRQF_ONESHOT, for this new setup. This is causing a race
condition.

In the previous situation a 'key data' read was triggered by
ht16k33_keypad_start(). This cleared the IRQ and gave a (somewhat racy)
known state. Now, when the IRQ line is HIGH during probe keyscan
wont work. 

Also, when ht16k33_keypad_stop() is run while the irq thread is waiting
for debounce, the scan will be skipped and irq will never be cleared.
This also breaks keyscan.

Regards,
Robin


Re: [PATCH 1/3] auxdisplay: ht16k33: do not try to free fbdev

2017-02-08 Thread Robin van der Gracht
On Tue, 31 Jan 2017 12:54:36 -0800
Dmitry Torokhov <dmitry.torok...@gmail.com> wrote:

> 'fbdev' is allocated as part of larger ht16k33_priv structure; trying to
> free it will cause troubles.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torok...@gmail.com>
> ---
> 
> Note that the patches have not been tried on a real hardware.
> 
> I am pretty confident in #1 and #3, but #2 is larger and it would be great
> if someone with hardware tried running it before it gets applied.
> 
> Thanks!
> 
>  drivers/auxdisplay/ht16k33.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index eeb323f56c07..f2f304b3f061 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -378,7 +378,7 @@ static int ht16k33_probe(struct i2c_client *client,
>   fbdev->buffer = (unsigned char *) get_zeroed_page(GFP_KERNEL);
>   if (!fbdev->buffer) {
>   err = -ENOMEM;
> - goto err_free_fbdev;
> + goto err_destroy_wq;
>   }
>  
>   fbdev->cache = devm_kmalloc(>dev, HT16K33_FB_SIZE, GFP_KERNEL);
> @@ -510,8 +510,6 @@ static int ht16k33_probe(struct i2c_client *client,
>   framebuffer_release(fbdev->info);
>  err_fbdev_buffer:
>   free_page((unsigned long) fbdev->buffer);
> -err_free_fbdev:
> - kfree(fbdev);
>  err_destroy_wq:
>   destroy_workqueue(priv->workqueue);
>  

Acked-by: Robin van der Gracht <ro...@protonic.nl>


Re: [PATCH 1/3] auxdisplay: ht16k33: do not try to free fbdev

2017-02-08 Thread Robin van der Gracht
On Tue, 31 Jan 2017 12:54:36 -0800
Dmitry Torokhov  wrote:

> 'fbdev' is allocated as part of larger ht16k33_priv structure; trying to
> free it will cause troubles.
> 
> Signed-off-by: Dmitry Torokhov 
> ---
> 
> Note that the patches have not been tried on a real hardware.
> 
> I am pretty confident in #1 and #3, but #2 is larger and it would be great
> if someone with hardware tried running it before it gets applied.
> 
> Thanks!
> 
>  drivers/auxdisplay/ht16k33.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index eeb323f56c07..f2f304b3f061 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -378,7 +378,7 @@ static int ht16k33_probe(struct i2c_client *client,
>   fbdev->buffer = (unsigned char *) get_zeroed_page(GFP_KERNEL);
>   if (!fbdev->buffer) {
>   err = -ENOMEM;
> - goto err_free_fbdev;
> + goto err_destroy_wq;
>   }
>  
>   fbdev->cache = devm_kmalloc(>dev, HT16K33_FB_SIZE, GFP_KERNEL);
> @@ -510,8 +510,6 @@ static int ht16k33_probe(struct i2c_client *client,
>   framebuffer_release(fbdev->info);
>  err_fbdev_buffer:
>   free_page((unsigned long) fbdev->buffer);
> -err_free_fbdev:
> - kfree(fbdev);
>  err_destroy_wq:
>   destroy_workqueue(priv->workqueue);
>  

Acked-by: Robin van der Gracht 


Re: [PATCH 1/3] auxdisplay: ht16k33: do not try to free fbdev

2017-02-07 Thread Robin van der Gracht
Hello Dmitry,

Thank you for submitting your changes. I was out of office last week
and I'll try to test and review your changes on my hardware this week.

Best regards,
Robin van der Gracht


Re: [PATCH 1/3] auxdisplay: ht16k33: do not try to free fbdev

2017-02-07 Thread Robin van der Gracht
Hello Dmitry,

Thank you for submitting your changes. I was out of office last week
and I'll try to test and review your changes on my hardware this week.

Best regards,
Robin van der Gracht


Re: [PATCH] auxdisplay: fix new ht16k33 build errors

2017-01-01 Thread Robin van der Gracht
On Mon, 26 Dec 2016 09:58:34 -0800
Randy Dunlap <rdun...@infradead.org> wrote:

> From: Randy Dunlap <rdun...@infradead.org>
> 
> Fix build errors caused by selecting incorrect kconfig symbols.
> 
> drivers/built-in.o:(.data+0x19cec): undefined reference to `sys_fillrect'
> drivers/built-in.o:(.data+0x19cf0): undefined reference to `sys_copyarea'
> drivers/built-in.o:(.data+0x19cf4): undefined reference to `sys_imageblit'
> 
> Fixes: 31114fa95bdb (auxdisplay: ht16k33: select framebuffer helper modules)
> 
> Signed-off-by: Randy Dunlap <rdun...@infradead.org>
> Cc:   Robin van der Gracht <ro...@protonic.nl>
> Cc:   Miguel Ojeda Sandonis <miguel.ojeda.sando...@gmail.com>
> Cc:   Greg Kroah-Hartman <gre...@linuxfoundation.org>
> Reported-by: kbuild test robot <fengguang...@intel.com>
> ---
>  drivers/auxdisplay/Kconfig |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> --- lnx-410-rc1.orig/drivers/auxdisplay/Kconfig
> +++ lnx-410-rc1/drivers/auxdisplay/Kconfig
> @@ -132,9 +132,9 @@ config HT16K33
>   tristate "Holtek Ht16K33 LED controller with keyscan"
>   depends on FB && OF && I2C && INPUT
>   select FB_SYS_FOPS
> - select FB_CFB_FILLRECT
> - select FB_CFB_COPYAREA
> - select FB_CFB_IMAGEBLIT
> + select FB_SYS_FILLRECT
> + select FB_SYS_COPYAREA
> + select FB_SYS_IMAGEBLIT
>   select INPUT_MATRIXKMAP
>   select FB_BACKLIGHT
>   help

Acked-by: Robin van der Gracht <ro...@protonic.nl>


Re: [PATCH] auxdisplay: fix new ht16k33 build errors

2017-01-01 Thread Robin van der Gracht
On Mon, 26 Dec 2016 09:58:34 -0800
Randy Dunlap  wrote:

> From: Randy Dunlap 
> 
> Fix build errors caused by selecting incorrect kconfig symbols.
> 
> drivers/built-in.o:(.data+0x19cec): undefined reference to `sys_fillrect'
> drivers/built-in.o:(.data+0x19cf0): undefined reference to `sys_copyarea'
> drivers/built-in.o:(.data+0x19cf4): undefined reference to `sys_imageblit'
> 
> Fixes: 31114fa95bdb (auxdisplay: ht16k33: select framebuffer helper modules)
> 
> Signed-off-by: Randy Dunlap 
> Cc:   Robin van der Gracht 
> Cc:   Miguel Ojeda Sandonis 
> Cc:   Greg Kroah-Hartman 
> Reported-by: kbuild test robot 
> ---
>  drivers/auxdisplay/Kconfig |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> --- lnx-410-rc1.orig/drivers/auxdisplay/Kconfig
> +++ lnx-410-rc1/drivers/auxdisplay/Kconfig
> @@ -132,9 +132,9 @@ config HT16K33
>   tristate "Holtek Ht16K33 LED controller with keyscan"
>   depends on FB && OF && I2C && INPUT
>   select FB_SYS_FOPS
> - select FB_CFB_FILLRECT
> - select FB_CFB_COPYAREA
> - select FB_CFB_IMAGEBLIT
> + select FB_SYS_FILLRECT
> + select FB_SYS_COPYAREA
> + select FB_SYS_IMAGEBLIT
>   select INPUT_MATRIXKMAP
>   select FB_BACKLIGHT
>   help

Acked-by: Robin van der Gracht 


[PATCH] auxdisplay: ht16k33: select framebuffer helper modules

2016-11-30 Thread Robin van der Gracht
The new driver caused a rare randconfig failure:

drivers/auxdisplay/ht16k33.o:(.data.ht16k33_fb_ops+0xc): undefined reference to 
`fb_sys_read'
drivers/auxdisplay/ht16k33.o:(.data.ht16k33_fb_ops+0x10): undefined reference 
to `fb_sys_write'

This selects the respective helper modules.

Reported-by: Arnd Bergmann <a...@arndb.de>
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---

Greg: Bugfix for your char-misc-* tree

 drivers/auxdisplay/Kconfig | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index a230ea7..4ef4c5c 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -131,6 +131,10 @@ config IMG_ASCII_LCD
 config HT16K33
tristate "Holtek Ht16K33 LED controller with keyscan"
depends on FB && OF && I2C && INPUT
+   select FB_SYS_FOPS
+   select FB_CFB_FILLRECT
+   select FB_CFB_COPYAREA
+   select FB_CFB_IMAGEBLIT
select INPUT_MATRIXKMAP
select FB_BACKLIGHT
help
-- 
2.7.4



[PATCH] auxdisplay: ht16k33: select framebuffer helper modules

2016-11-30 Thread Robin van der Gracht
The new driver caused a rare randconfig failure:

drivers/auxdisplay/ht16k33.o:(.data.ht16k33_fb_ops+0xc): undefined reference to 
`fb_sys_read'
drivers/auxdisplay/ht16k33.o:(.data.ht16k33_fb_ops+0x10): undefined reference 
to `fb_sys_write'

This selects the respective helper modules.

Reported-by: Arnd Bergmann 
Signed-off-by: Robin van der Gracht 
---

Greg: Bugfix for your char-misc-* tree

 drivers/auxdisplay/Kconfig | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index a230ea7..4ef4c5c 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -131,6 +131,10 @@ config IMG_ASCII_LCD
 config HT16K33
tristate "Holtek Ht16K33 LED controller with keyscan"
depends on FB && OF && I2C && INPUT
+   select FB_SYS_FOPS
+   select FB_CFB_FILLRECT
+   select FB_CFB_COPYAREA
+   select FB_CFB_IMAGEBLIT
select INPUT_MATRIXKMAP
select FB_BACKLIGHT
help
-- 
2.7.4



Re: [PATCH] auxdisplay: ht16k33: select required CONFIG_FB_CFB_* helpers

2016-11-29 Thread Robin van der Gracht
On Tue, 29 Nov 2016 21:04:30 +0100
Greg Kroah-Hartman <gre...@linuxfoundation.org> wrote:

> On Tue, Nov 29, 2016 at 08:55:50PM +0100, Arnd Bergmann wrote:
> > On Tuesday, November 29, 2016 8:42:47 PM CET Greg Kroah-Hartman wrote:  
> > > On Fri, Nov 25, 2016 at 10:50:07AM +0100, Robin van der Gracht wrote:  
> > > > This selects the respective helpers required in addition to the one
> > > > Arnd Bergmann pointer out earlier.
> > > > 
> > > > Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
> > > > ---
> > > > This is a responce to https://lkml.org/lkml/2016/11/25/66
> > > > This patch complements the changes Arnd submitted earlier. 
> > > > 
> > > >  drivers/auxdisplay/Kconfig | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > > 
> > > > diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
> > > > index b8bbfc6..4ef4c5c 100644
> > > > --- a/drivers/auxdisplay/Kconfig
> > > > +++ b/drivers/auxdisplay/Kconfig
> > > > @@ -132,6 +132,9 @@ config HT16K33
> > > > tristate "Holtek Ht16K33 LED controller with keyscan"
> > > > depends on FB && OF && I2C && INPUT
> > > > select FB_SYS_FOPS
> > > > +   select FB_CFB_FILLRECT
> > > > +   select FB_CFB_COPYAREA
> > > > +   select FB_CFB_IMAGEBLIT
> > > > select INPUT_MATRIXKMAP
> > > > select FB_BACKLIGHT
> > > > help  
> > > 
> > > What tree is this patch against?
> > > 
> > > thanks,
> > > 
> > > greg k-h
> > >   
> > 
> > It's on top of my patch "auxdisplay: ht16k33: select CONFIG_FB_SYS_FOPS"
> > from a few days ago. I guess Robin expected you to have picked that
> > up, while you expected him to combine it with the new changes.
> > 
> > Robin, I think it's easier if you send the combined patch and
> > add "Reported-by: Arnd Bergmann <a...@arndb.de>", as Greg has
> > probably already droppped my earlier patch from his queue.  
> 
> Yes, it's not in my queue anymore.
> 
> thanks,
> 
> greg k-h

I'll create a new patch.

Regards,
Robin


Re: [PATCH] auxdisplay: ht16k33: select required CONFIG_FB_CFB_* helpers

2016-11-29 Thread Robin van der Gracht
On Tue, 29 Nov 2016 21:04:30 +0100
Greg Kroah-Hartman  wrote:

> On Tue, Nov 29, 2016 at 08:55:50PM +0100, Arnd Bergmann wrote:
> > On Tuesday, November 29, 2016 8:42:47 PM CET Greg Kroah-Hartman wrote:  
> > > On Fri, Nov 25, 2016 at 10:50:07AM +0100, Robin van der Gracht wrote:  
> > > > This selects the respective helpers required in addition to the one
> > > > Arnd Bergmann pointer out earlier.
> > > > 
> > > > Signed-off-by: Robin van der Gracht 
> > > > ---
> > > > This is a responce to https://lkml.org/lkml/2016/11/25/66
> > > > This patch complements the changes Arnd submitted earlier. 
> > > > 
> > > >  drivers/auxdisplay/Kconfig | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > > 
> > > > diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
> > > > index b8bbfc6..4ef4c5c 100644
> > > > --- a/drivers/auxdisplay/Kconfig
> > > > +++ b/drivers/auxdisplay/Kconfig
> > > > @@ -132,6 +132,9 @@ config HT16K33
> > > > tristate "Holtek Ht16K33 LED controller with keyscan"
> > > > depends on FB && OF && I2C && INPUT
> > > > select FB_SYS_FOPS
> > > > +   select FB_CFB_FILLRECT
> > > > +   select FB_CFB_COPYAREA
> > > > +   select FB_CFB_IMAGEBLIT
> > > > select INPUT_MATRIXKMAP
> > > > select FB_BACKLIGHT
> > > > help  
> > > 
> > > What tree is this patch against?
> > > 
> > > thanks,
> > > 
> > > greg k-h
> > >   
> > 
> > It's on top of my patch "auxdisplay: ht16k33: select CONFIG_FB_SYS_FOPS"
> > from a few days ago. I guess Robin expected you to have picked that
> > up, while you expected him to combine it with the new changes.
> > 
> > Robin, I think it's easier if you send the combined patch and
> > add "Reported-by: Arnd Bergmann ", as Greg has
> > probably already droppped my earlier patch from his queue.  
> 
> Yes, it's not in my queue anymore.
> 
> thanks,
> 
> greg k-h

I'll create a new patch.

Regards,
Robin


[PATCH] auxdisplay: ht16k33: select required CONFIG_FB_CFB_* helpers

2016-11-25 Thread Robin van der Gracht
This selects the respective helpers required in addition to the one
Arnd Bergmann pointer out earlier.

Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
This is a responce to https://lkml.org/lkml/2016/11/25/66
This patch complements the changes Arnd submitted earlier. 

 drivers/auxdisplay/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index b8bbfc6..4ef4c5c 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -132,6 +132,9 @@ config HT16K33
tristate "Holtek Ht16K33 LED controller with keyscan"
depends on FB && OF && I2C && INPUT
select FB_SYS_FOPS
+   select FB_CFB_FILLRECT
+   select FB_CFB_COPYAREA
+   select FB_CFB_IMAGEBLIT
select INPUT_MATRIXKMAP
select FB_BACKLIGHT
help
-- 
2.7.4



[PATCH] auxdisplay: ht16k33: select required CONFIG_FB_CFB_* helpers

2016-11-25 Thread Robin van der Gracht
This selects the respective helpers required in addition to the one
Arnd Bergmann pointer out earlier.

Signed-off-by: Robin van der Gracht 
---
This is a responce to https://lkml.org/lkml/2016/11/25/66
This patch complements the changes Arnd submitted earlier. 

 drivers/auxdisplay/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index b8bbfc6..4ef4c5c 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -132,6 +132,9 @@ config HT16K33
tristate "Holtek Ht16K33 LED controller with keyscan"
depends on FB && OF && I2C && INPUT
select FB_SYS_FOPS
+   select FB_CFB_FILLRECT
+   select FB_CFB_COPYAREA
+   select FB_CFB_IMAGEBLIT
select INPUT_MATRIXKMAP
select FB_BACKLIGHT
help
-- 
2.7.4



Re: [PATCH] auxdisplay: ht16k33: select CONFIG_FB_SYS_FOPS

2016-11-24 Thread Robin van der Gracht
Hi Arnd,

On Wed, 23 Nov 2016 14:06:49 +0100
Arnd Bergmann  wrote:

> The new driver caused a rare randconfig failure:
> 
> drivers/auxdisplay/ht16k33.o:(.data.ht16k33_fb_ops+0xc): undefined reference 
> to `fb_sys_read'
> drivers/auxdisplay/ht16k33.o:(.data.ht16k33_fb_ops+0x10): undefined reference 
> to `fb_sys_write'
> 
> This selects the respective helper module, like all other
> such drivers do.

Thanks for reporting this. You are right about the missing helper.
However, the fb_ops struct uses several helpers which are all missing.

static struct fb_ops ht16k33_fb_ops = {
.owner = THIS_MODULE,
.fb_read = fb_sys_read,
.fb_write = fb_sys_write,
.fb_fillrect = sys_fillrect,
.fb_copyarea = sys_copyarea,
.fb_imageblit = sys_imageblit,
.fb_mmap = ht16k33_mmap,
};

HT16K33 should also select:
FB_CFB_FILLRECT
FB_CFB_COPYAREA
FB_CFB_IMAGEBLIT

> 
> Fixes: 8992da44c680 ("auxdisplay: ht16k33: Driver for LED controller")
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/auxdisplay/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
> index a230ea797b92..b8bbfc64a1d1 100644
> --- a/drivers/auxdisplay/Kconfig
> +++ b/drivers/auxdisplay/Kconfig
> @@ -131,6 +131,7 @@ config IMG_ASCII_LCD
>  config HT16K33
>   tristate "Holtek Ht16K33 LED controller with keyscan"
>   depends on FB && OF && I2C && INPUT
> + select FB_SYS_FOPS
>   select INPUT_MATRIXKMAP
>   select FB_BACKLIGHT
>   help

Regards,
Robin



Re: [PATCH] auxdisplay: ht16k33: select CONFIG_FB_SYS_FOPS

2016-11-24 Thread Robin van der Gracht
Hi Arnd,

On Wed, 23 Nov 2016 14:06:49 +0100
Arnd Bergmann  wrote:

> The new driver caused a rare randconfig failure:
> 
> drivers/auxdisplay/ht16k33.o:(.data.ht16k33_fb_ops+0xc): undefined reference 
> to `fb_sys_read'
> drivers/auxdisplay/ht16k33.o:(.data.ht16k33_fb_ops+0x10): undefined reference 
> to `fb_sys_write'
> 
> This selects the respective helper module, like all other
> such drivers do.

Thanks for reporting this. You are right about the missing helper.
However, the fb_ops struct uses several helpers which are all missing.

static struct fb_ops ht16k33_fb_ops = {
.owner = THIS_MODULE,
.fb_read = fb_sys_read,
.fb_write = fb_sys_write,
.fb_fillrect = sys_fillrect,
.fb_copyarea = sys_copyarea,
.fb_imageblit = sys_imageblit,
.fb_mmap = ht16k33_mmap,
};

HT16K33 should also select:
FB_CFB_FILLRECT
FB_CFB_COPYAREA
FB_CFB_IMAGEBLIT

> 
> Fixes: 8992da44c680 ("auxdisplay: ht16k33: Driver for LED controller")
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/auxdisplay/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
> index a230ea797b92..b8bbfc64a1d1 100644
> --- a/drivers/auxdisplay/Kconfig
> +++ b/drivers/auxdisplay/Kconfig
> @@ -131,6 +131,7 @@ config IMG_ASCII_LCD
>  config HT16K33
>   tristate "Holtek Ht16K33 LED controller with keyscan"
>   depends on FB && OF && I2C && INPUT
> + select FB_SYS_FOPS
>   select INPUT_MATRIXKMAP
>   select FB_BACKLIGHT
>   help

Regards,
Robin



[PATCH v7 RESEND 1/3] of: add vendor prefix for Holtek Semiconductor

2016-11-07 Thread Robin van der Gracht
This patch introduces a vendor prefix for Holtek Semiconductor Inc.

Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
Acked-by: Rob Herring <r...@kernel.org>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index f0a48ea..a955828 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -126,6 +126,7 @@ hitex   Hitex Development Tools
 holt   Holt Integrated Circuits, Inc.
 honeywell  Honeywell
 hp Hewlett Packard
+holtek Holtek Semiconductor, Inc.
 i2se   I2SE GmbH
 ibmInternational Business Machines (IBM)
 idtIntegrated Device Technologies, Inc.
-- 
2.7.4



[PATCH v7 RESEND 1/3] of: add vendor prefix for Holtek Semiconductor

2016-11-07 Thread Robin van der Gracht
This patch introduces a vendor prefix for Holtek Semiconductor Inc.

Signed-off-by: Robin van der Gracht 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index f0a48ea..a955828 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -126,6 +126,7 @@ hitex   Hitex Development Tools
 holt   Holt Integrated Circuits, Inc.
 honeywell  Honeywell
 hp Hewlett Packard
+holtek Holtek Semiconductor, Inc.
 i2se   I2SE GmbH
 ibmInternational Business Machines (IBM)
 idtIntegrated Device Technologies, Inc.
-- 
2.7.4



[PATCH v7 RESEND 2/3] auxdisplay: ht16k33: Driver for LED controller

2016-11-07 Thread Robin van der Gracht
Added a driver for the Holtek HT16K33 LED controller with keyscan.

Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
CC: Miguel Ojeda Sandonis <miguel.ojeda.sando...@gmail.com>
Acked-by: Rob Herring <r...@kernel.org>
Reviewed-by: Linus Walleij <linus.wall...@linaro.org>
---
 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 4 files changed, 615 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
new file mode 100644
index 000..8e5b30b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -0,0 +1,42 @@
+Holtek ht16k33 RAM mapping 16*8 LED controller driver with keyscan
+---
+
+Required properties:
+- compatible:  "holtek,ht16k33"
+- reg: I2C slave address of the chip.
+- interrupt-parent:A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+- interrupts:  Interrupt specification for the key pressed interrupt.
+- refresh-rate-hz: Display update interval in HZ.
+- debounce-delay-ms:   Debouncing interval time in milliseconds.
+- linux,keymap:The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
+Optional properties:
+- linux,no-autorepeat: Disable keyrepeat.
+- default-brightness-level: Initial brightness level [0-15] (default: 15).
+
+Example:
+
+ {
+   ht16k33: ht16k33@70 {
+   compatible = "holtek,ht16k33";
+   reg = <0x70>;
+   refresh-rate-hz = <20>;
+   debounce-delay-ms = <50>;
+   interrupt-parent = <>;
+   interrupts = <5 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>;
+   linux,keymap = <
+   MATRIX_KEY(2, 0, KEY_F6)
+   MATRIX_KEY(3, 0, KEY_F8)
+   MATRIX_KEY(4, 0, KEY_F10)
+   MATRIX_KEY(5, 0, KEY_F4)
+   MATRIX_KEY(6, 0, KEY_F2)
+   MATRIX_KEY(2, 1, KEY_F5)
+   MATRIX_KEY(3, 1, KEY_F7)
+   MATRIX_KEY(4, 1, KEY_F9)
+   MATRIX_KEY(5, 1, KEY_F3)
+   MATRIX_KEY(6, 1, KEY_F1)
+   >;
+   };
+};
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index 10e1b9e..a230ea7 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -128,4 +128,13 @@ config IMG_ASCII_LCD
  development boards such as the MIPS Boston, MIPS Malta & MIPS SEAD3
  from Imagination Technologies.
 
+config HT16K33
+   tristate "Holtek Ht16K33 LED controller with keyscan"
+   depends on FB && OF && I2C && INPUT
+   select INPUT_MATRIXKMAP
+   select FB_BACKLIGHT
+   help
+ Say yes here to add support for Holtek HT16K33, RAM mapping 16*8
+ LED controller driver with keyscan.
+
 endif # AUXDISPLAY
diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile
index 3127175..cb3dd84 100644
--- a/drivers/auxdisplay/Makefile
+++ b/drivers/auxdisplay/Makefile
@@ -5,3 +5,4 @@
 obj-$(CONFIG_KS0108)   += ks0108.o
 obj-$(CONFIG_CFAG12864B)   += cfag12864b.o cfag12864bfb.o
 obj-$(CONFIG_IMG_ASCII_LCD)+= img-ascii-lcd.o
+obj-$(CONFIG_HT16K33)  += ht16k33.o
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
new file mode 100644
index 000..eeb323f
--- /dev/null
+++ b/drivers/auxdisplay/ht16k33.c
@@ -0,0 +1,563 @@
+/*
+ * HT16K33 driver
+ *
+ * Author: Robin van der Gracht <ro...@protonic.nl>
+ *
+ * Copyright: (C) 2016 Protonic Holland.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Registers */
+#define REG_SYSTEM_SETUP   0x20
+#define REG_SYSTEM_SETUP_OSC_ONBIT(0)
+
+#define REG_DISPLAY_SETUP  0x80
+#define REG_DI

[PATCH v7 RESEND 3/3] MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

2016-11-07 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
CC: Miguel Ojeda Sandonis <miguel.ojeda.sando...@gmail.com>
Acked-by: Linus Walleij <linus.wall...@linaro.org>
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 411e3b8..15d9712 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3030,6 +3030,12 @@ F:   drivers/usb/host/whci/
 F: drivers/usb/wusbcore/
 F: include/linux/usb/wusb*
 
+HT16K33 LED CONTROLLER DRIVER
+M: Robin van der Gracht <ro...@protonic.nl>
+S: Maintained
+F: drivers/auxdisplay/ht16k33.c
+F: Documentation/devicetree/bindings/display/ht16k33.txt
+
 CFAG12864B LCD DRIVER
 M: Miguel Ojeda Sandonis <miguel.ojeda.sando...@gmail.com>
 W: http://miguelojeda.es/auxdisplay.htm
-- 
2.7.4



[PATCH v7 RESEND 0/3] auxdisplay: Introduce ht16k33 driver

2016-11-07 Thread Robin van der Gracht
Rebased and resend for Greg.

This patchset adds a new driver to the auxdisplay subsystem. It also adds
devicetree binding documentation and a new vendor prefix.

I added myself as maintainer to the MAINTAINERS file.

Robin van der Gracht (3):
  of: add vendor prefix for Holtek Semiconductor
  auxdisplay: ht16k33: Driver for LED controller
  MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 .../devicetree/bindings/vendor-prefixes.txt|   1 +
 MAINTAINERS|   6 +
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 6 files changed, 622 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

-- 
2.7.4



[PATCH v7 RESEND 3/3] MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

2016-11-07 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht 
CC: Miguel Ojeda Sandonis 
Acked-by: Linus Walleij 
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 411e3b8..15d9712 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3030,6 +3030,12 @@ F:   drivers/usb/host/whci/
 F: drivers/usb/wusbcore/
 F: include/linux/usb/wusb*
 
+HT16K33 LED CONTROLLER DRIVER
+M: Robin van der Gracht 
+S: Maintained
+F: drivers/auxdisplay/ht16k33.c
+F: Documentation/devicetree/bindings/display/ht16k33.txt
+
 CFAG12864B LCD DRIVER
 M: Miguel Ojeda Sandonis 
 W: http://miguelojeda.es/auxdisplay.htm
-- 
2.7.4



[PATCH v7 RESEND 0/3] auxdisplay: Introduce ht16k33 driver

2016-11-07 Thread Robin van der Gracht
Rebased and resend for Greg.

This patchset adds a new driver to the auxdisplay subsystem. It also adds
devicetree binding documentation and a new vendor prefix.

I added myself as maintainer to the MAINTAINERS file.

Robin van der Gracht (3):
  of: add vendor prefix for Holtek Semiconductor
  auxdisplay: ht16k33: Driver for LED controller
  MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 .../devicetree/bindings/vendor-prefixes.txt|   1 +
 MAINTAINERS|   6 +
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 6 files changed, 622 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

-- 
2.7.4



[PATCH v7 RESEND 2/3] auxdisplay: ht16k33: Driver for LED controller

2016-11-07 Thread Robin van der Gracht
Added a driver for the Holtek HT16K33 LED controller with keyscan.

Signed-off-by: Robin van der Gracht 
CC: Miguel Ojeda Sandonis 
Acked-by: Rob Herring 
Reviewed-by: Linus Walleij 
---
 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 4 files changed, 615 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
new file mode 100644
index 000..8e5b30b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -0,0 +1,42 @@
+Holtek ht16k33 RAM mapping 16*8 LED controller driver with keyscan
+---
+
+Required properties:
+- compatible:  "holtek,ht16k33"
+- reg: I2C slave address of the chip.
+- interrupt-parent:A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+- interrupts:  Interrupt specification for the key pressed interrupt.
+- refresh-rate-hz: Display update interval in HZ.
+- debounce-delay-ms:   Debouncing interval time in milliseconds.
+- linux,keymap:The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
+Optional properties:
+- linux,no-autorepeat: Disable keyrepeat.
+- default-brightness-level: Initial brightness level [0-15] (default: 15).
+
+Example:
+
+ {
+   ht16k33: ht16k33@70 {
+   compatible = "holtek,ht16k33";
+   reg = <0x70>;
+   refresh-rate-hz = <20>;
+   debounce-delay-ms = <50>;
+   interrupt-parent = <>;
+   interrupts = <5 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>;
+   linux,keymap = <
+   MATRIX_KEY(2, 0, KEY_F6)
+   MATRIX_KEY(3, 0, KEY_F8)
+   MATRIX_KEY(4, 0, KEY_F10)
+   MATRIX_KEY(5, 0, KEY_F4)
+   MATRIX_KEY(6, 0, KEY_F2)
+   MATRIX_KEY(2, 1, KEY_F5)
+   MATRIX_KEY(3, 1, KEY_F7)
+   MATRIX_KEY(4, 1, KEY_F9)
+   MATRIX_KEY(5, 1, KEY_F3)
+   MATRIX_KEY(6, 1, KEY_F1)
+   >;
+   };
+};
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index 10e1b9e..a230ea7 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -128,4 +128,13 @@ config IMG_ASCII_LCD
  development boards such as the MIPS Boston, MIPS Malta & MIPS SEAD3
  from Imagination Technologies.
 
+config HT16K33
+   tristate "Holtek Ht16K33 LED controller with keyscan"
+   depends on FB && OF && I2C && INPUT
+   select INPUT_MATRIXKMAP
+   select FB_BACKLIGHT
+   help
+ Say yes here to add support for Holtek HT16K33, RAM mapping 16*8
+ LED controller driver with keyscan.
+
 endif # AUXDISPLAY
diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile
index 3127175..cb3dd84 100644
--- a/drivers/auxdisplay/Makefile
+++ b/drivers/auxdisplay/Makefile
@@ -5,3 +5,4 @@
 obj-$(CONFIG_KS0108)   += ks0108.o
 obj-$(CONFIG_CFAG12864B)   += cfag12864b.o cfag12864bfb.o
 obj-$(CONFIG_IMG_ASCII_LCD)+= img-ascii-lcd.o
+obj-$(CONFIG_HT16K33)  += ht16k33.o
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
new file mode 100644
index 000..eeb323f
--- /dev/null
+++ b/drivers/auxdisplay/ht16k33.c
@@ -0,0 +1,563 @@
+/*
+ * HT16K33 driver
+ *
+ * Author: Robin van der Gracht 
+ *
+ * Copyright: (C) 2016 Protonic Holland.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Registers */
+#define REG_SYSTEM_SETUP   0x20
+#define REG_SYSTEM_SETUP_OSC_ONBIT(0)
+
+#define REG_DISPLAY_SETUP  0x80
+#define REG_DISPLAY_SETUP_ON   BIT(0)
+
+#define REG_ROWINT_SET 0xA0
+#define REG_ROWINT_SET_INT_EN  BIT(0)
+#define REG_

Re: [char-misc:char-misc-testing] warning

2016-11-02 Thread Robin van der Gracht
Hi Randy,

On Tue, 1 Nov 2016 09:34:04 -0700
Randy Dunlap <rdun...@infradead.org> wrote:

> On 11/01/16 09:02, Robin van der Gracht wrote:
> > Hi Tobias,
> > 
> > On Tue, 1 Nov 2016 16:33:03 +0100
> > Tobias Jakobi <tjak...@math.uni-bielefeld.de> wrote:
> >   
> >> Hello Robin,
> >>
> >> I'm afraid I can't help you with that. The series was done as a request
> >> by Daniel Vetter, see here for reference:
> >> http://www.spinics.net/lists/dri-devel/msg113011.html  
> > So.. I should contact Daniel Vetter about this..?
> >
> >> I don't have any nouveau platform here.  
> > 
> > Me neither, the warning is shown when invoking Kconfig. So when I use
> > the config file supplied on my previous email, and start a build or a
> > menuconfig on my (x86_64) system its showing.  
> 
> 
> The kconfig warning is in mainline now and it has nothing to do with the
> new HT16K33 driver.
> 
> How is nouveau supposed to provide backlight support?
> It selects FB_BACKLIGHT but FB_BACKLIGHT depends on FB, which is not
> enabled in the supplied .config file.

Yes, exactly!

I think that line should have been removed along with the other FB deps.

Regards,

-- 
Robin van der Gracht
Protonic Holland


Re: [char-misc:char-misc-testing] warning

2016-11-02 Thread Robin van der Gracht
Hi Randy,

On Tue, 1 Nov 2016 09:34:04 -0700
Randy Dunlap  wrote:

> On 11/01/16 09:02, Robin van der Gracht wrote:
> > Hi Tobias,
> > 
> > On Tue, 1 Nov 2016 16:33:03 +0100
> > Tobias Jakobi  wrote:
> >   
> >> Hello Robin,
> >>
> >> I'm afraid I can't help you with that. The series was done as a request
> >> by Daniel Vetter, see here for reference:
> >> http://www.spinics.net/lists/dri-devel/msg113011.html  
> > So.. I should contact Daniel Vetter about this..?
> >
> >> I don't have any nouveau platform here.  
> > 
> > Me neither, the warning is shown when invoking Kconfig. So when I use
> > the config file supplied on my previous email, and start a build or a
> > menuconfig on my (x86_64) system its showing.  
> 
> 
> The kconfig warning is in mainline now and it has nothing to do with the
> new HT16K33 driver.
> 
> How is nouveau supposed to provide backlight support?
> It selects FB_BACKLIGHT but FB_BACKLIGHT depends on FB, which is not
> enabled in the supplied .config file.

Yes, exactly!

I think that line should have been removed along with the other FB deps.

Regards,

-- 
Robin van der Gracht
Protonic Holland


Re: [char-misc:char-misc-testing] warning

2016-11-01 Thread Robin van der Gracht
Hi Tobias,

On Tue, 1 Nov 2016 16:33:03 +0100
Tobias Jakobi <tjak...@math.uni-bielefeld.de> wrote:

> Hello Robin,
> 
> I'm afraid I can't help you with that. The series was done as a request
> by Daniel Vetter, see here for reference:
> http://www.spinics.net/lists/dri-devel/msg113011.html
So.. I should contact Daniel Vetter about this..?
 
> I don't have any nouveau platform here.

Me neither, the warning is shown when invoking Kconfig. So when I use
the config file supplied on my previous email, and start a build or a
menuconfig on my (x86_64) system its showing.

Regards,

-- 
Robin van der Gracht
Protonic Holland



Re: [char-misc:char-misc-testing] warning

2016-11-01 Thread Robin van der Gracht
Hi Tobias,

On Tue, 1 Nov 2016 16:33:03 +0100
Tobias Jakobi  wrote:

> Hello Robin,
> 
> I'm afraid I can't help you with that. The series was done as a request
> by Daniel Vetter, see here for reference:
> http://www.spinics.net/lists/dri-devel/msg113011.html
So.. I should contact Daniel Vetter about this..?
 
> I don't have any nouveau platform here.

Me neither, the warning is shown when invoking Kconfig. So when I use
the config file supplied on my previous email, and start a build or a
menuconfig on my (x86_64) system its showing.

Regards,

-- 
Robin van der Gracht
Protonic Holland



[char-misc:char-misc-testing] warning

2016-11-01 Thread Robin van der Gracht
Hi Tobias,

Lately I've submitted patches to Gregs (char-misc) git repo and they got
bounced because the kbuild bot threw a warning:

warning: (PMAC_BACKLIGHT && DRM_NOUVEAU && HT16K33 && FB_TFT) selects
FB_BACKLIGHT which has unmet direct dependencies (HAS_IOMEM && FB)

My patched added a new driver named HT16K33, but..

I believe the warning is the result of a dependency issue made possible by this 
commit:
https://kernel.googlesource.com/pub/scm/linux/kernel/git/gregkh/char-misc/+/fc497ed8361f34e465f31e9babcb88efe38fe433

The kbuild bots configuration file stated:
CONFIG_HAS_IOMEM=y
CONFIG_DRM_NOUVEAU=y
CONFIG_DRM_NOUVEAU_BACKLIGHT=y
CONFIG_FB_BACKLIGHT=y
# CONFIG_FB is not set

PMAC_BACKLIGHT, HT16K33 and FB_TFT ware not mentioned in the config file.
I've attached the config file to this email.

FB_BACKLIGHT depends on FB like so:

(drivers/video/fbdev/Kconfig)
config FB_BACKLIGHT
bool
depends on FB
...

In your commit the 'select FB' is removed from the config DRM_NOUVEAU in
the drivers/gpu/drm/nouveau/Kconfig file but DRM_NOUVEAU still selects
FB_BACKLIGHT when using DRM_NOUVEAU_BACKLIGHT.

Is no one else selects FB, the warning mentioned above is raised.

Would you like to verify this?

Regards,

-- 
Robin van der Gracht
Protonic Holland


config.gz
Description: application/gzip


[char-misc:char-misc-testing] warning

2016-11-01 Thread Robin van der Gracht
Hi Tobias,

Lately I've submitted patches to Gregs (char-misc) git repo and they got
bounced because the kbuild bot threw a warning:

warning: (PMAC_BACKLIGHT && DRM_NOUVEAU && HT16K33 && FB_TFT) selects
FB_BACKLIGHT which has unmet direct dependencies (HAS_IOMEM && FB)

My patched added a new driver named HT16K33, but..

I believe the warning is the result of a dependency issue made possible by this 
commit:
https://kernel.googlesource.com/pub/scm/linux/kernel/git/gregkh/char-misc/+/fc497ed8361f34e465f31e9babcb88efe38fe433

The kbuild bots configuration file stated:
CONFIG_HAS_IOMEM=y
CONFIG_DRM_NOUVEAU=y
CONFIG_DRM_NOUVEAU_BACKLIGHT=y
CONFIG_FB_BACKLIGHT=y
# CONFIG_FB is not set

PMAC_BACKLIGHT, HT16K33 and FB_TFT ware not mentioned in the config file.
I've attached the config file to this email.

FB_BACKLIGHT depends on FB like so:

(drivers/video/fbdev/Kconfig)
config FB_BACKLIGHT
bool
depends on FB
...

In your commit the 'select FB' is removed from the config DRM_NOUVEAU in
the drivers/gpu/drm/nouveau/Kconfig file but DRM_NOUVEAU still selects
FB_BACKLIGHT when using DRM_NOUVEAU_BACKLIGHT.

Is no one else selects FB, the warning mentioned above is raised.

Would you like to verify this?

Regards,

-- 
Robin van der Gracht
Protonic Holland


config.gz
Description: application/gzip


[PATCH v2] auxdisplay: ht16k33: Keyscan function is now optional

2016-10-06 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
Changes in v2:
- Removed the trailing dot in the patch subject

 .../devicetree/bindings/display/ht16k33.txt|  15 ++-
 drivers/auxdisplay/ht16k33.c   | 126 +++--
 2 files changed, 73 insertions(+), 68 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
index 8e5b30b..e2c9048 100644
--- a/Documentation/devicetree/bindings/display/ht16k33.txt
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -4,18 +4,21 @@ Holtek ht16k33 RAM mapping 16*8 LED controller driver with 
keyscan
 Required properties:
 - compatible:  "holtek,ht16k33"
 - reg: I2C slave address of the chip.
-- interrupt-parent:A phandle pointing to the interrupt controller
-   serving the interrupt for this chip.
-- interrupts:  Interrupt specification for the key pressed interrupt.
 - refresh-rate-hz: Display update interval in HZ.
-- debounce-delay-ms:   Debouncing interval time in milliseconds.
-- linux,keymap:The keymap for keys as described in the binding
-   document (devicetree/bindings/input/matrix-keymap.txt).
 
 Optional properties:
 - linux,no-autorepeat: Disable keyrepeat.
 - default-brightness-level: Initial brightness level [0-15] (default: 15).
 
+- Keypad
+ Supply the 'interrupts' property to enable the keyscan feature.
+ - interrupts: Interrupt specification for the key pressed interrupt.
+ - interrupt-parent:   A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+ - debounce-delay-ms:  Debouncing interval time in milliseconds.
+ - linux,keymap:   The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
 Example:
 
  {
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 9c09bbc..5cf8fb4 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -334,15 +334,71 @@ static struct fb_ops ht16k33_fb_ops = {
.fb_mmap = ht16k33_mmap,
 };
 
+static int ht16k33_register_keypad(struct ht16k33_priv *priv)
+{
+   int rows, cols, err;
+   struct ht16k33_keypad *keypad = >keypad;
+   struct device *dev = >client->dev;
+
+   keypad->dev = devm_input_allocate_device(dev);
+   if (!keypad->dev)
+   return -ENOMEM;
+
+   keypad->dev->name = dev_name(dev);
+   keypad->dev->id.bustype = BUS_I2C;
+   keypad->dev->open = ht16k33_keypad_start;
+   keypad->dev->close = ht16k33_keypad_stop;
+
+   if (!of_get_property(dev->of_node, "linux,no-autorepeat", NULL))
+   __set_bit(EV_REP, keypad->dev->evbit);
+
+   err = of_property_read_u32(dev->of_node, "debounce-delay-ms",
+  >debounce_ms);
+   if (err) {
+   dev_err(dev, "key debounce delay not specified\n");
+   return err;
+   }
+
+   err = devm_request_threaded_irq(dev, priv->client->irq, NULL,
+   ht16k33_irq_thread,
+   IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+   DRIVER_NAME, priv);
+   if (err) {
+   dev_err(dev, "Failed to request irq %i\n", priv->client->irq);
+   return err;
+   }
+
+   disable_irq_nosync(priv->client->irq);
+   rows = HT16K33_MATRIX_KEYPAD_MAX_ROWS;
+   cols = HT16K33_MATRIX_KEYPAD_MAX_COLS;
+   err = matrix_keypad_parse_of_params(dev, , );
+   if (err)
+   return err;
+
+   err = matrix_keypad_build_keymap(NULL, NULL, rows, cols, NULL,
+keypad->dev);
+   if (err) {
+   dev_err(dev, "failed to build keymap\n");
+   return err;
+   }
+
+   input_set_drvdata(keypad->dev, priv);
+   keypad->rows = rows;
+   keypad->cols = cols;
+   keypad->row_shift = get_count_order(cols);
+   INIT_DELAYED_WORK(>work, ht16k33_keypad_scan);
+
+   return input_register_device(keypad->dev);
+}
+
 static int ht16k33_probe(struct i2c_client *client,
  const struct i2c_device_id *id)
 {
int err;
-   uint32_t rows, cols, dft_brightness;
+   uint32_t dft_brightness;
struct backlight_device *bl;
struct backlight_properties bl_props;
struct ht16k33_priv *priv;
-   struct ht16k33_keypad *keypad;
struct ht16k33_fbdev *fbdev;
struct device_node *node = client->dev.of_node;
const char *dev_id = dev_name(>dev);
@@ -352,11 +408,6 @@ static int ht16k33_probe(struct i2c_client 

[PATCH v2] auxdisplay: ht16k33: Keyscan function is now optional

2016-10-06 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht 
---
Changes in v2:
- Removed the trailing dot in the patch subject

 .../devicetree/bindings/display/ht16k33.txt|  15 ++-
 drivers/auxdisplay/ht16k33.c   | 126 +++--
 2 files changed, 73 insertions(+), 68 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
index 8e5b30b..e2c9048 100644
--- a/Documentation/devicetree/bindings/display/ht16k33.txt
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -4,18 +4,21 @@ Holtek ht16k33 RAM mapping 16*8 LED controller driver with 
keyscan
 Required properties:
 - compatible:  "holtek,ht16k33"
 - reg: I2C slave address of the chip.
-- interrupt-parent:A phandle pointing to the interrupt controller
-   serving the interrupt for this chip.
-- interrupts:  Interrupt specification for the key pressed interrupt.
 - refresh-rate-hz: Display update interval in HZ.
-- debounce-delay-ms:   Debouncing interval time in milliseconds.
-- linux,keymap:The keymap for keys as described in the binding
-   document (devicetree/bindings/input/matrix-keymap.txt).
 
 Optional properties:
 - linux,no-autorepeat: Disable keyrepeat.
 - default-brightness-level: Initial brightness level [0-15] (default: 15).
 
+- Keypad
+ Supply the 'interrupts' property to enable the keyscan feature.
+ - interrupts: Interrupt specification for the key pressed interrupt.
+ - interrupt-parent:   A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+ - debounce-delay-ms:  Debouncing interval time in milliseconds.
+ - linux,keymap:   The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
 Example:
 
  {
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 9c09bbc..5cf8fb4 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -334,15 +334,71 @@ static struct fb_ops ht16k33_fb_ops = {
.fb_mmap = ht16k33_mmap,
 };
 
+static int ht16k33_register_keypad(struct ht16k33_priv *priv)
+{
+   int rows, cols, err;
+   struct ht16k33_keypad *keypad = >keypad;
+   struct device *dev = >client->dev;
+
+   keypad->dev = devm_input_allocate_device(dev);
+   if (!keypad->dev)
+   return -ENOMEM;
+
+   keypad->dev->name = dev_name(dev);
+   keypad->dev->id.bustype = BUS_I2C;
+   keypad->dev->open = ht16k33_keypad_start;
+   keypad->dev->close = ht16k33_keypad_stop;
+
+   if (!of_get_property(dev->of_node, "linux,no-autorepeat", NULL))
+   __set_bit(EV_REP, keypad->dev->evbit);
+
+   err = of_property_read_u32(dev->of_node, "debounce-delay-ms",
+  >debounce_ms);
+   if (err) {
+   dev_err(dev, "key debounce delay not specified\n");
+   return err;
+   }
+
+   err = devm_request_threaded_irq(dev, priv->client->irq, NULL,
+   ht16k33_irq_thread,
+   IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+   DRIVER_NAME, priv);
+   if (err) {
+   dev_err(dev, "Failed to request irq %i\n", priv->client->irq);
+   return err;
+   }
+
+   disable_irq_nosync(priv->client->irq);
+   rows = HT16K33_MATRIX_KEYPAD_MAX_ROWS;
+   cols = HT16K33_MATRIX_KEYPAD_MAX_COLS;
+   err = matrix_keypad_parse_of_params(dev, , );
+   if (err)
+   return err;
+
+   err = matrix_keypad_build_keymap(NULL, NULL, rows, cols, NULL,
+keypad->dev);
+   if (err) {
+   dev_err(dev, "failed to build keymap\n");
+   return err;
+   }
+
+   input_set_drvdata(keypad->dev, priv);
+   keypad->rows = rows;
+   keypad->cols = cols;
+   keypad->row_shift = get_count_order(cols);
+   INIT_DELAYED_WORK(>work, ht16k33_keypad_scan);
+
+   return input_register_device(keypad->dev);
+}
+
 static int ht16k33_probe(struct i2c_client *client,
  const struct i2c_device_id *id)
 {
int err;
-   uint32_t rows, cols, dft_brightness;
+   uint32_t dft_brightness;
struct backlight_device *bl;
struct backlight_properties bl_props;
struct ht16k33_priv *priv;
-   struct ht16k33_keypad *keypad;
struct ht16k33_fbdev *fbdev;
struct device_node *node = client->dev.of_node;
const char *dev_id = dev_name(>dev);
@@ -352,11 +408,6 @@ static int ht16k33_probe(struct i2c_client *clien

[PATCH] auxdisplay: ht16k33: Keyscan function is now optional.

2016-10-06 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
 .../devicetree/bindings/display/ht16k33.txt|  15 ++-
 drivers/auxdisplay/ht16k33.c   | 126 +++--
 2 files changed, 73 insertions(+), 68 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
index 8e5b30b..e2c9048 100644
--- a/Documentation/devicetree/bindings/display/ht16k33.txt
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -4,18 +4,21 @@ Holtek ht16k33 RAM mapping 16*8 LED controller driver with 
keyscan
 Required properties:
 - compatible:  "holtek,ht16k33"
 - reg: I2C slave address of the chip.
-- interrupt-parent:A phandle pointing to the interrupt controller
-   serving the interrupt for this chip.
-- interrupts:  Interrupt specification for the key pressed interrupt.
 - refresh-rate-hz: Display update interval in HZ.
-- debounce-delay-ms:   Debouncing interval time in milliseconds.
-- linux,keymap:The keymap for keys as described in the binding
-   document (devicetree/bindings/input/matrix-keymap.txt).
 
 Optional properties:
 - linux,no-autorepeat: Disable keyrepeat.
 - default-brightness-level: Initial brightness level [0-15] (default: 15).
 
+- Keypad
+ Supply the 'interrupts' property to enable the keyscan feature.
+ - interrupts: Interrupt specification for the key pressed interrupt.
+ - interrupt-parent:   A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+ - debounce-delay-ms:  Debouncing interval time in milliseconds.
+ - linux,keymap:   The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
 Example:
 
  {
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 9c09bbc..5cf8fb4 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -334,15 +334,71 @@ static struct fb_ops ht16k33_fb_ops = {
.fb_mmap = ht16k33_mmap,
 };
 
+static int ht16k33_register_keypad(struct ht16k33_priv *priv)
+{
+   int rows, cols, err;
+   struct ht16k33_keypad *keypad = >keypad;
+   struct device *dev = >client->dev;
+
+   keypad->dev = devm_input_allocate_device(dev);
+   if (!keypad->dev)
+   return -ENOMEM;
+
+   keypad->dev->name = dev_name(dev);
+   keypad->dev->id.bustype = BUS_I2C;
+   keypad->dev->open = ht16k33_keypad_start;
+   keypad->dev->close = ht16k33_keypad_stop;
+
+   if (!of_get_property(dev->of_node, "linux,no-autorepeat", NULL))
+   __set_bit(EV_REP, keypad->dev->evbit);
+
+   err = of_property_read_u32(dev->of_node, "debounce-delay-ms",
+  >debounce_ms);
+   if (err) {
+   dev_err(dev, "key debounce delay not specified\n");
+   return err;
+   }
+
+   err = devm_request_threaded_irq(dev, priv->client->irq, NULL,
+   ht16k33_irq_thread,
+   IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+   DRIVER_NAME, priv);
+   if (err) {
+   dev_err(dev, "Failed to request irq %i\n", priv->client->irq);
+   return err;
+   }
+
+   disable_irq_nosync(priv->client->irq);
+   rows = HT16K33_MATRIX_KEYPAD_MAX_ROWS;
+   cols = HT16K33_MATRIX_KEYPAD_MAX_COLS;
+   err = matrix_keypad_parse_of_params(dev, , );
+   if (err)
+   return err;
+
+   err = matrix_keypad_build_keymap(NULL, NULL, rows, cols, NULL,
+keypad->dev);
+   if (err) {
+   dev_err(dev, "failed to build keymap\n");
+   return err;
+   }
+
+   input_set_drvdata(keypad->dev, priv);
+   keypad->rows = rows;
+   keypad->cols = cols;
+   keypad->row_shift = get_count_order(cols);
+   INIT_DELAYED_WORK(>work, ht16k33_keypad_scan);
+
+   return input_register_device(keypad->dev);
+}
+
 static int ht16k33_probe(struct i2c_client *client,
  const struct i2c_device_id *id)
 {
int err;
-   uint32_t rows, cols, dft_brightness;
+   uint32_t dft_brightness;
struct backlight_device *bl;
struct backlight_properties bl_props;
struct ht16k33_priv *priv;
-   struct ht16k33_keypad *keypad;
struct ht16k33_fbdev *fbdev;
struct device_node *node = client->dev.of_node;
const char *dev_id = dev_name(>dev);
@@ -352,11 +408,6 @@ static int ht16k33_probe(struct i2c_client *client,
return -EIO;
}
 
-   if

[PATCH] auxdisplay: ht16k33: Keyscan function is now optional.

2016-10-06 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht 
---
 .../devicetree/bindings/display/ht16k33.txt|  15 ++-
 drivers/auxdisplay/ht16k33.c   | 126 +++--
 2 files changed, 73 insertions(+), 68 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
index 8e5b30b..e2c9048 100644
--- a/Documentation/devicetree/bindings/display/ht16k33.txt
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -4,18 +4,21 @@ Holtek ht16k33 RAM mapping 16*8 LED controller driver with 
keyscan
 Required properties:
 - compatible:  "holtek,ht16k33"
 - reg: I2C slave address of the chip.
-- interrupt-parent:A phandle pointing to the interrupt controller
-   serving the interrupt for this chip.
-- interrupts:  Interrupt specification for the key pressed interrupt.
 - refresh-rate-hz: Display update interval in HZ.
-- debounce-delay-ms:   Debouncing interval time in milliseconds.
-- linux,keymap:The keymap for keys as described in the binding
-   document (devicetree/bindings/input/matrix-keymap.txt).
 
 Optional properties:
 - linux,no-autorepeat: Disable keyrepeat.
 - default-brightness-level: Initial brightness level [0-15] (default: 15).
 
+- Keypad
+ Supply the 'interrupts' property to enable the keyscan feature.
+ - interrupts: Interrupt specification for the key pressed interrupt.
+ - interrupt-parent:   A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+ - debounce-delay-ms:  Debouncing interval time in milliseconds.
+ - linux,keymap:   The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
 Example:
 
  {
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 9c09bbc..5cf8fb4 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -334,15 +334,71 @@ static struct fb_ops ht16k33_fb_ops = {
.fb_mmap = ht16k33_mmap,
 };
 
+static int ht16k33_register_keypad(struct ht16k33_priv *priv)
+{
+   int rows, cols, err;
+   struct ht16k33_keypad *keypad = >keypad;
+   struct device *dev = >client->dev;
+
+   keypad->dev = devm_input_allocate_device(dev);
+   if (!keypad->dev)
+   return -ENOMEM;
+
+   keypad->dev->name = dev_name(dev);
+   keypad->dev->id.bustype = BUS_I2C;
+   keypad->dev->open = ht16k33_keypad_start;
+   keypad->dev->close = ht16k33_keypad_stop;
+
+   if (!of_get_property(dev->of_node, "linux,no-autorepeat", NULL))
+   __set_bit(EV_REP, keypad->dev->evbit);
+
+   err = of_property_read_u32(dev->of_node, "debounce-delay-ms",
+  >debounce_ms);
+   if (err) {
+   dev_err(dev, "key debounce delay not specified\n");
+   return err;
+   }
+
+   err = devm_request_threaded_irq(dev, priv->client->irq, NULL,
+   ht16k33_irq_thread,
+   IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+   DRIVER_NAME, priv);
+   if (err) {
+   dev_err(dev, "Failed to request irq %i\n", priv->client->irq);
+   return err;
+   }
+
+   disable_irq_nosync(priv->client->irq);
+   rows = HT16K33_MATRIX_KEYPAD_MAX_ROWS;
+   cols = HT16K33_MATRIX_KEYPAD_MAX_COLS;
+   err = matrix_keypad_parse_of_params(dev, , );
+   if (err)
+   return err;
+
+   err = matrix_keypad_build_keymap(NULL, NULL, rows, cols, NULL,
+keypad->dev);
+   if (err) {
+   dev_err(dev, "failed to build keymap\n");
+   return err;
+   }
+
+   input_set_drvdata(keypad->dev, priv);
+   keypad->rows = rows;
+   keypad->cols = cols;
+   keypad->row_shift = get_count_order(cols);
+   INIT_DELAYED_WORK(>work, ht16k33_keypad_scan);
+
+   return input_register_device(keypad->dev);
+}
+
 static int ht16k33_probe(struct i2c_client *client,
  const struct i2c_device_id *id)
 {
int err;
-   uint32_t rows, cols, dft_brightness;
+   uint32_t dft_brightness;
struct backlight_device *bl;
struct backlight_properties bl_props;
struct ht16k33_priv *priv;
-   struct ht16k33_keypad *keypad;
struct ht16k33_fbdev *fbdev;
struct device_node *node = client->dev.of_node;
const char *dev_id = dev_name(>dev);
@@ -352,11 +408,6 @@ static int ht16k33_probe(struct i2c_client *client,
return -EIO;
}
 
-   if (client->irq &l

[PATCH] auxdisplay: ht16k33: Use unique i2c client device name

2016-10-06 Thread Robin van der Gracht
Static naming causes problems when multiple devices are registered.

Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
 drivers/auxdisplay/ht16k33.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index eeb323f..9c09bbc 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -345,6 +345,7 @@ static int ht16k33_probe(struct i2c_client *client,
struct ht16k33_keypad *keypad;
struct ht16k33_fbdev *fbdev;
struct device_node *node = client->dev.of_node;
+   const char *dev_id = dev_name(>dev);
 
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
dev_err(>dev, "i2c_check_functionality error\n");
@@ -365,7 +366,7 @@ static int ht16k33_probe(struct i2c_client *client,
fbdev = >fbdev;
keypad = >keypad;
 
-   priv->workqueue = create_singlethread_workqueue(DRIVER_NAME "-wq");
+   priv->workqueue = create_singlethread_workqueue(dev_id);
if (priv->workqueue == NULL)
return -ENOMEM;
 
@@ -422,7 +423,7 @@ static int ht16k33_probe(struct i2c_client *client,
goto err_fbdev_unregister;
}
 
-   keypad->dev->name = DRIVER_NAME"-keypad";
+   keypad->dev->name = dev_id;
keypad->dev->id.bustype = BUS_I2C;
keypad->dev->open = ht16k33_keypad_start;
keypad->dev->close = ht16k33_keypad_stop;
@@ -476,7 +477,7 @@ static int ht16k33_probe(struct i2c_client *client,
bl_props.type = BACKLIGHT_RAW;
bl_props.max_brightness = MAX_BRIGHTNESS;
 
-   bl = devm_backlight_device_register(>dev, DRIVER_NAME"-bl",
+   bl = devm_backlight_device_register(>dev, dev_id,
>dev, priv,
_bl_ops, _props);
if (IS_ERR(bl)) {
-- 
2.7.4



[PATCH] auxdisplay: ht16k33: Use unique i2c client device name

2016-10-06 Thread Robin van der Gracht
Static naming causes problems when multiple devices are registered.

Signed-off-by: Robin van der Gracht 
---
 drivers/auxdisplay/ht16k33.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index eeb323f..9c09bbc 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -345,6 +345,7 @@ static int ht16k33_probe(struct i2c_client *client,
struct ht16k33_keypad *keypad;
struct ht16k33_fbdev *fbdev;
struct device_node *node = client->dev.of_node;
+   const char *dev_id = dev_name(>dev);
 
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
dev_err(>dev, "i2c_check_functionality error\n");
@@ -365,7 +366,7 @@ static int ht16k33_probe(struct i2c_client *client,
fbdev = >fbdev;
keypad = >keypad;
 
-   priv->workqueue = create_singlethread_workqueue(DRIVER_NAME "-wq");
+   priv->workqueue = create_singlethread_workqueue(dev_id);
if (priv->workqueue == NULL)
return -ENOMEM;
 
@@ -422,7 +423,7 @@ static int ht16k33_probe(struct i2c_client *client,
goto err_fbdev_unregister;
}
 
-   keypad->dev->name = DRIVER_NAME"-keypad";
+   keypad->dev->name = dev_id;
keypad->dev->id.bustype = BUS_I2C;
keypad->dev->open = ht16k33_keypad_start;
keypad->dev->close = ht16k33_keypad_stop;
@@ -476,7 +477,7 @@ static int ht16k33_probe(struct i2c_client *client,
bl_props.type = BACKLIGHT_RAW;
bl_props.max_brightness = MAX_BRIGHTNESS;
 
-   bl = devm_backlight_device_register(>dev, DRIVER_NAME"-bl",
+   bl = devm_backlight_device_register(>dev, dev_id,
>dev, priv,
_bl_ops, _props);
if (IS_ERR(bl)) {
-- 
2.7.4



[PATCH v7 2/3] auxdisplay: ht16k33: Driver for LED controller

2016-10-06 Thread Robin van der Gracht
Added a driver for the Holtek HT16K33 LED controller with keyscan.

Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
CC: Miguel Ojeda Sandonis <miguel.ojeda.sando...@gmail.com>
Acked-by: Rob Herring <r...@kernel.org>
---
Changes in v7:
- Fixed unit for debounce-delay-ms in doc (microseconds -> milliseconds)

 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 4 files changed, 615 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
new file mode 100644
index 000..8e5b30b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -0,0 +1,42 @@
+Holtek ht16k33 RAM mapping 16*8 LED controller driver with keyscan
+---
+
+Required properties:
+- compatible:  "holtek,ht16k33"
+- reg: I2C slave address of the chip.
+- interrupt-parent:A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+- interrupts:  Interrupt specification for the key pressed interrupt.
+- refresh-rate-hz: Display update interval in HZ.
+- debounce-delay-ms:   Debouncing interval time in milliseconds.
+- linux,keymap:The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
+Optional properties:
+- linux,no-autorepeat: Disable keyrepeat.
+- default-brightness-level: Initial brightness level [0-15] (default: 15).
+
+Example:
+
+ {
+   ht16k33: ht16k33@70 {
+   compatible = "holtek,ht16k33";
+   reg = <0x70>;
+   refresh-rate-hz = <20>;
+   debounce-delay-ms = <50>;
+   interrupt-parent = <>;
+   interrupts = <5 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>;
+   linux,keymap = <
+   MATRIX_KEY(2, 0, KEY_F6)
+   MATRIX_KEY(3, 0, KEY_F8)
+   MATRIX_KEY(4, 0, KEY_F10)
+   MATRIX_KEY(5, 0, KEY_F4)
+   MATRIX_KEY(6, 0, KEY_F2)
+   MATRIX_KEY(2, 1, KEY_F5)
+   MATRIX_KEY(3, 1, KEY_F7)
+   MATRIX_KEY(4, 1, KEY_F9)
+   MATRIX_KEY(5, 1, KEY_F3)
+   MATRIX_KEY(6, 1, KEY_F1)
+   >;
+   };
+};
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index c07e725..75ad4f5 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -119,4 +119,13 @@ config CFAG12864B_RATE
  If you compile this as a module, you can still override this
  value using the module parameters.
 
+config HT16K33
+   tristate "Holtek Ht16K33 LED controller with keyscan"
+   depends on FB && OF && I2C && INPUT
+   select INPUT_MATRIXKMAP
+   select FB_BACKLIGHT
+   help
+ Say yes here to add support for Holtek HT16K33, RAM mapping 16*8
+ LED controller driver with keyscan.
+
 endif # AUXDISPLAY
diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile
index 8a8936a..d7c9ef5 100644
--- a/drivers/auxdisplay/Makefile
+++ b/drivers/auxdisplay/Makefile
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_KS0108)   += ks0108.o
 obj-$(CONFIG_CFAG12864B)   += cfag12864b.o cfag12864bfb.o
+obj-$(CONFIG_HT16K33)  += ht16k33.o
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
new file mode 100644
index 000..eeb323f
--- /dev/null
+++ b/drivers/auxdisplay/ht16k33.c
@@ -0,0 +1,563 @@
+/*
+ * HT16K33 driver
+ *
+ * Author: Robin van der Gracht <ro...@protonic.nl>
+ *
+ * Copyright: (C) 2016 Protonic Holland.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Registers */
+#define REG_SYSTEM_SETUP   0x20
+#define REG_SYSTEM_SETUP_OSC_ONBIT(0)
+
+#define REG_DISPLAY_SETUP  0x80
+#define REG_DISPLAY_SETUP_ON   

[PATCH v7 2/3] auxdisplay: ht16k33: Driver for LED controller

2016-10-06 Thread Robin van der Gracht
Added a driver for the Holtek HT16K33 LED controller with keyscan.

Signed-off-by: Robin van der Gracht 
CC: Miguel Ojeda Sandonis 
Acked-by: Rob Herring 
---
Changes in v7:
- Fixed unit for debounce-delay-ms in doc (microseconds -> milliseconds)

 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 4 files changed, 615 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
new file mode 100644
index 000..8e5b30b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -0,0 +1,42 @@
+Holtek ht16k33 RAM mapping 16*8 LED controller driver with keyscan
+---
+
+Required properties:
+- compatible:  "holtek,ht16k33"
+- reg: I2C slave address of the chip.
+- interrupt-parent:A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+- interrupts:  Interrupt specification for the key pressed interrupt.
+- refresh-rate-hz: Display update interval in HZ.
+- debounce-delay-ms:   Debouncing interval time in milliseconds.
+- linux,keymap:The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
+Optional properties:
+- linux,no-autorepeat: Disable keyrepeat.
+- default-brightness-level: Initial brightness level [0-15] (default: 15).
+
+Example:
+
+ {
+   ht16k33: ht16k33@70 {
+   compatible = "holtek,ht16k33";
+   reg = <0x70>;
+   refresh-rate-hz = <20>;
+   debounce-delay-ms = <50>;
+   interrupt-parent = <>;
+   interrupts = <5 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>;
+   linux,keymap = <
+   MATRIX_KEY(2, 0, KEY_F6)
+   MATRIX_KEY(3, 0, KEY_F8)
+   MATRIX_KEY(4, 0, KEY_F10)
+   MATRIX_KEY(5, 0, KEY_F4)
+   MATRIX_KEY(6, 0, KEY_F2)
+   MATRIX_KEY(2, 1, KEY_F5)
+   MATRIX_KEY(3, 1, KEY_F7)
+   MATRIX_KEY(4, 1, KEY_F9)
+   MATRIX_KEY(5, 1, KEY_F3)
+   MATRIX_KEY(6, 1, KEY_F1)
+   >;
+   };
+};
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index c07e725..75ad4f5 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -119,4 +119,13 @@ config CFAG12864B_RATE
  If you compile this as a module, you can still override this
  value using the module parameters.
 
+config HT16K33
+   tristate "Holtek Ht16K33 LED controller with keyscan"
+   depends on FB && OF && I2C && INPUT
+   select INPUT_MATRIXKMAP
+   select FB_BACKLIGHT
+   help
+ Say yes here to add support for Holtek HT16K33, RAM mapping 16*8
+ LED controller driver with keyscan.
+
 endif # AUXDISPLAY
diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile
index 8a8936a..d7c9ef5 100644
--- a/drivers/auxdisplay/Makefile
+++ b/drivers/auxdisplay/Makefile
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_KS0108)   += ks0108.o
 obj-$(CONFIG_CFAG12864B)   += cfag12864b.o cfag12864bfb.o
+obj-$(CONFIG_HT16K33)  += ht16k33.o
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
new file mode 100644
index 000..eeb323f
--- /dev/null
+++ b/drivers/auxdisplay/ht16k33.c
@@ -0,0 +1,563 @@
+/*
+ * HT16K33 driver
+ *
+ * Author: Robin van der Gracht 
+ *
+ * Copyright: (C) 2016 Protonic Holland.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Registers */
+#define REG_SYSTEM_SETUP   0x20
+#define REG_SYSTEM_SETUP_OSC_ONBIT(0)
+
+#define REG_DISPLAY_SETUP  0x80
+#define REG_DISPLAY_SETUP_ON   BIT(0)
+
+#define REG_ROWINT_SET 0xA0
+#define REG_ROWINT_SET_INT_EN  BIT(0)

[PATCH v7 3/3] MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

2016-10-06 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
CC: Miguel Ojeda Sandonis <miguel.ojeda.sando...@gmail.com>
Acked-by: Linus Walleij <linus.wall...@linaro.org>
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 841ffa3..7e7368e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2998,6 +2998,12 @@ F:   drivers/usb/host/whci/
 F: drivers/usb/wusbcore/
 F: include/linux/usb/wusb*
 
+HT16K33 LED CONTROLLER DRIVER
+M: Robin van der Gracht <ro...@protonic.nl>
+S: Maintained
+F: drivers/auxdisplay/ht16k33.c
+F: Documentation/devicetree/bindings/display/ht16k33.txt
+
 CFAG12864B LCD DRIVER
 M: Miguel Ojeda Sandonis <miguel.ojeda.sando...@gmail.com>
 W: http://miguelojeda.es/auxdisplay.htm
-- 
2.7.4



[PATCH v7 1/3] of: add vendor prefix for Holtek Semiconductor

2016-10-06 Thread Robin van der Gracht
This patch introduces a vendor prefix for Holtek Semiconductor Inc.

Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
Acked-by: Rob Herring <r...@kernel.org>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 77e985f..2bf7ffd 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -125,6 +125,7 @@ hitex   Hitex Development Tools
 holt   Holt Integrated Circuits, Inc.
 honeywell  Honeywell
 hp Hewlett Packard
+holtek Holtek Semiconductor, Inc.
 i2se   I2SE GmbH
 ibmInternational Business Machines (IBM)
 idtIntegrated Device Technologies, Inc.
-- 
2.7.4



[PATCH v7 3/3] MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

2016-10-06 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht 
CC: Miguel Ojeda Sandonis 
Acked-by: Linus Walleij 
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 841ffa3..7e7368e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2998,6 +2998,12 @@ F:   drivers/usb/host/whci/
 F: drivers/usb/wusbcore/
 F: include/linux/usb/wusb*
 
+HT16K33 LED CONTROLLER DRIVER
+M: Robin van der Gracht 
+S: Maintained
+F: drivers/auxdisplay/ht16k33.c
+F: Documentation/devicetree/bindings/display/ht16k33.txt
+
 CFAG12864B LCD DRIVER
 M: Miguel Ojeda Sandonis 
 W: http://miguelojeda.es/auxdisplay.htm
-- 
2.7.4



[PATCH v7 1/3] of: add vendor prefix for Holtek Semiconductor

2016-10-06 Thread Robin van der Gracht
This patch introduces a vendor prefix for Holtek Semiconductor Inc.

Signed-off-by: Robin van der Gracht 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 77e985f..2bf7ffd 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -125,6 +125,7 @@ hitex   Hitex Development Tools
 holt   Holt Integrated Circuits, Inc.
 honeywell  Honeywell
 hp Hewlett Packard
+holtek Holtek Semiconductor, Inc.
 i2se   I2SE GmbH
 ibmInternational Business Machines (IBM)
 idtIntegrated Device Technologies, Inc.
-- 
2.7.4



[PATCH v7 0/3] auxdisplay: Introduce ht16k33 driver

2016-10-06 Thread Robin van der Gracht
This patchset adds a new driver to the auxdisplay subsystem. It also adds
devicetree binding documentation and a new vendor prefix.

I added myself as maintainer to the MAINTAINERS file.

@Greg: Would you like to review and push this upstream?

Robin van der Gracht (3):
  of: add vendor prefix for Holtek Semiconductor
  auxdisplay: ht16k33: Driver for LED controller
  MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 .../devicetree/bindings/vendor-prefixes.txt|   1 +
 MAINTAINERS|   6 +
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 6 files changed, 622 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

-- 
2.7.4



[PATCH v7 0/3] auxdisplay: Introduce ht16k33 driver

2016-10-06 Thread Robin van der Gracht
This patchset adds a new driver to the auxdisplay subsystem. It also adds
devicetree binding documentation and a new vendor prefix.

I added myself as maintainer to the MAINTAINERS file.

@Greg: Would you like to review and push this upstream?

Robin van der Gracht (3):
  of: add vendor prefix for Holtek Semiconductor
  auxdisplay: ht16k33: Driver for LED controller
  MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 .../devicetree/bindings/vendor-prefixes.txt|   1 +
 MAINTAINERS|   6 +
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 6 files changed, 622 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

-- 
2.7.4



Re: [PATCH v6 0/3] auxdisplay: Introduce ht16k33 driver

2016-05-19 Thread Robin van der Gracht
On Wed, 18 May 2016 08:09:24 -0700
Greg Kroah-Hartman <gre...@linuxfoundation.org> wrote:

> On Wed, May 18, 2016 at 02:23:16PM +0200, Robin van der Gracht wrote:
> > This patchset adds a new driver to the auxdisplay subsystem. It
> > also adds devicetree bindings documentation and a new vendor prefix.
> > 
> > I added myself as maintainer to the MAINTAINERS file.  
> 
> First off, if you want me to apply patches, put me in the to: line,
> and say so, otherwise I don't know.

Ack

> 
> Secondly, it's the middle of the merge window, and we can't take new
> patches into our trees (go read Documentation/development_model
> please), so this will have to wait until after 4.7-rc1 is out.

Thats fine with me.

> 
> Thirdly, I need an ack for the DT-related change before I can accept
> that, hopefully you included the correct people on it.

Rob (re)acked the patches this morning. I'll try not to forget to
re-add acks when I resubmit patches.

> 
> And 4th, what is with the insane number of people on cc:?  Use
> get_maintainer.pl correctly please, and don't just hit everyone you
> can possibly think of with a cc: for no good reason.

I did use the get_maintainer script. I solely passed the patch set as
command line argument.

> 
> I'll put this in my "to-review" queue to look at after 4.7-rc1 is out.

Thanks Greg.

Robin van der Gracht


Re: [PATCH v6 0/3] auxdisplay: Introduce ht16k33 driver

2016-05-19 Thread Robin van der Gracht
On Wed, 18 May 2016 08:09:24 -0700
Greg Kroah-Hartman  wrote:

> On Wed, May 18, 2016 at 02:23:16PM +0200, Robin van der Gracht wrote:
> > This patchset adds a new driver to the auxdisplay subsystem. It
> > also adds devicetree bindings documentation and a new vendor prefix.
> > 
> > I added myself as maintainer to the MAINTAINERS file.  
> 
> First off, if you want me to apply patches, put me in the to: line,
> and say so, otherwise I don't know.

Ack

> 
> Secondly, it's the middle of the merge window, and we can't take new
> patches into our trees (go read Documentation/development_model
> please), so this will have to wait until after 4.7-rc1 is out.

Thats fine with me.

> 
> Thirdly, I need an ack for the DT-related change before I can accept
> that, hopefully you included the correct people on it.

Rob (re)acked the patches this morning. I'll try not to forget to
re-add acks when I resubmit patches.

> 
> And 4th, what is with the insane number of people on cc:?  Use
> get_maintainer.pl correctly please, and don't just hit everyone you
> can possibly think of with a cc: for no good reason.

I did use the get_maintainer script. I solely passed the patch set as
command line argument.

> 
> I'll put this in my "to-review" queue to look at after 4.7-rc1 is out.

Thanks Greg.

Robin van der Gracht


[PATCH v6 0/3] auxdisplay: Introduce ht16k33 driver

2016-05-18 Thread Robin van der Gracht
This patchset adds a new driver to the auxdisplay subsystem. It also adds
devicetree bindings documentation and a new vendor prefix.

I added myself as maintainer to the MAINTAINERS file.

Robin van der Gracht (3):
  of: add vendor prefix for Holtek Semiconductor
  auxdisplay: ht16k33: Driver for LED controller
  MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 .../devicetree/bindings/vendor-prefixes.txt|   1 +
 MAINTAINERS|   6 +
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 6 files changed, 622 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

-- 
2.7.4



[PATCH v6 0/3] auxdisplay: Introduce ht16k33 driver

2016-05-18 Thread Robin van der Gracht
This patchset adds a new driver to the auxdisplay subsystem. It also adds
devicetree bindings documentation and a new vendor prefix.

I added myself as maintainer to the MAINTAINERS file.

Robin van der Gracht (3):
  of: add vendor prefix for Holtek Semiconductor
  auxdisplay: ht16k33: Driver for LED controller
  MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 .../devicetree/bindings/vendor-prefixes.txt|   1 +
 MAINTAINERS|   6 +
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 6 files changed, 622 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

-- 
2.7.4



[PATCH v6 3/3] MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

2016-05-18 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9c567a4..54aed16 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2816,6 +2816,12 @@ F:   drivers/usb/host/whci/
 F: drivers/usb/wusbcore/
 F: include/linux/usb/wusb*
 
+HT16K33 LED CONTROLLER DRIVER
+M: Robin van der Gracht <ro...@protonic.nl>
+S: Maintained
+F: drivers/auxdisplay/ht16k33.c
+F: Documentation/devicetree/bindings/display/ht16k33.txt
+
 CFAG12864B LCD DRIVER
 M: Miguel Ojeda Sandonis <miguel.ojeda.sando...@gmail.com>
 W: http://miguelojeda.es/auxdisplay.htm
-- 
2.7.4



[PATCH v6 3/3] MAINTAINERS: auxdisplay: Added myself as maintainer for ht16k33 driver

2016-05-18 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht 
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9c567a4..54aed16 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2816,6 +2816,12 @@ F:   drivers/usb/host/whci/
 F: drivers/usb/wusbcore/
 F: include/linux/usb/wusb*
 
+HT16K33 LED CONTROLLER DRIVER
+M: Robin van der Gracht 
+S: Maintained
+F: drivers/auxdisplay/ht16k33.c
+F: Documentation/devicetree/bindings/display/ht16k33.txt
+
 CFAG12864B LCD DRIVER
 M: Miguel Ojeda Sandonis 
 W: http://miguelojeda.es/auxdisplay.htm
-- 
2.7.4



[PATCH v6 1/3] of: add vendor prefix for Holtek Semiconductor

2016-05-18 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 86740d4..84fb85d 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -112,6 +112,7 @@ hitex   Hitex Development Tools
 holt   Holt Integrated Circuits, Inc.
 honeywell  Honeywell
 hp Hewlett Packard
+holtek Holtek Semiconductor, Inc.
 i2se   I2SE GmbH
 ibmInternational Business Machines (IBM)
 idtIntegrated Device Technologies, Inc.
-- 
2.7.4



[PATCH v6 2/3] auxdisplay: ht16k33: Driver for LED controller

2016-05-18 Thread Robin van der Gracht
Added a driver for the Holtek HT16K33 LED controller with keyscan.

Signed-off-by: Robin van der Gracht <ro...@protonic.nl>
---
Changes in v6:
- Fixed minor typo in documentation 'KEY_F0' -> 'KEY_F10'

 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 4 files changed, 615 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
new file mode 100644
index 000..5c11320
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -0,0 +1,42 @@
+Holtek ht16k33 RAM mapping 16*8 LED controller driver with keyscan
+---
+
+Required properties:
+- compatible:  "holtek,ht16k33"
+- reg: I2C slave address of the chip.
+- interrupt-parent:A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+- interrupts:  Interrupt specification for the key pressed interrupt.
+- refresh-rate-hz: Display update interval in HZ.
+- debounce-delay-ms:   Debouncing interval time in microseconds.
+- linux,keymap:The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
+Optional properties:
+- linux,no-autorepeat: Disable keyrepeat.
+- default-brightness-level: Initial brightness level [0-15] (default: 15).
+
+Example:
+
+ {
+   ht16k33: ht16k33@70 {
+   compatible = "holtek,ht16k33";
+   reg = <0x70>;
+   refresh-rate-hz = <20>;
+   debounce-delay-ms = <50>;
+   interrupt-parent = <>;
+   interrupts = <5 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>;
+   linux,keymap = <
+   MATRIX_KEY(2, 0, KEY_F6)
+   MATRIX_KEY(3, 0, KEY_F8)
+   MATRIX_KEY(4, 0, KEY_F10)
+   MATRIX_KEY(5, 0, KEY_F4)
+   MATRIX_KEY(6, 0, KEY_F2)
+   MATRIX_KEY(2, 1, KEY_F5)
+   MATRIX_KEY(3, 1, KEY_F7)
+   MATRIX_KEY(4, 1, KEY_F9)
+   MATRIX_KEY(5, 1, KEY_F3)
+   MATRIX_KEY(6, 1, KEY_F1)
+   >;
+   };
+};
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index c07e725..75ad4f5 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -119,4 +119,13 @@ config CFAG12864B_RATE
  If you compile this as a module, you can still override this
  value using the module parameters.
 
+config HT16K33
+   tristate "Holtek Ht16K33 LED controller with keyscan"
+   depends on FB && OF && I2C && INPUT
+   select INPUT_MATRIXKMAP
+   select FB_BACKLIGHT
+   help
+ Say yes here to add support for Holtek HT16K33, RAM mapping 16*8
+ LED controller driver with keyscan.
+
 endif # AUXDISPLAY
diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile
index 8a8936a..d7c9ef5 100644
--- a/drivers/auxdisplay/Makefile
+++ b/drivers/auxdisplay/Makefile
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_KS0108)   += ks0108.o
 obj-$(CONFIG_CFAG12864B)   += cfag12864b.o cfag12864bfb.o
+obj-$(CONFIG_HT16K33)  += ht16k33.o
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
new file mode 100644
index 000..eeb323f
--- /dev/null
+++ b/drivers/auxdisplay/ht16k33.c
@@ -0,0 +1,563 @@
+/*
+ * HT16K33 driver
+ *
+ * Author: Robin van der Gracht <ro...@protonic.nl>
+ *
+ * Copyright: (C) 2016 Protonic Holland.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Registers */
+#define REG_SYSTEM_SETUP   0x20
+#define REG_SYSTEM_SETUP_OSC_ONBIT(0)
+
+#define REG_DISPLAY_SETUP  0x80
+#define REG_DISPLAY_SETUP_ON   BIT(0)
+
+#define REG_ROWINT_SET 0xA0
+#define REG_ROWINT_SET_INT_EN  BIT(0)
+#define REG_R

[PATCH v6 1/3] of: add vendor prefix for Holtek Semiconductor

2016-05-18 Thread Robin van der Gracht
Signed-off-by: Robin van der Gracht 
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 86740d4..84fb85d 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -112,6 +112,7 @@ hitex   Hitex Development Tools
 holt   Holt Integrated Circuits, Inc.
 honeywell  Honeywell
 hp Hewlett Packard
+holtek Holtek Semiconductor, Inc.
 i2se   I2SE GmbH
 ibmInternational Business Machines (IBM)
 idtIntegrated Device Technologies, Inc.
-- 
2.7.4



[PATCH v6 2/3] auxdisplay: ht16k33: Driver for LED controller

2016-05-18 Thread Robin van der Gracht
Added a driver for the Holtek HT16K33 LED controller with keyscan.

Signed-off-by: Robin van der Gracht 
---
Changes in v6:
- Fixed minor typo in documentation 'KEY_F0' -> 'KEY_F10'

 .../devicetree/bindings/display/ht16k33.txt|  42 ++
 drivers/auxdisplay/Kconfig |   9 +
 drivers/auxdisplay/Makefile|   1 +
 drivers/auxdisplay/ht16k33.c   | 563 +
 4 files changed, 615 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/ht16k33.txt
 create mode 100644 drivers/auxdisplay/ht16k33.c

diff --git a/Documentation/devicetree/bindings/display/ht16k33.txt 
b/Documentation/devicetree/bindings/display/ht16k33.txt
new file mode 100644
index 000..5c11320
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/ht16k33.txt
@@ -0,0 +1,42 @@
+Holtek ht16k33 RAM mapping 16*8 LED controller driver with keyscan
+---
+
+Required properties:
+- compatible:  "holtek,ht16k33"
+- reg: I2C slave address of the chip.
+- interrupt-parent:A phandle pointing to the interrupt controller
+   serving the interrupt for this chip.
+- interrupts:  Interrupt specification for the key pressed interrupt.
+- refresh-rate-hz: Display update interval in HZ.
+- debounce-delay-ms:   Debouncing interval time in microseconds.
+- linux,keymap:The keymap for keys as described in the binding
+   document (devicetree/bindings/input/matrix-keymap.txt).
+
+Optional properties:
+- linux,no-autorepeat: Disable keyrepeat.
+- default-brightness-level: Initial brightness level [0-15] (default: 15).
+
+Example:
+
+ {
+   ht16k33: ht16k33@70 {
+   compatible = "holtek,ht16k33";
+   reg = <0x70>;
+   refresh-rate-hz = <20>;
+   debounce-delay-ms = <50>;
+   interrupt-parent = <>;
+   interrupts = <5 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>;
+   linux,keymap = <
+   MATRIX_KEY(2, 0, KEY_F6)
+   MATRIX_KEY(3, 0, KEY_F8)
+   MATRIX_KEY(4, 0, KEY_F10)
+   MATRIX_KEY(5, 0, KEY_F4)
+   MATRIX_KEY(6, 0, KEY_F2)
+   MATRIX_KEY(2, 1, KEY_F5)
+   MATRIX_KEY(3, 1, KEY_F7)
+   MATRIX_KEY(4, 1, KEY_F9)
+   MATRIX_KEY(5, 1, KEY_F3)
+   MATRIX_KEY(6, 1, KEY_F1)
+   >;
+   };
+};
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index c07e725..75ad4f5 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -119,4 +119,13 @@ config CFAG12864B_RATE
  If you compile this as a module, you can still override this
  value using the module parameters.
 
+config HT16K33
+   tristate "Holtek Ht16K33 LED controller with keyscan"
+   depends on FB && OF && I2C && INPUT
+   select INPUT_MATRIXKMAP
+   select FB_BACKLIGHT
+   help
+ Say yes here to add support for Holtek HT16K33, RAM mapping 16*8
+ LED controller driver with keyscan.
+
 endif # AUXDISPLAY
diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile
index 8a8936a..d7c9ef5 100644
--- a/drivers/auxdisplay/Makefile
+++ b/drivers/auxdisplay/Makefile
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_KS0108)   += ks0108.o
 obj-$(CONFIG_CFAG12864B)   += cfag12864b.o cfag12864bfb.o
+obj-$(CONFIG_HT16K33)  += ht16k33.o
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
new file mode 100644
index 000..eeb323f
--- /dev/null
+++ b/drivers/auxdisplay/ht16k33.c
@@ -0,0 +1,563 @@
+/*
+ * HT16K33 driver
+ *
+ * Author: Robin van der Gracht 
+ *
+ * Copyright: (C) 2016 Protonic Holland.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Registers */
+#define REG_SYSTEM_SETUP   0x20
+#define REG_SYSTEM_SETUP_OSC_ONBIT(0)
+
+#define REG_DISPLAY_SETUP  0x80
+#define REG_DISPLAY_SETUP_ON   BIT(0)
+
+#define REG_ROWINT_SET 0xA0
+#define REG_ROWINT_SET_INT_EN  BIT(0)
+#define REG_ROWINT_SET_INT_ACT_HIGHBIT(1)
+
+#define REG_BRIG

Re: [GIT PULL] move ARM LCD display driver to auxdisplay

2016-05-12 Thread Robin van der Gracht
On Mon, 9 May 2016 16:27:00 +0200
Linus Walleij <linus.wall...@linaro.org> wrote:

> On Mon, May 9, 2016 at 4:17 PM, Robin van der Gracht
> <ro...@protonic.nl> wrote:
> > On Mon, 9 May 2016 15:19:26 +0200
> > Linus Walleij <linus.wall...@linaro.org> wrote:
> >  
> >> On Mon, May 9, 2016 at 9:06 AM, Robin van der Gracht
> >> <ro...@protonic.nl> wrote:
> >>  
> >> > If you guys feel like auxdisplay is not the right subsystem for
> >> > the driver, and would like me to move it, please share.  
> >>
> >> The best would be if you volunteer to maintain it and bring
> >> it forward.  
> >
> > Thats fine. Would it suffice if I submit another patch adding myself
> > to the maintainers file?  
> 
> That's half of it, if Miguel does not come back then his name
> should be removed as the second step.
> 

First half is completed. I've added myself as maintainer for the
driver I've posted recently (HT16K33 LED CONTROLLER DRIVER).

According to MAINTAINERS, Miguel maintains:
 - CFAG12864B LCD DRIVER
 - CFAG12864BFB LCD FRAMEBUFFER DRIVER
 - KS0108 LCD CONTROLLER DRIVER
 - AUXILIARY DISPLAY DRIVERS

AFAIK, I should not be judge in Miguels case.

@linus: I'll send my patches to Greg if you agree on this.

Kind regards,
Robin van der Gracht


  1   2   >