@@ -1003,13 +1003,9 @@ static const char *const mira220_supply_name[] = {
1003
1003
#define MIRA220_NUM_SUPPLIES ARRAY_SIZE(mira220_supply_name)
1004
1004
1005
1005
1006
- // The supported formats. All flip/mirror combinations have the same byte order because the sensor
1007
- // is monochrome
1006
+ // Mira220 comes in monochrome and RGB variants. This driver implements the RGB variant.
1008
1007
1009
1008
static const u32 codes [] = {
1010
- //MEDIA_BUS_FMT_Y8_1X8,
1011
- //MEDIA_BUS_FMT_Y10_1X10,
1012
- //MEDIA_BUS_FMT_Y12_1X12,
1013
1009
MEDIA_BUS_FMT_SGRBG8_1X8 ,
1014
1010
MEDIA_BUS_FMT_SGRBG10_1X10 ,
1015
1011
MEDIA_BUS_FMT_SGRBG12_1X12 ,
@@ -1051,7 +1047,6 @@ struct mira220 {
1051
1047
struct clk * xclk ; /* system clock to MIRA220 */
1052
1048
u32 xclk_freq ;
1053
1049
1054
- //struct gpio_desc *reset_gpio;
1055
1050
struct regulator_bulk_data supplies [MIRA220_NUM_SUPPLIES ];
1056
1051
1057
1052
struct v4l2_ctrl_handler ctrl_handler ;
@@ -1071,11 +1066,6 @@ struct mira220 {
1071
1066
1072
1067
struct mutex mutex ;
1073
1068
1074
- /* Streaming on/off */
1075
- bool streaming ;
1076
-
1077
- /* User specified I2C device address */
1078
- u32 tbd_client_i2c_addr ;
1079
1069
struct regmap * regmap ;
1080
1070
};
1081
1071
@@ -1096,19 +1086,20 @@ static int mira220_power_on(struct device *dev)
1096
1086
if (ret ) {
1097
1087
dev_err (& client -> dev , "%s: failed to enable regulators\n" ,
1098
1088
__func__ );
1099
- return ret ;
1089
+ goto reg_off ;
1100
1090
}
1101
1091
ret = clk_prepare_enable (mira220 -> xclk );
1102
1092
if (ret ) {
1103
1093
dev_err (& client -> dev , "%s: failed to enable clock\n" , __func__ );
1104
- goto reg_off ;
1094
+ goto clk_off ;
1105
1095
}
1106
- // gpiod_set_value_cansleep(mira220->reset_gpio, 1);
1107
1096
usleep_range (MIRA220_XCLR_MIN_DELAY_US ,
1108
1097
MIRA220_XCLR_MIN_DELAY_US + MIRA220_XCLR_DELAY_RANGE_US );
1109
1098
1110
1099
return 0 ;
1111
1100
1101
+ clk_off :
1102
+ clk_disable_unprepare (mira220 -> xclk );
1112
1103
reg_off :
1113
1104
ret = regulator_bulk_disable (MIRA220_NUM_SUPPLIES , mira220 -> supplies );
1114
1105
return ret ;
@@ -1121,8 +1112,8 @@ static int mira220_power_off(struct device *dev)
1121
1112
struct mira220 * mira220 = to_mira220 (sd );
1122
1113
(void )mira220 ;
1123
1114
1124
- regulator_bulk_disable (MIRA220_NUM_SUPPLIES , mira220 -> supplies );
1125
1115
clk_disable_unprepare (mira220 -> xclk );
1116
+ regulator_bulk_disable (MIRA220_NUM_SUPPLIES , mira220 -> supplies );
1126
1117
1127
1118
return 0 ;
1128
1119
}
@@ -1337,7 +1328,6 @@ static int mira220_set_ctrl(struct v4l2_ctrl *ctrl)
1337
1328
1338
1329
switch (ctrl -> id ) {
1339
1330
case V4L2_CID_ANALOGUE_GAIN :
1340
- // ret = mira220_write_analog_gain_reg(mira220, ctrl->val);
1341
1331
break ;
1342
1332
case V4L2_CID_EXPOSURE :
1343
1333
ret = mira220_write_exposure_reg (mira220 , ctrl -> val );
@@ -1684,7 +1674,6 @@ static int mira220_start_streaming(struct mira220 *mira220)
1684
1674
reg_list = & mira220 -> mode -> reg_list ;
1685
1675
ret = cci_multi_reg_write (mira220 -> regmap , reg_list -> regs ,
1686
1676
reg_list -> num_of_regs , NULL );
1687
- // ret = mira220_write_regs(mira220, reg_list->regs, reg_list->num_of_regs);
1688
1677
if (ret ) {
1689
1678
dev_err (& client -> dev , "%s failed to set mode\n" , __func__ );
1690
1679
goto err_rpm_put ;
@@ -1742,10 +1731,6 @@ static int mira220_set_stream(struct v4l2_subdev *sd, int enable)
1742
1731
int ret = 0 ;
1743
1732
1744
1733
mutex_lock (& mira220 -> mutex );
1745
- if (mira220 -> streaming == enable ) {
1746
- mutex_unlock (& mira220 -> mutex );
1747
- return 0 ;
1748
- }
1749
1734
1750
1735
if (enable ) {
1751
1736
/*
@@ -1759,8 +1744,6 @@ static int mira220_set_stream(struct v4l2_subdev *sd, int enable)
1759
1744
mira220_stop_streaming (mira220 );
1760
1745
}
1761
1746
1762
- mira220 -> streaming = enable ;
1763
-
1764
1747
mutex_unlock (& mira220 -> mutex );
1765
1748
1766
1749
return ret ;
@@ -1771,40 +1754,6 @@ static int mira220_set_stream(struct v4l2_subdev *sd, int enable)
1771
1754
return ret ;
1772
1755
}
1773
1756
1774
- static int __maybe_unused mira220_suspend (struct device * dev )
1775
- {
1776
- struct i2c_client * client = to_i2c_client (dev );
1777
- struct v4l2_subdev * sd = i2c_get_clientdata (client );
1778
- struct mira220 * mira220 = to_mira220 (sd );
1779
-
1780
- if (mira220 -> streaming )
1781
- mira220_stop_streaming (mira220 );
1782
-
1783
- return 0 ;
1784
- }
1785
-
1786
- static int __maybe_unused mira220_resume (struct device * dev )
1787
- {
1788
- struct i2c_client * client = to_i2c_client (dev );
1789
- struct v4l2_subdev * sd = i2c_get_clientdata (client );
1790
- struct mira220 * mira220 = to_mira220 (sd );
1791
- int ret ;
1792
-
1793
- if (mira220 -> streaming ) {
1794
- ret = mira220_start_streaming (mira220 );
1795
- if (ret )
1796
- goto error ;
1797
- }
1798
-
1799
- return 0 ;
1800
-
1801
- error :
1802
- mira220_stop_streaming (mira220 );
1803
- mira220 -> streaming = false;
1804
-
1805
- return ret ;
1806
- }
1807
-
1808
1757
static int mira220_get_regulators (struct mira220 * mira220 )
1809
1758
{
1810
1759
struct i2c_client * client = v4l2_get_subdevdata (& mira220 -> sd );
@@ -1941,10 +1890,6 @@ static int mira220_init_controls(struct mira220 *mira220)
1941
1890
mira220 -> mode -> hblank , mira220 -> mode -> hblank ,
1942
1891
1 , mira220 -> mode -> hblank );
1943
1892
1944
- // Make the vblank control read only. This could be changed to allow changing framerate in
1945
- // runtime, but would require adapting other settings
1946
- // mira220->vblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
1947
-
1948
1893
// Exposure is indicated in number of lines here
1949
1894
// Max is determined by vblank + vsize and Tglob.
1950
1895
max_exposure = mira220_calculate_max_exposure_time (
0 commit comments