summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/platform/tegra/camera/tegracam_core.c18
-rw-r--r--include/media/tegracam_core.h4
2 files changed, 21 insertions, 1 deletions
diff --git a/drivers/media/platform/tegra/camera/tegracam_core.c b/drivers/media/platform/tegra/camera/tegracam_core.c
index 6765f96ad..6e5249c1d 100644
--- a/drivers/media/platform/tegra/camera/tegracam_core.c
+++ b/drivers/media/platform/tegra/camera/tegracam_core.c
@@ -19,6 +19,17 @@
19#include <media/tegra-v4l2-camera.h> 19#include <media/tegra-v4l2-camera.h>
20#include <media/tegracam_core.h> 20#include <media/tegracam_core.h>
21 21
22/* use semantic versioning convention */
23#define TEGRACAM_MAJOR_VERSION 2
24#define TEGRACAM_MINOR_VERSION 0
25#define TEGRACAM_PATCH_VERSION 0
26
27u32 tegracam_version(u8 major, u8 minor, u8 patch)
28{
29 return ((major << 16) | (minor << 8) | patch);
30}
31EXPORT_SYMBOL_GPL(tegracam_version);
32
22struct tegracam_device *to_tegracam_device(struct camera_common_data *data) 33struct tegracam_device *to_tegracam_device(struct camera_common_data *data)
23{ 34{
24 /* fix this by moving subdev to base struct */ 35 /* fix this by moving subdev to base struct */
@@ -119,6 +130,13 @@ int tegracam_device_register(struct tegracam_device *tc_dev)
119 s_data->frmfmt[mode_idx].size.height; 130 s_data->frmfmt[mode_idx].size.height;
120 s_data->def_clk_freq = signal_props->mclk_freq * 1000; 131 s_data->def_clk_freq = signal_props->mclk_freq * 1000;
121 132
133 /* add version info to identify the right feature set */
134 tc_dev->version = tegracam_version(TEGRACAM_MAJOR_VERSION,
135 TEGRACAM_MINOR_VERSION, TEGRACAM_PATCH_VERSION);
136 dev_info(dev, "tegracam sensor driver:%s_v%d.%d.%d\n",
137 tc_dev->name, TEGRACAM_MAJOR_VERSION,
138 TEGRACAM_MINOR_VERSION, TEGRACAM_PATCH_VERSION);
139
122 return 0; 140 return 0;
123} 141}
124EXPORT_SYMBOL_GPL(tegracam_device_register); 142EXPORT_SYMBOL_GPL(tegracam_device_register);
diff --git a/include/media/tegracam_core.h b/include/media/tegracam_core.h
index 5725cb437..8a7cdb9d0 100644
--- a/include/media/tegracam_core.h
+++ b/include/media/tegracam_core.h
@@ -1,7 +1,7 @@
1/** 1/**
2 * tegracam_core.h - tegra camera framework core utilities 2 * tegracam_core.h - tegra camera framework core utilities
3 * 3 *
4 * Copyright (c) 2017-2018, NVIDIA Corporation. All rights reserved. 4 * Copyright (c) 2017-2019, NVIDIA Corporation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -24,6 +24,7 @@
24struct tegracam_device { 24struct tegracam_device {
25 struct camera_common_data *s_data; 25 struct camera_common_data *s_data;
26 struct media_pad pad; 26 struct media_pad pad;
27 u32 version;
27 /* variables to be filled by the driver to register */ 28 /* variables to be filled by the driver to register */
28 char name[32]; 29 char name[32];
29 struct i2c_client *client; 30 struct i2c_client *client;
@@ -39,6 +40,7 @@ struct tegracam_device {
39 void *priv; 40 void *priv;
40}; 41};
41 42
43u32 tegracam_version(u8 major, u8 minor, u8 patch);
42struct tegracam_device *to_tegracam_device(struct camera_common_data *data); 44struct tegracam_device *to_tegracam_device(struct camera_common_data *data);
43 45
44void tegracam_set_privdata(struct tegracam_device *tc_dev, void *priv); 46void tegracam_set_privdata(struct tegracam_device *tc_dev, void *priv);