1
0
Files
kernel-49/drivers/media/i2c/s5c73m3/s5c73m3.h
Greg Kroah-Hartman e3c1be14a2 Merge 4.9.276 into android-4.9-q
Changes in 4.9.276
	ALSA: usb-audio: fix rate on Ozone Z90 USB headset
	media: dvb-usb: fix wrong definition
	Input: usbtouchscreen - fix control-request directions
	net: can: ems_usb: fix use-after-free in ems_usb_disconnect()
	usb: gadget: eem: fix echo command packet response issue
	USB: cdc-acm: blacklist Heimann USB Appset device
	ntfs: fix validity check for file name attribute
	iov_iter_fault_in_readable() should do nothing in xarray case
	Input: joydev - prevent use of not validated data in JSIOCSBTNMAP ioctl
	ARM: dts: at91: sama5d4: fix pinctrl muxing
	btrfs: clear defrag status of a root if starting transaction fails
	ext4: fix kernel infoleak via ext4_extent_header
	ext4: correct the cache_nr in tracepoint ext4_es_shrink_exit
	ext4: remove check for zero nr_to_scan in ext4_es_scan()
	ext4: fix avefreec in find_group_orlov
	SUNRPC: Fix the batch tasks count wraparound.
	SUNRPC: Should wake up the privileged task firstly.
	s390/cio: dont call css_wait_for_slow_path() inside a lock
	iio: ltr501: mark register holding upper 8 bits of ALS_DATA{0,1} and PS_DATA as volatile, too
	iio: ltr501: ltr559: fix initialization of LTR501_ALS_CONTR
	iio: ltr501: ltr501_read_ps(): add missing endianness conversion
	serial: sh-sci: Stop dmaengine transfer in sci_stop_tx()
	serial_cs: Add Option International GSM-Ready 56K/ISDN modem
	serial_cs: remove wrong GLOBETROTTER.cis entry
	ath9k: Fix kernel NULL pointer dereference during ath_reset_internal()
	ssb: sdio: Don't overwrite const buffer if block_write fails
	seq_buf: Make trace_seq_putmem_hex() support data longer than 8
	fuse: check connected before queueing on fpq->io
	spi: spi-loopback-test: Fix 'tx_buf' might be 'rx_buf'
	spi: spi-topcliff-pch: Fix potential double free in pch_spi_process_messages()
	spi: omap-100k: Fix the length judgment problem
	crypto: nx - add missing MODULE_DEVICE_TABLE
	media: cpia2: fix memory leak in cpia2_usb_probe
	media: cobalt: fix race condition in setting HPD
	media: pvrusb2: fix warning in pvr2_i2c_core_done
	crypto: qat - check return code of qat_hal_rd_rel_reg()
	crypto: qat - remove unused macro in FW loader
	media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release
	media: bt8xx: Fix a missing check bug in bt878_probe
	media: st-hva: Fix potential NULL pointer dereferences
	mmc: via-sdmmc: add a check against NULL pointer dereference
	crypto: shash - avoid comparing pointers to exported functions under CFI
	media: dvb_net: avoid speculation from net slot
	media: siano: fix device register error path
	btrfs: abort transaction if we fail to update the delayed inode
	btrfs: disable build on platforms having page size 256K
	regulator: da9052: Ensure enough delay time for .set_voltage_time_sel
	ACPI: processor idle: Fix up C-state latency if not ordered
	block_dump: remove block_dump feature in mark_inode_dirty()
	fs: dlm: cancel work sync othercon
	random32: Fix implicit truncation warning in prandom_seed_state()
	fs: dlm: fix memory leak when fenced
	ACPI: bus: Call kobject_put() in acpi_init() error path
	platform/x86: toshiba_acpi: Fix missing error code in toshiba_acpi_setup_keyboard()
	ACPI: tables: Add custom DSDT file as makefile prerequisite
	ia64: mca_drv: fix incorrect array size calculation
	media: s5p_cec: decrement usage count if disabled
	crypto: ixp4xx - dma_unmap the correct address
	crypto: ux500 - Fix error return code in hash_hw_final()
	sata_highbank: fix deferred probing
	pata_rb532_cf: fix deferred probing
	media: I2C: change 'RST' to "RSET" to fix multiple build errors
	pata_octeon_cf: avoid WARN_ON() in ata_host_activate()
	pata_ep93xx: fix deferred probing
	media: tc358743: Fix error return code in tc358743_probe_of()
	media: siano: Fix out-of-bounds warnings in smscore_load_firmware_family2()
	mmc: usdhi6rol0: fix error return code in usdhi6_probe()
	media: s5p-g2d: Fix a memory leak on ctx->fh.m2m_ctx
	hwmon: (max31722) Remove non-standard ACPI device IDs
	hwmon: (max31790) Fix fan speed reporting for fan7..12
	spi: spi-sun6i: Fix chipselect/clock bug
	crypto: nx - Fix RCU warning in nx842_OF_upd_status
	ACPI: sysfs: Fix a buffer overrun problem with description_show()
	ocfs2: fix snprintf() checking
	net: pch_gbe: Propagate error from devm_gpio_request_one()
	ehea: fix error return code in ehea_restart_qps()
	RDMA/rxe: Fix failure during driver load
	drm: qxl: ensure surf.data is ininitialized
	wireless: carl9170: fix LEDS build errors & warnings
	brcmsmac: mac80211_if: Fix a resource leak in an error handling path
	ath10k: Fix an error code in ath10k_add_interface()
	netlabel: Fix memory leak in netlbl_mgmt_add_common
	netfilter: nft_exthdr: check for IPv6 packet before further processing
	net: ethernet: aeroflex: fix UAF in greth_of_remove
	net: ethernet: ezchip: fix UAF in nps_enet_remove
	net: ethernet: ezchip: fix error handling
	vxlan: add missing rcu_read_lock() in neigh_reduce()
	i40e: Fix error handling in i40e_vsi_open
	Bluetooth: mgmt: Fix slab-out-of-bounds in tlv_data_is_valid
	writeback: fix obtain a reference to a freeing memcg css
	net: sched: fix warning in tcindex_alloc_perfect_hash
	tty: nozomi: Fix a resource leak in an error handling function
	iio: adis_buffer: do not return ints in irq handlers
	iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	iio: accel: stk8ba50: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	iio: adc: ti-ads1015: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
	Input: hil_kbd - fix error return code in hil_dev_connect()
	char: pcmcia: error out if 'num_bytes_read' is greater than 4 in set_protocol()
	tty: nozomi: Fix the error handling path of 'nozomi_card_init()'
	scsi: FlashPoint: Rename si_flags field
	s390: appldata depends on PROC_SYSCTL
	staging: gdm724x: check for buffer overflow in gdm_lte_multi_sdu_pkt()
	staging: gdm724x: check for overflow in gdm_lte_netif_rx()
	of: Fix truncation of memory sizes on 32-bit platforms
	scsi: mpt3sas: Fix error return value in _scsih_expander_add()
	phy: ti: dm816x: Fix the error handling path in 'dm816x_usb_phy_probe()
	extcon: sm5502: Drop invalid register write in sm5502_reg_data
	extcon: max8997: Add missing modalias string
	configfs: fix memleak in configfs_release_bin_file
	leds: ktd2692: Fix an error handling path
	mm/huge_memory.c: don't discard hugepage if other processes are mapping it
	selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random
	mmc: vub3000: fix control-request direction
	scsi: core: Retry I/O for Notify (Enable Spinup) Required error
	net: pch_gbe: Use proper accessors to BE data in pch_ptp_match()
	hugetlb: clear huge pte during flush function on mips platform
	atm: iphase: fix possible use-after-free in ia_module_exit()
	mISDN: fix possible use-after-free in HFC_cleanup()
	atm: nicstar: Fix possible use-after-free in nicstar_cleanup()
	net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT
	reiserfs: add check for invalid 1st journal block
	drm/virtio: Fix double free on probe failure
	udf: Fix NULL pointer dereference in udf_symlink function
	e100: handle eeprom as little endian
	clk: tegra: Ensure that PLLU configuration is applied properly
	ipv6: use prandom_u32() for ID generation
	RDMA/cxgb4: Fix missing error code in create_qp()
	dm space maps: don't reset space map allocation cursor when committing
	net: micrel: check return value after calling platform_get_resource()
	fjes: check return value after calling platform_get_resource()
	selinux: use __GFP_NOWARN with GFP_NOWAIT in the AVC
	xfrm: Fix error reporting in xfrm_state_construct.
	wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP
	wl1251: Fix possible buffer overflow in wl1251_cmd_scan
	cw1200: add missing MODULE_DEVICE_TABLE
	MIPS: add PMD table accounting into MIPS'pmd_alloc_one
	atm: nicstar: use 'dma_free_coherent' instead of 'kfree'
	atm: nicstar: register the interrupt handler in the right place
	RDMA/rxe: Don't overwrite errno from ib_umem_get()
	sfc: avoid double pci_remove of VFs
	sfc: error code if SRIOV cannot be disabled
	wireless: wext-spy: Fix out-of-bounds warning
	RDMA/cma: Fix rdma_resolve_route() memory leak
	Bluetooth: Fix the HCI to MGMT status conversion table
	Bluetooth: Shutdown controller after workqueues are flushed or cancelled
	Bluetooth: btusb: fix bt fiwmare downloading failure issue for qca btsoc.
	sctp: add size validation when walking chunks
	fuse: reject internal errno
	can: gw: synchronize rcu operations before removing gw job entry
	can: bcm: delay release of struct bcm_op after synchronize_rcu()
	mac80211: fix memory corruption in EAPOL handling
	powerpc/barrier: Avoid collision with clang's __lwsync macro
	pinctrl/amd: Add device HID for new AMD GPIO controller
	mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
	mmc: core: clear flags before allowing to retune
	ata: ahci_sunxi: Disable DIPM
	ASoC: tegra: Set driver_name=tegra for all machine drivers
	qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
	ipmi/watchdog: Stop watchdog timer when the current action is 'none'
	power: supply: ab8500: Fix an old bug
	seq_buf: Fix overflow in seq_buf_putmem_hex()
	ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe
	dm btree remove: assign new_root only when removal succeeds
	media: dtv5100: fix control-request directions
	media: zr364xx: fix memory leak in zr364xx_start_readpipe
	media: gspca/sq905: fix control-request direction
	media: gspca/sunplus: fix zero-length control requests
	media: uvcvideo: Fix pixel format change for Elgato Cam Link 4K
	jfs: fix GPF in diFree
	smackfs: restrict bytes count in smk_set_cipso()
	KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled
	KVM: X86: Disable hardware breakpoints unconditionally before kvm_x86->run()
	scsi: core: Fix bad pointer dereference when ehandler kthread is invalid
	tracing: Do not reference char * as a string in histograms
	fscrypt: don't ignore minor_hash when hash is 0
	tty: serial: fsl_lpuart: fix the potential risk of division or modulo by zero
	misc/libmasm/module: Fix two use after free in ibmasm_init_one
	Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro"
	scsi: lpfc: Fix "Unexpected timeout" error in direct attach topology
	tty: serial: 8250: serial_cs: Fix a memory leak in error handling path
	fs/jfs: Fix missing error code in lmLogInit()
	scsi: iscsi: Add iscsi_cls_conn refcount helpers
	mfd: da9052/stmpe: Add and modify MODULE_DEVICE_TABLE
	s390/sclp_vt220: fix console name to match device
	ALSA: sb: Fix potential double-free of CSP mixer elements
	powerpc/ps3: Add dma_mask to ps3_dma_region
	gpio: zynq: Check return value of pm_runtime_get_sync
	ALSA: ppc: fix error return code in snd_pmac_probe()
	selftests/powerpc: Fix "no_handler" EBB selftest
	ASoC: soc-core: Fix the error return code in snd_soc_of_parse_audio_routing()
	ALSA: bebob: add support for ToneWeal FW66
	usb: gadget: f_hid: fix endianness issue with descriptors
	usb: gadget: hid: fix error return code in hid_bind()
	powerpc/boot: Fixup device-tree on little endian
	backlight: lm3630a: Fix return code of .update_status() callback
	ALSA: hda: Add IRQ check for platform_get_irq()
	i2c: core: Disable client irq on reboot/shutdown
	lib/decompress_unlz4.c: correctly handle zero-padding around initrds.
	pwm: spear: Don't modify HW state in .remove callback
	power: supply: ab8500: Avoid NULL pointers
	power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE
	ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1
	watchdog: Fix possible use-after-free in wdt_startup()
	watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff()
	watchdog: Fix possible use-after-free by calling del_timer_sync()
	x86/fpu: Return proper error codes from user access functions
	orangefs: fix orangefs df output.
	ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty
	power: supply: charger-manager: add missing MODULE_DEVICE_TABLE
	power: supply: ab8500: add missing MODULE_DEVICE_TABLE
	pwm: tegra: Don't modify HW state in .remove callback
	ACPI: AMBA: Fix resource name in /proc/iomem
	virtio-blk: Fix memory leak among suspend/resume procedure
	virtio_console: Assure used length from device is limited
	PCI/sysfs: Fix dsm_label_utf16s_to_utf8s() buffer overrun
	power: supply: rt5033_battery: Fix device tree enumeration
	um: fix error return code in slip_open()
	um: fix error return code in winch_tramp()
	watchdog: aspeed: fix hardware timeout calculation
	nfs: fix acl memory leak of posix_acl_create()
	ubifs: Set/Clear I_LINKABLE under i_lock for whiteout inode
	x86/fpu: Limit xstate copy size in xstateregs_set()
	ALSA: isa: Fix error return code in snd_cmi8330_probe()
	hexagon: use common DISCARDS macro
	ARM: dts: exynos: fix PWM LED max brightness on Odroid XU/XU3
	ARM: dts: exynos: fix PWM LED max brightness on Odroid XU4
	rtc: fix snprintf() checking in is_rtc_hctosys()
	ARM: dts: r8a7779, marzen: Fix DU clock names
	reset: bail if try_module_get() fails
	memory: fsl_ifc: fix leak of IO mapping on probe failure
	memory: fsl_ifc: fix leak of private memory on probe failure
	ARM: dts: am335x: align ti,pindir-d0-out-d1-in property with dt-shema
	scsi: be2iscsi: Fix an error handling path in beiscsi_dev_probe()
	mips: always link byteswap helpers into decompressor
	mips: disable branch profiling in boot/decompress.o
	MIPS: vdso: Invalid GIC access through VDSO
	seq_file: disallow extremely large seq buffer allocations
	Linux 4.9.276

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I595c090068eb1b1934b15a0d54394abc38b4b0cc
2021-07-25 20:02:04 +03:00

464 lines
14 KiB
C

/*
* Samsung LSI S5C73M3 8M pixel camera driver
*
* Copyright (C) 2012, Samsung Electronics, Co., Ltd.
* Sylwester Nawrocki <s.nawrocki@samsung.com>
* Andrzej Hajda <a.hajda@samsung.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that 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.
*/
#ifndef S5C73M3_H_
#define S5C73M3_H_
#include <linux/clk.h>
#include <linux/kernel.h>
#include <linux/regulator/consumer.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-subdev.h>
#include <media/i2c/s5c73m3.h>
#define DRIVER_NAME "S5C73M3"
#define S5C73M3_ISP_FMT MEDIA_BUS_FMT_VYUY8_2X8
#define S5C73M3_JPEG_FMT MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8
/* Subdevs pad index definitions */
enum s5c73m3_pads {
S5C73M3_ISP_PAD,
S5C73M3_JPEG_PAD,
S5C73M3_NUM_PADS
};
enum s5c73m3_oif_pads {
OIF_ISP_PAD,
OIF_JPEG_PAD,
OIF_SOURCE_PAD,
OIF_NUM_PADS
};
#define S5C73M3_SENSOR_FW_LEN 6
#define S5C73M3_SENSOR_TYPE_LEN 12
#define S5C73M3_REG(_addrh, _addrl) (((_addrh) << 16) | _addrl)
#define AHB_MSB_ADDR_PTR 0xfcfc
#define REG_CMDWR_ADDRH 0x0050
#define REG_CMDWR_ADDRL 0x0054
#define REG_CMDRD_ADDRH 0x0058
#define REG_CMDRD_ADDRL 0x005c
#define REG_CMDBUF_ADDR 0x0f14
#define REG_I2C_SEQ_STATUS S5C73M3_REG(0x0009, 0x59A6)
#define SEQ_END_PLL (1<<0x0)
#define SEQ_END_SENSOR (1<<0x1)
#define SEQ_END_GPIO (1<<0x2)
#define SEQ_END_FROM (1<<0x3)
#define SEQ_END_STABLE_AE_AWB (1<<0x4)
#define SEQ_END_READY_I2C_CMD (1<<0x5)
#define REG_I2C_STATUS S5C73M3_REG(0x0009, 0x599E)
#define I2C_STATUS_CIS_I2C (1<<0x0)
#define I2C_STATUS_AF_INIT (1<<0x1)
#define I2C_STATUS_CAL_DATA (1<<0x2)
#define I2C_STATUS_FRAME_COUNT (1<<0x3)
#define I2C_STATUS_FROM_INIT (1<<0x4)
#define I2C_STATUS_I2C_CIS_STREAM_OFF (1<<0x5)
#define I2C_STATUS_I2C_N_CMD_OVER (1<<0x6)
#define I2C_STATUS_I2C_N_CMD_MISMATCH (1<<0x7)
#define I2C_STATUS_CHECK_BIN_CRC (1<<0x8)
#define I2C_STATUS_EXCEPTION (1<<0x9)
#define I2C_STATUS_INIF_INIT_STATE (0x8)
#define REG_STATUS S5C73M3_REG(0x0009, 0x5080)
#define REG_STATUS_BOOT_SUB_MAIN_ENTER 0xff01
#define REG_STATUS_BOOT_SRAM_TIMING_OK 0xff02
#define REG_STATUS_BOOT_INTERRUPTS_EN 0xff03
#define REG_STATUS_BOOT_R_PLL_DONE 0xff04
#define REG_STATUS_BOOT_R_PLL_LOCKTIME_DONE 0xff05
#define REG_STATUS_BOOT_DELAY_COUNT_DONE 0xff06
#define REG_STATUS_BOOT_I_PLL_DONE 0xff07
#define REG_STATUS_BOOT_I_PLL_LOCKTIME_DONE 0xff08
#define REG_STATUS_BOOT_PLL_INIT_OK 0xff09
#define REG_STATUS_BOOT_SENSOR_INIT_OK 0xff0a
#define REG_STATUS_BOOT_GPIO_SETTING_OK 0xff0b
#define REG_STATUS_BOOT_READ_CAL_DATA_OK 0xff0c
#define REG_STATUS_BOOT_STABLE_AE_AWB_OK 0xff0d
#define REG_STATUS_ISP_COMMAND_COMPLETED 0xffff
#define REG_STATUS_EXCEPTION_OCCURED 0xdead
#define COMM_RESULT_OFFSET S5C73M3_REG(0x0009, 0x5000)
#define COMM_IMG_OUTPUT 0x0902
#define COMM_IMG_OUTPUT_HDR 0x0008
#define COMM_IMG_OUTPUT_YUV 0x0009
#define COMM_IMG_OUTPUT_INTERLEAVED 0x000d
#define COMM_STILL_PRE_FLASH 0x0a00
#define COMM_STILL_PRE_FLASH_FIRE 0x0000
#define COMM_STILL_PRE_FLASH_NON_FIRED 0x0000
#define COMM_STILL_PRE_FLASH_FIRED 0x0001
#define COMM_STILL_MAIN_FLASH 0x0a02
#define COMM_STILL_MAIN_FLASH_CANCEL 0x0001
#define COMM_STILL_MAIN_FLASH_FIRE 0x0002
#define COMM_ZOOM_STEP 0x0b00
#define COMM_IMAGE_EFFECT 0x0b0a
#define COMM_IMAGE_EFFECT_NONE 0x0001
#define COMM_IMAGE_EFFECT_NEGATIVE 0x0002
#define COMM_IMAGE_EFFECT_AQUA 0x0003
#define COMM_IMAGE_EFFECT_SEPIA 0x0004
#define COMM_IMAGE_EFFECT_MONO 0x0005
#define COMM_IMAGE_QUALITY 0x0b0c
#define COMM_IMAGE_QUALITY_SUPERFINE 0x0000
#define COMM_IMAGE_QUALITY_FINE 0x0001
#define COMM_IMAGE_QUALITY_NORMAL 0x0002
#define COMM_FLASH_MODE 0x0b0e
#define COMM_FLASH_MODE_OFF 0x0000
#define COMM_FLASH_MODE_ON 0x0001
#define COMM_FLASH_MODE_AUTO 0x0002
#define COMM_FLASH_STATUS 0x0b80
#define COMM_FLASH_STATUS_OFF 0x0001
#define COMM_FLASH_STATUS_ON 0x0002
#define COMM_FLASH_STATUS_AUTO 0x0003
#define COMM_FLASH_TORCH 0x0b12
#define COMM_FLASH_TORCH_OFF 0x0000
#define COMM_FLASH_TORCH_ON 0x0001
#define COMM_AE_NEEDS_FLASH 0x0cba
#define COMM_AE_NEEDS_FLASH_OFF 0x0000
#define COMM_AE_NEEDS_FLASH_ON 0x0001
#define COMM_CHG_MODE 0x0b10
#define COMM_CHG_MODE_NEW 0x8000
#define COMM_CHG_MODE_SUBSAMPLING_HALF 0x2000
#define COMM_CHG_MODE_SUBSAMPLING_QUARTER 0x4000
#define COMM_CHG_MODE_YUV_320_240 0x0001
#define COMM_CHG_MODE_YUV_640_480 0x0002
#define COMM_CHG_MODE_YUV_880_720 0x0003
#define COMM_CHG_MODE_YUV_960_720 0x0004
#define COMM_CHG_MODE_YUV_1184_666 0x0005
#define COMM_CHG_MODE_YUV_1280_720 0x0006
#define COMM_CHG_MODE_YUV_1536_864 0x0007
#define COMM_CHG_MODE_YUV_1600_1200 0x0008
#define COMM_CHG_MODE_YUV_1632_1224 0x0009
#define COMM_CHG_MODE_YUV_1920_1080 0x000a
#define COMM_CHG_MODE_YUV_1920_1440 0x000b
#define COMM_CHG_MODE_YUV_2304_1296 0x000c
#define COMM_CHG_MODE_YUV_3264_2448 0x000d
#define COMM_CHG_MODE_YUV_352_288 0x000e
#define COMM_CHG_MODE_YUV_1008_672 0x000f
#define COMM_CHG_MODE_JPEG_640_480 0x0010
#define COMM_CHG_MODE_JPEG_800_450 0x0020
#define COMM_CHG_MODE_JPEG_800_600 0x0030
#define COMM_CHG_MODE_JPEG_1280_720 0x0040
#define COMM_CHG_MODE_JPEG_1280_960 0x0050
#define COMM_CHG_MODE_JPEG_1600_900 0x0060
#define COMM_CHG_MODE_JPEG_1600_1200 0x0070
#define COMM_CHG_MODE_JPEG_2048_1152 0x0080
#define COMM_CHG_MODE_JPEG_2048_1536 0x0090
#define COMM_CHG_MODE_JPEG_2560_1440 0x00a0
#define COMM_CHG_MODE_JPEG_2560_1920 0x00b0
#define COMM_CHG_MODE_JPEG_3264_2176 0x00c0
#define COMM_CHG_MODE_JPEG_1024_768 0x00d0
#define COMM_CHG_MODE_JPEG_3264_1836 0x00e0
#define COMM_CHG_MODE_JPEG_3264_2448 0x00f0
#define COMM_AF_CON 0x0e00
#define COMM_AF_CON_STOP 0x0000
#define COMM_AF_CON_SCAN 0x0001 /* Full Search */
#define COMM_AF_CON_START 0x0002 /* Fast Search */
#define COMM_AF_CAL 0x0e06
#define COMM_AF_TOUCH_AF 0x0e0a
#define REG_AF_STATUS S5C73M3_REG(0x0009, 0x5e80)
#define REG_CAF_STATUS_FIND_SEARCH_DIR 0x0001
#define REG_CAF_STATUS_FOCUSING 0x0002
#define REG_CAF_STATUS_FOCUSED 0x0003
#define REG_CAF_STATUS_UNFOCUSED 0x0004
#define REG_AF_STATUS_INVALID 0x0010
#define REG_AF_STATUS_FOCUSING 0x0020
#define REG_AF_STATUS_FOCUSED 0x0030
#define REG_AF_STATUS_UNFOCUSED 0x0040
#define REG_AF_TOUCH_POSITION S5C73M3_REG(0x0009, 0x5e8e)
#define COMM_AF_FACE_ZOOM 0x0e10
#define COMM_AF_MODE 0x0e02
#define COMM_AF_MODE_NORMAL 0x0000
#define COMM_AF_MODE_MACRO 0x0001
#define COMM_AF_MODE_MOVIE_CAF_START 0x0002
#define COMM_AF_MODE_MOVIE_CAF_STOP 0x0003
#define COMM_AF_MODE_PREVIEW_CAF_START 0x0004
#define COMM_AF_MODE_PREVIEW_CAF_STOP 0x0005
#define COMM_AF_SOFTLANDING 0x0e16
#define COMM_AF_SOFTLANDING_ON 0x0000
#define COMM_AF_SOFTLANDING_RES_COMPLETE 0x0001
#define COMM_FACE_DET 0x0e0c
#define COMM_FACE_DET_OFF 0x0000
#define COMM_FACE_DET_ON 0x0001
#define COMM_FACE_DET_OSD 0x0e0e
#define COMM_FACE_DET_OSD_OFF 0x0000
#define COMM_FACE_DET_OSD_ON 0x0001
#define COMM_AE_CON 0x0c00
#define COMM_AE_STOP 0x0000 /* lock */
#define COMM_AE_START 0x0001 /* unlock */
#define COMM_ISO 0x0c02
#define COMM_ISO_AUTO 0x0000
#define COMM_ISO_100 0x0001
#define COMM_ISO_200 0x0002
#define COMM_ISO_400 0x0003
#define COMM_ISO_800 0x0004
#define COMM_ISO_SPORTS 0x0005
#define COMM_ISO_NIGHT 0x0006
#define COMM_ISO_INDOOR 0x0007
/* 0x00000 (-2.0 EV)...0x0008 (2.0 EV), 0.5EV step */
#define COMM_EV 0x0c04
#define COMM_METERING 0x0c06
#define COMM_METERING_CENTER 0x0000
#define COMM_METERING_SPOT 0x0001
#define COMM_METERING_AVERAGE 0x0002
#define COMM_METERING_SMART 0x0003
#define COMM_WDR 0x0c08
#define COMM_WDR_OFF 0x0000
#define COMM_WDR_ON 0x0001
#define COMM_FLICKER_MODE 0x0c12
#define COMM_FLICKER_NONE 0x0000
#define COMM_FLICKER_MANUAL_50HZ 0x0001
#define COMM_FLICKER_MANUAL_60HZ 0x0002
#define COMM_FLICKER_AUTO 0x0003
#define COMM_FLICKER_AUTO_50HZ 0x0004
#define COMM_FLICKER_AUTO_60HZ 0x0005
#define COMM_FRAME_RATE 0x0c1e
#define COMM_FRAME_RATE_AUTO_SET 0x0000
#define COMM_FRAME_RATE_FIXED_30FPS 0x0002
#define COMM_FRAME_RATE_FIXED_20FPS 0x0003
#define COMM_FRAME_RATE_FIXED_15FPS 0x0004
#define COMM_FRAME_RATE_FIXED_60FPS 0x0007
#define COMM_FRAME_RATE_FIXED_120FPS 0x0008
#define COMM_FRAME_RATE_FIXED_7FPS 0x0009
#define COMM_FRAME_RATE_FIXED_10FPS 0x000a
#define COMM_FRAME_RATE_FIXED_90FPS 0x000b
#define COMM_FRAME_RATE_ANTI_SHAKE 0x0013
/* 0x0000...0x0004 -> sharpness: 0, 1, 2, -1, -2 */
#define COMM_SHARPNESS 0x0c14
/* 0x0000...0x0004 -> saturation: 0, 1, 2, -1, -2 */
#define COMM_SATURATION 0x0c16
/* 0x0000...0x0004 -> contrast: 0, 1, 2, -1, -2 */
#define COMM_CONTRAST 0x0c18
#define COMM_SCENE_MODE 0x0c1a
#define COMM_SCENE_MODE_NONE 0x0000
#define COMM_SCENE_MODE_PORTRAIT 0x0001
#define COMM_SCENE_MODE_LANDSCAPE 0x0002
#define COMM_SCENE_MODE_SPORTS 0x0003
#define COMM_SCENE_MODE_INDOOR 0x0004
#define COMM_SCENE_MODE_BEACH 0x0005
#define COMM_SCENE_MODE_SUNSET 0x0006
#define COMM_SCENE_MODE_DAWN 0x0007
#define COMM_SCENE_MODE_FALL 0x0008
#define COMM_SCENE_MODE_NIGHT 0x0009
#define COMM_SCENE_MODE_AGAINST_LIGHT 0x000a
#define COMM_SCENE_MODE_FIRE 0x000b
#define COMM_SCENE_MODE_TEXT 0x000c
#define COMM_SCENE_MODE_CANDLE 0x000d
#define COMM_AE_AUTO_BRACKET 0x0b14
#define COMM_AE_AUTO_BRAKET_EV05 0x0080
#define COMM_AE_AUTO_BRAKET_EV10 0x0100
#define COMM_AE_AUTO_BRAKET_EV15 0x0180
#define COMM_AE_AUTO_BRAKET_EV20 0x0200
#define COMM_SENSOR_STREAMING 0x090a
#define COMM_SENSOR_STREAMING_OFF 0x0000
#define COMM_SENSOR_STREAMING_ON 0x0001
#define COMM_AWB_MODE 0x0d02
#define COMM_AWB_MODE_INCANDESCENT 0x0000
#define COMM_AWB_MODE_FLUORESCENT1 0x0001
#define COMM_AWB_MODE_FLUORESCENT2 0x0002
#define COMM_AWB_MODE_DAYLIGHT 0x0003
#define COMM_AWB_MODE_CLOUDY 0x0004
#define COMM_AWB_MODE_AUTO 0x0005
#define COMM_AWB_CON 0x0d00
#define COMM_AWB_STOP 0x0000 /* lock */
#define COMM_AWB_START 0x0001 /* unlock */
#define COMM_FW_UPDATE 0x0906
#define COMM_FW_UPDATE_NOT_READY 0x0000
#define COMM_FW_UPDATE_SUCCESS 0x0005
#define COMM_FW_UPDATE_FAIL 0x0007
#define COMM_FW_UPDATE_BUSY 0xffff
#define S5C73M3_MAX_SUPPLIES 6
#define S5C73M3_DEFAULT_MCLK_FREQ 24000000U
struct s5c73m3_ctrls {
struct v4l2_ctrl_handler handler;
struct {
/* exposure/exposure bias cluster */
struct v4l2_ctrl *auto_exposure;
struct v4l2_ctrl *exposure_bias;
struct v4l2_ctrl *exposure_metering;
};
struct {
/* iso/auto iso cluster */
struct v4l2_ctrl *auto_iso;
struct v4l2_ctrl *iso;
};
struct v4l2_ctrl *auto_wb;
struct {
/* continuous auto focus/auto focus cluster */
struct v4l2_ctrl *focus_auto;
struct v4l2_ctrl *af_start;
struct v4l2_ctrl *af_stop;
struct v4l2_ctrl *af_status;
struct v4l2_ctrl *af_distance;
};
struct v4l2_ctrl *aaa_lock;
struct v4l2_ctrl *colorfx;
struct v4l2_ctrl *contrast;
struct v4l2_ctrl *saturation;
struct v4l2_ctrl *sharpness;
struct v4l2_ctrl *zoom;
struct v4l2_ctrl *wdr;
struct v4l2_ctrl *stabilization;
struct v4l2_ctrl *jpeg_quality;
struct v4l2_ctrl *scene_mode;
};
enum s5c73m3_gpio_id {
STBY,
RSET,
GPIO_NUM,
};
enum s5c73m3_resolution_types {
RES_ISP,
RES_JPEG,
};
struct s5c73m3_interval {
u16 fps_reg;
struct v4l2_fract interval;
/* Maximum rectangle for the interval */
struct v4l2_frmsize_discrete size;
};
struct s5c73m3 {
struct v4l2_subdev sensor_sd;
struct media_pad sensor_pads[S5C73M3_NUM_PADS];
struct v4l2_subdev oif_sd;
struct media_pad oif_pads[OIF_NUM_PADS];
struct spi_driver spidrv;
struct spi_device *spi_dev;
struct i2c_client *i2c_client;
u32 i2c_write_address;
u32 i2c_read_address;
struct regulator_bulk_data supplies[S5C73M3_MAX_SUPPLIES];
struct s5c73m3_gpio gpio[GPIO_NUM];
struct clk *clock;
/* External master clock frequency */
u32 mclk_frequency;
/* Video bus type - MIPI-CSI2/parallel */
enum v4l2_mbus_type bus_type;
const struct s5c73m3_frame_size *sensor_pix_size[2];
const struct s5c73m3_frame_size *oif_pix_size[2];
u32 mbus_code;
const struct s5c73m3_interval *fiv;
struct v4l2_mbus_frame_desc frame_desc;
/* protects the struct members below */
struct mutex lock;
struct s5c73m3_ctrls ctrls;
u8 streaming:1;
u8 apply_fmt:1;
u8 apply_fiv:1;
u8 isp_ready:1;
short power;
char sensor_fw[S5C73M3_SENSOR_FW_LEN + 2];
char sensor_type[S5C73M3_SENSOR_TYPE_LEN + 2];
char fw_file_version[2];
unsigned int fw_size;
};
struct s5c73m3_frame_size {
u32 width;
u32 height;
u8 reg_val;
};
extern int s5c73m3_dbg;
int s5c73m3_register_spi_driver(struct s5c73m3 *state);
void s5c73m3_unregister_spi_driver(struct s5c73m3 *state);
int s5c73m3_spi_write(struct s5c73m3 *state, const void *addr,
const unsigned int len, const unsigned int tx_size);
int s5c73m3_spi_read(struct s5c73m3 *state, void *addr,
const unsigned int len, const unsigned int tx_size);
int s5c73m3_read(struct s5c73m3 *state, u32 addr, u16 *data);
int s5c73m3_write(struct s5c73m3 *state, u32 addr, u16 data);
int s5c73m3_isp_command(struct s5c73m3 *state, u16 command, u16 data);
int s5c73m3_init_controls(struct s5c73m3 *state);
static inline struct v4l2_subdev *ctrl_to_sensor_sd(struct v4l2_ctrl *ctrl)
{
return &container_of(ctrl->handler, struct s5c73m3,
ctrls.handler)->sensor_sd;
}
static inline struct s5c73m3 *sensor_sd_to_s5c73m3(struct v4l2_subdev *sd)
{
return container_of(sd, struct s5c73m3, sensor_sd);
}
static inline struct s5c73m3 *oif_sd_to_s5c73m3(struct v4l2_subdev *sd)
{
return container_of(sd, struct s5c73m3, oif_sd);
}
#endif /* S5C73M3_H_ */