summaryrefslogtreecommitdiff
path: root/drivers/regulator
AgeCommit message (Collapse)Author
2019-05-24Regulator: Core: Add clock-enable to fixed-regulatorPhilippe Schenker
This adds the possibility to enable a fixed-regulator with a clock. Signed-off-by: <philippe.schenker@toradex.com>
2019-05-24regulator: pfuze100: Apalis iMX6: Fix poweroff does not release ↵Sanchayan Maity
POWER_ENABLE_MOCI Poweroff failed powering off the carrier board side of things and did not deassert POWER_ENABLE_MOCI on poweroff. Fix this. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 090138a21869fe2a4b1efa725e6f962ecdff86e5)
2019-05-24colibri-imx6: use stopmode for poweroffMax Krummenacher
After the system has been shutdown with PMIC_ON_REQ and VCC_BATT is supplied from a battery it will never restart either by RESET or power cycle. So use the PMIC_STBY_REQ after shutdown to switch off power rails. Conflicts: arch/arm/mach-imx/pm-imx6.c drivers/regulator/pfuze100-regulator.c (cherry-picked from commit c8b186404065c4502b485820ad4a51515924795c) (cherry-picked from commit ee4c5c4da3b32f65528a2d523ca4bce574dee3c5) Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> (cherry picked from commit 29ff2389ecf7cb4e30924c80b8d42165cf306936)
2019-05-08Merge branch 'linux-4.14.y_for_4.14-2.0.x-imx' into 4.14-2.0.x-imxPhilippe Schenker
2019-04-05regulator: act8865: Fix act8600_sudcdc_voltage_ranges settingAxel Lin
[ Upstream commit f01a7beb6791f1c419424c1a6958b7d0a289c974 ] The act8600_sudcdc_voltage_ranges setting does not match the datasheet. The problems in below entry: REGULATOR_LINEAR_RANGE(19000000, 191, 255, 400000), 1. The off-by-one min_sel causes wrong volatage calculation. The min_sel should be 192. 2. According to the datasheet[1] Table 7. (on page 43): The selector 248 (0b11111000) ~ 255 (0b11111111) are 41.400V. Also fix off-by-one for ACT8600_SUDCDC_VOLTAGE_NUM. [1] https://active-semi.com/wp-content/uploads/ACT8600_Datasheet.pdf Fixes: df3a950e4e73 ("regulator: act8865: Add act8600 support") Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-03-23regulator: s2mpa01: Fix step values for some LDOsStuart Menefy
commit 28c4f730d2a44f2591cb104091da29a38dac49fe upstream. The step values for some of the LDOs appears to be incorrect, resulting in incorrect voltages (or at least, ones which are different from the Samsung 3.4 vendor kernel). Signed-off-by: Stuart Menefy <stuart.menefy@mathembedded.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-23regulator: max77620: Initialize values for DT propertiesMark Zhang
commit 0ab66b3c326ef8f77dae9f528118966365757c0c upstream. If regulator DT node doesn't exist, its of_parse_cb callback function isn't called. Then all values for DT properties are filled with zero. This leads to wrong register update for FPS and POK settings. Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com> Signed-off-by: Mark Zhang <markz@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-23regulator: s2mps11: Fix steps for buck7, buck8 and LDO35Krzysztof Kozlowski
commit 56b5d4ea778c1b0989c5cdb5406d4a488144c416 upstream. LDO35 uses 25 mV step, not 50 mV. Bucks 7 and 8 use 12.5 mV step instead of 6.25 mV. Wrong step caused over-voltage (LDO35) or under-voltage (buck7 and 8) if regulators were used (e.g. on Exynos5420 Arndale Octa board). Cc: <stable@vger.kernel.org> Fixes: cb74685ecb39 ("regulator: s2mps11: Add samsung s2mps11 regulator driver") Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-12MLK-20205-3: regulator: core: fix modulo by zeroRobin Gong
Fix 'Division or modulo by zero' coverity issue(CID-4159438). In fact, no need to call set_ramp_delay() in case of ramp_disable is true, hence, ramp_delay never be 0 while set_ramp_delay() called. Signed-off-by: Robin Gong <yibin.gong@nxp.com> Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2019-02-12MLK-20205-2: regulator: bd71837: fix NULL dereferencedRobin Gong
Fix 'Explicit null dereferenced' coverity issue(CID-3351937). Signed-off-by: Robin Gong <yibin.gong@nxp.com> Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2019-02-12MLK-18653-1: regulator: bd71837: correct ldo setting for BD71840Robin Gong
For customed BD71840 on i.mx8mm-evk board, LDO1/LDO2 setting is different as BD71837, and no LDOx_SEL for LDO3/4. Correct LDO1_VOLT_SEL/ LDO1_VOLT_SEL and remove unused LDO enable code in probe, since those can be done by 'regulator-boot-on'/'regulator-always-on' in dts. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-18334: regulator: bd71837: fix reboot failure on i.mx845s evkRobin Gong
Fix reboot failure on i.mx845s evk board. For BD71837, BUCKx_SEL and BUCKx_EN of all bucks can't be set to 1 as explicity enabled or disabled, otherwise, it may mess up with the default state machine if pmic reset triggered. Remove enable/disable interfaces in driver to avoid touch such bits. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-18205-9 Support BD71837 PMIC chip on i.MX platformsHaoran.Wang
Signed-off-by: Haoran.Wang <elven.wang@nxp.com> Signed-off-by: Robin Gong <yibin.gong@nxp.com> Signed-off-by: Anson Huang <Anson.Huang@nxp.com> (cherry picked from commit 37f67d291e74a3428310cb5c98f556411042f810)
2019-02-12MLK-16283 regulator: pfuze100: add 500us wait time for switch enableRobin Gong
add 500us enable_time for switch to be stable while turned on. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-16202-01 driver: regulator: add enable/disable for switch for pfuze100Robin Gong
Add enable/disable support for switch regulator on pfuze100. Signed-off-by: Robin Gong <yibin.gong@nxp.com> Signed-off-by: Bai Ping <ping.bai@nxp.com>
2019-02-12MLK-14275: regulator: pf1550-regulator-rpmsg: clear 'u32 val' before read ↵Robin Gong
value by rpmsg Actually, m4 only fill the least 1byte, so we'd better clear 'val' before reading by rpmsg, thus the gabage data will not bother us. Signed-off-by: Robin Gong <yibin.gong@nxp.com> (cherry picked from commit df3428c6588a00fa153a3b6996cc33b21b69efb6)
2019-02-12MLK-14638-1 regulator: fixed: add off_on_delay supportHaibo Chen
Add off_on_delay for fixed regulator. This can assign the delay time between the regulator disable and regulator enable. User can define the delay value by using 'off-on-delay' in dts file. Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-02-12MLK-13982: 4.9 rebase: EPDC does not workCristina Ciocan
The Linux kernel regulator core implementation does not accept negative voltage values; all negative values are treated as errors. The problem with the EPDC is that the panel uses a negative voltage regulator which fails to be enabled by the regulator core. This issue has slipped up until the 4.9 rebase because the voltage range [min, max] was checked against only when min = max. This has been fixed in 4.9, resulting in errors in the VCOM regulator driver. The fix is to use the negative values when communicating with the hardware, but send only positive values to the regulator core. This patch sends the absolute value to the regulator core and transforms the received value (from the regulator core) to negative one before sending it to hardware. Fix device tree to deal with negative voltage regulator values by setting min_value = -real_max_value and vice versa. Boards affected: - imx6dl-sabresd - imx6ull-14x14-ddr3-arm2 - imx7d-12x12-lpddr3-arm2 - imx7d-sdb - imx6sll-evk - imx6sl-evk - imx6sll-lpddr3-arm2 Signed-off-by: Cristina Ciocan <cristina-mihaela.ciocan@nxp.com>
2019-02-12MLK-14241-1 regulator: pf1550-regulator-rpmsg: add mutex for ↵Robin Gong
pm_qos_add_request reentry Multi drivers(mmc, cpufreq..) may access pf1550 regulator rpmsg driver at the same time, so we have to add mutex for this multi-entry case. Otherwise the below kernel warning maybe triggered: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 19 at kernel/power/qos.c:453 pf1550_send_message+0x4c/0xf8() pm_qos_add_request() called for already added request Modules linked in: CPU: 0 PID: 19 Comm: kworker/0:1 Not tainted 4.1.33-02293-g80b8c19 #636 Hardware name: Freescale i.MX7ULP (Device Tree) Workqueue: events od_dbs_timer [<80015d78>] (unwind_backtrace) from [<8001271c>] (show_stack+0x10/0x14) [<8001271c>] (show_stack) from [<8082ba50>] (dump_stack+0x88/0x9c) [<8082ba50>] (dump_stack) from [<800387c8>] (warn_slowpath_common+0x80/0xb0) [<800387c8>] (warn_slowpath_common) from [<80038828>] (warn_slowpath_fmt+0x30/0x40) [<80038828>] (warn_slowpath_fmt) from [<80341180>] (pf1550_send_message+0x4c/0xf8) [<80341180>] (pf1550_send_message) from [<80341504>] (pf1550_get_voltage+0x48/0x5c) [<80341504>] (pf1550_get_voltage) from [<803370a0>] (_regulator_get_voltage+0x68/0xb4) [<803370a0>] (_regulator_get_voltage) from [<8033936c>] (_regulator_do_set_voltage+0x5c/0x3e4) [<8033936c>] (_regulator_do_set_voltage) from [<803397a4>] (regulator_set_voltage+0xb0/0x14c) [<803397a4>] (regulator_set_voltage) from [<8058dae8>] (imx7ulp_set_target+0x178/0x238) [<8058dae8>] (imx7ulp_set_target) from [<80584d14>] (__cpufreq_driver_target+0x164/0x294) [<80584d14>] (__cpufreq_driver_target) from [<8058bb08>] (dbs_check_cpu+0x1a0/0x1e0) [<8058bb08>] (dbs_check_cpu) from [<805888e8>] (od_dbs_timer+0x80/0x138) [<805888e8>] (od_dbs_timer) from [<8004bbbc>] (process_one_work+0x118/0x3e4) [<8004bbbc>] (process_one_work) from [<8004bed4>] (worker_thread+0x4c/0x4f4) [<8004bed4>] (worker_thread) from [<80050e4c>] (kthread+0xdc/0xf4) [<80050e4c>] (kthread) from [<8000f528>] (ret_from_fork+0x14/0x2c) ---[ end trace f8281ecde7a0b4ce ]--- ------------[ cut here ]------------ Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-13733-3 regulator: pf1550-regulator-rpmsg: update pf1550-rpmsg interfaceRobin Gong
update driver since m4 side refine the header structure. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-13638-4 regulator: fixed: add system pm routines for pinctrlPeter Chen
At some systems, the pinctrl setting will be lost or needs to set as "sleep" state to save power consumption. So, we need to configure pinctrl as "sleep" state when system enters suspend, and as "default" state after system resumes. In this way, the pinctrl value can be recovered as "default" state after resuming. Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-02-12MLK-13793-6 regulator: anatop: fix min dropout for bypass modeIrina Tirdea
In bypass mode, the anatop digital regulators do not have any minimum dropout value (the input voltage is equal to the output voltage according to documentation). Having a min dropout value of 125mV will lead to an increased voltage for PMIC supplies. Only set minimum dropout value for ldo enabled mode. Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
2019-02-12regulator: core: Adjust supplies for bypassed regulatorsLeonard Crestez
When a regulator is in bypass mode it's output is equal to it's supply and it can't do any adjustment. Deal with all set_voltage calls by propagating them upwards. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-02-12regulator: core: Refactor _regulator_should_adjust_supply conditionLeonard Crestez
It is difficult to understand what's going on inside a single if statement so split it into a separate function. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-02-12MLK-13793-2 regulator: anatop: Do not print error message for EPROBE_DEFERIrina Tirdea
An anatop regulator will return -EPROBE_DEFER when trying to register, if it has a supply from PMIC and this supply is not yet registered. This does not represent an error since the driver will call probe again later, so skip the error message in this case. Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
2019-02-12MLK-13720-4: regulator: pf1550-regulator-rpmsg: fix "rpmsg_send timeout"Robin Gong
Sometimes rpmsg callback triggered quickly before reinit_completion, then cause "rpmsg_send timeout!". Move reinit_completion to the place before rpmsg_send to make sure the completion is ready before callback triggered. Signed-off-by: Robin Gong <yibin.gong@nxp.com> (cherry picked from commit 8e44277d3f27e5f46232bd705ee9ef594db42575)
2019-02-12MLK-13720-3: regulator: pf1550-regulator-rpmsg: use the specific pf1550 ↵Robin Gong
rpmsg channel name Since multi rpmsg instances supported now, we can use the specific rpmsg channel name "rpmsg-regulator-channel" instead of "rpmsg-openamp-demo-channel" Signed-off-by: Robin Gong <yibin.gong@nxp.com> (cherry picked from commit 8a9d73fe43da2833951b428f389aac01aef7cb2a)
2019-02-12MLK-13636-2 regulator: pf1550-regulator-rmpsg: enable pm_qos to prevent low ↵Robin Gong
power idle CLKE bit of MU_CR may bring VLS state mess in M4 side, so use pm_qos instead to prevent i.mx7ulp A7 core enter STOP mode during pf1550 send command by rpmsg Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-13615-1 regulator: pf1550-regulator-rpmsg: should set voltage closest to ↵Dong Aisheng
min_uV According to API definition, Set the voltage for the regulator within the range specified, the driver should select the voltage closest to min_uV. Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-02-12MLK-13577-3 regulator: pf1550-regulator-rpmsg: add pf1550 regulator rpmsg driverRobin Gong
add pf1550 regulator rpmsg driver to control pf1550 on the m4 side by rpmsg. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-13387-3 regulator: consumer: add new event macroRichard Zhu
Add one new regulator events macro 'REGULATOR_EVENT_AFT_DO_ENABLE'. 1.8v of imx7d pcie phy, should be turned on after the 1p0d(1.0v) of pcie phy is turned on. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-12928-16 regulator: pf1550: check device node checkRobin Gong
Do not probe if the device node is not correct in dts. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-12928-15 mfd/regulator: pf1550: check OTP_SW2_DVS_ENB bit for different ↵Robin Gong
voltages check OTP_SW2_DVS_ENB bit for the different voltage list while SW2 regulator registered. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-12928-7 regulator: pf1550: correct ldo ops settingRobin Gong
The voltage of LDO1 and LDO3 are not linear, use voltage_table instead,so add new ops for them. Meanwhile, correct 12500uV for one step of SW1/SW2 rather than 125000uV. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-12928-2 regulator: pf1550: add pf1550 regulator driverRobin Gong
Add basic pf1550 regulator driver. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-11465-1: regulator: pfuze100: update voltage setting for SW1A of PF3000Robin Gong
Regards to the pfuze3000 doc update, regulator driver need to be updated too. Otherwise the voltage information show wrongly. Signed-off-by: Robin Gong <b38343@freescale.com>
2019-02-12MLK-11550-1: regulator: pfuze100: restore some registers after LPSR for ↵Robin Gong
pfuze3000 Some registers on pfuze3000 will lost after exit from LPSR, need restore them, otherwise system may reboot with below command after system enter LPSR one time: root@imx7d_all:~# echo enabled > /sys/class/tty/ttymxc0/power/wakeup root@imx7d_all:~# echo mem > /sys/power/state because LDOGCTL not recover as 1. Add 'fsl,lpsr-mode' property to this case, please add this property if your board support LPSR mode as imx7d-12x12-lpddr3-arm2 board. Signed-off-by: Robin Gong <b38343@freescale.com>
2019-02-12MLK-11556-1 pmic: max17135: add hwmon, mfd and regulator drivers for this pmicRobby Cai
Add PMIC 'MAX17135' module drivers to 4.1.y kernel. These are necessary to supply power for E-ink panel display functions. Signed-off-by: Robby Cai <r63905@freescale.com>
2019-02-12MLK-11561-2 regulator: anatop: set default voltage selector for pcieRichard Zhu
The code reads the default voltage selector from its register. If the default voltage selector is 0 which results in faulty behaviour of this regulator driver. This patch sets a default voltage selector for vddpcie-phy if it is not set in the register. Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
2019-02-12MLK-11407-3: regulator: anatop: force vddpu to use same voltage level as vddsocShawn Guo
The anatop on i.MX6 requires that vddpu use the same voltage level as vddsoc. It's a quick hacking to force the check whenever vddpu is about to be enabled. Signed-off-by: Shawn Guo <shawn.guo@freescale.com> Signed-off-by: Robin Gong <b38343@freescale.com> Also take into consideration bypass mode when using the vddsoc selector for vddpu. Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-02-12MLK-11395-3 regulator: consumer: add new event macrosFancy Fang
Add two new regulator events macro 'REGULATOR_EVENT_PRE_DO_ENABLE' and 'REGULATOR_EVENT_PRE_DO_DISABLE', since some gpc operations should be required when MIPI PHY is powered on/off. Signed-off-by: Fancy Fang <chen.fang@freescale.com>
2019-02-12MLK-10196-3 regulator: anatop: Add non core enable/disablePeter Chen
Add non core enable/disable API. Signed-off-by: Peter Chen <peter.chen@freescale.com> (cherry picked from commit 38681ee653cb75fa1839547414c7780c4f3a7c00)
2018-10-03regulator: fix crash caused by null driver dataYu Zhao
commit fb6de923ca3358a91525552b4907d4cb38730bdd upstream. dev_set_drvdata() needs to be called before device_register() exposes device to userspace. Otherwise kernel crashes after it gets null pointer from dev_get_drvdata() when userspace tries to access sysfs entries. [Removed backtrace for length -- broonie] Signed-off-by: Yu Zhao <yuzhao@google.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-03regulator: Don't return or expect -errno from of_map_mode()Douglas Anderson
[ Upstream commit 02f3703934a42417021405ef336fe45add13c3d1 ] In of_get_regulation_constraints() we were taking the result of of_map_mode() (an unsigned int) and assigning it to an int. We were then checking whether this value was -EINVAL. Some implementers of of_map_mode() were returning -EINVAL (even though the return type of their function needed to be unsigned int) because they needed to signal an error back to of_get_regulation_constraints(). In general in the regulator framework the mode is always referred to as an unsigned int. While we could fix this to be a signed int (the highest value we store in there right now is 0x8), it's actually pretty clean to just define the regulator mode 0x0 (the lack of any bits set) as an invalid mode. Let's do that. Fixes: 5e5e3a42c653 ("regulator: of: Add support for parsing initial and suspend modes") Suggested-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-03regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_opsAnson Huang
[ Upstream commit 0b01fd3d40fe6402e5fa3b491ef23109feb1aaa5 ] If is_enabled() is not defined, regulator core will assume this regulator is already enabled, then it can NOT be really enabled after disabled. Based on Li Jun's patch from the NXP kernel tree. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-30regulator: of: Add a missing 'of_node_put()' in an error handling path of ↵Christophe JAILLET
'of_regulator_match()' [ Upstream commit 30966861a7a2051457be8c49466887d78cc47e97 ] If an unlikely failure in 'of_get_regulator_init_data()' occurs, we must release the reference on the current 'child' node before returning. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-30regulator: gpio: Fix some error handling paths in 'gpio_regulator_probe()'Christophe Jaillet
[ Upstream commit ed8cffda27dea6fd3dafb3ee881c5a786edac9ca ] Re-order error handling code and gotos to avoid leaks in error handling paths. Fixes: 9f946099fe19 ("regulator: gpio: fix parsing of gpio list") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-15regulator: stm32-vrefbuf: fix check on ready flagFabrice Gasnier
commit f63248fac563125fd5a2f0bc780ce7a299872cab upstream. stm32_vrefbuf_enable() wrongly checks VRR bit: 0 stands for not ready, 1 for ready. It currently checks the opposite. This makes enable routine to exit immediately without waiting for ready flag. Fixes: 0cdbf481e927 ("regulator: Add support for stm32-vrefbuf") Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02Merge tag 'spdx_identifiers-4.14-rc8' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull initial SPDX identifiers from Greg KH: "License cleanup: add SPDX license identifiers to some files Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" * tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: License cleanup: add SPDX license identifier to uapi header files with a license License cleanup: add SPDX license identifier to uapi header files with no license License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>