OMAP baseline test results for v3.13-rc1 (toolchain Debian 4.7.2-5)
Here are some basic OMAP test results for Linux v3.13-rc1. Logs and other details at: http://www.pwsan.com/omap/testlogs/test_v3.13-rc1/20131124230250/ Test summary Build: uImage+dtb: Pass ( 3/ 3): omap2plus_defconfig_am33xx_only/am335x-bone, omap2plus_defconfig/omap4-panda, omap2plus_defconfig/omap4-panda-es Build: zImage: Pass ( 2/ 2): omap2plus_defconfig, omap2plus_defconfig_am33xx_only Build: uImage: Pass (14/14): omap1_defconfig, omap1_defconfig_1510innovator_only, omap1_defconfig_5912osk_only, omap2plus_defconfig, omap2plus_defconfig_2430sdp_only, omap2plus_defconfig_cpupm, omap2plus_defconfig_no_pm, omap2plus_defconfig_n800_only_a, omap2plus_defconfig_n800_multi_omap2xxx, omap2plus_defconfig_omap2_4_only, omap2plus_defconfig_omap3_4_only, rmk_omap3430_ldp_allnoconfig, rmk_omap3430_ldp_oldconfig, rmk_omap4430_sdp_allnoconfig Boot to userspace: FAIL ( 1/11): 37xxevm skip ( 1/ 1): 5912osk Pass (10/11): 2430sdp, 3517evm, 3530es3beagle, 3730beaglexm, 4430es2panda, 4460pandaes, am335xbone, am335xbonelt, cmt3517, 4460varsomom PM: chip retention via suspend: FAIL ( 4/ 7): 2430sdp, 37xxevm, 4430es2panda, 4460varsomom Pass ( 3/ 7): 3530es3beagle, 3730beaglexm, 4460pandaes PM: chip retention via dynamic idle: FAIL ( 5/ 7): 2430sdp, 37xxevm, 4430es2panda, 4460pandaes, 4460varsomom Pass ( 2/ 7): 3530es3beagle, 3730beaglexm PM: chip off except CORE via suspend: Pass ( 1/ 1): 3730beaglexm PM: chip off except CORE via dynamic idle: Pass ( 1/ 1): 3730beaglexm PM: chip off via suspend: FAIL ( 4/ 5): 37xxevm, 4430es2panda, 4460pandaes, 4460varsomom Pass ( 1/ 5): 3530es3beagle PM: chip off via dynamic idle: FAIL ( 4/ 5): 37xxevm, 4430es2panda, 4460pandaes, 4460varsomom Pass ( 1/ 5): 3530es3beagle vmlinux object size (delta in bytes from test_v3.12 (5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52)): text data bsstotal kernel -351659 +384+4216 -347059 omap1_defconfig -354695 +296+4216 -350183 omap1_defconfig_1510innovator_only -354491 +360+4216 -349915 omap1_defconfig_5912osk_only -276029-5584+5008 -276605 omap2plus_defconfig -292693+9808+4656 -278229 omap2plus_defconfig_2430sdp_only -273194-5512+5008 -273698 omap2plus_defconfig_cpupm +88436 +10392+4368 +103196 omap2plus_defconfig_n800_multi_omap2xxx +88404 +10408+4368 +103180 omap2plus_defconfig_n800_only_a -273765-4704+5008 -273461 omap2plus_defconfig_no_pm -263629 +13912+4944 -244773 omap2plus_defconfig_omap2_4_only -270645-5584+5008 -271221 omap2plus_defconfig_omap3_4_only -119620 -10124+2856 -126888 rmk_omap3430_ldp_allnoconfig +49719+3928+4352 +57999 rmk_omap3430_ldp_oldconfig -115704+1788+5608 -108308 rmk_omap4430_sdp_allnoconfig +4738404 +250480 +443152 +5432036 rmk_omap4430_sdp_oldnoconfig Re-enabled rmk_omap4430_sdp_oldnoconfig. A significant portion of the size delta is due to switch in the toolchain used for the testbed, to the Emdebian gcc 4.7. See also the message with the subject line "OMAP baseline test results for v3.13-rc1 (toolchain CodeSourcery 2010.09-50)" for the results with the previous compiler used. Boot-time memory difference (delta in bytes from test_v3.12 (5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52)) avail rsrvd high freed board kconfig -104k 104k . 4k 2420n800 omap2plus_defconfig_n800_only_a 276k -276k .-8k 2430sdpomap2plus_defconfig 276k -276k .-8k 3517evmomap2plus_defconfig 276k -276k .-8k 3530es3beagle omap2plus_defconfig 276k -276k .-8k 3730beaglexm omap2plus_defconfig -227908k -33212k . -392k 37xxevmomap2plus_defconfig 272k -272k .-8k 4430es2panda omap2plus_defconfig 268k -268k .-8k 4460pandaesomap2plus_defconfig 272k -272k .-8k 4460varsomom omap2plus_defconfig 312k -312k . 4k am335xbone omap2plus_defconfig_am33xx_only 268k -268k .-8k am335xbonelt omap2plus_defconfig_am33xx_only -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
OMAP baseline test results for v3.13-rc1 (toolchain CodeSourcery 2010.09-50)
Here are some basic OMAP test results for Linux v3.13-rc1. Logs and other details at: http://www.pwsan.com/omap/testlogs/test_v3.13-rc1/20131124223225/ Test summary Build: uImage+dtb: Pass ( 3/ 3): omap2plus_defconfig_am33xx_only/am335x-bone, omap2plus_defconfig/omap4-panda, omap2plus_defconfig/omap4-panda-es Build: zImage: Pass ( 2/ 2): omap2plus_defconfig, omap2plus_defconfig_am33xx_only Build: uImage: Pass (14/14): omap1_defconfig, omap1_defconfig_1510innovator_only, omap1_defconfig_5912osk_only, omap2plus_defconfig, omap2plus_defconfig_2430sdp_only, omap2plus_defconfig_cpupm, omap2plus_defconfig_no_pm, omap2plus_defconfig_n800_only_a, omap2plus_defconfig_n800_multi_omap2xxx, omap2plus_defconfig_omap2_4_only, omap2plus_defconfig_omap3_4_only, rmk_omap3430_ldp_allnoconfig, rmk_omap3430_ldp_oldconfig, rmk_omap4430_sdp_allnoconfig Boot to userspace: FAIL ( 1/11): 37xxevm skip ( 1/ 1): 5912osk Pass (10/11): 2430sdp, 3517evm, 3530es3beagle, 3730beaglexm, 4430es2panda, 4460pandaes, am335xbone, am335xbonelt, cmt3517, 4460varsomom PM: chip retention via suspend: FAIL ( 4/ 7): 2430sdp, 37xxevm, 4430es2panda, 4460varsomom Pass ( 3/ 7): 3530es3beagle, 3730beaglexm, 4460pandaes PM: chip retention via dynamic idle: FAIL ( 5/ 7): 2430sdp, 37xxevm, 4430es2panda, 4460pandaes, 4460varsomom Pass ( 2/ 7): 3530es3beagle, 3730beaglexm PM: chip off except CORE via suspend: Pass ( 1/ 1): 3730beaglexm PM: chip off except CORE via dynamic idle: Pass ( 1/ 1): 3730beaglexm PM: chip off via suspend: FAIL ( 4/ 5): 37xxevm, 4430es2panda, 4460pandaes, 4460varsomom Pass ( 1/ 5): 3530es3beagle PM: chip off via dynamic idle: FAIL ( 4/ 5): 37xxevm, 4430es2panda, 4460pandaes, 4460varsomom Pass ( 1/ 5): 3530es3beagle vmlinux object size (delta in bytes from test_v3.12 (5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52)): text data bsstotal kernel +53225 +320+4200 +57745 omap1_defconfig +50509 +216+4200 +54925 omap1_defconfig_1510innovator_only +47177 +272+4200 +51649 omap1_defconfig_5912osk_only +146639-6024+5056 +145671 omap2plus_defconfig +98635+9768+4672 +113075 omap2plus_defconfig_2430sdp_only +150542-6040+5056 +149558 omap2plus_defconfig_cpupm +83976 +10248+4400 +98624 omap2plus_defconfig_n800_multi_omap2xxx +83920 +10248+4400 +98568 omap2plus_defconfig_n800_only_a +145995-5224+5056 +145827 omap2plus_defconfig_no_pm +154543 +13528+4992 +173063 omap2plus_defconfig_omap2_4_only +150515-6016+5056 +149555 omap2plus_defconfig_omap3_4_only +30064 -10076+3116 +23104 rmk_omap3430_ldp_allnoconfig +48163+3960+4352 +56475 rmk_omap3430_ldp_oldconfig +34920+1748+5764 +42432 rmk_omap4430_sdp_allnoconfig +4532235 +248124 +439128 +5219487 rmk_omap4430_sdp_oldnoconfig Boot-time memory difference (delta in bytes from test_v3.12 (5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52)) avail rsrvd high freed board kconfig -96k96k . 4k 2420n800 omap2plus_defconfig_n800_only_a -140k 140k .-4k 2430sdpomap2plus_defconfig -140k 140k .-4k 3517evmomap2plus_defconfig -140k 140k .-4k 3530es3beagle omap2plus_defconfig -140k 140k .-4k 3730beaglexm omap2plus_defconfig -227908k -33212k . -392k 37xxevmomap2plus_defconfig -140k 140k .-4k 4430es2panda omap2plus_defconfig -144k 144k .-4k 4460pandaesomap2plus_defconfig -144k 144k .-4k 4460varsomom omap2plus_defconfig -144k 144k . 4k am335xbone omap2plus_defconfig_am33xx_only -148k 148k .-4k am335xbonelt omap2plus_defconfig_am33xx_only Re-enabled rmk_omap4430_sdp_oldnoconfig. Will be switching toolchains from CodeSourcery 2010.09-50 to Debian 4.7.2-5; a test with the newer toolchain version is to follow. -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: ARM: v3.13-rc1: USB regression
On Mon, Nov 25, 2013 at 12:22:47AM +0200, Aaro Koskinen wrote: > Hi, > > With 3.13-rc1, the USB OHCI probe fails on Amstrad E3 (ARM/OMAP1) > as follows: > > [ 33.814705] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver > [ 33.821482] ohci-omap: OHCI OMAP driver > [ 33.925153] ohci ohci: OMAP OHCI > [ 33.929087] ohci ohci: new USB bus registered, assigned bus number 1 > [ 33.967324] ohci ohci: Coherent DMA mask 0x (pfn 0xe-0xe) > covers a smaller range of system memory than the DMA zone pfn 0x0-0x10 > [ 33.982292] ohci ohci: can't setup: -12 > [ 33.987898] ohci ohci: USB bus 1 deregistered > [ 33.992984] ohci: probe of ohci failed with error -12 > > I bisected this to 4dcfa60071b3d23f0181f27d8519f12e37cefbb9 (ARM: DMA-API: > better handing of DMA masks for coherent allocations). Reverting that > commit makes the USB work again fine. This is because of this: #define __arch_dma_to_pfn(dev, addr)\ ({ dma_addr_t __dma = addr; \ if (is_lbus_device(dev)) \ __dma += PHYS_OFFSET - OMAP1510_LB_OFFSET; \ __phys_to_pfn(__dma);\ }) dma_addr_t is 32-bit. PHYS_OFFSET - OMAP1510_LB_OFFSET is 0xe000. Consider what the result of passing 0x as addr into this is. Better would be: #define __arch_dma_to_pfn(dev, addr)\ ({ unsigned long pfn = (addr) >> PAGE_SHIFT;\ if (is_lbus_device(dev)) \ pfn += PHYS_PFN_OFFSET -\ (OMAP1510_LB_OFFSET >> PAGE_SHIFT); \ pfn; \ }) Can you try that in arch/arm/mach-omap1/include/mach/memory.h please? -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
ARM: v3.13-rc1: USB regression
Hi, With 3.13-rc1, the USB OHCI probe fails on Amstrad E3 (ARM/OMAP1) as follows: [ 33.814705] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 33.821482] ohci-omap: OHCI OMAP driver [ 33.925153] ohci ohci: OMAP OHCI [ 33.929087] ohci ohci: new USB bus registered, assigned bus number 1 [ 33.967324] ohci ohci: Coherent DMA mask 0x (pfn 0xe-0xe) covers a smaller range of system memory than the DMA zone pfn 0x0-0x10 [ 33.982292] ohci ohci: can't setup: -12 [ 33.987898] ohci ohci: USB bus 1 deregistered [ 33.992984] ohci: probe of ohci failed with error -12 I bisected this to 4dcfa60071b3d23f0181f27d8519f12e37cefbb9 (ARM: DMA-API: better handing of DMA masks for coherent allocations). Reverting that commit makes the USB work again fine. A. -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode
On Sun, Nov 24, 2013 at 08:41:46PM +0100, Pali Rohár wrote: > On Sunday 24 November 2013 20:26:09 Sebastian Reichel wrote: > > On Sun, Nov 24, 2013 at 08:01:16PM +0100, Pali Rohár wrote: > > > Currently on Maemo 5 this is handled in userspace (with open > > > source dsme daemon). > > > > I assume it currently also takes care of the bq2415x watchdog? > > That means if the daemon dies charging will stop, because the > > watchdog does no longer trigger. > > > > When your patch is applied you have introduced a safety issue. > > When the daemon dies charging will continue and temperature is > > no longer checked. > > > > -- Sebastian > > No dsme checking battery temperature and does not handle bq24510 > timer (previously this was in closed bme daemon which > functionality is now in kernel drivers). Ok, so then the temperature checks are done by bme. > But dsme daemon also kicking tlw4030 watchdog, so when daemon dies > after 30s tlw4030 reboot device. Yes, but that does not matter if it does not take care of the charging. If the dsme daemon is not started for some reason phone will not be rebootet and phone charges. > But right you can implement correctly this in userspace (e.g. > when daemon not running/crashed, you can restart daemon or reboot > system or disable charing, whatever...) and you do not need to > have it in kernel... That does not change the fact, that the kernel openes a safety issue in default configuration. To be on the safe side charging must be disabled until some safety checking daemon enables it. -- Sebastian signature.asc Description: Digital signature
Re: [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode
On Sunday 24 November 2013 20:26:09 Sebastian Reichel wrote: > On Sun, Nov 24, 2013 at 08:01:16PM +0100, Pali Rohár wrote: > > Currently on Maemo 5 this is handled in userspace (with open > > source dsme daemon). > > I assume it currently also takes care of the bq2415x watchdog? > That means if the daemon dies charging will stop, because the > watchdog does no longer trigger. > > When your patch is applied you have introduced a safety issue. > When the daemon dies charging will continue and temperature is > no longer checked. > > -- Sebastian No dsme checking battery temperature and does not handle bq24510 timer (previously this was in closed bme daemon which functionality is now in kernel drivers). But dsme daemon also kicking tlw4030 watchdog, so when daemon dies after 30s tlw4030 reboot device. But right you can implement correctly this in userspace (e.g. when daemon not running/crashed, you can restart daemon or reboot system or disable charing, whatever...) and you do not need to have it in kernel... -- Pali Rohár pali.ro...@gmail.com signature.asc Description: This is a digitally signed message part.
Re: [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode
On Sun, Nov 24, 2013 at 08:01:16PM +0100, Pali Rohár wrote: > > I'm wondering if the watchdog thread should check some values, > > like e.g. battery temperature. It should stop charging the > > battery if some critical battery temperature threshold is > > reached. > > For checking battery temperature is needed third driver > (rx51_battery.ko). I know, but that doesn't mean one can skip the check. > And I think this should not be implemented in driver itself but in > charger manager framework... There is a reason, that the HW has a watchdog. I think the safety relevant stuff should be done in the watchdog thread. This ensures, that charging depends on reading the safety relevant sensors. Of course the watchdog stuff could be moved into the charger manager framework... > Currently on Maemo 5 this is handled in userspace (with open > source dsme daemon). I assume it currently also takes care of the bq2415x watchdog? That means if the daemon dies charging will stop, because the watchdog does no longer trigger. When your patch is applied you have introduced a safety issue. When the daemon dies charging will continue and temperature is no longer checked. -- Sebastian signature.asc Description: Digital signature
Re: [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode
On Sunday 24 November 2013 18:18:03 Michael Trimarchi wrote: > Hi > > On Tue, Nov 19, 2013 at 11:18 AM, Pali Rohár wrote: > > This patch removing set_mode_hook function from board data > > and replacing it with new string variable of notifier power > > supply device. After this change it is possible to add DT > > support because driver does not need specific board > > function anymore. Only static data and name of power supply > > device is required. > > > > Signed-off-by: Pali Rohár > > --- > > > > drivers/power/bq2415x_charger.c | 77 > > + > > include/linux/power/bq2415x_charger.h | 48 > > +++- 2 files changed, 65 insertions(+), 60 > > deletions(-) > > ... > > > > - struct bq2415x_device *bq = data; > > + struct bq2415x_device *bq = > > + container_of(nb, struct bq2415x_device, nb); > > + struct power_supply *psy = v; > > + enum bq2415x_mode mode; > > + union power_supply_propval prop; > > + int ret; > > + int mA; > > > > - if (!bq) > > - return; > > + if (val != PSY_EVENT_PROP_CHANGED) > > + return NOTIFY_OK; > > + > > + if (strcmp(psy->name, bq->init_data.notify_device) > > != 0) + return NOTIFY_OK; > > + > > + dev_dbg(bq->dev, "notifier call was called\n"); > > + > > + ret = psy->get_property(psy, > > POWER_SUPPLY_PROP_CURRENT_MAX, &prop); + if (ret != > > 0) > > + return NOTIFY_OK; > > So you can read this value without any type of synchronization > with the power_supply_core > and sysfs implementation? > > > Michael > I do not see reason why I cannot use it. When isp1704 driver send PSY_EVENT_PROP_CHANGED then property POWER_SUPPLY_PROP_CURRENT_MAX is already updated and can be read by get_property function. -- Pali Rohár pali.ro...@gmail.com signature.asc Description: This is a digitally signed message part.
Re: [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode
On Sunday 24 November 2013 18:00:00 Sebastian Reichel wrote: > Hi, > > On Tue, Nov 19, 2013 at 11:18:04AM +0100, Pali Rohár wrote: > > This patch removing set_mode_hook function from board data > > and replacing it with new string variable of notifier power > > supply device. After this change it is possible to add DT > > support because driver does not need specific board > > function anymore. Only static data and name of power supply > > device is required. > > I'm wondering if the watchdog thread should check some values, > like e.g. battery temperature. It should stop charging the > battery if some critical battery temperature threshold is > reached. > > -- Sebastian For checking battery temperature is needed third driver (rx51_battery.ko). And I think this should not be implemented in driver itself but in charger manager framework... Currently on Maemo 5 this is handled in userspace (with open source dsme daemon). -- Pali Rohár pali.ro...@gmail.com signature.asc Description: This is a digitally signed message part.
Re: [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode
Hi On Tue, Nov 19, 2013 at 11:18 AM, Pali Rohár wrote: > This patch removing set_mode_hook function from board data and replacing it > with > new string variable of notifier power supply device. After this change it is > possible to add DT support because driver does not need specific board > function > anymore. Only static data and name of power supply device is required. > > Signed-off-by: Pali Rohár > --- > drivers/power/bq2415x_charger.c | 77 > + > include/linux/power/bq2415x_charger.h | 48 +++- > 2 files changed, 65 insertions(+), 60 deletions(-) > > diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c > index 0727f92..d89583d 100644 > --- a/drivers/power/bq2415x_charger.c > +++ b/drivers/power/bq2415x_charger.c > @@ -1,7 +1,7 @@ > /* > * bq2415x charger driver > * > - * Copyright (C) 2011-2012 Pali Rohár > + * Copyright (C) 2011-2013 Pali Rohár > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License as published by > @@ -170,6 +170,7 @@ struct bq2415x_device { > struct bq2415x_platform_data init_data; > struct power_supply charger; > struct delayed_work work; > + struct notifier_block nb; > enum bq2415x_mode reported_mode;/* mode reported by hook function */ > enum bq2415x_mode mode; /* current configured mode */ > enum bq2415x_chip chip; > @@ -791,24 +792,53 @@ static int bq2415x_set_mode(struct bq2415x_device *bq, > enum bq2415x_mode mode) > > } > > -/* hook function called by other driver which set reported mode */ > -static void bq2415x_hook_function(enum bq2415x_mode mode, void *data) > +static int bq2415x_notifier_call(struct notifier_block *nb, > + unsigned long val, void *v) > { > - struct bq2415x_device *bq = data; > + struct bq2415x_device *bq = > + container_of(nb, struct bq2415x_device, nb); > + struct power_supply *psy = v; > + enum bq2415x_mode mode; > + union power_supply_propval prop; > + int ret; > + int mA; > > - if (!bq) > - return; > + if (val != PSY_EVENT_PROP_CHANGED) > + return NOTIFY_OK; > + > + if (strcmp(psy->name, bq->init_data.notify_device) != 0) > + return NOTIFY_OK; > + > + dev_dbg(bq->dev, "notifier call was called\n"); > + > + ret = psy->get_property(psy, POWER_SUPPLY_PROP_CURRENT_MAX, &prop); > + if (ret != 0) > + return NOTIFY_OK; So you can read this value without any type of synchronization with the power_supply_core and sysfs implementation? Michael > + > + mA = prop.intval; > + > + if (mA == 0) > + mode = BQ2415X_MODE_OFF; > + else if (mA < 500) > + mode = BQ2415X_MODE_NONE; > + else if (mA < 1800) > + mode = BQ2415X_MODE_HOST_CHARGER; > + else > + mode = BQ2415X_MODE_DEDICATED_CHARGER; > + > + if (bq->reported_mode == mode) > + return NOTIFY_OK; > > - dev_dbg(bq->dev, "hook function was called\n"); > bq->reported_mode = mode; > > /* if automode is not enabled do not tell about reported_mode */ > if (bq->automode < 1) > - return; > + return NOTIFY_OK; > > sysfs_notify(&bq->charger.dev->kobj, NULL, "reported_mode"); > bq2415x_set_mode(bq, bq->reported_mode); > > + return NOTIFY_OK; > } > > / timer functions / > @@ -1508,6 +1538,7 @@ static int bq2415x_probe(struct i2c_client *client, > int num; > char *name; > struct bq2415x_device *bq; > + struct power_supply *psy; > > if (!client->dev.platform_data) { > dev_err(&client->dev, "platform data not set\n"); > @@ -1569,16 +1600,27 @@ static int bq2415x_probe(struct i2c_client *client, > goto error_4; > } > > - if (bq->init_data.set_mode_hook) { > - if (bq->init_data.set_mode_hook( > - bq2415x_hook_function, bq)) { > - bq->automode = 1; > + if (bq->init_data.notify_device) { > + bq->nb.notifier_call = bq2415x_notifier_call; > + ret = power_supply_reg_notifier(&bq->nb); > + if (ret) { > + dev_err(bq->dev, "failed to reg notifier: %d\n", ret); > + goto error_5; > + } > + psy = power_supply_get_by_name(bq->init_data.notify_device); > + if (psy) { > + /* Query for initial reported_mode and set it */ > + bq2415x_notifier_call(&bq->nb, > + PSY_EVENT_PROP_CHANGED, psy); > bq2415x_set_mode(bq, bq->reported_mode); > - dev
Re: [PATCH v2 1/3] power_supply: Add power_supply notifier
Hi, On Tue, Nov 19, 2013 at 11:18:03AM +0100, Pali Rohár wrote: > This patch adds a notifier chain to the power_supply. > This notifier helps drivers in other subsystem to listen to > changes in power supply subsystem. This would help to take some > actions in those drivers on changing the power supply properties. > One such scenario is to increase/decrease system performance based > on the battery capacity/voltage. Another scenario is to adjust the > h/w peak current detection voltage/current thresholds based on battery > voltage/capacity. The notifier helps drivers to listen to changes > in power_suppy susbystem without polling the power_supply properties > > [...] Tested-By: Sebastian Reichel -- Sebastian signature.asc Description: Digital signature
Re: [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode
Hi, On Tue, Nov 19, 2013 at 11:18:04AM +0100, Pali Rohár wrote: > This patch removing set_mode_hook function from board data and replacing it > with > new string variable of notifier power supply device. After this change it is > possible to add DT support because driver does not need specific board > function > anymore. Only static data and name of power supply device is required. I'm wondering if the watchdog thread should check some values, like e.g. battery temperature. It should stop charging the battery if some critical battery temperature threshold is reached. -- Sebastian signature.asc Description: Digital signature
[PATCH 2/3] bq2415x_charger: add DT support
This adds DT support to the bq2415x driver. Signed-off-by: Sebastian Reichel --- drivers/power/bq2415x_charger.c | 72 + 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index d89583d..76a140c 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c @@ -170,6 +170,7 @@ struct bq2415x_device { struct bq2415x_platform_data init_data; struct power_supply charger; struct delayed_work work; + struct power_supply *notify_psy; struct notifier_block nb; enum bq2415x_mode reported_mode;/* mode reported by hook function */ enum bq2415x_mode mode; /* current configured mode */ @@ -806,7 +807,7 @@ static int bq2415x_notifier_call(struct notifier_block *nb, if (val != PSY_EVENT_PROP_CHANGED) return NOTIFY_OK; - if (strcmp(psy->name, bq->init_data.notify_device) != 0) + if (psy != bq->notify_psy) return NOTIFY_OK; dev_dbg(bq->dev, "notifier call was called\n"); @@ -1538,10 +1539,11 @@ static int bq2415x_probe(struct i2c_client *client, int num; char *name; struct bq2415x_device *bq; - struct power_supply *psy; + struct device_node *np = client->dev.of_node; + struct bq2415x_platform_data *pdata = client->dev.platform_data; - if (!client->dev.platform_data) { - dev_err(&client->dev, "platform data not set\n"); + if (!np && !pdata) { + dev_err(&client->dev, "platform data missing\n"); return -ENODEV; } @@ -1566,6 +1568,17 @@ static int bq2415x_probe(struct i2c_client *client, goto error_2; } + if (np) { + bq->notify_psy = power_supply_get_by_phandle(np, "ti,usb-charger-detection"); + + if (!bq->notify_psy) + return -EPROBE_DEFER; + } + else if (pdata->notify_device) + bq->notify_psy = power_supply_get_by_name(pdata->notify_device); + else + bq->notify_psy = NULL; + i2c_set_clientdata(client, bq); bq->id = num; @@ -1577,8 +1590,34 @@ static int bq2415x_probe(struct i2c_client *client, bq->autotimer = 0; bq->automode = 0; - memcpy(&bq->init_data, client->dev.platform_data, - sizeof(bq->init_data)); + if (np) { + ret = of_property_read_u32(np, "ti,current-limit", + &bq->init_data.current_limit); + if (ret) + return ret; + ret = of_property_read_u32(np, "ti,weak-battery-voltage", + &bq->init_data.weak_battery_voltage); + if (ret) + return ret; + ret = of_property_read_u32(np, "ti,battery-regulation-voltage", + &bq->init_data.battery_regulation_voltage); + if (ret) + return ret; + ret = of_property_read_u32(np, "ti,charge-current", + &bq->init_data.charge_current); + if (ret) + return ret; + ret = of_property_read_u32(np, "ti,termination-current", + &bq->init_data.termination_current); + if (ret) + return ret; + ret = of_property_read_u32(np, "ti,resistor-sense", + &bq->init_data.resistor_sense); + if (ret) + return ret; + } else { + memcpy(&bq->init_data, pdata, sizeof(bq->init_data)); + } bq2415x_reset_chip(bq); @@ -1600,25 +1639,18 @@ static int bq2415x_probe(struct i2c_client *client, goto error_4; } - if (bq->init_data.notify_device) { + if (bq->notify_psy) { bq->nb.notifier_call = bq2415x_notifier_call; ret = power_supply_reg_notifier(&bq->nb); if (ret) { dev_err(bq->dev, "failed to reg notifier: %d\n", ret); goto error_5; } - psy = power_supply_get_by_name(bq->init_data.notify_device); - if (psy) { - /* Query for initial reported_mode and set it */ - bq2415x_notifier_call(&bq->nb, - PSY_EVENT_PROP_CHANGED, psy); - bq2415x_set_mode(bq, bq->reported_mode); - } else { - dev_info(bq->dev, "notifier power supply device (%s) " - "for automode is not registred yet... " - "automode will not work without that device\n", - bq->init_data.notify_devi
[PATCH 1/3] power_supply: add power_supply_get_by_phandle
Add method to get power supply by device tree phandle. Signed-off-by: Sebastian Reichel --- drivers/power/power_supply_core.c | 24 include/linux/power_supply.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 08bce22..99e4b41 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c @@ -340,6 +340,30 @@ struct power_supply *power_supply_get_by_name(const char *name) } EXPORT_SYMBOL_GPL(power_supply_get_by_name); +static int power_supply_match_device_node(struct device *dev, const void *data) +{ + return dev->parent && dev->parent->of_node == data; +} + +struct power_supply *power_supply_get_by_phandle(struct device_node *np, + const char *property) +{ + struct device_node *power_supply_np; + struct device *dev; + + power_supply_np = of_parse_phandle(np, property, 0); + if (!power_supply_np) + return ERR_PTR(-ENODEV); + + dev = class_find_device(power_supply_class, NULL, power_supply_np, + power_supply_match_device_node); + + of_node_put(power_supply_np); + + return dev ? dev_get_drvdata(dev) : NULL; +} +EXPORT_SYMBOL_GPL(power_supply_get_by_phandle); + int power_supply_powers(struct power_supply *psy, struct device *dev) { return sysfs_create_link(&psy->dev->kobj, &dev->kobj, "powers"); diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index c6f52c0..4d0e0b4 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -246,6 +246,8 @@ extern struct atomic_notifier_headpower_supply_notifier; extern int power_supply_reg_notifier(struct notifier_block *nb); extern void power_supply_unreg_notifier(struct notifier_block *nb); extern struct power_supply *power_supply_get_by_name(const char *name); +extern struct power_supply *power_supply_get_by_phandle(struct device_node *np, + const char *property); extern void power_supply_changed(struct power_supply *psy); extern int power_supply_am_i_supplied(struct power_supply *psy); extern int power_supply_set_battery_charged(struct power_supply *psy); -- 1.8.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] dt: binding documentation for bq2415x charger
Add devicetree binding documentation for bq2415x charger. Signed-off-by: Sebastian Reichel --- .../devicetree/bindings/power/bq2415x.txt | 43 ++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/bq2415x.txt diff --git a/Documentation/devicetree/bindings/power/bq2415x.txt b/Documentation/devicetree/bindings/power/bq2415x.txt new file mode 100644 index 000..cb2e753 --- /dev/null +++ b/Documentation/devicetree/bindings/power/bq2415x.txt @@ -0,0 +1,43 @@ +Binding for TI bq2415x Li-Ion Charger + +Required properties: +- compatible: Should contain one of the following: + * "ti,bq24150" + * "ti,bq24150" + * "ti,bq24150a" + * "ti,bq24151" + * "ti,bq24151a" + * "ti,bq24152" + * "ti,bq24153" + * "ti,bq24153a" + * "ti,bq24155" + * "ti,bq24156" + * "ti,bq24156a" + * "ti,bq24158" +- reg: integer, i2c address of the device +- ti,current-limit: integer, current limit in mA +- ti,weak-battery-voltage: integer, weak battery voltage threshold in mV +- ti,battery-regulation-voltage: integer, battery regulation voltage in mV +- ti,charge-current: integer, charging current in mA +- ti,termination-current: integer, termination current in mA +- ti,resistor-sense: integer, value of sensing resistor in milliohm + +Optional properties: +- ti,usb-charger-detection: phandle to usb charger detection device + (required for auto mode) + +Example from Nokia N900: + +bq24150a { + compatible = "ti,bq24150a"; + reg = <0x6b>; + + ti,current-limit = <100>; + ti,weak-battery-voltage = <3400>; + ti,battery-regulation-voltage = <4200>; + ti,charge-current = <650>; + ti,termination-current = <100>; + ti,resistor-sense = <68>; + + ti,usb-charger-detection = <&isp1704>; +}; -- 1.8.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] DT support for bq2415x
Hi, This patchset adds DT support for the bq2415x charger, which is used in the Nokia N900. The changes depend on Pali Rohár's "[PATCH v2 0/3] Add support for charging battery in Nokia RX-51" patchset [0]. [0] https://lkml.org/lkml/2013/11/19/106 -- Sebastian Sebastian Reichel (3): power_supply: add power_supply_get_by_phandle bq2415x_charger: add DT support dt: binding documentation for bq2415x charger .../devicetree/bindings/power/bq2415x.txt | 43 + drivers/power/bq2415x_charger.c| 72 -- drivers/power/power_supply_core.c | 24 include/linux/power_supply.h | 2 + 4 files changed, 121 insertions(+), 20 deletions(-) create mode 100644 Documentation/devicetree/bindings/power/bq2415x.txt -- 1.8.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 3/3] RX-51: Add platform data for bq24150a charger
On Tuesday 19 November 2013 14:32:13 Pavel Machek wrote: > On Tue 2013-11-19 11:18:05, Pali Rohár wrote: > > This patch will register bq24150a charger in RX-51 board > > data. > > > > So finally charging battery on Nokia N900 (RX-51) working > > automatically without any proprietary Nokia bits in > > userspace. > > > > Signed-off-by: Pali Rohár > > Reviewed-by: Pavel Machek > > Pavel > BTW, current code says: > > That seems to limit charging voltage to 3.9V, with comment > saying 4.11V... which means battery will not be charged > fully. does it make sense to raise limit to 4.11V here? > > Aha, and actually will not 4.2V requested by > rx51_bq24150a_platform_data trigger -EINVAL? > > /* set battery regulation voltage in mV */ > static int bq2415x_set_battery_regulation_voltage(struct > bq2415x_device *bq, > int mV) > { > int val = (mV/10 - 350) / 2; > > if (val < 0) > val = 0; > else if (val > 94) /* FIXME: Max is 94 or 122 ? Set > max value ? */ > return -EINVAL; > > return bq2415x_i2c_write_mask(bq, BQ2415X_REG_VOLTAGE, > val, BQ2415X_MASK_VO, BQ2415X_SHIFT_VO); } > Above bq2415x_set_battery_regulation_voltage function is updated in 3.13, see commit 3ed5cd79b82e9a055e0df3275eeb471ea0f1e2d7. -- Pali Rohár pali.ro...@gmail.com signature.asc Description: This is a digitally signed message part.