aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@maxwell.research.nokia.com>2012-04-22 07:55:10 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-20 11:45:01 -0400
commit1e73eea781bc302ba7f35da89d627bd355a7814a (patch)
tree8a618353b8530b6cf4a97c35c1a06fd85bd3a38d /drivers/media
parent2547428de05d5bc45d3144a0ebc51e3f249a2bc0 (diff)
[media] smiapp: Pass struct sensor to register writing commands instead of i2c_client
Pass struct sensor to register access commands. This allows taking quirks into account in register access. Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/smiapp/smiapp-core.c154
-rw-r--r--drivers/media/video/smiapp/smiapp-quirk.c4
-rw-r--r--drivers/media/video/smiapp/smiapp-regs.c7
-rw-r--r--drivers/media/video/smiapp/smiapp-regs.h6
4 files changed, 84 insertions, 87 deletions
diff --git a/drivers/media/video/smiapp/smiapp-core.c b/drivers/media/video/smiapp/smiapp-core.c
index 999f3fc867c7..de5c94762916 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -75,12 +75,12 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor *sensor)
75 int embedded_start = -1, embedded_end = -1; 75 int embedded_start = -1, embedded_end = -1;
76 int image_start = 0; 76 int image_start = 0;
77 77
78 rval = smiapp_read(client, SMIAPP_REG_U8_FRAME_FORMAT_MODEL_TYPE, 78 rval = smiapp_read(sensor, SMIAPP_REG_U8_FRAME_FORMAT_MODEL_TYPE,
79 &fmt_model_type); 79 &fmt_model_type);
80 if (rval) 80 if (rval)
81 return rval; 81 return rval;
82 82
83 rval = smiapp_read(client, SMIAPP_REG_U8_FRAME_FORMAT_MODEL_SUBTYPE, 83 rval = smiapp_read(sensor, SMIAPP_REG_U8_FRAME_FORMAT_MODEL_SUBTYPE,
84 &fmt_model_subtype); 84 &fmt_model_subtype);
85 if (rval) 85 if (rval)
86 return rval; 86 return rval;
@@ -106,7 +106,7 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor *sensor)
106 106
107 if (fmt_model_type == SMIAPP_FRAME_FORMAT_MODEL_TYPE_2BYTE) { 107 if (fmt_model_type == SMIAPP_FRAME_FORMAT_MODEL_TYPE_2BYTE) {
108 rval = smiapp_read( 108 rval = smiapp_read(
109 client, 109 sensor,
110 SMIAPP_REG_U16_FRAME_FORMAT_DESCRIPTOR_2(i), 110 SMIAPP_REG_U16_FRAME_FORMAT_DESCRIPTOR_2(i),
111 &desc); 111 &desc);
112 if (rval) 112 if (rval)
@@ -120,7 +120,7 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor *sensor)
120 } else if (fmt_model_type 120 } else if (fmt_model_type
121 == SMIAPP_FRAME_FORMAT_MODEL_TYPE_4BYTE) { 121 == SMIAPP_FRAME_FORMAT_MODEL_TYPE_4BYTE) {
122 rval = smiapp_read( 122 rval = smiapp_read(
123 client, 123 sensor,
124 SMIAPP_REG_U32_FRAME_FORMAT_DESCRIPTOR_4(i), 124 SMIAPP_REG_U32_FRAME_FORMAT_DESCRIPTOR_4(i),
125 &desc); 125 &desc);
126 if (rval) 126 if (rval)
@@ -199,44 +199,43 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor *sensor)
199 199
200static int smiapp_pll_configure(struct smiapp_sensor *sensor) 200static int smiapp_pll_configure(struct smiapp_sensor *sensor)
201{ 201{
202 struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
203 struct smiapp_pll *pll = &sensor->pll; 202 struct smiapp_pll *pll = &sensor->pll;
204 int rval; 203 int rval;
205 204
206 rval = smiapp_write( 205 rval = smiapp_write(
207 client, SMIAPP_REG_U16_VT_PIX_CLK_DIV, pll->vt_pix_clk_div); 206 sensor, SMIAPP_REG_U16_VT_PIX_CLK_DIV, pll->vt_pix_clk_div);
208 if (rval < 0) 207 if (rval < 0)
209 return rval; 208 return rval;
210 209
211 rval = smiapp_write( 210 rval = smiapp_write(
212 client, SMIAPP_REG_U16_VT_SYS_CLK_DIV, pll->vt_sys_clk_div); 211 sensor, SMIAPP_REG_U16_VT_SYS_CLK_DIV, pll->vt_sys_clk_div);
213 if (rval < 0) 212 if (rval < 0)
214 return rval; 213 return rval;
215 214
216 rval = smiapp_write( 215 rval = smiapp_write(
217 client, SMIAPP_REG_U16_PRE_PLL_CLK_DIV, pll->pre_pll_clk_div); 216 sensor, SMIAPP_REG_U16_PRE_PLL_CLK_DIV, pll->pre_pll_clk_div);
218 if (rval < 0) 217 if (rval < 0)
219 return rval; 218 return rval;
220 219
221 rval = smiapp_write( 220 rval = smiapp_write(
222 client, SMIAPP_REG_U16_PLL_MULTIPLIER, pll->pll_multiplier); 221 sensor, SMIAPP_REG_U16_PLL_MULTIPLIER, pll->pll_multiplier);
223 if (rval < 0) 222 if (rval < 0)
224 return rval; 223 return rval;
225 224
226 /* Lane op clock ratio does not apply here. */ 225 /* Lane op clock ratio does not apply here. */
227 rval = smiapp_write( 226 rval = smiapp_write(
228 client, SMIAPP_REG_U32_REQUESTED_LINK_BIT_RATE_MBPS, 227 sensor, SMIAPP_REG_U32_REQUESTED_LINK_BIT_RATE_MBPS,
229 DIV_ROUND_UP(pll->op_sys_clk_freq_hz, 1000000 / 256 / 256)); 228 DIV_ROUND_UP(pll->op_sys_clk_freq_hz, 1000000 / 256 / 256));
230 if (rval < 0 || sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0) 229 if (rval < 0 || sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0)
231 return rval; 230 return rval;
232 231
233 rval = smiapp_write( 232 rval = smiapp_write(
234 client, SMIAPP_REG_U16_OP_PIX_CLK_DIV, pll->op_pix_clk_div); 233 sensor, SMIAPP_REG_U16_OP_PIX_CLK_DIV, pll->op_pix_clk_div);
235 if (rval < 0) 234 if (rval < 0)
236 return rval; 235 return rval;
237 236
238 return smiapp_write( 237 return smiapp_write(
239 client, SMIAPP_REG_U16_OP_SYS_CLK_DIV, pll->op_sys_clk_div); 238 sensor, SMIAPP_REG_U16_OP_SYS_CLK_DIV, pll->op_sys_clk_div);
240} 239}
241 240
242static int smiapp_pll_update(struct smiapp_sensor *sensor) 241static int smiapp_pll_update(struct smiapp_sensor *sensor)
@@ -425,7 +424,6 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
425 struct smiapp_sensor *sensor = 424 struct smiapp_sensor *sensor =
426 container_of(ctrl->handler, struct smiapp_subdev, ctrl_handler) 425 container_of(ctrl->handler, struct smiapp_subdev, ctrl_handler)
427 ->sensor; 426 ->sensor;
428 struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
429 u32 orient = 0; 427 u32 orient = 0;
430 int exposure; 428 int exposure;
431 int rval; 429 int rval;
@@ -433,12 +431,12 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
433 switch (ctrl->id) { 431 switch (ctrl->id) {
434 case V4L2_CID_ANALOGUE_GAIN: 432 case V4L2_CID_ANALOGUE_GAIN:
435 return smiapp_write( 433 return smiapp_write(
436 client, 434 sensor,
437 SMIAPP_REG_U16_ANALOGUE_GAIN_CODE_GLOBAL, ctrl->val); 435 SMIAPP_REG_U16_ANALOGUE_GAIN_CODE_GLOBAL, ctrl->val);
438 436
439 case V4L2_CID_EXPOSURE: 437 case V4L2_CID_EXPOSURE:
440 return smiapp_write( 438 return smiapp_write(
441 client, 439 sensor,
442 SMIAPP_REG_U16_COARSE_INTEGRATION_TIME, ctrl->val); 440 SMIAPP_REG_U16_COARSE_INTEGRATION_TIME, ctrl->val);
443 441
444 case V4L2_CID_HFLIP: 442 case V4L2_CID_HFLIP:
@@ -453,7 +451,7 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
453 orient |= SMIAPP_IMAGE_ORIENTATION_VFLIP; 451 orient |= SMIAPP_IMAGE_ORIENTATION_VFLIP;
454 452
455 orient ^= sensor->hvflip_inv_mask; 453 orient ^= sensor->hvflip_inv_mask;
456 rval = smiapp_write(client, 454 rval = smiapp_write(sensor,
457 SMIAPP_REG_U8_IMAGE_ORIENTATION, 455 SMIAPP_REG_U8_IMAGE_ORIENTATION,
458 orient); 456 orient);
459 if (rval < 0) 457 if (rval < 0)
@@ -478,13 +476,13 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
478 } 476 }
479 477
480 return smiapp_write( 478 return smiapp_write(
481 client, SMIAPP_REG_U16_FRAME_LENGTH_LINES, 479 sensor, SMIAPP_REG_U16_FRAME_LENGTH_LINES,
482 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height 480 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height
483 + ctrl->val); 481 + ctrl->val);
484 482
485 case V4L2_CID_HBLANK: 483 case V4L2_CID_HBLANK:
486 return smiapp_write( 484 return smiapp_write(
487 client, SMIAPP_REG_U16_LINE_LENGTH_PCK, 485 sensor, SMIAPP_REG_U16_LINE_LENGTH_PCK,
488 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width 486 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width
489 + ctrl->val); 487 + ctrl->val);
490 488
@@ -624,7 +622,7 @@ static int smiapp_get_limits(struct smiapp_sensor *sensor, int const *limit,
624 622
625 for (i = 0; i < n; i++) { 623 for (i = 0; i < n; i++) {
626 rval = smiapp_read( 624 rval = smiapp_read(
627 client, smiapp_reg_limits[limit[i]].addr, &val); 625 sensor, smiapp_reg_limits[limit[i]].addr, &val);
628 if (rval) 626 if (rval)
629 return rval; 627 return rval;
630 sensor->limits[limit[i]] = val; 628 sensor->limits[limit[i]] = val;
@@ -696,13 +694,13 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor)
696 int rval; 694 int rval;
697 695
698 rval = smiapp_read( 696 rval = smiapp_read(
699 client, SMIAPP_REG_U8_DATA_FORMAT_MODEL_TYPE, &type); 697 sensor, SMIAPP_REG_U8_DATA_FORMAT_MODEL_TYPE, &type);
700 if (rval) 698 if (rval)
701 return rval; 699 return rval;
702 700
703 dev_dbg(&client->dev, "data_format_model_type %d\n", type); 701 dev_dbg(&client->dev, "data_format_model_type %d\n", type);
704 702
705 rval = smiapp_read(client, SMIAPP_REG_U8_PIXEL_ORDER, 703 rval = smiapp_read(sensor, SMIAPP_REG_U8_PIXEL_ORDER,
706 &pixel_order); 704 &pixel_order);
707 if (rval) 705 if (rval)
708 return rval; 706 return rval;
@@ -733,7 +731,7 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor)
733 unsigned int fmt, j; 731 unsigned int fmt, j;
734 732
735 rval = smiapp_read( 733 rval = smiapp_read(
736 client, 734 sensor,
737 SMIAPP_REG_U16_DATA_FORMAT_DESCRIPTOR(i), &fmt); 735 SMIAPP_REG_U16_DATA_FORMAT_DESCRIPTOR(i), &fmt);
738 if (rval) 736 if (rval)
739 return rval; 737 return rval;
@@ -831,13 +829,13 @@ static int smiapp_update_mode(struct smiapp_sensor *sensor)
831 | sensor->binning_vertical; 829 | sensor->binning_vertical;
832 830
833 rval = smiapp_write( 831 rval = smiapp_write(
834 client, SMIAPP_REG_U8_BINNING_TYPE, binning_type); 832 sensor, SMIAPP_REG_U8_BINNING_TYPE, binning_type);
835 if (rval < 0) 833 if (rval < 0)
836 return rval; 834 return rval;
837 835
838 binning_mode = 1; 836 binning_mode = 1;
839 } 837 }
840 rval = smiapp_write(client, SMIAPP_REG_U8_BINNING_MODE, binning_mode); 838 rval = smiapp_write(sensor, SMIAPP_REG_U8_BINNING_MODE, binning_mode);
841 if (rval < 0) 839 if (rval < 0)
842 return rval; 840 return rval;
843 841
@@ -874,19 +872,18 @@ static int smiapp_update_mode(struct smiapp_sensor *sensor)
874static int smiapp_read_nvm(struct smiapp_sensor *sensor, 872static int smiapp_read_nvm(struct smiapp_sensor *sensor,
875 unsigned char *nvm) 873 unsigned char *nvm)
876{ 874{
877 struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
878 u32 i, s, p, np, v; 875 u32 i, s, p, np, v;
879 int rval, rval2; 876 int rval, rval2;
880 877
881 np = sensor->nvm_size / SMIAPP_NVM_PAGE_SIZE; 878 np = sensor->nvm_size / SMIAPP_NVM_PAGE_SIZE;
882 for (p = 0; p < np; p++) { 879 for (p = 0; p < np; p++) {
883 rval = smiapp_write( 880 rval = smiapp_write(
884 client, 881 sensor,
885 SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT, p); 882 SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT, p);
886 if (rval) 883 if (rval)
887 goto out; 884 goto out;
888 885
889 rval = smiapp_write(client, 886 rval = smiapp_write(sensor,
890 SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL, 887 SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL,
891 SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN | 888 SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN |
892 SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN); 889 SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN);
@@ -895,7 +892,7 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor,
895 892
896 for (i = 0; i < 1000; i++) { 893 for (i = 0; i < 1000; i++) {
897 rval = smiapp_read( 894 rval = smiapp_read(
898 client, 895 sensor,
899 SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS, &s); 896 SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS, &s);
900 897
901 if (rval) 898 if (rval)
@@ -913,7 +910,7 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor,
913 910
914 for (i = 0; i < SMIAPP_NVM_PAGE_SIZE; i++) { 911 for (i = 0; i < SMIAPP_NVM_PAGE_SIZE; i++) {
915 rval = smiapp_read( 912 rval = smiapp_read(
916 client, 913 sensor,
917 SMIAPP_REG_U8_DATA_TRANSFER_IF_1_DATA_0 + i, 914 SMIAPP_REG_U8_DATA_TRANSFER_IF_1_DATA_0 + i,
918 &v); 915 &v);
919 if (rval) 916 if (rval)
@@ -924,7 +921,7 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor,
924 } 921 }
925 922
926out: 923out:
927 rval2 = smiapp_write(client, SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL, 0); 924 rval2 = smiapp_write(sensor, SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL, 0);
928 if (rval < 0) 925 if (rval < 0)
929 return rval; 926 return rval;
930 else 927 else
@@ -944,7 +941,7 @@ static int smiapp_change_cci_addr(struct smiapp_sensor *sensor)
944 941
945 client->addr = sensor->platform_data->i2c_addr_dfl; 942 client->addr = sensor->platform_data->i2c_addr_dfl;
946 943
947 rval = smiapp_write(client, 944 rval = smiapp_write(sensor,
948 SMIAPP_REG_U8_CCI_ADDRESS_CONTROL, 945 SMIAPP_REG_U8_CCI_ADDRESS_CONTROL,
949 sensor->platform_data->i2c_addr_alt << 1); 946 sensor->platform_data->i2c_addr_alt << 1);
950 if (rval) 947 if (rval)
@@ -953,7 +950,7 @@ static int smiapp_change_cci_addr(struct smiapp_sensor *sensor)
953 client->addr = sensor->platform_data->i2c_addr_alt; 950 client->addr = sensor->platform_data->i2c_addr_alt;
954 951
955 /* verify addr change went ok */ 952 /* verify addr change went ok */
956 rval = smiapp_read(client, SMIAPP_REG_U8_CCI_ADDRESS_CONTROL, &val); 953 rval = smiapp_read(sensor, SMIAPP_REG_U8_CCI_ADDRESS_CONTROL, &val);
957 if (rval) 954 if (rval)
958 return rval; 955 return rval;
959 956
@@ -970,7 +967,6 @@ static int smiapp_change_cci_addr(struct smiapp_sensor *sensor)
970 */ 967 */
971static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor) 968static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor)
972{ 969{
973 struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
974 struct smiapp_flash_strobe_parms *strobe_setup; 970 struct smiapp_flash_strobe_parms *strobe_setup;
975 unsigned int ext_freq = sensor->platform_data->ext_clk; 971 unsigned int ext_freq = sensor->platform_data->ext_clk;
976 u32 tmp; 972 u32 tmp;
@@ -1060,33 +1056,33 @@ static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor)
1060 strobe_width_high_rs = (tmp + strobe_adjustment - 1) / 1056 strobe_width_high_rs = (tmp + strobe_adjustment - 1) /
1061 strobe_adjustment; 1057 strobe_adjustment;
1062 1058
1063 rval = smiapp_write(client, SMIAPP_REG_U8_FLASH_MODE_RS, 1059 rval = smiapp_write(sensor, SMIAPP_REG_U8_FLASH_MODE_RS,
1064 strobe_setup->mode); 1060 strobe_setup->mode);
1065 if (rval < 0) 1061 if (rval < 0)
1066 goto out; 1062 goto out;
1067 1063
1068 rval = smiapp_write(client, SMIAPP_REG_U8_FLASH_STROBE_ADJUSTMENT, 1064 rval = smiapp_write(sensor, SMIAPP_REG_U8_FLASH_STROBE_ADJUSTMENT,
1069 strobe_adjustment); 1065 strobe_adjustment);
1070 if (rval < 0) 1066 if (rval < 0)
1071 goto out; 1067 goto out;
1072 1068
1073 rval = smiapp_write( 1069 rval = smiapp_write(
1074 client, SMIAPP_REG_U16_TFLASH_STROBE_WIDTH_HIGH_RS_CTRL, 1070 sensor, SMIAPP_REG_U16_TFLASH_STROBE_WIDTH_HIGH_RS_CTRL,
1075 strobe_width_high_rs); 1071 strobe_width_high_rs);
1076 if (rval < 0) 1072 if (rval < 0)
1077 goto out; 1073 goto out;
1078 1074
1079 rval = smiapp_write(client, SMIAPP_REG_U16_TFLASH_STROBE_DELAY_RS_CTRL, 1075 rval = smiapp_write(sensor, SMIAPP_REG_U16_TFLASH_STROBE_DELAY_RS_CTRL,
1080 strobe_setup->strobe_delay); 1076 strobe_setup->strobe_delay);
1081 if (rval < 0) 1077 if (rval < 0)
1082 goto out; 1078 goto out;
1083 1079
1084 rval = smiapp_write(client, SMIAPP_REG_U16_FLASH_STROBE_START_POINT, 1080 rval = smiapp_write(sensor, SMIAPP_REG_U16_FLASH_STROBE_START_POINT,
1085 strobe_setup->stobe_start_point); 1081 strobe_setup->stobe_start_point);
1086 if (rval < 0) 1082 if (rval < 0)
1087 goto out; 1083 goto out;
1088 1084
1089 rval = smiapp_write(client, SMIAPP_REG_U8_FLASH_TRIGGER_RS, 1085 rval = smiapp_write(sensor, SMIAPP_REG_U8_FLASH_TRIGGER_RS,
1090 strobe_setup->trigger); 1086 strobe_setup->trigger);
1091 1087
1092out: 1088out:
@@ -1148,7 +1144,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
1148 } 1144 }
1149 } 1145 }
1150 1146
1151 rval = smiapp_write(client, SMIAPP_REG_U8_SOFTWARE_RESET, 1147 rval = smiapp_write(sensor, SMIAPP_REG_U8_SOFTWARE_RESET,
1152 SMIAPP_SOFTWARE_RESET); 1148 SMIAPP_SOFTWARE_RESET);
1153 if (rval < 0) { 1149 if (rval < 0) {
1154 dev_err(&client->dev, "software reset failed\n"); 1150 dev_err(&client->dev, "software reset failed\n");
@@ -1163,7 +1159,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
1163 } 1159 }
1164 } 1160 }
1165 1161
1166 rval = smiapp_write(client, SMIAPP_REG_U16_COMPRESSION_MODE, 1162 rval = smiapp_write(sensor, SMIAPP_REG_U16_COMPRESSION_MODE,
1167 SMIAPP_COMPRESSION_MODE_SIMPLE_PREDICTOR); 1163 SMIAPP_COMPRESSION_MODE_SIMPLE_PREDICTOR);
1168 if (rval) { 1164 if (rval) {
1169 dev_err(&client->dev, "compression mode set failed\n"); 1165 dev_err(&client->dev, "compression mode set failed\n");
@@ -1171,28 +1167,28 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
1171 } 1167 }
1172 1168
1173 rval = smiapp_write( 1169 rval = smiapp_write(
1174 client, SMIAPP_REG_U16_EXTCLK_FREQUENCY_MHZ, 1170 sensor, SMIAPP_REG_U16_EXTCLK_FREQUENCY_MHZ,
1175 sensor->platform_data->ext_clk / (1000000 / (1 << 8))); 1171 sensor->platform_data->ext_clk / (1000000 / (1 << 8)));
1176 if (rval) { 1172 if (rval) {
1177 dev_err(&client->dev, "extclk frequency set failed\n"); 1173 dev_err(&client->dev, "extclk frequency set failed\n");
1178 goto out_cci_addr_fail; 1174 goto out_cci_addr_fail;
1179 } 1175 }
1180 1176
1181 rval = smiapp_write(client, SMIAPP_REG_U8_CSI_LANE_MODE, 1177 rval = smiapp_write(sensor, SMIAPP_REG_U8_CSI_LANE_MODE,
1182 sensor->platform_data->lanes - 1); 1178 sensor->platform_data->lanes - 1);
1183 if (rval) { 1179 if (rval) {
1184 dev_err(&client->dev, "csi lane mode set failed\n"); 1180 dev_err(&client->dev, "csi lane mode set failed\n");
1185 goto out_cci_addr_fail; 1181 goto out_cci_addr_fail;
1186 } 1182 }
1187 1183
1188 rval = smiapp_write(client, SMIAPP_REG_U8_FAST_STANDBY_CTRL, 1184 rval = smiapp_write(sensor, SMIAPP_REG_U8_FAST_STANDBY_CTRL,
1189 SMIAPP_FAST_STANDBY_CTRL_IMMEDIATE); 1185 SMIAPP_FAST_STANDBY_CTRL_IMMEDIATE);
1190 if (rval) { 1186 if (rval) {
1191 dev_err(&client->dev, "fast standby set failed\n"); 1187 dev_err(&client->dev, "fast standby set failed\n");
1192 goto out_cci_addr_fail; 1188 goto out_cci_addr_fail;
1193 } 1189 }
1194 1190
1195 rval = smiapp_write(client, SMIAPP_REG_U8_CSI_SIGNALLING_MODE, 1191 rval = smiapp_write(sensor, SMIAPP_REG_U8_CSI_SIGNALLING_MODE,
1196 sensor->platform_data->csi_signalling_mode); 1192 sensor->platform_data->csi_signalling_mode);
1197 if (rval) { 1193 if (rval) {
1198 dev_err(&client->dev, "csi signalling mode set failed\n"); 1194 dev_err(&client->dev, "csi signalling mode set failed\n");
@@ -1200,7 +1196,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
1200 } 1196 }
1201 1197
1202 /* DPHY control done by sensor based on requested link rate */ 1198 /* DPHY control done by sensor based on requested link rate */
1203 rval = smiapp_write(client, SMIAPP_REG_U8_DPHY_CTRL, 1199 rval = smiapp_write(sensor, SMIAPP_REG_U8_DPHY_CTRL,
1204 SMIAPP_DPHY_CTRL_UI); 1200 SMIAPP_DPHY_CTRL_UI);
1205 if (rval < 0) 1201 if (rval < 0)
1206 return rval; 1202 return rval;
@@ -1247,8 +1243,6 @@ out_xclk_fail:
1247 1243
1248static void smiapp_power_off(struct smiapp_sensor *sensor) 1244static void smiapp_power_off(struct smiapp_sensor *sensor)
1249{ 1245{
1250 struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
1251
1252 /* 1246 /*
1253 * Currently power/clock to lens are enable/disabled separately 1247 * Currently power/clock to lens are enable/disabled separately
1254 * but they are essentially the same signals. So if the sensor is 1248 * but they are essentially the same signals. So if the sensor is
@@ -1257,7 +1251,7 @@ static void smiapp_power_off(struct smiapp_sensor *sensor)
1257 * will fail. So do a soft reset explicitly here. 1251 * will fail. So do a soft reset explicitly here.
1258 */ 1252 */
1259 if (sensor->platform_data->i2c_addr_alt) 1253 if (sensor->platform_data->i2c_addr_alt)
1260 smiapp_write(client, 1254 smiapp_write(sensor,
1261 SMIAPP_REG_U8_SOFTWARE_RESET, 1255 SMIAPP_REG_U8_SOFTWARE_RESET,
1262 SMIAPP_SOFTWARE_RESET); 1256 SMIAPP_SOFTWARE_RESET);
1263 1257
@@ -1315,7 +1309,7 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor)
1315 1309
1316 mutex_lock(&sensor->mutex); 1310 mutex_lock(&sensor->mutex);
1317 1311
1318 rval = smiapp_write(client, SMIAPP_REG_U16_CSI_DATA_FORMAT, 1312 rval = smiapp_write(sensor, SMIAPP_REG_U16_CSI_DATA_FORMAT,
1319 (sensor->csi_format->width << 8) | 1313 (sensor->csi_format->width << 8) |
1320 sensor->csi_format->compressed); 1314 sensor->csi_format->compressed);
1321 if (rval) 1315 if (rval)
@@ -1326,26 +1320,26 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor)
1326 goto out; 1320 goto out;
1327 1321
1328 /* Analog crop start coordinates */ 1322 /* Analog crop start coordinates */
1329 rval = smiapp_write(client, SMIAPP_REG_U16_X_ADDR_START, 1323 rval = smiapp_write(sensor, SMIAPP_REG_U16_X_ADDR_START,
1330 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].left); 1324 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].left);
1331 if (rval < 0) 1325 if (rval < 0)
1332 goto out; 1326 goto out;
1333 1327
1334 rval = smiapp_write(client, SMIAPP_REG_U16_Y_ADDR_START, 1328 rval = smiapp_write(sensor, SMIAPP_REG_U16_Y_ADDR_START,
1335 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].top); 1329 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].top);
1336 if (rval < 0) 1330 if (rval < 0)
1337 goto out; 1331 goto out;
1338 1332
1339 /* Analog crop end coordinates */ 1333 /* Analog crop end coordinates */
1340 rval = smiapp_write( 1334 rval = smiapp_write(
1341 client, SMIAPP_REG_U16_X_ADDR_END, 1335 sensor, SMIAPP_REG_U16_X_ADDR_END,
1342 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].left 1336 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].left
1343 + sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width - 1); 1337 + sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width - 1);
1344 if (rval < 0) 1338 if (rval < 0)
1345 goto out; 1339 goto out;
1346 1340
1347 rval = smiapp_write( 1341 rval = smiapp_write(
1348 client, SMIAPP_REG_U16_Y_ADDR_END, 1342 sensor, SMIAPP_REG_U16_Y_ADDR_END,
1349 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].top 1343 sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].top
1350 + sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height - 1); 1344 + sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height - 1);
1351 if (rval < 0) 1345 if (rval < 0)
@@ -1360,25 +1354,25 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor)
1360 if (sensor->limits[SMIAPP_LIMIT_DIGITAL_CROP_CAPABILITY] 1354 if (sensor->limits[SMIAPP_LIMIT_DIGITAL_CROP_CAPABILITY]
1361 == SMIAPP_DIGITAL_CROP_CAPABILITY_INPUT_CROP) { 1355 == SMIAPP_DIGITAL_CROP_CAPABILITY_INPUT_CROP) {
1362 rval = smiapp_write( 1356 rval = smiapp_write(
1363 client, SMIAPP_REG_U16_DIGITAL_CROP_X_OFFSET, 1357 sensor, SMIAPP_REG_U16_DIGITAL_CROP_X_OFFSET,
1364 sensor->scaler->crop[SMIAPP_PAD_SINK].left); 1358 sensor->scaler->crop[SMIAPP_PAD_SINK].left);
1365 if (rval < 0) 1359 if (rval < 0)
1366 goto out; 1360 goto out;
1367 1361
1368 rval = smiapp_write( 1362 rval = smiapp_write(
1369 client, SMIAPP_REG_U16_DIGITAL_CROP_Y_OFFSET, 1363 sensor, SMIAPP_REG_U16_DIGITAL_CROP_Y_OFFSET,
1370 sensor->scaler->crop[SMIAPP_PAD_SINK].top); 1364 sensor->scaler->crop[SMIAPP_PAD_SINK].top);
1371 if (rval < 0) 1365 if (rval < 0)
1372 goto out; 1366 goto out;
1373 1367
1374 rval = smiapp_write( 1368 rval = smiapp_write(
1375 client, SMIAPP_REG_U16_DIGITAL_CROP_IMAGE_WIDTH, 1369 sensor, SMIAPP_REG_U16_DIGITAL_CROP_IMAGE_WIDTH,
1376 sensor->scaler->crop[SMIAPP_PAD_SINK].width); 1370 sensor->scaler->crop[SMIAPP_PAD_SINK].width);
1377 if (rval < 0) 1371 if (rval < 0)
1378 goto out; 1372 goto out;
1379 1373
1380 rval = smiapp_write( 1374 rval = smiapp_write(
1381 client, SMIAPP_REG_U16_DIGITAL_CROP_IMAGE_HEIGHT, 1375 sensor, SMIAPP_REG_U16_DIGITAL_CROP_IMAGE_HEIGHT,
1382 sensor->scaler->crop[SMIAPP_PAD_SINK].height); 1376 sensor->scaler->crop[SMIAPP_PAD_SINK].height);
1383 if (rval < 0) 1377 if (rval < 0)
1384 goto out; 1378 goto out;
@@ -1387,23 +1381,23 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor)
1387 /* Scaling */ 1381 /* Scaling */
1388 if (sensor->limits[SMIAPP_LIMIT_SCALING_CAPABILITY] 1382 if (sensor->limits[SMIAPP_LIMIT_SCALING_CAPABILITY]
1389 != SMIAPP_SCALING_CAPABILITY_NONE) { 1383 != SMIAPP_SCALING_CAPABILITY_NONE) {
1390 rval = smiapp_write(client, SMIAPP_REG_U16_SCALING_MODE, 1384 rval = smiapp_write(sensor, SMIAPP_REG_U16_SCALING_MODE,
1391 sensor->scaling_mode); 1385 sensor->scaling_mode);
1392 if (rval < 0) 1386 if (rval < 0)
1393 goto out; 1387 goto out;
1394 1388
1395 rval = smiapp_write(client, SMIAPP_REG_U16_SCALE_M, 1389 rval = smiapp_write(sensor, SMIAPP_REG_U16_SCALE_M,
1396 sensor->scale_m); 1390 sensor->scale_m);
1397 if (rval < 0) 1391 if (rval < 0)
1398 goto out; 1392 goto out;
1399 } 1393 }
1400 1394
1401 /* Output size from sensor */ 1395 /* Output size from sensor */
1402 rval = smiapp_write(client, SMIAPP_REG_U16_X_OUTPUT_SIZE, 1396 rval = smiapp_write(sensor, SMIAPP_REG_U16_X_OUTPUT_SIZE,
1403 sensor->src->crop[SMIAPP_PAD_SRC].width); 1397 sensor->src->crop[SMIAPP_PAD_SRC].width);
1404 if (rval < 0) 1398 if (rval < 0)
1405 goto out; 1399 goto out;
1406 rval = smiapp_write(client, SMIAPP_REG_U16_Y_OUTPUT_SIZE, 1400 rval = smiapp_write(sensor, SMIAPP_REG_U16_Y_OUTPUT_SIZE,
1407 sensor->src->crop[SMIAPP_PAD_SRC].height); 1401 sensor->src->crop[SMIAPP_PAD_SRC].height);
1408 if (rval < 0) 1402 if (rval < 0)
1409 goto out; 1403 goto out;
@@ -1424,7 +1418,7 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor)
1424 goto out; 1418 goto out;
1425 } 1419 }
1426 1420
1427 rval = smiapp_write(client, SMIAPP_REG_U8_MODE_SELECT, 1421 rval = smiapp_write(sensor, SMIAPP_REG_U8_MODE_SELECT,
1428 SMIAPP_MODE_SELECT_STREAMING); 1422 SMIAPP_MODE_SELECT_STREAMING);
1429 1423
1430out: 1424out:
@@ -1439,7 +1433,7 @@ static int smiapp_stop_streaming(struct smiapp_sensor *sensor)
1439 int rval; 1433 int rval;
1440 1434
1441 mutex_lock(&sensor->mutex); 1435 mutex_lock(&sensor->mutex);
1442 rval = smiapp_write(client, SMIAPP_REG_U8_MODE_SELECT, 1436 rval = smiapp_write(sensor, SMIAPP_REG_U8_MODE_SELECT,
1443 SMIAPP_MODE_SELECT_SOFTWARE_STANDBY); 1437 SMIAPP_MODE_SELECT_SOFTWARE_STANDBY);
1444 if (rval) 1438 if (rval)
1445 goto out; 1439 goto out;
@@ -2203,50 +2197,50 @@ static int smiapp_identify_module(struct v4l2_subdev *subdev)
2203 minfo->name = SMIAPP_NAME; 2197 minfo->name = SMIAPP_NAME;
2204 2198
2205 /* Module info */ 2199 /* Module info */
2206 rval = smiapp_read(client, SMIAPP_REG_U8_MANUFACTURER_ID, 2200 rval = smiapp_read(sensor, SMIAPP_REG_U8_MANUFACTURER_ID,
2207 &minfo->manufacturer_id); 2201 &minfo->manufacturer_id);
2208 if (!rval) 2202 if (!rval)
2209 rval = smiapp_read(client, SMIAPP_REG_U16_MODEL_ID, 2203 rval = smiapp_read(sensor, SMIAPP_REG_U16_MODEL_ID,
2210 &minfo->model_id); 2204 &minfo->model_id);
2211 if (!rval) 2205 if (!rval)
2212 rval = smiapp_read(client, SMIAPP_REG_U8_REVISION_NUMBER_MAJOR, 2206 rval = smiapp_read(sensor, SMIAPP_REG_U8_REVISION_NUMBER_MAJOR,
2213 &minfo->revision_number_major); 2207 &minfo->revision_number_major);
2214 if (!rval) 2208 if (!rval)
2215 rval = smiapp_read(client, SMIAPP_REG_U8_REVISION_NUMBER_MINOR, 2209 rval = smiapp_read(sensor, SMIAPP_REG_U8_REVISION_NUMBER_MINOR,
2216 &minfo->revision_number_minor); 2210 &minfo->revision_number_minor);
2217 if (!rval) 2211 if (!rval)
2218 rval = smiapp_read(client, SMIAPP_REG_U8_MODULE_DATE_YEAR, 2212 rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_YEAR,
2219 &minfo->module_year); 2213 &minfo->module_year);
2220 if (!rval) 2214 if (!rval)
2221 rval = smiapp_read(client, SMIAPP_REG_U8_MODULE_DATE_MONTH, 2215 rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_MONTH,
2222 &minfo->module_month); 2216 &minfo->module_month);
2223 if (!rval) 2217 if (!rval)
2224 rval = smiapp_read(client, SMIAPP_REG_U8_MODULE_DATE_DAY, 2218 rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_DAY,
2225 &minfo->module_day); 2219 &minfo->module_day);
2226 2220
2227 /* Sensor info */ 2221 /* Sensor info */
2228 if (!rval) 2222 if (!rval)
2229 rval = smiapp_read(client, 2223 rval = smiapp_read(sensor,
2230 SMIAPP_REG_U8_SENSOR_MANUFACTURER_ID, 2224 SMIAPP_REG_U8_SENSOR_MANUFACTURER_ID,
2231 &minfo->sensor_manufacturer_id); 2225 &minfo->sensor_manufacturer_id);
2232 if (!rval) 2226 if (!rval)
2233 rval = smiapp_read(client, SMIAPP_REG_U16_SENSOR_MODEL_ID, 2227 rval = smiapp_read(sensor, SMIAPP_REG_U16_SENSOR_MODEL_ID,
2234 &minfo->sensor_model_id); 2228 &minfo->sensor_model_id);
2235 if (!rval) 2229 if (!rval)
2236 rval = smiapp_read(client, 2230 rval = smiapp_read(sensor,
2237 SMIAPP_REG_U8_SENSOR_REVISION_NUMBER, 2231 SMIAPP_REG_U8_SENSOR_REVISION_NUMBER,
2238 &minfo->sensor_revision_number); 2232 &minfo->sensor_revision_number);
2239 if (!rval) 2233 if (!rval)
2240 rval = smiapp_read(client, 2234 rval = smiapp_read(sensor,
2241 SMIAPP_REG_U8_SENSOR_FIRMWARE_VERSION, 2235 SMIAPP_REG_U8_SENSOR_FIRMWARE_VERSION,
2242 &minfo->sensor_firmware_version); 2236 &minfo->sensor_firmware_version);
2243 2237
2244 /* SMIA */ 2238 /* SMIA */
2245 if (!rval) 2239 if (!rval)
2246 rval = smiapp_read(client, SMIAPP_REG_U8_SMIA_VERSION, 2240 rval = smiapp_read(sensor, SMIAPP_REG_U8_SMIA_VERSION,
2247 &minfo->smia_version); 2241 &minfo->smia_version);
2248 if (!rval) 2242 if (!rval)
2249 rval = smiapp_read(client, SMIAPP_REG_U8_SMIAPP_VERSION, 2243 rval = smiapp_read(sensor, SMIAPP_REG_U8_SMIAPP_VERSION,
2250 &minfo->smiapp_version); 2244 &minfo->smiapp_version);
2251 2245
2252 if (rval) { 2246 if (rval) {
@@ -2415,7 +2409,7 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
2415 if (sensor->limits[SMIAPP_LIMIT_BINNING_CAPABILITY]) { 2409 if (sensor->limits[SMIAPP_LIMIT_BINNING_CAPABILITY]) {
2416 u32 val; 2410 u32 val;
2417 2411
2418 rval = smiapp_read(client, 2412 rval = smiapp_read(sensor,
2419 SMIAPP_REG_U8_BINNING_SUBTYPES, &val); 2413 SMIAPP_REG_U8_BINNING_SUBTYPES, &val);
2420 if (rval < 0) { 2414 if (rval < 0) {
2421 rval = -ENODEV; 2415 rval = -ENODEV;
@@ -2426,7 +2420,7 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
2426 2420
2427 for (i = 0; i < sensor->nbinning_subtypes; i++) { 2421 for (i = 0; i < sensor->nbinning_subtypes; i++) {
2428 rval = smiapp_read( 2422 rval = smiapp_read(
2429 client, SMIAPP_REG_U8_BINNING_TYPE_n(i), &val); 2423 sensor, SMIAPP_REG_U8_BINNING_TYPE_n(i), &val);
2430 if (rval < 0) { 2424 if (rval < 0) {
2431 rval = -ENODEV; 2425 rval = -ENODEV;
2432 goto out_power_off; 2426 goto out_power_off;
@@ -2600,7 +2594,7 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
2600 sensor->dev_init_done = true; 2594 sensor->dev_init_done = true;
2601 2595
2602 /* check flash capability */ 2596 /* check flash capability */
2603 rval = smiapp_read(client, SMIAPP_REG_U8_FLASH_MODE_CAPABILITY, &tmp); 2597 rval = smiapp_read(sensor, SMIAPP_REG_U8_FLASH_MODE_CAPABILITY, &tmp);
2604 sensor->flash_capability = tmp; 2598 sensor->flash_capability = tmp;
2605 if (rval) 2599 if (rval)
2606 goto out_nvm_release; 2600 goto out_nvm_release;
diff --git a/drivers/media/video/smiapp/smiapp-quirk.c b/drivers/media/video/smiapp/smiapp-quirk.c
index fb018de4bfa8..81c2be3d47cb 100644
--- a/drivers/media/video/smiapp/smiapp-quirk.c
+++ b/drivers/media/video/smiapp/smiapp-quirk.c
@@ -28,9 +28,7 @@
28 28
29static int smiapp_write_8(struct smiapp_sensor *sensor, u16 reg, u8 val) 29static int smiapp_write_8(struct smiapp_sensor *sensor, u16 reg, u8 val)
30{ 30{
31 struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); 31 return smiapp_write(sensor, (SMIA_REG_8BIT << 16) | reg, val);
32
33 return smiapp_write(client, (SMIA_REG_8BIT << 16) | reg, val);
34} 32}
35 33
36static int smiapp_write_8s(struct smiapp_sensor *sensor, 34static int smiapp_write_8s(struct smiapp_sensor *sensor,
diff --git a/drivers/media/video/smiapp/smiapp-regs.c b/drivers/media/video/smiapp/smiapp-regs.c
index a5055f18091f..e5e5f4356dd2 100644
--- a/drivers/media/video/smiapp/smiapp-regs.c
+++ b/drivers/media/video/smiapp/smiapp-regs.c
@@ -25,6 +25,7 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27 27
28#include "smiapp.h"
28#include "smiapp-regs.h" 29#include "smiapp-regs.h"
29 30
30static uint32_t float_to_u32_mul_1000000(struct i2c_client *client, 31static uint32_t float_to_u32_mul_1000000(struct i2c_client *client,
@@ -77,8 +78,9 @@ static uint32_t float_to_u32_mul_1000000(struct i2c_client *client,
77 * Read a 8/16/32-bit i2c register. The value is returned in 'val'. 78 * Read a 8/16/32-bit i2c register. The value is returned in 'val'.
78 * Returns zero if successful, or non-zero otherwise. 79 * Returns zero if successful, or non-zero otherwise.
79 */ 80 */
80int smiapp_read(struct i2c_client *client, u32 reg, u32 *val) 81int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val)
81{ 82{
83 struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
82 struct i2c_msg msg; 84 struct i2c_msg msg;
83 unsigned char data[4]; 85 unsigned char data[4];
84 unsigned int len = (u8)(reg >> 16); 86 unsigned int len = (u8)(reg >> 16);
@@ -145,8 +147,9 @@ err:
145 * Write to a 8/16-bit register. 147 * Write to a 8/16-bit register.
146 * Returns zero if successful, or non-zero otherwise. 148 * Returns zero if successful, or non-zero otherwise.
147 */ 149 */
148int smiapp_write(struct i2c_client *client, u32 reg, u32 val) 150int smiapp_write(struct smiapp_sensor *sensor, u32 reg, u32 val)
149{ 151{
152 struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
150 struct i2c_msg msg; 153 struct i2c_msg msg;
151 unsigned char data[6]; 154 unsigned char data[6];
152 unsigned int retries; 155 unsigned int retries;
diff --git a/drivers/media/video/smiapp/smiapp-regs.h b/drivers/media/video/smiapp/smiapp-regs.h
index 58e8009d4aa5..1edfd206fb76 100644
--- a/drivers/media/video/smiapp/smiapp-regs.h
+++ b/drivers/media/video/smiapp/smiapp-regs.h
@@ -40,7 +40,9 @@ struct smia_reg {
40 u32 val; /* 8/16/32-bit value */ 40 u32 val; /* 8/16/32-bit value */
41}; 41};
42 42
43int smiapp_read(struct i2c_client *client, u32 reg, u32 *val); 43struct smiapp_sensor;
44int smiapp_write(struct i2c_client *client, u32 reg, u32 val); 44
45int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val);
46int smiapp_write(struct smiapp_sensor *sensor, u32 reg, u32 val);
45 47
46#endif 48#endif