Commit 8825f596 authored by Rob Clark's avatar Rob Clark

drm/msm/adreno: Add helper for formating chip-id

This is used in a few places, including one that is parsed by userspace
tools.  So let's standardize it a bit better.
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/549774/
parent 67133dc0
...@@ -661,14 +661,12 @@ static int adreno_bind(struct device *dev, struct device *master, void *data) ...@@ -661,14 +661,12 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)
info = adreno_info(config.rev); info = adreno_info(config.rev);
if (!info) { if (!info) {
dev_warn(drm->dev, "Unknown GPU revision: %u.%u.%u.%u\n", dev_warn(drm->dev, "Unknown GPU revision: %"ADRENO_CHIPID_FMT"\n",
config.rev.core, config.rev.major, ADRENO_CHIPID_ARGS(config.rev));
config.rev.minor, config.rev.patchid);
return -ENXIO; return -ENXIO;
} }
DBG("Found GPU: %u.%u.%u.%u", config.rev.core, config.rev.major, DBG("Found GPU: %"ADRENO_CHIPID_FMT, ADRENO_CHIPID_ARGS(config.rev));
config.rev.minor, config.rev.patchid);
priv->is_a2xx = info->family < ADRENO_3XX; priv->is_a2xx = info->family < ADRENO_3XX;
priv->has_cached_coherent = priv->has_cached_coherent =
......
...@@ -847,10 +847,9 @@ void adreno_show(struct msm_gpu *gpu, struct msm_gpu_state *state, ...@@ -847,10 +847,9 @@ void adreno_show(struct msm_gpu *gpu, struct msm_gpu_state *state,
if (IS_ERR_OR_NULL(state)) if (IS_ERR_OR_NULL(state))
return; return;
drm_printf(p, "revision: %d (%d.%d.%d.%d)\n", drm_printf(p, "revision: %u (%"ADRENO_CHIPID_FMT")\n",
adreno_gpu->info->revn, adreno_gpu->rev.core, adreno_gpu->info->revn,
adreno_gpu->rev.major, adreno_gpu->rev.minor, ADRENO_CHIPID_ARGS(adreno_gpu->rev));
adreno_gpu->rev.patchid);
/* /*
* If this is state collected due to iova fault, so fault related info * If this is state collected due to iova fault, so fault related info
* *
...@@ -921,10 +920,9 @@ void adreno_dump_info(struct msm_gpu *gpu) ...@@ -921,10 +920,9 @@ void adreno_dump_info(struct msm_gpu *gpu)
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
int i; int i;
printk("revision: %d (%d.%d.%d.%d)\n", printk("revision: %u (%"ADRENO_CHIPID_FMT")\n",
adreno_gpu->info->revn, adreno_gpu->rev.core, adreno_gpu->info->revn,
adreno_gpu->rev.major, adreno_gpu->rev.minor, ADRENO_CHIPID_ARGS(adreno_gpu->rev));
adreno_gpu->rev.patchid);
for (i = 0; i < gpu->nr_rings; i++) { for (i = 0; i < gpu->nr_rings; i++) {
struct msm_ringbuffer *ring = gpu->rb[i]; struct msm_ringbuffer *ring = gpu->rb[i];
...@@ -1106,9 +1104,8 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, ...@@ -1106,9 +1104,8 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
speedbin = 0xffff; speedbin = 0xffff;
adreno_gpu->speedbin = (uint16_t) (0xffff & speedbin); adreno_gpu->speedbin = (uint16_t) (0xffff & speedbin);
gpu_name = devm_kasprintf(dev, GFP_KERNEL, "%d.%d.%d.%d", gpu_name = devm_kasprintf(dev, GFP_KERNEL, "%"ADRENO_CHIPID_FMT,
rev->core, rev->major, rev->minor, ADRENO_CHIPID_ARGS(config->rev));
rev->patchid);
if (!gpu_name) if (!gpu_name)
return -ENOMEM; return -ENOMEM;
......
...@@ -66,6 +66,12 @@ struct adreno_rev { ...@@ -66,6 +66,12 @@ struct adreno_rev {
#define ADRENO_REV(core, major, minor, patchid) \ #define ADRENO_REV(core, major, minor, patchid) \
((struct adreno_rev){ core, major, minor, patchid }) ((struct adreno_rev){ core, major, minor, patchid })
/* Helper for formating the chip_id in the way that userspace tools like
* crashdec expect.
*/
#define ADRENO_CHIPID_FMT "u.%u.%u.%u"
#define ADRENO_CHIPID_ARGS(_r) (_r).core, (_r).major, (_r).minor, (_r).patchid
struct adreno_gpu_funcs { struct adreno_gpu_funcs {
struct msm_gpu_funcs base; struct msm_gpu_funcs base;
int (*get_timestamp)(struct msm_gpu *gpu, uint64_t *value); int (*get_timestamp)(struct msm_gpu *gpu, uint64_t *value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment