Bug 196837

Summary: keyboard fails after upgrade to 4.13.0 from 4.13.0-rc7
Product: Drivers Reporter: Chris Gorman (chrisjohgorman)
Component: Input DevicesAssignee: drivers_input-devices
Status: RESOLVED DUPLICATE    
Severity: normal CC: andy.shevchenko, dmitry.torokhov, mika.westerberg
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 4.13.0 Subsystem:
Regression: No Bisected commit-id:
Attachments: config file from my build
dmidecode showing Manufacturer: GOOGLE ; Family: Intel_Strago

Description Chris Gorman 2017-09-05 23:17:33 UTC
Created attachment 258215 [details]
config file from my build

Somewhere between 4.13.0-rc7 and 4.13.0 my keyboard fails.  I looked at the git changes, but I can't see what has done this.  The computer is a google chromebook laptop, acer chromebook 15, model cb3-532.  The reboot key still works.  I made no kernel configuration changes between kernel builds, but have attached my .config in case it is useful.
Comment 1 Chris Gorman 2017-09-06 19:44:35 UTC
I'm trying to see where the keyboard stops working via git bisect.  I have 11 kernel builds to do to try this approach, so it may take a week.  In looking at the kernel git log I cannot see anything touching the at keyboard.  So in short, I'm not sure where this bug should be assigned.
Comment 2 Chris Gorman 2017-09-07 15:56:05 UTC
I found the problem commit, now I will try to look through it to see where my keyboard fails.

After applying this, my keyboard ceases to work, safe the power button.

bad: [e7d0c41ecc2e372a81741a30894f556afec24315] Merge tag 'devprop-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Comment 3 Dmitry Torokhov 2017-09-07 17:37:14 UTC
I do not think this is the right commit. You device is a Braswell Chromebook ("Banon") and is likely to be affected by https://bugzilla.kernel.org/show_bug.cgi?id=194945

Please look at your dmidecode output and see why quirks in drivers/pinctrl/intel/pinctrl-cherryview.c do don trigger for you. It probably does not have "Intel_Strago" as product family in DMI data.
Comment 4 Chris Gorman 2017-09-07 17:54:07 UTC
Created attachment 258255 [details]
dmidecode showing Manufacturer: GOOGLE ; Family: Intel_Strago
Comment 5 Chris Gorman 2017-09-07 18:13:38 UTC
(In reply to Dmitry Torokhov from comment #3)
> I do not think this is the right commit. You device is a Braswell Chromebook
> ("Banon") and is likely to be affected by
> https://bugzilla.kernel.org/show_bug.cgi?id=194945
> 
> Please look at your dmidecode output and see why quirks in
> drivers/pinctrl/intel/pinctrl-cherryview.c do don trigger for you. It
> probably does not have "Intel_Strago" as product family in DMI data.

Thanks for the pointer I will look at 194945 to see if I can get the keyboard working again.  I'm currently trying a build minus the code via git revert -m 1 e7d0c41ecc2e372a81741a30894f556afec24315 .  Since it's currently building, I'll test it out to see if it fixes the keyboard.

I have looked at the dmidecode output and drivers/pinctrl/intel/pinctrl-cherryview.c.  It appears that the Intel_Strago and GOOGLE strings are present.
Comment 6 Chris Gorman 2017-09-08 13:01:51 UTC
I went through the process of doing git bisect again, properly this time (I hope).  I got the following commit as my problem.  

commit dc749a09ea5e413564115dee742c3bc958248707
Author: Grygorii Strashko <grygorii.strashko@ti.com>
Date:   Fri Jul 21 11:49:00 2017 -0500

    gpiolib: allow gpio irqchip to map irqs dynamically
    
    Now IRQ mappings are always created for all (allowed) GPIOs in gpiochip in
    gpiochip_irqchip_add_key() which goes against the idea of SPARSE_IRQ and,
    as result, leads to:
     - increasing of memory consumption for IRQ descriptors most of which will
    never ever be used (espessially on platform with a high number of GPIOs).
    (sizeof(struct irq_desc) == 256 on my tested platforms)
     - imposibility to use GPIO irqchip APIs by gpio drivers when HW implements
    GPIO IRQ functionality as IRQ crossbar/router which has only limited
    number of IRQ outputs (example from [1], all GPIOs can be mapped on only 8
    IRQs).
    
    Hence, remove static IRQ mapping code from gpiochip_irqchip_add_key() and
    instead replace irq_find_mapping() with irq_create_mapping() in
    gpiochip_to_irq(). Also add additional gpiochip_irqchip_irq_valid() calls
    in gpiochip_to_irq() and gpiochip_irq_map().
    
    After this change gpio2irq mapping will happen the following way when GPIO
    irqchip APIs are used by gpio driver:
     - IRQ mappings will be created statically if driver passes first_irq>0
    vlaue in gpiochip_irqchip_add_key().
     - IRQ mappings will be created dynamically from gpio_to_irq() or
    of_irq_get().
    
    Tested on am335x-evm and dra72-evm-revc.
    - dra72-evm-revc: number of created irq mappings decreased from 402 -> 135
      Mem savings 267*256 = 68352 (66kB)
    - am335x-evm: number of created irq mappings decreased from 188 -> 63
      Mem savings 125*256 = 32000 (31kB)
    
    [1] https://lkml.org/lkml/2017/6/15/428
    
    Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

:040000 040000 c90387527eb9d519a82a2e406c3a517240240dd6 5b30d02d273ea4233763bbdcd68b06cdf93e0591 M	drivers

Based on the discussion in https://bugzilla.kernel.org/show_bug.cgi?id=194945 this sounds a little bit more like it.  I'm not sure where to go from here.  I will perhaps try to do a git revert on this patch from the head.  There's also the possibility of trying the old galliumos patch which changes the number of irq's on the north_community.
Comment 7 Chris Gorman 2017-09-08 17:26:04 UTC
Reverting the commit dc749a09ea5e413564115dee742c3bc958248707 causes the build to brake.  Increasing the number of irq's on the north_community in drivers/pinctrl/intel/pinctrl-cherryview.c from 8 to 9 fixes the problem for me.
Comment 8 Chris Gorman 2017-09-08 17:26:45 UTC
Reverting the commit dc749a09ea5e413564115dee742c3bc958248707 causes the build to brake.  Increasing the number of irq's on the north_community in drivers/pinctrl/intel/pinctrl-cherryview.c from 8 to 9 fixes the problem for me.
Comment 9 Chris Gorman 2017-09-08 23:06:04 UTC
Sad to say I have not found the offending patch.  Please excuse my ignorance of what I was doing with git bisect as it was my first time using it.  dc749a09ea5e413564115dee742c3bc958248707 is the final patch that needed to be removed to get a working build.

I am going to close this as it is a duplicate of https://bugzilla.kernel.org/show_bug.cgi?id=194945 .  Thank you to Dimitry for pointing me in the right direction.
Comment 10 Chris Gorman 2017-09-08 23:06:23 UTC

*** This bug has been marked as a duplicate of bug 194945 ***