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

Commit 6c4cd9be authored by Samyukta Mogily's avatar Samyukta Mogily Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: Add check for sensor data rate



Add check to return error when data rate is more
than the max rate that can be programmed.

Change-Id: Ife8bb677cd043f19f5c2c05ee4deb7ba63ef23a7
Signed-off-by: default avatarSamyukta Mogily <smogily@codeaurora.org>
parent 63098a4e
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@
#define MBPS                                      1000000
#define SNPS_INTERPHY_OFFSET                      0x800
#define SET_THE_BIT(x)                            (0x1 << x)
#define SNPS_MAX_DATA_RATE_PER_LANE               2500000000ULL

#undef CDBG
#define CDBG(fmt, args...) pr_debug(fmt, ##args)
@@ -185,7 +186,15 @@ static int msm_csiphy_snps_2_lane_config(
	void __iomem *csiphybase;

	csiphybase = csiphy_dev->base;

	if (csiphy_params->data_rate >
		SNPS_MAX_DATA_RATE_PER_LANE * num_lanes) {
		pr_err("unsupported data rate\n");
		return -EINVAL;
	}

	local_data_rate = csiphy_params->data_rate;

	if (mode == TWO_LANE_PHY_A)
		offset = 0x0;
	else if (mode == TWO_LANE_PHY_B)
@@ -208,15 +217,6 @@ static int msm_csiphy_snps_2_lane_config(
		diff = diff_i;
	}

	if (i == (sizeof(snps_v100_freq_values)/
		sizeof(snps_v100_freq_values[0]))) {
		if (local_data_rate >
			snps_v100_freq_values[--i].default_bit_rate) {
			pr_err("unsupported data rate\n");
			return -EINVAL;
		}
	}

	csiphy_dev->snps_programmed_data_rate = csiphy_params->data_rate;

	if (mode == TWO_LANE_PHY_A) {