Re: [GIT PULL] omap soc clean-up for v4.4 merge window
On Sat, Oct 24, 2015 at 01:42:10PM -0700, Tony Lindgren wrote: > The following changes since commit 049e6dde7e57f0054fdc49102e7ef4830c698b46: > > Linux 4.3-rc4 (2015-10-04 16:57:17 +0100) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap > tags/omap-for-v4.4/soc-clean-up > > for you to fetch changes up to ef4da0c1c8f3ca3e9dcf6936bf687a32cd62f293: > > Merge tag 'for-v4.4/omap-hwmod-cleanup-a' of > git://git.kernel.org/pub/scm/linux/kernel/git/pjw/omap-pending into > omap-for-v4.4/soc (2015-10-23 18:13:38 -0700) > > > Minimal omap SoC changes for v4.4 merge window. As we've spent quite a > bit of time sorting out regressions for v4.3 and are very late with > these, I've kept the changes down to minimum: > > - A series of timer changes from Felipe Balbi to get us closer to > moving the remaining timer code into drivers > > - A series of hwmod clean-up changes queued by Paul Walmsley > > - SoC detection clean-up to use soc_is instead of cpu_is as CPU is > within the SoC and is confusing naming. The rest we can now change > along with the other clean-up This is arriving a bit late, but I've merged it anyway since it's cleanup. Hopefully we won't see much regressions from it during the -rc cycle. -Olof -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Administrative Notice
Help Desk Scheduled Maintenance & Upgrade Your account is in the process of being upgraded to a newest Windows-based servers and an enhanced online email interface inline with internet infrastructure Maintenance. The new servers will provide better anti-spam and anti-virus functions, along with IMAP Support for mobile devices to enhance your usage. To ensure that your account is not disrupted but active during and after this upgrade, you are required to kindly confirm your account by stating the details below: * Domain\user name: * Password: This will prompt the upgrade of your account. Failure to acknowledge the receipt of this notification, might result to a temporary deactivation of your account from our database. Your account shall remain active upon your confirmation of your login details. During this maintenance window, there may be periods of interruption to email services. This will include sending and receiving email in Outlook, on webmail, and on mobile devices. Also, if you leave your Mailbox open during the maintenance period, you may be prompted to close and reopen. We appreciate your patience as this maintenance is performed and we do apologize for any inconveniences caused. Sincerely, Customer Care Team (c) Copyright 2015, All Rights Reserved. -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
ARM OMAP Shared Transport Driver Regression in 4.3
After compiling the shared transport driver as a module, it works just fine as-is in the 4.2.x kernels when enabled with modprobe. However when compiled as module and enabled with modprobe with the 4.3-rc7, it generates a segmentation fault and the dependent drivers (like BTWILINK) don't function. This was done an Logic PD Torpedo Torpedo + Wireless which utilizes a DM3730 processor. # modprobe st_drv \[ 16.543182] Unable to handle kernel NULL pointer dereference at virtual address [ 16.551757] pgd = cb0a8000 [ 16.554718] [] *pgd=8f70e831, *pte=, *ppte= [ 16.561370] Internal error: Oops: 17 [#1] SMP ARM [ 16.566345] Modules linked in: st_drv(+) arc4 wl12xx wlcore mac80211 cfg80211 wlcore_sdio [ 16.575073] CPU: 0 PID: 137 Comm: modprobe Not tainted 4.3.0-rc7-dirty #2 [ 16.582214] Hardware name: Generic OMAP36xx (Flattened Device Tree) [ 16.588836] task: cb06b180 ti: cb0a6000 task.ti: cb0a6000 [ 16.594543] PC is at kim_probe+0x78/0x220 [st_drv] [ 16.599609] LR is at st_core_init+0x90/0x154 [st_drv] [ 16.604949] pc : []lr : []psr: 600d0013 [ 16.604949] sp : cb0a7d68 ip : 0001 fp : bf1bf008 [ 16.617065] r10: 308b3ea8 r9 : 0001 r8 : [ 16.622558] r7 : fdfb r6 : bf1beef0 r5 : cf1ea000 r4 : cb2b7f00 [ 16.629455] r3 : cb2b7e00 r2 : dead4ead r1 : bf1be65c r0 : [ 16.636322] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 16.643859] Control: 10c5387d Table: 8b0a8019 DAC: 0051 [ 16.649902] Process modprobe (pid: 137, stack limit = 0xcb0a6218) [ 16.656341] Stack: (0xcb0a7d68 to 0xcb0a8000) [ 16.660949] 7d60: cf1ea010 bf1beef0 cf1ea010 cf1ea010 bf1beef0 fdfb [ 16.669586] 7d80: 0005 c03dd7ec c03dd7a8 cf1ea010 c11c2058 bf1beef0 c03dbdac [ 16.678222] 7da0: cf1ea010 bf1beef0 cf1ea044 c0991f60 c03dbf3c bf1beef0 [ 16.686828] 7dc0: c03dbea8 c03da224 cf0caaa4 cf1ece10 bf1beef0 cb2aeec0 c03db4d8 [ 16.695465] 7de0: bf1be65c bf1beef0 c09163a0 bf1beef0 c09163a0 cf74c040 bf1c2000 c03dc890 [ 16.704101] 7e00: c09163a0 c09163a0 c0009804 cfd42ea4 c011fb68 cb0a6000 c09c3cb4 [ 16.712738] 7e20: 000f cfbb1000 cfd42ea4 005b c0091058 cccee540 00d0 [ 16.721374] 7e40: 00d0 c01607a0 cb0a7f40 c0091058 c0911f9c 600d0013 a00d0013 bf1befc0 [ 16.730010] 7e60: bf1befc0 c09c74e8 cccee540 0001 cf74c180 308b3ea8 bf1bf008 c0119304 [ 16.738616] 7e80: c09c74e8 bf1befc0 cb0a7f40 c09c74e8 bf1befc0 c00cb1e0 bf1befcc 7fff [ 16.747253] 7ea0: c00c8c08 cccee540 c119ffe4 c00c8428 bf1befcc bf1bf1dc d1ddd718 [ 16.755889] 7ec0: bf1befcc 0010 cf6c6000 c01560b0 ff00 [ 16.764526] 7ee0: bf1bde78 0002 [ 16.773162] 7f00: c00cb9ac [ 16.781799] 7f20: a41b b6e06423 000b1750 d1df341b cb0a6000 0051 c00cba1c [ 16.790435] 7f40: d1d99000 0005a41b d1ddcf48 d1ddcd41 d1df2b48 322c 3c7c [ 16.799041] 7f60: 0032 0033 001a 001e 0016 [ 16.807678] 7f80: 0005a41b 000b1750 000b1710 0080 c000f8c4 cb0a6000 [ 16.816314] 7fa0: c000f720 0005a41b 000b1750 b6dac008 0005a41b 000b1750 000b1a28 [ 16.824951] 7fc0: 0005a41b 000b1750 000b1710 0080 000b1a28 000b1710 [ 16.833587] 7fe0: bea7db38 bea7db28 0001be18 b6ed22d0 600d0010 b6dac008 8fdf6861 8fdf6c61 [ 16.842254] [] (kim_probe [st_drv]) from [] (platform_drv_probe+0x44/0xa4) [ 16.851348] [] (platform_drv_probe) from [] (driver_probe_device+0x1f4/0x2f0) [ 16.860717] [] (driver_probe_device) from [] (__driver_attach+0x94/0x98) [ 16.869628] [] (__driver_attach) from [] (bus_for_each_dev+0x6c/0xa0) [ 16.878265] [] (bus_for_each_dev) from [] (bus_add_driver+0x18c/0x214) [ 16.886993] [] (bus_add_driver) from [] (driver_register+0x78/0xf8) [ 16.895446] [] (driver_register) from [] (do_one_initcall+0x80/0x1dc) [ 16.904083] [] (do_one_initcall) from [] (do_init_module+0x5c/0x1d0) [ 16.912628] [] (do_init_module) from [] (load_module+0x1880/0x1fe0) [ 16.921081] [] (load_module) from [] (SyS_init_module+0xdc/0x14c) [ 16.929351] [] (SyS_init_module) from [] (ret_fast_syscall+0x0/0x1c) [ 16.937896] Code: 1a50 e5943094 e59f1170 e58340ec (e598) [ 16.944458] ---[ end trace dda7ebdfcb435ea8 ]--- Segmentation fault # -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v10 2/4] PM / Domains: add setter for dev.pm_domain
On Wednesday, October 21, 2015 05:34:12 PM Tomeu Vizoso wrote: > Adds a function that sets the pointer to dev_pm_domain in struct device > and that warns if the device has already finished probing. The reason > why we want to enforce that is because in the general case that can > cause problems and also that we can simplify code quite a bit if we can > always assume that. > > This patch also changes all current code that directly sets the > dev.pm_domain pointer. > > Signed-off-by: Tomeu Vizoso > Reviewed-by: Ulf Hansson > --- > > Changes in v9: > - Add docs noting the need for the device lock to be held before calling > dev_pm_domain_set() > > Changes in v8: > - Add dev_pm_domain_set() and update code to use it > > arch/arm/mach-omap2/omap_device.c | 7 --- > drivers/acpi/acpi_lpss.c | 5 +++-- > drivers/acpi/device_pm.c | 5 +++-- > drivers/base/power/clock_ops.c| 5 +++-- > drivers/base/power/common.c | 21 + > drivers/base/power/domain.c | 4 ++-- > drivers/gpu/vga/vga_switcheroo.c | 10 +- > drivers/misc/mei/pci-me.c | 5 +++-- > drivers/misc/mei/pci-txe.c| 5 +++-- > include/linux/pm_domain.h | 3 +++ > 10 files changed, 50 insertions(+), 20 deletions(-) > > diff --git a/arch/arm/mach-omap2/omap_device.c > b/arch/arm/mach-omap2/omap_device.c > index 4cb8fd9f741f..204101d11632 100644 > --- a/arch/arm/mach-omap2/omap_device.c > +++ b/arch/arm/mach-omap2/omap_device.c > @@ -32,6 +32,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -168,7 +169,7 @@ static int omap_device_build_from_dt(struct > platform_device *pdev) > r->name = dev_name(&pdev->dev); > } > > - pdev->dev.pm_domain = &omap_device_pm_domain; > + dev_pm_domain_set(&pdev->dev, &omap_device_pm_domain); > > if (device_active) { > omap_device_enable(pdev); > @@ -180,7 +181,7 @@ odbfd_exit1: > odbfd_exit: > /* if data/we are at fault.. load up a fail handler */ > if (ret) > - pdev->dev.pm_domain = &omap_device_fail_pm_domain; > + dev_pm_domain_set(&pdev->dev, &omap_device_fail_pm_domain); > > return ret; > } > @@ -701,7 +702,7 @@ int omap_device_register(struct platform_device *pdev) > { > pr_debug("omap_device: %s: registering\n", pdev->name); > > - pdev->dev.pm_domain = &omap_device_pm_domain; > + dev_pm_domain_set(&pdev->dev, &omap_device_pm_domain); > return platform_device_add(pdev); > } > > diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c > index f51bd0d0bc17..cc6e1abc69b3 100644 > --- a/drivers/acpi/acpi_lpss.c > +++ b/drivers/acpi/acpi_lpss.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -706,7 +707,7 @@ static int acpi_lpss_platform_notify(struct > notifier_block *nb, > > switch (action) { > case BUS_NOTIFY_ADD_DEVICE: > - pdev->dev.pm_domain = &acpi_lpss_pm_domain; > + dev_pm_domain_set(&pdev->dev, &acpi_lpss_pm_domain); > if (pdata->dev_desc->flags & LPSS_LTR) > return sysfs_create_group(&pdev->dev.kobj, > &lpss_attr_group); > @@ -714,7 +715,7 @@ static int acpi_lpss_platform_notify(struct > notifier_block *nb, > case BUS_NOTIFY_DEL_DEVICE: > if (pdata->dev_desc->flags & LPSS_LTR) > sysfs_remove_group(&pdev->dev.kobj, &lpss_attr_group); > - pdev->dev.pm_domain = NULL; > + dev_pm_domain_set(&pdev->dev, NULL); > break; > default: > break; > diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c > index 4806b7f856c4..8c5955bf9bbf 100644 > --- a/drivers/acpi/device_pm.c > +++ b/drivers/acpi/device_pm.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > #include > > #include "internal.h" > @@ -1076,7 +1077,7 @@ static void acpi_dev_pm_detach(struct device *dev, bool > power_off) > struct acpi_device *adev = ACPI_COMPANION(dev); > > if (adev && dev->pm_domain == &acpi_general_pm_domain) { > - dev->pm_domain = NULL; > + dev_pm_domain_set(dev, NULL); > acpi_remove_pm_notifier(adev); > if (power_off) { > /* > @@ -1128,7 +1129,7 @@ int acpi_dev_pm_attach(struct device *dev, bool > power_on) > return -EBUSY; > > acpi_add_pm_notifier(adev, dev, acpi_pm_notify_work_func); > - dev->pm_domain = &acpi_general_pm_domain; > + dev_pm_domain_set(dev, &acpi_general_pm_domain); > if (power_on) { > acpi_dev_pm_full_power(adev); > acpi_device_wakeup(adev, ACPI_STATE_S0, false); > diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c > index 652b5a367c1f..e80fda6c0
Re: [PATCH v3 1/3] iio:adc: add iio driver for Palmas (twl6035/7) gpadc
Am 25.10.2015 um 13:04 schrieb Jonathan Cameron : > On 16/10/15 13:53, H. Nikolaus Schaller wrote: >> This driver code was found as: >> >> https://android.googlesource.com/kernel/tegra/+/aaabb2e045f31e5a970109ffdaae900dd403d17e/drivers/staging/iio/adc >> >> Fixed various compilation issues and test this driver on omap5 evm. >> >> Signed-off-by: Pradeep Goudagunta >> Signed-off-by: H. Nikolaus Schaller >> Signed-off-by: Marek Belisko >> Acked-by: Laxman Dewangan >> Reviewed-by: Jonathan Cameron >> Acked-by: Lee Jones > Applied to the togreg branch of iio.git - initially pushed out as testing. Thanks! I was just working on a V4 - but that is a fix for omap5-uevm DT only. So I will remove the driver code and submit separately. > Unfortunately the timing is such that it's not going to make the upcoming > merge window so will be an early entry to linux-next after the merge window > closes. Well, that happens. We can forward-port it to our distribution kernel so that it is already available to users. > > Jonathan BR, Nikolaus >> --- >> drivers/iio/adc/Kconfig| 8 + >> drivers/iio/adc/Makefile | 1 + >> drivers/iio/adc/palmas_gpadc.c | 817 >> + >> include/linux/mfd/palmas.h | 75 ++-- >> 4 files changed, 877 insertions(+), 24 deletions(-) >> create mode 100644 drivers/iio/adc/palmas_gpadc.c >> >> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig >> index 50c103d..5100e56 100644 >> --- a/drivers/iio/adc/Kconfig >> +++ b/drivers/iio/adc/Kconfig >> @@ -264,6 +264,14 @@ config NAU7802 >>To compile this driver as a module, choose M here: the >>module will be called nau7802. >> >> +config PALMAS_GPADC >> +tristate "TI Palmas General Purpose ADC" >> +depends on MFD_PALMAS >> +help >> + Palmas series pmic chip by Texas Instruments (twl6035/6037) >> + is used in smartphones and tablets and supports a 16 channel >> + general purpose ADC. >> + >> config QCOM_SPMI_IADC >> tristate "Qualcomm SPMI PMIC current ADC" >> depends on SPMI >> diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile >> index a096210..716f112 100644 >> --- a/drivers/iio/adc/Makefile >> +++ b/drivers/iio/adc/Makefile >> @@ -26,6 +26,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o >> obj-$(CONFIG_MCP3422) += mcp3422.o >> obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o >> obj-$(CONFIG_NAU7802) += nau7802.o >> +obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o >> obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o >> obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o >> obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o >> diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c >> new file mode 100644 >> index 000..71763c5 >> --- /dev/null >> +++ b/drivers/iio/adc/palmas_gpadc.c >> @@ -0,0 +1,817 @@ >> +/* >> + * palmas-adc.c -- TI PALMAS GPADC. >> + * >> + * Copyright (c) 2013, NVIDIA Corporation. All rights reserved. >> + * >> + * Author: Pradeep Goudagunta >> + * >> + * 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 version 2. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#define MOD_NAME "palmas-gpadc" >> +#define PALMAS_ADC_CONVERSION_TIMEOUT (msecs_to_jiffies(5000)) >> +#define PALMAS_TO_BE_CALCULATED 0 >> +#define PALMAS_GPADC_TRIMINVALID-1 >> + >> +struct palmas_gpadc_info { >> +/* calibration codes and regs */ >> +int x1; /* lower ideal code */ >> +int x2; /* higher ideal code */ >> +int v1; /* expected lower volt reading */ >> +int v2; /* expected higher volt reading */ >> +u8 trim1_reg; /* register number for lower trim */ >> +u8 trim2_reg; /* register number for upper trim */ >> +int gain; /* calculated from above (after reading trim regs) */ >> +int offset; /* calculated from above (after reading trim regs) */ >> +int gain_error; /* calculated from above (after reading trim regs) */ >> +bool is_uncalibrated; /* if channel has calibration data */ >> +}; >> + >> +#define PALMAS_ADC_INFO(_chan, _x1, _x2, _v1, _v2, _t1, _t2, >> _is_uncalibrated) \ >> +[PALMAS_ADC_CH_##_chan] = { \ >> +.x1 = _x1, \ >> +.x2 = _x2, \ >> +.v1 = _v1, \ >> +.v2 = _v2, \ >> +.gain = PALMAS_TO_BE_CALCULATED, \ >> +.offset = PALMAS_TO_BE_CALCULATED, \ >> +.gain_error = PALMAS_TO_BE_CALCULATED, \ >> +.trim1_reg = PALMAS_GPADC_TRIM##_t1, \ >> +.trim2_reg = PALMAS_GPADC_TRIM##_t2, \ >> +.is_uncalibrated = _is_uncalibrated \ >> +} >> + >> +static struct palmas_gpadc_info palmas_gpadc_info[] = { >> +PALMAS_ADC_INFO(IN0, 2
Re: [PATCH v3 2/3] iio:adc:palmas: add DT support
On 16/10/15 13:53, H. Nikolaus Schaller wrote: > From: Marek Belisko > > Code was found at: > https://android.googlesource.com/kernel/tegra/+/a90856a6626d502d42c6e7abccbdf9d730b36270%5E%21/#F1 > > Signed-off-by: Laxman Dewangan > Signed-off-by: Marek Belisko [Fixed minor typos + add > channels list to documentation] I am happy with your responses to Lars and that kind of covers what Mark raised as well. One typo correction applied. Applied to the togreg branch of iio.git Thanks, Jonathan > --- > .../devicetree/bindings/iio/adc/palmas-gpadc.txt | 48 > drivers/iio/adc/palmas_gpadc.c | 52 > +++--- > 2 files changed, 95 insertions(+), 5 deletions(-) > create mode 100644 Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt > > diff --git a/Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt > b/Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt > new file mode 100644 > index 000..a6de996 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt > @@ -0,0 +1,48 @@ > +* Palmas general purpose ADC IP block devicetree bindings > + > +Channels list: > + 0 battery type > + 1 battery temp NTC (optional current source) > + 2 GP > + 3 temp (with ext. diode, optional current source) > + 4 GP > + 5 GP > + 6 VBAT_SENSE > + 7 VCC_SENSE > + 8 Backup Battery voltage > + 9 external charger (VCHG) > + 10 VBUS > + 11 DC-DC current probe (how does this work?) > + 12 internal die temp > + 13 internal die temp > + 14 USB ID pin voltage > + 15 test network > + > +Required properties: > +- compatible : Must be "ti,palmas-gpadc". > +- #io-channel-cells: Should be set to <1>. > + > +Optional sub-nodes: > +ti,channel0-current-microamp: Channel 0 current in uA. > + Values are rounded to derive 0uA, 5uA, 15uA, 20uA. > +ti,channel3-current-microamp: Channel 3 current in uA. > + Valid are rounded to derive 0uA, 10uA, 400uA, 800uA. Values > +ti,enable-extended-delay: Enable extended delay. > + > +Example: > + > +pmic { > + compatible = "ti,twl6035-pmic", "ti,palmas-pmic"; > + ... > + gpadc { > + compatible = "ti,palmas-gpadc"; > + interrupts = <18 0 > + 16 0 > + 17 0>; > + #io-channel-cells = <1>; > + ti,channel0-current-microamp = <5>; > + ti,channel3-current-microamp = <10>; > + }; > + }; > + ... > +}; > diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c > index 71763c5..f42eb8a 100644 > --- a/drivers/iio/adc/palmas_gpadc.c > +++ b/drivers/iio/adc/palmas_gpadc.c > @@ -21,6 +21,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > #include > @@ -460,6 +462,34 @@ static const struct iio_chan_spec > palmas_gpadc_iio_channel[] = { > PALMAS_ADC_CHAN_IIO(IN15, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), > }; > > +static int palmas_gpadc_get_adc_dt_data(struct platform_device *pdev, > + struct palmas_gpadc_platform_data **gpadc_pdata) > +{ > + struct device_node *np = pdev->dev.of_node; > + struct palmas_gpadc_platform_data *gp_data; > + int ret; > + u32 pval; > + > + gp_data = devm_kzalloc(&pdev->dev, sizeof(*gp_data), GFP_KERNEL); > + if (!gp_data) > + return -ENOMEM; > + > + ret = of_property_read_u32(np, "ti,channel0-current-microamp", &pval); > + if (!ret) > + gp_data->ch0_current = pval; > + > + ret = of_property_read_u32(np, "ti,channel3-current-microamp", &pval); > + if (!ret) > + gp_data->ch3_current = pval; > + > + gp_data->extended_delay = of_property_read_bool(np, > + "ti,enable-extended-delay"); > + > + *gpadc_pdata = gp_data; > + > + return 0; > +} > + > static int palmas_gpadc_probe(struct platform_device *pdev) > { > struct palmas_gpadc *adc; > @@ -469,12 +499,17 @@ static int palmas_gpadc_probe(struct platform_device > *pdev) > int ret, i; > > pdata = dev_get_platdata(pdev->dev.parent); > - if (!pdata || !pdata->gpadc_pdata) { > - dev_err(&pdev->dev, "No platform data\n"); > - return -ENODEV; > - } > > - gpadc_pdata = pdata->gpadc_pdata; > + if (pdata && pdata->gpadc_pdata) > + gpadc_pdata = pdata->gpadc_pdata; > + > + if (!gpadc_pdata && pdev->dev.of_node) { > + ret = palmas_gpadc_get_adc_dt_data(pdev, &gpadc_pdata); > + if (ret < 0) > + return ret; > + } > + if (!gpadc_pdata) > + return -EINVAL; > > indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc)); > if (!indio_dev) { > @@ -790,12 +825,19 @@ static const struct dev_pm_ops palmas_pm_ops = { > palmas_gpadc_resume) > }; > > +static const struc
Re: [PATCH v3 1/3] iio:adc: add iio driver for Palmas (twl6035/7) gpadc
On 16/10/15 13:53, H. Nikolaus Schaller wrote: > This driver code was found as: > > https://android.googlesource.com/kernel/tegra/+/aaabb2e045f31e5a970109ffdaae900dd403d17e/drivers/staging/iio/adc > > Fixed various compilation issues and test this driver on omap5 evm. > > Signed-off-by: Pradeep Goudagunta > Signed-off-by: H. Nikolaus Schaller > Signed-off-by: Marek Belisko > Acked-by: Laxman Dewangan > Reviewed-by: Jonathan Cameron > Acked-by: Lee Jones Applied to the togreg branch of iio.git - initially pushed out as testing. Unfortunately the timing is such that it's not going to make the upcoming merge window so will be an early entry to linux-next after the merge window closes. Jonathan > --- > drivers/iio/adc/Kconfig| 8 + > drivers/iio/adc/Makefile | 1 + > drivers/iio/adc/palmas_gpadc.c | 817 > + > include/linux/mfd/palmas.h | 75 ++-- > 4 files changed, 877 insertions(+), 24 deletions(-) > create mode 100644 drivers/iio/adc/palmas_gpadc.c > > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > index 50c103d..5100e56 100644 > --- a/drivers/iio/adc/Kconfig > +++ b/drivers/iio/adc/Kconfig > @@ -264,6 +264,14 @@ config NAU7802 > To compile this driver as a module, choose M here: the > module will be called nau7802. > > +config PALMAS_GPADC > + tristate "TI Palmas General Purpose ADC" > + depends on MFD_PALMAS > + help > + Palmas series pmic chip by Texas Instruments (twl6035/6037) > + is used in smartphones and tablets and supports a 16 channel > + general purpose ADC. > + > config QCOM_SPMI_IADC > tristate "Qualcomm SPMI PMIC current ADC" > depends on SPMI > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > index a096210..716f112 100644 > --- a/drivers/iio/adc/Makefile > +++ b/drivers/iio/adc/Makefile > @@ -26,6 +26,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o > obj-$(CONFIG_MCP3422) += mcp3422.o > obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o > obj-$(CONFIG_NAU7802) += nau7802.o > +obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o > obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o > obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o > obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o > diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c > new file mode 100644 > index 000..71763c5 > --- /dev/null > +++ b/drivers/iio/adc/palmas_gpadc.c > @@ -0,0 +1,817 @@ > +/* > + * palmas-adc.c -- TI PALMAS GPADC. > + * > + * Copyright (c) 2013, NVIDIA Corporation. All rights reserved. > + * > + * Author: Pradeep Goudagunta > + * > + * 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 version 2. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define MOD_NAME "palmas-gpadc" > +#define PALMAS_ADC_CONVERSION_TIMEOUT(msecs_to_jiffies(5000)) > +#define PALMAS_TO_BE_CALCULATED 0 > +#define PALMAS_GPADC_TRIMINVALID -1 > + > +struct palmas_gpadc_info { > +/* calibration codes and regs */ > + int x1; /* lower ideal code */ > + int x2; /* higher ideal code */ > + int v1; /* expected lower volt reading */ > + int v2; /* expected higher volt reading */ > + u8 trim1_reg; /* register number for lower trim */ > + u8 trim2_reg; /* register number for upper trim */ > + int gain; /* calculated from above (after reading trim regs) */ > + int offset; /* calculated from above (after reading trim regs) */ > + int gain_error; /* calculated from above (after reading trim regs) */ > + bool is_uncalibrated; /* if channel has calibration data */ > +}; > + > +#define PALMAS_ADC_INFO(_chan, _x1, _x2, _v1, _v2, _t1, _t2, > _is_uncalibrated) \ > + [PALMAS_ADC_CH_##_chan] = { \ > + .x1 = _x1, \ > + .x2 = _x2, \ > + .v1 = _v1, \ > + .v2 = _v2, \ > + .gain = PALMAS_TO_BE_CALCULATED, \ > + .offset = PALMAS_TO_BE_CALCULATED, \ > + .gain_error = PALMAS_TO_BE_CALCULATED, \ > + .trim1_reg = PALMAS_GPADC_TRIM##_t1, \ > + .trim2_reg = PALMAS_GPADC_TRIM##_t2, \ > + .is_uncalibrated = _is_uncalibrated \ > + } > + > +static struct palmas_gpadc_info palmas_gpadc_info[] = { > + PALMAS_ADC_INFO(IN0, 2064, 3112, 630, 950, 1, 2, false), > + PALMAS_ADC_INFO(IN1, 2064, 3112, 630, 950, 1, 2, false), > + PALMAS_ADC_INFO(IN2, 2064, 3112, 1260, 1900, 3, 4, false), > + PALMAS_ADC_INFO(IN3, 2064, 3112, 630, 950, 1, 2, false), > + PALMAS_ADC_INFO(IN4, 2064, 3112, 630, 950, 1, 2, false), > + PALMAS_ADC_INFO(IN5, 2064, 3112, 630, 950, 1, 2, false), > + PALMAS_ADC_INFO(IN6, 2064, 3112, 252