sensors: Add support for PixArt PS5520.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
iabdalkader 2025-03-28 17:03:31 +01:00
parent c89787552a
commit 6526f9412b
5 changed files with 1655 additions and 0 deletions

View File

@ -57,6 +57,7 @@
#include "pag7920.h" #include "pag7920.h"
#include "pag7936.h" #include "pag7936.h"
#include "paj6100.h" #include "paj6100.h"
#include "ps5520.h"
#include "frogeye2020.h" #include "frogeye2020.h"
#include "gc2145.h" #include "gc2145.h"
#include "genx320.h" #include "genx320.h"
@ -301,6 +302,12 @@ static int omv_csi_detect() {
csi.chip_id = ((csi.chip_id << 8) | (csi.chip_id >> 8)) & 0xFFFF; csi.chip_id = ((csi.chip_id << 8) | (csi.chip_id >> 8)) & 0xFFFF;
return slv_addr; return slv_addr;
#endif // (OMV_PAG7936_ENABLE == 1) #endif // (OMV_PAG7936_ENABLE == 1)
#if (OMV_PS5520_ENABLE == 1)
case PS5520_SLV_ADDR:
omv_i2c_readw2(&csi.i2c_bus, slv_addr, PIXART_CHIP_ID, (uint16_t *) &csi.chip_id);
return slv_addr;
#endif // (OMV_PS5520_ENABLE == 1)
} }
} }
@ -546,6 +553,15 @@ int omv_csi_probe_init(uint32_t bus_id, uint32_t bus_speed) {
break; break;
#endif // (OMV_PAJ6100_ENABLE == 1) #endif // (OMV_PAJ6100_ENABLE == 1)
#if (OMV_PS5520_ENABLE == 1)
case PS5520_ID:
if (omv_csi_set_clk_frequency(OMV_PS5520_CLK_FREQ) != 0) {
return OMV_CSI_ERROR_TIM_INIT_FAILED;
}
init_ret = ps5520_init(&csi);
break;
#endif // (OMV_PS5520_ENABLE == 1)
#if (OMV_FROGEYE2020_ENABLE == 1) #if (OMV_FROGEYE2020_ENABLE == 1)
case FROGEYE2020_ID: case FROGEYE2020_ID:
if (omv_csi_set_clk_frequency(OMV_FROGEYE2020_CLK_FREQ) != 0) { if (omv_csi_set_clk_frequency(OMV_FROGEYE2020_CLK_FREQ) != 0) {

View File

@ -51,6 +51,7 @@
#define PAG7920_SLV_ADDR (0x80) #define PAG7920_SLV_ADDR (0x80)
#define PAG7936_SLV_ADDR (0x80) #define PAG7936_SLV_ADDR (0x80)
#define SOFTCSI_SLV_ADDR (0x7f) #define SOFTCSI_SLV_ADDR (0x7f)
#define PS5520_SLV_ADDR (0x90)
// Chip ID Registers // Chip ID Registers
#define OV5640_CHIP_ID (0x300A) #define OV5640_CHIP_ID (0x300A)
@ -92,6 +93,7 @@
#define GENX320_ID_MP (0xB0602003) #define GENX320_ID_MP (0xB0602003)
#define PAG7920_ID (0x7920) #define PAG7920_ID (0x7920)
#define PAG7936_ID (0x7936) #define PAG7936_ID (0x7936)
#define PS5520_ID (0x5520)
#define PAJ6100_ID (0x6100) #define PAJ6100_ID (0x6100)
#define FROGEYE2020_ID (0x2020) #define FROGEYE2020_ID (0x2020)
#define SOFTCSI_ID (0x50F7) #define SOFTCSI_ID (0x50F7)

View File

@ -203,6 +203,7 @@ DRIVER_SRC_C += $(addprefix sensors/, \
ov9650.c \ ov9650.c \
pag7920.c \ pag7920.c \
pag7936.c \ pag7936.c \
ps5520.c \
paj6100.c \ paj6100.c \
softcsi.c \ softcsi.c \
) )

1599
drivers/sensors/ps5520.c Normal file

File diff suppressed because it is too large Load Diff

37
drivers/sensors/ps5520.h Normal file
View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2025 OpenMV, LLC.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Any redistribution, use, or modification in source or binary form
* is done solely for personal benefit and not for any commercial
* purpose or for monetary gain. For commercial licensing options,
* please contact openmv@openmv.io
*
* THIS SOFTWARE IS PROVIDED BY THE LICENSOR AND COPYRIGHT OWNER "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR OR COPYRIGHT
* OWNER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* PixArt PS5520 driver.
*/
#ifndef __PS5520_H__
#define __PS5520_H__
#define OMV_PS5520_CLK_FREQ (24000000)
int ps5520_init(omv_csi_t *csi);
#endif // __PS5520_H__