diff options
author | Alan Cox <alan@linux.intel.com> | 2017-02-17 16:55:17 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-06 09:39:54 +0100 |
commit | a49d25364dfb9f8a64037488a39ab1f56c5fa419 (patch) | |
tree | bd97382cf06a958cef045e75334fc622500ba209 /drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c | |
parent | 372499b589ae5ec38d3dec88b72f2bde3b3790d4 (diff) | |
download | op-kernel-dev-a49d25364dfb9f8a64037488a39ab1f56c5fa419.zip op-kernel-dev-a49d25364dfb9f8a64037488a39ab1f56c5fa419.tar.gz |
staging/atomisp: Add support for the Intel IPU v2
This patch adds support for the Intel IPU v2 as found on Android and IoT
Baytrail-T and Baytrail-CR platforms (those with the IPU PCI mapped). You
will also need the firmware files from your device (Android usually puts
them into /etc) - or you can find them in the downloadable restore/upgrade
kits if you blew them away for some reason.
It may be possible to extend the driver to handle the BYT/T windows
platforms such as the ASUS T100TA. These platforms don't expose the IPU via
the PCI interface but via ACPI buried in the GPU description and with the
camera information somewhere unknown so would need a platform driver
interface adding to the codebase *IFF* the firmware works on such devices.
To get good results you also need a suitable support library such as
libxcam. The camera is intended to be driven from Android so it has a lot of
features that many desktop apps don't fully spport.
In theory all the pieces are there to build it with -DISP2401 and some
differing files to get CherryTrail/T support, but unifying the drivers
properlly is a work in progress.
The IPU driver represents the work of a lot of people within Intel over many
years. It's historical goal was portability rather than Linux upstream. Any
queries about the upstream aimed driver should be sent to me not to the
original authors.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c')
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c new file mode 100644 index 0000000..0bfebce --- /dev/null +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c @@ -0,0 +1,84 @@ +/* + * Support for Intel Camera Imaging ISP subsystem. + * Copyright (c) 2015, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include "platform_support.h" + +#include "sh_css_hrt.h" +#include "ia_css_debug.h" + +#include "device_access.h" + +#define __INLINE_EVENT__ +#include "event_fifo.h" +#define __INLINE_SP__ +#include "sp.h" +#define __INLINE_ISP__ +#include "isp.h" +#define __INLINE_IRQ__ +#include "irq.h" +#define __INLINE_FIFO_MONITOR__ +#include "fifo_monitor.h" + +/* System independent */ +#include "sh_css_internal.h" + +bool sh_css_hrt_system_is_idle(void) +{ + bool not_idle = false, idle; + fifo_channel_t ch; + + idle = sp_ctrl_getbit(SP0_ID, SP_SC_REG, SP_IDLE_BIT); + not_idle |= !idle; + if (!idle) + IA_CSS_WARNING("SP not idle"); + + idle = isp_ctrl_getbit(ISP0_ID, ISP_SC_REG, ISP_IDLE_BIT); + not_idle |= !idle; + if (!idle) + IA_CSS_WARNING("ISP not idle"); + + for (ch=0; ch<N_FIFO_CHANNEL; ch++) { + fifo_channel_state_t state; + fifo_channel_get_state(FIFO_MONITOR0_ID, ch, &state); + if (state.fifo_valid) { + IA_CSS_WARNING("FIFO channel %d is not empty", ch); + not_idle = true; + } + } + + return !not_idle; +} + +enum ia_css_err sh_css_hrt_sp_wait(void) +{ +#if defined(HAS_IRQ_MAP_VERSION_2) + irq_sw_channel_id_t irq_id = IRQ_SW_CHANNEL0_ID; +#else + irq_sw_channel_id_t irq_id = IRQ_SW_CHANNEL2_ID; +#endif + /* + * Wait till SP is idle or till there is a SW2 interrupt + * The SW2 interrupt will be used when frameloop runs on SP + * and signals an event with similar meaning as SP idle + * (e.g. frame_done) + */ + while (!sp_ctrl_getbit(SP0_ID, SP_SC_REG, SP_IDLE_BIT) && + ((irq_reg_load(IRQ0_ID, + _HRT_IRQ_CONTROLLER_STATUS_REG_IDX) & + (1U<<(irq_id + IRQ_SW_CHANNEL_OFFSET))) == 0)) { + hrt_sleep(); + } + +return IA_CSS_SUCCESS; +} |