Re: [PATCH] clk: exynos7: Mark aclk_fsys1_200 as critical
On 17.12.2020 11:14, Stephen Boyd wrote: > Not sure why this wasn't picked up in the samsung PR. Can you resend? Hi There was v2 (https://patchwork.kernel.org/project/linux-samsung-soc/patch/20201107121456.25562-1-pawel.mikolaj.chm...@gmail.com/) but it did receive some request for changes comments and i didn't yet had time to it. > >> diff --git a/drivers/clk/samsung/clk-exynos7.c >> b/drivers/clk/samsung/clk-exynos7.c >> index c1ff715e960c..1048d83f097b 100644 >> --- a/drivers/clk/samsung/clk-exynos7.c >> +++ b/drivers/clk/samsung/clk-exynos7.c >> @@ -538,7 +538,8 @@ static const struct samsung_gate_clock top1_gate_clks[] >> __initconst = { >> ENABLE_ACLK_TOP13, 28, CLK_SET_RATE_PARENT | >> CLK_IS_CRITICAL, 0), >> GATE(CLK_ACLK_FSYS1_200, "aclk_fsys1_200", "dout_aclk_fsys1_200", >> - ENABLE_ACLK_TOP13, 24, CLK_SET_RATE_PARENT, 0), >> + ENABLE_ACLK_TOP13, 24, CLK_SET_RATE_PARENT | >> + CLK_IS_CRITICAL, 0), >> > > Please put a comment in the code why a clk is critica>
Re: [PATCH v2] clk: exynos7: Keep aclk_fsys1_200 enabled
On 09.11.2020 13:32, Sylwester Nawrocki wrote: > Hi Paweł, > > On 11/7/20 13:14, Paweł Chmiel wrote: >> This clock must be always enabled to allow access to any registers in >> fsys1 CMU. Until proper solution based on runtime PM is applied >> (similar to what was done for Exynos5433), fix this by calling >> clk_prepare_enable() directly from clock provider driver. >> >> It was observed on Samsung Galaxy S6 device (based on Exynos7420), where >> UFS module is probed before pmic used to power that device. >> In this case defer probe was happening and that clock was disabled by >> UFS driver, causing whole boot to hang on next CMU access. >> >> Signed-off-by: Paweł Chmiel > >> --- a/drivers/clk/samsung/clk-exynos7.c >> +++ b/drivers/clk/samsung/clk-exynos7.c > >> @@ -571,6 +572,10 @@ static const struct samsung_cmu_info top1_cmu_info >> __initconst = { >> static void __init exynos7_clk_top1_init(struct device_node *np) >> { >> samsung_cmu_register_one(np, _cmu_info); >> +/* >> + * Keep top FSYS1 aclk enabled permanently. It's required for CMU >> register access. >> + */ >> +clk_prepare_enable(__clk_lookup("aclk_fsys1_200")); > > Thanks for the patch. Could you rework it to avoid the __clk_lookup() call? > I.e. could you change it to something along the lines of: Hi. I'll send v3 version with this fixed. Thanks for review and comments > > -8< > diff --git a/drivers/clk/samsung/clk-exynos7.c > b/drivers/clk/samsung/clk-exynos7.c > index 87ee1ba..9ecf498 100644 > --- a/drivers/clk/samsung/clk-exynos7.c > +++ b/drivers/clk/samsung/clk-exynos7.c > @@ -570,7 +570,15 @@ static const struct samsung_cmu_info top1_cmu_info > __initconst = { > > static void __init exynos7_clk_top1_init(struct device_node *np) > { > - samsung_cmu_register_one(np, _cmu_info); > + struct samsung_clk_provider *ctx; > + struct clk_hw **hws; > + > + ctx = samsung_cmu_register_one(np, _cmu_info); > + if (!ctx) > + return; > + hws = ctx->clk_data.hws; > + > + clk_prepare_enable(hws[CLK_ACLK_FSYS1_200]); > } > > CLK_OF_DECLARE(exynos7_clk_top1, "samsung,exynos7-clock-top1", > -8< > ? > > -- > Regards, > Sylwester > >
[PATCH v2 2/2] arm64: dts: exynos: Correct psci compatible used on Exynos7
It's not possible to reboot or poweroff Exynos7420 using PSCI. Instead we need to use syscon reboot/poweroff drivers, like it's done for other Exynos SoCs. This was confirmed by checking vendor source and testing it on Samsung Galaxy S6 device based on this SoC. To be able to use custom restart/poweroff handlers instead of PSCI functions, we need to correct psci compatible. This also requires us to provide function ids for CPU_ON and CPU_OFF. Fixes: fb026cb65247 ("arm64: dts: Add reboot node for exynos7") Fixes: b9024cbc937d ("arm64: dts: Add initial device tree support for exynos7") Signed-off-by: Paweł Chmiel --- Changes from v1: - Split into two separate patches. --- arch/arm64/boot/dts/exynos/exynos7.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi index 723f5d5fcf00..fff383206545 100644 --- a/arch/arm64/boot/dts/exynos/exynos7.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi @@ -117,8 +117,10 @@ cpu_atlas3: cpu@3 { }; psci { - compatible = "arm,psci-0.2"; + compatible = "arm,psci"; method = "smc"; + cpu_off = <0x8402>; + cpu_on = <0xC403>; }; soc: soc@0 { -- 2.27.0
[PATCH v2 1/2] arm64: dts: exynos: Include common syscon restart/poweroff for Exynos7
Exynos7 uses the same syscon reboot and poweroff nodes as other Exynos SoCs, so instead of duplicating code we can just include common dtsi file, which already contains definitions of them. After this change, poweroff node will be also available, previously this dts file did contain only reboot node. Fixes: fb026cb65247 ("arm64: dts: Add reboot node for exynos7") Fixes: b9024cbc937d ("arm64: dts: Add initial device tree support for exynos7") Signed-off-by: Paweł Chmiel --- Changes from v1: - Split into two separate patches. - Include existing exynos-syscon-restart.dtsi to avoid code duplication. --- arch/arm64/boot/dts/exynos/exynos7.dtsi | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi index 7a2cba4220d9..723f5d5fcf00 100644 --- a/arch/arm64/boot/dts/exynos/exynos7.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi @@ -624,13 +624,6 @@ hsi2c_11: hsi2c@136a { pmu_system_controller: system-controller@105c { compatible = "samsung,exynos7-pmu", "syscon"; reg = <0x105c 0x5000>; - - reboot: syscon-reboot { - compatible = "syscon-reboot"; - regmap = <_system_controller>; - offset = <0x0400>; - mask = <0x1>; - }; }; rtc: rtc@1059 { @@ -818,3 +811,5 @@ atlas_thermal: cluster0-thermal { }; #include "exynos7-pinctrl.dtsi" +#include "arm/exynos-syscon-restart.dtsi" + -- 2.27.0
[PATCH v2] clk: exynos7: Keep aclk_fsys1_200 enabled
This clock must be always enabled to allow access to any registers in fsys1 CMU. Until proper solution based on runtime PM is applied (similar to what was done for Exynos5433), fix this by calling clk_prepare_enable() directly from clock provider driver. It was observed on Samsung Galaxy S6 device (based on Exynos7420), where UFS module is probed before pmic used to power that device. In this case defer probe was happening and that clock was disabled by UFS driver, causing whole boot to hang on next CMU access. Signed-off-by: Paweł Chmiel --- Changes from v1: - Instead of marking clock as critical, enable it manually in driver. --- drivers/clk/samsung/clk-exynos7.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/clk/samsung/clk-exynos7.c b/drivers/clk/samsung/clk-exynos7.c index c1ff715e960c..e05b673e277f 100644 --- a/drivers/clk/samsung/clk-exynos7.c +++ b/drivers/clk/samsung/clk-exynos7.c @@ -6,6 +6,7 @@ #include #include +#include #include "clk.h" #include @@ -571,6 +572,10 @@ static const struct samsung_cmu_info top1_cmu_info __initconst = { static void __init exynos7_clk_top1_init(struct device_node *np) { samsung_cmu_register_one(np, _cmu_info); + /* +* Keep top FSYS1 aclk enabled permanently. It's required for CMU register access. +*/ + clk_prepare_enable(__clk_lookup("aclk_fsys1_200")); } CLK_OF_DECLARE(exynos7_clk_top1, "samsung,exynos7-clock-top1", -- 2.27.0
Re: [PATCH] arm64: dts: exynos: Fix reboot/poweroff issues on Exynos7
Hi On 29.10.2020 18:50, Krzysztof Kozlowski wrote: > On Wed, Oct 28, 2020 at 10:08:13PM +0100, Paweł Chmiel wrote: >> In vendor sources for Exynos 7420, psci is not used to reboot or >> poweroff device. Instead we should use syscon reboot/poweroff. >> Previously it was not possible to poweroff (no syscon poweroff node) or >> reboot (because it was handled by psci and this way is not working for >> Exynos). > > Do you want to say that PSCI cannot be used to power off or reboot? Yes > >> >> Fixes: fb026cb65247 ("arm64: dts: Add reboot node for exynos7") >> Fixes: b9024cbc937d ("arm64: dts: Add initial device tree support for >> exynos7") >> Signed-off-by: Paweł Chmiel >> --- >> arch/arm64/boot/dts/exynos/exynos7.dtsi | 11 ++- >> 1 file changed, 10 insertions(+), 1 deletion(-) >> >> diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi >> b/arch/arm64/boot/dts/exynos/exynos7.dtsi >> index 959918f4ca45..47d54c369d03 100644 >> --- a/arch/arm64/boot/dts/exynos/exynos7.dtsi >> +++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi >> @@ -117,8 +117,10 @@ cpu_atlas3: cpu@3 { >> }; >> >> psci { >> -compatible = "arm,psci-0.2"; >> +compatible = "arm,psci"; > > Please explain how is it related to this issue? You onle mentioned > a problem of lacking syscon-reboot node. > >> method = "smc"; >> +cpu_off = <0x8402>; >> +cpu_on = <0xC403>; > > The same question. Thanks for feedback. I'll split this patch into two - one for inclusion of exynos-syscon-restart.dtsi and second one fixing psci compatible (so syscon-poweroff/restart will be working). > >> }; >> >> soc: soc@0 { >> @@ -552,6 +554,13 @@ pmu_system_controller: system-controller@105c { >> compatible = "samsung,exynos7-pmu", "syscon"; >> reg = <0x105c 0x5000>; >> >> +poweroff: syscon-poweroff { >> +compatible = "syscon-poweroff"; >> +regmap = <_system_controller>; >> +offset = <0x330C>; /* PS_HOLD_CONTROL */ >> +mask = <0x5200>; /* reset value */ >> +}; >> + > > Instead, please include arm/exynos-syscon-restart.dtsi. Will do this. > > Best regards, > Krzysztof >
[PATCH] arm64: dts: exynos: Fix reboot/poweroff issues on Exynos7
In vendor sources for Exynos 7420, psci is not used to reboot or poweroff device. Instead we should use syscon reboot/poweroff. Previously it was not possible to poweroff (no syscon poweroff node) or reboot (because it was handled by psci and this way is not working for Exynos). Fixes: fb026cb65247 ("arm64: dts: Add reboot node for exynos7") Fixes: b9024cbc937d ("arm64: dts: Add initial device tree support for exynos7") Signed-off-by: Paweł Chmiel --- arch/arm64/boot/dts/exynos/exynos7.dtsi | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi index 959918f4ca45..47d54c369d03 100644 --- a/arch/arm64/boot/dts/exynos/exynos7.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi @@ -117,8 +117,10 @@ cpu_atlas3: cpu@3 { }; psci { - compatible = "arm,psci-0.2"; + compatible = "arm,psci"; method = "smc"; + cpu_off = <0x8402>; + cpu_on = <0xC403>; }; soc: soc@0 { @@ -552,6 +554,13 @@ pmu_system_controller: system-controller@105c { compatible = "samsung,exynos7-pmu", "syscon"; reg = <0x105c 0x5000>; + poweroff: syscon-poweroff { + compatible = "syscon-poweroff"; + regmap = <_system_controller>; + offset = <0x330C>; /* PS_HOLD_CONTROL */ + mask = <0x5200>; /* reset value */ + }; + reboot: syscon-reboot { compatible = "syscon-reboot"; regmap = <_system_controller>; -- 2.27.0
[PATCH] clk: exynos7: Mark aclk_fsys1_200 as critical
This clock must be always enabled to allow access to any registers in fsys1 CMU. Until proper solution based on runtime PM is applied (similar to what was done for Exynos5433), mark that clock as critical so it won't be disabled. It was observed on Samsung Galaxy S6 device (based on Exynos7420), where UFS module is probed before pmic used to power that device. In this case defer probe was happening and that clock was disabled by UFS driver, causing whole boot to hang on next CMU access. Signed-off-by: Paweł Chmiel --- drivers/clk/samsung/clk-exynos7.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/samsung/clk-exynos7.c b/drivers/clk/samsung/clk-exynos7.c index c1ff715e960c..1048d83f097b 100644 --- a/drivers/clk/samsung/clk-exynos7.c +++ b/drivers/clk/samsung/clk-exynos7.c @@ -538,7 +538,8 @@ static const struct samsung_gate_clock top1_gate_clks[] __initconst = { ENABLE_ACLK_TOP13, 28, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, 0), GATE(CLK_ACLK_FSYS1_200, "aclk_fsys1_200", "dout_aclk_fsys1_200", - ENABLE_ACLK_TOP13, 24, CLK_SET_RATE_PARENT, 0), + ENABLE_ACLK_TOP13, 24, CLK_SET_RATE_PARENT | + CLK_IS_CRITICAL, 0), GATE(CLK_SCLK_PHY_FSYS1_26M, "sclk_phy_fsys1_26m", "dout_sclk_phy_fsys1_26m", ENABLE_SCLK_TOP1_FSYS11, -- 2.25.1
Re: [PATCH] misc: fsa9480: Delete this driver
On Sun, 2019-06-30 at 16:03 +0200, Linus Walleij wrote: > The FSA9480 has a new driver more appropriately located > in the drivers/extcon subsystem. It is also more complete > and includes device tree support. Delete the old misc > driver. > > Cc: Paweł Chmiel > Cc: Chanwoo Choi > Cc: Arnd Bergmann > Signed-off-by: Linus Walleij > --- > drivers/misc/Kconfig | 9 - > drivers/misc/Makefile | 1 - > drivers/misc/fsa9480.c| 547 -- > include/linux/platform_data/fsa9480.h | 24 -- > 4 files changed, 581 deletions(-) > delete mode 100644 drivers/misc/fsa9480.c > delete mode 100644 include/linux/platform_data/fsa9480.h Hi Reviewed-by: Paweł Chmiel Thanks > > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig > index 85fc77148d19..88e59bb1b06f 100644 > --- a/drivers/misc/Kconfig > +++ b/drivers/misc/Kconfig > @@ -431,15 +431,6 @@ config PCH_PHUB > To compile this driver as a module, choose M here: the module will > be called pch_phub. > > -config USB_SWITCH_FSA9480 > - tristate "FSA9480 USB Switch" > - depends on I2C > - help > - The FSA9480 is a USB port accessory detector and switch. > - The FSA9480 is fully controlled using I2C and enables USB data, > - stereo and mono audio, video, microphone and UART data to use > - a common connector port. > - > config LATTICE_ECP3_CONFIG > tristate "Lattice ECP3 FPGA bitstream configuration via SPI" > depends on SPI && SYSFS > diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile > index b9affcdaa3d6..95440c335dd4 100644 > --- a/drivers/misc/Makefile > +++ b/drivers/misc/Makefile > @@ -42,7 +42,6 @@ obj-$(CONFIG_VMWARE_BALLOON)+= vmw_balloon.o > obj-$(CONFIG_PCH_PHUB) += pch_phub.o > obj-y+= ti-st/ > obj-y+= lis3lv02d/ > -obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o > obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/ > obj-$(CONFIG_INTEL_MEI) += mei/ > obj-$(CONFIG_VMWARE_VMCI)+= vmw_vmci/ > diff --git a/drivers/misc/fsa9480.c b/drivers/misc/fsa9480.c > deleted file mode 100644 > index fab02f2da077.. > --- a/drivers/misc/fsa9480.c > +++ /dev/null > @@ -1,547 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0-only > -/* > - * fsa9480.c - FSA9480 micro USB switch device driver > - * > - * Copyright (C) 2010 Samsung Electronics > - * Minkyu Kang > - * Wonguk Jeong > - */ > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -/* FSA9480 I2C registers */ > -#define FSA9480_REG_DEVID0x01 > -#define FSA9480_REG_CTRL 0x02 > -#define FSA9480_REG_INT1 0x03 > -#define FSA9480_REG_INT2 0x04 > -#define FSA9480_REG_INT1_MASK0x05 > -#define FSA9480_REG_INT2_MASK0x06 > -#define FSA9480_REG_ADC 0x07 > -#define FSA9480_REG_TIMING1 0x08 > -#define FSA9480_REG_TIMING2 0x09 > -#define FSA9480_REG_DEV_T1 0x0a > -#define FSA9480_REG_DEV_T2 0x0b > -#define FSA9480_REG_BTN1 0x0c > -#define FSA9480_REG_BTN2 0x0d > -#define FSA9480_REG_CK 0x0e > -#define FSA9480_REG_CK_INT1 0x0f > -#define FSA9480_REG_CK_INT2 0x10 > -#define FSA9480_REG_CK_INTMASK1 0x11 > -#define FSA9480_REG_CK_INTMASK2 0x12 > -#define FSA9480_REG_MANSW1 0x13 > -#define FSA9480_REG_MANSW2 0x14 > - > -/* Control */ > -#define CON_SWITCH_OPEN (1 << 4) > -#define CON_RAW_DATA (1 << 3) > -#define CON_MANUAL_SW(1 << 2) > -#define CON_WAIT (1 << 1) > -#define CON_INT_MASK (1 << 0) > -#define CON_MASK (CON_SWITCH_OPEN | CON_RAW_DATA | \ > - CON_MANUAL_SW | CON_WAIT) > - > -/* Device Type 1 */ > -#define DEV_USB_OTG (1 << 7) > -#define DEV_DEDICATED_CHG(1 << 6) > -#define DEV_USB_CHG (1 << 5) > -#define DEV_CAR_KIT (1 << 4) > -#define DEV_UART (1 << 3) > -#define DEV_USB (1 << 2) > -#define DEV_AUDIO_2 (1 << 1) > -#define DEV_AUDIO_1 (1 << 0) > - > -#define DEV_T1_USB_MASK (DEV_USB_OTG | DEV_USB) > -#define DEV_T1_UART_MASK (DEV_UART) > -#define DEV_T1_C
Re: [PATCH v2 0/2] extcon: Add fsa9480 extcon driver
On Fri, 2019-06-28 at 14:37 +0200, Greg KH wrote: > On Fri, Jun 28, 2019 at 11:28:11AM +0100, Linus Walleij wrote: > > On Fri, Jun 21, 2019 at 12:14 PM Paweł Chmiel > > wrote: > > > > > This small patchset adds support for Fairchild Semiconductor > > > FSA9480 > > > microUSB switch. > > > > > > It has been tested on Samsung Galaxy S and Samsung Fascinate 4G, > > > but it can be found also on other Samsung Aries (s5pv210) based > > > devices. > > > > > > Tomasz Figa (2): > > > dt-bindings: extcon: Add support for fsa9480 switch > > > extcon: Add fsa9480 extcon driver > > > > This is surely an important driver since almost all elder Samsung > > mobiles use this kind of switch. So > > Acked-by: Linus Walleij > > > > This driver I see is already sent to Greg for inclusion in the next > > kernel. > > I just wonder if you guys are even aware of this driver for the > > same > > hardware added by Donggeun Kim in 2011: > > drivers/misc/fsa9480.c Yes, new one is based on this driver (plus device tree and regmap). Originally this new driver was written for 3.18 kernel. > > > > That said I am all for pulling in this new driver because it is > > surely > > better and supports device tree. > > > > But can we please also send Greg a patch to delete the old driver > > so we don't have two of them now? > > > > The old driver have no in-tree users so it can be deleted without > > side effects. Out-of-tree users can certainly adapt to the new > > extcon driver. > > > > If you want I can send a deletion patch for the misc driver? If You could do this (and maybe it'll get merged faster) i'll be great. Thanks > > Please, I'll gladly take a patch that deletes code :)If You ca > > thanks, > > greg k-h
[PATCH v4 0/2] power: supply: max8998-charger: Device Tree support
This patch series compose of 2 patches. First patch, updates max8998 charger driver, so it's possible to parse devicetree for configuration. Second patch, updates max8998 documentation, so it includes new node and properties, needed for charger. Patches has been tested on, Samsung Galaxy S (i9000) phone. Changes from v3: - Property prefix should be maxim, not max8998 - Changed property name to more meaning full - Describe what End of Charge in percent means Changes from v2: - Make charge-restart-level-microvolt and charge-timeout-hours properties optional. If they're not present, assume they're disabled. Changes from v1: - Removed unneeded Fixes tag - Correct description of all charger values - Added missing property unit for charger properties - Removed already applied patch Paweł Chmiel (2): power: supply: max8998-charger: Parse device tree for required data. dt-bindings: mfd: max8998: Add charger subnode binding .../devicetree/bindings/mfd/max8998.txt | 26 drivers/power/supply/max8998_charger.c| 60 +++ 2 files changed, 86 insertions(+) -- 2.17.1
[PATCH v4 1/2] power: supply: max8998-charger: Parse device tree for required data.
This patch adds missing code for reading charger configuration from devicetree. Signed-off-by: Paweł Chmiel --- Changes from v3: - Property prefix should be maxim, not max8998 - Changed property name to more meaning full Changes from v2: - Make restart level and charge timeout properties optional. If they're not present in devicetree, assume they're disabled. Changes from v1: - Removed unneeded Fixes tag - Use new property names --- drivers/power/supply/max8998_charger.c | 60 ++ 1 file changed, 60 insertions(+) diff --git a/drivers/power/supply/max8998_charger.c b/drivers/power/supply/max8998_charger.c index 9a926c7c0f22..dfd473ed4c5b 100644 --- a/drivers/power/supply/max8998_charger.c +++ b/drivers/power/supply/max8998_charger.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -69,6 +70,59 @@ static const struct power_supply_desc max8998_battery_desc = { .num_properties = ARRAY_SIZE(max8998_battery_props), }; +static int max8998_pmic_dt_parse_pdata(struct max8998_dev *iodev, + struct max8998_platform_data *pdata) +{ + struct device_node *pmic_np = iodev->dev->of_node; + struct device_node *charger_np; + int ret; + + charger_np = of_get_child_by_name(pmic_np, "charger"); + if (!charger_np) { + dev_err(iodev->dev, "could not find charger sub-node\n"); + return -EINVAL; + } + + ret = of_property_read_u32(charger_np, + "maxim,end-of-charge-percentage", + >eoc); + if (ret < 0) { + dev_err(iodev->dev, + "Could not find maxim,end-of-charge-percentage in devicetree\n"); + return ret; + } + + ret = of_property_read_u32(charger_np, + "maxim,charge-restart-threshold", + >restart); + if (ret < 0) { + if (ret != -EINVAL) { + dev_err(iodev->dev, + "Failed to read maxim,charge-restart-threshold\n"); + return ret; + } + + pdata->restart = -1; + dev_dbg(iodev->dev, "Charge Restart Threshold disabled\n"); + } + + ret = of_property_read_u32(charger_np, + "maxim,charge-timeout", + >timeout); + if (ret < 0) { + if (ret != -EINVAL) { + dev_err(iodev->dev, + "Failed to read maxim,charge-timeout\n"); + return ret; + } + + pdata->timeout = -1; + dev_dbg(iodev->dev, "Charge Full Timeout disabled\n"); + } + + return 0; +} + static int max8998_battery_probe(struct platform_device *pdev) { struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent); @@ -83,6 +137,12 @@ static int max8998_battery_probe(struct platform_device *pdev) return -ENODEV; } + if (IS_ENABLED(CONFIG_OF) && iodev->dev->of_node) { + ret = max8998_pmic_dt_parse_pdata(iodev, pdata); + if (ret) + return ret; + } + max8998 = devm_kzalloc(>dev, sizeof(struct max8998_battery_data), GFP_KERNEL); if (!max8998) -- 2.17.1
[PATCH v4 2/2] dt-bindings: mfd: max8998: Add charger subnode binding
This patch adds devicetree bindings documentation for battery charging controller as the subnode of MAX8998 PMIC. Signed-off-by: Paweł Chmiel --- Changes from v3: - Property prefix should be maxim, not max8998 - Describe what End of Charge in percent means Changes from v2: - Make charge-restart-level-microvolt optional. - Make charge-timeout-hours optional. Changes from v1: - Removed unneeded Fixes tag - Correct description of all charger values - Added missing property unit --- .../devicetree/bindings/mfd/max8998.txt | 26 +++ 1 file changed, 26 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/max8998.txt b/Documentation/devicetree/bindings/mfd/max8998.txt index 5f2f07c09c90..368f787d6079 100644 --- a/Documentation/devicetree/bindings/mfd/max8998.txt +++ b/Documentation/devicetree/bindings/mfd/max8998.txt @@ -48,6 +48,25 @@ Additional properties required if max8998,pmic-buck2-dvs-gpio is defined: - max8998,pmic-buck2-dvs-voltage: An array of 2 voltage values in microvolts for buck2 regulator that can be selected using dvs gpio. +Charger: Configuration for battery charging controller should be added +inside a child node named 'charger'. + Required properties: + - maxim,end-of-charge-percentage: End of Charge in percent. +When the charge current in constant-voltage phase drops below +end-of-charge-percentage of it's start value, charging is terminated. +If value equals 0, leave it unchanged. Otherwise it should be value +from 10 to 45 by 5 step. + + Optional properties: + - maxim,charge-restart-threshold: Charge restart threshold in millivolts. +If property is not present, this will be disabled. +Valid values are: 0, 100, 150, 200. If the value equals 0, leave it +unchanged. + + - maxim,charge-timeout: Charge timeout in hours. If property is not +present, this will be disabled. Valid values are: 0, 5, 6, 7. +If the value equals 0, leave it unchanged. + Regulators: All the regulators of MAX8998 to be instantiated shall be listed in a child node named 'regulators'. Each regulator is represented by a child node of the 'regulators' node. @@ -97,6 +116,13 @@ Example: max8998,pmic-buck2-dvs-gpio = < 0 3 0 0>; /* SET3 */ max8998,pmic-buck2-dvs-voltage = <135>, <130>; + /* Charger configuration */ + charger { + maxim,end-of-charge-percentage = <20>; + maxim,charge-restart-threshold = <100>; + maxim,charge-timeout = <7>; + }; + /* Regulators to instantiate */ regulators { ldo2_reg: LDO2 { -- 2.17.1
[PATCH v2 2/2] extcon: Add fsa9480 extcon driver
From: Tomasz Figa This patch adds extcon driver for Fairchild Semiconductor FSA9480 microUSB switch. Signed-off-by: Tomasz Figa Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- Changes from v1: - Remove license sentences - Remove custom sysfs entries - Remove manual switch code (it was used by sysfs code) - Switch to using regmap api - Select REGMAP_I2C and IRQ_DOMAIN --- drivers/extcon/Kconfig | 12 + drivers/extcon/Makefile | 1 + drivers/extcon/extcon-fsa9480.c | 395 3 files changed, 408 insertions(+) create mode 100644 drivers/extcon/extcon-fsa9480.c diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig index 6f5af4196b8d..8aa83c6274a0 100644 --- a/drivers/extcon/Kconfig +++ b/drivers/extcon/Kconfig @@ -37,6 +37,18 @@ config EXTCON_AXP288 Say Y here to enable support for USB peripheral detection and USB MUX switching by X-Power AXP288 PMIC. +config EXTCON_FSA9480 + tristate "FSA9480 EXTCON Support" + depends on INPUT + select IRQ_DOMAIN + select REGMAP_I2C + help + If you say yes here you get support for the Fairchild Semiconductor + FSA9480 microUSB switch and accessory detector chip. The FSA9480 is a USB + port accessory detector and switch. The FSA9480 is fully controlled using + I2C and enables USB data, stereo and mono audio, video, microphone + and UART data to use a common connector port. + config EXTCON_GPIO tristate "GPIO extcon support" depends on GPIOLIB || COMPILE_TEST diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile index d3941a735df3..52096fd8a216 100644 --- a/drivers/extcon/Makefile +++ b/drivers/extcon/Makefile @@ -8,6 +8,7 @@ extcon-core-objs+= extcon.o devres.o obj-$(CONFIG_EXTCON_ADC_JACK) += extcon-adc-jack.o obj-$(CONFIG_EXTCON_ARIZONA) += extcon-arizona.o obj-$(CONFIG_EXTCON_AXP288)+= extcon-axp288.o +obj-$(CONFIG_EXTCON_FSA9480) += extcon-fsa9480.o obj-$(CONFIG_EXTCON_GPIO) += extcon-gpio.o obj-$(CONFIG_EXTCON_INTEL_INT3496) += extcon-intel-int3496.o obj-$(CONFIG_EXTCON_INTEL_CHT_WC) += extcon-intel-cht-wc.o diff --git a/drivers/extcon/extcon-fsa9480.c b/drivers/extcon/extcon-fsa9480.c new file mode 100644 index ..845f5e366083 --- /dev/null +++ b/drivers/extcon/extcon-fsa9480.c @@ -0,0 +1,395 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * extcon-fsa9480.c - Fairchild Semiconductor FSA9480 extcon driver + * + * Copyright (c) 2014 Tomasz Figa + * + * Loosely based on old fsa9480 misc-device driver. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* FSA9480 I2C registers */ +#define FSA9480_REG_DEVID 0x01 +#define FSA9480_REG_CTRL0x02 +#define FSA9480_REG_INT10x03 +#define FSA9480_REG_INT20x04 +#define FSA9480_REG_INT1_MASK 0x05 +#define FSA9480_REG_INT2_MASK 0x06 +#define FSA9480_REG_ADC 0x07 +#define FSA9480_REG_TIMING1 0x08 +#define FSA9480_REG_TIMING2 0x09 +#define FSA9480_REG_DEV_T1 0x0a +#define FSA9480_REG_DEV_T2 0x0b +#define FSA9480_REG_BTN10x0c +#define FSA9480_REG_BTN20x0d +#define FSA9480_REG_CK 0x0e +#define FSA9480_REG_CK_INT1 0x0f +#define FSA9480_REG_CK_INT2 0x10 +#define FSA9480_REG_CK_INTMASK1 0x11 +#define FSA9480_REG_CK_INTMASK2 0x12 +#define FSA9480_REG_MANSW1 0x13 +#define FSA9480_REG_MANSW2 0x14 +#define FSA9480_REG_END 0x15 + +/* Control */ +#define CON_SWITCH_OPEN (1 << 4) +#define CON_RAW_DATA(1 << 3) +#define CON_MANUAL_SW (1 << 2) +#define CON_WAIT(1 << 1) +#define CON_INT_MASK(1 << 0) +#define CON_MASK(CON_SWITCH_OPEN | CON_RAW_DATA | \ +CON_MANUAL_SW | CON_WAIT) + +/* Device Type 1 */ +#define DEV_USB_OTG 7 +#define DEV_DEDICATED_CHG 6 +#define DEV_USB_CHG 5 +#define DEV_CAR_KIT 4 +#define DEV_UART3 +#define DEV_USB 2 +#define DEV_AUDIO_2 1 +#define DEV_AUDIO_1 0 + +#define DEV_T1_USB_MASK (DEV_USB_OTG | DEV_USB) +#define DEV_T1_UART_MASK(DEV_UART) +#define DEV_T1_CHARGER_MASK (DEV_DEDICATED_CHG | DEV_USB_CHG) + +/* Device Type 2 */ +#define DEV_AV 14 +#define DEV_TTY 13 +#define DEV_PPD 12 +#define DEV_JIG_UART_OFF11 +#define DEV_JIG_UART_ON 10 +#define DEV_JIG_USB_OFF 9 +#define DEV_JIG_USB_ON 8 + +#define DEV_T2_USB_MASK (DEV_JIG_U
[PATCH v2 0/2] extcon: Add fsa9480 extcon driver
This small patchset adds support for Fairchild Semiconductor FSA9480 microUSB switch. It has been tested on Samsung Galaxy S and Samsung Fascinate 4G, but it can be found also on other Samsung Aries (s5pv210) based devices. Tomasz Figa (2): dt-bindings: extcon: Add support for fsa9480 switch extcon: Add fsa9480 extcon driver Changes from v1: - Added newline at end of dt-bindings file - Removed interrupt-parent from dt-bindings file - Added Acked-by to dt-bindings patch - Remove license sentences from driver - Remove custom sysfs entries and manual switch code - Switch to using regmap api .../bindings/extcon/extcon-fsa9480.txt| 19 + drivers/extcon/Kconfig| 12 + drivers/extcon/Makefile | 1 + drivers/extcon/extcon-fsa9480.c | 395 ++ 4 files changed, 427 insertions(+) create mode 100644 Documentation/devicetree/bindings/extcon/extcon-fsa9480.txt create mode 100644 drivers/extcon/extcon-fsa9480.c -- 2.17.1
[PATCH v2 1/2] dt-bindings: extcon: Add support for fsa9480 switch
From: Tomasz Figa This patch adds documentation for binding of extcont Fairchild Semiconductor FSA9480 microusb switch. This usb port accessory detector and switch, can be found for example in some Samsung s5pv210 based phones. Signed-off-by: Tomasz Figa Signed-off-by: Paweł Chmiel Acked-by: Chanwoo Choi --- Changes from v1: - Added newline at end of file - Removed interrupt-parent as it is implicit - Added Acked-by --- .../bindings/extcon/extcon-fsa9480.txt| 19 +++ 1 file changed, 19 insertions(+) create mode 100644 Documentation/devicetree/bindings/extcon/extcon-fsa9480.txt diff --git a/Documentation/devicetree/bindings/extcon/extcon-fsa9480.txt b/Documentation/devicetree/bindings/extcon/extcon-fsa9480.txt new file mode 100644 index ..d592c21245f2 --- /dev/null +++ b/Documentation/devicetree/bindings/extcon/extcon-fsa9480.txt @@ -0,0 +1,19 @@ +FAIRCHILD SEMICONDUCTOR FSA9480 MICROUSB SWITCH + +The FSA9480 is a USB port accessory detector and switch. The FSA9480 is fully +controlled using I2C and enables USB data, stereo and mono audio, video, +microphone, and UART data to use a common connector port. + +Required properties: + - compatible : Must be "fcs,fsa9480" + - reg : Specifies i2c slave address. Must be 0x25. + - interrupts : Should contain one entry specifying interrupt signal of + interrupt parent to which interrupt pin of the chip is connected. + + Example: + musb@25 { + compatible = "fcs,fsa9480"; + reg = <0x25>; + interrupt-parent = <>; + interrupts = <7 0>; + }; -- 2.17.1
[RESEND,v2] cpufreq: s5pv210: Don't flood kernel log after cpufreq change
This commit replaces printk with pr_debug, so we don't flood kernel log. Signed-off-by: Paweł Chmiel Acked-by: Krzysztof Kozlowski --- Changes from v1: - Added Acked-by --- drivers/cpufreq/s5pv210-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index 5b4289460bc9..c7b7d1e65b08 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c @@ -481,7 +481,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index) arm_volt, arm_volt_max); } - printk(KERN_DEBUG "Perf changed[L%d]\n", index); + pr_debug("Perf changed[L%d]\n", index); exit: mutex_unlock(_freq_lock); -- 2.17.1
Re: [PATCH 0/5] mtd: onenand/samsung: Add device tree support
On poniedziałek, 29 kwietnia 2019 10:19:28 CEST Miquel Raynal wrote: > Hi Paweł, > > Paweł Chmiel wrote on Fri, 26 Apr 2019 > 18:42:19 +0200: > > > This patchset adds device tree support to Samsung OneNAND driver. > > It was tested on Samsung Galaxy S and Samsung Galaxy S Fascinate 4G, > > an Samsung S5PV210 based mobile phones. > > > > Tomasz Figa (5): > > mtd: onenand/samsung: Unify resource order for controller variants > > mtd: onenand/samsung: Make sure that bus clock is enabled > > mtd: onenand/samsung: Add device tree support > > dt-binding: mtd: onenand/samsung: Add device tree support > > mtd: onenand/samsung: Set name field of mtd_info struct > > > > .../bindings/mtd/samsung-onenand.txt | 46 + > > drivers/mtd/nand/onenand/samsung.c| 94 +-- > > 2 files changed, 113 insertions(+), 27 deletions(-) > > create mode 100644 > > Documentation/devicetree/bindings/mtd/samsung-onenand.txt > > > > I think you should use "mtd: onenand: samsung:" as prefix. > > Thanks, > Miquèl > Hi Miquèl I'll fix all issues and send new version of patchset. Thanks for review and comments
[PATCH 4/5] dt-binding: mtd: onenand/samsung: Add device tree support
From: Tomasz Figa This patch adds dt-bindings for Samsung OneNAND driver. Signed-off-by: Tomasz Figa Signed-off-by: Paweł Chmiel --- .../bindings/mtd/samsung-onenand.txt | 46 +++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/samsung-onenand.txt diff --git a/Documentation/devicetree/bindings/mtd/samsung-onenand.txt b/Documentation/devicetree/bindings/mtd/samsung-onenand.txt new file mode 100644 index ..341d97cc1513 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/samsung-onenand.txt @@ -0,0 +1,46 @@ +Device tree bindings for Samsung SoC OneNAND controller + +Required properties: + - compatible : value should be either of the following. + (a) "samsung,s3c6400-onenand" - for onenand controller compatible with + S3C6400 SoC, + (b) "samsung,s3c6410-onenand" - for onenand controller compatible with + S3C6410 SoC, + (c) "samsung,s5pc100-onenand" - for onenand controller compatible with + S5PC100 SoC, + (d) "samsung,s5pv210-onenand" - for onenand controller compatible with + S5PC110/S5PV210 SoCs. + + - reg : two memory mapped register regions: + - first entry: control registers. + - second and next entries: memory windows of particular OneNAND chips; + for variants a), b) and c) only one is allowed, in case of d) up to + two chips can be supported. + + - interrupt-parent : phandle of interrupt controller to which the OneNAND + controller is wired, + - interrupts : specifier of interrupt signal to which the OneNAND controller + is wired; should contain just one entry. + - clock-names : should contain two entries: + - "bus" - bus clock of the controller, + - "onenand" - clock supplied to OneNAND memory. + - clock: should contain list of phandles and specifiers for all clocks listed + in clock-names property. + - #address-cells : must be 1, + - #size-cells : must be 1. + +For partition table parsing (optional) please refer to: + [1] Documentation/devicetree/bindings/mtd/partition.txt + +Example for an s5pv210 board: + + onenand@b060 { + compatible = "samsung,s5pv210-onenand"; + reg = <0xb060 0x2000>, <0xb000 0x2>; + interrupt-parent = <>; + interrupts = <31>; + clock-names = "bus", "onenand"; + clocks = < NANDXL>, < DOUT_FLASH>; + #address-cells = <1>; + #size-cells = <1>; + }; -- 2.20.1
[PATCH 1/5] mtd: onenand/samsung: Unify resource order for controller variants
From: Tomasz Figa Before this patch, the order of memory resources requested by the driver was controller base as first and OneNAND chip base as second for S3C64xx/S5PC100 variant and the opposite for S5PC110/S5PV210 variant. To make this more consistent, this patch swaps the order of resources for the latter and updates platform code accordingly. As a nice side effect there is a slight reduction in line count of probe function. Signed-off-by: Tomasz Figa Signed-off-by: Paweł Chmiel --- drivers/mtd/nand/onenand/samsung.c | 48 ++ 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/drivers/mtd/nand/onenand/samsung.c b/drivers/mtd/nand/onenand/samsung.c index e64d0fdf7eb5..a425f19a3876 100644 --- a/drivers/mtd/nand/onenand/samsung.c +++ b/drivers/mtd/nand/onenand/samsung.c @@ -126,14 +126,13 @@ struct s3c_onenand { struct mtd_info *mtd; struct platform_device *pdev; enum soc_type type; - void __iomem*base; - void __iomem*ahb_addr; + void __iomem*ctrl_base; + void __iomem*chip_base; int bootram_command; void*page_buf; void*oob_buf; unsigned int(*mem_addr)(int fba, int fpa, int fsa); unsigned int(*cmd_map)(unsigned int type, unsigned int val); - void __iomem*dma_addr; unsigned long phys_base; struct completion complete; }; @@ -147,22 +146,22 @@ static struct s3c_onenand *onenand; static inline int s3c_read_reg(int offset) { - return readl(onenand->base + offset); + return readl(onenand->ctrl_base + offset); } static inline void s3c_write_reg(int value, int offset) { - writel(value, onenand->base + offset); + writel(value, onenand->ctrl_base + offset); } static inline int s3c_read_cmd(unsigned int cmd) { - return readl(onenand->ahb_addr + cmd); + return readl(onenand->chip_base + cmd); } static inline void s3c_write_cmd(int value, unsigned int cmd) { - writel(value, onenand->ahb_addr + cmd); + writel(value, onenand->chip_base + cmd); } #ifdef SAMSUNG_DEBUG @@ -519,7 +518,7 @@ static int (*s5pc110_dma_ops)(dma_addr_t dst, dma_addr_t src, size_t count, int static int s5pc110_dma_poll(dma_addr_t dst, dma_addr_t src, size_t count, int direction) { - void __iomem *base = onenand->dma_addr; + void __iomem *base = onenand->ctrl_base; int status; unsigned long timeout; @@ -563,7 +562,7 @@ static int s5pc110_dma_poll(dma_addr_t dst, dma_addr_t src, size_t count, int di static irqreturn_t s5pc110_onenand_irq(int irq, void *data) { - void __iomem *base = onenand->dma_addr; + void __iomem *base = onenand->ctrl_base; int status, cmd = 0; status = readl(base + S5PC110_INTC_DMA_STATUS); @@ -585,7 +584,7 @@ static irqreturn_t s5pc110_onenand_irq(int irq, void *data) static int s5pc110_dma_irq(dma_addr_t dst, dma_addr_t src, size_t count, int direction) { - void __iomem *base = onenand->dma_addr; + void __iomem *base = onenand->ctrl_base; int status; status = readl(base + S5PC110_INTC_DMA_MASK); @@ -634,7 +633,7 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area, } if (offset & 3 || (size_t) buf & 3 || - !onenand->dma_addr || count != mtd->writesize) + !onenand->ctrl_base || count != mtd->writesize) goto normal; /* Handle vmalloc address */ @@ -864,23 +863,22 @@ static int s3c_onenand_probe(struct platform_device *pdev) s3c_onenand_setup(mtd); r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - onenand->base = devm_ioremap_resource(>dev, r); - if (IS_ERR(onenand->base)) - return PTR_ERR(onenand->base); - + onenand->ctrl_base = devm_ioremap_resource(>dev, r); + if (IS_ERR(onenand->ctrl_base)) + return PTR_ERR(onenand->ctrl_base); + + r = platform_get_resource(pdev, IORESOURCE_MEM, 1); + onenand->chip_base = devm_ioremap_resource(>dev, r); + if (IS_ERR(onenand->chip_base)) + return PTR_ERR(onenand->chip_base); onenand->phys_base = r->start; - /* Set onenand_chip also */ - this->base = onenand->base; - /* Use runtime badblock check */ this->options |= ONENAND_SKIP_UNLOCK_CHECK; if (onenand->type != TYPE_S5PC110) { - r = platform_get_resource(pdev, IORESOURCE_MEM, 1); - onenand->ahb_addr = devm_ioremap_resource(>dev, r); - if (IS_ERR(onenand->ahb_addr)) - return PTR_ERR(onenand->ahb_addr); + /* Set onenand_chip also */ + this->base = onenand->ctrl_base;
[PATCH 2/5] mtd: onenand/samsung: Make sure that bus clock is enabled
From: Tomasz Figa This patch adds basic handling of controller bus clock to make sure that in device probe it is enabled and device can operate correctly. The clock is optional and driver behavior is identical as before this patch if not provided. Signed-off-by: Tomasz Figa Signed-off-by: Paweł Chmiel --- drivers/mtd/nand/onenand/samsung.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/mtd/nand/onenand/samsung.c b/drivers/mtd/nand/onenand/samsung.c index a425f19a3876..9628bf5bc397 100644 --- a/drivers/mtd/nand/onenand/samsung.c +++ b/drivers/mtd/nand/onenand/samsung.c @@ -14,6 +14,7 @@ * S5PC110: use DMA */ +#include #include #include #include @@ -125,6 +126,7 @@ enum soc_type { struct s3c_onenand { struct mtd_info *mtd; struct platform_device *pdev; + struct clk *clk_bus; enum soc_type type; void __iomem*ctrl_base; void __iomem*chip_base; @@ -916,6 +918,10 @@ static int s3c_onenand_probe(struct platform_device *pdev) } } + onenand->clk_bus = devm_clk_get(>dev, "bus"); + if (!IS_ERR(onenand->clk_bus)) + clk_prepare_enable(onenand->clk_bus); + err = onenand_scan(mtd, 1); if (err) return err; @@ -947,6 +953,8 @@ static int s3c_onenand_remove(struct platform_device *pdev) struct mtd_info *mtd = platform_get_drvdata(pdev); onenand_release(mtd); + if (!IS_ERR(onenand->clk_bus)) + clk_disable_unprepare(onenand->clk_bus); return 0; } -- 2.20.1
[PATCH 5/5] mtd: onenand/samsung: Set name field of mtd_info struct
From: Tomasz Figa This patch adds initialization of .name field of mtd_info struct to avoid printing "(null)" in kernel log messages, such as: [1.942519] 1 ofpart partitions found on MTD device (null) [1.949708] Creating 1 MTD partitions on "(null)": Signed-off-by: Tomasz Figa Signed-off-by: Paweł Chmiel --- drivers/mtd/nand/onenand/samsung.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/nand/onenand/samsung.c b/drivers/mtd/nand/onenand/samsung.c index 0f450604412f..1fda1f324cc6 100644 --- a/drivers/mtd/nand/onenand/samsung.c +++ b/drivers/mtd/nand/onenand/samsung.c @@ -886,6 +886,7 @@ static int s3c_onenand_probe(struct platform_device *pdev) return -ENOMEM; this = (struct onenand_chip *) [1]; + mtd->name = dev_name(>dev); mtd->priv = this; mtd->dev.of_node = np; mtd->dev.parent = >dev; -- 2.20.1
[PATCH 3/5] mtd: onenand/samsung: Add device tree support
From: Tomasz Figa This patch adds support for instantation using Device Tree. Signed-off-by: Tomasz Figa Signed-off-by: Paweł Chmiel --- drivers/mtd/nand/onenand/samsung.c | 37 +- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/onenand/samsung.c b/drivers/mtd/nand/onenand/samsung.c index 9628bf5bc397..0f450604412f 100644 --- a/drivers/mtd/nand/onenand/samsung.c +++ b/drivers/mtd/nand/onenand/samsung.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "samsung.h" @@ -835,8 +836,36 @@ static void s3c_onenand_setup(struct mtd_info *mtd) this->write_bufferram = onenand_write_bufferram; } +#ifdef CONFIG_OF +static const struct of_device_id s3c_onenand_of_match[] = { + { .compatible = "samsung,s3c6400-onenand", + .data = (void *)TYPE_S3C6400 }, + { .compatible = "samsung,s3c6410-onenand", + .data = (void *)TYPE_S3C6410 }, + { .compatible = "samsung,s5pv210-onenand", + .data = (void *)TYPE_S5PC110 }, + {}, +}; +MODULE_DEVICE_TABLE(of, onenand_s3c_dt_match); +#endif + +static enum soc_type s3c_onenand_get_device_id(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + + if (IS_ENABLED(CONFIG_OF) && np) { + const struct of_device_id *match; + + match = of_match_node(s3c_onenand_of_match, np); + return (enum soc_type)match->data; + } + + return platform_get_device_id(pdev)->driver_data; +} + static int s3c_onenand_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; struct onenand_platform_data *pdata; struct onenand_chip *this; struct mtd_info *mtd; @@ -858,9 +887,10 @@ static int s3c_onenand_probe(struct platform_device *pdev) this = (struct onenand_chip *) [1]; mtd->priv = this; + mtd->dev.of_node = np; mtd->dev.parent = >dev; onenand->pdev = pdev; - onenand->type = platform_get_device_id(pdev)->driver_data; + onenand->type = s3c_onenand_get_device_id(pdev); s3c_onenand_setup(mtd); @@ -919,6 +949,10 @@ static int s3c_onenand_probe(struct platform_device *pdev) } onenand->clk_bus = devm_clk_get(>dev, "bus"); + if (np && IS_ERR(onenand->clk_bus)) { + dev_err(>dev, "failed to get bus clock\n"); + return PTR_ERR(onenand->clk_bus); + } if (!IS_ERR(onenand->clk_bus)) clk_prepare_enable(onenand->clk_bus); @@ -1000,6 +1034,7 @@ static struct platform_driver s3c_onenand_driver = { .driver = { .name = "samsung-onenand", .pm = _pm_ops, + .of_match_table = of_match_ptr(s3c_onenand_of_match), }, .id_table = s3c_onenand_driver_ids, .probe = s3c_onenand_probe, -- 2.20.1
[PATCH 0/5] mtd: onenand/samsung: Add device tree support
This patchset adds device tree support to Samsung OneNAND driver. It was tested on Samsung Galaxy S and Samsung Galaxy S Fascinate 4G, an Samsung S5PV210 based mobile phones. Tomasz Figa (5): mtd: onenand/samsung: Unify resource order for controller variants mtd: onenand/samsung: Make sure that bus clock is enabled mtd: onenand/samsung: Add device tree support dt-binding: mtd: onenand/samsung: Add device tree support mtd: onenand/samsung: Set name field of mtd_info struct .../bindings/mtd/samsung-onenand.txt | 46 + drivers/mtd/nand/onenand/samsung.c| 94 +-- 2 files changed, 113 insertions(+), 27 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/samsung-onenand.txt -- 2.20.1
[PATCH] mtd: onenand: Add support for 8Gb datasize onenand
From: Jonathan Bakker Used in several S5PV210-based Galaxy S devices, among them SGH-T959V, SGH-T959P, SGH-T839, and SPH-D700. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/mtd/nand/onenand/onenand_base.c | 2 ++ include/linux/mtd/onenand_regs.h| 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/mtd/nand/onenand/onenand_base.c b/drivers/mtd/nand/onenand/onenand_base.c index 4ca4b194e7d7..abdef0bd1367 100644 --- a/drivers/mtd/nand/onenand/onenand_base.c +++ b/drivers/mtd/nand/onenand/onenand_base.c @@ -3260,6 +3260,8 @@ static void onenand_check_features(struct mtd_info *mtd) /* Lock scheme */ switch (density) { + case ONENAND_DEVICE_DENSITY_8Gb: + this->options |= ONENAND_HAS_NOP_1; case ONENAND_DEVICE_DENSITY_4Gb: if (ONENAND_IS_DDP(this)) this->options |= ONENAND_HAS_2PLANE; diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h index d60130f88eed..9640d707cbf8 100644 --- a/include/linux/mtd/onenand_regs.h +++ b/include/linux/mtd/onenand_regs.h @@ -80,6 +80,7 @@ #define ONENAND_DEVICE_DENSITY_1Gb (0x003) #define ONENAND_DEVICE_DENSITY_2Gb (0x004) #define ONENAND_DEVICE_DENSITY_4Gb (0x005) +#define ONENAND_DEVICE_DENSITY_8Gb (0x006) /* * Version ID Register F002h (R) -- 2.20.1
Re: [PATCH 2/2] extcon: Add fsa9480 extcon driver
On poniedziałek, 18 marca 2019 11:47:38 CET Chanwoo Choi wrote: > Hi, > > Sorry for late reply. Thanks for review. I'll fix all issues and submit v2 version of patches. > > On 19. 2. 26. 오전 1:58, Paweł Chmiel wrote: > > From: Tomasz Figa > > > > This patch adds extcon driver for Fairchild Semiconductor FSA9480 > > microUSB switch. > > > > Signed-off-by: Tomasz Figa > > Signed-off-by: Jonathan Bakker > > Signed-off-by: Paweł Chmiel > > --- > > drivers/extcon/Kconfig | 10 + > > drivers/extcon/Makefile | 1 + > > drivers/extcon/extcon-fsa9480.c | 473 > > 3 files changed, 484 insertions(+) > > create mode 100644 drivers/extcon/extcon-fsa9480.c > > > > diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig > > index de15bf55895b..9904f993d39a 100644 > > --- a/drivers/extcon/Kconfig > > +++ b/drivers/extcon/Kconfig > > @@ -36,6 +36,16 @@ config EXTCON_AXP288 > > Say Y here to enable support for USB peripheral detection > > and USB MUX switching by X-Power AXP288 PMIC. > > > > +config EXTCON_FSA9480 > > + tristate "FSA9480 EXTCON Support" > > + depends on INPUT > > I add the comment about I2C interface. If you use the REGMAP_I2C, > please add the proper dependency to prevent the build error. > > > + help > > + If you say yes here you get support for the Fairchild Semiconductor > > + FSA9480 microUSB switch and accessory detector chip. The FSA9480 is a > > USB > > + port accessory detector and switch. The FSA9480 is fully controlled > > using > > + I2C and enables USB data, stereo and mono audio, video, microphone > > + and UART data to use a common connector port. > > + > > config EXTCON_GPIO > > tristate "GPIO extcon support" > > depends on GPIOLIB || COMPILE_TEST > > diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile > > index 0888fdeded72..0a3a96d92a28 100644 > > --- a/drivers/extcon/Makefile > > +++ b/drivers/extcon/Makefile > > @@ -8,6 +8,7 @@ extcon-core-objs+= extcon.o devres.o > > obj-$(CONFIG_EXTCON_ADC_JACK) += extcon-adc-jack.o > > obj-$(CONFIG_EXTCON_ARIZONA) += extcon-arizona.o > > obj-$(CONFIG_EXTCON_AXP288)+= extcon-axp288.o > > +obj-$(CONFIG_EXTCON_FSA9480) += extcon-fsa9480.o > > obj-$(CONFIG_EXTCON_GPIO) += extcon-gpio.o > > obj-$(CONFIG_EXTCON_INTEL_INT3496) += extcon-intel-int3496.o > > obj-$(CONFIG_EXTCON_INTEL_CHT_WC) += extcon-intel-cht-wc.o > > diff --git a/drivers/extcon/extcon-fsa9480.c > > b/drivers/extcon/extcon-fsa9480.c > > new file mode 100644 > > index ..5c58f3e3f0e4 > > --- /dev/null > > +++ b/drivers/extcon/extcon-fsa9480.c > > @@ -0,0 +1,473 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * extcon-fsa9480.c - Fairchild Semiconductor FSA9480 extcon driver > > + * > > + * Copyright (c) 2014 Tomasz Figa > > + * > > + * Loosely based on old fsa9480 misc-device driver. > > + * > > This driver keep the 'SPDX' license rule. So, you don't need > following license sentences. Please remove them. > > > + * 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 > > + * the Free Software Foundation; either version 2 of the License, or > > + * (at your option) any later version. > > + * > > + * 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 > > + > > +/* FSA9480 I2C registers */ > > +#define FSA9480_REG_DEVID 0x01 > > +#define FSA9480_REG_CTRL0x02 > > +#define FSA9480_REG_INT10x03 > > +#define FSA9480_REG_INT20x04 > > +#define FSA9480_REG_INT1_MASK 0x05 > > +#define FSA9480_REG_INT2_MASK 0x06 > > +#define FSA9480_REG_ADC 0x07 > > +#define FSA9480_REG_TIMING1 0x08 > > +#define FSA9480_REG_TIMING2 0x09 > > +#define FSA9480_REG_DEV_T1
[PATCH 0/2] extcon: Add fsa9480 extcon driver
This small patchset adds support for Fairchild Semiconductor FSA9480 microUSB switch. It has been tested on Samsung Galaxy S and Samsung Fascinate 4G, but it can be found also on other Samsung Aries (s5pv210) based devices. Tomasz Figa (2): dt-bindings: extcon: Add support for fsa9480 switch extcon: Add fsa9480 extcon driver .../bindings/extcon/extcon-fsa9480.txt| 21 + drivers/extcon/Kconfig| 10 + drivers/extcon/Makefile | 1 + drivers/extcon/extcon-fsa9480.c | 473 ++ 4 files changed, 505 insertions(+) create mode 100644 Documentation/devicetree/bindings/extcon/extcon-fsa9480.txt create mode 100644 drivers/extcon/extcon-fsa9480.c -- 2.17.1
[PATCH 1/2] dt-bindings: extcon: Add support for fsa9480 switch
From: Tomasz Figa This patch adds documentation for binding of extcont Fairchild Semiconductor FSA9480 microusb switch. This usb port accessory detector and switch, can be found for example in some Samsung s5pv210 based phones. Signed-off-by: Tomasz Figa Signed-off-by: Paweł Chmiel --- .../bindings/extcon/extcon-fsa9480.txt| 21 +++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/extcon/extcon-fsa9480.txt diff --git a/Documentation/devicetree/bindings/extcon/extcon-fsa9480.txt b/Documentation/devicetree/bindings/extcon/extcon-fsa9480.txt new file mode 100644 index ..ebced7b18eb5 --- /dev/null +++ b/Documentation/devicetree/bindings/extcon/extcon-fsa9480.txt @@ -0,0 +1,21 @@ +FAIRCHILD SEMICONDUCTOR FSA9480 MICROUSB SWITCH + +The FSA9480 is a USB port accessory detector and switch. The FSA9480 is fully +controlled using I2C and enables USB data, stereo and mono audio, video, +microphone, and UART data to use a common connector port. + +Required properties: + - compatible : Must be "fcs,fsa9480" + - reg : Specifies i2c slave address. Must be 0x25. + - interrupt-parent : Phandle to interrupt controller to which interrupt + signal of the chip is connected. + - interrupts : Should contain one entry specifying interrupt signal of + interrupt parent to which interrupt pin of the chip is connected. + + Example: + musb@25 { + compatible = "fcs,fsa9480"; + reg = <0x25>; + interrupt-parent = <>; + interrupts = <7 0>; + }; \ No newline at end of file -- 2.17.1
[PATCH 2/2] extcon: Add fsa9480 extcon driver
From: Tomasz Figa This patch adds extcon driver for Fairchild Semiconductor FSA9480 microUSB switch. Signed-off-by: Tomasz Figa Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/extcon/Kconfig | 10 + drivers/extcon/Makefile | 1 + drivers/extcon/extcon-fsa9480.c | 473 3 files changed, 484 insertions(+) create mode 100644 drivers/extcon/extcon-fsa9480.c diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig index de15bf55895b..9904f993d39a 100644 --- a/drivers/extcon/Kconfig +++ b/drivers/extcon/Kconfig @@ -36,6 +36,16 @@ config EXTCON_AXP288 Say Y here to enable support for USB peripheral detection and USB MUX switching by X-Power AXP288 PMIC. +config EXTCON_FSA9480 + tristate "FSA9480 EXTCON Support" + depends on INPUT + help + If you say yes here you get support for the Fairchild Semiconductor + FSA9480 microUSB switch and accessory detector chip. The FSA9480 is a USB + port accessory detector and switch. The FSA9480 is fully controlled using + I2C and enables USB data, stereo and mono audio, video, microphone + and UART data to use a common connector port. + config EXTCON_GPIO tristate "GPIO extcon support" depends on GPIOLIB || COMPILE_TEST diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile index 0888fdeded72..0a3a96d92a28 100644 --- a/drivers/extcon/Makefile +++ b/drivers/extcon/Makefile @@ -8,6 +8,7 @@ extcon-core-objs+= extcon.o devres.o obj-$(CONFIG_EXTCON_ADC_JACK) += extcon-adc-jack.o obj-$(CONFIG_EXTCON_ARIZONA) += extcon-arizona.o obj-$(CONFIG_EXTCON_AXP288)+= extcon-axp288.o +obj-$(CONFIG_EXTCON_FSA9480) += extcon-fsa9480.o obj-$(CONFIG_EXTCON_GPIO) += extcon-gpio.o obj-$(CONFIG_EXTCON_INTEL_INT3496) += extcon-intel-int3496.o obj-$(CONFIG_EXTCON_INTEL_CHT_WC) += extcon-intel-cht-wc.o diff --git a/drivers/extcon/extcon-fsa9480.c b/drivers/extcon/extcon-fsa9480.c new file mode 100644 index ..5c58f3e3f0e4 --- /dev/null +++ b/drivers/extcon/extcon-fsa9480.c @@ -0,0 +1,473 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * extcon-fsa9480.c - Fairchild Semiconductor FSA9480 extcon driver + * + * Copyright (c) 2014 Tomasz Figa + * + * Loosely based on old fsa9480 misc-device driver. + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + +/* FSA9480 I2C registers */ +#define FSA9480_REG_DEVID 0x01 +#define FSA9480_REG_CTRL0x02 +#define FSA9480_REG_INT10x03 +#define FSA9480_REG_INT20x04 +#define FSA9480_REG_INT1_MASK 0x05 +#define FSA9480_REG_INT2_MASK 0x06 +#define FSA9480_REG_ADC 0x07 +#define FSA9480_REG_TIMING1 0x08 +#define FSA9480_REG_TIMING2 0x09 +#define FSA9480_REG_DEV_T1 0x0a +#define FSA9480_REG_DEV_T2 0x0b +#define FSA9480_REG_BTN10x0c +#define FSA9480_REG_BTN20x0d +#define FSA9480_REG_CK 0x0e +#define FSA9480_REG_CK_INT1 0x0f +#define FSA9480_REG_CK_INT2 0x10 +#define FSA9480_REG_CK_INTMASK1 0x11 +#define FSA9480_REG_CK_INTMASK2 0x12 +#define FSA9480_REG_MANSW1 0x13 +#define FSA9480_REG_MANSW2 0x14 + +/* Control */ +#define CON_SWITCH_OPEN (1 << 4) +#define CON_RAW_DATA(1 << 3) +#define CON_MANUAL_SW (1 << 2) +#define CON_WAIT(1 << 1) +#define CON_INT_MASK(1 << 0) +#define CON_MASK(CON_SWITCH_OPEN | CON_RAW_DATA | \ +CON_MANUAL_SW | CON_WAIT) + +/* Device Type 1 */ +#define DEV_USB_OTG 7 +#define DEV_DEDICATED_CHG 6 +#define DEV_USB_CHG 5 +#define DEV_CAR_KIT 4 +#define DEV_UART3 +#define DEV_USB 2 +#define DEV_AUDIO_2 1 +#define DEV_AUDIO_1 0 + +#define DEV_T1_USB_MASK (DEV_USB_OTG | DEV_USB) +#define DEV_T1_UART_MASK(DEV_UART) +#define DEV_T1_CHARGER_MASK (DEV_DEDICATED_CHG | DEV_USB_CHG) + +/* Device Type 2 */ +#define DEV_AV 14 +#define DEV_TTY 13 +#define DEV_PPD 12 +#define D
[PATCH v4 1/2] dt-bindings: drm: panel: Add Samsung s6e63m0 panel documentation
From: Jonathan Bakker This commit adds documentation for Samsung s6e63m0 AMOLED LCD panel driver. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel Reviewed-by: Rob Herring --- Changes from v2: - Added Reviewed-by Changes from v1: - Add missing subject prefix - Rename reset-gpio to reset-gpios - Add link to spi properites documentation. They're required for driver to work - Removed delay properties, which are now hardcoded in driver - Removed display timings, which are now hardcoded in driver --- .../display/panel/samsung,s6e63m0.txt | 33 +++ 1 file changed, 33 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt diff --git a/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt b/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt new file mode 100644 index ..9fb9ebeef8e4 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt @@ -0,0 +1,33 @@ +Samsung s6e63m0 AMOLED LCD panel + +Required properties: + - compatible: "samsung,s6e63m0" + - reset-gpios: GPIO spec for reset pin + - vdd3-supply: VDD regulator + - vci-supply: VCI regulator + +The panel must obey rules for SPI slave device specified in document [1]. + +The device node can contain one 'port' child node with one child +'endpoint' node, according to the bindings defined in [2]. This +node should describe panel's video bus. + +[1]: Documentation/devicetree/bindings/spi/spi-bus.txt +[2]: Documentation/devicetree/bindings/media/video-interfaces.txt + +Example: + + s6e63m0: display@0 { + compatible = "samsung,s6e63m0"; + reg = <0>; + reset-gpio = < 5 1>; + vdd3-supply = <_reg>; + vci-supply = <_reg>; + spi-max-frequency = <120>; + + port { + lcd_ep: endpoint { + remote-endpoint = <_ep>; + }; + }; + }; -- 2.17.1
[PATCH v4 2/2] drm/panel: Add driver for Samsung S6E63M0 panel
This patch adds Samsung S6E63M0 AMOLED LCD panel driver, connected over spi. It's based on already removed, non dt s6e63m0 driver and panel-samsung-ld9040. It can be found for example in some of Samsung Aries based phones. Signed-off-by: Paweł Chmiel Reviewed-by: Sam Ravnborg Reviewed-by: Andrzej Hajda --- Changes from v3: - Squash s6e63m0_brightness_set into s6e63m0_set_brightness - In power_on assert reset gpio after regulators, like it was done in vendor sources - In power_off assert reset gpio before regulators, like it was done in vendor sources - Add reviewed by - Match MCS command names (taken from other samsung panels) Changes from v2: - VIDEOMODE_HELPERS is not needed in Kconfig - Added help text to Kconfig - Remove unneeded videomode includes/fields - Add sentinel comment in s6e63m0_of_match struct - Handle errors during registration of backlight device. We shouldn't register panel if we fail to register backlight device - Added Reviewed-by Changes from v1: - Correct order of Kconfig/Makefile entry - Fix SPDX tag, so it matches value of MODULE_LICENSE - Remove inclusion of drmP.h - Fix code formatting - Use DRM_DEV_ERROR/DEBUG - Extract hardcoded values - Remove possibility to change gamma through sysfs, leaving only one gamma table values - Fix reset_gpio handling, so it'll be asserted in power_on and deasserted in power_off. Also do it before turning voltage on. - Disable backlight and enter sleep mode in disable callback. Previously it was done in unprepare - Enable display and backlight in enable callback. Previously it was done in prepare - Hardcode display timings and delays. Previously they were readed from device tree - We're using SPDX, so we don't need to have license body - Use MIPI_DCS_EXIT_SLEEP_MODE and MIPI_DCS_SET_DISPLAY_ON - Rename MAX_GAMMA_LEVEL to NUM_GAMMA_LEVELS - Ommit get_brightness callback - Use backlight_enable/disable API, like it's done in other panel drivers (for example panel-simple) - Make set_brightness called only from backlight api, like it's done in other panel drivers (for example panel-simple). - Reset gpio should be set to GPIOD_OUT_HIGH. It's declared as active low in device tree - Don't call power_off in remove callback --- drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile| 1 + drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 514 ++ 3 files changed, 524 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 3f3537719beb..45e9ab4b7857 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -158,6 +158,15 @@ config DRM_PANEL_SAMSUNG_S6E63J0X03 depends on BACKLIGHT_CLASS_DEVICE select VIDEOMODE_HELPERS +config DRM_PANEL_SAMSUNG_S6E63M0 + tristate "Samsung S6E63M0 RGB/SPI panel" + depends on OF + depends on SPI + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y here if you want to enable support for Samsung s6e63m0 + AMOLED LCD panel. + config DRM_PANEL_SAMSUNG_S6E8AA0 tristate "Samsung S6E8AA0 DSI video mode panel" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 4396658a7996..4507a2d253ac 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c new file mode 100644 index ..142d395ea512 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c @@ -0,0 +1,514 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * S6E63M0 AMOLED LCD drm_panel driver. + * + * Copyright (C) 2019 Paweł Chmiel + * Derived from drivers/gpu/drm/panel-samsung-ld9040.c + * + * Andrzej Hajda + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +/* Manufacturer Command Set */ +#define MCS_ELVSS_ON0xb1 +#define MCS_MIECTL10xc0 +#define MCS_BCMODE 0xc1 +#define MCS_DISCTL 0xf2 +#define MCS_SRCCTL 0xf6 +#define MCS_IFCTL 0xf7 +#define MCS_PANELCTL 0xF8 +#
Re: [PATCH v3 2/2] drm/panel: Add driver for Samsung S6E63M0 panel
On poniedziałek, 11 lutego 2019 16:35:19 CET Andrzej Hajda wrote: > On 02.02.2019 15:27, Paweł Chmiel wrote: > > This patch adds Samsung S6E63M0 AMOLED LCD panel driver, connected over > > spi. It's based on already removed, non dt s6e63m0 driver and > > panel-samsung-ld9040. It can be found for example in some of Samsung > > Aries based phones. > > > > Signed-off-by: Paweł Chmiel > > Reviewed-by: Sam Ravnborg > > --- > > Changes from v2: > > - VIDEOMODE_HELPERS is not needed in Kconfig > > - Added help text to Kconfig > > - Remove unneeded videomode includes/fields > > - Add sentinel comment in s6e63m0_of_match struct > > - Handle errors during registration of backlight device. We shouldn't > > register panel if we fail to register backlight device > > - Added Reviewed-by > > > > Changes from v1: > > - Correct order of Kconfig/Makefile entry > > - Fix SPDX tag, so it matches value of MODULE_LICENSE > > - Remove inclusion of drmP.h > > - Fix code formatting > > - Use DRM_DEV_ERROR/DEBUG > > - Extract hardcoded values > > - Remove possibility to change gamma through sysfs, leaving only one > > gamma table values > > - Fix reset_gpio handling, so it'll be asserted in power_on and > > deasserted in power_off. Also do it before turning voltage on. > > - Disable backlight and enter sleep mode in disable callback. > > Previously it was done in unprepare > > - Enable display and backlight in enable callback. Previously it was > > done in prepare > > - Hardcode display timings and delays. Previously they were readed > > from device tree > > - We're using SPDX, so we don't need to have license body > > - Use MIPI_DCS_EXIT_SLEEP_MODE and MIPI_DCS_SET_DISPLAY_ON > > - Rename MAX_GAMMA_LEVEL to NUM_GAMMA_LEVELS > > - Ommit get_brightness callback > > - Use backlight_enable/disable API, like it's done in other panel > > drivers (for example panel-simple) > > - Make set_brightness called only from backlight api, like it's done > > in other panel drivers (for example panel-simple). > > - Reset gpio should be set to GPIOD_OUT_HIGH. It's declared as active > > low in device tree > > - Don't call power_off in remove callback > > --- > > drivers/gpu/drm/panel/Kconfig | 9 + > > drivers/gpu/drm/panel/Makefile| 1 + > > drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 517 ++ > > 3 files changed, 527 insertions(+) > > create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c > > > > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig > > index 3f3537719beb..45e9ab4b7857 100644 > > --- a/drivers/gpu/drm/panel/Kconfig > > +++ b/drivers/gpu/drm/panel/Kconfig > > @@ -158,6 +158,15 @@ config DRM_PANEL_SAMSUNG_S6E63J0X03 > > depends on BACKLIGHT_CLASS_DEVICE > > select VIDEOMODE_HELPERS > > > > +config DRM_PANEL_SAMSUNG_S6E63M0 > > + tristate "Samsung S6E63M0 RGB/SPI panel" > > + depends on OF > > + depends on SPI > > + depends on BACKLIGHT_CLASS_DEVICE > > + help > > + Say Y here if you want to enable support for Samsung s6e63m0 > > + AMOLED LCD panel. > > + > > config DRM_PANEL_SAMSUNG_S6E8AA0 > > tristate "Samsung S6E8AA0 DSI video mode panel" > > depends on OF > > diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile > > index 4396658a7996..4507a2d253ac 100644 > > --- a/drivers/gpu/drm/panel/Makefile > > +++ b/drivers/gpu/drm/panel/Makefile > > @@ -16,6 +16,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += > > panel-samsung-ld9040.o > > obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o > > obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o > > obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o > > +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o > > obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o > > obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o > > obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o > > diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c > > b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c > > new file mode 100644 > > index ..4312aa3e4386 > > --- /dev/null > > +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c > > @@ -0,0 +1,517 @@ > > +// SPDX-Licen
[PATCH v2 4/5] input: misc: bma150: Drop platform data
From: Jonathan Bakker bma150 supports DT now and as there are no in-kernel users of the platform data, remove it. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/misc/bma150.c | 27 +-- include/linux/bma150.h | 5 - 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index e86df79490ad..1cdc8ce97968 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c @@ -567,8 +567,6 @@ int bma150_cfg_from_of(struct device_node *np) static int bma150_probe(struct i2c_client *client, const struct i2c_device_id *id) { - const struct bma150_platform_data *pdata = - dev_get_platdata(>dev); const struct bma150_cfg *cfg; struct bma150_data *bma150; int chip_id; @@ -592,27 +590,12 @@ static int bma150_probe(struct i2c_client *client, bma150->client = client; - if (pdata) { - if (pdata->irq_gpio_cfg) { - error = pdata->irq_gpio_cfg(); - if (error) { - dev_err(>dev, - "IRQ GPIO conf. error %d, error %d\n", - client->irq, error); - return error; - } - } - cfg = >cfg; - } else if (client->dev.of_node) { - error = bma150_cfg_from_of(client->dev.of_node); - if (error) { - dev_err(>dev, "Failed to parse of data\n"); - return error; - } - cfg = _cfg; - } else { - cfg = _cfg; + error = bma150_cfg_from_of(client->dev.of_node); + if (error) { + dev_err(>dev, "Failed to parse of data\n"); + return error; } + cfg = _cfg; error = bma150_initialize(bma150, cfg); if (error) diff --git a/include/linux/bma150.h b/include/linux/bma150.h index ad19dc7a30d7..650ffe9fa4cf 100644 --- a/include/linux/bma150.h +++ b/include/linux/bma150.h @@ -41,9 +41,4 @@ struct bma150_cfg { u32 bandwidth; /* one of BMA0150_BW_xxx */ }; -struct bma150_platform_data { - struct bma150_cfg cfg; - int (*irq_gpio_cfg)(void); -}; - #endif /* _BMA150_H_ */ -- 2.17.1
[PATCH v2 3/5] input: misc: bma150: Add support for device tree
From: Jonathan Bakker Add of_match table to enable bma150 to be probed via DT Changes from v1: - Add properties for all of bma150_cfg Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/misc/bma150.c | 64 - include/linux/bma150.h | 20 ++-- 2 files changed, 73 insertions(+), 11 deletions(-) diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index 79acaaf86b7e..e86df79490ad 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -146,7 +147,7 @@ struct bma150_data { * are stated and verified by Bosch Sensortec where they are configured * to provide a generic sensitivity performance. */ -static const struct bma150_cfg default_cfg = { +static struct bma150_cfg default_cfg = { .any_motion_int = 1, .hg_int = 1, .lg_int = 1, @@ -518,6 +519,51 @@ static int bma150_register_polled_device(struct bma150_data *bma150) return 0; } +int bma150_cfg_from_of(struct device_node *np) +{ + int error; + + default_cfg.any_motion_int = + of_property_read_bool(np, "any-motion-int"); + default_cfg.hg_int = + of_property_read_bool(np, "hg-int"); + default_cfg.lg_int = + of_property_read_bool(np, "lg-int"); + + error = of_property_read_u32_array(np, "any-motion-cfg", + _cfg.any_motion_dur, 2); + if (error < 0 && error != -EINVAL) + return error; + + error = of_property_read_u32_array(np, "hg-cfg", + _cfg.hg_hyst, 3); + if (error < 0 && error != -EINVAL) + return error; + + error = of_property_read_u32_array(np, "lg-cfg", + _cfg.lg_hyst, 3); + if (error < 0 && error != -EINVAL) + return error; + + error = of_property_read_u32(np, "range", + _cfg.range); + if (error < 0 && error != -EINVAL) + return error; + else if (default_cfg.range < BMA150_RANGE_2G || + default_cfg.range > BMA150_RANGE_8G) + return -EINVAL; + + error = of_property_read_u32(np, "bandwidth", + _cfg.bandwidth); + if (error < 0 && error != -EINVAL) + return error; + else if (default_cfg.bandwidth < BMA150_BW_25HZ || + default_cfg.bandwidth > BMA150_BW_1500HZ) + return -EINVAL; + + return 0; +} + static int bma150_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -557,6 +603,13 @@ static int bma150_probe(struct i2c_client *client, } } cfg = >cfg; + } else if (client->dev.of_node) { + error = bma150_cfg_from_of(client->dev.of_node); + if (error) { + dev_err(>dev, "Failed to parse of data\n"); + return error; + } + cfg = _cfg; } else { cfg = _cfg; } @@ -620,6 +673,14 @@ static int bma150_resume(struct device *dev) static UNIVERSAL_DEV_PM_OPS(bma150_pm, bma150_suspend, bma150_resume, NULL); +#if IS_ENABLED(CONFIG_OF) +static const struct of_device_id bma150_of_match[] = { + { .compatible = "bosch,bma150" }, + { }, +}; +MODULE_DEVICE_TABLE(of, bma150_of_match); +#endif + static const struct i2c_device_id bma150_id[] = { { "bma150", 0 }, { "smb380", 0 }, @@ -632,6 +693,7 @@ MODULE_DEVICE_TABLE(i2c, bma150_id); static struct i2c_driver bma150_driver = { .driver = { .name = BMA150_DRIVER, + .of_match_table = of_match_ptr(bma150_of_match), .pm = _pm, }, .class = I2C_CLASS_HWMON, diff --git a/include/linux/bma150.h b/include/linux/bma150.h index b85266a9c35c..ad19dc7a30d7 100644 --- a/include/linux/bma150.h +++ b/include/linux/bma150.h @@ -29,16 +29,16 @@ struct bma150_cfg { bool any_motion_int;/* Set to enable any-motion interrupt */ bool hg_int;/* Set to enable high-G interrupt */ bool lg_int;/* Set to enable low-G interrupt */ - unsigned char any_motion_dur; /* Any-motion duration */ - unsigned char any_motion_thres; /* Any-motion threshold */ - unsigned char hg_hyst; /* High-G hysterisis */ - unsigned char hg_dur; /* High-G duration */ - unsigned char hg_thres; /* High-G threshold */ - unsign
[PATCH v2 2/5] input: misc: bma150: Use managed resources helpers
From: Jonathan Bakker The driver can be cleaned up by using managed resource helpers Changes from v1: - Correct devm input unregistering Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/misc/bma150.c | 44 ++--- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index 1efcfdf9f8a8..79acaaf86b7e 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c @@ -471,7 +471,7 @@ static int bma150_register_input_device(struct bma150_data *bma150) struct input_dev *idev; int error; - idev = input_allocate_device(); + idev = devm_input_allocate_device(>client->dev); if (!idev) return -ENOMEM; @@ -482,10 +482,8 @@ static int bma150_register_input_device(struct bma150_data *bma150) input_set_drvdata(idev, bma150); error = input_register_device(idev); - if (error) { - input_free_device(idev); + if (error) return error; - } bma150->input = idev; return 0; @@ -496,7 +494,7 @@ static int bma150_register_polled_device(struct bma150_data *bma150) struct input_polled_dev *ipoll_dev; int error; - ipoll_dev = input_allocate_polled_device(); + ipoll_dev = devm_input_allocate_polled_device(>client->dev); if (!ipoll_dev) return -ENOMEM; @@ -511,10 +509,8 @@ static int bma150_register_polled_device(struct bma150_data *bma150) bma150_init_input_device(bma150, ipoll_dev->input); error = input_register_polled_device(ipoll_dev); - if (error) { - input_free_polled_device(ipoll_dev); + if (error) return error; - } bma150->input_polled = ipoll_dev; bma150->input = ipoll_dev->input; @@ -543,7 +539,8 @@ static int bma150_probe(struct i2c_client *client, return -EINVAL; } - bma150 = kzalloc(sizeof(struct bma150_data), GFP_KERNEL); + bma150 = devm_kzalloc(>dev, sizeof(struct bma150_data), + GFP_KERNEL); if (!bma150) return -ENOMEM; @@ -556,7 +553,7 @@ static int bma150_probe(struct i2c_client *client, dev_err(>dev, "IRQ GPIO conf. error %d, error %d\n", client->irq, error); - goto err_free_mem; + return error; } } cfg = >cfg; @@ -566,14 +563,14 @@ static int bma150_probe(struct i2c_client *client, error = bma150_initialize(bma150, cfg); if (error) - goto err_free_mem; + return error; if (client->irq > 0) { error = bma150_register_input_device(bma150); if (error) - goto err_free_mem; + return error; - error = request_threaded_irq(client->irq, + error = devm_request_threaded_irq(>dev, client->irq, NULL, bma150_irq_thread, IRQF_TRIGGER_RISING | IRQF_ONESHOT, BMA150_DRIVER, bma150); @@ -581,13 +578,12 @@ static int bma150_probe(struct i2c_client *client, dev_err(>dev, "irq request failed %d, error %d\n", client->irq, error); - input_unregister_device(bma150->input); - goto err_free_mem; + return error; } } else { error = bma150_register_polled_device(bma150); if (error) - goto err_free_mem; + return error; } i2c_set_clientdata(client, bma150); @@ -595,28 +591,12 @@ static int bma150_probe(struct i2c_client *client, pm_runtime_enable(>dev); return 0; - -err_free_mem: - kfree(bma150); - return error; } static int bma150_remove(struct i2c_client *client) { - struct bma150_data *bma150 = i2c_get_clientdata(client); - pm_runtime_disable(>dev); - if (client->irq > 0) { - free_irq(client->irq, bma150); - input_unregister_device(bma150->input); - } else { - input_unregister_polled_device(bma150->input_polled); - input_free_polled_device(bma150->input_polled); - } - - kfree(bma150); - return 0; } -- 2.17.1
[PATCH v2 1/5] dt-bindings: input: Add binding for bma150 sensor
From: Jonathan Bakker Add device tree bindings for Bosch BMA150 Accelerometer Sensor Changes from v1: - Add properties for all of bma150_cfg - Correct IRQ type in example Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- .../bindings/input/bosch,bma150.txt | 38 +++ include/dt-bindings/input/bma150.h| 22 +++ include/linux/bma150.h| 13 +-- 3 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/bosch,bma150.txt create mode 100644 include/dt-bindings/input/bma150.h diff --git a/Documentation/devicetree/bindings/input/bosch,bma150.txt b/Documentation/devicetree/bindings/input/bosch,bma150.txt new file mode 100644 index ..f644d132f79c --- /dev/null +++ b/Documentation/devicetree/bindings/input/bosch,bma150.txt @@ -0,0 +1,38 @@ +* Bosch BMA150 Accelerometer Sensor + +Also works for the SMB380 and BMA023 accelerometers + +Required properties: +- compatible : Should be "bosch,bma150" +- reg : The I2C address of the sensor + +Optional properties: +- interrupt-parent : should be the phandle for the interrupt controller +- interrupts : Interrupt mapping for IRQ. If not present device will be polled +- any-motion-int : bool for if the any motion interrupt should be enabled +- hg-int : bool for if the high-G interrupt should be enabled +- lg-int : bool for if the low-G interrupt should be enabled +- any-motion-cfg : array of integers for any motion duration and threshold +- hg-cfg : array of integers for high-G hysterisis, duration, and threshold +- lg-cfg : array of integers for low-G hysterisis, duration, and threshold +- range : configuration of range, one of BMA150_RANGE_* as defined in [1] +- bandwidth : refresh rate of device, one of BMA150_BW_* as defined in [1] + +Example: + +bma150@38 { + compatible = "bosch,bma150"; + reg = <0x38>; + interrupt-parent = <>; + interrupts = <1 IRQ_TYPE_EDGE_RISING>; + any-motion-int; + hg-int; + lg-int; + any-motion-cfg = <0 0>; + hg-cfg = <0 150 160>; + lg-cfg = <0 150 20>; + range = ; + bandwidth = ; +}; + +[1] include/dt-bindings/input/bma150.h diff --git a/include/dt-bindings/input/bma150.h b/include/dt-bindings/input/bma150.h new file mode 100644 index ..fb38ca787f0f --- /dev/null +++ b/include/dt-bindings/input/bma150.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * This header provides bindings for the BMA150 accelerometer + */ +#ifndef _DT_BINDINGS_INPUT_BMA150_H +#define _DT_BINDINGS_INPUT_BMA150_H + +/* Range */ +#define BMA150_RANGE_2G0 +#define BMA150_RANGE_4G1 +#define BMA150_RANGE_8G2 + +/* Refresh rate */ +#define BMA150_BW_25HZ 0 +#define BMA150_BW_50HZ 1 +#define BMA150_BW_100HZ2 +#define BMA150_BW_190HZ3 +#define BMA150_BW_375HZ4 +#define BMA150_BW_750HZ5 +#define BMA150_BW_1500HZ 6 + +#endif /* _DT_BINDINGS_INPUT_BMA150_H */ diff --git a/include/linux/bma150.h b/include/linux/bma150.h index 97ade7cdc870..b85266a9c35c 100644 --- a/include/linux/bma150.h +++ b/include/linux/bma150.h @@ -20,19 +20,10 @@ #ifndef _BMA150_H_ #define _BMA150_H_ -#define BMA150_DRIVER "bma150" +#include -#define BMA150_RANGE_2G0 -#define BMA150_RANGE_4G1 -#define BMA150_RANGE_8G2 +#define BMA150_DRIVER "bma150" -#define BMA150_BW_25HZ 0 -#define BMA150_BW_50HZ 1 -#define BMA150_BW_100HZ2 -#define BMA150_BW_190HZ3 -#define BMA150_BW_375HZ4 -#define BMA150_BW_750HZ5 -#define BMA150_BW_1500HZ 6 struct bma150_cfg { bool any_motion_int;/* Set to enable any-motion interrupt */ -- 2.17.1
[PATCH v2 5/5] input: misc: bma150: Register input device after setting private data
From: Jonathan Bakker Otherwise we introduce a race condition where userspace can request input before we're ready leading to null pointer dereference such as input: bma150 as /devices/platform/i2c-gpio-2/i2c-5/5-0038/input/input3 Unable to handle kernel NULL pointer dereference at virtual address 0018 pgd = (ptrval) [0018] *pgd=55dac831, *pte=, *ppte= Internal error: Oops: 17 [#1] PREEMPT ARM Modules linked in: bma150 input_polldev [last unloaded: bma150] CPU: 0 PID: 2870 Comm: accelerometer Not tainted 5.0.0-rc3-dirty #46 Hardware name: Samsung S5PC110/S5PV210-based board PC is at input_event+0x8/0x60 LR is at bma150_report_xyz+0x9c/0xe0 [bma150] pc : [<80450f70>]lr : [<7f0a614c>]psr: 800d0013 sp : a4c1fd78 ip : 0081 fp : 0002 r10: r9 : a5e2944c r8 : a7455000 r7 : 0016 r6 : 0101 r5 : a7617940 r4 : 80909048 r3 : fff2 r2 : r1 : 0003 r0 : Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none Control: 10c5387d Table: 54e34019 DAC: 0051 Process accelerometer (pid: 2870, stack limit = 0x(ptrval)) Stackck: (0xa4c1fd78 to 0xa4c2) fd60: fff3 fc813f6c fd80: 40410581 d7530ce3 a5e2817c a7617f00 a5e29404 a5e2817c 7f008324 fda0: a5e28000 8044f59c a5fdd9d0 a5e2945c a46a4a00 a5e29668 a7455000 80454f10 fdc0: 80909048 a5e29668 a5fdd9d0 a46a4a00 806316d0 a46a4a00 801df5f0 fde0: d7530ce3 a4c1fec0 a46a4a00 a5fdd9d0 a46a4a08 801df53c fe00: 801d74bc a4c1fec0 a4c1ff70 a7038da8 fe20: a46a4a00 801e91fc a411bbe0 801f2e88 0004 80909048 0041 fe40: 0002 dead4ead a6a88da0 e000 806fcae8 fe60: a4c1fec8 80909048 0002 a5fdd9d0 a7660110 a411bab0 0001 fe80: dead4ead a4c1fe8c a4c1fe8c d7530ce3 2013 80909048 fea0: 80909048 a4c1ff70 0001 f000 a4c1e000 0005 00026038 801eabd8 fec0: a7660110 a411bab0 b9394901 0006 a696201b 76fb3000 a7039720 fee0: a5fdd9d0 0101 0002 0096 a4c1ff00 ff00: a6b310f4 805cb174 a6b310f4 0010 0fe0 0010 a4c1e000 d7530ce3 ff20: 0003 a5f41400 a5f41424 a6962000 0003 0002 ff40: ff9c 000a 80909048 d7530ce3 a6962000 0003 80909048 ff9c ff60: a6962000 801d890c 0002 a759 0004 0100 ff80: 0001 d7530ce3 000288b8 00026320 000288b8 0005 80101204 a4c1e000 ffa0: 0005 80101000 000288b8 00026320 000288b8 000a ffc0: 000288b8 00026320 000288b8 0005 7eef3bac 000264e8 00028ad8 00026038 ffe0: 0005 7eef3300 76f76e91 76f78546 800d0030 000288b8 [<80450f70>] (input_event) from [] (0xa5e2817c) Code: e1a08148 eaa8 e351001f 812fff1e (e590c018) ---[ end trace 1c691ee85f2ff243 ]--- Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/misc/bma150.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index 1cdc8ce97968..64caf43e5bca 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c @@ -470,7 +470,6 @@ static void bma150_init_input_device(struct bma150_data *bma150, static int bma150_register_input_device(struct bma150_data *bma150) { struct input_dev *idev; - int error; idev = devm_input_allocate_device(>client->dev); if (!idev) @@ -482,18 +481,14 @@ static int bma150_register_input_device(struct bma150_data *bma150) idev->close = bma150_irq_close; input_set_drvdata(idev, bma150); - error = input_register_device(idev); - if (error) - return error; - bma150->input = idev; - return 0; + + return input_register_device(idev); } static int bma150_register_polled_device(struct bma150_data *bma150) { struct input_polled_dev *ipoll_dev; - int error; ipoll_dev = devm_input_allocate_polled_device(>client->dev); if (!ipoll_dev) @@ -509,14 +504,10 @@ static int bma150_register_polled_device(struct bma150_data *bma150) bma150_init_input_device(bma150, ipoll_dev->input); - error = input_register_polled_device(ipoll_dev); - if (error) - return error; - bma150->input_polled = ipoll_dev; bma150->input = ipoll_dev->input; - return 0; + return input_register_polled_device(ipoll_dev); } int bma150_cfg_from_of(struct device_node *np) -- 2.17.1
[PATCH v2 0/5] input: misc: bma150: Add support for device tree
This small patchset adds support for device tree to Bosch BMA150 Accelerometer Sensor driver. It was tested on s5pv210-galaxys and s5pv210-fascinate4g. Changes from v1: - Correct devm input unregistering - Correct IRQ type in DT documentation - Add DT properties for bma150_cfg and document - Add patch removing pdata - Fix race condition in input device registering Jonathan Bakker (5): dt-bindings: input: Add binding for bma150 sensor input: misc: bma150: Use managed resources helpers input: misc: bma150: Add support for device tree input: misc: bma150: Drop platform data input: misc: bma150: Register input device after setting private data .../bindings/input/bosch,bma150.txt | 38 ++ drivers/input/misc/bma150.c | 128 ++ include/dt-bindings/input/bma150.h| 22 +++ include/linux/bma150.h| 38 ++ 4 files changed, 144 insertions(+), 82 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/bosch,bma150.txt create mode 100644 include/dt-bindings/input/bma150.h -- 2.17.1
[PATCH v3 1/2] dt-bindings: drm: panel: Add Samsung s6e63m0 panel documentation
From: Jonathan Bakker This commit adds documentation for Samsung s6e63m0 AMOLED LCD panel driver. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- Changes from v1: - Add missing subject prefix - Rename reset-gpio to reset-gpios - Add link to spi properites documentation. They're required for driver to work - Removed delay properties, which are now hardcoded in driver - Removed display timings, which are now hardcoded in driver --- .../display/panel/samsung,s6e63m0.txt | 33 +++ 1 file changed, 33 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt diff --git a/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt b/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt new file mode 100644 index ..9fb9ebeef8e4 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt @@ -0,0 +1,33 @@ +Samsung s6e63m0 AMOLED LCD panel + +Required properties: + - compatible: "samsung,s6e63m0" + - reset-gpios: GPIO spec for reset pin + - vdd3-supply: VDD regulator + - vci-supply: VCI regulator + +The panel must obey rules for SPI slave device specified in document [1]. + +The device node can contain one 'port' child node with one child +'endpoint' node, according to the bindings defined in [2]. This +node should describe panel's video bus. + +[1]: Documentation/devicetree/bindings/spi/spi-bus.txt +[2]: Documentation/devicetree/bindings/media/video-interfaces.txt + +Example: + + s6e63m0: display@0 { + compatible = "samsung,s6e63m0"; + reg = <0>; + reset-gpio = < 5 1>; + vdd3-supply = <_reg>; + vci-supply = <_reg>; + spi-max-frequency = <120>; + + port { + lcd_ep: endpoint { + remote-endpoint = <_ep>; + }; + }; + }; -- 2.17.1
Re: [PATCH v2 2/2] drm/panel: Add driver for Samsung S6E63M0 panel
On piątek, 1 lutego 2019 22:36:07 CET Sam Ravnborg wrote: > Hi Paweł > > Looks good, thanks for addressing all the review feedback. > > On Fri, Feb 01, 2019 at 06:28:52PM +0100, Paweł Chmiel wrote: > > This patch adds Samsung S6E63M0 AMOLED LCD panel driver, connected over > > spi. It's based on already removed, non dt s6e63m0 driver and > > panel-samsung-ld9040. It can be found for example in some of Samsung > > Aries based phones. > > > > Signed-off-by: Paweł Chmiel > If you consider (do not change unless you think it better) the > following nits than you can add my: > > Reviewed-by: Sam Ravnborg > > Sam > > > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig > > index 3f3537719beb..be05ed5218eb 100644 > > --- a/drivers/gpu/drm/panel/Kconfig > > +++ b/drivers/gpu/drm/panel/Kconfig > > @@ -158,6 +158,13 @@ config DRM_PANEL_SAMSUNG_S6E63J0X03 > > depends on BACKLIGHT_CLASS_DEVICE > > select VIDEOMODE_HELPERS > > > > +config DRM_PANEL_SAMSUNG_S6E63M0 > > + tristate "Samsung S6E63M0 RGB/SPI panel" > > + depends on OF > > + depends on SPI > > + depends on BACKLIGHT_CLASS_DEVICE > > + select VIDEOMODE_HELPERS > With the use of display_mode the above "select VIDEOMODE_HELPERS" > is likely no longer required. Please check. Confirmed that it's not needed now. > > A help text would be nice. Simple help text added. > > > + > > config DRM_PANEL_SAMSUNG_S6E8AA0 > > tristate "Samsung S6E8AA0 DSI video mode panel" > > depends on OF > > > > +#include > > +#include > Please check if these two files are required. Removed. > > > +struct s6e63m0 { > > + struct device *dev; > > + struct drm_panel panel; > > + struct backlight_device *bl_dev; > > + > > + struct regulator_bulk_data supplies[2]; > > + struct gpio_desc *reset_gpio; > > + struct videomode vm; > vm is no longer used - delete it. Removed. > > > + > > + bool prepared; > > + bool enabled; > > + > > + /* > > +* This field is tested by functions directly accessing bus before > > +* transfer, transfer is skipped if it is set. In case of transfer > > +* failure or unexpected response the field is set to error value. > > +* Such construct allows to eliminate many checks in higher level > > +* functions. > > +*/ > > + int error; > > +}; > > + > > > +static int s6e63m0_get_modes(struct drm_panel *panel) > > +{ > > + struct drm_connector *connector = panel->connector; > > + struct drm_display_mode *mode; > > + > > + mode = drm_mode_duplicate(panel->drm, _mode); > > + if (!mode) { > > + DRM_ERROR("failed to add mode %ux%ux@%u\n", > > + default_mode.hdisplay, default_mode.vdisplay, > > + default_mode.vrefresh); > I recall I have seen a generic way to print the above, > but I have failed to find it. > Maybe it is just my memory that fools me. > > The above is fine. > > > + > > + s6e63m0_backlight_register(ctx); > > Is it correct that we continue even if we fail to register backlight? Fixed, now errors are handled and it's called before adding drm panel, so we won't do this if there will be any error during backlight setup. > > > > + > > + return 0; > > +} > > + > > + > > +static const struct of_device_id s6e63m0_of_match[] = { > > + { .compatible = "samsung,s6e63m0" }, > > + { } > > Add /* sentinel */ comment? Added > > > +}; > > I'll be sending v3 version with all issues fixed. It would be nice to have this tested on Samsung Goni. Thanks for all comments
[PATCH v3 2/2] drm/panel: Add driver for Samsung S6E63M0 panel
This patch adds Samsung S6E63M0 AMOLED LCD panel driver, connected over spi. It's based on already removed, non dt s6e63m0 driver and panel-samsung-ld9040. It can be found for example in some of Samsung Aries based phones. Signed-off-by: Paweł Chmiel Reviewed-by: Sam Ravnborg --- Changes from v2: - VIDEOMODE_HELPERS is not needed in Kconfig - Added help text to Kconfig - Remove unneeded videomode includes/fields - Add sentinel comment in s6e63m0_of_match struct - Handle errors during registration of backlight device. We shouldn't register panel if we fail to register backlight device - Added Reviewed-by Changes from v1: - Correct order of Kconfig/Makefile entry - Fix SPDX tag, so it matches value of MODULE_LICENSE - Remove inclusion of drmP.h - Fix code formatting - Use DRM_DEV_ERROR/DEBUG - Extract hardcoded values - Remove possibility to change gamma through sysfs, leaving only one gamma table values - Fix reset_gpio handling, so it'll be asserted in power_on and deasserted in power_off. Also do it before turning voltage on. - Disable backlight and enter sleep mode in disable callback. Previously it was done in unprepare - Enable display and backlight in enable callback. Previously it was done in prepare - Hardcode display timings and delays. Previously they were readed from device tree - We're using SPDX, so we don't need to have license body - Use MIPI_DCS_EXIT_SLEEP_MODE and MIPI_DCS_SET_DISPLAY_ON - Rename MAX_GAMMA_LEVEL to NUM_GAMMA_LEVELS - Ommit get_brightness callback - Use backlight_enable/disable API, like it's done in other panel drivers (for example panel-simple) - Make set_brightness called only from backlight api, like it's done in other panel drivers (for example panel-simple). - Reset gpio should be set to GPIOD_OUT_HIGH. It's declared as active low in device tree - Don't call power_off in remove callback --- drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile| 1 + drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 517 ++ 3 files changed, 527 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 3f3537719beb..45e9ab4b7857 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -158,6 +158,15 @@ config DRM_PANEL_SAMSUNG_S6E63J0X03 depends on BACKLIGHT_CLASS_DEVICE select VIDEOMODE_HELPERS +config DRM_PANEL_SAMSUNG_S6E63M0 + tristate "Samsung S6E63M0 RGB/SPI panel" + depends on OF + depends on SPI + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y here if you want to enable support for Samsung s6e63m0 + AMOLED LCD panel. + config DRM_PANEL_SAMSUNG_S6E8AA0 tristate "Samsung S6E8AA0 DSI video mode panel" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 4396658a7996..4507a2d253ac 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c new file mode 100644 index ..4312aa3e4386 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c @@ -0,0 +1,517 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * S6E63M0 AMOLED LCD drm_panel driver. + * + * Copyright (C) 2019 Paweł Chmiel + * Derived from drivers/gpu/drm/panel-samsung-ld9040.c + * + * Andrzej Hajda + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +/* Manufacturer Command Set */ +#define MCS_ELVSS_ON0xb1 +#define MCS_ACL_CTRL0xc0 +#define MCS_DISPLAY_CONDITION 0xf2 +#define MCS_ETC_CONDITION 0xf6 +#define MCS_PANEL_CONDITION 0xF8 +#define MCS_GAMMA_CTRL 0xfa + +#define NUM_GAMMA_LEVELS 11 +#define GAMMA_TABLE_COUNT 23 + +#define DATA_MASK 0x100 + +#define MAX_BRIGHTNESS (NUM_GAMMA_LEVELS - 1) + +/* array of gamma tables for gamma value 2.2 */ +static u8 const s6e63m0_gamma_22[NUM_GAMMA_LEVELS][GAMMA_TABLE_COUNT] = { + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x78, 0xEC, 0x3D,
[PATCH v2 2/2] drm/panel: Add driver for Samsung S6E63M0 panel
This patch adds Samsung S6E63M0 AMOLED LCD panel driver, connected over spi. It's based on already removed, non dt s6e63m0 driver and panel-samsung-ld9040. It can be found for example in some of Samsung Aries based phones. Signed-off-by: Paweł Chmiel --- Changes from v1: - Correct order of Kconfig/Makefile entry - Fix SPDX tag, so it matches value of MODULE_LICENSE - Remove inclusion of drmP.h - Fix code formatting - Use DRM_DEV_ERROR/DEBUG - Extract hardcoded values - Remove possibility to change gamma through sysfs, leaving only one gamma table values - Fix reset_gpio handling, so it'll be asserted in power_on and deasserted in power_off. Also do it before turning voltage on. - Disable backlight and enter sleep mode in disable callback. Previously it was done in unprepare - Enable display and backlight in enable callback. Previously it was done in prepare - Hardcode display timings and delays. Previously they were readed from device tree - We're using SPDX, so we don't need to have license body - Use MIPI_DCS_EXIT_SLEEP_MODE and MIPI_DCS_SET_DISPLAY_ON - Rename MAX_GAMMA_LEVEL to NUM_GAMMA_LEVELS - Ommit get_brightness callback - Use backlight_enable/disable API, like it's done in other panel drivers (for example panel-simple) - Make set_brightness called only from backlight api, like it's done in other panel drivers (for example panel-simple). - Reset gpio should be set to GPIOD_OUT_HIGH. It's declared as active low in device tree - Don't call power_off in remove callback --- drivers/gpu/drm/panel/Kconfig | 7 + drivers/gpu/drm/panel/Makefile| 1 + drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 517 ++ 3 files changed, 525 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 3f3537719beb..be05ed5218eb 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -158,6 +158,13 @@ config DRM_PANEL_SAMSUNG_S6E63J0X03 depends on BACKLIGHT_CLASS_DEVICE select VIDEOMODE_HELPERS +config DRM_PANEL_SAMSUNG_S6E63M0 + tristate "Samsung S6E63M0 RGB/SPI panel" + depends on OF + depends on SPI + depends on BACKLIGHT_CLASS_DEVICE + select VIDEOMODE_HELPERS + config DRM_PANEL_SAMSUNG_S6E8AA0 tristate "Samsung S6E8AA0 DSI video mode panel" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 4396658a7996..4507a2d253ac 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c new file mode 100644 index ..7658bd993088 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c @@ -0,0 +1,517 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * S6E63M0 AMOLED LCD drm_panel driver. + * + * Copyright (C) 2019 Paweł Chmiel + * Derived from drivers/gpu/drm/panel-samsung-ld9040.c + * + * Andrzej Hajda + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/* Manufacturer Command Set */ +#define MCS_ELVSS_ON0xb1 +#define MCS_ACL_CTRL0xc0 +#define MCS_DISPLAY_CONDITION 0xf2 +#define MCS_ETC_CONDITION 0xf6 +#define MCS_PANEL_CONDITION 0xF8 +#define MCS_GAMMA_CTRL 0xfa + +#define NUM_GAMMA_LEVELS 11 +#define GAMMA_TABLE_COUNT 23 + +#define DATA_MASK 0x100 + +#define MAX_BRIGHTNESS (NUM_GAMMA_LEVELS - 1) + +/* array of gamma tables for gamma value 2.2 */ +static u8 const s6e63m0_gamma_22[NUM_GAMMA_LEVELS][GAMMA_TABLE_COUNT] = { + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x78, 0xEC, 0x3D, 0xC8, + 0xC2, 0xB6, 0xC4, 0xC7, 0xB6, 0xD5, 0xD7, + 0xCC, 0x00, 0x39, 0x00, 0x36, 0x00, 0x51 }, + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x73, 0x4A, 0x3D, 0xC0, + 0xC2, 0xB1, 0xBB, 0xBE, 0xAC, 0xCE, 0xCF, + 0xC5, 0x00, 0x5D, 0x00, 0x5E, 0x00, 0x82 }, + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x70, 0x51, 0x3E, 0xBF, + 0xC1, 0xAF, 0xB9, 0xBC, 0xAB, 0xCC,
[PATCH v2 1/2] dt-bindings: drm: panel: Add Samsung s6e63m0 panel documentation
From: Jonathan Bakker This commit adds documentation for Samsung s6e63m0 AMOLED LCD panel driver. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- Changes from v1: - Add missing subject prefix - Rename reset-gpio to reset-gpios - Add link to spi properites documentation. They're required for driver to work - Removed delay properties, which are now hardcoded in driver - Removed display timings, which are now hardcoded in driver --- .../display/panel/samsung,s6e63m0.txt | 33 +++ 1 file changed, 33 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt diff --git a/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt b/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt new file mode 100644 index ..9fb9ebeef8e4 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt @@ -0,0 +1,33 @@ +Samsung s6e63m0 AMOLED LCD panel + +Required properties: + - compatible: "samsung,s6e63m0" + - reset-gpios: GPIO spec for reset pin + - vdd3-supply: VDD regulator + - vci-supply: VCI regulator + +The panel must obey rules for SPI slave device specified in document [1]. + +The device node can contain one 'port' child node with one child +'endpoint' node, according to the bindings defined in [2]. This +node should describe panel's video bus. + +[1]: Documentation/devicetree/bindings/spi/spi-bus.txt +[2]: Documentation/devicetree/bindings/media/video-interfaces.txt + +Example: + + s6e63m0: display@0 { + compatible = "samsung,s6e63m0"; + reg = <0>; + reset-gpio = < 5 1>; + vdd3-supply = <_reg>; + vci-supply = <_reg>; + spi-max-frequency = <120>; + + port { + lcd_ep: endpoint { + remote-endpoint = <_ep>; + }; + }; + }; -- 2.17.1
Re: [PATCH 2/2] drm/panel: Add driver for Samsung S6E63M0 panel
On poniedziałek, 28 stycznia 2019 14:47:41 CET Andrzej Hajda wrote: > Hi Paweł, > > Nice work. > > I agree with most Sam's comments (maybe expect DRM_DEV_* logging - I am > not sure if we need concurrent logging facility). > > I'd like to add few more comments: > > > > On 25.01.2019 17:46, Paweł Chmiel wrote: > > This patch adds Samsung S6E63M0 AMOLED LCD panel driver, connected over > > spi. It's based on already removed, non dt s6e63m0 driver and > > panel-samsung-ld9040. There is possibility to choose one from 3 > > different gamma tables. > > It can be found for example in some of Samsung Aries based phones. > > > > Signed-off-by: Paweł Chmiel > > --- > > drivers/gpu/drm/panel/Kconfig | 7 + > > drivers/gpu/drm/panel/Makefile| 1 + > > drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 712 ++ > > 3 files changed, 720 insertions(+) > > create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c > > > > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig > > index 3f3537719beb..4a4b64f74e70 100644 > > --- a/drivers/gpu/drm/panel/Kconfig > > +++ b/drivers/gpu/drm/panel/Kconfig > > @@ -82,6 +82,13 @@ config DRM_PANEL_SAMSUNG_LD9040 > > depends on OF && SPI > > select VIDEOMODE_HELPERS > > > > +config DRM_PANEL_SAMSUNG_S6E63M0 > > + tristate "Samsung S6E63M0 RGB/SPI panel" > > + depends on OF > > + depends on SPI > > + depends on BACKLIGHT_CLASS_DEVICE > > + select VIDEOMODE_HELPERS > > + > > config DRM_PANEL_LG_LG4573 > > tristate "LG4573 RGB/SPI panel" > > depends on OF && SPI > > diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile > > index 4396658a7996..3e5d53fdee47 100644 > > --- a/drivers/gpu/drm/panel/Makefile > > +++ b/drivers/gpu/drm/panel/Makefile > > @@ -14,6 +14,7 @@ obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += > > panel-raspberrypi-touchscreen > > obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o > > obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o > > obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o > > +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o > > obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o > > obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o > > obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o > > diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c > > b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c > > new file mode 100644 > > index ..cb5c090621ad > > --- /dev/null > > +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c > > @@ -0,0 +1,712 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * S6E63M0 AMOLED LCD drm_panel driver. > > + * > > + * Copyright (C) 2019 Paweł Chmiel > > + * Derived from drivers/gpu/drm/panel-samsung-ld9040.c > > + * > > + * Andrzej Hajda > > + * > > + * 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. > > > You do not need license 'body' if SPDX is in use. > > > > + */ > > + > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > + > > +/* Manufacturer Command Set */ > > +#define MCS_STAND_BY_OFF0x11 > > MIPI_DCS_EXIT_SLEEP_MODE > > > +#define MCS_DISPLAY_ON 0x29 > MIPI_DCS_SET_DISPLAY_ON > > +#define MCS_ELVSS_ON0xb1 > > +#define MCS_ACL_CTRL0xc0 > > +#define MCS_DISPLAY_CONDITION 0xf2 > > +#define MCS_ETC_CONDITION 0xf6 > > +#define MCS_PANEL_CONDITION 0xF8 > > +#define MCS_GAMMA_CTRL 0xfa > > + > > +#define MAX_GAMMA_LEVEL 11 > > > GAMMA_LEVEL_COUNT or NUM_GAMMA_LEVELS ? Ok, NUM_GAMMA_LEVELS looks better. > > > > +#define GAMMA_TABLE_COUNT 23 > > + > > +#define MAX_BRIGHTNESS (MAX_GAMMA_LEVEL - 1) > > +#define GAMMA_MODE_22 0 > > +#define GAMMA_MODE_19 1 > > +#define GAMMA_MODE_17 2 > > + > > +/* array of gamma tables for gamma value 2.2 *
Re: [PATCH 1/2] drm: panel: Add Samsung s6e63m0 panel documentation
On sobota, 26 stycznia 2019 21:55:01 CET Sam Ravnborg wrote: Hi > Hi Pawel. > > Thanks for the patch, some comments follows. > Please judge what comments you chose to follow, see this as suggestions. > > According to Documentation/devicetree/bindings/submitting-patches.rst: > > The preferred subject prefix for binding patches is: > "dt-bindings: : ..." > > It would be a good idea to follow this practice in next revision. I don't know how I forgot about this (will be fixed in next version). > > On Fri, Jan 25, 2019 at 05:46:44PM +0100, Paweł Chmiel wrote: > > From: Jonathan Bakker > > > > This commit adds documentation for Samsung s6e63m0 AMOLED LCD panel > > driver. > > > > Signed-off-by: Jonathan Bakker > > Signed-off-by: Paweł Chmiel > > --- > > .../display/panel/samsung,s6e63m0.txt | 60 +++ > > 1 file changed, 60 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt > > > > diff --git > > a/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt > > b/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt > > new file mode 100644 > > index ..4979200e2dd2 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt > > @@ -0,0 +1,60 @@ > > +Samsung s6e63m0 AMOLED LCD panel > > + > > +Required properties: > > + - compatible: "samsung,s6e63m0" > > + - reset-gpio: GPIO spec for reset pin > The preferred name is reset-gpios (added 's') Right, will be fixed. > > > + - vdd3-supply: VDD regulator > > + - vci-supply: VCI regulator > > + - display-timings: timings for the connected panel as described by [1] > Today, as is my best understanding, it is encouraged to specify the timing > in the actual driver and not in DT, Ok, will hardcode them in driver. Currently those timings (which i had added to my device dts) were taken from original kernel sources. Need to check if there are other devices (not only using mainline kernel) using this panel and what timings are they using (hope they're the same). > > The example include a spi-max-frequency which is not mentioned? spi-max-frequency shouldn't be here and will be removed. > > > + > > +Optional properties: > > + - reset-delay: Delay in ms after adjusting reset-gpio, default 120ms > > + - power-on-delay: Delay in ms after powering on, default 25ms > > + - power-off-delay: Delay in ms before powering off, default 200ms > > + - panel-width-mm: physical panel width in mm > > + - panel-height-mm: physical panel height in mm > Likewise these delays are also properties that today are included in the > driver. > Need to check delays also (like timings). > I cannot explain the background for this, this is just how things are done. > > > + > > +The device node can contain one 'port' child node with one child > > +'endpoint' node, according to the bindings defined in [2]. This > > +node should describe panel's video bus. > > + > > +[1]: Documentation/devicetree/bindings/display/panel/display-timing.txt > > +[2]: Documentation/devicetree/bindings/media/video-interfaces.txt > > + > > +Example: > > + > > + s6e63m0: display@0 { > > + compatible = "samsung,s6e63m0"; > > + reg = <0>; > > + reset-gpio = < 5 1>; > > + vdd3-supply = <_reg>; > > + vci-supply = <_reg>; > > + spi-max-frequency = <100>; > > + > > + power-on-delay = <0>; > > + power-off-delay = <0>; > > + reset-delay = <10>; > > + panel-width-mm = <53>; > > + panel-height-mm = <89>; > > + > > + display-timings { > > + timing-0 { > > + /* 480x800@60Hz */ > > + clock-frequency = <25628040>; > > + hactive = <480>; > > + vactive = <800>; > > + hfront-porch = <16>; > > + hback-porch = <16>; > > + hsync-len = <2>; > > + vfront-porch = <28>; > > + vback-porch = <1>; > > + vsync-len = <2>; > > + }; > > + }; > > + > > + port { > > + lcd_ep: endpoint { > > + remote-endpoint = <_ep>; > > + }; > > + }; > > + }; > > Sam > Thanks for review
[PATCH 2/3] input: misc: bma150: Add support for device tree
From: Jonathan Bakker Add basic of_match table to enable bma150 to be probed via DT Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/misc/bma150.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index d101bb0a33d6..c26a118d89fa 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -628,6 +629,14 @@ static int bma150_resume(struct device *dev) static UNIVERSAL_DEV_PM_OPS(bma150_pm, bma150_suspend, bma150_resume, NULL); +#if IS_ENABLED(CONFIG_OF) +static const struct of_device_id bma150_of_match[] = { + { .compatible = "bosch,bma150" }, + { }, +}; +MODULE_DEVICE_TABLE(of, bma150_of_match); +#endif + static const struct i2c_device_id bma150_id[] = { { "bma150", 0 }, { "smb380", 0 }, @@ -640,6 +649,7 @@ MODULE_DEVICE_TABLE(i2c, bma150_id); static struct i2c_driver bma150_driver = { .driver = { .name = BMA150_DRIVER, + .of_match_table = of_match_ptr(bma150_of_match), .pm = _pm, }, .class = I2C_CLASS_HWMON, -- 2.17.1
[PATCH 1/3] input: misc: bma150: Use managed resources helpers
From: Jonathan Bakker The driver can be cleaned up by using managed resource helpers Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/misc/bma150.c | 40 + 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index 1efcfdf9f8a8..d101bb0a33d6 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c @@ -471,7 +471,7 @@ static int bma150_register_input_device(struct bma150_data *bma150) struct input_dev *idev; int error; - idev = input_allocate_device(); + idev = devm_input_allocate_device(>client->dev); if (!idev) return -ENOMEM; @@ -482,10 +482,8 @@ static int bma150_register_input_device(struct bma150_data *bma150) input_set_drvdata(idev, bma150); error = input_register_device(idev); - if (error) { - input_free_device(idev); + if (error) return error; - } bma150->input = idev; return 0; @@ -496,7 +494,7 @@ static int bma150_register_polled_device(struct bma150_data *bma150) struct input_polled_dev *ipoll_dev; int error; - ipoll_dev = input_allocate_polled_device(); + ipoll_dev = devm_input_allocate_polled_device(>client->dev); if (!ipoll_dev) return -ENOMEM; @@ -511,10 +509,8 @@ static int bma150_register_polled_device(struct bma150_data *bma150) bma150_init_input_device(bma150, ipoll_dev->input); error = input_register_polled_device(ipoll_dev); - if (error) { - input_free_polled_device(ipoll_dev); + if (error) return error; - } bma150->input_polled = ipoll_dev; bma150->input = ipoll_dev->input; @@ -543,7 +539,8 @@ static int bma150_probe(struct i2c_client *client, return -EINVAL; } - bma150 = kzalloc(sizeof(struct bma150_data), GFP_KERNEL); + bma150 = devm_kzalloc(>dev, sizeof(struct bma150_data), + GFP_KERNEL); if (!bma150) return -ENOMEM; @@ -556,7 +553,7 @@ static int bma150_probe(struct i2c_client *client, dev_err(>dev, "IRQ GPIO conf. error %d, error %d\n", client->irq, error); - goto err_free_mem; + return error; } } cfg = >cfg; @@ -566,14 +563,14 @@ static int bma150_probe(struct i2c_client *client, error = bma150_initialize(bma150, cfg); if (error) - goto err_free_mem; + return error; if (client->irq > 0) { error = bma150_register_input_device(bma150); if (error) - goto err_free_mem; + return error; - error = request_threaded_irq(client->irq, + error = devm_request_threaded_irq(>dev, client->irq, NULL, bma150_irq_thread, IRQF_TRIGGER_RISING | IRQF_ONESHOT, BMA150_DRIVER, bma150); @@ -582,12 +579,12 @@ static int bma150_probe(struct i2c_client *client, "irq request failed %d, error %d\n", client->irq, error); input_unregister_device(bma150->input); - goto err_free_mem; + return error; } } else { error = bma150_register_polled_device(bma150); if (error) - goto err_free_mem; + return error; } i2c_set_clientdata(client, bma150); @@ -595,10 +592,6 @@ static int bma150_probe(struct i2c_client *client, pm_runtime_enable(>dev); return 0; - -err_free_mem: - kfree(bma150); - return error; } static int bma150_remove(struct i2c_client *client) @@ -607,15 +600,10 @@ static int bma150_remove(struct i2c_client *client) pm_runtime_disable(>dev); - if (client->irq > 0) { - free_irq(client->irq, bma150); + if (client->irq > 0) input_unregister_device(bma150->input); - } else { + else input_unregister_polled_device(bma150->input_polled); - input_free_polled_device(bma150->input_polled); - } - - kfree(bma150); return 0; } -- 2.17.1
[PATCH 3/3] input: dt-bindings: Add binding for bma150 sensor
From: Jonathan Bakker Add device tree bindings for Bosch BMA150 Accelerometer Sensor Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- .../bindings/input/bosch,bma150.txt | 20 +++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/bosch,bma150.txt diff --git a/Documentation/devicetree/bindings/input/bosch,bma150.txt b/Documentation/devicetree/bindings/input/bosch,bma150.txt new file mode 100644 index ..290c60e38c70 --- /dev/null +++ b/Documentation/devicetree/bindings/input/bosch,bma150.txt @@ -0,0 +1,20 @@ +* Bosch BMA150 Accelerometer Sensor + +Also works for the SMB380 and BMA023 accelerometers + +Required properties: +- compatible : Should be "bosch,bma150" +- reg : The I2C address of the sensor + +Optional properties: +- interrupt-parent : should be the phandle for the interrupt controller +- interrupts : Interrupt mapping for IRQ. If not present device will be polled + +Example: + +bma150@38 { + compatible = "bosch,bma150"; + reg = <0x38>; + interrupt-parent = <>; + interrupts = <1 IRQ_TYPE_LEVEL_HIGH>; +}; -- 2.17.1
[PATCH 0/3] input: misc: bma150: Add support for device tree
This small patchset adds support for device tree to Bosch BMA150 Accelerometer Sensor driver. It was tested on s5pv210-galaxys and s5pv210-fascinate4g. Jonathan Bakker (3): input: misc: bma150: Use managed resources helpers input: misc: bma150: Add support for device tree input: dt-bindings: Add binding for bma150 sensor .../bindings/input/bosch,bma150.txt | 20 drivers/input/misc/bma150.c | 50 +-- 2 files changed, 44 insertions(+), 26 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/bosch,bma150.txt -- 2.17.1
[PATCH 2/4] input: misc: gp2a: Add support for light sensor
From: Jonathan Bakker The gp2a driver previously only supported the proximity part of the sensor while the hardware supports both. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/misc/Kconfig | 2 + drivers/input/misc/gp2ap002a00f.c | 71 +- include/linux/input/gp2ap002a00f.h | 4 ++ 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index ca59a2be9bc5..a532efb4e6d8 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -252,6 +252,8 @@ config INPUT_GP2A tristate "Sharp GP2AP002A00F I2C Proximity/Opto sensor driver" depends on I2C depends on GPIOLIB || COMPILE_TEST + depends on IIO + select INPUT_POLLDEV help Say Y here if you have a Sharp GP2AP002A00F proximity/als combo-chip hooked to an I2C bus. diff --git a/drivers/input/misc/gp2ap002a00f.c b/drivers/input/misc/gp2ap002a00f.c index 79c8c4c56d1a..090c8c313295 100644 --- a/drivers/input/misc/gp2ap002a00f.c +++ b/drivers/input/misc/gp2ap002a00f.c @@ -10,9 +10,12 @@ */ #include +#include +#include #include #include #include +#include #include #include #include @@ -20,7 +23,9 @@ #include struct gp2a_data { + struct iio_channel *channel; struct input_dev *input; + struct input_polled_dev *poll_dev; const struct gp2a_platform_data *pdata; struct i2c_client *i2c_client; }; @@ -58,6 +63,19 @@ static irqreturn_t gp2a_irq(int irq, void *handle) return IRQ_HANDLED; } +static void gp2a_poll(struct input_polled_dev *dev) +{ + struct gp2a_data *dt = dev->private; + int ret, value; + + ret = iio_read_channel_processed(dt->channel, ); + if (ret < 0) + dev_err(>i2c_client->dev, "failed to read value!"); + + input_report_abs(dev->input, ABS_MISC, value); + input_sync(dev->input); +} + static int gp2a_enable(struct gp2a_data *dt) { return i2c_smbus_write_byte_data(dt->i2c_client, GP2A_ADDR_OPMOD, @@ -127,7 +145,7 @@ static int gp2a_probe(struct i2c_client *client, { const struct gp2a_platform_data *pdata = dev_get_platdata(>dev); struct gp2a_data *dt; - int error; + int error, value; if (!pdata) return -EINVAL; @@ -152,6 +170,49 @@ static int gp2a_probe(struct i2c_client *client, dt->pdata = pdata; dt->i2c_client = client; + dt->channel = devm_iio_channel_get(>dev, "light"); + if (!IS_ERR(dt->channel)) { + if (!dt->channel->indio_dev) { + error = -ENXIO; + goto err_hw_shutdown; + } + + if (dt->pdata->light_adc_max <= 0 || + dt->pdata->light_adc_fuzz <= 0) { + error = -EINVAL; + goto err_hw_shutdown; + } + + dt->poll_dev = devm_input_allocate_polled_device(>dev); + if (!dt->poll_dev) { + dev_err(>dev, + "failed to allocate polled input device"); + error = -ENOMEM; + goto err_hw_shutdown; + } + + if (!device_property_read_u32(>dev, "poll-interval", + )) + dt->poll_dev->poll_interval = value; + + dt->poll_dev->poll = gp2a_poll; + dt->poll_dev->private = dt; + + dt->poll_dev->input->name = GP2A_I2C_NAME; + + input_set_capability(dt->poll_dev->input, EV_ABS, ABS_MISC); + input_set_abs_params(dt->poll_dev->input, ABS_MISC, 0, +dt->pdata->light_adc_max, +dt->pdata->light_adc_fuzz, 0); + + error = input_register_polled_device(dt->poll_dev); + if (error) + goto err_hw_shutdown; + } else if (PTR_ERR(dt->channel) == -EPROBE_DEFER) { + error = -EPROBE_DEFER; + goto err_hw_shutdown; + } + error = gp2a_initialize(dt); if (error < 0) goto err_hw_shutdown; @@ -203,6 +264,8 @@ static int gp2a_remove(struct i2c_client *client) const struct gp2a_platform_data *pdata = dt->pdata; input_unregister_device(dt->input); + if (dt->poll_dev) + input_unregister_polled_device(dt->poll_dev); if (pdata->hw_shutdown) pdata->hw_shutdown(client); @@ -243,6 +306,12 @@ static int __maybe_unused gp2a_resume(struct device *dev)
[PATCH 4/4] dt-bindings: input: Add documentation for gp2a sensor
From: Jonathan Bakker This commit adds documentation for Sharp GP2AP002A00F. It's Proximity/Opto Sensor connected over i2c. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- .../bindings/input/sharp,gp2ap002a00f.txt | 29 +++ 1 file changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt diff --git a/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt b/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt new file mode 100644 index ..c524eb7d3d60 --- /dev/null +++ b/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt @@ -0,0 +1,29 @@ +* Sharp GP2AP002A00F I2C Proximity/Opto Sensor + +Required properties: +- compatible : Should be "sharp,gp2ap002a00f" +- reg : The I2C address of the sensor +- vout-gpio : The gpio connected to the vout pin +- interrupt-parent : should be the phandle for the interrupt controller +- interrupts : Interrupt mapping for GPIO IRQ, it should by configured with + flags IRQ_TYPE_EDGE_BOTH + +Optional properties: +- wakeup : If the device is capable of waking up the system +- io-channels : Phandle to an ADC channel connected to the light sensor +- io-channel-names = "light"; +- poll-interval : Poll interval time in milliseconds, default 500ms +- light-adc-max : Maximum light value reported, default 4096 +- light-adc-fuzz : Fuzz value for reported light value, default 80 + +Example: + +gp2a@44 { + compatible = "sharp,gp2ap002a00f"; + reg = <0x44>; + vout-gpio = < 2 GPIO_ACTIVE_HIGH>; + interrupt-parent = <>; + interrupts = <2 IRQ_TYPE_EDGE_BOTH>; + io-channels = < 9>; + io-channel-names = "light"; +}; -- 2.17.1
[PATCH 3/4] input: misc: gp2a: Enable device tree
From: Jonathan Bakker Enable probing of gp2a via device tree via a simple of_match table Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/misc/gp2ap002a00f.c | 46 +++ 1 file changed, 46 insertions(+) diff --git a/drivers/input/misc/gp2ap002a00f.c b/drivers/input/misc/gp2ap002a00f.c index 090c8c313295..01a7d44ae921 100644 --- a/drivers/input/misc/gp2ap002a00f.c +++ b/drivers/input/misc/gp2ap002a00f.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include struct gp2a_data { struct iio_channel *channel; @@ -140,6 +142,35 @@ static int gp2a_initialize(struct gp2a_data *dt) return error; } +static struct gp2a_platform_data *gp2a_parse_dt_pdata(struct device *dev) +{ + struct gp2a_platform_data *pdata; + int ret; + + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return ERR_PTR(-ENOMEM); + + pdata->wakeup = of_property_read_bool(dev->of_node, "wakeup"); + + pdata->vout_gpio = of_get_named_gpio(dev->of_node, "vout-gpio", 0); + if (pdata->vout_gpio < 0) { + dev_err(dev, "failed to find vout-gpio"); + return ERR_PTR(-EINVAL); + } + + ret = device_property_read_u32(dev, "light-adc-max", + >light_adc_max); + if (ret) + pdata->light_adc_max = 4096; + ret = device_property_read_u32(dev, "light-adc-fuzz", + >light_adc_fuzz); + if (ret) + pdata->light_adc_fuzz = 80; + + return pdata; +} + static int gp2a_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -147,6 +178,12 @@ static int gp2a_probe(struct i2c_client *client, struct gp2a_data *dt; int error, value; + if (IS_ENABLED(CONFIG_OF) && client->dev.of_node) { + pdata = gp2a_parse_dt_pdata(>dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + } + if (!pdata) return -EINVAL; @@ -317,6 +354,14 @@ static int __maybe_unused gp2a_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(gp2a_pm, gp2a_suspend, gp2a_resume); +#if IS_ENABLED(CONFIG_OF) +static const struct of_device_id gp2a_of_match[] = { + { .compatible = "sharp,gp2ap002a00f" }, + { }, +}; +MODULE_DEVICE_TABLE(of, gp2a_of_match); +#endif + static const struct i2c_device_id gp2a_i2c_id[] = { { GP2A_I2C_NAME, 0 }, { } @@ -326,6 +371,7 @@ MODULE_DEVICE_TABLE(i2c, gp2a_i2c_id); static struct i2c_driver gp2a_i2c_driver = { .driver = { .name = GP2A_I2C_NAME, + .of_match_table = of_match_ptr(gp2a_of_match), .pm = _pm, }, .probe = gp2a_probe, -- 2.17.1
[PATCH 0/4] input: misc: gp2a: Add device tree support
The main goal of this patchset is to add device tree support to driver. First patch is doing little cleanup by using managed resource helpers. Second patch adds support for light sensor part, which is supported by hw, but was not supported by driver. The last two patches adds device tree support to driver, with documentation. It was tested on s5pv210-galaxys and s5pv210-fascinate4g. Jonathan Bakker (4): input: misc: gp2a: Use managed resource helpers input: misc: gp2a: Add support for light sensor input: misc: gp2a: Enable device tree dt-bindings: input: Add documentation for gp2a sensor .../bindings/input/sharp,gp2ap002a00f.txt | 29 drivers/input/misc/Kconfig| 2 + drivers/input/misc/gp2ap002a00f.c | 154 +++--- include/linux/input/gp2ap002a00f.h| 4 + 4 files changed, 163 insertions(+), 26 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt -- 2.17.1
[PATCH 1/4] input: misc: gp2a: Use managed resource helpers
From: Jonathan Bakker Simplify cleanup of failures by using managed resource helpers Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/misc/gp2ap002a00f.c | 37 ++- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/drivers/input/misc/gp2ap002a00f.c b/drivers/input/misc/gp2ap002a00f.c index c6a29e57b5e4..79c8c4c56d1a 100644 --- a/drivers/input/misc/gp2ap002a00f.c +++ b/drivers/input/misc/gp2ap002a00f.c @@ -138,14 +138,15 @@ static int gp2a_probe(struct i2c_client *client, return error; } - error = gpio_request_one(pdata->vout_gpio, GPIOF_IN, GP2A_I2C_NAME); + error = devm_gpio_request_one(>dev, pdata->vout_gpio, + GPIOF_IN, GP2A_I2C_NAME); if (error) goto err_hw_shutdown; - dt = kzalloc(sizeof(struct gp2a_data), GFP_KERNEL); + dt = devm_kzalloc(>dev, sizeof(struct gp2a_data), GFP_KERNEL); if (!dt) { error = -ENOMEM; - goto err_free_gpio; + goto err_hw_shutdown; } dt->pdata = pdata; @@ -153,12 +154,12 @@ static int gp2a_probe(struct i2c_client *client, error = gp2a_initialize(dt); if (error < 0) - goto err_free_mem; + goto err_hw_shutdown; - dt->input = input_allocate_device(); + dt->input = devm_input_allocate_device(>dev); if (!dt->input) { error = -ENOMEM; - goto err_free_mem; + goto err_hw_shutdown; } input_set_drvdata(dt->input, dt); @@ -171,19 +172,18 @@ static int gp2a_probe(struct i2c_client *client, input_set_capability(dt->input, EV_SW, SW_FRONT_PROXIMITY); - error = request_threaded_irq(client->irq, NULL, gp2a_irq, - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | - IRQF_ONESHOT, - GP2A_I2C_NAME, dt); + error = devm_request_threaded_irq(>dev, client->irq, NULL, + gp2a_irq, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | + IRQF_ONESHOT, GP2A_I2C_NAME, dt); if (error) { dev_err(>dev, "irq request failed\n"); - goto err_free_input_dev; + goto err_hw_shutdown; } error = input_register_device(dt->input); if (error) { dev_err(>dev, "device registration failed\n"); - goto err_free_irq; + goto err_hw_shutdown; } device_init_wakeup(>dev, pdata->wakeup); @@ -191,14 +191,6 @@ static int gp2a_probe(struct i2c_client *client, return 0; -err_free_irq: - free_irq(client->irq, dt); -err_free_input_dev: - input_free_device(dt->input); -err_free_mem: - kfree(dt); -err_free_gpio: - gpio_free(pdata->vout_gpio); err_hw_shutdown: if (pdata->hw_shutdown) pdata->hw_shutdown(client); @@ -210,12 +202,7 @@ static int gp2a_remove(struct i2c_client *client) struct gp2a_data *dt = i2c_get_clientdata(client); const struct gp2a_platform_data *pdata = dt->pdata; - free_irq(client->irq, dt); - input_unregister_device(dt->input); - kfree(dt); - - gpio_free(pdata->vout_gpio); if (pdata->hw_shutdown) pdata->hw_shutdown(client); -- 2.17.1
[PATCH 2/2] drm/panel: Add driver for Samsung S6E63M0 panel
This patch adds Samsung S6E63M0 AMOLED LCD panel driver, connected over spi. It's based on already removed, non dt s6e63m0 driver and panel-samsung-ld9040. There is possibility to choose one from 3 different gamma tables. It can be found for example in some of Samsung Aries based phones. Signed-off-by: Paweł Chmiel --- drivers/gpu/drm/panel/Kconfig | 7 + drivers/gpu/drm/panel/Makefile| 1 + drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 712 ++ 3 files changed, 720 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 3f3537719beb..4a4b64f74e70 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -82,6 +82,13 @@ config DRM_PANEL_SAMSUNG_LD9040 depends on OF && SPI select VIDEOMODE_HELPERS +config DRM_PANEL_SAMSUNG_S6E63M0 + tristate "Samsung S6E63M0 RGB/SPI panel" + depends on OF + depends on SPI + depends on BACKLIGHT_CLASS_DEVICE + select VIDEOMODE_HELPERS + config DRM_PANEL_LG_LG4573 tristate "LG4573 RGB/SPI panel" depends on OF && SPI diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 4396658a7996..3e5d53fdee47 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += panel-raspberrypi-touchscreen obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c new file mode 100644 index ..cb5c090621ad --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c @@ -0,0 +1,712 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * S6E63M0 AMOLED LCD drm_panel driver. + * + * Copyright (C) 2019 Paweł Chmiel + * Derived from drivers/gpu/drm/panel-samsung-ld9040.c + * + * Andrzej Hajda + * + * 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. + */ + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +/* Manufacturer Command Set */ +#define MCS_STAND_BY_OFF0x11 +#define MCS_DISPLAY_ON 0x29 +#define MCS_ELVSS_ON0xb1 +#define MCS_ACL_CTRL0xc0 +#define MCS_DISPLAY_CONDITION 0xf2 +#define MCS_ETC_CONDITION 0xf6 +#define MCS_PANEL_CONDITION 0xF8 +#define MCS_GAMMA_CTRL 0xfa + +#define MAX_GAMMA_LEVEL 11 +#define GAMMA_TABLE_COUNT 23 + +#define MAX_BRIGHTNESS (MAX_GAMMA_LEVEL - 1) +#define GAMMA_MODE_22 0 +#define GAMMA_MODE_19 1 +#define GAMMA_MODE_17 2 + +/* array of gamma tables for gamma value 2.2 */ +static u8 const s6e63m0_gamma_22[MAX_GAMMA_LEVEL][GAMMA_TABLE_COUNT] = { + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x78, 0xEC, 0x3D, 0xC8, + 0xC2, 0xB6, 0xC4, 0xC7, 0xB6, 0xD5, 0xD7, + 0xCC, 0x00, 0x39, 0x00, 0x36, 0x00, 0x51 }, + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x73, 0x4A, 0x3D, 0xC0, + 0xC2, 0xB1, 0xBB, 0xBE, 0xAC, 0xCE, 0xCF, + 0xC5, 0x00, 0x5D, 0x00, 0x5E, 0x00, 0x82 }, + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x70, 0x51, 0x3E, 0xBF, + 0xC1, 0xAF, 0xB9, 0xBC, 0xAB, 0xCC, 0xCC, + 0xC2, 0x00, 0x65, 0x00, 0x67, 0x00, 0x8D }, + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x6C, 0x54, 0x3A, 0xBC, + 0xBF, 0xAC, 0xB7, 0xBB, 0xA9, 0xC9, 0xC9, + 0xBE, 0x00, 0x71, 0x00, 0x73, 0x00, 0x9E }, + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x69, 0x54, 0x37, 0xBB, + 0xBE, 0xAC, 0xB4, 0xB7, 0xA6, 0xC7, 0xC8, + 0xBC, 0x00, 0x7B, 0x00, 0x7E, 0x00, 0xAB }, + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x66, 0x55, 0x34, 0xBA, + 0xBD, 0xAB, 0xB1, 0xB5, 0xA3, 0xC5, 0xC6, + 0xB9, 0x00, 0x85, 0x00, 0x88, 0x00, 0xBA }, + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x63, 0x53, 0x31, 0xB8, + 0xBC, 0xA9, 0xB0, 0xB5, 0xA2, 0xC4, 0xC4, + 0xB8, 0x00, 0x8B, 0x00, 0x8E, 0x00, 0xC2 }, + { MCS_GAMMA_CTRL, 0x00, + 0x18, 0x08, 0x24, 0x62, 0x54, 0x30, 0xB9, + 0xBB, 0xA9, 0xB0, 0xB3, 0xA1, 0xC1, 0x
[PATCH 1/2] drm: panel: Add Samsung s6e63m0 panel documentation
From: Jonathan Bakker This commit adds documentation for Samsung s6e63m0 AMOLED LCD panel driver. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- .../display/panel/samsung,s6e63m0.txt | 60 +++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt diff --git a/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt b/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt new file mode 100644 index ..4979200e2dd2 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.txt @@ -0,0 +1,60 @@ +Samsung s6e63m0 AMOLED LCD panel + +Required properties: + - compatible: "samsung,s6e63m0" + - reset-gpio: GPIO spec for reset pin + - vdd3-supply: VDD regulator + - vci-supply: VCI regulator + - display-timings: timings for the connected panel as described by [1] + +Optional properties: + - reset-delay: Delay in ms after adjusting reset-gpio, default 120ms + - power-on-delay: Delay in ms after powering on, default 25ms + - power-off-delay: Delay in ms before powering off, default 200ms + - panel-width-mm: physical panel width in mm + - panel-height-mm: physical panel height in mm + +The device node can contain one 'port' child node with one child +'endpoint' node, according to the bindings defined in [2]. This +node should describe panel's video bus. + +[1]: Documentation/devicetree/bindings/display/panel/display-timing.txt +[2]: Documentation/devicetree/bindings/media/video-interfaces.txt + +Example: + + s6e63m0: display@0 { + compatible = "samsung,s6e63m0"; + reg = <0>; + reset-gpio = < 5 1>; + vdd3-supply = <_reg>; + vci-supply = <_reg>; + spi-max-frequency = <100>; + + power-on-delay = <0>; + power-off-delay = <0>; + reset-delay = <10>; + panel-width-mm = <53>; + panel-height-mm = <89>; + + display-timings { + timing-0 { + /* 480x800@60Hz */ + clock-frequency = <25628040>; + hactive = <480>; + vactive = <800>; + hfront-porch = <16>; + hback-porch = <16>; + hsync-len = <2>; + vfront-porch = <28>; + vback-porch = <1>; + vsync-len = <2>; + }; + }; + + port { + lcd_ep: endpoint { + remote-endpoint = <_ep>; + }; + }; + }; -- 2.17.1
[PATCH v2 2/2] input: misc: pwm-vibra: Stop regulator after disabling pwm, not before
This patch fixes order of disable calls in pwm_vibrator_stop. Currently when starting device, we first enable vcc regulator and then setup and enable pwm. When stopping, we should do this in oposite order, so first disable pwm and then disable regulator. Previously order was the same as in start. Signed-off-by: Paweł Chmiel --- drivers/input/misc/pwm-vibra.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c index 9df87431d7d4..dbb6d9e1b947 100644 --- a/drivers/input/misc/pwm-vibra.c +++ b/drivers/input/misc/pwm-vibra.c @@ -80,14 +80,14 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator) static void pwm_vibrator_stop(struct pwm_vibrator *vibrator) { + if (vibrator->pwm_dir) + pwm_disable(vibrator->pwm_dir); + pwm_disable(vibrator->pwm); + if (vibrator->vcc_on) { regulator_disable(vibrator->vcc); vibrator->vcc_on = false; } - - if (vibrator->pwm_dir) - pwm_disable(vibrator->pwm_dir); - pwm_disable(vibrator->pwm); } static void pwm_vibrator_play_work(struct work_struct *work) -- 2.17.1
[PATCH v2 1/2] input: misc: pwm-vibra: Prevent unbalanced regulator
From: Jonathan Bakker pwm_vibrator_stop disables the regulator, but it can be called from multiple places, even when the regulator is already disabled. Fix this by using regulator_is_enabled check when starting and stopping device. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- Changes from v1: - Rather than using regulator_is_enabled api, use local flag for checking if regulator is enabled --- drivers/input/misc/pwm-vibra.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c index 55da191ae550..9df87431d7d4 100644 --- a/drivers/input/misc/pwm-vibra.c +++ b/drivers/input/misc/pwm-vibra.c @@ -34,6 +34,7 @@ struct pwm_vibrator { struct work_struct play_work; u16 level; u32 direction_duty_cycle; + bool vcc_on; }; static int pwm_vibrator_start(struct pwm_vibrator *vibrator) @@ -42,10 +43,13 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator) struct pwm_state state; int err; - err = regulator_enable(vibrator->vcc); - if (err) { - dev_err(pdev, "failed to enable regulator: %d", err); - return err; + if (!vibrator->vcc_on) { + err = regulator_enable(vibrator->vcc); + if (err) { + dev_err(pdev, "failed to enable regulator: %d", err); + return err; + } + vibrator->vcc_on = true; } pwm_get_state(vibrator->pwm, ); @@ -76,7 +80,10 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator) static void pwm_vibrator_stop(struct pwm_vibrator *vibrator) { - regulator_disable(vibrator->vcc); + if (vibrator->vcc_on) { + regulator_disable(vibrator->vcc); + vibrator->vcc_on = false; + } if (vibrator->pwm_dir) pwm_disable(vibrator->pwm_dir); -- 2.17.1
Re: [PATCH] input: misc: pwm-vibra: Prevent unbalanced regulator
czw., 17 sty 2019 o 08:08 Dmitry Torokhov napisał(a): > > Hi Paweł, > > On Wed, Jan 16, 2019 at 10:11:31PM +0100, Paweł Chmiel wrote: > > From: Jonathan Bakker > > > > pwm_vibrator_stop disables the regulator, but it can be called from > > multiple places, even when the regulator is already disabled. Fix this > > by using regulator_is_enabled check when starting and stopping device. > > > > Signed-off-by: Jonathan Bakker > > Signed-off-by: Paweł Chmiel > > --- > > drivers/input/misc/pwm-vibra.c | 13 - > > 1 file changed, 8 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c > > index 55da191ae550..66677ee770ca 100644 > > --- a/drivers/input/misc/pwm-vibra.c > > +++ b/drivers/input/misc/pwm-vibra.c > > @@ -42,10 +42,12 @@ static int pwm_vibrator_start(struct pwm_vibrator > > *vibrator) > > struct pwm_state state; > > int err; > > > > - err = regulator_enable(vibrator->vcc); > > - if (err) { > > - dev_err(pdev, "failed to enable regulator: %d", err); > > - return err; > > + if (!regulator_is_enabled(vibrator->vcc)) { > > I do not think this is correct in case of shared supply, as this checks > global state of regulator. That means that if there is another user, we > may forego enabling regulator here, and that anther user may power it > down and vibrator will stop working. > > I think you need a local flag here. Ok will fix this (funny that in first version of patch there was such flag). > > > + err = regulator_enable(vibrator->vcc); > > + if (err) { > > + dev_err(pdev, "failed to enable regulator: %d", err); > > + return err; > > + } > > } > > > > pwm_get_state(vibrator->pwm, ); > > @@ -76,7 +78,8 @@ static int pwm_vibrator_start(struct pwm_vibrator > > *vibrator) > > > > static void pwm_vibrator_stop(struct pwm_vibrator *vibrator) > > { > > - regulator_disable(vibrator->vcc); > > + if (regulator_is_enabled(vibrator->vcc)) > > + regulator_disable(vibrator->vcc); > > Looking at this, I wonder if we should not disable PWMs first and the > disable regulator. I will create and send separate patch for this. Thanks for review > > > > > if (vibrator->pwm_dir) > > pwm_disable(vibrator->pwm_dir); > > -- > > 2.17.1 > > > > Thanks. > > -- > Dmitry
[PATCH] input: misc: pwm-vibra: Prevent unbalanced regulator
From: Jonathan Bakker pwm_vibrator_stop disables the regulator, but it can be called from multiple places, even when the regulator is already disabled. Fix this by using regulator_is_enabled check when starting and stopping device. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/misc/pwm-vibra.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c index 55da191ae550..66677ee770ca 100644 --- a/drivers/input/misc/pwm-vibra.c +++ b/drivers/input/misc/pwm-vibra.c @@ -42,10 +42,12 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator) struct pwm_state state; int err; - err = regulator_enable(vibrator->vcc); - if (err) { - dev_err(pdev, "failed to enable regulator: %d", err); - return err; + if (!regulator_is_enabled(vibrator->vcc)) { + err = regulator_enable(vibrator->vcc); + if (err) { + dev_err(pdev, "failed to enable regulator: %d", err); + return err; + } } pwm_get_state(vibrator->pwm, ); @@ -76,7 +78,8 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator) static void pwm_vibrator_stop(struct pwm_vibrator *vibrator) { - regulator_disable(vibrator->vcc); + if (regulator_is_enabled(vibrator->vcc)) + regulator_disable(vibrator->vcc); if (vibrator->pwm_dir) pwm_disable(vibrator->pwm_dir); -- 2.17.1
[PATCH v4] cpufreq: s5pv210: Defer probe if getting regulators fail
There is possibility, that when probing driver, regulators are not yet initialized. In this case we should return EPROBE_DEFER and wait till they're initialized, since they're required currently for cpufreq driver to work. Also move regulator initialization code at beginning of probe, so we can defer as fast as posibble. Signed-off-by: Paweł Chmiel --- Changes from v3: - Zero dmc_base pointers after unmapping them - If getting vddarm regulator fails just return, no need to do goto jump which would do the same Changes from v2: - Handle all error paths in probe Changes from v1: - Fix compilation error - Reorganize code so it's smaller --- drivers/cpufreq/s5pv210-cpufreq.c | 67 ++- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index f51697f1e0b3..c7b7d1e65b08 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c @@ -584,7 +584,7 @@ static struct notifier_block s5pv210_cpufreq_reboot_notifier = { static int s5pv210_cpufreq_probe(struct platform_device *pdev) { struct device_node *np; - int id; + int id, result = 0; /* * HACK: This is a temporary workaround to get access to clock @@ -594,18 +594,39 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) * this whole driver as soon as S5PV210 gets migrated to use * cpufreq-dt driver. */ + arm_regulator = regulator_get(NULL, "vddarm"); + if (IS_ERR(arm_regulator)) { + if (PTR_ERR(arm_regulator) == -EPROBE_DEFER) + pr_debug("vddarm regulator not ready, defer\n"); + else + pr_err("failed to get regulator vddarm\n"); + return PTR_ERR(arm_regulator); + } + + int_regulator = regulator_get(NULL, "vddint"); + if (IS_ERR(int_regulator)) { + if (PTR_ERR(int_regulator) == -EPROBE_DEFER) + pr_debug("vddint regulator not ready, defer\n"); + else + pr_err("failed to get regulator vddint\n"); + result = PTR_ERR(int_regulator); + goto err_int_regulator; + } + np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-clock"); if (!np) { pr_err("%s: failed to find clock controller DT node\n", __func__); - return -ENODEV; + result = -ENODEV; + goto err_clock; } clk_base = of_iomap(np, 0); of_node_put(np); if (!clk_base) { pr_err("%s: failed to map clock registers\n", __func__); - return -EFAULT; + result = -EFAULT; + goto err_clock; } for_each_compatible_node(np, NULL, "samsung,s5pv210-dmc") { @@ -614,7 +635,8 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) pr_err("%s: failed to get alias of dmc node '%pOFn'\n", __func__, np); of_node_put(np); - return id; + result = id; + goto err_clk_base; } dmc_base[id] = of_iomap(np, 0); @@ -622,33 +644,40 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) pr_err("%s: failed to map dmc%d registers\n", __func__, id); of_node_put(np); - return -EFAULT; + result = -EFAULT; + goto err_dmc; } } for (id = 0; id < ARRAY_SIZE(dmc_base); ++id) { if (!dmc_base[id]) { pr_err("%s: failed to find dmc%d node\n", __func__, id); - return -ENODEV; + result = -ENODEV; + goto err_dmc; } } - arm_regulator = regulator_get(NULL, "vddarm"); - if (IS_ERR(arm_regulator)) { - pr_err("failed to get regulator vddarm\n"); - return PTR_ERR(arm_regulator); - } - - int_regulator = regulator_get(NULL, "vddint"); - if (IS_ERR(int_regulator)) { - pr_err("failed to get regulator vddint\n"); - regulator_put(arm_regulator); - return PTR_ERR(int_regulator); - } - register_reboot_notifier(_cpufreq_reboot_notifier); return cpufreq_register_driver(_driver); + +err_dmc: + for (id = 0; id < ARRAY_SIZE(dmc_base); ++id) + if (dmc_base[id]) { + iou
Re: [PATCH v3] cpufreq: s5pv210: Defer probe if getting regulators fail
On niedziela, 13 stycznia 2019 14:16:24 CET Krzysztof Kozlowski wrote: > On Fri, Jan 11, 2019 at 08:42:44PM +0100, Paweł Chmiel wrote: > > There is possibility, that when probing driver, regulators are not yet > > initialized. In this case we should return EPROBE_DEFER and wait till > > they're initialized, since they're required currently for cpufreq driver > > to work. Also move regulator initialization code at beginning of probe, > > so we can defer as fast as posibble. > > > > Signed-off-by: Paweł Chmiel > > --- > > Changes from v2: > > - Handle all error paths in probe > > > > Changes from v1: > > - Fix compilation error > > - Reorganize code so it's smaller > > --- > > drivers/cpufreq/s5pv210-cpufreq.c | 68 ++- > > 1 file changed, 49 insertions(+), 19 deletions(-) > > > > diff --git a/drivers/cpufreq/s5pv210-cpufreq.c > > b/drivers/cpufreq/s5pv210-cpufreq.c > > index f51697f1e0b3..627b132e3e61 100644 > > --- a/drivers/cpufreq/s5pv210-cpufreq.c > > +++ b/drivers/cpufreq/s5pv210-cpufreq.c > > @@ -584,7 +584,7 @@ static struct notifier_block > > s5pv210_cpufreq_reboot_notifier = { > > static int s5pv210_cpufreq_probe(struct platform_device *pdev) > > { > > struct device_node *np; > > - int id; > > + int id, result = 0; > > > > /* > > * HACK: This is a temporary workaround to get access to clock > > @@ -594,18 +594,40 @@ static int s5pv210_cpufreq_probe(struct > > platform_device *pdev) > > * this whole driver as soon as S5PV210 gets migrated to use > > * cpufreq-dt driver. > > */ > > + arm_regulator = regulator_get(NULL, "vddarm"); > > + if (IS_ERR(arm_regulator)) { > > + if (PTR_ERR(arm_regulator) == -EPROBE_DEFER) > > + pr_debug("vddarm regulator not ready, defer\n"); > > + else > > + pr_err("failed to get regulator vddarm\n"); > > + result = PTR_ERR(arm_regulator); > > + goto err_arm_regulator; > > Just return here. Fixed. > > > + } > > + > > + int_regulator = regulator_get(NULL, "vddint"); > > + if (IS_ERR(int_regulator)) { > > + if (PTR_ERR(int_regulator) == -EPROBE_DEFER) > > + pr_debug("vddint regulator not ready, defer\n"); > > + else > > + pr_err("failed to get regulator vddint\n"); > > + result = PTR_ERR(int_regulator); > > + goto err_int_regulator; > > + } > > + > > np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-clock"); > > if (!np) { > > pr_err("%s: failed to find clock controller DT node\n", > > __func__); > > - return -ENODEV; > > + result = -ENODEV; > > + goto err_clock; > > } > > > > clk_base = of_iomap(np, 0); > > of_node_put(np); > > if (!clk_base) { > > pr_err("%s: failed to map clock registers\n", __func__); > > - return -EFAULT; > > + result = -EFAULT; > > + goto err_clock; > > } > > > > for_each_compatible_node(np, NULL, "samsung,s5pv210-dmc") { > > @@ -614,7 +636,8 @@ static int s5pv210_cpufreq_probe(struct platform_device > > *pdev) > > pr_err("%s: failed to get alias of dmc node '%pOFn'\n", > > __func__, np); > > of_node_put(np); > > - return id; > > + result = id; > > + goto err_clk_base; > > } > > > > dmc_base[id] = of_iomap(np, 0); > > @@ -622,33 +645,40 @@ static int s5pv210_cpufreq_probe(struct > > platform_device *pdev) > > pr_err("%s: failed to map dmc%d registers\n", > > __func__, id); > > of_node_put(np); > > - return -EFAULT; > > + result = -EFAULT; > > + goto err_dmc; > > } > > } > > > > for (id = 0; id < ARRAY_SIZE(dmc_base); ++id) { > > if (!dmc_base[id]) { > > pr_err("%s: failed to find dmc%d node\n", __func__, id); > > - return -ENODEV; > > + result = -ENODEV;
[PATCH v3] cpufreq: s5pv210: Defer probe if getting regulators fail
There is possibility, that when probing driver, regulators are not yet initialized. In this case we should return EPROBE_DEFER and wait till they're initialized, since they're required currently for cpufreq driver to work. Also move regulator initialization code at beginning of probe, so we can defer as fast as posibble. Signed-off-by: Paweł Chmiel --- Changes from v2: - Handle all error paths in probe Changes from v1: - Fix compilation error - Reorganize code so it's smaller --- drivers/cpufreq/s5pv210-cpufreq.c | 68 ++- 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index f51697f1e0b3..627b132e3e61 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c @@ -584,7 +584,7 @@ static struct notifier_block s5pv210_cpufreq_reboot_notifier = { static int s5pv210_cpufreq_probe(struct platform_device *pdev) { struct device_node *np; - int id; + int id, result = 0; /* * HACK: This is a temporary workaround to get access to clock @@ -594,18 +594,40 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) * this whole driver as soon as S5PV210 gets migrated to use * cpufreq-dt driver. */ + arm_regulator = regulator_get(NULL, "vddarm"); + if (IS_ERR(arm_regulator)) { + if (PTR_ERR(arm_regulator) == -EPROBE_DEFER) + pr_debug("vddarm regulator not ready, defer\n"); + else + pr_err("failed to get regulator vddarm\n"); + result = PTR_ERR(arm_regulator); + goto err_arm_regulator; + } + + int_regulator = regulator_get(NULL, "vddint"); + if (IS_ERR(int_regulator)) { + if (PTR_ERR(int_regulator) == -EPROBE_DEFER) + pr_debug("vddint regulator not ready, defer\n"); + else + pr_err("failed to get regulator vddint\n"); + result = PTR_ERR(int_regulator); + goto err_int_regulator; + } + np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-clock"); if (!np) { pr_err("%s: failed to find clock controller DT node\n", __func__); - return -ENODEV; + result = -ENODEV; + goto err_clock; } clk_base = of_iomap(np, 0); of_node_put(np); if (!clk_base) { pr_err("%s: failed to map clock registers\n", __func__); - return -EFAULT; + result = -EFAULT; + goto err_clock; } for_each_compatible_node(np, NULL, "samsung,s5pv210-dmc") { @@ -614,7 +636,8 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) pr_err("%s: failed to get alias of dmc node '%pOFn'\n", __func__, np); of_node_put(np); - return id; + result = id; + goto err_clk_base; } dmc_base[id] = of_iomap(np, 0); @@ -622,33 +645,40 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) pr_err("%s: failed to map dmc%d registers\n", __func__, id); of_node_put(np); - return -EFAULT; + result = -EFAULT; + goto err_dmc; } } for (id = 0; id < ARRAY_SIZE(dmc_base); ++id) { if (!dmc_base[id]) { pr_err("%s: failed to find dmc%d node\n", __func__, id); - return -ENODEV; + result = -ENODEV; + goto err_dmc; } } - arm_regulator = regulator_get(NULL, "vddarm"); - if (IS_ERR(arm_regulator)) { - pr_err("failed to get regulator vddarm\n"); - return PTR_ERR(arm_regulator); - } - - int_regulator = regulator_get(NULL, "vddint"); - if (IS_ERR(int_regulator)) { - pr_err("failed to get regulator vddint\n"); - regulator_put(arm_regulator); - return PTR_ERR(int_regulator); - } - register_reboot_notifier(_cpufreq_reboot_notifier); return cpufreq_register_driver(_driver); + +err_dmc: + for (id = 0; id < ARRAY_SIZE(dmc_base); ++id) + if (dmc_base[id]) + iounmap(dmc_base[id]); + +err_clk_base: + iounmap(clk_base); + +err_clock: + regulator_put(int_regulator); + +err_int_regulator: + regulator_put(arm_regulator); + +err_arm_regulator: + + return result; } static struct platform_driver s5pv210_cpufreq_platdrv = { -- 2.17.1
Re: [PATCH v2 3/4] cpufreq: s5pv210: Defer probe if getting regulators fail
pt., 11 sty 2019 o 10:46 Krzysztof Kozlowski napisał(a): > > On Thu, 10 Jan 2019 at 21:53, Paweł Chmiel > wrote: > > > > There is possibility, that when probing driver, regulators are not yet > > initialized. In this case we should return EPROBE_DEFER and wait till > > they're initialized, since they're required currently for cpufreq driver > > to work. Also move regulator initialization code at beginning of probe, > > so we can defer as fast as posibble. > > > > Signed-off-by: Paweł Chmiel > > --- > > Changes from v1: > > - Fix compilation error > > - Reorganize code so it's smaller > > --- > > drivers/cpufreq/s5pv210-cpufreq.c | 32 ++- > > 1 file changed, 19 insertions(+), 13 deletions(-) > > > > diff --git a/drivers/cpufreq/s5pv210-cpufreq.c > > b/drivers/cpufreq/s5pv210-cpufreq.c > > index f51697f1e0b3..6df95941ba96 100644 > > --- a/drivers/cpufreq/s5pv210-cpufreq.c > > +++ b/drivers/cpufreq/s5pv210-cpufreq.c > > @@ -594,6 +594,25 @@ static int s5pv210_cpufreq_probe(struct > > platform_device *pdev) > > * this whole driver as soon as S5PV210 gets migrated to use > > * cpufreq-dt driver. > > */ > > + arm_regulator = regulator_get(NULL, "vddarm"); > > + if (IS_ERR(arm_regulator)) { > > + if (PTR_ERR(arm_regulator) == -EPROBE_DEFER) > > + pr_debug("vddarm regulator not ready, defer\n"); > > + else > > + pr_err("failed to get regulator vddarm\n"); > > + return PTR_ERR(arm_regulator); > > + } > > + > > + int_regulator = regulator_get(NULL, "vddint"); > > + if (IS_ERR(int_regulator)) { > > + if (PTR_ERR(int_regulator) == -EPROBE_DEFER) > > + pr_debug("vddint regulator not ready, defer\n"); > > + else > > + pr_err("failed to get regulator vddint\n"); > > + regulator_put(arm_regulator); > > + return PTR_ERR(int_regulator); > > + } > > + > > Error paths are now not correct. You should put the regulators when > returning later. The previous code had these error paths wrong as well > - not iounmapping - but if you move things around, maybe let's fix > things. Ok, will fix this in new version and will resend it (only this one patch, since all other looks ok/applied). Also will add missing iounmapping/etc to fix all other error paths. Thanks > > Best regards, > Krzysztof
[PATCH v2 0/4] ARM: dts: s5pv210: Enable cpufreq support
This patchset enables cpufreq support using s5pv210-cpufreq driver. First patch adds missing dmc nodes, which are required by driver. Second patch is cosmetic, it stops driver from flooding kernel log with messages, after every change of freq. Third patch adds defer probe support for regulators, needed by driver. It was observed, that those regulators can be no yet initialized, when driver is probed, so we should wait till we can get them. Last patch enables required kernel config options. Changes from v1: - Added Acked-by to one of patches - Fix compilation error after changes in driver - Reorganize code (so it's smaller), inside patch which logs information about defered probe of regulators Paweł Chmiel (4): ARM: dts: s5pv210: Add dmc nodes cpufreq: s5pv210: Don't flood kernel log after cpufreq change cpufreq: s5pv210: Defer probe if getting regulators fail ARM: defconfig: s5pv210: Add cpufreq support arch/arm/boot/dts/s5pv210.dtsi | 12 +++ arch/arm/configs/s5pv210_defconfig | 6 ++ drivers/cpufreq/s5pv210-cpufreq.c | 34 ++ 3 files changed, 38 insertions(+), 14 deletions(-) -- 2.17.1
[PATCH v2 2/4] cpufreq: s5pv210: Don't flood kernel log after cpufreq change
This commit replaces printk with pr_debug, so we don't flood kernel log. Signed-off-by: Paweł Chmiel Acked-by: Krzysztof Kozlowski --- Changes from v1: - Added Acked-by --- drivers/cpufreq/s5pv210-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index dbecd7667db2..f51697f1e0b3 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c @@ -481,7 +481,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index) arm_volt, arm_volt_max); } - printk(KERN_DEBUG "Perf changed[L%d]\n", index); + pr_debug("Perf changed[L%d]\n", index); exit: mutex_unlock(_freq_lock); -- 2.17.1
[PATCH v2 1/4] ARM: dts: s5pv210: Add dmc nodes
This commit adds dmc nodes, which are needed by s5pv210 cpufreq driver to work. Signed-off-by: Paweł Chmiel --- arch/arm/boot/dts/s5pv210.dtsi | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi index e9613418228d..2d55a3a6e79e 100644 --- a/arch/arm/boot/dts/s5pv210.dtsi +++ b/arch/arm/boot/dts/s5pv210.dtsi @@ -25,6 +25,8 @@ aliases { csis0 = + dmc0 = + dmc1 = fimc0 = fimc1 = fimc2 = @@ -521,6 +523,16 @@ status = "disabled"; }; + dmc0: dmc@f000 { + compatible = "samsung,s5pv210-dmc"; + reg = <0xf000 0x1000>; + }; + + dmc1: dmc@f140 { + compatible = "samsung,s5pv210-dmc"; + reg = <0xf140 0x1000>; + }; + g2d: g2d@fa00 { compatible = "samsung,s5pv210-g2d"; reg = <0xfa00 0x1000>; -- 2.17.1
[PATCH v2 3/4] cpufreq: s5pv210: Defer probe if getting regulators fail
There is possibility, that when probing driver, regulators are not yet initialized. In this case we should return EPROBE_DEFER and wait till they're initialized, since they're required currently for cpufreq driver to work. Also move regulator initialization code at beginning of probe, so we can defer as fast as posibble. Signed-off-by: Paweł Chmiel --- Changes from v1: - Fix compilation error - Reorganize code so it's smaller --- drivers/cpufreq/s5pv210-cpufreq.c | 32 ++- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index f51697f1e0b3..6df95941ba96 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c @@ -594,6 +594,25 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) * this whole driver as soon as S5PV210 gets migrated to use * cpufreq-dt driver. */ + arm_regulator = regulator_get(NULL, "vddarm"); + if (IS_ERR(arm_regulator)) { + if (PTR_ERR(arm_regulator) == -EPROBE_DEFER) + pr_debug("vddarm regulator not ready, defer\n"); + else + pr_err("failed to get regulator vddarm\n"); + return PTR_ERR(arm_regulator); + } + + int_regulator = regulator_get(NULL, "vddint"); + if (IS_ERR(int_regulator)) { + if (PTR_ERR(int_regulator) == -EPROBE_DEFER) + pr_debug("vddint regulator not ready, defer\n"); + else + pr_err("failed to get regulator vddint\n"); + regulator_put(arm_regulator); + return PTR_ERR(int_regulator); + } + np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-clock"); if (!np) { pr_err("%s: failed to find clock controller DT node\n", @@ -633,19 +652,6 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) } } - arm_regulator = regulator_get(NULL, "vddarm"); - if (IS_ERR(arm_regulator)) { - pr_err("failed to get regulator vddarm\n"); - return PTR_ERR(arm_regulator); - } - - int_regulator = regulator_get(NULL, "vddint"); - if (IS_ERR(int_regulator)) { - pr_err("failed to get regulator vddint\n"); - regulator_put(arm_regulator); - return PTR_ERR(int_regulator); - } - register_reboot_notifier(_cpufreq_reboot_notifier); return cpufreq_register_driver(_driver); -- 2.17.1
[PATCH v2 4/4] ARM: defconfig: s5pv210: Add cpufreq support
This commit enables cpufreq support for all s5pv210 devices. Signed-off-by: Paweł Chmiel --- arch/arm/configs/s5pv210_defconfig | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/configs/s5pv210_defconfig b/arch/arm/configs/s5pv210_defconfig index 951196bdf008..fd4f28aabda6 100644 --- a/arch/arm/configs/s5pv210_defconfig +++ b/arch/arm/configs/s5pv210_defconfig @@ -11,6 +11,12 @@ CONFIG_ARCH_S5PV210=y CONFIG_VMSPLIT_2G=y CONFIG_ARM_APPENDED_DTB=y CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x2080,8M console=ttySAC1,115200 init=/linuxrc" +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_STAT=y +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=m +CONFIG_CPU_FREQ_GOV_USERSPACE=m +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m CONFIG_VFP=y CONFIG_NEON=y CONFIG_MODULES=y -- 2.17.1
Re: [PATCH 4/4] dt-bindings: mfd: max8998: Add charger subnode binding
Hi On Thursday, 10 January 2019 18:47:11 CET Sylwester Nawrocki wrote: > Hi, > > On 5/1/18 16:43, Paweł Chmiel wrote: > > On Tuesday, May 1, 2018 2:45:40 PM CEST Sebastian Reichel wrote: > >> On Fri, Apr 27, 2018 at 06:03:02PM +0200, Paweł Chmiel wrote: > >>> This patch adds devicetree bindings documentation for > >>> battery charging controller as the subnode of MAX8998 PMIC. > >>> It's based on current behavior of driver. > >>> > >>> Fixes: ee999fb3f17f ("mfd: max8998: Add support for Device Tree") > >>> Signed-off-by: Paweł Chmiel > >>> --- > >>> Documentation/devicetree/bindings/mfd/max8998.txt | 22 > >>> ++ > >>> 1 file changed, 22 insertions(+) > > >>> --- a/Documentation/devicetree/bindings/mfd/max8998.txt > >>> +++ b/Documentation/devicetree/bindings/mfd/max8998.txt > >>> @@ -50,6 +50,21 @@ Additional properties required if > >>> max8998,pmic-buck2-dvs-gpio is defined: > >>> - max8998,pmic-buck2-dvs-voltage: An array of 2 voltage values in > >>> microvolts > >>>for buck2 regulator that can be selected using dvs gpio. > >>> > >>> +Charger: Configuration for battery charging controller should be added > >>> +inside a child node named 'charger'. > >>> + Required properties: > >>> + - max8998,charge-eoc: Setup "End of Charge". If value equals 0, > >>> +remain value set from bootloader or default value will be used. > >>> +Valid values: 0, 10 - 45 > >>> + > >>> + - max8998,charge-restart: Setup "Charge Restart Level". If value > >>> equals 0, > >>> +remain value set from bootloader or default value will be used. > >>> +Valid values: -1, 0, 100, 150, 200 > > Perhaps change the property name to max8998,charge-restart-threshold, > in include/linux/mfd/max8998.h we have: > > * @restart: Restart Level in mV: 100, 150, 200, and -1 for disable. > * If it equals 0, leave it unchanged. > > Then we could make it an optional property: > > - max8998,charge-restart-threshold: Charge restart threshold in millivolts. >Valid values are: 0, 100, 150, 200. If the value equals 0 the charger >restart will be disabled. > > If the property is missing the charger restart threshold configuration would > be left unchanged. > Strange, i've looked at max8998 and didn't saw information that those values are in mV (maybe it was from vendor sources). > >>> + - max8998,charge-timeout: Setup "Charge Full Timeout". If value equals > >>> 0, > >>> +remain value set from bootloader or default value will be used. > >>> +Valid values: -1, 0, 5, 6, 7 > >> > >> What are those values? seconds? > >> > > Honestly i don't know. I've just documented values accepted currently > > by charger driver, so we can use it from devicetree. > > I couldn't find any max8998 datasheet with this information (units, > > possible > > values etc for those properties). > > The charge timeout is in hours, as described in include/linux/mfd/max8998.h: > > > "* @timeout: Full Timeout in hours: 5, 6, 7, and -1 for disable. > * If it equals 0, leave it unchanged. > * Otherwise, leave it unchanged." > > We could change description of the property to something along the lines of: > > Optional properties: > > - max8998,charge-timeout: Charge timeout in hours. Valid values are: > 0, 5, 6, 7. If the value is 0 the charge timer will be disabled. > > Then if the property is missing the driver will leave charge timer > configuration > unchanged. > > Thanks Sylwester Nawrocki for all those hints (mostly regarding units of those magic numbers/values). I'll prepare new version of those patches with all hints included.
Re: [PATCH 3/4] cpufreq: s5pv210: Defer probe if getting regulators fail
czw., 10 sty 2019 o 08:01 Viresh Kumar napisał(a): > > On 08-01-19, 21:05, Paweł Chmiel wrote: > > There is possibility, that when probing driver, regulators are not yet > > initialized. In this case we should return EPROBE_DEFER and wait till > > they're initialized, since they're required currently for cpufreq driver > > to work. Also move regulator initialization code at beginning of probe, > > so we can defer as fast as posibble. > > > > Signed-off-by: Paweł Chmiel > > --- > > drivers/cpufreq/s5pv210-cpufreq.c | 33 +++ > > 1 file changed, 20 insertions(+), 13 deletions(-) > > > > diff --git a/drivers/cpufreq/s5pv210-cpufreq.c > > b/drivers/cpufreq/s5pv210-cpufreq.c > > index f51697f1e0b3..2d0e4dc7ede7 100644 > > --- a/drivers/cpufreq/s5pv210-cpufreq.c > > +++ b/drivers/cpufreq/s5pv210-cpufreq.c > > @@ -594,6 +594,26 @@ static int s5pv210_cpufreq_probe(struct > > platform_device *pdev) > >* this whole driver as soon as S5PV210 gets migrated to use > >* cpufreq-dt driver. > >*/ > > + arm_regulator = regulator_get(NULL, "vddarm"); > > + if (PTR_ERR(arm_regulator) == -EPROBE_DEFER) { > > + pr_dbg("vddarm regulator not ready, defer\n"); > > + return -EPROBE_DEFER; > > + } else if (IS_ERR(arm_regulator)) { > > + pr_err("failed to get regulator vddarm\n"); > > + return PTR_ERR(arm_regulator); > > + } > > The only difference between the two cases is pr_dbg vs pr_err, its > ugly that we have to add special code for that :( > > Maybe write it as: > > if (IS_ERR(arm_regulator)) { > if (PTR_ERR(arm_regulator) == -EPROBE_DEFER) > pr_dbg... > else > pr_err > return PTR_ERR(arm_regulator); > } > > > + > > + int_regulator = regulator_get(NULL, "vddint"); > > + if (PTR_ERR(int_regulator == -EPROBE_DEFER) { > > Does this even compile ? Looks like i broke it after testing (where it was working fine - was able to change freq and gov), and didn't catch this before sending patch for review :/. Sorry, this (and first issue) will be fixed in v2. Thanks for review > > > + regulator_put(arm_regulator); > > + pr_dbg("vddint regulator not ready, defer\n"); > > + return -EPROBE_DEFER; > > + } else if (IS_ERR(int_regulator)) { > > + regulator_put(arm_regulator); > > + pr_err("failed to get regulator vddint\n"); > > + return PTR_ERR(int_regulator); > > + } > > + > > np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-clock"); > > if (!np) { > > pr_err("%s: failed to find clock controller DT node\n", > > @@ -633,19 +653,6 @@ static int s5pv210_cpufreq_probe(struct > > platform_device *pdev) > > } > > } > > > > - arm_regulator = regulator_get(NULL, "vddarm"); > > - if (IS_ERR(arm_regulator)) { > > - pr_err("failed to get regulator vddarm\n"); > > - return PTR_ERR(arm_regulator); > > - } > > - > > - int_regulator = regulator_get(NULL, "vddint"); > > - if (IS_ERR(int_regulator)) { > > - pr_err("failed to get regulator vddint\n"); > > - regulator_put(arm_regulator); > > - return PTR_ERR(int_regulator); > > - } > > - > > register_reboot_notifier(_cpufreq_reboot_notifier); > > > > return cpufreq_register_driver(_driver); > > -- > > 2.17.1 > > -- > viresh
Re: [PATCH 4/4] ARM: defconfig: s5pv210: Add cpufreq support
czw., 10 sty 2019 o 08:02 Viresh Kumar napisał(a): > > On 08-01-19, 21:05, Paweł Chmiel wrote: > > This commit enables cpufreq support for all s5pv210 devices. > > > > Signed-off-by: Paweł Chmiel > > --- > > arch/arm/configs/s5pv210_defconfig | 6 ++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/arch/arm/configs/s5pv210_defconfig > > b/arch/arm/configs/s5pv210_defconfig > > index 951196bdf008..fd4f28aabda6 100644 > > --- a/arch/arm/configs/s5pv210_defconfig > > +++ b/arch/arm/configs/s5pv210_defconfig > > @@ -11,6 +11,12 @@ CONFIG_ARCH_S5PV210=y > > CONFIG_VMSPLIT_2G=y > > CONFIG_ARM_APPENDED_DTB=y > > CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x2080,8M > > console=ttySAC1,115200 init=/linuxrc" > > +CONFIG_CPU_FREQ=y > > +CONFIG_CPU_FREQ_STAT=y > > +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y > > +CONFIG_CPU_FREQ_GOV_POWERSAVE=m > > +CONFIG_CPU_FREQ_GOV_USERSPACE=m > > +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m > > You don't want to use schedutil ? That is the default governor for > everyone now a days. schedutil depends on SMP, which is not enabled on s5pv210 (it has only one cpu core). > > -- > viresh
[PATCH] media: s5p-jpeg: Correct step and max values for V4L2_CID_JPEG_RESTART_INTERVAL
This commit corrects max and step values for v4l2 control for V4L2_CID_JPEG_RESTART_INTERVAL. Max should be 0x and step should be 1. It was found by using v4l2-compliance tool and checking result of VIDIOC_QUERY_EXT_CTRL/QUERYMENU test. Previously it was complaining that step was bigger than difference between max and min. Fixes: 15f4bc3b1f42 ("[media] s5p-jpeg: Add JPEG controls support") Signed-off-by: Paweł Chmiel --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 3f9000b70385..33e9927db9a0 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -2002,7 +2002,7 @@ static int s5p_jpeg_controls_create(struct s5p_jpeg_ctx *ctx) v4l2_ctrl_new_std(>ctrl_handler, _jpeg_ctrl_ops, V4L2_CID_JPEG_RESTART_INTERVAL, - 0, 3, 0x, 0); + 0, 0x, 1, 0); if (ctx->jpeg->variant->version == SJPEG_S5P) mask = ~0x06; /* 422, 420 */ } -- 2.17.1
Re: [PATCH] ARM: dts: s5pv210: Fix onenand's unit address format warning
Dnia środa, 9 stycznia 2019 14:43:03 CET Krzysztof Kozlowski pisze: > According to Devicetree specification, the unit-address must match the > first address specified in the reg property of the node. Fix the DTC > warning onenand node: > > arch/arm/boot/dts/s5pv210.dtsi:81.29-93.5: > Warning (simple_bus_reg): /soc/onenand@b000: simple-bus unit > address format error, expected "b060" > > Signed-off-by: Krzysztof Kozlowski > > --- > > The remaining warning is wrong clock-controller subnode of fimc camera. > arch/arm/boot/dts/s5pv210.dtsi:578.32-580.6: Warning (simple_bus_reg): > /soc/camera/clock-controller: missing or empty reg/ranges property > The subnode in my understanding does not follow bindings and the driver. > The driver with current s5pv210.dtsi will not register a clock provider... but > I do not have a device to confirm this. > --- > arch/arm/boot/dts/s5pv210.dtsi | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi > index cc22c9db80d2..26ea5c66d8ce 100644 > --- a/arch/arm/boot/dts/s5pv210.dtsi > +++ b/arch/arm/boot/dts/s5pv210.dtsi > @@ -78,7 +78,7 @@ > }; > }; > > - onenand: onenand@b000 { > + onenand: onenand@b060 { > compatible = "samsung,s5pv210-onenand"; > reg = <0xb060 0x2000>, > <0xb000 0x2>, > Checked on Samsung Galaxy S (with local, not yet submited patches for devicetree support for onenand, which is missing in mainline) and it looks ok (device probed, was able to use ubi tools). Tested-by: Paweł Chmiel
[PATCH 3/4] cpufreq: s5pv210: Defer probe if getting regulators fail
There is possibility, that when probing driver, regulators are not yet initialized. In this case we should return EPROBE_DEFER and wait till they're initialized, since they're required currently for cpufreq driver to work. Also move regulator initialization code at beginning of probe, so we can defer as fast as posibble. Signed-off-by: Paweł Chmiel --- drivers/cpufreq/s5pv210-cpufreq.c | 33 +++ 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index f51697f1e0b3..2d0e4dc7ede7 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c @@ -594,6 +594,26 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) * this whole driver as soon as S5PV210 gets migrated to use * cpufreq-dt driver. */ + arm_regulator = regulator_get(NULL, "vddarm"); + if (PTR_ERR(arm_regulator) == -EPROBE_DEFER) { + pr_dbg("vddarm regulator not ready, defer\n"); + return -EPROBE_DEFER; + } else if (IS_ERR(arm_regulator)) { + pr_err("failed to get regulator vddarm\n"); + return PTR_ERR(arm_regulator); + } + + int_regulator = regulator_get(NULL, "vddint"); + if (PTR_ERR(int_regulator == -EPROBE_DEFER) { + regulator_put(arm_regulator); + pr_dbg("vddint regulator not ready, defer\n"); + return -EPROBE_DEFER; + } else if (IS_ERR(int_regulator)) { + regulator_put(arm_regulator); + pr_err("failed to get regulator vddint\n"); + return PTR_ERR(int_regulator); + } + np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-clock"); if (!np) { pr_err("%s: failed to find clock controller DT node\n", @@ -633,19 +653,6 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) } } - arm_regulator = regulator_get(NULL, "vddarm"); - if (IS_ERR(arm_regulator)) { - pr_err("failed to get regulator vddarm\n"); - return PTR_ERR(arm_regulator); - } - - int_regulator = regulator_get(NULL, "vddint"); - if (IS_ERR(int_regulator)) { - pr_err("failed to get regulator vddint\n"); - regulator_put(arm_regulator); - return PTR_ERR(int_regulator); - } - register_reboot_notifier(_cpufreq_reboot_notifier); return cpufreq_register_driver(_driver); -- 2.17.1
[PATCH 4/4] ARM: defconfig: s5pv210: Add cpufreq support
This commit enables cpufreq support for all s5pv210 devices. Signed-off-by: Paweł Chmiel --- arch/arm/configs/s5pv210_defconfig | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/configs/s5pv210_defconfig b/arch/arm/configs/s5pv210_defconfig index 951196bdf008..fd4f28aabda6 100644 --- a/arch/arm/configs/s5pv210_defconfig +++ b/arch/arm/configs/s5pv210_defconfig @@ -11,6 +11,12 @@ CONFIG_ARCH_S5PV210=y CONFIG_VMSPLIT_2G=y CONFIG_ARM_APPENDED_DTB=y CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x2080,8M console=ttySAC1,115200 init=/linuxrc" +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_STAT=y +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=m +CONFIG_CPU_FREQ_GOV_USERSPACE=m +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m CONFIG_VFP=y CONFIG_NEON=y CONFIG_MODULES=y -- 2.17.1
[PATCH 0/4] ARM: dts: s5pv210: Enable cpufreq support
This patchset enables cpufreq support using s5pv210-cpufreq driver. First patch adds missing dmc nodes, which are required by driver. Second patch is cosmetic, it stops driver from flooding kernel log with messages, after every change of freq. Third patch adds defer probe support for regulators, needed by driver. It was observed, that those regulators can be no yet initialized, when driver is probed, so we should wait till we can get them. Last patch enables required kernel config options. Paweł Chmiel (4): ARM: dts: s5pv210: Add dmc nodes cpufreq: s5pv210: Don't flood kernel log after cpufreq change cpufreq: s5pv210: Defer probe if getting regulators fail ARM: defconfig: s5pv210: Add cpufreq support arch/arm/boot/dts/s5pv210.dtsi | 12 ++ arch/arm/configs/s5pv210_defconfig | 6 + drivers/cpufreq/s5pv210-cpufreq.c | 35 ++ 3 files changed, 39 insertions(+), 14 deletions(-) -- 2.17.1
[PATCH 2/4] cpufreq: s5pv210: Don't flood kernel log after cpufreq change
This commit replaces printk with pr_debug, so we don't flood kernel log. Signed-off-by: Paweł Chmiel --- drivers/cpufreq/s5pv210-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index dbecd7667db2..f51697f1e0b3 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c @@ -481,7 +481,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index) arm_volt, arm_volt_max); } - printk(KERN_DEBUG "Perf changed[L%d]\n", index); + pr_debug("Perf changed[L%d]\n", index); exit: mutex_unlock(_freq_lock); -- 2.17.1
[PATCH 1/4] ARM: dts: s5pv210: Add dmc nodes
This commit adds dmc nodes, which are needed by s5pv210 cpufreq driver to work. Signed-off-by: Paweł Chmiel --- arch/arm/boot/dts/s5pv210.dtsi | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi index e9613418228d..2d55a3a6e79e 100644 --- a/arch/arm/boot/dts/s5pv210.dtsi +++ b/arch/arm/boot/dts/s5pv210.dtsi @@ -25,6 +25,8 @@ aliases { csis0 = + dmc0 = + dmc1 = fimc0 = fimc1 = fimc2 = @@ -521,6 +523,16 @@ status = "disabled"; }; + dmc0: dmc@f000 { + compatible = "samsung,s5pv210-dmc"; + reg = <0xf000 0x1000>; + }; + + dmc1: dmc@f140 { + compatible = "samsung,s5pv210-dmc"; + reg = <0xf140 0x1000>; + }; + g2d: g2d@fa00 { compatible = "samsung,s5pv210-g2d"; reg = <0xfa00 0x1000>; -- 2.17.1
[PATCH v2 1/4] ARM: dts: s5pv210: aries: Add reserved memory for mfc
THis commit adds memory reservation required by MFC to run. On S5PV210 both regions needs to be on separate memory banks. Size of both regions is taken from stock sources. Signed-off-by: Paweł Chmiel --- Changes from v1: - Fixed name of nodes to be more generic --- arch/arm/boot/dts/s5pv210-aries.dtsi | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/boot/dts/s5pv210-aries.dtsi b/arch/arm/boot/dts/s5pv210-aries.dtsi index 575094ea7024..89525e56cc7c 100644 --- a/arch/arm/boot/dts/s5pv210-aries.dtsi +++ b/arch/arm/boot/dts/s5pv210-aries.dtsi @@ -23,6 +23,24 @@ 0x5000 0x0800>; }; + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + mfc_left: region@4300 { + compatible = "shared-dma-pool"; + no-map; + reg = <0x4300 0x200>; + }; + + mfc_right: region@5100 { + compatible = "shared-dma-pool"; + no-map; + reg = <0x5100 0x200>; + }; + }; + wifi_pwrseq: wifi-pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = < 2 GPIO_ACTIVE_LOW>; @@ -329,6 +347,10 @@ status = "okay"; }; + { + memory-region = <_left>, <_right>; +}; + { wlan_bt_en: wlan-bt-en { samsung,pins = "gpb-5"; -- 2.17.1
[PATCH v2 4/4] ARM: defconfig: s5pv210: Enable more drivers present on Samsung Aries
This commit enables following drivers: - i2c support (using s3c2410 driver) - s5p-jpeg - s5p-mfc - exynos drm rotator - pwm support - pwm vibrator - fixed regulator - syscon poweroff - Atmel maXTouch touchscreen - Broadcom BCM4329 bluetooth over uart0 - dma devices (so we can use pl330 dma driver) Disable DEBUG_LL. It's currently set to uart1, but if we want to use it on Aries, we would need to switch it to uart2, to get any logs. Signed-off-by: Paweł Chmiel Signed-off-by: Jonathan Bakker --- arch/arm/configs/s5pv210_defconfig | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/arch/arm/configs/s5pv210_defconfig b/arch/arm/configs/s5pv210_defconfig index 0159636d4c0d..951196bdf008 100644 --- a/arch/arm/configs/s5pv210_defconfig +++ b/arch/arm/configs/s5pv210_defconfig @@ -27,6 +27,11 @@ CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y CONFIG_IP_PNP_BOOTP=y CONFIG_IP_PNP_RARP=y +CONFIG_BT=m +CONFIG_BT_RFCOMM=y +CONFIG_BT_BNEP=y +CONFIG_BT_HCIUART=m +CONFIG_BT_HCIUART_BCM=y CONFIG_CFG80211=m CONFIG_MAC80211=m CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" @@ -44,21 +49,35 @@ CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_ATMEL_MXT=m +CONFIG_INPUT_MISC=y +CONFIG_INPUT_PWM_VIBRA=m CONFIG_SERIAL_8250=y CONFIG_SERIAL_SAMSUNG=y CONFIG_SERIAL_SAMSUNG_CONSOLE=y +CONFIG_SERIAL_DEV_BUS=y CONFIG_HW_RANDOM=y CONFIG_I2C_GPIO=y +CONFIG_I2C_S3C2410=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON_POWEROFF=y CONFIG_POWER_SUPPLY=y CONFIG_BATTERY_MAX17040=y # CONFIG_HWMON is not set CONFIG_MFD_MAX8998=y CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_MAX8998=y +CONFIG_MEDIA_SUPPORT=m +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_V4L_MEM2MEM_DRIVERS=y +CONFIG_VIDEO_SAMSUNG_S5P_JPEG=m +CONFIG_VIDEO_SAMSUNG_S5P_MFC=m CONFIG_DRM=y CONFIG_DRM_EXYNOS=y CONFIG_DRM_EXYNOS_FIMD=y CONFIG_DRM_EXYNOS_DPI=y +CONFIG_DRM_EXYNOS_ROTATOR=y CONFIG_USB=y CONFIG_USB_OTG=y CONFIG_USB_EHCI_HCD=y @@ -72,6 +91,9 @@ CONFIG_MMC_SDHCI_S3C=y CONFIG_MMC_SDHCI_S3C_DMA=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_MAX8998=m +CONFIG_DMADEVICES=y +CONFIG_PWM=y +CONFIG_PWM_SAMSUNG=y CONFIG_PHY_SAMSUNG_USB2=m CONFIG_PHY_S5PV210_USB2=y CONFIG_EXT2_FS=y @@ -97,6 +119,3 @@ CONFIG_DEBUG_SPINLOCK=y CONFIG_DEBUG_MUTEXES=y CONFIG_DEBUG_ATOMIC_SLEEP=y CONFIG_DEBUG_USER=y -CONFIG_DEBUG_LL=y -CONFIG_DEBUG_S3C_UART1=y -CONFIG_EARLY_PRINTK=y -- 2.17.1
[PATCH v2 3/4] ARM: defconfig: s5pv210: Run make savedefconfig
This is result of running savedefconfig. It's preparation for adding support for more hw present on Samsung Aries based devices. Signed-off-by: Paweł Chmiel --- arch/arm/configs/s5pv210_defconfig | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm/configs/s5pv210_defconfig b/arch/arm/configs/s5pv210_defconfig index a077597369f1..0159636d4c0d 100644 --- a/arch/arm/configs/s5pv210_defconfig +++ b/arch/arm/configs/s5pv210_defconfig @@ -1,24 +1,24 @@ CONFIG_SYSVIPC=y CONFIG_NO_HZ=y CONFIG_HIGH_RES_TIMERS=y +CONFIG_PREEMPT=y CONFIG_CGROUPS=y CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y CONFIG_BLK_DEV_INITRD=y CONFIG_KALLSYMS_ALL=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PARTITION_ADVANCED=y -CONFIG_BSD_DISKLABEL=y -CONFIG_SOLARIS_X86_PARTITION=y CONFIG_ARCH_S5PV210=y CONFIG_VMSPLIT_2G=y -CONFIG_PREEMPT=y CONFIG_ARM_APPENDED_DTB=y CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x2080,8M console=ttySAC1,115200 init=/linuxrc" CONFIG_VFP=y CONFIG_NEON=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_BLK_DEV_BSG is not set +CONFIG_PARTITION_ADVANCED=y +CONFIG_BSD_DISKLABEL=y +CONFIG_SOLARIS_X86_PARTITION=y CONFIG_NET=y CONFIG_PACKET=y CONFIG_UNIX=y @@ -87,6 +87,7 @@ CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ASCII=y CONFIG_NLS_ISO8859_1=y CONFIG_NLS_UTF8=y +CONFIG_CRC_CCITT=y CONFIG_DEBUG_INFO=y CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_KERNEL=y @@ -99,4 +100,3 @@ CONFIG_DEBUG_USER=y CONFIG_DEBUG_LL=y CONFIG_DEBUG_S3C_UART1=y CONFIG_EARLY_PRINTK=y -CONFIG_CRC_CCITT=y -- 2.17.1
[PATCH v2 0/4] ARM: dts: s5pv210: aries: Enable more drivers present on Samsung Aries based devices
This patchset enables more drivers for devices present on Samsung Aries based devices. Changes from v1: - Removed already applied patches - Fixed name of mfc memory reservation nodes - Added separate patch with savedefconfig result - Fixed configuration of touchscreen Jonathan Bakker (1): ARM: dts: s5pv210: aries: Support for more devices present on Aries Paweł Chmiel (3): ARM: dts: s5pv210: aries: Add reserved memory for mfc ARM: defconfig: s5pv210: Run make savedefconfig ARM: defconfig: s5pv210: Enable more drivers present on Samsung Aries arch/arm/boot/dts/s5pv210-aries.dtsi | 90 arch/arm/configs/s5pv210_defconfig | 41 + 2 files changed, 120 insertions(+), 11 deletions(-) -- 2.17.1
[PATCH v2 2/4] ARM: dts: s5pv210: aries: Support for more devices present on Aries
From: Jonathan Bakker This commit enables following devices present on Aries based phones: - pwm-vibrator attached to PWM 1 - poweroff support - Atmel maXTouch touchscreen, connected to i2c2 - Broadcom BCM4329 bluetooth over uart0 Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- Changes from v1: - Touchscreen irq pin should have PULL_NONE, since it's already pulled up with 2.8v - Touchscreen irq should be edge failing (like in vendor sources) --- arch/arm/boot/dts/s5pv210-aries.dtsi | 68 1 file changed, 68 insertions(+) diff --git a/arch/arm/boot/dts/s5pv210-aries.dtsi b/arch/arm/boot/dts/s5pv210-aries.dtsi index 89525e56cc7c..8ff70b856334 100644 --- a/arch/arm/boot/dts/s5pv210-aries.dtsi +++ b/arch/arm/boot/dts/s5pv210-aries.dtsi @@ -41,6 +41,13 @@ }; }; + vibrator_pwr: regulator-fixed-0 { + compatible = "regulator-fixed"; + regulator-name = "vibrator-en"; + enable-active-high; + gpio = < 1 GPIO_ACTIVE_HIGH>; + }; + wifi_pwrseq: wifi-pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = < 2 GPIO_ACTIVE_LOW>; @@ -314,6 +321,22 @@ reg = <0x36>; }; }; + + vibrator: pwm-vibrator { + compatible = "pwm-vibrator"; + pwms = < 1 44642 0>; + pwm-names = "enable"; + vcc-supply = <_pwr>; + pinctrl-names = "default"; + pinctrl-0 = <_out>; + }; + + poweroff: syscon-poweroff { + compatible = "syscon-poweroff"; + regmap = <_syscon>; + offset = <0x681c>; /* PS_HOLD_CONTROL */ + value = <0x5200>; + }; }; { @@ -347,6 +370,23 @@ status = "okay"; }; + { + samsung,i2c-sda-delay = <100>; + samsung,i2c-max-bus-freq = <40>; + samsung,i2c-slave-addr = <0x10>; + status = "okay"; + + touchscreen@4a { + compatible = "atmel,maxtouch"; + reg = <0x4a>; + interrupt-parent = <>; + interrupts = <5 IRQ_TYPE_EDGE_FALLING>; + pinctrl-names = "default"; + pinctrl-0 = <_irq>; + reset-gpios = < 3 GPIO_ACTIVE_HIGH>; + }; +}; + { memory-region = <_left>, <_right>; }; @@ -372,6 +412,13 @@ samsung,pin-drv = ; }; + bt_host_wake: bt-host-wake { + samsung,pins = "gph2-5"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = ; + }; + tf_detect: tf-detect { samsung,pins = "gph3-4"; samsung,pin-function = ; @@ -384,6 +431,17 @@ samsung,pin-function = ; samsung,pin-pud = ; }; + + ts_irq: ts-irq { + samsung,pins = "gpj0-5"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = ; + }; +}; + + { + samsung,pwm-outputs = <1>; }; { @@ -421,6 +479,16 @@ { status = "okay"; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + max-speed = <115200>; + pinctrl-names = "default"; + pinctrl-0 = <_data _fctl _host_wake>; + shutdown-gpios = < 3 GPIO_ACTIVE_HIGH>; + device-wakeup-gpios = < 4 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = < 5 GPIO_ACTIVE_HIGH>; + }; }; { -- 2.17.1
Re: [PATCH 5/6] ARM: dts: s5pv210: aries: Support for more devices present on Aries
Dnia poniedziałek, 31 grudnia 2018 14:35:55 CET Krzysztof Kozlowski pisze: > On Fri, 28 Dec 2018 at 17:18, Paweł Chmiel > wrote: > > > > From: Jonathan Bakker > > > > This commit enables following devices present on Aries based phones: > > - pwm-vibrator attached to PWM 1 > > - poweroff support > > - Atmel maXTouch touchscreen. It's connected to i2c2 > > - Broadcom BCM4329 bluetooth over uart0 > > > > Signed-off-by: Jonathan Bakker > > Signed-off-by: Paweł Chmiel > > --- > > arch/arm/boot/dts/s5pv210-aries.dtsi | 68 > > 1 file changed, 68 insertions(+) > > > > diff --git a/arch/arm/boot/dts/s5pv210-aries.dtsi > > b/arch/arm/boot/dts/s5pv210-aries.dtsi > > index 35ba009a1a33..b7246f879648 100644 > > --- a/arch/arm/boot/dts/s5pv210-aries.dtsi > > +++ b/arch/arm/boot/dts/s5pv210-aries.dtsi > > @@ -41,6 +41,13 @@ > > }; > > }; > > > > + vibrator_pwr: regulator-fixed-0 { > > + compatible = "regulator-fixed"; > > + regulator-name = "vibrator-en"; > > + enable-active-high; > > + gpio = < 1 GPIO_ACTIVE_HIGH>; > > + }; > > + > > wifi_pwrseq: wifi-pwrseq { > > compatible = "mmc-pwrseq-simple"; > > reset-gpios = < 2 GPIO_ACTIVE_LOW>; > > @@ -314,6 +321,22 @@ > > reg = <0x36>; > > }; > > }; > > + > > + vibrator: pwm-vibrator { > > + compatible = "pwm-vibrator"; > > + pwms = < 1 44642 0>; > > + pwm-names = "enable"; > > + vcc-supply = <_pwr>; > > + pinctrl-names = "default"; > > + pinctrl-0 = <_out>; > > + }; > > + > > + poweroff: syscon-poweroff { > > + compatible = "syscon-poweroff"; > > + regmap = <_syscon>; > > + offset = <0x681c>; /* PS_HOLD_CONTROL */ > > + value = <0x5200>; > > + }; > > }; > > > > { > > @@ -347,6 +370,23 @@ > > status = "okay"; > > }; > > > > + { > > + samsung,i2c-sda-delay = <100>; > > + samsung,i2c-max-bus-freq = <40>; > > + samsung,i2c-slave-addr = <0x10>; > > + status = "okay"; > > + > > + touchscreen@4a { > > + compatible = "atmel,maxtouch"; > > + reg = <0x4a>; > > + interrupt-parent = <>; > > + interrupts = <5 IRQ_TYPE_LEVEL_LOW>; > > + pinctrl-names = "default"; > > + pinctrl-0 = <_irq>; > > + reset-gpios = < 3 GPIO_ACTIVE_HIGH>; > > + }; > > +}; > > + > > { > > memory-region = <_left>, <_right>; > > }; > > @@ -372,6 +412,13 @@ > > samsung,pin-drv = ; > > }; > > > > + bt_host_wake: bt-host-wake { > > + samsung,pins = "gph2-5"; > > + samsung,pin-function = ; > > + samsung,pin-pud = ; > > + samsung,pin-drv = ; > > + }; > > + > > tf_detect: tf-detect { > > samsung,pins = "gph3-4"; > > samsung,pin-function = ; > > @@ -384,6 +431,17 @@ > > samsung,pin-function = ; > > samsung,pin-pud = ; > > }; > > + > > + ts_irq: ts-irq { > > + samsung,pins = "gpj0-5"; > > + samsung,pin-function = ; > > + samsung,pin-pud = ; > > It seems there is a difference here between Aries and Fascinate. At > least in vendor kernel. One disables pull and second pulls down. > Anyway neither of them pulls it up. Fixed with all other issues in v2. Thanks > > Best regards, > Krzysztof
[PATCH v3 4/7] Input: tm2-touchkey: Allow specifying custom keycodes
From: Jonathan Bakker Not all devices use the same keycodes in the same order, so add possibility to define keycodes for buttons present on actual hardware. If keycodes property is not present, we assume that device has at least MENU and BACK keys. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- Changes from v2: - Change property name from keycodes to linux,keycodes Changes from v1: - Because key codes could be bigger than 255, use ints for keycodes --- drivers/input/keyboard/tm2-touchkey.c | 49 +++ 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c index 0336789ab1bb..b55faf597d8a 100644 --- a/drivers/input/keyboard/tm2-touchkey.c +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -35,11 +35,6 @@ #define TM2_TOUCHKEY_LED_VOLTAGE_MIN 250 #define TM2_TOUCHKEY_LED_VOLTAGE_MAX 330 -enum { - TM2_TOUCHKEY_KEY_MENU = 0x1, - TM2_TOUCHKEY_KEY_BACK, -}; - struct touchkey_variant { u8 keycode_reg; u8 base_reg; @@ -52,6 +47,8 @@ struct tm2_touchkey_data { struct regulator *vdd; struct regulator_bulk_data regulators[2]; const struct touchkey_variant *variant; + u32 keycodes[4]; + int num_keycodes; }; static const struct touchkey_variant tm2_touchkey_variant = { @@ -112,7 +109,8 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid) { struct tm2_touchkey_data *touchkey = devid; int data; - int key; + int index; + int i; data = i2c_smbus_read_byte_data(touchkey->client, touchkey->variant->keycode_reg); @@ -122,26 +120,20 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid) goto out; } - switch (data & TM2_TOUCHKEY_BIT_KEYCODE) { - case TM2_TOUCHKEY_KEY_MENU: - key = KEY_PHONE; - break; - - case TM2_TOUCHKEY_KEY_BACK: - key = KEY_BACK; - break; - - default: + index = (data & TM2_TOUCHKEY_BIT_KEYCODE) - 1; + if (index < 0 || index >= touchkey->num_keycodes) { dev_warn(>client->dev, -"unhandled keycode, data %#02x\n", data); +"invalid keycode index %d\n", index); goto out; } if (data & TM2_TOUCHKEY_BIT_PRESS_EV) { - input_report_key(touchkey->input_dev, KEY_PHONE, 0); - input_report_key(touchkey->input_dev, KEY_BACK, 0); + for (i = 0; i < touchkey->num_keycodes; i++) + input_report_key(touchkey->input_dev, +touchkey->keycodes[i], 0); } else { - input_report_key(touchkey->input_dev, key, 1); + input_report_key(touchkey->input_dev, +touchkey->keycodes[index], 1); } input_sync(touchkey->input_dev); @@ -153,8 +145,10 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid) static int tm2_touchkey_probe(struct i2c_client *client, const struct i2c_device_id *id) { + struct device_node *np = client->dev.of_node; struct tm2_touchkey_data *touchkey; int error; + int i; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA)) { @@ -184,6 +178,16 @@ static int tm2_touchkey_probe(struct i2c_client *client, /* Save VDD for easy access */ touchkey->vdd = touchkey->regulators[1].consumer; + touchkey->num_keycodes = of_property_read_variable_u32_array(np, + "linux,keycodes", touchkey->keycodes, 0, + ARRAY_SIZE(touchkey->keycodes)); + if (touchkey->num_keycodes <= 0) { + /* default keycodes */ + touchkey->keycodes[0] = KEY_PHONE; + touchkey->keycodes[1] = KEY_BACK; + touchkey->num_keycodes = 2; + } + error = tm2_touchkey_power_enable(touchkey); if (error) { dev_err(>dev, "failed to power up device: %d\n", error); @@ -208,8 +212,9 @@ static int tm2_touchkey_probe(struct i2c_client *client, touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME; touchkey->input_dev->id.bustype = BUS_I2C; - input_set_capability(touchkey->input_dev, EV_KEY, KEY_PHONE); - input_set_capability(touchkey->input_dev, EV_KEY, KEY_BACK); + for (i = 0; i < touchkey->num_keycodes; i++) + input_set_capability(touchkey->input_dev, EV_KEY, +touchkey->keycodes[i]); error = input_register_device(touchkey->input_dev); if (error) { -- 2.17.1
[PATCH v3 2/7] Input: dt-bindings: tm2-touchkey: Add support for midas touchkey
From: Simon Shields Document compatible for midas touchkey. Signed-off-by: Simon Shields Signed-off-by: Paweł Chmiel Reviewed-by: Rob Herring --- Changes from v1: - Added Reviewed-by --- .../devicetree/bindings/input/cypress,tm2-touchkey.txt| 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt index 0c252d9306da..dfb3b9f0ee40 100644 --- a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt +++ b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt @@ -1,7 +1,9 @@ Samsung tm2-touchkey Required properties: -- compatible: must be "cypress,tm2-touchkey" +- compatible: +* "cypress,tm2-touchkey" - for the touchkey found on the tm2 board +* "cypress,midas-touchkey" - for the touchkey found on midas boards - reg: I2C address of the chip. - interrupts: interrupt to which the chip is connected (see interrupt binding[0]). -- 2.17.1
[PATCH v3 6/7] Input: tm2-touchkey: Add support for aries touchkey variant
From: Jonathan Bakker The touchkey variant found on aries board is slighty different, it uses a fixed regulator and writes/read to the same place Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/keyboard/tm2-touchkey.c | 53 +++ 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c index b55faf597d8a..7dbef96559d2 100644 --- a/drivers/input/keyboard/tm2-touchkey.c +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -28,6 +28,8 @@ #define TM2_TOUCHKEY_DEV_NAME "tm2-touchkey" +#define ARIES_TOUCHKEY_CMD_LED_ON 0x1 +#define ARIES_TOUCHKEY_CMD_LED_OFF 0x2 #define TM2_TOUCHKEY_CMD_LED_ON0x10 #define TM2_TOUCHKEY_CMD_LED_OFF 0x20 #define TM2_TOUCHKEY_BIT_PRESS_EV BIT(3) @@ -38,6 +40,10 @@ struct touchkey_variant { u8 keycode_reg; u8 base_reg; + u8 cmd_led_on; + u8 cmd_led_off; + bool no_reg; + bool fixed_regulator; }; struct tm2_touchkey_data { @@ -54,11 +60,22 @@ struct tm2_touchkey_data { static const struct touchkey_variant tm2_touchkey_variant = { .keycode_reg = 0x03, .base_reg = 0x00, + .cmd_led_on = TM2_TOUCHKEY_CMD_LED_ON, + .cmd_led_off = TM2_TOUCHKEY_CMD_LED_OFF, }; static const struct touchkey_variant midas_touchkey_variant = { .keycode_reg = 0x00, .base_reg = 0x00, + .cmd_led_on = TM2_TOUCHKEY_CMD_LED_ON, + .cmd_led_off = TM2_TOUCHKEY_CMD_LED_OFF, +}; + +static struct touchkey_variant aries_touchkey_variant = { + .no_reg = true, + .fixed_regulator = true, + .cmd_led_on = ARIES_TOUCHKEY_CMD_LED_ON, + .cmd_led_off = ARIES_TOUCHKEY_CMD_LED_OFF, }; static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev, @@ -71,15 +88,20 @@ static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev, if (brightness == LED_OFF) { volt = TM2_TOUCHKEY_LED_VOLTAGE_MIN; - data = TM2_TOUCHKEY_CMD_LED_OFF; + data = touchkey->variant->cmd_led_off; } else { volt = TM2_TOUCHKEY_LED_VOLTAGE_MAX; - data = TM2_TOUCHKEY_CMD_LED_ON; + data = touchkey->variant->cmd_led_on; } - regulator_set_voltage(touchkey->vdd, volt, volt); - i2c_smbus_write_byte_data(touchkey->client, - touchkey->variant->base_reg, data); + if (!touchkey->variant->fixed_regulator) + regulator_set_voltage(touchkey->vdd, volt, volt); + + if (touchkey->variant->no_reg) + i2c_smbus_write_byte(touchkey->client, data); + else + i2c_smbus_write_byte_data(touchkey->client, + touchkey->variant->base_reg, data); } static int tm2_touchkey_power_enable(struct tm2_touchkey_data *touchkey) @@ -112,8 +134,11 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid) int index; int i; - data = i2c_smbus_read_byte_data(touchkey->client, - touchkey->variant->keycode_reg); + if (touchkey->variant->no_reg) + data = i2c_smbus_read_byte(touchkey->client); + else + data = i2c_smbus_read_byte_data(touchkey->client, + touchkey->variant->keycode_reg); if (data < 0) { dev_err(>client->dev, "failed to read i2c data: %d\n", data); @@ -139,6 +164,14 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid) input_sync(touchkey->input_dev); out: + if (touchkey->variant->fixed_regulator && + data & TM2_TOUCHKEY_BIT_PRESS_EV) { + /* touch turns backlight on, so make sure we're in sync */ + if (touchkey->led_dev.brightness == LED_OFF) + tm2_touchkey_led_brightness_set(>led_dev, + LED_OFF); + } + return IRQ_HANDLED; } @@ -246,6 +279,9 @@ static int tm2_touchkey_probe(struct i2c_client *client, return error; } + if (touchkey->variant->fixed_regulator) + tm2_touchkey_led_brightness_set(>led_dev, LED_ON); + return 0; } @@ -291,6 +327,9 @@ static const struct of_device_id tm2_touchkey_of_match[] = { }, { .compatible = "cypress,midas-touchkey", .data = _touchkey_variant, + }, { + .compatible = "cypress,aries-touchkey", + .data = _touchkey_variant, }, { }, }; -- 2.17.1
[PATCH v3 3/7] Input: tm2-touchkey: Correct initial brightness
From: Jonathan Bakker Tm2-touchkey don't have brightness levels, but only on/off states, so replace LED_FULL with LED_ON. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- drivers/input/keyboard/tm2-touchkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c index 5a1fe08bdd76..0336789ab1bb 100644 --- a/drivers/input/keyboard/tm2-touchkey.c +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -230,7 +230,7 @@ static int tm2_touchkey_probe(struct i2c_client *client, /* led device */ touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME; - touchkey->led_dev.brightness = LED_FULL; + touchkey->led_dev.brightness = LED_ON; touchkey->led_dev.max_brightness = LED_ON; touchkey->led_dev.brightness_set = tm2_touchkey_led_brightness_set; -- 2.17.1
[PATCH v3 5/7] Input: dt-bindings: tm2-touchkey: Document new keycodes property
From: Jonathan Bakker Document new optional property for setting custom keycodes. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- Changes from v2: - Change property name from keycodes to linux,keycodes Changes from v1: - Because key codes could be bigger than 255, use ints for keycodes --- .../devicetree/bindings/input/cypress,tm2-touchkey.txt| 4 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt index dfb3b9f0ee40..8ef1517c0220 100644 --- a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt +++ b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt @@ -10,6 +10,9 @@ Required properties: - vcc-supply : internal regulator output. 1.8V - vdd-supply : power supply for IC 3.3V +Optional properties: +- linux,keycodes: array of keycodes (max 4), default KEY_PHONE and KEY_BACK + [0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt Example: @@ -23,5 +26,6 @@ Example: interrupts = <2 IRQ_TYPE_EDGE_FALLING>; vcc-supply=<_reg>; vdd-supply=<_reg>; + linux,keycodes = ; }; }; -- 2.17.1
[PATCH v3 0/7] Input: tm2-touchkey: Add support for Aries and Midas
This patches adds support for Aries (Samsung i9000) and Midas (Samsung S3) based devices to TM2 Touchkey driver. Changes from v2: - Change property name from keycodes to linux,keycodes Changes from v1: - Added Reviewed-by to some patches - Use ints for keycodes (they could be bigger than 255) - Droped separate name changes - Added missing const in few places - Removed redundant cast Jonathan Bakker (5): Input: tm2-touchkey: Correct initial brightness Input: tm2-touchkey: Allow specifying custom keycodes Input: dt-bindings: tm2-touchkey: Document new keycodes property Input: tm2-touchkey: Add support for aries touchkey variant Input: dt-bindings: tm2-touchkey: Add support for aries touchkey Simon Shields (2): Input: tm2-touchkey: Add support for midas touchkey Input: dt-bindings: tm2-touchkey: Add support for midas touchkey .../bindings/input/cypress,tm2-touchkey.txt | 9 +- drivers/input/keyboard/tm2-touchkey.c | 132 +- 2 files changed, 108 insertions(+), 33 deletions(-) -- 2.17.1
[PATCH v3 7/7] Input: dt-bindings: tm2-touchkey: Add support for aries touchkey
From: Jonathan Bakker Document compatible for aries touchkey. Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel Reviewed-by: Rob Herring --- Changes from v1: - Added Reviewed-by --- Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt index 8ef1517c0220..ef2ae729718f 100644 --- a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt +++ b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt @@ -4,6 +4,7 @@ Required properties: - compatible: * "cypress,tm2-touchkey" - for the touchkey found on the tm2 board * "cypress,midas-touchkey" - for the touchkey found on midas boards +* "cypress,aries-touchkey" - for the touchkey found on aries boards - reg: I2C address of the chip. - interrupts: interrupt to which the chip is connected (see interrupt binding[0]). -- 2.17.1
[PATCH v3 1/7] Input: tm2-touchkey: Add support for midas touchkey
From: Simon Shields The touchkey on midas boards is almost identical. The only real difference is that it uses the same register for both keycode and base. Signed-off-by: Simon Shields Signed-off-by: Paweł Chmiel --- Changes from v1: - Droped separate name changes - Added missing const in few places - Removed redundant cast --- drivers/input/keyboard/tm2-touchkey.c | 34 +++ 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c index abc266e40e17..5a1fe08bdd76 100644 --- a/drivers/input/keyboard/tm2-touchkey.c +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -22,12 +22,12 @@ #include #include #include +#include #include #include #define TM2_TOUCHKEY_DEV_NAME "tm2-touchkey" -#define TM2_TOUCHKEY_KEYCODE_REG 0x03 -#define TM2_TOUCHKEY_BASE_REG 0x00 + #define TM2_TOUCHKEY_CMD_LED_ON0x10 #define TM2_TOUCHKEY_CMD_LED_OFF 0x20 #define TM2_TOUCHKEY_BIT_PRESS_EV BIT(3) @@ -40,12 +40,28 @@ enum { TM2_TOUCHKEY_KEY_BACK, }; +struct touchkey_variant { + u8 keycode_reg; + u8 base_reg; +}; + struct tm2_touchkey_data { struct i2c_client *client; struct input_dev *input_dev; struct led_classdev led_dev; struct regulator *vdd; struct regulator_bulk_data regulators[2]; + const struct touchkey_variant *variant; +}; + +static const struct touchkey_variant tm2_touchkey_variant = { + .keycode_reg = 0x03, + .base_reg = 0x00, +}; + +static const struct touchkey_variant midas_touchkey_variant = { + .keycode_reg = 0x00, + .base_reg = 0x00, }; static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev, @@ -66,7 +82,7 @@ static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev, regulator_set_voltage(touchkey->vdd, volt, volt); i2c_smbus_write_byte_data(touchkey->client, - TM2_TOUCHKEY_BASE_REG, data); + touchkey->variant->base_reg, data); } static int tm2_touchkey_power_enable(struct tm2_touchkey_data *touchkey) @@ -99,7 +115,7 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid) int key; data = i2c_smbus_read_byte_data(touchkey->client, - TM2_TOUCHKEY_KEYCODE_REG); + touchkey->variant->keycode_reg); if (data < 0) { dev_err(>client->dev, "failed to read i2c data: %d\n", data); @@ -153,6 +169,8 @@ static int tm2_touchkey_probe(struct i2c_client *client, touchkey->client = client; i2c_set_clientdata(client, touchkey); + touchkey->variant = of_device_get_match_data(>dev); + touchkey->regulators[0].supply = "vcc"; touchkey->regulators[1].supply = "vdd"; error = devm_regulator_bulk_get(>dev, @@ -262,7 +280,13 @@ static const struct i2c_device_id tm2_touchkey_id_table[] = { MODULE_DEVICE_TABLE(i2c, tm2_touchkey_id_table); static const struct of_device_id tm2_touchkey_of_match[] = { - { .compatible = "cypress,tm2-touchkey", }, + { + .compatible = "cypress,tm2-touchkey", + .data = _touchkey_variant, + }, { + .compatible = "cypress,midas-touchkey", + .data = _touchkey_variant, + }, { }, }; MODULE_DEVICE_TABLE(of, tm2_touchkey_of_match); -- 2.17.1
Re: [PATCH v2 5/7] Input: dt-bindings: tm2-touchkey: Document new keycodes property
Dnia czwartek, 3 stycznia 2019 19:27:39 CET Rob Herring pisze: > On Fri, Dec 28, 2018 at 4:52 PM Dmitry Torokhov > wrote: > > > > On Fri, Dec 28, 2018 at 2:47 PM Rob Herring wrote: > > > > > > On Fri, 28 Dec 2018 16:46:07 +0100, =?UTF-8?q?Pawe=C5=82=20Chmiel?= wrote: > > > > From: Jonathan Bakker > > > > > > > > Document new optional property for setting custom keycodes. > > > > > > > > Signed-off-by: Jonathan Bakker > > > > Signed-off-by: Paweł Chmiel > > > > --- > > > > Changes from v1: > > > > - Because key codes could be bigger than 255, use ints for keycodes > > > > --- > > > > .../devicetree/bindings/input/cypress,tm2-touchkey.txt| 4 > > > > 1 file changed, 4 insertions(+) > > > > > > > > > > Reviewed-by: Rob Herring > > > > Shouldn't this be "linux,keycodes" though? > > Sigh, yes. > > Rob I'll send v3 version with this property name fixed (both in documentation and in driver). Thanks
[PATCH] media: s5p-jpeg: Check for fmt_ver_flag when doing fmt enumeration
Previously when doing format enumeration, it was returning all formats supported by driver, even if they're not supported by hw. Add missing check for fmt_ver_flag, so it'll be fixed and only those supported by hw will be returned. Similar thing is already done in s5p_jpeg_find_format. It was found by using v4l2-compliance tool and checking result of VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS test and using v4l2-ctl to get list of all supported formats. Tested on s5pv210-galaxys (Samsung i9000 phone). Fixes: bb677f3ac434 ("[media] Exynos4 JPEG codec v4l2 driver") Signed-off-by: Paweł Chmiel --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 3f9000b70385..232b75cf209f 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -1293,13 +1293,16 @@ static int s5p_jpeg_querycap(struct file *file, void *priv, return 0; } -static int enum_fmt(struct s5p_jpeg_fmt *sjpeg_formats, int n, +static int enum_fmt(struct s5p_jpeg_ctx *ctx, + struct s5p_jpeg_fmt *sjpeg_formats, int n, struct v4l2_fmtdesc *f, u32 type) { int i, num = 0; + unsigned int fmt_ver_flag = ctx->jpeg->variant->fmt_ver_flag; for (i = 0; i < n; ++i) { - if (sjpeg_formats[i].flags & type) { + if (sjpeg_formats[i].flags & type && + sjpeg_formats[i].flags & fmt_ver_flag) { /* index-th format of type type found ? */ if (num == f->index) break; @@ -1326,10 +1329,10 @@ static int s5p_jpeg_enum_fmt_vid_cap(struct file *file, void *priv, struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv); if (ctx->mode == S5P_JPEG_ENCODE) - return enum_fmt(sjpeg_formats, SJPEG_NUM_FORMATS, f, + return enum_fmt(ctx, sjpeg_formats, SJPEG_NUM_FORMATS, f, SJPEG_FMT_FLAG_ENC_CAPTURE); - return enum_fmt(sjpeg_formats, SJPEG_NUM_FORMATS, f, + return enum_fmt(ctx, sjpeg_formats, SJPEG_NUM_FORMATS, f, SJPEG_FMT_FLAG_DEC_CAPTURE); } @@ -1339,10 +1342,10 @@ static int s5p_jpeg_enum_fmt_vid_out(struct file *file, void *priv, struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv); if (ctx->mode == S5P_JPEG_ENCODE) - return enum_fmt(sjpeg_formats, SJPEG_NUM_FORMATS, f, + return enum_fmt(ctx, sjpeg_formats, SJPEG_NUM_FORMATS, f, SJPEG_FMT_FLAG_ENC_OUTPUT); - return enum_fmt(sjpeg_formats, SJPEG_NUM_FORMATS, f, + return enum_fmt(ctx, sjpeg_formats, SJPEG_NUM_FORMATS, f, SJPEG_FMT_FLAG_DEC_OUTPUT); } -- 2.17.1
[PATCH 3/6] ARM: dts: s5pv210: fascinate4g: Remove hardcoded bootargs
Since we have uboot (flashed in place of stock kernel), it's not needed anymore to hardcode bootargs. Signed-off-by: Paweł Chmiel --- arch/arm/boot/dts/s5pv210-fascinate4g.dts | 7 --- 1 file changed, 7 deletions(-) diff --git a/arch/arm/boot/dts/s5pv210-fascinate4g.dts b/arch/arm/boot/dts/s5pv210-fascinate4g.dts index ccf761b1babf..07a8d9bbe5b8 100644 --- a/arch/arm/boot/dts/s5pv210-fascinate4g.dts +++ b/arch/arm/boot/dts/s5pv210-fascinate4g.dts @@ -11,13 +11,6 @@ chosen { stdout-path = - /* -* It's hard to change those parameters in stock bootloader, -* since it requires special hardware/cable. -* Let's hardocde bootargs for now, till u-boot port is finished, -* with which it should be easier. -*/ - bootargs = "root=/dev/mmcblk1p1 rw rootwait ignore_loglevel earlyprintk"; }; gpio-keys { -- 2.17.1
[PATCH 6/6] ARM: defconfig: s5pv210: Enable more drivers present on Samsung Aries
This commit enables following drivers: - i2c support (using s3c2410 driver) - s5p-jpeg - s5p-mfc - exynos drm rotator - pwm support - pwm vibrator - fixed regulator - syscon poweroff - Atmel maXTouch touchscreen - Broadcom BCM4329 bluetooth over uart0 - dma devices (so we can use pl330 dma driver) Disable DEBUG_LL. It's currently set to uart1, but if we want to use it on Aries, we would need to switch uart2, to get any logs. Signed-off-by: Paweł Chmiel Signed-off-by: Jonathan Bakker --- arch/arm/configs/s5pv210_defconfig | 41 ++ 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/arch/arm/configs/s5pv210_defconfig b/arch/arm/configs/s5pv210_defconfig index a077597369f1..951196bdf008 100644 --- a/arch/arm/configs/s5pv210_defconfig +++ b/arch/arm/configs/s5pv210_defconfig @@ -1,24 +1,24 @@ CONFIG_SYSVIPC=y CONFIG_NO_HZ=y CONFIG_HIGH_RES_TIMERS=y +CONFIG_PREEMPT=y CONFIG_CGROUPS=y CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y CONFIG_BLK_DEV_INITRD=y CONFIG_KALLSYMS_ALL=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PARTITION_ADVANCED=y -CONFIG_BSD_DISKLABEL=y -CONFIG_SOLARIS_X86_PARTITION=y CONFIG_ARCH_S5PV210=y CONFIG_VMSPLIT_2G=y -CONFIG_PREEMPT=y CONFIG_ARM_APPENDED_DTB=y CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x2080,8M console=ttySAC1,115200 init=/linuxrc" CONFIG_VFP=y CONFIG_NEON=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_BLK_DEV_BSG is not set +CONFIG_PARTITION_ADVANCED=y +CONFIG_BSD_DISKLABEL=y +CONFIG_SOLARIS_X86_PARTITION=y CONFIG_NET=y CONFIG_PACKET=y CONFIG_UNIX=y @@ -27,6 +27,11 @@ CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y CONFIG_IP_PNP_BOOTP=y CONFIG_IP_PNP_RARP=y +CONFIG_BT=m +CONFIG_BT_RFCOMM=y +CONFIG_BT_BNEP=y +CONFIG_BT_HCIUART=m +CONFIG_BT_HCIUART_BCM=y CONFIG_CFG80211=m CONFIG_MAC80211=m CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" @@ -44,21 +49,35 @@ CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_ATMEL_MXT=m +CONFIG_INPUT_MISC=y +CONFIG_INPUT_PWM_VIBRA=m CONFIG_SERIAL_8250=y CONFIG_SERIAL_SAMSUNG=y CONFIG_SERIAL_SAMSUNG_CONSOLE=y +CONFIG_SERIAL_DEV_BUS=y CONFIG_HW_RANDOM=y CONFIG_I2C_GPIO=y +CONFIG_I2C_S3C2410=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON_POWEROFF=y CONFIG_POWER_SUPPLY=y CONFIG_BATTERY_MAX17040=y # CONFIG_HWMON is not set CONFIG_MFD_MAX8998=y CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_MAX8998=y +CONFIG_MEDIA_SUPPORT=m +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_V4L_MEM2MEM_DRIVERS=y +CONFIG_VIDEO_SAMSUNG_S5P_JPEG=m +CONFIG_VIDEO_SAMSUNG_S5P_MFC=m CONFIG_DRM=y CONFIG_DRM_EXYNOS=y CONFIG_DRM_EXYNOS_FIMD=y CONFIG_DRM_EXYNOS_DPI=y +CONFIG_DRM_EXYNOS_ROTATOR=y CONFIG_USB=y CONFIG_USB_OTG=y CONFIG_USB_EHCI_HCD=y @@ -72,6 +91,9 @@ CONFIG_MMC_SDHCI_S3C=y CONFIG_MMC_SDHCI_S3C_DMA=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_MAX8998=m +CONFIG_DMADEVICES=y +CONFIG_PWM=y +CONFIG_PWM_SAMSUNG=y CONFIG_PHY_SAMSUNG_USB2=m CONFIG_PHY_S5PV210_USB2=y CONFIG_EXT2_FS=y @@ -87,6 +109,7 @@ CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ASCII=y CONFIG_NLS_ISO8859_1=y CONFIG_NLS_UTF8=y +CONFIG_CRC_CCITT=y CONFIG_DEBUG_INFO=y CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_KERNEL=y @@ -96,7 +119,3 @@ CONFIG_DEBUG_SPINLOCK=y CONFIG_DEBUG_MUTEXES=y CONFIG_DEBUG_ATOMIC_SLEEP=y CONFIG_DEBUG_USER=y -CONFIG_DEBUG_LL=y -CONFIG_DEBUG_S3C_UART1=y -CONFIG_EARLY_PRINTK=y -CONFIG_CRC_CCITT=y -- 2.17.1
[PATCH 2/6] ARM: dts: s5pv210: galaxys: Remove hardcoded bootargs
Since we have uboot (flashed in place of stock kernel), it's not needed anymore to hardcode bootargs. Signed-off-by: Paweł Chmiel --- arch/arm/boot/dts/s5pv210-galaxys.dts | 7 --- 1 file changed, 7 deletions(-) diff --git a/arch/arm/boot/dts/s5pv210-galaxys.dts b/arch/arm/boot/dts/s5pv210-galaxys.dts index 842276749717..cf161bbfbacf 100644 --- a/arch/arm/boot/dts/s5pv210-galaxys.dts +++ b/arch/arm/boot/dts/s5pv210-galaxys.dts @@ -11,13 +11,6 @@ chosen { stdout-path = - /* -* It's hard to change those parameters in stock bootloader, -* since it requires special hardware/cable. -* Let's hardocde bootargs for now, till u-boot port is finished, -* with which it should be easier. -*/ - bootargs = "root=/dev/mmcblk2p1 rw rootwait ignore_loglevel earlyprintk"; }; nand_pwrseq: nand-pwrseq { -- 2.17.1
[PATCH 5/6] ARM: dts: s5pv210: aries: Support for more devices present on Aries
From: Jonathan Bakker This commit enables following devices present on Aries based phones: - pwm-vibrator attached to PWM 1 - poweroff support - Atmel maXTouch touchscreen. It's connected to i2c2 - Broadcom BCM4329 bluetooth over uart0 Signed-off-by: Jonathan Bakker Signed-off-by: Paweł Chmiel --- arch/arm/boot/dts/s5pv210-aries.dtsi | 68 1 file changed, 68 insertions(+) diff --git a/arch/arm/boot/dts/s5pv210-aries.dtsi b/arch/arm/boot/dts/s5pv210-aries.dtsi index 35ba009a1a33..b7246f879648 100644 --- a/arch/arm/boot/dts/s5pv210-aries.dtsi +++ b/arch/arm/boot/dts/s5pv210-aries.dtsi @@ -41,6 +41,13 @@ }; }; + vibrator_pwr: regulator-fixed-0 { + compatible = "regulator-fixed"; + regulator-name = "vibrator-en"; + enable-active-high; + gpio = < 1 GPIO_ACTIVE_HIGH>; + }; + wifi_pwrseq: wifi-pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = < 2 GPIO_ACTIVE_LOW>; @@ -314,6 +321,22 @@ reg = <0x36>; }; }; + + vibrator: pwm-vibrator { + compatible = "pwm-vibrator"; + pwms = < 1 44642 0>; + pwm-names = "enable"; + vcc-supply = <_pwr>; + pinctrl-names = "default"; + pinctrl-0 = <_out>; + }; + + poweroff: syscon-poweroff { + compatible = "syscon-poweroff"; + regmap = <_syscon>; + offset = <0x681c>; /* PS_HOLD_CONTROL */ + value = <0x5200>; + }; }; { @@ -347,6 +370,23 @@ status = "okay"; }; + { + samsung,i2c-sda-delay = <100>; + samsung,i2c-max-bus-freq = <40>; + samsung,i2c-slave-addr = <0x10>; + status = "okay"; + + touchscreen@4a { + compatible = "atmel,maxtouch"; + reg = <0x4a>; + interrupt-parent = <>; + interrupts = <5 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <_irq>; + reset-gpios = < 3 GPIO_ACTIVE_HIGH>; + }; +}; + { memory-region = <_left>, <_right>; }; @@ -372,6 +412,13 @@ samsung,pin-drv = ; }; + bt_host_wake: bt-host-wake { + samsung,pins = "gph2-5"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = ; + }; + tf_detect: tf-detect { samsung,pins = "gph3-4"; samsung,pin-function = ; @@ -384,6 +431,17 @@ samsung,pin-function = ; samsung,pin-pud = ; }; + + ts_irq: ts-irq { + samsung,pins = "gpj0-5"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = ; + }; +}; + + { + samsung,pwm-outputs = <1>; }; { @@ -421,6 +479,16 @@ { status = "okay"; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + max-speed = <115200>; + pinctrl-names = "default"; + pinctrl-0 = <_data _fctl _host_wake>; + shutdown-gpios = < 3 GPIO_ACTIVE_HIGH>; + device-wakeup-gpios = < 4 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = < 5 GPIO_ACTIVE_HIGH>; + }; }; { -- 2.17.1
[PATCH 4/6] ARM: dts: s5pv210: aries: Add reserved memory for mfc
This commit adds memory reservation required by MFC to run. On S5PV210 both regions needs to be on separate memory banks. Size of both regions is taken from stock sources. Signed-off-by: Paweł Chmiel --- arch/arm/boot/dts/s5pv210-aries.dtsi | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/boot/dts/s5pv210-aries.dtsi b/arch/arm/boot/dts/s5pv210-aries.dtsi index 575094ea7024..35ba009a1a33 100644 --- a/arch/arm/boot/dts/s5pv210-aries.dtsi +++ b/arch/arm/boot/dts/s5pv210-aries.dtsi @@ -23,6 +23,24 @@ 0x5000 0x0800>; }; + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + mfc_left: region_mfc_left@4300 { + compatible = "shared-dma-pool"; + no-map; + reg = <0x4300 0x200>; + }; + + mfc_right: region_mfc_right@5100 { + compatible = "shared-dma-pool"; + no-map; + reg = <0x5100 0x200>; + }; + }; + wifi_pwrseq: wifi-pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = < 2 GPIO_ACTIVE_LOW>; @@ -329,6 +347,10 @@ status = "okay"; }; + { + memory-region = <_left>, <_right>; +}; + { wlan_bt_en: wlan-bt-en { samsung,pins = "gpb-5"; -- 2.17.1