mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			54 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From 12da899e9496f711140ed4fdaa4f94b383629c03 Mon Sep 17 00:00:00 2001
 | |
| From: Dave Stevenson <dave.stevenson@raspberrypi.com>
 | |
| Date: Tue, 3 Jan 2023 16:53:37 +0000
 | |
| Subject: [PATCH 546/726] media: dw9807-vcm: Smooth the first user movement of
 | |
|  the lens
 | |
| 
 | |
| The power up/down sequence is already ramped. Extend this to
 | |
| the first user movement as well, as this will generally avoid
 | |
| the "tick" noises due to rapid movements and overshooting.
 | |
| Subsequent movements are generally smaller and so don't cause
 | |
| issues.
 | |
| 
 | |
| Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
 | |
| ---
 | |
|  drivers/media/i2c/dw9807-vcm.c | 7 ++++++-
 | |
|  1 file changed, 6 insertions(+), 1 deletion(-)
 | |
| 
 | |
| diff --git a/drivers/media/i2c/dw9807-vcm.c b/drivers/media/i2c/dw9807-vcm.c
 | |
| index 0bd9fe75deb5..85412361e991 100644
 | |
| --- a/drivers/media/i2c/dw9807-vcm.c
 | |
| +++ b/drivers/media/i2c/dw9807-vcm.c
 | |
| @@ -62,6 +62,7 @@ struct dw9807_device {
 | |
|  	u16 idle_pos;
 | |
|  	struct regulator *vdd;
 | |
|  	struct notifier_block notifier;
 | |
| +	bool first;
 | |
|  };
 | |
|  
 | |
|  static inline struct dw9807_device *sd_to_dw9807_vcm(
 | |
| @@ -176,6 +177,8 @@ static int dw9807_active(struct dw9807_device *dw9807_dev)
 | |
|  		return ret;
 | |
|  	}
 | |
|  
 | |
| +	dw9807_dev->first = true;
 | |
| +
 | |
|  	return dw9807_ramp(client, dw9807_dev->idle_pos, dw9807_dev->current_val);
 | |
|  }
 | |
|  
 | |
| @@ -230,9 +233,11 @@ static int dw9807_set_ctrl(struct v4l2_ctrl *ctrl)
 | |
|  
 | |
|  	if (ctrl->id == V4L2_CID_FOCUS_ABSOLUTE) {
 | |
|  		struct i2c_client *client = v4l2_get_subdevdata(&dev_vcm->sd);
 | |
| +		int start = (dev_vcm->first) ? dev_vcm->current_val : ctrl->val;
 | |
|  
 | |
| +		dev_vcm->first = false;
 | |
|  		dev_vcm->current_val = ctrl->val;
 | |
| -		return dw9807_ramp(client, ctrl->val, ctrl->val);
 | |
| +		return dw9807_ramp(client, start, ctrl->val);
 | |
|  	}
 | |
|  
 | |
|  	return -EINVAL;
 | |
| -- 
 | |
| 2.33.1
 | |
| 
 |