All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] SMIA++ driver improvements
@ 2012-09-15 21:43 Sakari Ailus
  2012-09-15 21:43 ` [PATCH 1/2] smiapp: Use highest bits-per-pixel for sensor internal format Sakari Ailus
  2012-09-15 21:43 ` [PATCH 2/2] smiapp: Provide module identification information through sysfs Sakari Ailus
  0 siblings, 2 replies; 3+ messages in thread
From: Sakari Ailus @ 2012-09-15 21:43 UTC (permalink / raw)
  To: LMML

Hi,

The first one of these two small patches fixes a minor issue in format 
enumeration from the sensor, whereas the second one provides the module 
identification information to the user space through a sysfs file.

Regards,

-- 
Sakari Ailus
sakari.ailus@iki.fi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] smiapp: Use highest bits-per-pixel for sensor internal format
  2012-09-15 21:43 [PATCH 0/2] SMIA++ driver improvements Sakari Ailus
@ 2012-09-15 21:43 ` Sakari Ailus
  2012-09-15 21:43 ` [PATCH 2/2] smiapp: Provide module identification information through sysfs Sakari Ailus
  1 sibling, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2012-09-15 21:43 UTC (permalink / raw)
  To: linux-media

The format shown on the links internal to the sensor was the first one
enumerated from the sensor, not the highest bit depth data that can be
produced by the sensor. Correct this.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
---
 drivers/media/i2c/smiapp/smiapp-core.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 4f1c8d6..02bfa44 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -777,7 +777,11 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor)
 			dev_dbg(&client->dev, "jolly good! %d\n", j);
 
 			sensor->default_mbus_frame_fmts |= 1 << j;
-			if (!sensor->csi_format) {
+			if (!sensor->csi_format
+			    || f->width > sensor->csi_format->width
+			    || (f->width == sensor->csi_format->width
+				&& f->compressed
+				> sensor->csi_format->compressed)) {
 				sensor->csi_format = f;
 				sensor->internal_csi_format = f;
 			}
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] smiapp: Provide module identification information through sysfs
  2012-09-15 21:43 [PATCH 0/2] SMIA++ driver improvements Sakari Ailus
  2012-09-15 21:43 ` [PATCH 1/2] smiapp: Use highest bits-per-pixel for sensor internal format Sakari Ailus
@ 2012-09-15 21:43 ` Sakari Ailus
  1 sibling, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2012-09-15 21:43 UTC (permalink / raw)
  To: linux-media

From: Sakari Ailus <sakari.ailus@iki.if>

Provide module ident information through sysfs.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.if>
---
 drivers/media/i2c/smiapp/smiapp-core.c |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 02bfa44..e08e588 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2211,6 +2211,21 @@ smiapp_sysfs_nvm_read(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR(nvm, S_IRUGO, smiapp_sysfs_nvm_read, NULL);
 
+static ssize_t
+smiapp_sysfs_ident_read(struct device *dev, struct device_attribute *attr,
+			char *buf)
+{
+	struct v4l2_subdev *subdev = i2c_get_clientdata(to_i2c_client(dev));
+	struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
+	struct smiapp_module_info *minfo = &sensor->minfo;
+
+	return snprintf(buf, PAGE_SIZE, "%2.2x%4.4x%2.2x\n",
+			minfo->manufacturer_id, minfo->model_id,
+			minfo->revision_number_major) + 1;
+}
+
+static DEVICE_ATTR(ident, S_IRUGO, smiapp_sysfs_ident_read, NULL);
+
 /* -----------------------------------------------------------------------------
  * V4L2 subdev core operations
  */
@@ -2467,6 +2482,11 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
 	sensor->binning_horizontal = 1;
 	sensor->binning_vertical = 1;
 
+	if (device_create_file(&client->dev, &dev_attr_ident) != 0) {
+		dev_err(&client->dev, "sysfs ident entry creation failed\n");
+		rval = -ENOENT;
+		goto out_power_off;
+	}
 	/* SMIA++ NVM initialization - it will be read from the sensor
 	 * when it is first requested by userspace.
 	 */
@@ -2476,13 +2496,13 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
 		if (sensor->nvm == NULL) {
 			dev_err(&client->dev, "nvm buf allocation failed\n");
 			rval = -ENOMEM;
-			goto out_power_off;
+			goto out_ident_release;
 		}
 
 		if (device_create_file(&client->dev, &dev_attr_nvm) != 0) {
 			dev_err(&client->dev, "sysfs nvm entry failed\n");
 			rval = -EBUSY;
-			goto out_power_off;
+			goto out_ident_release;
 		}
 	}
 
@@ -2637,6 +2657,9 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
 out_nvm_release:
 	device_remove_file(&client->dev, &dev_attr_nvm);
 
+out_ident_release:
+	device_remove_file(&client->dev, &dev_attr_ident);
+
 out_power_off:
 	smiapp_power_off(sensor);
 
@@ -2832,6 +2855,7 @@ static int __exit smiapp_remove(struct i2c_client *client)
 		sensor->power_count = 0;
 	}
 
+	device_remove_file(&client->dev, &dev_attr_ident);
 	if (sensor->nvm)
 		device_remove_file(&client->dev, &dev_attr_nvm);
 
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-15 21:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-15 21:43 [PATCH 0/2] SMIA++ driver improvements Sakari Ailus
2012-09-15 21:43 ` [PATCH 1/2] smiapp: Use highest bits-per-pixel for sensor internal format Sakari Ailus
2012-09-15 21:43 ` [PATCH 2/2] smiapp: Provide module identification information through sysfs Sakari Ailus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.