[Galaxy Tab S2 Q&A, Help & Troubleshooting] bluess57:
Hey All,

I noticed in a kernel boot panic log a warning about gpio_ensure_requested (see below)

The charger driver code here :-

kernel/samsung/universal5433/drivers/battery/sm5703_charger.c

The code/call to the gpio_request

ret = gpio_request(charger->pdata->chgen_gpio, "sm5703_nCHGEN");

needs to be before the call to :-

sm5703_chg_init(charger);

as it goes on to act on the gpio

I'm just testing it out atm... warning fix/removed

Anyone playing along at home, the branch with the code change is here:-

GitHub - bluess57/android_kernel_samsung_universal5433 at feature/sm5703charger

Exynos5433 Kernel for Note 4 / Tab S2 Series | Lineage-OS - GitHub - bluess57/android_kernel_samsung_universal5433 at feature/sm5703charger

github.com

<6>[ 0.240331] [c4] sm5703_charger_init
<6>[ 0.240520] [c4] sm5703_charger_probe:[BATT] SM5703 Charger driver probe..
<6>[ 0.240602] [c4] sm5703_charger_parse_dt : cannot get bst_iq3limit
<7>[ 0.240624] [c4] of_get_named_gpio_flags exited with status 224
<6>[ 0.240632] [c4] sm5703_charger_parse_dt: chgen gpio : 224
<6>[ 0.240674] [c4] sm5703_charger_parse_dt full_check_type: 2
<6>[ 0.240686] [c4] sm5703_charger_parse_dt full_check_type_2nd: 0
<6>[ 0.240820] [c4] sm5703-charger sm5703-charger: sm5703 charger parse dt retval = 0
<6>[ 0.240830] [c4] sm5703_enable_autostop:[BATT] Autostop set(1)
<6>[ 0.241121] [c4] sm5703_enable_autoset:[BATT] Autoset set(1)
<6>[ 0.241404] [c4] sm5703_enable_aiclen:[BATT] AICLEN set(1)
<6>[ 0.242125] [c4] sm5703_set_aiclth : SM5703_CHGCNTL5 (AICHTH) : 0xd8
<6>[ 0.242573] [c4] sm5703_set_freqsel : SM5703_CHGCNTL6 (FREQSEL) : 0x08
<6>[ 0.242858] [c4] sm5703_set_topoff_timer : TOPOFF timer set (timer=0x2)
<6>[ 0.243307] [c4] sm5703_set_regulation_voltage : SM5703_CHGCNTL3 (Battery regulation voltage) : 0x17
<6>[ 0.243755] [c4] sm5703_set_otgcurrent : SM5703_OTGCURRENTCNTL (OTG current) : 0x02
<6>[ 0.244202] [c4] sm5703_set_bst_iq3limit : SM5703_Q3LIMITCNTL (BST_IQ3LIMIT) : 0x00
<6>[ 0.244377] [c4] sm5703_chg_init: W/A Charger already topoff state. Charger Off
<6>[ 0.244386] [c4] sm5703_enable_charger_switch: turn off charger
<4>[ 0.244395] [c4] ------------[ cut here ]------------
<4>[ 0.244413] [c4] WARNING: at ../../../../../../kernel/samsung/universal5433/drivers/gpio/gpiolib.c:160 gpio_ensure_requested+0x78/0xd8()
<4>[ 0.244422] [c4] autorequest GPIO-224
<4>[ 0.244430] [c4] Modules linked in:
<4>[ 0.244445] [c4] CPU: 4 PID: 1 Comm: swapper/0 Not tainted 3.10.21+ #25
<4>[ 0.244454] [c4] Backtrace:
<4>[ 0.244471] [c4] [<c0015a18>] (dump_backtrace+0x0/0x128) from [<c0015c68>] (show_stack+0x18/0x1c)
<4>[ 0.244480] [c4] r6:c0c4d824 r5:000000a0 r4:c0353a78 r3:00000000
<4>[ 0.244507] [c4] [<c0015c50>] (show_stack+0x0/0x1c) from [<c09a978c>] (dump_stack+0x24/0x2c)
<4>[ 0.244523] [c4] [<c09a9768>] (dump_stack+0x0/0x2c) from [<c0035a04>] (warn_slowpath_fmt+0x68/0x88)
<4>[ 0.244536] [c4] [<c003599c>] (warn_slowpath_fmt+0x0/0x88) from [<c0353a78>] (gpio_ensure_requested+0x78/0xd8)
<4>[ 0.244545] [c4] r3:000000e0 r2:c0c4d86c
<4>[ 0.244557] [c4] r6:c11ad848 r5:c0f23068 r4:c11ad84c
<4>[ 0.244577] [c4] [<c0353a00>] (gpio_ensure_requested+0x0/0xd8) from [<c0354edc>] (gpiod_direction_output+0x6c/0x360)
<4>[ 0.244585] [c4] r8:c11acdc4 r7:00000001 r6:c0f23068 r5:c0a3ced8 r4:c11ad848
<4>[ 0.244585] r3:c034fe24
<4>[ 0.244614] [c4] [<c0354e70>] (gpiod_direction_output+0x0/0x360) from [<c0356010>] (gpio_direction_output+0x34/0x58)
<4>[ 0.244623] [c4] r9:00000002 r8:e5ee1a68 r7:c000aad8 r6:c0a3cd48 r5:c0a3ced8
<4>[ 0.244623] r4:e5ee1800
<4>[ 0.244655] [c4] [<c0355fdc>] (gpio_direction_output+0x0/0x58) from [<c0756cdc>] (sm5703_enable_charger_switch+0xec/0x124)
<4>[ 0.244670] [c4] [<c0756bf0>] (sm5703_enable_charger_switch+0x0/0x124) from [<c0757ae0>] (sm5703_charger_probe+0xdcc/0x1048)
<4>[ 0.244678] [c4] r5:00000007 r4:e5ee1800
<4>[ 0.244698] [c4] [<c0756d14>] (sm5703_charger_probe+0x0/0x1048) from [<c0431480>] (platform_drv_probe+0x20/0x24)
<4>[ 0.244713] [c4] [<c0431460>] (platform_drv_probe+0x0/0x24) from [<c042fd10>] (really_probe+0x7c/0x2c8)
<4>[ 0.244726] [c4] [<c042fc94>] (really_probe+0x0/0x2c8) from [<c0430118>] (driver_probe_device+0x34/0x54)
<4>[ 0.244735] [c4] r7:c0430184 r6:e5eb4444 r5:c0f4b828 r4:e5eb4410
<4>[ 0.244757] [c4] [<c04300e4>] (driver_probe_device+0x0/0x54) from [<c0430218>] (__driver_attach+0x94/0x98)
<4>[ 0.244765] [c4] r5:c0f4b828 r4:e5eb4410
<4>[ 0.244783] [c4] [<c0430184>] (__driver_attach+0x0/0x98) from [<c042df8c>] (bus_for_each_dev+0x74/0xa8)
<4>[ 0.244791] [c4] r6:c0f4b828 r5:e69bde60 r4:00000000 r3:00000001
<4>[ 0.244812] [c4] [<c042df18>] (bus_for_each_dev+0x0/0xa8) from [<c042f960>] (driver_attach+0x24/0x2c)
<4>[ 0.244821] [c4] r7:00000000 r6:c0f3ac80 r5:c0f4b828 r4:e604ae80
<4>[ 0.244842] [c4] [<c042f93c>] (driver_attach+0x0/0x2c) from [<c042f4b0>] (bus_add_driver+0x1dc/0x290)
<4>[ 0.244856] [c4] [<c042f2d4>] (bus_add_driver+0x0/0x290) from [<c04308fc>] (driver_register+0x80/0x150)
<4>[ 0.244864] [c4] r7:c0d6a224 r6:00000004 r5:0000014c r4:c0f4b828
<4>[ 0.244887] [c4] [<c043087c>] (driver_register+0x0/0x150) from [<c0431a6c>] (platform_driver_register+0x5c/0x70)
<4>[ 0.244895] [c4] r8:e69bc008 r7:c0d6a224 r6:00000004 r5:0000014c r4:c0dd0460
<4>[ 0.244895] r3:00000000
<4>[ 0.244928] [c4] [<c0431a10>] (platform_driver_register+0x0/0x70) from [<c0db26b8>] (sm5703_charger_init+0x30/0x40)
<4>[ 0.244942] [c4] [<c0db2688>] (sm5703_charger_init+0x0/0x40) from [<c000b040>] (do_one_initcall+0x11c/0x1a0)
<4>[ 0.244957] [c4] [<c000af24>] (do_one_initcall+0x0/0x1a0) from [<c0d6de4c>] (kernel_init_freeable+0x168/0x254)
<4>[ 0.244971] [c4] [<c0d6dce4>] (kernel_init_freeable+0x0/0x254) from [<c099c78c>] (kernel_init+0x10/0x1d8)
<4>[ 0.244984] [c4] [<c099c77c>] (kernel_init+0x0/0x1d8) from [<c0011218>] (ret_from_fork+0x14/0x3c)
<4>[ 0.244992] [c4] r5:c099c77c r4:00000000
<4>[ 0.245015] [c4] ---[ end trace 4bedb166006344bf ]---