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

Commit 6fadb8f8 authored by Sunid Wilson's avatar Sunid Wilson
Browse files

msm: jpeg: Unvote the bus soon after encoding done.



Perform bus voting at start-encoding ioctl call and
un-vote right after the encoding is done and before
sending the encoding-done event to userspace
to ensure honest bus voting by jpeg.

Change-Id: I8ae10e3d1e0ad4e62a0120a11b2f20ee6d70b070
Signed-off-by: default avatarSunid Wilson <sunidw@codeaurora.org>
parent 77813844
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -18,6 +18,9 @@
#define JPEG_PR_ERR   pr_err
#define JPEG_DBG_HIGH   pr_debug

#define JPEG_BUS_VOTED(pgmn_dev) (pgmn_dev->jpeg_bus_vote = 1)
#define JPEG_BUS_UNVOTED(pgmn_dev) (pgmn_dev->jpeg_bus_vote = 0)

enum JPEG_MODE {
	JPEG_MODE_DISABLE,
	JPEG_MODE_OFFLINE,
+6 −4
Original line number Diff line number Diff line
@@ -459,8 +459,6 @@ int msm_jpeg_platform_init(struct platform_device *pdev,
		pgmn_dev->jpeg_bus_client = 0;
		return -EINVAL;
	}
	msm_bus_scale_client_update_request(
		pgmn_dev->jpeg_bus_client, 1);

	jpeg_io = request_mem_region(jpeg_mem->start,
		resource_size(jpeg_mem), pdev->name);
@@ -586,8 +584,12 @@ int msm_jpeg_platform_release(struct resource *mem, void *base, int irq,
	msm_jpeg_detach_iommu(pgmn_dev);

	if (pgmn_dev->jpeg_bus_client) {
		if (pgmn_dev->jpeg_bus_vote) {
			msm_bus_scale_client_update_request(
				pgmn_dev->jpeg_bus_client, 0);
			JPEG_BUS_UNVOTED(pgmn_dev);
			JPEG_DBG("%s:%d] Bus unvoted\n", __func__, __LINE__);
		}
		msm_bus_scale_unregister_client(pgmn_dev->jpeg_bus_client);
	}

+13 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <linux/compat.h>
#include <linux/ratelimit.h>
#include <media/msm_jpeg.h>
#include <linux/msm-bus.h>
#include "msm_jpeg_sync.h"
#include "msm_jpeg_core.h"
#include "msm_jpeg_platform.h"
@@ -312,6 +313,13 @@ int msm_jpeg_evt_get(struct msm_jpeg_device *pgmn_dev,
	ctrl_cmd.type = buf_p->vbuf.type;
	kfree(buf_p);

	if (ctrl_cmd.type == MSM_JPEG_EVT_SESSION_DONE) {
		msm_bus_scale_client_update_request(
			pgmn_dev->jpeg_bus_client, 0);
		JPEG_BUS_UNVOTED(pgmn_dev);
		JPEG_DBG("%s:%d] Bus unvoted\n", __func__, __LINE__);
	}

	JPEG_DBG("%s:%d] 0x%08lx %d\n", __func__, __LINE__,
		(unsigned long) ctrl_cmd.value, ctrl_cmd.len);

@@ -898,6 +906,11 @@ int msm_jpeg_start(struct msm_jpeg_device *pgmn_dev, void * __user arg,

	msm_jpeg_platform_set_dt_config(pgmn_dev);

	msm_bus_scale_client_update_request(
		pgmn_dev->jpeg_bus_client, 1);
	JPEG_BUS_VOTED(pgmn_dev);
	JPEG_DBG("%s:%d] Bus Voted\n", __func__, __LINE__);

	pgmn_dev->release_buf = 1;
	for (i = 0; i < 2; i++) {
		buf_out = msm_jpeg_q_out(&pgmn_dev->input_buf_q);
+4 −0
Original line number Diff line number Diff line
@@ -75,6 +75,10 @@ struct msm_jpeg_device {
	char	  open_count;
	uint8_t       op_mode;

	/* Flag to store the jpeg bus vote state
	 */
	int jpeg_bus_vote;

	/* event queue including frame done & err indications
	 */
	struct msm_jpeg_q evt_q;