Merge commit '51a874510a351b4417b2b0d1ec9ca743118ecb49'

* commit '51a874510a351b4417b2b0d1ec9ca743118ecb49':
  arm64: dts: rockchip: rk3576-evb2: fix es8388 sound card config
  media: i2c: ov16880: fix gain ctrl

Change-Id: Ib3bc514b0a6b41cca4e3457da963533511cfa340
This commit is contained in:
Tao Huang
2024-07-12 19:17:19 +08:00
2 changed files with 35 additions and 8 deletions

View File

@@ -16,7 +16,7 @@
status = "okay";
compatible = "rockchip,multicodecs-card";
rockchip,card-name = "rockchip-es8388";
hp-det-gpio = <&gpio0 RK_PD3 GPIO_ACTIVE_LOW>;
hp-det-gpio = <&gpio1 RK_PD5 GPIO_ACTIVE_LOW>;
io-channels = <&saradc 3>;
io-channel-names = "adc-detect";
keyup-threshold-microvolt = <1800000>;
@@ -415,6 +415,8 @@
&sai1 {
status = "okay";
rockchip,sai-rx-route = <1 0 2 3>;
rockchip,sai-tx-route = <1 0 2 3>;
pinctrl-names = "default";
pinctrl-0 = <&sai1m0_lrck
&sai1m0_sclk
@@ -505,7 +507,7 @@
headphone {
hp_det: hp-det {
rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>;
};
};

View File

@@ -57,8 +57,8 @@
#define OV16880_AGAIN_REG_H 0x350A
#define OV16880_AGAIN_REG_L 0x350B
#define OV16880_SF_AGAIN_REG_H 0x350C
#define OV16880_SF_AGAIN_REG_L 0x350D
#define OV16880_SF_AGAIN_REG_H 0x350E
#define OV16880_SF_AGAIN_REG_L 0x350F
#define OV16880_GAIN_H_MASK 0x1f
#define OV16880_GAIN_H_SHIFT 8
@@ -2428,6 +2428,34 @@ static const struct v4l2_subdev_ops ov16880_subdev_ops = {
.pad = &ov16880_pad_ops,
};
static int ov16880_set_gain_reg(struct ov16880 *ov16880, u32 a_gain)
{
int ret = 0;
ret = ov16880_write_reg(ov16880->client,
OV16880_GROUP_UPDATE_ADDRESS,
OV16880_REG_VALUE_08BIT,
OV16880_GROUP_UPDATE_START_DATA);
ret |= ov16880_write_reg(ov16880->client,
OV16880_SF_AGAIN_REG_H,
OV16880_REG_VALUE_16BIT,
a_gain & 0x7ff);
ret |= ov16880_write_reg(ov16880->client,
OV16880_AGAIN_REG_H,
OV16880_REG_VALUE_16BIT,
a_gain & 0x7ff);
ret |= ov16880_write_reg(ov16880->client,
OV16880_GROUP_UPDATE_ADDRESS,
OV16880_REG_VALUE_08BIT,
OV16880_GROUP_UPDATE_END_DATA);
ret |= ov16880_write_reg(ov16880->client,
OV16880_GROUP_UPDATE_ADDRESS,
OV16880_REG_VALUE_08BIT,
OV16880_GROUP_UPDATE_LAUNCH);
return ret;
};
static int ov16880_set_ctrl(struct v4l2_ctrl *ctrl)
{
struct ov16880 *ov16880 = container_of(ctrl->handler,
@@ -2463,10 +2491,7 @@ static int ov16880_set_ctrl(struct v4l2_ctrl *ctrl)
ctrl->val);
break;
case V4L2_CID_ANALOGUE_GAIN:
ret = ov16880_write_reg(ov16880->client,
OV16880_AGAIN_REG_H,
OV16880_REG_VALUE_16BIT,
ctrl->val & 0x7ff);
ret = ov16880_set_gain_reg(ov16880, ctrl->val);
dev_dbg(&client->dev, "set analog gain value 0x%x\n", ctrl->val);
break;
case V4L2_CID_VBLANK: