feat(camera): support GalaxyCore GC2385 (TA-1059) and GC2365 alongside GC2395 (TA-1048)
This commit is contained in:
1 parent
a2b8e46c43
commit
eef8584a8d
8 files changed
+109
-28
No files matched your search
@@ -18,7 +18,7 @@ It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) optimized f
|
|||||||
- `src/sxmo-st/`: patched `st` terminal with HarfBuzz OpenType ligatures (`Fira Code`), `XIM` (`fcitx5-t9`), and live `SIGUSR1` `.Xresources` reload.
|
- `src/sxmo-st/`: patched `st` terminal with HarfBuzz OpenType ligatures (`Fira Code`), `XIM` (`fcitx5-t9`), and live `SIGUSR1` `.Xresources` reload.
|
||||||
- `src/fcitx5-t9/`: 6-mode keypad input method (`abc`, `Abc`, `ABC`, `Sym`, `Ctl`, `123` + `*` long-press `Ctrl+` latch) with fixed bottom preedit bar (`Y=290, H=30`).
|
- `src/fcitx5-t9/`: 6-mode keypad input method (`abc`, `Abc`, `ABC`, `Sym`, `Ctl`, `123` + `*` long-press `Ctrl+` latch) with fixed bottom preedit bar (`Y=290, H=30`).
|
||||||
- `src/games/`: standalone keypad-driven `240x320` X11 games and emulators (`snake.cpp` -> `/usr/bin/snake`, `tetris.cpp` -> `/usr/bin/tetris`, `gambatte_phone.cpp` + `gambatte/` -> `/usr/bin/gambatte` / `/usr/bin/gbemu`) with built-in 5x7 bitmap fonts, `timerfd`-driven pacing, and offscreen `Pixmap` double buffering.
|
- `src/games/`: standalone keypad-driven `240x320` X11 games and emulators (`snake.cpp` -> `/usr/bin/snake`, `tetris.cpp` -> `/usr/bin/tetris`, `gambatte_phone.cpp` + `gambatte/` -> `/usr/bin/gambatte` / `/usr/bin/gbemu`) with built-in 5x7 bitmap fonts, `timerfd`-driven pacing, and offscreen `Pixmap` double buffering.
|
||||||
- `src/msm8905-cam/` & `src/leds-msm8905-torch/`: out-of-tree Linux `6.12.1-msm8916` kernel modules for the rear `GC2395` camera (`/dev/video0`) and `SY7807` torch LED (`white:torch`) / WCD codec init / PM8909 `PON` shutdown.
|
- `src/msm8905-cam/` & `src/leds-msm8905-torch/`: out-of-tree Linux `6.12.1-msm8916` kernel modules for the rear `GC2395` / `GC2385` / `GC2365` camera (`/dev/video0`) and `SY7807` torch LED (`white:torch`) / WCD codec init / PM8909 `PON` shutdown.
|
||||||
- `overlay/rootfs/`: system configuration overlay applied over the target rootfs (kept in sync with `prebuilt/`).
|
- `overlay/rootfs/`: system configuration overlay applied over the target rootfs (kept in sync with `prebuilt/`).
|
||||||
- `prebuilt/`: cross-compiled `armv7` binaries and kernel modules (`sxmo-x11`, `fcitx5-t9`, `xlibre`, `kernel-6.12.1-msm8916`, `bantam`, `games`).
|
- `prebuilt/`: cross-compiled `armv7` binaries and kernel modules (`sxmo-x11`, `fcitx5-t9`, `xlibre`, `kernel-6.12.1-msm8916`, `bantam`, `games`).
|
||||||
- `devices/` & `patches/`: device trees (`.dts`/`.dtb`), MIPI-DBI panel init sequences, and upstream patch sets.
|
- `devices/` & `patches/`: device trees (`.dts`/`.dtb`), MIPI-DBI panel init sequences, and upstream patch sets.
|
||||||
|
|||||||
+3
-2
@@ -36,8 +36,9 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
|
|||||||
- Standardized all Bananarchy `240x320` X11/Xft/Pango UI components, `.Xresources` / `~/.xthemes/*.xth` live theme resolution, offscreen `Pixmap` double buffering, FIFO IPC, softkey chord detection (`xdrawer`), and multi-tap input into a shared library (`/usr/lib/libneoui.so`) and header (`/usr/include/neoui.h`) with both C++20 classes and a C-compatible FFI (`neoui_*`).
|
- Standardized all Bananarchy `240x320` X11/Xft/Pango UI components, `.Xresources` / `~/.xthemes/*.xth` live theme resolution, offscreen `Pixmap` double buffering, FIFO IPC, softkey chord detection (`xdrawer`), and multi-tap input into a shared library (`/usr/lib/libneoui.so`) and header (`/usr/include/neoui.h`) with both C++20 classes and a C-compatible FFI (`neoui_*`).
|
||||||
- Migrated all 14 custom GUI plugins (`xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`) to use `NeoUI`.
|
- Migrated all 14 custom GUI plugins (`xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`) to use `NeoUI`.
|
||||||
- Added a complete Yabasic native C FFI wrapper (`~/Projects/neoui.yab`, symlinked at `/usr/lib/neoui.yab`), an interactive 3-tab UI showcase program (`~/Projects/neoui_demo.yab`), a `libcurl` + socket FFI networking library for Yabasic (`~/Projects/neonet.yab`, symlinked at `/usr/lib/neonet.yab`) supporting HTTP/HTTPS requests with custom headers and raw TCP/TLS/UDP socket data exchange, a combined NeoNet + NeoUI demo (`~/Projects/neonet_demo.yab`), and full SDK documentation in `SDK.md`.
|
- Added a complete Yabasic native C FFI wrapper (`~/Projects/neoui.yab`, symlinked at `/usr/lib/neoui.yab`), an interactive 3-tab UI showcase program (`~/Projects/neoui_demo.yab`), a `libcurl` + socket FFI networking library for Yabasic (`~/Projects/neonet.yab`, symlinked at `/usr/lib/neonet.yab`) supporting HTTP/HTTPS requests with custom headers and raw TCP/TLS/UDP socket data exchange, a combined NeoNet + NeoUI demo (`~/Projects/neonet_demo.yab`), and full SDK documentation in `SDK.md`.
|
||||||
- **Camera viewfinder and capture orientation fix (`xcamera` and `bananarchy-photo`)**:
|
- **Camera sensor support and orientation fix (`msm8905-cam`, `xcamera`, and `bananarchy-photo`)**:
|
||||||
- Rotated the raw `800x600` `GC2395` sensor frames 90 degrees clockwise in both the live `240x180` 4:3 viewfinder (`downscaleViewfinder800x600To240x180`) and captured JPEG photos (`600x800` portrait output in `xcamera` and `bananarchy-photo`).
|
- Extended `msm8905-cam` (`/dev/video0`) to support the GalaxyCore `GC2385` (`0x2385`, used on Nokia 8110 4G `TA-1059`) and `GC2365` (`0x2365`) 2MP MIPI CSI-2 camera sensors alongside `GC2395` (`0x2395`, used on `TA-1048`).
|
||||||
|
- Rotated the raw `800x600` `GC2395`/`GC2385`/`GC2365` sensor frames 90 degrees clockwise in both the live `240x180` 4:3 viewfinder (`downscaleViewfinder800x600To240x180`) and captured JPEG photos (`600x800` portrait output in `xcamera` and `bananarchy-photo`).
|
||||||
- **Window management, context menu, and `fcitx5` XIM stability fixes**:
|
- **Window management, context menu, and `fcitx5` XIM stability fixes**:
|
||||||
- Added direct C-level `_BANANARCHY_DWM_CMD` IPC between `dmenu` and `dwm` for instant window management (`Kill window`, `Close Terminal`, `Move to WS 1..4`, `Go to WS 1..4`, `Shift stack`, `Swap stack`, `Toggle Layout`) and restored application context menus (`Right softkey` inside `st`, `nano`, and X11 apps).
|
- Added direct C-level `_BANANARCHY_DWM_CMD` IPC between `dmenu` and `dwm` for instant window management (`Kill window`, `Close Terminal`, `Move to WS 1..4`, `Go to WS 1..4`, `Shift stack`, `Swap stack`, `Toggle Layout`) and restored application context menus (`Right softkey` inside `st`, `nano`, and X11 apps).
|
||||||
- Updated the `fcitx5` `superd` service wrapper (`bananarchy-fcitx5.sh`) and XIM environment propagation across `st`, `dmenu`, and `dwm-plugin` so T9 keypad input stays supervised and active across all terminal and menu sessions.
|
- Updated the `fcitx5` `superd` service wrapper (`bananarchy-fcitx5.sh`) and XIM environment propagation across `st`, `dmenu`, and `dwm-plugin` so T9 keypad input stays supervised and active across all terminal and menu sessions.
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ This manual covers flashing, operating, and customizing **Bananarchy Linux** (`2
|
|||||||
- `fcitx5-t9` provides 6 keypad input modes (`abc`, `Abc`, `ABC`, `Sym`, `Ctl`, `123` + `*` long-press `Ctrl+` latch) in a fixed bottom candidate bar (`Y = 290, H = 30`).
|
- `fcitx5-t9` provides 6 keypad input modes (`abc`, `Abc`, `ABC`, `Sym`, `Ctl`, `123` + `*` long-press `Ctrl+` latch) in a fixed bottom candidate bar (`Y = 290, H = 30`).
|
||||||
4. **Mainline Linux 6.12 hardware drivers**:
|
4. **Mainline Linux 6.12 hardware drivers**:
|
||||||
- **QDSP6 / Q6Voice audio and Dual-SIM modem**: loudspeaker, boosted (+6 dB) earpiece, internal MEMS and headset microphones, `ModemManager` + `q6voiced` call audio routing, and direct Qualcomm QMI UIM Dual-SIM Dual Standby (DSDS), instant default SIM switching, Primary/Secondary GW (`4G/Data`) slot swapping, PIN/PUK management, and SIM phonebook access.
|
- **QDSP6 / Q6Voice audio and Dual-SIM modem**: loudspeaker, boosted (+6 dB) earpiece, internal MEMS and headset microphones, `ModemManager` + `q6voiced` call audio routing, and direct Qualcomm QMI UIM Dual-SIM Dual Standby (DSDS), instant default SIM switching, Primary/Secondary GW (`4G/Data`) slot swapping, PIN/PUK management, and SIM phonebook access.
|
||||||
- **Rear 2MP camera and torch LED**: `msm8905-cam` V4L2 driver (`/dev/video0` `800x600` `RGB3` for GalaxyCore `GC2395`) and `leds-msm8905-torch` (`white:torch` + PM8909 clean poweroff).
|
- **Rear 2MP camera and torch LED**: `msm8905-cam` V4L2 driver (`/dev/video0` `800x600` `RGB3` for GalaxyCore `GC2395` / `GC2385` / `GC2365`) and `leds-msm8905-torch` (`white:torch` + PM8909 clean poweroff).
|
||||||
5. **Preinstalled developer and utility stack**:
|
5. **Preinstalled developer and utility stack**:
|
||||||
- `gcc`/`g++`, `make`, `git`, GNU `coreutils`, GNU `bc`/`dc`, `nano`, `ed`, `less`, `rlwrap`, `lua` (`5.5` and `5.4`), `yabasic`, `janet` + `jpm`, `bantam` coding agent, `perl` (`IO::Socket::SSL`), `tcl` (`tcllib`, `tcl-tls`, `sqlite-tcl`), `sqlite3`, `frotz`, `ffmpeg`, `mpv`, `imv`, standalone `snake` and `tetris` X11 games, and the `gambatte` Game Boy / Game Boy Color emulator.
|
- `gcc`/`g++`, `make`, `git`, GNU `coreutils`, GNU `bc`/`dc`, `nano`, `ed`, `less`, `rlwrap`, `lua` (`5.5` and `5.4`), `yabasic`, `janet` + `jpm`, `bantam` coding agent, `perl` (`IO::Socket::SSL`), `tcl` (`tcllib`, `tcl-tls`, `sqlite-tcl`), `sqlite3`, `frotz`, `ffmpeg`, `mpv`, `imv`, standalone `snake` and `tetris` X11 games, and the `gambatte` Game Boy / Game Boy Color emulator.
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ All fifteen phone applications are compiled as shared-object plugins (`/usr/lib/
|
|||||||
|
|
||||||
9. **Camera (`camera.so` / `xcamera`)**:
|
9. **Camera (`camera.so` / `xcamera`)**:
|
||||||
- **Open**: select **Camera** from the System menu or run `xcamera`.
|
- **Open**: select **Camera** from the System menu or run `xcamera`.
|
||||||
- **Viewfinder and gallery**: streams live `800x600` frames from `/dev/video0` (`GC2395`) into a `240x180` 4:3 viewfinder. Press **Center `OK`**, **`5`**, or **Call (green)** to capture a JPEG to `~/Pictures/photo-YYYYMMDD-HHMMSS.jpg`; `*` or `1` toggles **Auto-Flash**; `0` or `2` toggles continuous **Torch**; `Up`/`Down` adjusts **Digital Zoom** (`1.0x` / `2.0x` / `4.0x`); `#` or `3` toggles the **3-second Self-Timer**; **Left softkey (`Gallery`)** opens the built-in photo gallery.
|
- **Viewfinder and gallery**: streams live `800x600` frames from `/dev/video0` (`GC2395` / `GC2385` / `GC2365`) into a `240x180` 4:3 viewfinder. Press **Center `OK`**, **`5`**, or **Call (green)** to capture a JPEG to `~/Pictures/photo-YYYYMMDD-HHMMSS.jpg`; `*` or `1` toggles **Auto-Flash**; `0` or `2` toggles continuous **Torch**; `Up`/`Down` adjusts **Digital Zoom** (`1.0x` / `2.0x` / `4.0x`); `#` or `3` toggles the **3-second Self-Timer**; **Left softkey (`Gallery`)** opens the built-in photo gallery.
|
||||||
|
|
||||||
10. **Theme manager (`themes.so` / `xthemes`)**:
|
10. **Theme manager (`themes.so` / `xthemes`)**:
|
||||||
- **Open**: select **Themes** from the System, Apps, or Config menu, or run `xthemes`.
|
- **Open**: select **Themes** from the System, Apps, or Config menu, or run `xthemes`.
|
||||||
@@ -330,7 +330,7 @@ Two classic X11 games (`/usr/bin/snake` and `/usr/bin/tetris`) and the full-feat
|
|||||||
|
|
||||||
### 5.1 Taking photos from the CLI (`bananarchy-photo` and `/dev/video0`)
|
### 5.1 Taking photos from the CLI (`bananarchy-photo` and `/dev/video0`)
|
||||||
|
|
||||||
The `msm8905-cam` kernel module drives the rear 2MP GalaxyCore `GC2395` sensor through MSM8909 `CAMSS` and registers `/dev/video0` (`800x600` 24-bit `RGB3`).
|
The `msm8905-cam` kernel module drives the rear 2MP GalaxyCore `GC2395` (TA-1048), `GC2385` (TA-1059), and `GC2365` sensors through MSM8909 `CAMSS` and registers `/dev/video0` (`800x600` 24-bit `RGB3`).
|
||||||
|
|
||||||
- **Using `bananarchy-photo`**:
|
- **Using `bananarchy-photo`**:
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
## Key features
|
## Key features
|
||||||
|
|
||||||
### System and hardware support
|
### System and hardware support
|
||||||
- **Mainline Linux 6.12 kernel**: custom patches and out-of-tree drivers for Qualcomm QDSP6/Q6Voice audio routing, Dual-SIM modem control, the rear 2MP GalaxyCore `GC2395` camera (`/dev/video0`), the `SY7807` flashlight LED (`white:torch`), physical keypad/slider events, and clean PM8909 poweroff.
|
- **Mainline Linux 6.12 kernel**: custom patches and out-of-tree drivers for Qualcomm QDSP6/Q6Voice audio routing, Dual-SIM modem control, the rear 2MP GalaxyCore `GC2395` / `GC2385` / `GC2365` camera (`/dev/video0`), the `SY7807` flashlight LED (`white:torch`), physical keypad/slider events, and clean PM8909 poweroff.
|
||||||
- **Alpine Linux Edge base**: full access to the Alpine package ecosystem with `< 95 MB` idle RAM usage on 512 MB devices and full local root access out of the box.
|
- **Alpine Linux Edge base**: full access to the Alpine package ecosystem with `< 95 MB` idle RAM usage on 512 MB devices and full local root access out of the box.
|
||||||
- **Pure X11 graphical stack**: cross-compiled **Xlibre** (`X11Libre/xserver`) display server paired with a customized **Sxmo (`sxmo-de-dwm`)** window manager (`240x320` vertical stack layout, Conky desktop clock and system status widget, `< 2 ms` slider/key wake latency, and zero Wayland overhead).
|
- **Pure X11 graphical stack**: cross-compiled **Xlibre** (`X11Libre/xserver`) display server paired with a customized **Sxmo (`sxmo-de-dwm`)** window manager (`240x320` vertical stack layout, Conky desktop clock and system status widget, `< 2 ms` slider/key wake latency, and zero Wayland overhead).
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ bananarchy/
|
|||||||
│ ├── fcitx5-t9/ # 6-mode fcitx5-t9 keypad input method
|
│ ├── fcitx5-t9/ # 6-mode fcitx5-t9 keypad input method
|
||||||
│ ├── games/ # Standalone keypad X11 games and Gambatte GB/GBC emulator (snake, tetris, gambatte)
|
│ ├── games/ # Standalone keypad X11 games and Gambatte GB/GBC emulator (snake, tetris, gambatte)
|
||||||
│ ├── leds-msm8905-torch/ # Kernel driver for SY7807 torch LED, WCD codec init, and PON shutdown
|
│ ├── leds-msm8905-torch/ # Kernel driver for SY7807 torch LED, WCD codec init, and PON shutdown
|
||||||
│ └── msm8905-cam/ # Kernel V4L2 driver for GC2395 2MP rear camera (/dev/video0)
|
│ └── msm8905-cam/ # Kernel V4L2 driver for GC2395/GC2385/GC2365 2MP rear camera (/dev/video0)
|
||||||
├── overlay/rootfs/ # System configuration overlay applied over the target rootfs
|
├── overlay/rootfs/ # System configuration overlay applied over the target rootfs
|
||||||
├── prebuilt/ # Pre-compiled armv7 binaries and kernel modules
|
├── prebuilt/ # Pre-compiled armv7 binaries and kernel modules
|
||||||
└── scripts/ # Cross-compilation, artwork generation, version, and overlay scripts
|
└── scripts/ # Cross-compilation, artwork generation, version, and overlay scripts
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Bananarchy rear camera photo capture utility and Sxmo menu wrapper
|
# Bananarchy rear camera photo capture utility and Sxmo menu wrapper
|
||||||
# Captures 800x600 24-bit RGB frames from /dev/video0 (msm8905-cam / GC2395)
|
# Captures 800x600 24-bit RGB frames from /dev/video0 (msm8905-cam / GC2395/GC2385/GC2365)
|
||||||
# via v4l2-ctl and encodes JPEG/PNG images via ffmpeg -f rawvideo.
|
# via v4l2-ctl and encodes JPEG/PNG images via ffmpeg -f rawvideo.
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -2,7 +2,8 @@
|
|||||||
/*
|
/*
|
||||||
* Qualcomm MSM8905 / Nokia 8110 4G (nokia-argon) Rear Camera V4L2 Driver
|
* Qualcomm MSM8905 / Nokia 8110 4G (nokia-argon) Rear Camera V4L2 Driver
|
||||||
*
|
*
|
||||||
* Drives the GalaxyCore GC2395 2MP MIPI CSI-2 sensor on BLSP1 I2C3 (GPIO 29/30)
|
* Drives the GalaxyCore GC2395 (TA-1048), GC2385 (TA-1059), and GC2365 2MP
|
||||||
|
* MIPI CSI-2 sensors on BLSP1 I2C3 (GPIO 29/30)
|
||||||
* through MSM8909 CAMSS (CSIPHY0 -> CSID0 -> ISPIF RDI0 -> VFE0 WM0 -> VBIF)
|
* through MSM8909 CAMSS (CSIPHY0 -> CSID0 -> ISPIF RDI0 -> VFE0 WM0 -> VBIF)
|
||||||
* and exposes /dev/video0 (800x600 RGB24 V4L2 capture device).
|
* and exposes /dev/video0 (800x600 RGB24 V4L2 capture device).
|
||||||
*/
|
*/
|
||||||
@@ -71,11 +72,16 @@
|
|||||||
#define ISPIF_BASE 0x0a000U
|
#define ISPIF_BASE 0x0a000U
|
||||||
#define VFE0_BASE 0x10000U
|
#define VFE0_BASE 0x10000U
|
||||||
|
|
||||||
|
#define GC2395_CHIP_ID 0x2395U
|
||||||
|
#define GC2385_CHIP_ID 0x2385U
|
||||||
|
#define GC2365_CHIP_ID 0x2365U
|
||||||
|
|
||||||
struct gc2395_reg {
|
struct gc2395_reg {
|
||||||
u8 reg;
|
u8 reg;
|
||||||
u8 val;
|
u8 val;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Shared 1600x1200 RAW10 MIPI CSI-2 init table for GC2395 (TA-1048) and GC2385 (TA-1059) */
|
||||||
static const struct gc2395_reg gc2395_init_regs[] = {
|
static const struct gc2395_reg gc2395_init_regs[] = {
|
||||||
{ 0xfe, 0x00 }, { 0xfe, 0x00 }, { 0xfe, 0x00 }, { 0xf2, 0x02 },
|
{ 0xfe, 0x00 }, { 0xfe, 0x00 }, { 0xfe, 0x00 }, { 0xf2, 0x02 },
|
||||||
{ 0xf4, 0x03 }, { 0xf7, 0x01 }, { 0xf8, 0x28 }, { 0xf9, 0x02 },
|
{ 0xf4, 0x03 }, { 0xf7, 0x01 }, { 0xf8, 0x28 }, { 0xf9, 0x02 },
|
||||||
@@ -100,6 +106,41 @@ static const struct gc2395_reg gc2395_init_regs[] = {
|
|||||||
{ 0x29, 0x06 }, { 0x2a, 0x08 }, { 0x2b, 0x06 }, { 0xfe, 0x00 },
|
{ 0x29, 0x06 }, { 0x2a, 0x08 }, { 0x2b, 0x06 }, { 0xfe, 0x00 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* 1600x1200 RAW10 MIPI CSI-2 init table for GC2365 */
|
||||||
|
static const struct gc2395_reg gc2365_init_regs[] = {
|
||||||
|
{ 0xfe, 0x00 }, { 0xfe, 0x00 }, { 0xfe, 0x00 }, { 0xf7, 0x01 },
|
||||||
|
{ 0xf8, 0x0d }, { 0xf9, 0x4a }, { 0xfa, 0x80 }, { 0xfc, 0x8e },
|
||||||
|
{ 0xfe, 0x00 }, { 0xfe, 0x00 }, { 0xfe, 0x00 }, { 0x88, 0x03 },
|
||||||
|
{ 0xfe, 0x00 }, { 0x03, 0x04 }, { 0x04, 0x62 }, { 0x05, 0x02 },
|
||||||
|
{ 0x06, 0xbc }, { 0x07, 0x02 }, { 0x08, 0x00 }, { 0x0a, 0x0a },
|
||||||
|
{ 0x0c, 0x12 }, { 0x0d, 0x04 }, { 0x0e, 0xb8 }, { 0x0f, 0x06 },
|
||||||
|
{ 0x10, 0x50 }, { 0x17, 0xc0 }, { 0x1b, 0x11 }, { 0x1d, 0x0f },
|
||||||
|
{ 0x1f, 0x16 }, { 0x22, 0x50 }, { 0x27, 0x76 }, { 0x2b, 0x28 },
|
||||||
|
{ 0x2c, 0x40 }, { 0x2e, 0x8f }, { 0x2f, 0xd5 }, { 0x32, 0x05 },
|
||||||
|
{ 0x33, 0x50 }, { 0x37, 0x28 }, { 0x38, 0x50 }, { 0x39, 0x80 },
|
||||||
|
{ 0x3d, 0x18 }, { 0x3e, 0x1d }, { 0x3f, 0x50 }, { 0x75, 0x8e },
|
||||||
|
{ 0x76, 0x08 }, { 0x77, 0x5d }, { 0x78, 0x09 }, { 0x79, 0xb3 },
|
||||||
|
{ 0x7a, 0x24 }, { 0x8a, 0x3f }, { 0xc0, 0xb0 }, { 0xc1, 0x13 },
|
||||||
|
{ 0xc2, 0x00 }, { 0xc3, 0x2c }, { 0xc4, 0x4b }, { 0xe0, 0x02 },
|
||||||
|
{ 0xe1, 0x02 }, { 0xe2, 0x02 }, { 0xe3, 0x02 }, { 0xe4, 0x02 },
|
||||||
|
{ 0xe5, 0x02 }, { 0xe6, 0x02 }, { 0xe7, 0x02 }, { 0xe8, 0x07 },
|
||||||
|
{ 0x28, 0xf0 }, { 0x90, 0x01 }, { 0x92, 0x03 }, { 0x94, 0x02 },
|
||||||
|
{ 0x95, 0x04 }, { 0x96, 0xb0 }, { 0x97, 0x06 }, { 0x98, 0x40 },
|
||||||
|
{ 0x18, 0x02 }, { 0x40, 0x22 }, { 0x41, 0x01 }, { 0x43, 0x07 },
|
||||||
|
{ 0x4c, 0x00 }, { 0x4d, 0x03 }, { 0x4e, 0x3c }, { 0x4f, 0x3c },
|
||||||
|
{ 0x60, 0x00 }, { 0x61, 0x80 }, { 0x84, 0x00 }, { 0x85, 0x20 },
|
||||||
|
{ 0x87, 0x30 }, { 0xa0, 0x01 }, { 0xa1, 0x02 }, { 0xbd, 0x01 },
|
||||||
|
{ 0xbe, 0x02 }, { 0xb0, 0x60 }, { 0xb1, 0x02 }, { 0xb2, 0x80 },
|
||||||
|
{ 0xb3, 0x40 }, { 0xb4, 0x40 }, { 0xb5, 0x40 }, { 0xb6, 0x00 },
|
||||||
|
{ 0x66, 0xc7 }, { 0x72, 0xff }, { 0x74, 0xff }, { 0xfe, 0x03 },
|
||||||
|
{ 0x10, 0x00 }, { 0x01, 0x03 }, { 0x02, 0x32 }, { 0x03, 0x90 },
|
||||||
|
{ 0x04, 0x04 }, { 0x05, 0x00 }, { 0x06, 0x80 }, { 0x11, 0x2b },
|
||||||
|
{ 0x12, 0xd0 }, { 0x13, 0x07 }, { 0x15, 0x00 }, { 0x21, 0x08 },
|
||||||
|
{ 0x22, 0x05 }, { 0x23, 0x13 }, { 0x24, 0x02 }, { 0x25, 0x13 },
|
||||||
|
{ 0x26, 0x08 }, { 0x29, 0x04 }, { 0x2a, 0x08 }, { 0x2b, 0x08 },
|
||||||
|
{ 0xfe, 0x00 },
|
||||||
|
};
|
||||||
|
|
||||||
static const u32 camss_cbcr_offsets[] = {
|
static const u32 camss_cbcr_offsets[] = {
|
||||||
0x56004U, 0x5a014U, 0x50004U,
|
0x56004U, 0x5a014U, 0x50004U,
|
||||||
0x58038U, 0x58044U, 0x58048U, 0x58050U,
|
0x58038U, 0x58044U, 0x58048U, 0x58050U,
|
||||||
@@ -127,6 +168,7 @@ struct msm8905_cam_dev {
|
|||||||
bool buf_queued[CAM_MAX_MMAP_BUFS];
|
bool buf_queued[CAM_MAX_MMAP_BUFS];
|
||||||
u32 num_bufs;
|
u32 num_bufs;
|
||||||
u32 sequence;
|
u32 sequence;
|
||||||
|
u16 chip_id;
|
||||||
bool streaming;
|
bool streaming;
|
||||||
bool hw_initialized;
|
bool hw_initialized;
|
||||||
};
|
};
|
||||||
@@ -314,6 +356,31 @@ static void gc2395_write_reg(struct msm8905_cam_dev *cam, u8 reg, u8 val)
|
|||||||
cam_i2c_stop(cam);
|
cam_i2c_stop(cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gc23xx_stream_on(struct msm8905_cam_dev *cam)
|
||||||
|
{
|
||||||
|
if (cam->chip_id == GC2365_CHIP_ID) {
|
||||||
|
gc2395_write_reg(cam, 0xfeU, 0x03U);
|
||||||
|
gc2395_write_reg(cam, 0x10U, 0x90U);
|
||||||
|
gc2395_write_reg(cam, 0xfeU, 0x00U);
|
||||||
|
} else {
|
||||||
|
gc2395_write_reg(cam, 0xfeU, 0x00U);
|
||||||
|
gc2395_write_reg(cam, 0xedU, 0x90U);
|
||||||
|
gc2395_write_reg(cam, 0xfeU, 0x00U);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gc23xx_stream_off(struct msm8905_cam_dev *cam)
|
||||||
|
{
|
||||||
|
if (cam->chip_id == GC2365_CHIP_ID) {
|
||||||
|
gc2395_write_reg(cam, 0xfeU, 0x03U);
|
||||||
|
gc2395_write_reg(cam, 0x10U, 0x00U);
|
||||||
|
gc2395_write_reg(cam, 0xfeU, 0x00U);
|
||||||
|
} else {
|
||||||
|
gc2395_write_reg(cam, 0xfeU, 0x00U);
|
||||||
|
gc2395_write_reg(cam, 0xedU, 0x00U);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void msm8905_cam_enable_clocks(struct msm8905_cam_dev *cam)
|
static void msm8905_cam_enable_clocks(struct msm8905_cam_dev *cam)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
@@ -372,7 +439,7 @@ static int msm8905_cam_hw_init(struct msm8905_cam_dev *cam)
|
|||||||
for (i = 0; i < ARRAY_SIZE(camss_cbcr_offsets); i++)
|
for (i = 0; i < ARRAY_SIZE(camss_cbcr_offsets); i++)
|
||||||
cam_enable_cbcr(cam, camss_cbcr_offsets[i]);
|
cam_enable_cbcr(cam, camss_cbcr_offsets[i]);
|
||||||
|
|
||||||
/* 4. Power on GC2395 sensor */
|
/* 4. Power on GalaxyCore GC2395 / GC2385 / GC2365 sensor */
|
||||||
cam_gpio_cfg(cam, GPIO_CAM_STANDBY, 0x200U);
|
cam_gpio_cfg(cam, GPIO_CAM_STANDBY, 0x200U);
|
||||||
cam_gpio_cfg(cam, GPIO_CAM_RESET, 0x200U);
|
cam_gpio_cfg(cam, GPIO_CAM_RESET, 0x200U);
|
||||||
cam_gpio_cfg(cam, GPIO_CAM_VDIG, 0x200U);
|
cam_gpio_cfg(cam, GPIO_CAM_VDIG, 0x200U);
|
||||||
@@ -386,13 +453,23 @@ static int msm8905_cam_hw_init(struct msm8905_cam_dev *cam)
|
|||||||
usleep_range(15000, 18000);
|
usleep_range(15000, 18000);
|
||||||
|
|
||||||
chip_id = ((u16)gc2395_read_reg(cam, 0xf0U) << 8) | gc2395_read_reg(cam, 0xf1U);
|
chip_id = ((u16)gc2395_read_reg(cam, 0xf0U) << 8) | gc2395_read_reg(cam, 0xf1U);
|
||||||
if (chip_id != 0x2395U) {
|
if (chip_id != GC2395_CHIP_ID && chip_id != GC2385_CHIP_ID &&
|
||||||
dev_err(&cam->pdev->dev, "GC2395 chip ID mismatch: 0x%04x\n", chip_id);
|
chip_id != GC2365_CHIP_ID) {
|
||||||
|
dev_err(&cam->pdev->dev,
|
||||||
|
"GalaxyCore chip ID mismatch: 0x%04x (expected 0x2395/0x2385/0x2365)\n",
|
||||||
|
chip_id);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
cam->chip_id = chip_id;
|
||||||
|
dev_info(&cam->pdev->dev, "detected GalaxyCore GC%04x sensor\n", chip_id);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(gc2395_init_regs); i++)
|
if (chip_id == GC2365_CHIP_ID) {
|
||||||
gc2395_write_reg(cam, gc2395_init_regs[i].reg, gc2395_init_regs[i].val);
|
for (i = 0; i < ARRAY_SIZE(gc2365_init_regs); i++)
|
||||||
|
gc2395_write_reg(cam, gc2365_init_regs[i].reg, gc2365_init_regs[i].val);
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < ARRAY_SIZE(gc2395_init_regs); i++)
|
||||||
|
gc2395_write_reg(cam, gc2395_init_regs[i].reg, gc2395_init_regs[i].val);
|
||||||
|
}
|
||||||
|
|
||||||
/* 5. CSI_CLK_MUX */
|
/* 5. CSI_CLK_MUX */
|
||||||
cam_w32(cam->camss_base, 0x0030U, 0x0U);
|
cam_w32(cam->camss_base, 0x0030U, 0x0U);
|
||||||
@@ -523,11 +600,10 @@ static int msm8905_cam_capture_rgb(struct msm8905_cam_dev *cam, u8 *dst_rgb)
|
|||||||
msm8905_cam_enable_clocks(cam);
|
msm8905_cam_enable_clocks(cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure GC2395 stream and ISPIF/VFE0 are idle before arming next frame */
|
/* Ensure sensor MIPI stream and ISPIF/VFE0 are idle before arming next frame */
|
||||||
cam_w32(cam->camss_base, ISPIF_BASE + 0x248U, 0xaaaaaaaaU);
|
cam_w32(cam->camss_base, ISPIF_BASE + 0x248U, 0xaaaaaaaaU);
|
||||||
wmb();
|
wmb();
|
||||||
gc2395_write_reg(cam, 0xfeU, 0x00U);
|
gc23xx_stream_off(cam);
|
||||||
gc2395_write_reg(cam, 0xedU, 0x00U);
|
|
||||||
usleep_range(600, 900);
|
usleep_range(600, 900);
|
||||||
cam_w32(cam->camss_base, VFE0_BASE + 0x04cU, 0x00000000U);
|
cam_w32(cam->camss_base, VFE0_BASE + 0x04cU, 0x00000000U);
|
||||||
cam_w32(cam->camss_base, VFE0_BASE + 0x6fcU, 0x00000000U);
|
cam_w32(cam->camss_base, VFE0_BASE + 0x6fcU, 0x00000000U);
|
||||||
@@ -564,13 +640,11 @@ static int msm8905_cam_capture_rgb(struct msm8905_cam_dev *cam, u8 *dst_rgb)
|
|||||||
cam_w32(cam->camss_base, VFE0_BASE + 0x018U, 0x00000001U);
|
cam_w32(cam->camss_base, VFE0_BASE + 0x018U, 0x00000001U);
|
||||||
cam_w32(cam->camss_base, VFE0_BASE + 0x260U, 0x00000002U);
|
cam_w32(cam->camss_base, VFE0_BASE + 0x260U, 0x00000002U);
|
||||||
|
|
||||||
/* Enable ISPIF RDI0 on frame boundary and start GC2395 MIPI stream */
|
/* Enable ISPIF RDI0 on frame boundary and start sensor MIPI stream */
|
||||||
cam_w32(cam->camss_base, ISPIF_BASE + 0x248U, 0xfffffdffU);
|
cam_w32(cam->camss_base, ISPIF_BASE + 0x248U, 0xfffffdffU);
|
||||||
wmb();
|
wmb();
|
||||||
|
|
||||||
gc2395_write_reg(cam, 0xfeU, 0x00U);
|
gc23xx_stream_on(cam);
|
||||||
gc2395_write_reg(cam, 0xedU, 0x90U);
|
|
||||||
gc2395_write_reg(cam, 0xfeU, 0x00U);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Poll for WM0 PING_PONG_IRQ (bit 6 = 0x40) with sub-millisecond sleep so we
|
* Poll for WM0 PING_PONG_IRQ (bit 6 = 0x40) with sub-millisecond sleep so we
|
||||||
@@ -586,14 +660,13 @@ static int msm8905_cam_capture_rgb(struct msm8905_cam_dev *cam, u8 *dst_rgb)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* 1. Gate ISPIF at frame boundary FIRST so VFE0 never receives a partial frame.
|
* 1. Gate ISPIF at frame boundary FIRST so VFE0 never receives a partial frame.
|
||||||
* 2. Stop GC2395 MIPI stream during VBLANK (LP-11 state).
|
* 2. Stop sensor MIPI stream during VBLANK (LP-11 state).
|
||||||
* 3. Wait for VFE0 WM0 / VBIF AXI write bursts to drain completely before
|
* 3. Wait for VFE0 WM0 / VBIF AXI write bursts to drain completely before
|
||||||
* clearing WM0_CFG and RDI0_CFG.
|
* clearing WM0_CFG and RDI0_CFG.
|
||||||
*/
|
*/
|
||||||
cam_w32(cam->camss_base, ISPIF_BASE + 0x248U, 0xaaaaaaaaU);
|
cam_w32(cam->camss_base, ISPIF_BASE + 0x248U, 0xaaaaaaaaU);
|
||||||
wmb();
|
wmb();
|
||||||
gc2395_write_reg(cam, 0xfeU, 0x00U);
|
gc23xx_stream_off(cam);
|
||||||
gc2395_write_reg(cam, 0xedU, 0x00U);
|
|
||||||
usleep_range(800, 1200);
|
usleep_range(800, 1200);
|
||||||
cam_w32(cam->camss_base, VFE0_BASE + 0x04cU, 0x00000000U);
|
cam_w32(cam->camss_base, VFE0_BASE + 0x04cU, 0x00000000U);
|
||||||
cam_w32(cam->camss_base, VFE0_BASE + 0x6fcU, 0x00000000U);
|
cam_w32(cam->camss_base, VFE0_BASE + 0x6fcU, 0x00000000U);
|
||||||
@@ -689,9 +762,16 @@ static int msm8905_cam_enum_frameintervals(struct file *file, void *priv,
|
|||||||
static int msm8905_cam_enum_input(struct file *file, void *priv,
|
static int msm8905_cam_enum_input(struct file *file, void *priv,
|
||||||
struct v4l2_input *inp)
|
struct v4l2_input *inp)
|
||||||
{
|
{
|
||||||
|
struct msm8905_cam_dev *cam = video_drvdata(file);
|
||||||
|
|
||||||
if (inp->index > 0)
|
if (inp->index > 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
strscpy(inp->name, "GC2395 Rear Camera", sizeof(inp->name));
|
if (cam->chip_id == GC2385_CHIP_ID)
|
||||||
|
strscpy(inp->name, "GC2385 Rear Camera", sizeof(inp->name));
|
||||||
|
else if (cam->chip_id == GC2365_CHIP_ID)
|
||||||
|
strscpy(inp->name, "GC2365 Rear Camera", sizeof(inp->name));
|
||||||
|
else
|
||||||
|
strscpy(inp->name, "GC2395 Rear Camera", sizeof(inp->name));
|
||||||
inp->type = V4L2_INPUT_TYPE_CAMERA;
|
inp->type = V4L2_INPUT_TYPE_CAMERA;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1017,7 +1097,7 @@ static int __init msm8905_cam_init(void)
|
|||||||
goto err_v4l2;
|
goto err_v4l2;
|
||||||
|
|
||||||
g_cam = cam;
|
g_cam = cam;
|
||||||
pr_info("msm8905-cam: registered /dev/video%d (GC2395 800x600 RGB24, dma=0x%08llx)\n",
|
pr_info("msm8905-cam: registered /dev/video%d (GC2395/GC2385 800x600 RGB24, dma=0x%08llx)\n",
|
||||||
cam->vdev.num, (unsigned long long)cam->raw_dma_phys);
|
cam->vdev.num, (unsigned long long)cam->raw_dma_phys);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -1071,6 +1151,6 @@ static void __exit msm8905_cam_exit(void)
|
|||||||
module_init(msm8905_cam_init);
|
module_init(msm8905_cam_init);
|
||||||
module_exit(msm8905_cam_exit);
|
module_exit(msm8905_cam_exit);
|
||||||
|
|
||||||
MODULE_DESCRIPTION("Qualcomm MSM8905 / Nokia 8110 4G GC2395 V4L2 Camera Driver");
|
MODULE_DESCRIPTION("Qualcomm MSM8905 / Nokia 8110 4G GC2395/GC2385/GC2365 V4L2 Camera Driver");
|
||||||
MODULE_AUTHOR("Bananarchy Project");
|
MODULE_AUTHOR("Bananarchy Project");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
Reference in new issue
Block a user