[libcamera-devel,v2,1/3] libcamera: media_device: add hwRevision method
diff mbox series

Message ID 20210225171205.23341-2-dafna.hirschfeld@collabora.com
State Changes Requested
Headers show
Series
  • rkisp1: add an initial support to different hw revision
Related show

Commit Message

Dafna Hirschfeld Feb. 25, 2021, 5:12 p.m. UTC
Add a method 'hwRevision' to return the
info.hw_version reported by the driver.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
---
 include/libcamera/internal/media_device.h | 2 ++
 src/libcamera/media_device.cpp            | 1 +
 2 files changed, 3 insertions(+)

Comments

Laurent Pinchart March 2, 2021, 7:52 p.m. UTC | #1
Hi Dafna,

Thank you for the patch.

On Thu, Feb 25, 2021 at 06:12:03PM +0100, Dafna Hirschfeld wrote:
> Add a method 'hwRevision' to return the
> info.hw_version reported by the driver.

The code looks fine, but documentation for the new function is missing.
Didn't doxygen warn you ?

> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
>  include/libcamera/internal/media_device.h | 2 ++
>  src/libcamera/media_device.cpp            | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h
> index d0459cde..c3292508 100644
> --- a/include/libcamera/internal/media_device.h
> +++ b/include/libcamera/internal/media_device.h
> @@ -41,6 +41,7 @@ public:
>  	const std::string deviceNode() const { return deviceNode_; }
>  	const std::string model() const { return model_; }
>  	unsigned int version() const { return version_; }
> +	unsigned int hwRevision() const { return hwRevision_; }
>  
>  	const std::vector<MediaEntity *> &entities() const { return entities_; }
>  	MediaEntity *getEntityByName(const std::string &name) const;
> @@ -79,6 +80,7 @@ private:
>  	std::string deviceNode_;
>  	std::string model_;
>  	unsigned int version_;
> +	unsigned int hwRevision_;
>  
>  	int fd_;
>  	bool valid_;
> diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp
> index de18d572..ec964948 100644
> --- a/src/libcamera/media_device.cpp
> +++ b/src/libcamera/media_device.cpp
> @@ -231,6 +231,7 @@ int MediaDevice::populate()
>  	driver_ = info.driver;
>  	model_ = info.model;
>  	version_ = info.media_version;
> +	hwRevision_ = info.hw_revision;
>  
>  	/*
>  	 * Keep calling G_TOPOLOGY until the version number stays stable.
Dafna Hirschfeld March 5, 2021, 9:30 a.m. UTC | #2
On 02.03.21 20:52, Laurent Pinchart wrote:
> Hi Dafna,
> 
> Thank you for the patch.
> 
> On Thu, Feb 25, 2021 at 06:12:03PM +0100, Dafna Hirschfeld wrote:
>> Add a method 'hwRevision' to return the
>> info.hw_version reported by the driver.
> 
> The code looks fine, but documentation for the new function is missing.
> Didn't doxygen warn you ?

Oh, it did indeed, missed that

Thanks,
Dafna

> 
>> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
>> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
>> ---
>>   include/libcamera/internal/media_device.h | 2 ++
>>   src/libcamera/media_device.cpp            | 1 +
>>   2 files changed, 3 insertions(+)
>>
>> diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h
>> index d0459cde..c3292508 100644
>> --- a/include/libcamera/internal/media_device.h
>> +++ b/include/libcamera/internal/media_device.h
>> @@ -41,6 +41,7 @@ public:
>>   	const std::string deviceNode() const { return deviceNode_; }
>>   	const std::string model() const { return model_; }
>>   	unsigned int version() const { return version_; }
>> +	unsigned int hwRevision() const { return hwRevision_; }
>>   
>>   	const std::vector<MediaEntity *> &entities() const { return entities_; }
>>   	MediaEntity *getEntityByName(const std::string &name) const;
>> @@ -79,6 +80,7 @@ private:
>>   	std::string deviceNode_;
>>   	std::string model_;
>>   	unsigned int version_;
>> +	unsigned int hwRevision_;
>>   
>>   	int fd_;
>>   	bool valid_;
>> diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp
>> index de18d572..ec964948 100644
>> --- a/src/libcamera/media_device.cpp
>> +++ b/src/libcamera/media_device.cpp
>> @@ -231,6 +231,7 @@ int MediaDevice::populate()
>>   	driver_ = info.driver;
>>   	model_ = info.model;
>>   	version_ = info.media_version;
>> +	hwRevision_ = info.hw_revision;
>>   
>>   	/*
>>   	 * Keep calling G_TOPOLOGY until the version number stays stable.
>

Patch
diff mbox series

diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h
index d0459cde..c3292508 100644
--- a/include/libcamera/internal/media_device.h
+++ b/include/libcamera/internal/media_device.h
@@ -41,6 +41,7 @@  public:
 	const std::string deviceNode() const { return deviceNode_; }
 	const std::string model() const { return model_; }
 	unsigned int version() const { return version_; }
+	unsigned int hwRevision() const { return hwRevision_; }
 
 	const std::vector<MediaEntity *> &entities() const { return entities_; }
 	MediaEntity *getEntityByName(const std::string &name) const;
@@ -79,6 +80,7 @@  private:
 	std::string deviceNode_;
 	std::string model_;
 	unsigned int version_;
+	unsigned int hwRevision_;
 
 	int fd_;
 	bool valid_;
diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp
index de18d572..ec964948 100644
--- a/src/libcamera/media_device.cpp
+++ b/src/libcamera/media_device.cpp
@@ -231,6 +231,7 @@  int MediaDevice::populate()
 	driver_ = info.driver;
 	model_ = info.model;
 	version_ = info.media_version;
+	hwRevision_ = info.hw_revision;
 
 	/*
 	 * Keep calling G_TOPOLOGY until the version number stays stable.