Skip to contentSkip to conversation

UPSTREAM: media: ov8856: skip OTP read in non-zero ACPI D state

PATCH Superseded Jimmy Su 2 participants 2 messages May 10, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jimmy Su

author
#0 lore raw

PATCH 1/1 UPSTREAM: media: ov8856: skip OTP read in non-zero ACPI D state

To skip OTP read function while enable non-zero ACPI D state. This OTP read only influences streaming output with 3280x2464 & 1640x1232 resolution.

---
 drivers/media/i2c/ov8856.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/media/i2c/ov8856.c +15 -1
index 8785764b7a74..bbab0ac91edf 100644
@@ -1448,6 +1448,9 @@ struct ov8856 {
 
 	/* True if the device has been identified */
 	bool identified;
+
+	/* True for skipping otp read */
+	bool acpi_skip_otp;
 };
 
 struct ov8856_lane_cfg {
@@ -1692,7 +1695,7 @@ static int ov8856_identify_module(struct ov8856 *ov8856)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd);
 	int ret;
-	u32 val;
+	u32 val, width;
 
 	if (ov8856->identified)
 		return 0;
@@ -1708,6 +1711,10 @@ static int ov8856_identify_module(struct ov8856 *ov8856)
 		return -ENXIO;
 	}
 
+	width = ov8856->cur_mode->width;
+	if (ov8856->acpi_skip_otp & (width == 3280 | width == 1640))
+		goto otp_skip;
+
 	ret = ov8856_write_reg(ov8856, OV8856_REG_MODE_SELECT,
 			       OV8856_REG_VALUE_08BIT, OV8856_MODE_STREAMING);
 	if (ret)
@@ -1750,6 +1757,11 @@ static int ov8856_identify_module(struct ov8856 *ov8856)
 
 	ov8856->identified = true;
 
+	return 0;
+
+otp_skip:
+	ov8856->identified = true;
+
 	return 0;
 }
 
@@ -2499,6 +2511,8 @@ static int ov8856_probe(struct i2c_client *client)
 			dev_err(&client->dev, "failed to find sensor: %d", ret);
 			goto probe_power_off;
 		}
+	} else {
+		ov8856->acpi_skip_otp = true;
 	}
 
 	mutex_init(&ov8856->mutex);
Signature · 1 line
2.17.1
#1 lore raw
I love your patch! Perhaps something to improve:

Hi Jimmy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on media-tree/master]
[also build test WARNING on v5.18-rc6 next-20220509]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Jimmy-Su/UPSTREAM-media-ov8856-skip-OTP-read-in-non-zero-ACPI-D-state/20220510-161148
base:   git://linuxtv.org/media_tree.git master
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220510/[email protected]/config)
compiler: arceb-elf-gcc (GCC) 11.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/7c73f80b49c8ffc328209b21fa3c85ac8b9295d2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jimmy-Su/UPSTREAM-media-ov8856-skip-OTP-read-in-non-zero-ACPI-D-state/20220510-161148 git checkout 7c73f80b49c8ffc328209b21fa3c85ac8b9295d2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/media/i2c/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

drivers/media/i2c/ov8856.c: In function 'ov8856_identify_module':

>> drivers/media/i2c/ov8856.c:1715:44: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
    1715 |         if (ov8856->acpi_skip_otp & (width == 3280 | width == 1640))
         |                                      ~~~~~~^~~~~~~

vim +1715 drivers/media/i2c/ov8856.c

1693
1694 static int ov8856_identify_module(struct ov8856 *ov8856)
1695 {
1696 struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd);
1697 int ret;
1698 u32 val, width;
1699
1700 if (ov8856->identified)
1701 return 0;
1702
1703 ret = ov8856_read_reg(ov8856, OV8856_REG_CHIP_ID,
1704 OV8856_REG_VALUE_24BIT, &val);
1705 if (ret)
1706 return ret;
1707
1708 if (val != OV8856_CHIP_ID) {
1709 dev_err(&client->dev, "chip id mismatch: %x!=%x",
1710 OV8856_CHIP_ID, val);
1711 return -ENXIO;
1712 }
1713
1714 width = ov8856->cur_mode->width;

> 1715		if (ov8856->acpi_skip_otp & (width == 3280 | width == 1640))

1716 goto otp_skip;
1717
1718 ret = ov8856_write_reg(ov8856, OV8856_REG_MODE_SELECT,
1719 OV8856_REG_VALUE_08BIT, OV8856_MODE_STREAMING);
1720 if (ret)
1721 return ret;
1722
1723 ret = ov8856_write_reg(ov8856, OV8856_OTP_MODE_CTRL,
1724 OV8856_REG_VALUE_08BIT, OV8856_OTP_MODE_AUTO);
1725 if (ret) {
1726 dev_err(&client->dev, "failed to set otp mode");
1727 return ret;
1728 }
1729
1730 ret = ov8856_write_reg(ov8856, OV8856_OTP_LOAD_CTRL,
1731 OV8856_REG_VALUE_08BIT,
1732 OV8856_OTP_LOAD_CTRL_ENABLE);
1733 if (ret) {
1734 dev_err(&client->dev, "failed to enable load control");
1735 return ret;
1736 }
1737
1738 ret = ov8856_read_reg(ov8856, OV8856_MODULE_REVISION,
1739 OV8856_REG_VALUE_08BIT, &val);
1740 if (ret) {
1741 dev_err(&client->dev, "failed to read module revision");
1742 return ret;
1743 }
1744
1745 dev_info(&client->dev, "OV8856 revision %x (%s) at address 0x%02x\n",
1746 val,
1747 val == OV8856_2A_MODULE ? "2A" :
1748 val == OV8856_1B_MODULE ? "1B" : "unknown revision",
1749 client->addr);
1750
1751 ret = ov8856_write_reg(ov8856, OV8856_REG_MODE_SELECT,
1752 OV8856_REG_VALUE_08BIT, OV8856_MODE_STANDBY);
1753 if (ret) {
1754 dev_err(&client->dev, "failed to exit streaming mode");
1755 return ret;
1756 }
1757
1758 ov8856->identified = true;
1759
1760 return 0;
1761
1762 otp_skip:
1763 ov8856->identified = true;
1764
1765 return 0;
1766 }
1767

Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp