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

Commit 8d782896 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drm/msm: enable compilation for new files in display driver"

parents ca856260 40a5826c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -182,7 +182,8 @@ msm_drm-$(CONFIG_DRM_MSM) += \
	sde/sde_reg_dma.o \
	sde/sde_hw_reg_dma_v1.o \
	sde/sde_hw_dsc.o \
	sde/sde_hw_ds.o
	sde/sde_hw_ds.o \
	sde/sde_hw_qdss.o

msm_drm-$(CONFIG_DRM_SDE_WB) += sde/sde_wb.o \
	sde/sde_encoder_phys_wb.o
+107 −0
Original line number Diff line number Diff line
/* Copyright (c) 2019, 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
 * only 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.
 */

#define pr_fmt(fmt)     "[drm:%s:%d] " fmt, __func__, __LINE__

#include <linux/mutex.h>
#include <linux/platform_device.h>

#include "sde_kms.h"
#include "sde_dbg.h"
#include "sde_hw_qdss.h"

#define QDSS_CONFIG	0x0

static struct sde_qdss_cfg *_qdss_offset(enum sde_qdss qdss,
		struct sde_mdss_cfg *m,
		void __iomem *addr,
		struct sde_hw_blk_reg_map *b)
{
	int i;

	for (i = 0; i < m->qdss_count; i++) {
		if (qdss == m->qdss[i].id) {
			b->base_off = addr;
			b->blk_off = m->qdss[i].base;
			b->length = m->qdss[i].len;
			b->hwversion = m->hwversion;
			b->log_mask = SDE_DBG_MASK_QDSS;
			return &m->qdss[i];
		}
	}

	return ERR_PTR(-EINVAL);
}

static void sde_hw_qdss_enable_qdss_events(struct sde_hw_qdss *hw_qdss,
							bool enable)
{
	struct sde_hw_blk_reg_map *c = &hw_qdss->hw;
	u32 val;

	val = enable ? 0x100 : 0;

	if (c)
		SDE_REG_WRITE(c, QDSS_CONFIG, val);
}

static void _setup_qdss_ops(struct sde_hw_qdss_ops *ops)
{
	ops->enable_qdss_events = sde_hw_qdss_enable_qdss_events;
}

static struct sde_hw_blk_ops sde_hw_ops = {
	.start = NULL,
	.stop = NULL,
};

struct sde_hw_qdss *sde_hw_qdss_init(enum sde_qdss idx,
			void __iomem *addr,
			struct sde_mdss_cfg *m)
{
	struct sde_hw_qdss *c;
	struct sde_qdss_cfg *cfg;
	int rc;

	c = kzalloc(sizeof(*c), GFP_KERNEL);
	if (!c)
		return ERR_PTR(-ENOMEM);

	cfg = _qdss_offset(idx, m, addr, &c->hw);
	if (IS_ERR_OR_NULL(cfg)) {
		kfree(c);
		return ERR_PTR(-EINVAL);
	}

	c->idx = idx;
	c->caps = cfg;
	_setup_qdss_ops(&c->ops);

	rc = sde_hw_blk_init(&c->base, SDE_HW_BLK_QDSS, idx, &sde_hw_ops);
	if (rc) {
		SDE_ERROR("failed to init hw blk %d\n", rc);
		kzfree(c);
		return ERR_PTR(rc);
	}

	sde_dbg_reg_register_dump_range(SDE_DBG_NAME, cfg->name, c->hw.blk_off,
			c->hw.blk_off + c->hw.length, c->hw.xin_id);

	return c;
}

void sde_hw_qdss_destroy(struct sde_hw_qdss *qdss)
{
	if (qdss)
		sde_hw_blk_destroy(&qdss->base);
	kfree(qdss);
}
+75 −0
Original line number Diff line number Diff line
/* Copyright (c) 2019, 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
 * only 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 _SDE_HW_QDSS_H
#define _SDE_HW_QDSS_H

#include "sde_hw_catalog.h"
#include "sde_hw_mdss.h"
#include "sde_hw_blk.h"
#include "sde_hw_util.h"

struct sde_hw_qdss;

/**
 * struct sde_hw_qdss_ops - interface to the qdss hardware driver functions
 * Assumption is these functions will be called after clocks are enabled
 */
struct sde_hw_qdss_ops {
	/**
	 * enable_qdss_events - enable qdss events
	 * @hw_qdss: Pointer to qdss context
	 */
	void (*enable_qdss_events)(struct sde_hw_qdss *hw_qdss, bool enable);
};

struct sde_hw_qdss {
	struct sde_hw_blk base;
	struct sde_hw_blk_reg_map hw;

	/* qdss */
	enum sde_qdss idx;
	const struct sde_qdss_cfg *caps;

	/* ops */
	struct sde_hw_qdss_ops ops;
};

/**
 * to_sde_hw_qdss - convert base object sde_hw_base to container
 * @hw: Pointer to base hardware block
 * return: Pointer to hardware block container
 */
static inline struct sde_hw_qdss *to_sde_hw_qdss(struct sde_hw_blk *hw)
{
	return container_of(hw, struct sde_hw_qdss, base);
}

/**
 * sde_hw_qdss_init - initializes the qdss block for the passed qdss idx
 * @idx:  QDSS index for which driver object is required
 * @addr: Mapped register io address of MDP
 * @m:    Pointer to mdss catalog data
 * Returns: Error code or allocated sde_hw_qdss context
 */
struct sde_hw_qdss *sde_hw_qdss_init(enum sde_qdss idx,
				void __iomem *addr,
				struct sde_mdss_cfg *m);

/**
 * sde_hw_qdss_destroy - destroys qdss driver context
 *			 should be called to free the context
 * @qdss: Pointer to qdss driver context returned by sde_hw_qdss_init
 */
void sde_hw_qdss_destroy(struct sde_hw_qdss *qdss);

#endif /*_SDE_HW_QDSS_H */