platform/x86/sony-laptop: Remove unused sony laptop camera code
authorDr. David Alan Gilbert <linux@treblig.org>
Mon, 5 May 2025 15:25:58 +0000 (16:25 +0100)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 8 May 2025 13:04:11 +0000 (16:04 +0300)
commit ba47652ba655 ("media: meye: remove this deprecated driver")
removed the meye driver but left behind the code in sony-laptop.c
which that driver used to call.

Remove the sony_pic_camera_command() function, and the set of
defines (SONY_PIC_COMMAND_*) in a header used for the interface
and the static helpers it called.

Cleanup remaining #defines.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250505152558.40526-1-linux@treblig.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
MAINTAINERS
drivers/platform/x86/sony-laptop.c
include/linux/sony-laptop.h [deleted file]

index 49adae693221687341b57b342cff60e93ec83be6..f9417b4e9bafd1a4033bba2fdb4a4e6fb68cf219 100644 (file)
@@ -22597,7 +22597,6 @@ W:      http://www.linux.it/~malattia/wiki/index.php/Sony_drivers
 F:     Documentation/admin-guide/laptops/sony-laptop.rst
 F:     drivers/char/sonypi.c
 F:     drivers/platform/x86/sony-laptop.c
-F:     include/linux/sony-laptop.h
 
 SOPHGO DEVICETREES and DRIVERS
 M:     Chen Wang <unicorn_wang@outlook.com>
index 492c275ba9acd46d23ac7aabe5bd986f2cd96dd1..56beebc38850cfdd56aa78342c84554c285c1719 100644 (file)
@@ -48,7 +48,6 @@
 #include <linux/acpi.h>
 #include <linux/slab.h>
 #include <linux/sonypi.h>
-#include <linux/sony-laptop.h>
 #include <linux/rfkill.h>
 #ifdef CONFIG_SONYPI_COMPAT
 #include <linux/poll.h>
@@ -3621,22 +3620,6 @@ static u8 sony_pic_call2(u8 dev, u8 fn)
        return v1;
 }
 
-static u8 sony_pic_call3(u8 dev, u8 fn, u8 v)
-{
-       u8 v1;
-
-       wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
-       outb(dev, spic_dev.cur_ioport->io1.minimum + 4);
-       wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
-       outb(fn, spic_dev.cur_ioport->io1.minimum);
-       wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
-       outb(v, spic_dev.cur_ioport->io1.minimum);
-       v1 = inb_p(spic_dev.cur_ioport->io1.minimum);
-       dprintk("sony_pic_call3(0x%.2x - 0x%.2x - 0x%.2x): 0x%.4x\n",
-                       dev, fn, v, v1);
-       return v1;
-}
-
 /*
  * minidrivers for SPIC models
  */
@@ -3724,156 +3707,6 @@ out:
                dev->model == SONYPI_DEVICE_TYPE2 ? 2 : 3);
 }
 
-/* camera tests and poweron/poweroff */
-#define SONYPI_CAMERA_PICTURE          5
-#define SONYPI_CAMERA_CONTROL          0x10
-
-#define SONYPI_CAMERA_BRIGHTNESS               0
-#define SONYPI_CAMERA_CONTRAST                 1
-#define SONYPI_CAMERA_HUE                      2
-#define SONYPI_CAMERA_COLOR                    3
-#define SONYPI_CAMERA_SHARPNESS                        4
-
-#define SONYPI_CAMERA_EXPOSURE_MASK            0xC
-#define SONYPI_CAMERA_WHITE_BALANCE_MASK       0x3
-#define SONYPI_CAMERA_PICTURE_MODE_MASK                0x30
-#define SONYPI_CAMERA_MUTE_MASK                        0x40
-
-/* the rest don't need a loop until not 0xff */
-#define SONYPI_CAMERA_AGC                      6
-#define SONYPI_CAMERA_AGC_MASK                 0x30
-#define SONYPI_CAMERA_SHUTTER_MASK             0x7
-
-#define SONYPI_CAMERA_SHUTDOWN_REQUEST         7
-#define SONYPI_CAMERA_CONTROL                  0x10
-
-#define SONYPI_CAMERA_STATUS                   7
-#define SONYPI_CAMERA_STATUS_READY             0x2
-#define SONYPI_CAMERA_STATUS_POSITION          0x4
-
-#define SONYPI_DIRECTION_BACKWARDS             0x4
-
-#define SONYPI_CAMERA_REVISION                         8
-#define SONYPI_CAMERA_ROMVERSION               9
-
-static int __sony_pic_camera_ready(void)
-{
-       u8 v;
-
-       v = sony_pic_call2(0x8f, SONYPI_CAMERA_STATUS);
-       return (v != 0xff && (v & SONYPI_CAMERA_STATUS_READY));
-}
-
-static int __sony_pic_camera_off(void)
-{
-       if (!camera) {
-               pr_warn("camera control not enabled\n");
-               return -ENODEV;
-       }
-
-       wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE,
-                               SONYPI_CAMERA_MUTE_MASK),
-                       ITERATIONS_SHORT);
-
-       if (spic_dev.camera_power) {
-               sony_pic_call2(0x91, 0);
-               spic_dev.camera_power = 0;
-       }
-       return 0;
-}
-
-static int __sony_pic_camera_on(void)
-{
-       int i, j, x;
-
-       if (!camera) {
-               pr_warn("camera control not enabled\n");
-               return -ENODEV;
-       }
-
-       if (spic_dev.camera_power)
-               return 0;
-
-       for (j = 5; j > 0; j--) {
-
-               for (x = 0; x < 100 && sony_pic_call2(0x91, 0x1); x++)
-                       msleep(10);
-               sony_pic_call1(0x93);
-
-               for (i = 400; i > 0; i--) {
-                       if (__sony_pic_camera_ready())
-                               break;
-                       msleep(10);
-               }
-               if (i)
-                       break;
-       }
-
-       if (j == 0) {
-               pr_warn("failed to power on camera\n");
-               return -ENODEV;
-       }
-
-       wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTROL,
-                               0x5a),
-                       ITERATIONS_SHORT);
-
-       spic_dev.camera_power = 1;
-       return 0;
-}
-
-/* External camera command (exported to the motion eye v4l driver) */
-int sony_pic_camera_command(int command, u8 value)
-{
-       if (!camera)
-               return -EIO;
-
-       mutex_lock(&spic_dev.lock);
-
-       switch (command) {
-       case SONY_PIC_COMMAND_SETCAMERA:
-               if (value)
-                       __sony_pic_camera_on();
-               else
-                       __sony_pic_camera_off();
-               break;
-       case SONY_PIC_COMMAND_SETCAMERABRIGHTNESS:
-               wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_BRIGHTNESS, value),
-                               ITERATIONS_SHORT);
-               break;
-       case SONY_PIC_COMMAND_SETCAMERACONTRAST:
-               wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTRAST, value),
-                               ITERATIONS_SHORT);
-               break;
-       case SONY_PIC_COMMAND_SETCAMERAHUE:
-               wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_HUE, value),
-                               ITERATIONS_SHORT);
-               break;
-       case SONY_PIC_COMMAND_SETCAMERACOLOR:
-               wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_COLOR, value),
-                               ITERATIONS_SHORT);
-               break;
-       case SONY_PIC_COMMAND_SETCAMERASHARPNESS:
-               wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_SHARPNESS, value),
-                               ITERATIONS_SHORT);
-               break;
-       case SONY_PIC_COMMAND_SETCAMERAPICTURE:
-               wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE, value),
-                               ITERATIONS_SHORT);
-               break;
-       case SONY_PIC_COMMAND_SETCAMERAAGC:
-               wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_AGC, value),
-                               ITERATIONS_SHORT);
-               break;
-       default:
-               pr_err("sony_pic_camera_command invalid: %d\n", command);
-               break;
-       }
-       mutex_unlock(&spic_dev.lock);
-       return 0;
-}
-EXPORT_SYMBOL(sony_pic_camera_command);
-
 /* gprs/edge modem (SZ460N and SZ210P), thanks to Joshua Wise */
 static void __sony_pic_set_wwanpower(u8 state)
 {
diff --git a/include/linux/sony-laptop.h b/include/linux/sony-laptop.h
deleted file mode 100644 (file)
index 1e3c92f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _SONYLAPTOP_H_
-#define _SONYLAPTOP_H_
-
-#include <linux/types.h>
-
-#ifdef __KERNEL__
-
-/* used only for communication between v4l and sony-laptop */
-
-#define SONY_PIC_COMMAND_GETCAMERA              1      /* obsolete */
-#define SONY_PIC_COMMAND_SETCAMERA              2
-#define SONY_PIC_COMMAND_GETCAMERABRIGHTNESS    3      /* obsolete */
-#define SONY_PIC_COMMAND_SETCAMERABRIGHTNESS    4
-#define SONY_PIC_COMMAND_GETCAMERACONTRAST      5      /* obsolete */
-#define SONY_PIC_COMMAND_SETCAMERACONTRAST      6
-#define SONY_PIC_COMMAND_GETCAMERAHUE           7      /* obsolete */
-#define SONY_PIC_COMMAND_SETCAMERAHUE           8
-#define SONY_PIC_COMMAND_GETCAMERACOLOR                 9      /* obsolete */
-#define SONY_PIC_COMMAND_SETCAMERACOLOR                10
-#define SONY_PIC_COMMAND_GETCAMERASHARPNESS    11      /* obsolete */
-#define SONY_PIC_COMMAND_SETCAMERASHARPNESS    12
-#define SONY_PIC_COMMAND_GETCAMERAPICTURE      13      /* obsolete */
-#define SONY_PIC_COMMAND_SETCAMERAPICTURE      14
-#define SONY_PIC_COMMAND_GETCAMERAAGC          15      /* obsolete */
-#define SONY_PIC_COMMAND_SETCAMERAAGC          16
-#define SONY_PIC_COMMAND_GETCAMERADIRECTION    17      /* obsolete */
-#define SONY_PIC_COMMAND_GETCAMERAROMVERSION   18      /* obsolete */
-#define SONY_PIC_COMMAND_GETCAMERAREVISION     19      /* obsolete */
-
-#if IS_ENABLED(CONFIG_SONY_LAPTOP)
-int sony_pic_camera_command(int command, u8 value);
-#else
-static inline int sony_pic_camera_command(int command, u8 value) { return 0; }
-#endif
-
-#endif /* __KERNEL__ */
-
-#endif /* _SONYLAPTOP_H_ */