Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 521e6aa6 authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: ope: Change packer and unpacker format in case NV12" into camera-kernel.lnx.3.1

parents 4f9bb2b4 21f578dc
Loading
Loading
Loading
Loading
+32 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/of.h>
@@ -29,6 +29,29 @@

static struct ope_bus_rd *bus_rd;

enum cam_ope_bus_unpacker_format {
	UNPACKER_FMT_PLAIN_128                   = 0x0,
	UNPACKER_FMT_PLAIN_8                     = 0x1,
	UNPACKER_FMT_PLAIN_16_10BPP              = 0x2,
	UNPACKER_FMT_PLAIN_16_12BPP              = 0x3,
	UNPACKER_FMT_PLAIN_16_14BPP              = 0x4,
	UNPACKER_FMT_PLAIN_32_20BPP              = 0x5,
	UNPACKER_FMT_ARGB_16_10BPP               = 0x6,
	UNPACKER_FMT_ARGB_16_12BPP               = 0x7,
	UNPACKER_FMT_ARGB_16_14BPP               = 0x8,
	UNPACKER_FMT_PLAIN_32                    = 0x9,
	UNPACKER_FMT_PLAIN_64                    = 0xA,
	UNPACKER_FMT_TP_10                       = 0xB,
	UNPACKER_FMT_MIPI_8                      = 0xC,
	UNPACKER_FMT_MIPI_10                     = 0xD,
	UNPACKER_FMT_MIPI_12                     = 0xE,
	UNPACKER_FMT_MIPI_14                     = 0xF,
	UNPACKER_FMT_PLAIN_16_16BPP              = 0x10,
	UNPACKER_FMT_PLAIN_128_ODD_EVEN          = 0x11,
	UNPACKER_FMT_PLAIN_8_ODD_EVEN            = 0x12,
	UNPACKER_FMT_MAX                         = 0x13,
};

static int cam_ope_bus_rd_in_port_idx(uint32_t input_port_id)
{
	int i;
@@ -243,6 +266,14 @@ static uint32_t *cam_ope_bus_rd_update(struct ope_hw *ope_hw_info,
				rd_reg_client->stride;
			temp_reg[count++] = stripe_io->stride;

			/*
			 * In case of NV12, change the unpacker format of
			 * chroma plane to odd even byte swapped format.
			 */
			if (k == 1 && stripe_io->format == CAM_FORMAT_NV12)
				stripe_io->unpack_format =
					UNPACKER_FMT_PLAIN_8_ODD_EVEN;

			/* Unpack cfg : Mode and alignment */
			temp_reg[count++] = rd_reg->offset +
				rd_reg_client->unpack_cfg;
+28 −0
Original line number Diff line number Diff line
@@ -29,6 +29,24 @@

static struct ope_bus_wr *wr_info;

enum cam_ope_bus_packer_format {
	PACKER_FMT_PLAIN_128                   = 0x0,
	PACKER_FMT_PLAIN_8                     = 0x1,
	PACKER_FMT_PLAIN_8_ODD_EVEN            = 0x2,
	PACKER_FMT_PLAIN_8_LSB_MSB_10          = 0x3,
	PACKER_FMT_PLAIN_8_LSB_MSB_10_ODD_EVEN = 0x4,
	PACKER_FMT_PLAIN_16_10BPP              = 0x5,
	PACKER_FMT_PLAIN_16_12BPP              = 0x6,
	PACKER_FMT_PLAIN_16_14BPP              = 0x7,
	PACKER_FMT_PLAIN_16_16BPP              = 0x8,
	PACKER_FMT_PLAIN_32                    = 0x9,
	PACKER_FMT_PLAIN_64                    = 0xA,
	PACKER_FMT_TP_10                       = 0xB,
	PACKER_FMT_MIPI_10                     = 0xC,
	PACKER_FMT_MIPI_12                     = 0xD,
	PACKER_FMT_MAX                         = 0xE,
};

static int cam_ope_bus_en_port_idx(
	struct cam_ope_request *ope_request,
	uint32_t batch_idx,
@@ -286,6 +304,16 @@ static uint32_t *cam_ope_bus_wr_update(struct ope_hw *ope_hw_info,
			temp_reg[count++] = wr_reg->offset +
				wr_reg_client->pack_cfg;
			temp = 0;

			/*
			 * In case of NV12, change the packer format of chroma
			 * plane to odd even byte swapped format
			 */

			if (k == 1 && stripe_io->format == CAM_FORMAT_NV12)
				stripe_io->pack_format =
					PACKER_FMT_PLAIN_8_ODD_EVEN;

			temp |= ((stripe_io->pack_format &
				wr_res_val_client->format_mask) <<
				wr_res_val_client->format_shift);