linux/drivers/media/platform/marvell/cafe-driver.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * A driver for the CMOS camera controller in the Marvell 88ALP01 "cafe"
 * multifunction chip.  Currently works with the Omnivision OV7670
 * sensor.
 *
 * The data sheet for this device can be found at:
 *    http://wiki.laptop.org/images/5/5c/88ALP01_Datasheet_July_2007.pdf
 *
 * Copyright 2006-11 One Laptop Per Child Association, Inc.
 * Copyright 2006-11 Jonathan Corbet <[email protected]>
 * Copyright 2018 Lubomir Rintel <[email protected]>
 *
 * Written by Jonathan Corbet, [email protected].
 *
 * v4l2_device/v4l2_subdev conversion by:
 * Copyright (C) 2009 Hans Verkuil <[email protected]>
 */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/i2c/ov7670.h>
#include <linux/device.h>
#include <linux/wait.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/clkdev.h>

#include "mcam-core.h"

#define CAFE_VERSION


/*
 * Parameters.
 */
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

struct cafe_camera {};

/*
 * Most of the camera controller registers are defined in mcam-core.h,
 * but the Cafe platform has some additional registers of its own;
 * they are described here.
 */

/*
 * "General purpose register" has a couple of GPIOs used for sensor
 * power and reset on OLPC XO 1.0 systems.
 */
#define REG_GPR
#define GPR_C1EN
#define GPR_C0EN
#define GPR_C1
/*
 * Control 0 is wired to reset on OLPC machines.  For ov7x sensors,
 * it is active low.
 */
#define GPR_C0

/*
 * These registers control the SMBUS module for communicating
 * with the sensor.
 */
#define REG_TWSIC0
#define TWSIC0_EN
#define TWSIC0_MODE
#define TWSIC0_SID
/*
 * Subtle trickery: the slave ID field starts with bit 2.  But the
 * Linux i2c stack wants to treat the bottommost bit as a separate
 * read/write bit, which is why slave ID's are usually presented
 * >>1.  For consistency with that behavior, we shift over three
 * bits instead of two.
 */
#define TWSIC0_SID_SHIFT
#define TWSIC0_CLKDIV
#define TWSIC0_MASKACK
#define TWSIC0_OVMAGIC

#define REG_TWSIC1
#define TWSIC1_DATA
#define TWSIC1_ADDR
#define TWSIC1_ADDR_SHIFT
#define TWSIC1_READ
#define TWSIC1_WSTAT
#define TWSIC1_RVALID
#define TWSIC1_ERROR

/*
 * Here's the weird global control registers
 */
#define REG_GL_CSR
#define GCSR_SRS
#define GCSR_SRC
#define GCSR_MRS
#define GCSR_MRC
#define GCSR_CCIC_EN
#define REG_GL_IMASK
#define GIMSK_CCIC_EN

#define REG_GL_FCR
#define GFCR_GPIO_ON
#define REG_GL_GPIOR
#define GGPIO_OUT
#define GGPIO_VAL

#define REG_LEN


/*
 * Debugging and related.
 */
#define cam_err(cam, fmt, arg...)
#define cam_warn(cam, fmt, arg...)

/* -------------------------------------------------------------------- */
/*
 * The I2C/SMBUS interface to the camera itself starts here.  The
 * controller handles SMBUS itself, presenting a relatively simple register
 * interface; all we have to do is to tell it where to route the data.
 */
#define CAFE_SMBUS_TIMEOUT

static int cafe_smbus_write_done(struct mcam_camera *mcam)
{}

static int cafe_smbus_write_data(struct cafe_camera *cam,
		u16 addr, u8 command, u8 value)
{}



static int cafe_smbus_read_done(struct mcam_camera *mcam)
{}



static int cafe_smbus_read_data(struct cafe_camera *cam,
		u16 addr, u8 command, u8 *value)
{}

/*
 * Perform a transfer over SMBUS.  This thing is called under
 * the i2c bus lock, so we shouldn't race with ourselves...
 */
static int cafe_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
		unsigned short flags, char rw, u8 command,
		int size, union i2c_smbus_data *data)
{}


static void cafe_smbus_enable_irq(struct cafe_camera *cam)
{}

static u32 cafe_smbus_func(struct i2c_adapter *adapter)
{}

static const struct i2c_algorithm cafe_smbus_algo =;

static int cafe_smbus_setup(struct cafe_camera *cam)
{}

static void cafe_smbus_shutdown(struct cafe_camera *cam)
{}


/*
 * Controller-level stuff
 */

static void cafe_ctlr_init(struct mcam_camera *mcam)
{}


static int cafe_ctlr_power_up(struct mcam_camera *mcam)
{}

static void cafe_ctlr_power_down(struct mcam_camera *mcam)
{}



/*
 * The platform interrupt handler.
 */
static irqreturn_t cafe_irq(int irq, void *data)
{}

/* -------------------------------------------------------------------------- */

static struct ov7670_config sensor_cfg =;

static struct i2c_board_info ov7670_info =;

/* -------------------------------------------------------------------------- */
/*
 * PCI interface stuff.
 */

static int cafe_pci_probe(struct pci_dev *pdev,
		const struct pci_device_id *id)
{}


/*
 * Shut down an initialized device
 */
static void cafe_shutdown(struct cafe_camera *cam)
{}


static void cafe_pci_remove(struct pci_dev *pdev)
{}


/*
 * Basic power management.
 */
static int __maybe_unused cafe_pci_suspend(struct device *dev)
{}


static int __maybe_unused cafe_pci_resume(struct device *dev)
{}

static const struct pci_device_id cafe_ids[] =;

MODULE_DEVICE_TABLE(pci, cafe_ids);

static SIMPLE_DEV_PM_OPS(cafe_pci_pm_ops, cafe_pci_suspend, cafe_pci_resume);

static struct pci_driver cafe_pci_driver =;




static int __init cafe_init(void)
{}


static void __exit cafe_exit(void)
{}

module_init();
module_exit(cafe_exit);