Commit graph

255 commits

Author SHA1 Message Date
Andrzej Głąbek 4b43065cfc drivers: nrf: Enable nRF drivers by default in Kconfig
Make the following nRF peripheral drivers:
- ADC
- GPIO
- I2C
- SPI
- UART
- USB_DEVICE
enabled by default so that users do not need to explicitly enable them
in their applications after choosing an nRF SoC as the build target.

Kconfig options enabling these drivers depend on both a given hardware
feature (e.g. I2C) and an nRF family SoC selected, so effectively they
will be automatically enabled only when it is adequate (and in most
cases these drivers are the only option for a given hardware feature
on nRF SoCs).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Nicolai Glud 763af40159 drivers: adc: adc_mcux_adc16: improving configurability
This change enables configuration of bit resolution of the adc mcux
adc16.

Signed-off-by: Nicolai Glud <nigd@prevas.dk>
2018-12-14 12:40:51 -06:00
Johann Fischer 0187d60937 drivers: adc_mcux: improve initialization of the ADC
Improve initialization of the ADC.

After initialization with the default values, the clock source
of the ADC is asynchronous clock (ADACK) and clock divide ratio
is 8. The minimum conversion clock frequency is 1MHz.
Add clock divider selection and set default divide ratio to 1.
That sets the conversion clock frequency to approximately 5MHz.

Default configuration for the voltage reference is set to
external pins V_REFH and V_REFL. Depending on the MCU configuration
V_REFL may be connected to ground and V_REFH to VREF_OUT.
Since Voltage Reference block is not supported, the ADC does not work
properly on FRDM-KW41Z. Add voltage reference selection to fix it.

Enable self-calibration function as recommeded in Reference Manual.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-12-13 08:32:18 -06:00
Johann Fischer 487603e655 drivers: adc_mcux: save pointer for repeated sampling
Save pointer for repeated sampling.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-12-13 08:32:18 -06:00
Patrik Flykt 8ff96b5a57 drivers: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Kumar Gala 0916659fb7 adc: remove adc_ti_adc108s102.h
When we removed the adc108s102 driver we missed adc_ti_adc108s102.h

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 18:06:11 -05:00
Kumar Gala c256949bae dts: adc: cleanup CONFIG_ADC_x_NAME
All of the cases of CONFIG_ADC_x_NAME should be DT_ADC_x_NAME.
So go ahead and fix them up.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 18:05:39 -05:00
Kumar Gala d4983db515 dts: adc: cleanup CONFIG_ADC_x_IRQ_PRI
All of the cases of CONFIG_ADC_x_IRQ_PRI should be DT_ADC_x_IRQ_PRI.
So go ahead and fix them up.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 18:05:39 -05:00
Kumar Gala c167789d20 adc: adc_intel_quark_d2000: Pass 0 for IRQ Priority
The Interrupt Controller on the Quark D2000 doesn't support irq priority
to just pass 0 in the for the priority instead of CONFIG_ADC_0_IRQ_PRI.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 18:05:39 -05:00
Kumar Gala a8d0e5af07 adc: ti_adc108s102: Remove driver as its bit-rotted
Nothing builds this driver and the driver hasn't been updated to the new
ADC api so it does not compile.  Remove it sinces its effectively dead
code.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 12:29:24 -05:00
Mieszko Mierunski b370b2ba05 dts: nrf: Remove ADC dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Kumar Gala c0a3c6d4fc adc: adc_dw: Remove dead code related to undefined Kconfig symbols
CONFIG_ADC_DW_REPETITIVE and CONFIG_ADC_DW_DUMMY_CONVERSION aren't
defined anywhere so remove the associated code for these Kconfig
symbols.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-10 15:18:24 -05:00
Flavio Ceolin aecd4ecb8d kernel: Change k_poll_signal api
k_poll_signal was being used by both, struct and function. Besides
this being extremely error prone it is also a MISRA-C violation.
Changing the function to contain a verb, since it performs an action
and the struct will be a noun. This pattern must be formalized and
followed and across the project.

MISRA-C rules 5.7 and 5.9

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-04 11:37:24 -05:00
Kumar Gala aa2bdbe322 drivers: Remove board.h include
We either don't need board.h in the driver or we should be include soc.h
instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-01 13:21:11 -04:00
Andy Ross cbb77be675 sys_clock.h: Remove sys_clock_ticks_per_sec()
This just got turned into a function from a "variable" API, but
post-the-most-recent-patch it turns out to be degenerate anyway.
Everyone everywhere should always have been using the kconfig variable
directly, and it was only a weirdness in the tickless API that made it
confusing.  Fix.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 220d4f8347 sys_clock.h: Make "global variable" APIs into proper functions
The existing API defined sys_clock_{hw_cycles,ticks}_per_sec as simple
"variables" to be shared, except that they were only real storage in
certain modes (the HPET driver, basically) and everywhere else they
were a build constant.

Properly, these should be an API defined by the timer driver (who
controls those rates) and consumed by the clock subsystem.  So give
them function syntax as a stepping stone to get there.

Note that this also removes the deprecated variable
_sys_clock_us_per_tick rather than give it the same treatment.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Anas Nashif 9a8567fa4a drivers: adc: move to new logger
Move to new logger subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Andrzej Głąbek 7ed7d535e9 drivers: adc: nrfx: Use SAADC HAL for setting the burst mode
Replaces direct accesses to the peripheral registers structure
with the proper SAADC HAL function that appeared recently in nrfx.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-09-21 09:12:14 -07:00
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Flavio Ceolin da49f2e440 coccicnelle: Ignore return of memset
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.

The only directory excluded directory was ext/* since it contains
only imported code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Justin Watson bfca8b677b adc: sam: Fixed adc_api test for the SAM E70.
The interval_us is supported by the adc_context code. It is not a
feature that the driver writer needs to code to support. Fixes
bug #9723.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2018-09-06 13:17:29 -05:00
Daniel Leung acc40d990a adc: remove adc_qmsi driver
We now have a native driver for Quark D2000 so the QMSI
one can be removed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-05 18:38:57 -04:00
Daniel Leung 8708611fab adc: add native driver for Quark D2000
This adds a native ADC driver for Quark D2000.

Original: origin

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-05 18:38:57 -04:00
Punit Vara b98aeab505 drivers: Kconfig.dw: Remove unnecessary Kconfig
Remove Kconfig which are replaced by dts and unnecessary macros which is
not useful anymore.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-08-29 13:46:57 -04:00
Punit Vara 353a69cbfd drivers: adc: Update new ADC APIs
Replace new ADC apis for designware driver

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-08-29 13:46:57 -04:00
Punit Vara ef83943387 drivers: Use Designware driver for sensor subsystem
Remove adc_qmsi_ss to use designware driver for sensor subsystem

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-08-29 13:46:57 -04:00
Justin Watson 4e551aabb6 sam: adc: Updated SAM ADC driver.
Updated to work with new ADC API.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2018-08-29 13:46:57 -04:00
Maureen Helm c0ce7d02d5 adc: Convert mcux adc16 driver to the new adc api
Major rework of the mcux adc16 driver to convert it to the new adc api.
Currently supports a subset of the api features including synchronous
and asynchronous reads, and consecutive reads triggered by the kernel
timer.

Does not yet support some of the channel configuration options such as
gain and reference voltage because the hardware only allows these
options to be configured by peripheral instance rather than by channel.
The values are currently hardcoded in the driver, but in the future we
could introduce some flexibility per instance via device tree
attributes.

Does not yet support consecutive reads triggered by a hardware timer.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-29 13:46:57 -04:00
Andrzej Głąbek 62fcfb72d2 drivers: adc: Select HAS_DTS_ADC for all ADC drivers
To require relevant DTS entries on all platforms providing the ADC
driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-29 13:46:57 -04:00
Andrzej Głąbek aad21ecb31 drivers: adc: Add shims for nrfx ADC and SAADC drivers
This commit adds translation layers to make nrfx drivers for the nRF
ADC (nRF51 series) and SAADC (nRF52 series) peripherals accessible via
the Zephyr's API. The SAADC peripheral is accessed using nrfx HAL only
as it turns out that usage of the nrfx driver in this case would be
inconvenient and would unnecessarily complicate the shim.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-29 13:46:57 -04:00
Andrzej Głąbek f1891e9473 drivers: adc: Introduce reworked API
This commit replaces the API for ADC drivers with a reworked one.
As requested in the issue #3980, the adc_enable/adc_disable functions
are removed. Additionaly, some new features are introduced, like:
- asynchronous calls
- configuration of channels
- multi-channel sampling

Common parts of code that are supposed to appear in each implementation
of the driver (like locking, synchronization, triggering of consecutive
samplings) are provided in the "adc_context.h" file to keep consistency
with the SPI driver. Syscalls are no longer present in the API because
the functions starting read requests cannot use them, since they can be
provided with a callback that is executed in the ISR context, and there
is no point in supporting syscalls only for the channels configuration.

"adc_api" test is updated and extended with additional test cases,
with intention to show how the API is supposed to be used.
"adc_simple" test is removed as it does not seem to add much value.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-29 13:46:57 -04:00
Ulf Magnusson 8cf8db3a73 Kconfig: Use a short, consistent style for prompts
Consistently use

    config FOO
            bool/int/hex/string "Prompt text"

instead of

    config FOO
            bool/int/hex/string
            prompt "Prompt text"

(...and a bunch of other variations that e.g. swapped the order of the
type and the 'prompt', or put other properties between them).

The shorthand is fully equivalent to using 'prompt'. It saves lines and
avoids tricking people into thinking there is some semantic difference.

Most of the grunt work was done by a modified version of
https://unix.stackexchange.com/questions/26284/
how-can-i-use-sed-to-replace-a-multi-line-string/26290#26290, but some
of the rarer variations had to be converted manually.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-15 04:10:10 -07:00
Ulf Magnusson 2713e44594 drivers: adc: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Andrew Boie 7e5b021b56 drivers: adc: fix TOCTOU attacks
The toplevel adc_seq_table is now copied onto the stack and
the stack copy used.

The contained entries array is now copied onto an allocation
drawn from the caller's resource pool, to prevent modification
of the buffer pointers.

The return value policy here is to oops the caller if bad memory
or objects are passed in, but return an error otherwise.

Based on an original patch by Leandro Pereira, rebased and the
copy of the entries array added.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-17 15:08:54 -07:00
Andrew Boie 8345e5ebf0 syscalls: remove policy from handler checks
The various macros to do checks in system call handlers all
implictly would generate a kernel oops if a check failed.
This is undesirable for a few reasons:

* System call handlers that acquire resources in the handler
  have no good recourse for cleanup if a check fails.
* In some cases we may want to propagate a return value back
  to the caller instead of just killing the calling thread,
  even though the base API doesn't do these checks.

These macros now all return a value, if nonzero is returned
the check failed. K_OOPS() now wraps these calls to generate
a kernel oops.

At the moment, the policy for all APIs has not changed. They
still all oops upon a failed check/

The macros now use the Z_ notation for private APIs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-17 23:34:03 +03:00
Tomasz Bursztyka cd580e0bba drivers/adc: Uneven buffers will lead to buffer overflow
TI's ADC108S102 is a sampling on 16 bits, and thus requires the
destination buffer to be made of an even number of bytes.

Fixes #7389

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:30:29 +03:00
Adithya Baglody b0db28b512 drivers: Cmake: Add __ZEPHYR_SUPERVISOR__ macro for driver files.
Normally a syscall would check the current privilege level and then
decide to go to _impl_<syscall> directly or go through a
_handler_<syscall>.
__ZEPHYR_SUPERVISOR__ is a compiler optimization flag which will
make all the system calls from the driver files directly link
to the _impl_<syscall>. Thereby reducing the overhead of checking the
privileges.

In the previous implementation all the source files would be compiled
by zephyr_source() rule. This means that zephyr_* is a catchall CMake
library for source files that can be built purely with the include
paths, defines, and other compiler flags that all zephyr source
files uses. This states that adding one extra compiler flag for only
one complete directory would fail.
This limitation can be overcome by using zephyr_libray* APIs. This
creates a library for the required directories and it also supports
directory level properties.
Hence we use zephyr_library* to create a new library with
macro _ZEPHYR_SUPERVISOR_ for the optimization.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-15 17:48:18 +03:00
Andrew Boie 5dc2ab4f47 ti_adc108s102: validate num_entries
num_entries can be as large as 255. However, based on the
_ti_adc108s102 implementation, num_entries must be less than
ADC108S102_CMD_BUFFER_SIZE or the cmd_buffer[] and
sampling_buffer[] arrays in the data struct could overflow.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-07 22:27:28 -04:00
Andrew Boie 97ccf99b9b ti_adc108s102: fix verification off-by-one
Channel IDs start at 0, need to fail if the provided ID
equals ADC108S102_CHANNELS, not just larger than it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-07 22:27:28 -04:00
Leandro Pereira c200367b68 drivers: Perform a runtime check if a driver is capable of an operation
Driver APIs might not implement all operations, making it possible for
a user thread to get the kernel to execute a function at 0x00000000.

Perform runtime checks in all the driver handlers, checking if they're
capable of performing the requested operation.

Fixes #6907.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-26 02:57:12 +05:30
Tomasz Bursztyka d620c16a0d drivers/adc: Switch ti_adc108s102 driver to new SPI API
Replacing legacy API calls by news ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 324265420b api/spi: Disable legacy API by default
Let's start deprecation work of the SPI legacy API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Anas Nashif 8949233390 kconfig: fix more help spacing issues
Fix Kconfig help sections and add spacing to be consistent across all
Kconfig file. In a previous run we missed a few.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-15 23:20:55 -05:00
Anas Nashif f6aefe5f17 drivers: ti_adc108s102: remove newline from syslog messages
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-09 10:59:41 -05:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Andrew Boie c93a4789cb drivers: adc: add system call handlers
Straightforward conversion for adc_enable/disable.

adc_read() uses a sequence table, which points to an array
of struct adc_seq_entry, each element pointing
to memory buffers. Need to validate all of these as being readable
by the caller, and the buffers writable.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Jonas Pfaff b62a353551 drivers: adc: Add SAM ADC driver
Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Jira: ZEP-2507

Signed-off-by: Jonas Pfaff <jonas.pfaff@gmail.com>
2017-10-10 11:56:47 -05:00
Maureen Helm f7a37cea8d mcux: nxp_kinetis: Move HAS_ADC16 config to ext
SoCs outside the Kinetis family can have the ADC16 module, so move the
HAS_ADC16 config from arch/arm/soc/nxp_kinetis to ext/hal/nxp/mcux

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-09-25 12:31:59 -05:00
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