Commit graph

255 commits

Author SHA1 Message Date
Michał Kruszewski 0fea242397 kconfig: adc: Extract platform specific configs to separate files.
It increases readability and order.

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
2017-09-13 09:56:25 -04:00
Anas Nashif 09bcd8ee74 Kconfig: make all syslog variables depend on SYS_LOG
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-04 14:34:54 -05:00
Leandro Pereira 732424f065 drivers, net: Clean up semaphore initialization
Change the common "init with 0" + "give" idiom to "init with 1".  This
won't change the behavior or performance, but should decrease the size
ever so slightly.

This change has been performed mechanically with the following
Coccinelle script:

    @@
    expression SEM;
    expression LIMIT;
    expression TIMEOUT;
    @@

    - k_sem_init(SEM, 0, LIMIT);
    - k_sem_give(SEM);
    + k_sem_init(SEM, 1, LIMIT);

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-07-27 15:23:07 -04:00
Maureen Helm 8ff51559da adc: Introduce new mcux adc16 driver
Adds a shim layer around the mcux adc16 driver to adapt it to the Zephyr
adc interface.

Jira: ZEP-1396

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-07-19 14:28:08 -05:00
Maureen Helm 7bf0df3aec dts: Generate Kinetis adc settings from device tree
Adds common and Kinetis-specific adc device tree properties, and updates
all Kinetis SoC and board dts files to include adc nodes.

Jira: ZEP-1396

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-07-19 14:28:08 -05:00
Maureen Helm a8b1b7f118 adc: Introduce multiple instance configs
The Kconfig assumed that there would only ever be one instance of an
adc, but some Kinetis devices have multiple adc instances.

Jira: ZEP-1396

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-07-19 14:28:08 -05:00
Maureen Helm 615891dd1c adc: Simplify Kconfig dependencies
Remove repetitive dependencies on ADC and instead wrap everything in one
big if.

Jira: ZEP-1396

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-07-19 14:28:08 -05:00
David B. Kinder 93e4d7258d spell: fix Kconfig help typos: /boards /drivers
Fix misspellings in Kconfig help text

Change-Id: I3ae28a5d23d8e266612114bc0eb8a6e158129dc7
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-21 21:31:30 +00:00
Kumar Gala ccad5bf3e3 drivers: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I08f51e2bfd475f6245771c1bd2df7ffc744c48c4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 10:06:48 -05:00
Kumar Gala 789081673f Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t.  This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.

We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.

We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.

Jira: ZEP-2051

Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 16:07:08 +00:00
Anas Nashif 306e15e0a1 kernel: remove legacy kernel support
Change-Id: Iac1e21677d74f81a93cd29d64cce261676ae78a6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-19 15:48:37 +00:00
Juan Solano ee623d21de drivers: Remove unnecessary CONFIG_SYS_POWER_DEEP_SLEEP
This commit removes unnecessary CONFIG_SYS_POWER_DEEP_SLEEP protection
in shim drivers as QMSI 1.4 has introduced empty context save/restore
functions that can be called in Quark D2000, therefore keeping common
code at the shim driver level for Quark SE and D2000.

Change-Id: Ia2a466327f999668c6511c0193014e9151bff6ae
Signed-off-by: Juan Solano <juanx.solano.menacho@intel.com>
2017-02-10 16:27:32 +00:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Baohong Liu 0fa409ff48 drivers: adc108s102: use unified kernel
Use new kernel header file and k_sleep from unified
kernel instead of nano timer.

Change-Id: I1c98c07f880382eaa87f6e0c45967a4b8b6bfd7d
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-22 01:22:09 +00:00
Anas Nashif 3d8e86c12c drivers: eliminate nano/micro kernel usage
Jira: ZEP-1415

Change-Id: I4a009ff57edb799750175aef574a865589f96c14
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-21 18:45:02 +00:00
Anas Nashif a9e879e273 logging: move sys_log to subsys/logging
Move logging out of misc/ to its own subsystem. Anything related to
logging and any new logging features or backends could be added here
instead of the generic location in misc/ which is overcrowded with
options that are not related to eachother.

Jira: ZEP-1467
Change-Id: If6a3ea625c3a3562a7a61a0ba5fd7e6ca75518ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:39 +00:00
Baohong Liu 683cb88777 drivers: adc: replace device sync APIs with semaphores
Device sync APIs are actually wrappers for semaphores.
Let's replace them with semaphores.

Jira: ZEP-1411

Change-Id: Ic37972a631f0bfd7bc45f28088e1c423151b1612
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-11 11:26:06 +00:00
Flavio Santes b04cdcd6e6 drivers: Remove legacy nanokernel.h include
This commit replaces the nanokernel.h include by kernel.h.

Change-Id: Ib42fbf2d9f77a73c0831f569b3dbbfb342ea2e1d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-04 14:59:37 -06:00
Flavio Santes 290a2aba88 drivers: Remove unused parameter warning
This patch fixes the unused parameter warning found at the
following drivers:

- adc_ti_adc108s102.c
- gpio_dw.c
- gpio_k64.c
- exti_stm32.c
- pinmux_dev_atmel_sam3x.c
- pinmux_dev_k64.c
- pinmux_dev_stm32.c
- uart_atmel_sam3.c

Change-Id: I76a17d19176683130d57e8f48e5195e7785060f3
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-03 14:49:08 +00:00
Vincenzo Frascino f880c250dd adc: Cleanup ti 108s102 adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: I0692b389da7f4bf591b5e33f7481bf3dcbbf9801
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino 95f06a5657 adc: Cleanup qmsi ss adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: I28e7daef19359759afb09cd196f659a81c758ea1
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino 9192e55ff4 adc: Cleanup qmsi adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: I12c29f83e5e8a7eb51880d481da17666764b2c2b
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino 0dfab90d30 adc: Cleanup DW adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: Ib05943b53b6863b5b44848ecb2199b7e99d24139
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino c3b54339da adc: Cleanup main Kconfig
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.

Change-Id: I46a156581cdf79d0ba8f0030ce7b595469db1bcb
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Iván Briano b190bd4da2 adc_qmsi_ss: Add power management support to driver
Add the device_ctrl hook to the ADC driver of the Sensor Subsystem,
using the QMSI APIs to save and restore the driver's context.

Jira: ZEP-667

Change-Id: I8b89a875d8185cc4db3c4bfc30ef0f39c6589df1
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-11 23:33:21 +00:00
Baohong Liu 9376f876df drivers: adc: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: Ifeadaffcc2167729c4a7c7d1aea4ea6d6c5b833c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 23:16:05 +00:00
Andrew Boie 0b474eef9c kernel: deprecate old init levels
PRIMARY, SECONDARY, NANOKERNEL, MICROKERNEL init levels are now
deprecated.

New init levels introduced: PRE_KERNEL_1, PRE_KERNEL_2, POST_KERNEL
to replace them.

Most existing code has instances of PRIMARY replaced with PRE_KERNEL_1,
SECONDARY with POST_KERNEL as SECONDARY has had a longstanding bug
where the documentation specified SECONDARY ran before the kernel started
up, but actually ran afterwards.

Change-Id: I771bc634e9caf7f17dbf214a270bc9967eed7d32
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-09 17:59:44 +00:00
Iván Briano 0094ab228d ext qmsi: Update to QMSI 1.3 release
Update the QMSI drop we maintain in Zephyr, and fix the build where
needed:

- QM_SCSS_INT is renamed to QM_INTERRUPT_ROUTER;
- every member of QM_INTERRUPT_ROUTER was renamed as well;
- QM_IRQ_* renamed too, mostly added _INT at the end;
- some isr functions were renamed to keep their names consistent;
- build for x86 needs to define QM_LAKEMONT, as QM_SENSOR was for ARC.

Change-Id: I459029ca0d373f6c831e2bb8ebd52402a55994d1
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-10-31 13:26:06 +00:00
Marcus Shawcroft 12c20ef37f driver/ti_adc108s102: Limit name space, add static.
Change-Id: I711a11a3e41626f8f3e97bcb891c6cf048200ee1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:04 +00:00
Marcus Shawcroft df4c5d7f0c drivers/ti_adc108s102: Make driver_api structure const.
Change-Id: Ib3ba23270f18f99eefdf7181bb3a06930ca535ad
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:21 +00:00
Marcus Shawcroft 223e36bea7 drivers/adc_qmsi_ss: Make driver_api structure const.
Change-Id: Idb7196cac4e7be1bf9819989634046b8c289f8c5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:21 +00:00
Marcus Shawcroft 4303d74220 drivers/adc_qmsi: Make driver_api structure const.
Change-Id: I1666b9130b36fa470cdc496fb96747cbb0e52ce7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:20 +00:00
Marcus Shawcroft d0a71d8f77 adc: Make driver config_info structure const.
Change-Id: Ide974b66da3b785c676f5bbd4f3f5f248797c4e5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:45 +00:00
Marcus Shawcroft d8708d52bc adc/ti: Make driver config structure static.
Change-Id: Ie3ae8397624ee3b9aedbfbe61acbe5a17a2db0b0
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft bad1a4b1da adc/ti: Make config_info pointers const.
Make pointers to struct config_info const in prepration for a const
config_info.

Change-Id: I2256c0f0bff5100e756709c9f99887af70bac661
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft 11258b1395 adc/dw: Make driver config structure static.
Change-Id: Ia094d1abda47ff5d2e05c3d97f9a377cb17d2ee7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft b28b59b617 adc/dw: Make config_info pointers const.
Make pointers to struct config_info const in prepration for a const
config_info.

Change-Id: I977979bc86830768101ab9a2ca1928823ae994df
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Anas Nashif 5e4b62c35c boards: rename Quark SE Devboard to Quark SE C1000 (Sensor Subsystem)
Jira: ZEP-758
Change-Id: I8ee5a2f9e4a6ecbd15214e59321bf27a502ef6ee
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-16 03:10:30 +00:00
Baohong Liu 0ec26e9587 drivers: adc: Correct an error in Kconfig
Correct an error in ADC Kconfig. The # in the beginning of
the code lines unintentionally commented out the "if" condition.

Jira: ZEP-645

Change-Id: Ieee1bdbf4865fc39aef9a0986036fd81a75e5b58
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-08-11 03:11:28 +00:00
Baohong Liu c5404e7c4f sensor: adc: Fix a bug in ADC QMSI shim driver
Correct ADC resolution definition and default value in Kconfig.
QMSI uses different definition for sensor. But, Kconfig did not
reflect the difference.

Change-Id: I8e57aa5670bff0e5b29bf0772159834e4b902d88
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-07-06 22:06:17 +00:00
Jesus Sanchez-Palencia abd7496225 ext qmsi: Update to QMSI 1.1-Beta
QMSI 1.1 Beta is available on Github:
https://github.com/01org/qmsi/releases/tag/v1.1.0-beta

Update the QMSI drop we maintain in Zephyr and
keep the modification to qm_soc_regs.h introduced on commit
6b88a6b945 "ext qmsi: Add USB base and interrupt defines" since
that patch hasn't made into the QMSI 1.1-Beta release in time.

Also, fix the build where needed:
- add hard dependency from qm_i2c to qm_dma
- fix spi_qmsi_ss.c due to new parameter naming
- fix adc_qmsi.c and adc_qmsi_ss.c due to a new parameter

Change-Id: I01388c787f5ee6ee97fece2e42b24a717522207f
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-07-01 13:43:02 -07:00
Genaro Saucedo Tejada a679f32920 sys_log: replace old debug macros at ADC driver
ADC driver is now using new system log macros, also update the Kconfig
variable to be a level rather than a bool.
JIRA: ZEP-311

Change-Id: Iac96c37989e44484808ded515397d457186240e0
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-06-30 17:50:55 +00:00
Anas Nashif 5b202557d3 adc: qmsi: remove obsolete usage of QM_RC_OK
Change-Id: Ia34cc9d8b8b37a9157499be0843c5a42fec9a380
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-02 12:21:10 -04:00
Kumar Gala 9ec2f3be80 Cleanup whitespace in Kconfig files
Convert leading whitespace into tabs in Kconfig files.  Also replaced
double spaces between config and <prompt>.

Change-Id: I341c718ecf4143529b477c239bbde88e18f37062
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-05-25 13:28:07 -05:00
Chuck Jordan 2ae9689678 adc: some symbols didn't have depends on ADC and should
I noticed that even though I was building w/o ADC, that some
ADC config symbols were still defined. Adding some "depends on"
to clean that up.

Change-Id: Ie73d131ba1ad63b5f3d920e17b4c7b5a0d785609
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-24 11:33:48 +00:00
Anas Nashif 229980f33c adc: quark se: Add QMSI 1.1-based ADC shim driver
Change-Id: I330be6ae1fa16d66bfca0c2ae36664fc9c6d080d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:31:51 +00:00
Anas Nashif f35d6e04e3 qmsi: update qmsi to 1.1 alpha
Change-Id: Ib35ebcb32954f764ef8e33f6a1c11ad9f63931bc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:30:04 +00:00
Anas Nashif d0c4b30679 adc: unify kconfig variables and make them consistent
Change-Id: Icf102cf845f0917263d4286fec7a85112c7f8ffc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:25 +00:00
Anas Nashif 00664b5a41 galileo: set priority of ADC to 95
ADC should come after SPI.

Jira: ZEP-217
Change-Id: I1f72d675604b83d54a9268014be3b46d197d746d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-11 17:59:46 +00:00
Daniel Leung b78c9b6a5d adc/qmsi: use new DEVICE_AND_API_INIT()
Change-Id: I56af7fa2d4b9bdc09928d6a1db79b0f37b9b5db5
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-28 01:03:38 +00:00
Anas Nashif b3e02b406a qmsi: adc: use built-in qmsi driver
Fix naming and use a global driver name for instance.

Change-Id: I30a54cb9c20773e1b6fdc57b934aa564612a6c45
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:55:36 -04:00
Daniel Leung 6bb186b754 adc/dw: convert to use DEVICE_AND_API_INIT()
Change-Id: Ieaf72ea553bff766314e69f1e58888c2ccc07f21
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:11 +00:00
Daniel Leung 2735e1fa82 adc: move each driver kconfig options into submenus
This moves the kconfig options for each drivers into their own
submenus. This makes menuconfig easier to navigate.

Change-Id: I2bdc8c3b61e424248ffb65385a7eabc797d89684
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-18 11:27:09 +00:00
Andre Guedes 136d171588 drivers: Replace DEV_NOT_CONFIG by -EPERM
This patch replaces all occurences of the macro DEV_NOT_CONFIG by
-EPERM at the driver level. This patch is part of the effort to
transition from DEV_* codes to errno.h codes.

Change-Id: I3054c8aa76319a58a2eec089b8a72bf301c85391
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes b3cb3a1f68 drivers: Replace DEV_INVALID_CONF by -EINVAL
This patch replaces all occurences of the macro DEV_INVALID_CONF by
-EINVAL at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: Idae0d5af8dd780416977c9261a5fb6188c3aab64
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 245e140da6 drivers: Replace DEV_INVALID_OP by -ENOTSUP
This patch replaces all occurences of the macro DEV_INVALID_OP by
-ENOTSUP at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I46aec3c65963018c479b01602e4a3eec8650eaff
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 7c956d2ece drivers: Replace DEV_FAIL by -EIO
This patch replaces all occurences of the macro DEV_FAIL by -EIO
at the driver level. So this patch touch the files under drivers/,
include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I0594ab5dbe667e074c250129e7c13ce512ac940f
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 024cfe754e drivers: Replace DEV_OK by 0
This patch replaces all occurences of the macro DEV_OK by the actual
value 0 at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I69980ecb9755f2fb026de5668ae9c21a4ae62d1e
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Maciek Borzecki 5b1b008661 drivers/adc: fix QMSI ADC config options dependency
Config options 'Clock Radio and 'Serial Delay' appeared out of ADC menu
due to a missing dependency on ADC_QMSI.

Change-Id: Ia1ca0d5a4ea676205a5928689c2adee9e26c2691
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-10 13:28:42 +00:00
Sergio Rodriguez b47df6e800 adc: QMSI ADC driver
This creates the QMSI ADC driver which is simply a shim driver based
on the ADC driver provided by QMSI BSP.

In order to enable this driver, the following options should be set:
CONFIG_QMSI_DRIVERS=y
CONFIG_QMSI_INSTALL_PATH="/path/to/libqmsi/directory"
CONFIG_ADC=y
CONFIG_ADC_QMSI=y

Optionally this can be set:
CONFIG_ADC_IRQ
CONFIG_ADC_PRI
CONFIG_ADC_QMSI_POLL
CONFIG_ADC_QMSI_INTERRUPT
CONFIG_ADC_QMSI_CALIBRATION
CONFIG_ADC_QMSI_CLOCK_RATIO
CONFIG_ADC_QMSI_SERIAL_DELAY
CONFIG_ADC_QMSI_SAMPLE_WIDTH

Origin of the file: This file has been created from scratch

Change-Id: Ie04776ac2ed88e56852409070edec568974f8e0d
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-03-05 18:22:32 +00:00
Johan Hedberg 0efd558cbc SPI: Change read/write buffer pointers to void *
There's no reason to require callers to cast their data to uint8_t *
when the data might e.g. originate in a packed struct or some other
data type. Instead, be nice to callers and let them use any pointer
they want. Additionally, declare the TX buffer as a const pointer so
unnecessary typecasts aren't needed for that either (if the data
originates in a const location).

Change-Id: I1482ca4e350b5a7fbda6871ed9f54f255af3aa9e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-04 20:13:21 +00:00
Dan Kalowsky 5d81be5c9d adc : rename device to just ADC
Part of making the device model work, is using a more generic name for
the devices.  Currently the ADC uses 2 possible solutions, when it should
be using just one name for them all.

Change-Id: Id9b78b3edf234391819847bb9b8534747d7d4409
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-10 11:23:56 -05:00
Dan Kalowsky 9ccd5ce785 adc : ti : only one instance
There can only be one instance of an ADC, but we have code setup for
multiple.

Change-Id: I94eae2450bdc6b138ebad66f80a7c451cefe32a9
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-10 11:23:56 -05:00
Dan Kalowsky e97507a034 adc: dw: there is only one ADC
The ADC for DesignWare is currently setup to handle multiple dev entries,
but there only ever exists one.  No reason to add to complexity for multiple
if there is only going to be one.

Change-Id: I0b77ef91160776dcf0aea1a50b144fff2b2be9e2
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-10 11:23:56 -05:00
Dan Kalowsky 4743684e4f struct packing
Looking at all structs as to where we can pack them a little better, and
calling out the padding/stride at the end for future expansion.

Change-Id: I4a651092e950dd3d915af9fa0ee0d7d59803e58f
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-10 16:21:26 +00:00
Juan Manuel Cruz 21b5da27ff adc: fixes unexpected error with interrupt handler
Interrupt handler needs to finish all the handler work before
returning to the sync call.
Before this fix, a call to the API read() method could unexpectedly
fail because a second read() call could start before the previous
read() call had not completely finished.

Change-Id: I74249a52b403e2a589d970fae05b9325b20fbe38
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-08 22:19:51 -05:00
Juan Manuel Cruz ff8138595e adc: adjustments to dummy read
Per Curie documentation, the first sample from the Quark SE ADC
hardware after reset needs to be dropped.
This commits changes the location and the trigger event to do
a dummy read that drops the first sample.
Originally the driver did the dummy read on the API call enable()
and it was triggered if the ADC had awakened from suspend mode.
Because the SoC is not in suspend mode on power on and the API
enable() call has no information on the channels to be read the
dummy read could be missed.
Now the dummy read is done on the API call to read()
and triggered if it is the first time read() is called
since power on.

Change-Id: I1e1ad5f7f44d71ca88572ae242ad629471a9ab9b
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-08 22:19:51 -05:00
Andrew Boie 897ffaeb2c irq: rename irq_connect() to IRQ_CONNECT()
It's not a function and requires all its arguments to be build-time
constants. Make this more obvious to the end user to ease confusion.

Change-Id: I64107cf4d9db9f0e853026ce78e477060570fe6f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh d340d4cb3f device: use DEVICE_INIT everwhere
This is the last step before obsoleting DEVICE_DEFINE() and
DEVICE_INIT_CONFIG_DEFINE().

Change-Id: Ica4257662969048083ab9839872b4b437b8b351b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh 2c1a95aee6 device: rename SYS_GET_DEVICE_NAME/SYS_GET_DEVICE
Rename them to DEVICE_NAME_GET and DEVICE_GET to fit in the 'device'
namespace.

Change-Id: I407a7f284ed4d1c071961b46615eea859c2e825f
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh 0303d8cab9 device: rename SYS_DEFINE_DEVICE()
Rename it to DEVICE_DEFINE() so that it fits in the 'device' namespace.

Change-Id: I3af3a39cf9154359b31d22729d0db9f710cd202b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh bfc27206b2 device: rename DECLARE_DEVICE_INIT_CONFIG()
Rename it to DEVICE_INIT_CONFIG_DEFINE(), because (a) it was not fitting
in any namespace and (b) it is not used to declare, but rather define a
object.

Change-Id: I1da5822f06b85a9fb024b5b184afd0ccc01012ec
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh 99a4f13bbc device: rename synchronous_call_ APIs
Rename them to device_sync_ to fit in the device_ namespace.

Change-Id: I1088dda958584ed90b97137298050fee44c20ee4
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:24 -05:00
Juan Manuel Cruz 06e2d0fe76 adc: updates sample width kconfig help message
The numeric code to configure sample width in ADC needs correction.

Change-Id: I6d73db674852650f70178322d949f9b2b49f97af
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:23 -05:00
Peter Mitsis a0e4568760 c++: Add extern "C" { } block to header files
Adds extern "C" { } blocks to header files so that they can be
safely used by C++ source files.

Change-Id: Ia4db0c36a5dac5d3de351184a297d2af0df64532
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz 41771e5b1c adc: Repetitive buffer management
This commit changes the behavior of the driver when it reports
buffer results back through the callback.

Originally, the driver reported a callback after each sequence
table round signaled by an interrupt. If in repetitive mode,
each reported result was put in the next buffer element,
which was considered circular, and reported back with callback.

Now the behavior changes. If in repetitive mode, each sequence table
round reported by an interruption puts the data  in next element of
the reception buffer. The callback reports back once the buffer is
fulled and stops the sampling process.

Change-Id: I3707574cfaf5dfc874473f38c5dfa88dd392133d
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz 51a5b96367 adc: remove of single/differential modes
On Curie SoC the ADC must always be configured in single ended mode.

Change-Id: Ie59b4180358153865c961b66f98321db60d4269f
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz 87aa20ebad adc: adds dummy conversion
After exiting a deep power down mode a dummy conversion is required.

Change-Id: I98dad19e168984efe7af6ad360d0cc46e6603736
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz 1e3467602a adc: fix a bug polling the power states.
Curie specs states that the ADC_PWR_MODE_STS bit in the
IO_CREG_SLV0_OBSR register must be polled to check if
the requested power mode equals the current power mode.
The bit is set to 1 when requested and current modes match
and the bit is located as the bit 0.

Change-Id: I030d7693d36fb96f09a9cbdd404118674fcb089a
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz edfe960e02 adc: adds calibration capability for dw driver.
ADC DW IP requires a calibration process each time the
IP recovers from a deep power down mode.

Change-Id: I2e02d1987af9addd9cb08a4e4e8d3848ad5b623c
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz 65cb6dbe23 adc: removing MST_CLT and SLV_OBSR offsets
Change-Id: I1d287332036dde399875249580635c2a06fd2b5c
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Tomasz Bursztyka 86fde21f3b spi: Make the API fully synchronous
The driver has to implement the logic in an interrupt based manner.
Applying the changes to the existing drivers.

Changing ADC's API and implementation as well to follow those changes.

Change-Id: Ie0c3e3e318f619ade6be935adb064a25446cc29c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:17 -05:00
Tomasz Bursztyka c0205c243c adc: Fix a mistake in result buffer handling
The casting was wrong, resulting in setting only on of 2 slots.
Taking the opportunity to make thing a bit cleaner on the header side.

Change-Id: I3aa90b5f251f3c5aa756681425bb8ab07e3da1b5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:17 -05:00
Andrew Boie d9cfbd5a61 interrupts: new static IRQ API
The interrupt API has been redesigned:

- irq_connect() for dynamic interrupts renamed to irq_connect_dynamic().
  It will be used in situations where the new static irq_connect()
  won't work, i.e. the value of arguments can't be computed at build time
- a new API for static interrupts replaces irq_connect(). it is used
  exactly the same way as its dynamic counterpart. The old static irq
  macros will be removed
- Separate stub assembly files are no longer needed as the stubs are now
  generated inline with irq_connect()

ReST documentation updated for the changed API. Some detail about the
IDT in ROM added, and an oblique reference to the internal-only
_irq_handler_set() API removed; we don't talk about internal APIs in
the official documentation.

Change-Id: I280519993da0e0fe671eb537a876f67de33d3cd4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:17 -05:00
Juan Manuel Cruz 1fcbd09d88 adc: simplifies Kconfig options for adc dw driver
Change-Id: I1acda668cf10fa58944e57a957f6cf057a1188be
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Juan Manuel Cruz 11d2e57f90 adc: improves buffer management to hold repetitive reads.
ADC allows to program repetitives sampling after a read request.
User should be able to provide buffers for each table entry that can
hold subsequente repetitive samples.

Change-Id: I75da4a480a0e3f241d9276cf4fe3999a9cfbba2c
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Juan Manuel Cruz 69b124dab9 adc: fixes interrupt lines' issue.
Change-Id: I7660a6cb709dcd0237c41c8719152a97bc808980
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Juan Manuel Cruz 42696ca14f adc: simplifies buffer management on adc dw driver.
Buffer management on dw driver was too complex.
New buffer management follows the following behavior.
- Each sequence entry have one sample at a time.
- Each sequence entry have a buffer to store that sample.
- If ADC have repetitive sampling configuration, the buffer value
  is overwritten with the new value.

New buffer management allow us to remove Synposys'
files and license headers as well.

Change-Id: I75bbbee59bea400839bb34ca1fcb2111073f99d0
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Anas Nashif 6bca3724c1 drivers: set default priority for drivers
Use a default priority to avoid Kconfig blocking when priority
is not set in SoC or Board.

Change-Id: I4edda47b955a7ee834f04dc40d0decbd8dee6305
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Anas Nashif 10bb38c186 Use SoC instead of platform.
Change terminology and use SoC instead of platform. An SoC provides
features and default configurations available with an SoC. A board
implements the SoC and adds more features and IP block specific to the
board to extend the SoC functionality such as sensors and debugging
features.

Change-Id: I15e8d78a6d4ecd5cfb3bc25ced9ba77e5ea1122f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Juan Manuel Cruz 0aa73523dd adc: fixes the macro name for interruption vectors.
Change-Id: I01d939e98e3e4bf4593ded2feb6ff757a46c3d38
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:57 -05:00
Juan Manuel Cruz 86a0ab478b adc: kconfig symbols for interruption vectors and priority
Change-Id: I464277dbeae0138702cc78ef43278ce26c8b1a0c
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:57 -05:00
Juan Manuel Cruz bc1a79c4c3 irq: removes priority parameter from IRQ_CONFIG macro
Removes the 'priority' parameter from the IRQ_CONFIG macro.
This parameter was not used anymore in any architecture.
The priority is handled in the IRQ_CONNECT macro.
The documentation is updated as well.

Change-Id: I24a293c5e41bd729d5e759113e0c4a8a6a61e0dd
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:57 -05:00
Juan Manuel Cruz 46e79a7990 adc: adapts irq static macro calls
Adapts IRQ macro calls for the new IRQ static support convention
on ARC.

The new IRQ_CONNECT macro requires to receive the irq numbers without
parenthesis around. This is needed to execute preprocesor substitution
correctly.

Change-Id: I318cb7916b6c3ff3a92b4d2e5a13379f8eed0b4e
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:56 -05:00
Anas Nashif bbe94000e4 quark_se_ss: rename platform and remove arc suffix
This platform if actually a subsystem of the Quark SE SoC and is
not standalone. Use a more descriptive name and remove the architecture
from the platform name.

Change-Id: I16b1ab8dd668441683b07fc4512c219924463441
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Dmitriy Korovkin 57f2741e4f init: Implement fine-grained initialization policy
Put initialization priorities as device driver Kconfig
parameter.

Initialization priority value for each platform is defined
in the platform Kconfig file.

Drivers and platform code use SYS_DEFINE_DEVICE to add
and initialization function.

Change-Id: I2f4f3c7370dac02408a1b50a0a1bade8b427a282
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Juan Manuel Cruz a24b7a8895 adc: add DesignWare ADC driver
This commit adds the Synopsys source code for the arc ADC driver.

Change-Id: I140a63505685cda8ec9d3174b7cf4fc1e2e91b06
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:48 -05:00
Anas Nashif 9f30c4a8b5 adc: fix inclusion of local header
since we are in the same directory, include the file directly.

Change-Id: I8c676e1e5acd7dbab2c283d914a3ef62c2d36cdc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Peter Mitsis 3f97f24b33 adc: Fix dependencies
The ADC implementation requires that the kconfig option NANO_TIMEOUTS be
enabled as it uses the routine fiber_delayed_start().

Change-Id: Iec49fec4badd3fcf173a2d2cc9d2924299190150
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Peter Mitsis c7a76a226d galileo: Fix SPI speed and configuration values
Change-Id: If15b2931e00d3a5748a56cea673e694389a7e963
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Dan Kalowsky da67b29569 checkpatch: warning - block_comment_style
Change-Id: I6da43e41f9c6efee577b70513ec368ae3cce0144
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Dan Kalowsky 286a7e2bfe adc: renaming ADC files to use underscore
The naming convention is to use underscores (_) and not dashes (-)
within the filename.

Change-Id: I678cf01306d72a905ed7b161af116c6e4a2cd39c
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Javier B Perez Hernandez f7fffae8aa Change BSD-3 licenses to Apache 2
Change all the Intel and Wind River code license from BSD-3 to Apache 2.

Change-Id: Id8be2c1c161a06ea8a0b9f38e17660e11dbb384b
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:29 -05:00
Tomasz Bursztyka 5bcdfbe255 adc: Adding driver for TI's adc108s102 chip
It's an SPI driven chip and proposes up to 8 channels for input
conversion. It's found on Galileo board.

Change-Id: I916367e9be0849812c6a509082a501730a01ce60
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:28 -05:00
Tomasz Bursztyka e6fc1c2049 adc: Add drivers infrastructure
Only Kconfig file for now.

Change-Id: I633ac209583b2fe6cbed3c75036ac245f0058df6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00