__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * MIPI Camera Control Interface (CCI) register access helpers.
 *
 * Copyright (C) 2023 Hans de Goede <[email protected]>
 */
#ifndef _V4L2_CCI_H
#define _V4L2_CCI_H

#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/types.h>

struct i2c_client;
struct regmap;

/**
 * struct cci_reg_sequence - An individual write from a sequence of CCI writes
 *
 * @reg: Register address, use CCI_REG#() macros to encode reg width
 * @val: Register value
 *
 * Register/value pairs for sequences of writes.
 */
struct cci_reg_sequence {
	u32 reg;
	u64 val;
};

/*
 * Macros to define register address with the register width encoded
 * into the higher bits.
 */
#define CCI_REG_ADDR_MASK		GENMASK(15, 0)
#define CCI_REG_WIDTH_SHIFT		16
#define CCI_REG_WIDTH_MASK		GENMASK(19, 16)
/*
 * Private CCI register flags, for the use of drivers.
 */
#define CCI_REG_PRIVATE_SHIFT		28U
#define CCI_REG_PRIVATE_MASK		GENMASK(31U, CCI_REG_PRIVATE_SHIFT)

#define CCI_REG_WIDTH_BYTES(x)		FIELD_GET(CCI_REG_WIDTH_MASK, x)
#define CCI_REG_WIDTH(x)		(CCI_REG_WIDTH_BYTES(x) << 3)
#define CCI_REG_ADDR(x)			FIELD_GET(CCI_REG_ADDR_MASK, x)
#define CCI_REG_LE			BIT(20)

#define CCI_REG8(x)			((1 << CCI_REG_WIDTH_SHIFT) | (x))
#define CCI_REG16(x)			((2 << CCI_REG_WIDTH_SHIFT) | (x))
#define CCI_REG24(x)			((3 << CCI_REG_WIDTH_SHIFT) | (x))
#define CCI_REG32(x)			((4 << CCI_REG_WIDTH_SHIFT) | (x))
#define CCI_REG64(x)			((8 << CCI_REG_WIDTH_SHIFT) | (x))
#define CCI_REG16_LE(x)			(CCI_REG_LE | (2U << CCI_REG_WIDTH_SHIFT) | (x))
#define CCI_REG24_LE(x)			(CCI_REG_LE | (3U << CCI_REG_WIDTH_SHIFT) | (x))
#define CCI_REG32_LE(x)			(CCI_REG_LE | (4U << CCI_REG_WIDTH_SHIFT) | (x))
#define CCI_REG64_LE(x)			(CCI_REG_LE | (8U << CCI_REG_WIDTH_SHIFT) | (x))

/**
 * cci_read() - Read a value from a single CCI register
 *
 * @map: Register map to read from
 * @reg: Register address to read, use CCI_REG#() macros to encode reg width
 * @val: Pointer to store read value
 * @err: Optional pointer to store errors, if a previous error is set
 *       then the read will be skipped
 *
 * Return: %0 on success or a negative error code on failure.
 */
int cci_read(struct regmap *map, u32 reg, u64 *val, int *err);

/**
 * cci_write() - Write a value to a single CCI register
 *
 * @map: Register map to write to
 * @reg: Register address to write, use CCI_REG#() macros to encode reg width
 * @val: Value to be written
 * @err: Optional pointer to store errors, if a previous error is set
 *       then the write will be skipped
 *
 * Return: %0 on success or a negative error code on failure.
 */
int cci_write(struct regmap *map, u32 reg, u64 val, int *err);

/**
 * cci_update_bits() - Perform a read/modify/write cycle on
 *                     a single CCI register
 *
 * @map: Register map to update
 * @reg: Register address to update, use CCI_REG#() macros to encode reg width
 * @mask: Bitmask to change
 * @val: New value for bitmask
 * @err: Optional pointer to store errors, if a previous error is set
 *       then the update will be skipped
 *
 * Note this uses read-modify-write to update the bits, atomicity with regards
 * to other cci_*() register access functions is NOT guaranteed.
 *
 * Return: %0 on success or a negative error code on failure.
 */
int cci_update_bits(struct regmap *map, u32 reg, u64 mask, u64 val, int *err);

/**
 * cci_multi_reg_write() - Write multiple registers to the device
 *
 * @map: Register map to write to
 * @regs: Array of structures containing register-address, -value pairs to be
 *        written, register-addresses use CCI_REG#() macros to encode reg width
 * @num_regs: Number of registers to write
 * @err: Optional pointer to store errors, if a previous error is set
 *       then the write will be skipped
 *
 * Write multiple registers to the device where the set of register, value
 * pairs are supplied in any order, possibly not all in a single range.
 *
 * Use of the CCI_REG#() macros to encode reg width is mandatory.
 *
 * For raw lists of register-address, -value pairs with only 8 bit
 * wide writes regmap_multi_reg_write() can be used instead.
 *
 * Return: %0 on success or a negative error code on failure.
 */
int cci_multi_reg_write(struct regmap *map, const struct cci_reg_sequence *regs,
			unsigned int num_regs, int *err);

#if IS_ENABLED(CONFIG_V4L2_CCI_I2C)
/**
 * devm_cci_regmap_init_i2c() - Create regmap to use with cci_*() register
 *                              access functions
 *
 * @client: i2c_client to create the regmap for
 * @reg_addr_bits: register address width to use (8 or 16)
 *
 * Note the memory for the created regmap is devm() managed, tied to the client.
 *
 * Return: %0 on success or a negative error code on failure.
 */
struct regmap *devm_cci_regmap_init_i2c(struct i2c_client *client,
					int reg_addr_bits);
#endif

#endif

Filemanager

Name Type Size Permission Actions
davinci Folder 0755
drv-intf Folder 0755
i2c Folder 0755
tpg Folder 0755
cec-notifier.h File 5.03 KB 0644
cec-pin.h File 2.79 KB 0644
cec.h File 17.88 KB 0644
demux.h File 22.69 KB 0644
dmxdev.h File 5.87 KB 0644
dvb-usb-ids.h File 19.46 KB 0644
dvb_ca_en50221.h File 4.35 KB 0644
dvb_demux.h File 10.77 KB 0644
dvb_frontend.h File 30.42 KB 0644
dvb_net.h File 2.43 KB 0644
dvb_ringbuffer.h File 8.32 KB 0644
dvb_vb2.h File 7.65 KB 0644
dvbdev.h File 14.77 KB 0644
frame_vector.h File 1.42 KB 0644
imx.h File 190 B 0644
ipu-bridge.h File 4.3 KB 0644
ipu6-pci-table.h File 876 B 0644
jpeg.h File 500 B 0644
media-dev-allocator.h File 2.21 KB 0644
media-device.h File 17.65 KB 0644
media-devnode.h File 5.29 KB 0644
media-entity.h File 47.13 KB 0644
media-request.h File 11.95 KB 0644
mipi-csi2.h File 1.46 KB 0644
rc-core.h File 12.08 KB 0644
rc-map.h File 14.53 KB 0644
rcar-fcp.h File 1.1 KB 0644
tuner-types.h File 7.54 KB 0644
tuner.h File 8.46 KB 0644
tveeprom.h File 3.3 KB 0644
v4l2-async.h File 11.78 KB 0644
v4l2-cci.h File 4.75 KB 0644
v4l2-common.h File 19.96 KB 0644
v4l2-ctrls.h File 54.48 KB 0644
v4l2-dev.h File 20.42 KB 0644
v4l2-device.h File 18.61 KB 0644
v4l2-dv-timings.h File 10.64 KB 0644
v4l2-event.h File 6.01 KB 0644
v4l2-fh.h File 4.22 KB 0644
v4l2-flash-led-class.h File 5.75 KB 0644
v4l2-fwnode.h File 15.57 KB 0644
v4l2-h264.h File 3.1 KB 0644
v4l2-image-sizes.h File 827 B 0644
v4l2-ioctl.h File 33.52 KB 0644
v4l2-jpeg.h File 6.43 KB 0644
v4l2-mc.h File 7.78 KB 0644
v4l2-mediabus.h File 9.65 KB 0644
v4l2-mem2mem.h File 29.48 KB 0644
v4l2-rect.h File 5.71 KB 0644
v4l2-subdev.h File 74.55 KB 0644
v4l2-vp9.h File 8.32 KB 0644
videobuf2-core.h File 52.05 KB 0644
videobuf2-dma-contig.h File 883 B 0644
videobuf2-dma-sg.h File 698 B 0644
videobuf2-dvb.h File 1.81 KB 0644
videobuf2-memops.h File 1.09 KB 0644
videobuf2-v4l2.h File 14.48 KB 0644
videobuf2-vmalloc.h File 509 B 0644
vsp1.h File 3.62 KB 0644
Filemanager